git.delta.rocks / unique-network / refs/commits / 79a270aa7ee9

difftreelog

fix serde rpc Fixed method signature `total_pieces`. Before that the number of pieces greater than 2^53 -1 caused an error when calling this method.

PraetorP2022-08-12parent: #e4268af.patch.diff
in: master

7 files changed

modifiedCargo.lockdiffbeforeafterboth
1237912379
12380[[package]]12380[[package]]
12381name = "uc-rpc"12381name = "uc-rpc"
12382version = "0.1.1"12382version = "0.1.2"
12383dependencies = [12383dependencies = [
12384 "anyhow",12384 "anyhow",
12385 "jsonrpsee",12385 "jsonrpsee",
modifiedclient/rpc/CHANGELOG.mddiffbeforeafterboth
22
3All notable changes to this project will be documented in this file.3All notable changes to this project will be documented in this file.
44
5## [0.1.2] - 2022-08-12
6
7### Fixed
8
9- Method signature `total_pieces`. Before that the number of pieces greater than 2^53 -1 caused an error when calling this method.
10
5## [0.1.1] - 2022-07-1411## [0.1.1] - 2022-07-14
612
7### Added13### Added
814
9 - Implementation of RPC method `token_owners` returning 10 owners in no particular order.15- Implementation of RPC method `token_owners` returning 10 owners in no particular order.
10 This was an internal request to improve the web interface and support fractionalization event. 16 This was an internal request to improve the web interface and support fractionalization event.
11 17
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "uc-rpc"2name = "uc-rpc"
3version = "0.1.1"3version = "0.1.2"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
242 collection_id: CollectionId,242 collection_id: CollectionId,
243 token_id: TokenId,243 token_id: TokenId,
244 at: Option<BlockHash>,244 at: Option<BlockHash>,
245 ) -> Result<Option<u128>>;245 ) -> Result<Option<String>>;
246}246}
247247
248mod rmrk_unique_rpc {248mod rmrk_unique_rpc {
518 pass_method!(collection_stats() -> CollectionStats, unique_api);518 pass_method!(collection_stats() -> CollectionStats, unique_api);
519 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);519 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);
520 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);520 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);
521 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<u128>, unique_api);521 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);
522 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);522 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);
523}523}
524524
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
536 /// Can't transfer tokens to ethereum zero address536 /// Can't transfer tokens to ethereum zero address
537 AddressIsZero,537 AddressIsZero,
538538
539 /// The oprtation is not supported539 /// The operation is not supported
540 UnsupportedOperation,540 UnsupportedOperation,
541541
542 /// Insufficient funds to perform an action542 /// Insufficient funds to perform an action
modifiedtests/CHANGELOG.mddiffbeforeafterboth
22
3All notable changes to this project will be documented in this file.3All notable changes to this project will be documented in this file.
44
5## 2022-08-12
6
7### Added
8
9- In integration tests for `RFT` added check of work with the maximum allowable number of pieces (MAX_REFUNGIBLE_PIECES).
10
5## 2022-07-1411## 2022-07-14
612
7### Added13### Added
14
8 - Integrintegration tests of RPC method `token_owners`.15- Integrintegration tests of RPC method `token_owners`.
9 - Integrintegration tests of Fungible Pallet.16- Integrintegration tests of Fungible Pallet.
10 17
11
modifiedtests/src/refungible.test.tsdiffbeforeafterboth
3030
31let alice: IKeyringPair;31let alice: IKeyringPair;
32let bob: IKeyringPair;32let bob: IKeyringPair;
33const MAX_REFUNGIBLE_PIECES = 1_000_000_000_000_000_000_000n;
3334
34describe('integration test: Refungible functionality:', async () => {35describe('integration test: Refungible functionality:', async () => {
35 before(async function() {36 before(async function() {
58 });59 });
59 });60 });
60 61
62 it('Checking RPC methods when interacting with maximum allowed values (MAX_REFUNGIBLE_PIECES)', async () => {
63 await usingPlaygrounds(async helper => {
64 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
65
66 const token = await collection.mintToken(alice, {Substrate: alice.address}, MAX_REFUNGIBLE_PIECES);
67
68 expect(await collection.getTokenBalance(token.tokenId, {Substrate: alice.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);
69
70 await collection.transferToken(alice, token.tokenId, {Substrate: bob.address}, MAX_REFUNGIBLE_PIECES);
71 expect(await collection.getTokenBalance(token.tokenId, {Substrate: bob.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);
72 expect(await token.getTotalPieces()).to.be.equal(MAX_REFUNGIBLE_PIECES);
73
74 await expect(collection.mintToken(alice, {Substrate: alice.address}, MAX_REFUNGIBLE_PIECES + 1n)).to.eventually.be.rejected;
75 });
76 });
77
61 it('RPC method tokenOnewrs for refungible collection and token', async () => {78 it('RPC method tokenOnewrs for refungible collection and token', async () => {
62 await usingPlaygrounds(async (helper, privateKey) => {79 await usingPlaygrounds(async (helper, privateKey) => {