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 accountTokens: fun(41 'Get tokens owned by an account in a collection', 42 [collectionParam, crossAccountParam()], 43 'Vec<u32>',44 ),45 collectionTokens: fun(46 'Get tokens contained within a collection', 47 [collectionParam], 48 'Vec<u32>',49 ),50 tokenExists: fun(51 'Check if the token exists', 52 [collectionParam, tokenParam], 53 'bool',54 ),5556 tokenOwner: fun(57 'Get the token owner', 58 [collectionParam, tokenParam], 59 `Option<${CROSS_ACCOUNT_ID_TYPE}>`,60 ),61 topmostTokenOwner: fun(62 'Get the topmost token owner in the hierarchy of a possibly nested token', 63 [collectionParam, tokenParam], 64 `Option<${CROSS_ACCOUNT_ID_TYPE}>`,65 ),66 tokenChildren: fun(67 'Get tokens nested directly into the token', 68 [collectionParam, tokenParam], 69 'Vec<UpDataStructsTokenChild>',70 ),7172 collectionProperties: fun(73 'Get collection properties, optionally limited to the provided keys',74 [collectionParam, propertyKeysParam],75 'Vec<UpDataStructsProperty>',76 ),77 tokenProperties: fun(78 'Get token properties, optionally limited to the provided keys',79 [collectionParam, tokenParam, propertyKeysParam],80 'Vec<UpDataStructsProperty>',81 ),82 propertyPermissions: fun(83 'Get property permissions, optionally limited to the provided keys',84 [collectionParam, propertyKeysParam],85 'Vec<UpDataStructsPropertyKeyPermission>',86 ),8788 tokenData: fun(89 'Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT',90 [collectionParam, tokenParam, propertyKeysParam],91 'UpDataStructsTokenData',92 ),93 totalSupply: fun(94 'Get the amount of distinctive tokens present in a collection', 95 [collectionParam], 96 'u32',97 ),9899 accountBalance: fun(100 'Get the amount of any user tokens owned by an account', 101 [collectionParam, crossAccountParam()], 102 'u32',103 ),104 balance: fun(105 'Get the amount of a specific token owned by an account', 106 [collectionParam, crossAccountParam(), tokenParam], 107 'u128',108 ),109 allowance: fun(110 'Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor', 111 [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 112 'u128',113 ),114115 adminlist: fun(116 'Get the list of admin accounts of a collection', 117 [collectionParam], 118 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',119 ),120 allowlist: fun(121 'Get the list of accounts allowed to operate within a collection', 122 [collectionParam], 123 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',124 ),125 allowed: fun(126 'Check if a user is allowed to operate within a collection', 127 [collectionParam, crossAccountParam()], 128 'bool',129 ),130131 lastTokenId: fun('Get the last token ID created in a collection', [collectionParam], 'u32'),132 collectionById: fun(133 'Get a collection by the specified ID', 134 [collectionParam], 135 'Option<UpDataStructsRpcCollection>',136 ),137 collectionStats: fun(138 'Get chain stats about collections', 139 [], 140 'UpDataStructsCollectionStats',141 ),142143 nextSponsored: fun(144 'Get the number of blocks until sponsoring a transaction is available', 145 [collectionParam, crossAccountParam(), tokenParam], 146 'Option<u64>',147 ),148 effectiveCollectionLimits: fun(149 'Get effective collection limits', 150 [collectionParam], 151 'Option<UpDataStructsCollectionLimits>',152 ),153 totalPieces: fun(154 'Get the total amount of pieces of an RFT', 155 [collectionParam, tokenParam], 156 'Option<u128>',157 ),158 },159};