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 propertyKeysParam = {name: 'propertyKeys', type: 'Vec<String>'};30const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});31const atParam = {name: 'at', type: 'Hash', isOptional: true};3233const fun = (description: string, params: RpcParam[], type: string) => ({34 description,35 params: [...params, atParam],36 type,37});3839export default {40 types,41 rpc: {42 adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),43 allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),4445 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),46 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),4748 lastTokenId: fun('Get last token id', [collectionParam], 'u32'),49 totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),50 accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),51 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),52 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),53 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),54 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),55 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),56 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),5758 collectionProperties: fun(59 'Get collection properties',60 [collectionParam, propertyKeysParam],61 'Vec<UpDataStructsProperty>',62 ),6364 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),65 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),66 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),67 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),68 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),69 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),70 },71};