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
--- a/tests/src/createCollection.test.ts
+++ b/tests/src/createCollection.test.ts
@@ -29,7 +29,7 @@
     collection = await helper.rft.mintCollection(signer, options);
   }
   const data = await collection.getData();
-  expect(data?.normalizedOwner).to.be.equal(signer.address);
+  expect(data?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(signer.address));
   expect(data?.name).to.be.equal(options.name);
   expect(data?.description).to.be.equal(options.description);
   expect(data?.raw.tokenPrefix).to.be.equal(options.tokenPrefix);
@@ -96,7 +96,7 @@
     const limits = await collection.getEffectiveLimits();
     const raw = data?.raw;
 
-    expect(data?.normalizedOwner).to.be.equal(alice.address);
+    expect(data?.normalizedOwner).to.be.equal(helper.util.normalizeSubstrateAddress(alice.address));
     expect(data?.name).to.be.equal('name');
     expect(data?.description).to.be.equal('descr');
     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 });