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
--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -31,11 +31,11 @@
   itSub('Changing owner changes owner address', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
     const beforeChanging = await helper.collection.getData(collection.collectionId);
-    expect(beforeChanging?.normalizedOwner).to.be.equal(alice.address);
+    expect(beforeChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(alice.address));
 
     await collection.changeOwner(alice, bob.address);
     const afterChanging = await helper.collection.getData(collection.collectionId);
-    expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);
+    expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
   });
 });
 
@@ -60,7 +60,7 @@
     await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
 
     const afterChanging = await helper.collection.getData(collection.collectionId);
-    expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);
+    expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
   });
 
   itSub('New collectionOwner has access to sponsorship management operations in the collection', async ({helper}) => {
@@ -68,7 +68,7 @@
     await collection.changeOwner(alice, bob.address);
 
     const afterChanging = await helper.collection.getData(collection.collectionId);
-    expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);
+    expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
 
     await collection.setSponsor(bob, charlie.address);
     await collection.confirmSponsorship(charlie);
@@ -97,7 +97,7 @@
     await collection.changeOwner(alice, bob.address);
     await collection.changeOwner(bob, charlie.address);
     const collectionData = await collection.getData();
-    expect(collectionData?.normalizedOwner).to.be.equal(charlie.address);
+    expect(collectionData?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(charlie.address));
   });
 });
 
@@ -140,7 +140,7 @@
     await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
 
     const afterChanging = await helper.collection.getData(collection.collectionId);
-    expect(afterChanging?.normalizedOwner).to.be.equal(bob.address);
+    expect(afterChanging?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(bob.address));
 
     const setSponsorTx = async () => collection.setSponsor(alice, charlie.address);
     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
--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -48,7 +48,7 @@
     const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
     for (const [i, token] of tokens.entries()) {
       const tokenData = await token.getData();
-      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});
+      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
       expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
     }
   });
@@ -116,7 +116,7 @@
     const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
     for (const [i, token] of tokens.entries()) {
       const tokenData = await token.getData();
-      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});
+      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
       expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
     }
   });
@@ -138,7 +138,7 @@
     const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
     for (const [i, token] of tokens.entries()) {
       const tokenData = await token.getData();
-      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});
+      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
       expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
     }
   });
@@ -160,7 +160,7 @@
     const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);
     for (const [i, token] of tokens.entries()) {
       const tokenData = await token.getData();
-      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});
+      expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: helper.util.normalizeSubstrateAddress(alice.address)});
       expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);
     }
   });