git.delta.rocks / unique-network / refs/commits / 94da15aaa928

difftreelog

feat(api) added RPC method, integrations tests for fungibble pallet

PraetorP2022-07-11parent: #da952fd.patch.diff
in: master
Added method that returns 10 tokens owners in no particular order.

30 files changed

modifiedCargo.lockdiffbeforeafterboth
59535953
5954[[package]]5954[[package]]
5955name = "pallet-fungible"5955name = "pallet-fungible"
5956version = "0.1.0"5956version = "0.1.1"
5957dependencies = [5957dependencies = [
5958 "ethereum",5958 "ethereum",
5959 "evm-coder",5959 "evm-coder",
61986198
6199[[package]]6199[[package]]
6200name = "pallet-nonfungible"6200name = "pallet-nonfungible"
6201version = "0.1.0"6201version = "0.1.1"
6202dependencies = [6202dependencies = [
6203 "ethereum",6203 "ethereum",
6204 "evm-coder",6204 "evm-coder",
1237412374
12375[[package]]12375[[package]]
12376name = "uc-rpc"12376name = "uc-rpc"
12377version = "0.1.0"12377version = "0.1.1"
12378dependencies = [12378dependencies = [
12379 "anyhow",12379 "anyhow",
12380 "jsonrpsee",12380 "jsonrpsee",
1267912679
12680[[package]]12680[[package]]
12681name = "unique-runtime-common"12681name = "unique-runtime-common"
12682version = "0.9.24"12682version = "0.9.25"
12683dependencies = [12683dependencies = [
12684 "evm-coder",12684 "evm-coder",
12685 "fp-rpc",12685 "fp-rpc",
1275112751
12752[[package]]12752[[package]]
12753name = "up-rpc"12753name = "up-rpc"
12754version = "0.1.0"12754version = "0.1.1"
12755dependencies = [12755dependencies = [
12756 "pallet-common",12756 "pallet-common",
12757 "pallet-evm",12757 "pallet-evm",
addedclient/rpc/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "uc-rpc"2name = "uc-rpc"
3version = "0.1.0"3version = "0.1.1"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
71 at: Option<BlockHash>,71 at: Option<BlockHash>,
72 ) -> Result<Option<CrossAccountId>>;72 ) -> Result<Option<CrossAccountId>>;
7373
74 /// Returns 10 tokens owners in no particular order.
74 #[method(name = "unique_tokenOwners")]75 #[method(name = "unique_tokenOwners")]
75 fn token_owners(76 fn token_owners(
76 &self,77 &self,
addedpallets/common/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
1748 /// * `token` - The token for which you need to find out the owner.1748 /// * `token` - The token for which you need to find out the owner.
1749 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId>;1749 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId>;
17501750
1751 /// Token owners1751 /// Returns 10 tokens owners in no particular order.
1752 ///
1753 /// * `token` - The token for which you need to find out the owners.
1752 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId>;1754 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId>;
17531755
1754 /// Get the value of the token property by key.1756 /// Get the value of the token property by key.
addedpallets/fungible/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-fungible"2name = "pallet-fungible"
3version = "0.1.0"3version = "0.1.1"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
362 None362 None
363 }363 }
364364
365 /// Returns 10 tokens owners in no particular order.
365 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {366 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
366 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])367 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])
367 }368 }
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
614 )614 )
615 }615 }
616616
617 /// Returns 10 tokens owners in no particular order
618 ///
619 /// There is no direct way to get token holders in ascending order,
620 /// since `iter_prefix` returns values in no particular order.
621 /// Therefore, getting the 10 largest holders with a large value of holders
622 /// can lead to impact memory allocation + sorting with `n * log (n)`.
617 pub fn token_owners(623 pub fn token_owners(
618 collection: CollectionId,624 collection: CollectionId,
619 _token: TokenId,625 _token: TokenId,
620 ) -> Option<Vec<T::CrossAccountId>> {626 ) -> Option<Vec<T::CrossAccountId>> {
621 let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection,))627 let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection,))
622 .map(|r| r.0)628 .map(|(owner, _amount)| owner)
623 .take(10)629 .take(10)
624 .collect();630 .collect();
625631
addedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-nonfungible"2name = "pallet-nonfungible"
3version = "0.1.0"3version = "0.1.1"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
422 <TokenData<T>>::get((self.id, token)).map(|t| t.owner)422 <TokenData<T>>::get((self.id, token)).map(|t| t.owner)
423 }423 }
424424
425 /// Returns token owners.
425 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {426 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
426 self.token_owner(token).map_or_else(|| vec![], |t| vec![t])427 self.token_owner(token).map_or_else(|| vec![], |t| vec![t])
427 }428 }
addedpallets/refungible/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
438 <Pallet<T>>::token_owner(self.id, token)438 <Pallet<T>>::token_owner(self.id, token)
439 }439 }
440440
441 /// Returns 10 token in no particular order.
441 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {442 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
442 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])443 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])
443 }444 }
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
1135 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)1135 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
1136 }1136 }
1137 1137
1138 /// Returns 10 token in no particular order.
1139 ///
1140 /// There is no direct way to get token holders in ascending order,
1141 /// since `iter_prefix` returns values in no particular order.
1142 /// Therefore, getting the 10 largest holders with a large value of holders
1143 /// can lead to impact memory allocation + sorting with `n * log (n)`.
1138 pub fn token_owners(1144 pub fn token_owners(
1139 collection_id: CollectionId,1145 collection_id: CollectionId,
1140 token: TokenId,1146 token: TokenId,
1141 ) -> Option<Vec<T::CrossAccountId>> {1147 ) -> Option<Vec<T::CrossAccountId>> {
1142 let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection_id, token))1148 let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection_id, token))
1143 .map(|r| r.0)1149 .map(|(owner, _amount)| owner)
1144 .take(10)1150 .take(10)
1145 .collect();1151 .collect();
11461152
addedprimitives/rpc/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedprimitives/rpc/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "up-rpc"2name = "up-rpc"
3version = "0.1.0"3version = "0.1.1"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
addedruntime/common/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedruntime/common/Cargo.tomldiffbeforeafterboth
6license = 'All Rights Reserved'6license = 'All Rights Reserved'
7name = 'unique-runtime-common'7name = 'unique-runtime-common'
8repository = 'https://github.com/UniqueNetwork/unique-chain'8repository = 'https://github.com/UniqueNetwork/unique-chain'
9version = '0.9.24'9version = '0.9.25'
1010
11[features]11[features]
12default = ['std']12default = ['std']
addedtests/CHANGELOG.mddiffbeforeafterboth

no changes

modifiedtests/package.jsondiffbeforeafterboth
80 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",80 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",
81 "testEthCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createCollection.test.ts",81 "testEthCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createCollection.test.ts",
82 "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",82 "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",
83 "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",
83 "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",84 "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",
84 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",85 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",
85 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",86 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",
addedtests/src/fungible.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth
29 [key: string]: Codec;29 [key: string]: Codec;
30 };30 };
31 common: {31 common: {
32 /**
33 * Maximum admins per collection.
34 **/
32 collectionAdminsLimit: u32 & AugmentedConst<ApiType>;35 collectionAdminsLimit: u32 & AugmentedConst<ApiType>;
36 /**
37 * Set price to create a collection.
38 **/
33 collectionCreationPrice: u128 & AugmentedConst<ApiType>;39 collectionCreationPrice: u128 & AugmentedConst<ApiType>;
34 /**40 /**
35 * Generic const41 * Generic const
modifiedtests/src/interfaces/augment-api-events.tsdiffbeforeafterboth
58 [key: string]: AugmentedEvent<ApiType>;58 [key: string]: AugmentedEvent<ApiType>;
59 };59 };
60 common: {60 common: {
61 /**61 /**
62 * * collection_id62 * Amount pieces of token owned by `sender` was approved for `spender`.
63 * 63 **/
64 * * item_id
65 *
66 * * sender
67 *
68 * * spender
69 *
70 * * amount
71 **/
72 Approved: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;64 Approved: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
73 /**65 /**
74 * New collection was created66 * New collection was created
75 * 67 **/
76 * # Arguments
77 *
78 * * collection_id: Globally unique identifier of newly created collection.
79 *
80 * * mode: [CollectionMode] converted into u8.
81 *
82 * * account_id: Collection owner.
83 **/
84 CollectionCreated: AugmentedEvent<ApiType, [u32, u8, AccountId32]>;68 CollectionCreated: AugmentedEvent<ApiType, [u32, u8, AccountId32]>;
85 /**69 /**
86 * New collection was destroyed70 * New collection was destroyed
87 * 71 **/
88 * # Arguments
89 *
90 * * collection_id: Globally unique identifier of collection.
91 **/
92 CollectionDestroyed: AugmentedEvent<ApiType, [u32]>;72 CollectionDestroyed: AugmentedEvent<ApiType, [u32]>;
73 /**
74 * The property has been deleted.
75 **/
93 CollectionPropertyDeleted: AugmentedEvent<ApiType, [u32, Bytes]>;76 CollectionPropertyDeleted: AugmentedEvent<ApiType, [u32, Bytes]>;
77 /**
78 * The colletion property has been set.
79 **/
94 CollectionPropertySet: AugmentedEvent<ApiType, [u32, Bytes]>;80 CollectionPropertySet: AugmentedEvent<ApiType, [u32, Bytes]>;
95 /**81 /**
96 * New item was created.82 * New item was created.
97 * 83 **/
98 * # Arguments
99 *
100 * * collection_id: Id of the collection where item was created.
101 *
102 * * item_id: Id of an item. Unique within the collection.
103 *
104 * * recipient: Owner of newly created item
105 *
106 * * amount: Always 1 for NFT
107 **/
108 ItemCreated: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;84 ItemCreated: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
109 /**85 /**
110 * Collection item was burned.86 * Collection item was burned.
111 * 87 **/
112 * # Arguments
113 *
114 * * collection_id.
115 *
116 * * item_id: Identifier of burned NFT.
117 *
118 * * owner: which user has destroyed its tokens
119 *
120 * * amount: Always 1 for NFT
121 **/
122 ItemDestroyed: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;88 ItemDestroyed: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
89 /**
90 * The colletion property permission has been set.
91 **/
123 PropertyPermissionSet: AugmentedEvent<ApiType, [u32, Bytes]>;92 PropertyPermissionSet: AugmentedEvent<ApiType, [u32, Bytes]>;
93 /**
94 * The token property has been deleted.
95 **/
124 TokenPropertyDeleted: AugmentedEvent<ApiType, [u32, u32, Bytes]>;96 TokenPropertyDeleted: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
97 /**
98 * The token property has been set.
99 **/
125 TokenPropertySet: AugmentedEvent<ApiType, [u32, u32, Bytes]>;100 TokenPropertySet: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
126 /**101 /**
127 * Item was transferred102 * Item was transferred
128 * 103 **/
129 * * collection_id: Id of collection to which item is belong
130 *
131 * * item_id: Id of an item
132 *
133 * * sender: Original owner of item
134 *
135 * * recipient: New owner of item
136 *
137 * * amount: Always 1 for NFT
138 **/
139 Transfer: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;104 Transfer: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
140 /**105 /**
141 * Generic event106 * Generic event
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
69 [key: string]: QueryableStorageEntry<ApiType>;69 [key: string]: QueryableStorageEntry<ApiType>;
70 };70 };
71 common: {71 common: {
72 /**
73 * Storage of collection admins count.
74 **/
72 adminAmount: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;75 adminAmount: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
73 /**76 /**
74 * Allowlisted collection users77 * Allowlisted collection users
75 **/78 **/
76 allowlist: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;79 allowlist: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
77 /**80 /**
78 * Collection info81 * Storage of collection info.
79 **/82 **/
80 collectionById: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<UpDataStructsCollection>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;83 collectionById: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<UpDataStructsCollection>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
81 /**84 /**
82 * Collection properties85 * Storage of collection properties.
83 **/86 **/
84 collectionProperties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;87 collectionProperties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
88 /**
89 * Storage of collection properties permissions.
90 **/
85 collectionPropertyPermissions: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<BTreeMap<Bytes, UpDataStructsPropertyPermission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;91 collectionPropertyPermissions: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<BTreeMap<Bytes, UpDataStructsPropertyPermission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
92 /**
93 * Storage of the count of created collections.
94 **/
86 createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;95 createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
96 /**
97 * Storage of the count of deleted collections.
98 **/
87 destroyedCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;99 destroyedCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
88 /**100 /**
89 * Not used by code, exists only to provide some types to metadata101 * Not used by code, exists only to provide some types to metadata.
90 **/102 **/
91 dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, UpDataStructsTokenChild, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;103 dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, UpDataStructsTokenChild, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;
92 /**104 /**
93 * List of collection admins105 * List of collection admins
231 [key: string]: QueryableStorageEntry<ApiType>;243 [key: string]: QueryableStorageEntry<ApiType>;
232 };244 };
233 nonfungible: {245 nonfungible: {
246 /**
247 * Amount of tokens owned by account.
248 **/
234 accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;249 accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
250 /**
251 * Allowance set by an owner for a spender for a token.
252 **/
235 allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;253 allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
236 /**254 /**
237 * Used to enumerate tokens owned by account255 * Used to enumerate tokens owned by account.
238 **/256 **/
239 owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;257 owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
258 /**
259 * Custom data that is serialized to bytes and attached to a token property.
260 * Currently used to store RMRK data.
261 **/
240 tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;262 tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
241 /**263 /**
242 * Used to enumerate token's children264 * Used to enumerate token's children.
243 **/265 **/
244 tokenChildren: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<bool>, [u32, u32, ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [u32, u32, ITuple<[u32, u32]>]>;266 tokenChildren: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<bool>, [u32, u32, ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [u32, u32, ITuple<[u32, u32]>]>;
267 /**
268 * Custom data serialized to bytes for token.
269 **/
245 tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNonfungibleItemData>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;270 tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNonfungibleItemData>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
271 /**
272 * Key-Value map stored for token.
273 **/
246 tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;274 tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
275 /**
276 * Amount of burnt tokens for collection.
277 **/
247 tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;278 tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
279 /**
280 * Amount of tokens minted for collection.
281 **/
248 tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;282 tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
249 /**283 /**
250 * Generic query284 * Generic query
430 **/464 **/
431 tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletRefungibleItemData>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;465 tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletRefungibleItemData>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
432 tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;466 tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
467 /**
468 * Amount of burnt tokens for collection
469 **/
433 tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;470 tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
434 /**471 /**
435 * Amount of tokens minted for collection472 * Amount of tokens minted for collection
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
708 * Get token owner708 * Get token owner
709 **/709 **/
710 tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;710 tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
711 /**711 /**
712 * Get token owners712 * Returns 10 tokens owners in no particular order
713 **/713 **/
714 tokenOwners: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;714 tokenOwners: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
715 /**715 /**
716 * Get token properties716 * Get token properties
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
49 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),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'),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}>`),51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
52 tokenOwners: fun('Get token owners', [collectionParam, tokenParam], `Vec<${CROSS_ACCOUNT_ID_TYPE}>`),52 tokenOwners: fun('Returns 10 tokens owners in no particular order', [collectionParam, tokenParam], `Vec<${CROSS_ACCOUNT_ID_TYPE}>`),
53 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),53 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
54 tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),54 tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),
55 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),55 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
modifiedtests/src/refungible.test.tsdiffbeforeafterboth
32 repartitionRFT,32 repartitionRFT,
33 createCollectionWithPropsExpectSuccess,33 createCollectionWithPropsExpectSuccess,
34 getDetailedCollectionInfo,34 getDetailedCollectionInfo,
35 normalizeAccountId,
36 CrossAccountId,
35} from './util/helpers';37} from './util/helpers';
3638
37import chai from 'chai';39import chai from 'chai';
100 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);102 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);
101 expect(owners.length == 10).to.be.true;103 expect(owners.length == 10).to.be.true;
104
105 const eleven = privateKeyWrapper('11');
106 expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;
107 expect((await api.rpc.unique.tokenOwners(collectionId, aliceTokenId)).length).to.be.equal(10);
102 });108 });
103 });109 });
104 110
modifiedtests/src/rpc.test.tsdiffbeforeafterboth
49 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);49 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);
50 expect(owners.length == 10).to.be.true;50 expect(owners.length == 10).to.be.true;
51
52 const eleven = privateKeyWrapper('11');
53 expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;
54 expect((await api.rpc.unique.tokenOwners(collectionId, aliceTokenId)).length).to.be.equal(10);
51 });55 });
52 });56 });
53});57});