1234567891011121314151617type RpcParam = {18 name: string;19 type: string;20 isOptional?: true;21};2223const CROSS_ACCOUNT_ID_TYPE = 'PalletEvmAccountBasicCrossAccountIdRepr';2425const collectionParam = {name: 'collection', type: 'u32'};26const tokenParam = {name: 'tokenId', type: 'u32'};27const propertyKeysParam = {name: 'propertyKeys', type: 'Vec<String>', isOptional: true};28const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});29const atParam = {name: 'at', type: 'Hash', isOptional: true};3031const fun = (description: string, params: RpcParam[], type: string) => ({32 description,33 params: [...params, atParam],34 type,35});3637export default {38 types: {},39 rpc: {40 adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),41 allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),4243 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),44 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),4546 lastTokenId: fun('Get last token id', [collectionParam], 'u32'),47 totalSupply: fun('Get amount of unique collection tokens', [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], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),52 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),53 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),54 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),55 collectionProperties: fun(56 'Get collection properties',57 [collectionParam, propertyKeysParam],58 'Vec<UpDataStructsProperty>',59 ),60 tokenProperties: fun(61 'Get token properties',62 [collectionParam, tokenParam, propertyKeysParam],63 'Vec<UpDataStructsProperty>',64 ),65 propertyPermissions: fun(66 'Get property permissions',67 [collectionParam, propertyKeysParam],68 'Vec<UpDataStructsPropertyKeyPermission>',69 ),70 tokenData: fun(71 'Get token data',72 [collectionParam, tokenParam, propertyKeysParam],73 'UpDataStructsTokenData',74 ),75 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),76 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),77 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),78 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),79 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),80 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),81 },82};