git.delta.rocks / unique-network / refs/commits / fd6a419056e6

difftreelog

fix normalize addresses

rkv2022-09-22parent: #b45c52c.patch.diff
in: master

3 files changed

modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
31 itSub('Changing owner changes owner address', async ({helper}) => {31 itSub('Changing owner changes owner address', async ({helper}) => {
32 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});32 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
33 const beforeChanging = await helper.collection.getData(collection.collectionId);33 const beforeChanging = await helper.collection.getData(collection.collectionId);
34 expect(beforeChanging?.normalizedOwner).to.be.equal(alice.address);34 expect(beforeChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(alice.address));
3535
36 await collection.changeOwner(alice, bob.address);36 await collection.changeOwner(alice, bob.address);
37 const afterChanging = await helper.collection.getData(collection.collectionId);37 const afterChanging = await helper.collection.getData(collection.collectionId);
38 expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);38 expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
39 });39 });
40});40});
4141
60 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);60 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
6161
62 const afterChanging = await helper.collection.getData(collection.collectionId);62 const afterChanging = await helper.collection.getData(collection.collectionId);
63 expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);63 expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
64 });64 });
6565
66 itSub('New collectionOwner has access to sponsorship management operations in the collection', async ({helper}) => {66 itSub('New collectionOwner has access to sponsorship management operations in the collection', async ({helper}) => {
67 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});67 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
68 await collection.changeOwner(alice, bob.address);68 await collection.changeOwner(alice, bob.address);
6969
70 const afterChanging = await helper.collection.getData(collection.collectionId);70 const afterChanging = await helper.collection.getData(collection.collectionId);
71 expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);71 expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
7272
73 await collection.setSponsor(bob, charlie.address);73 await collection.setSponsor(bob, charlie.address);
74 await collection.confirmSponsorship(charlie);74 await collection.confirmSponsorship(charlie);
97 await collection.changeOwner(alice, bob.address);97 await collection.changeOwner(alice, bob.address);
98 await collection.changeOwner(bob, charlie.address);98 await collection.changeOwner(bob, charlie.address);
99 const collectionData = await collection.getData();99 const collectionData = await collection.getData();
100 expect(collectionData?.normalizedOwner).to.be.equal(charlie.address);100 expect(collectionData?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(charlie.address));
101 });101 });
102});102});
103103
140 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);140 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
141141
142 const afterChanging = await helper.collection.getData(collection.collectionId);142 const afterChanging = await helper.collection.getData(collection.collectionId);
143 expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);143 expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
144144
145 const setSponsorTx = async () => collection.setSponsor(alice, charlie.address);145 const setSponsorTx = async () => collection.setSponsor(alice, charlie.address);
146 const confirmSponsorshipTx = async () => collection.confirmSponsorship(alice);146 const confirmSponsorshipTx = async () => collection.confirmSponsorship(alice);
modifiedtests/src/createCollection.test.tsdiffbeforeafterboth
29 collection = await helper.rft.mintCollection(signer, options);29 collection = await helper.rft.mintCollection(signer, options);
30 }30 }
31 const data = await collection.getData();31 const data = await collection.getData();
32 expect(data?.normalizedOwner).to.be.equal(signer.address);32 expect(data?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(signer.address));
33 expect(data?.name).to.be.equal(options.name);33 expect(data?.name).to.be.equal(options.name);
34 expect(data?.description).to.be.equal(options.description);34 expect(data?.description).to.be.equal(options.description);
35 expect(data?.raw.tokenPrefix).to.be.equal(options.tokenPrefix);35 expect(data?.raw.tokenPrefix).to.be.equal(options.tokenPrefix);
96 const limits = await collection.getEffectiveLimits();96 const limits = await collection.getEffectiveLimits();
97 const raw = data?.raw;97 const raw = data?.raw;
9898
99 expect(data?.normalizedOwner).to.be.equal(alice.address);99 expect(data?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(alice.address));
100 expect(data?.name).to.be.equal('name');100 expect(data?.name).to.be.equal('name');
101 expect(data?.description).to.be.equal('descr');101 expect(data?.description).to.be.equal('descr');
102 expect(raw.permissions.access).to.be.equal('AllowList');102 expect(raw.permissions.access).to.be.equal('AllowList');
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
48 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);48 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
49 for (const [i, token] of tokens.entries()) {49 for (const [i, token] of tokens.entries()) {
50 const tokenData = await token.getData();50 const tokenData = await token.getData();
51 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});51 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
52 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);52 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
53 }53 }
54 });54 });
116 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);116 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
117 for (const [i, token] of tokens.entries()) {117 for (const [i, token] of tokens.entries()) {
118 const tokenData = await token.getData();118 const tokenData = await token.getData();
119 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});119 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
120 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);120 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
121 }121 }
122 });122 });
138 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);138 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
139 for (const [i, token] of tokens.entries()) {139 for (const [i, token] of tokens.entries()) {
140 const tokenData = await token.getData();140 const tokenData = await token.getData();
141 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});141 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
142 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);142 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
143 }143 }
144 });144 });
160 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);160 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
161 for (const [i, token] of tokens.entries()) {161 for (const [i, token] of tokens.entries()) {
162 const tokenData = await token.getData();162 const tokenData = await token.getData();
163 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});163 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
164 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);164 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
165 }165 }
166 });166 });