1234567891011121314151617import types from '../lookup';1819type RpcParam = {20 name: string;21 type: string;22 isOptional?: true;23};2425const CROSS_ACCOUNT_ID_TYPE = 'PalletEvmAccountBasicCrossAccountIdRepr';2627const collectionParam = {name: 'collection', type: 'u32'};28const tokenParam = {name: 'tokenId', type: 'u32'};29const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});30const atParam = {name: 'at', type: 'Hash', isOptional: true};3132const fun = (description: string, params: RpcParam[], type: string) => ({33 description,34 params: [...params, atParam],35 type,36});3738export default {39 types,40 rpc: {41 adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),42 allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),4344 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),45 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),4647 lastTokenId: fun('Get last token id', [collectionParam], 'u32'),48 accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),49 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], CROSS_ACCOUNT_ID_TYPE),52 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),53 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),54 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),55 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),56 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),57 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),58 },59};