difftreelog
tests(nesting): refactor naming conventions for token addresses
in: master
7 files changed
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -240,7 +240,7 @@
}
fromTokenId(collectionId: number, tokenId: number): string {
- return this.helper.util.getNestingTokenAddressRaw({collectionId, tokenId});
+ return this.helper.util.getTokenAddress({collectionId, tokenId});
}
normalizeAddress(address: string): string {
tests/src/nesting/graphs.test.tsdiffbeforeafterboth--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -64,7 +64,7 @@
'second transaction',
).to.be.rejectedWith(/structure\.OuroborosDetected/);
await expect(
- tokens[1].transferFrom(alice, tokens[0].nestingAddress(), tokens[7].nestingAddress()),
+ tokens[1].transferFrom(alice, tokens[0].nestingAccount(), tokens[7].nestingAccount()),
'third transaction',
).to.be.rejectedWith(/structure\.OuroborosDetected/);
});
tests/src/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -33,9 +33,9 @@
const targetToken = await collection.mintToken(alice);
// Create an immediately nested token
- const nestedToken = await collection.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested
const newToken = await collection.mintToken(alice);
@@ -43,14 +43,14 @@
// Nest
await newToken.nest(alice, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Move bundle to different user
await targetToken.transfer(alice, {Substrate: bob.address});
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Unnest
await newToken.unnest(bob, targetToken, {Substrate: bob.address});
@@ -64,13 +64,13 @@
const tokenB = await collection.mintToken(alice);
// Create a nested token
- const tokenC = await collection.mintToken(alice, tokenA.nestingAddress());
- expect(await tokenC.getOwner()).to.be.deep.equal(tokenA.nestingAddress());
+ const tokenC = await collection.mintToken(alice, tokenA.nestingAccount());
+ expect(await tokenC.getOwner()).to.be.deep.equal(tokenA.nestingAccount());
// Transfer the nested token to another token
- await expect(tokenC.transferFrom(alice, tokenA.nestingAddress(), tokenB.nestingAddress())).to.be.fulfilled;
+ await expect(tokenC.transferFrom(alice, tokenA.nestingAccount(), tokenB.nestingAccount())).to.be.fulfilled;
expect(await tokenC.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
- expect(await tokenC.getOwner()).to.be.deep.equal(tokenB.nestingAddress());
+ expect(await tokenC.getOwner()).to.be.deep.equal(tokenB.nestingAccount());
});
itSub('Checks token children', async ({helper}) => {
@@ -81,7 +81,7 @@
expect((await targetToken.getChildren()).length).to.be.equal(0, 'Children length check at creation');
// Create a nested NFT token
- const tokenA = await collectionA.mintToken(alice, targetToken.nestingAddress());
+ const tokenA = await collectionA.mintToken(alice, targetToken.nestingAccount());
expect(await targetToken.getChildren()).to.have.deep.members([
{tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
], 'Children contents check at nesting #1').and.be.length(1, 'Children length check at nesting #1');
@@ -102,7 +102,7 @@
// Create a fungible token in another collection and then nest
await collectionB.mint(alice, 10n);
- await collectionB.transfer(alice, targetToken.nestingAddress(), 2n);
+ await collectionB.transfer(alice, targetToken.nestingAccount(), 2n);
expect(await targetToken.getChildren()).to.be.have.deep.members([
{tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
{tokenId: 0, collectionId: collectionB.collectionId},
@@ -110,7 +110,7 @@
.and.be.length(2, 'Children length check at nesting #4 (from another collection)');
// Move part of the fungible token inside token A deeper in the nesting tree
- await collectionB.transferFrom(alice, targetToken.nestingAddress(), tokenA.nestingAddress(), 1n);
+ await collectionB.transferFrom(alice, targetToken.nestingAccount(), tokenA.nestingAccount(), 1n);
expect(await targetToken.getChildren()).to.be.have.deep.members([
{tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
{tokenId: 0, collectionId: collectionB.collectionId},
@@ -120,7 +120,7 @@
], 'Children contents check at nesting #5.5 (deeper)').and.be.length(1, 'Children length check at nesting #5.5 (deeper)');
// Move the remaining part of the fungible token inside token A deeper in the nesting tree
- await collectionB.transferFrom(alice, targetToken.nestingAddress(), tokenA.nestingAddress(), 1n);
+ await collectionB.transferFrom(alice, targetToken.nestingAccount(), tokenA.nestingAccount(), 1n);
expect(await targetToken.getChildren()).to.be.have.deep.members([
{tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
], 'Children contents check at nesting #6 (deeper)').and.be.length(1, 'Children length check at nesting #6 (deeper)');
@@ -148,15 +148,15 @@
const targetToken = await collection.mintToken(alice, {Substrate: charlie.address});
// Create an immediately nested token
- const nestedToken = await collection.mintToken(bob, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(bob, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested and nest
const newToken = await collection.mintToken(bob);
await newToken.nest(bob, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
itSub('Admin (NFT): Admin and Token Owner can operate together', async ({helper}) => {
@@ -165,15 +165,15 @@
const targetToken = await collection.mintToken(alice, {Substrate: charlie.address});
// Create an immediately nested token by an administrator
- const nestedToken = await collection.mintToken(bob, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(bob, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested and nest
const newToken = await collection.mintToken(alice, {Substrate: charlie.address});
await newToken.nest(charlie, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
itSub('Admin (NFT): allows an Admin to nest a token (Restricted nesting)', async ({helper}) => {
@@ -185,15 +185,15 @@
const targetToken = await collectionA.mintToken(alice, {Substrate: charlie.address});
// Create an immediately nested token
- const nestedToken = await collectionB.mintToken(bob, targetToken.nestingAddress());
+ const nestedToken = await collectionB.mintToken(bob, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested and nest
const newToken = await collectionB.mintToken(bob);
await newToken.nest(bob, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
// ---------- Non-Fungible ----------
@@ -202,18 +202,18 @@
const collection = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}}});
await collection.addToAllowList(alice, {Substrate: charlie.address});
const targetToken = await collection.mintToken(charlie);
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- const nestedToken = await collection.mintToken(charlie, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(charlie, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested and nest
const newToken = await collection.mintToken(charlie);
await newToken.nest(charlie, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
itSub('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {
@@ -224,22 +224,22 @@
await collectionA.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionB.collectionId]}});
await collectionA.addToAllowList(alice, {Substrate: charlie.address});
- await collectionA.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionA.addToAllowList(alice, targetToken.nestingAccount());
await collectionB.setPermissions(alice, {access: 'AllowList', mintMode: true});
await collectionB.addToAllowList(alice, {Substrate: charlie.address});
- await collectionB.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionB.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- const nestedToken = await collectionB.mintToken(charlie, targetToken.nestingAddress());
+ const nestedToken = await collectionB.mintToken(charlie, targetToken.nestingAccount());
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Create a token to be nested and nest
const newToken = await collectionB.mintToken(charlie);
await newToken.nest(charlie, targetToken);
expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
- expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
// ---------- Fungible ----------
@@ -250,20 +250,20 @@
const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
await collectionFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
await collectionFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionFT.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- await collectionFT.mint(charlie, 5n, targetToken.nestingAddress());
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ await collectionFT.mint(charlie, 5n, targetToken.nestingAccount());
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
// Create a token to be nested and nest
await collectionFT.mint(charlie, 5n);
- await collectionFT.transfer(charlie, targetToken.nestingAddress(), 2n);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(7n);
+ await collectionFT.transfer(charlie, targetToken.nestingAccount(), 2n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);
});
itSub('Fungible: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {
@@ -273,20 +273,20 @@
await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionFT.collectionId]}});
await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
await collectionFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
await collectionFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionFT.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- await collectionFT.mint(charlie, 5n, targetToken.nestingAddress());
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ await collectionFT.mint(charlie, 5n, targetToken.nestingAccount());
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
// Create a token to be nested and nest
await collectionFT.mint(charlie, 5n);
- await collectionFT.transfer(charlie, targetToken.nestingAddress(), 2n);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(7n);
+ await collectionFT.transfer(charlie, targetToken.nestingAccount(), 2n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);
});
// ---------- Re-Fungible ----------
@@ -297,20 +297,20 @@
const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
await collectionRFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
await collectionRFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionRFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionRFT.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAddress());
- expect(await nestedToken.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAccount());
+ expect(await nestedToken.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
// Create a token to be nested and nest
const newToken = await collectionRFT.mintToken(charlie, 5n);
- await newToken.transfer(charlie, targetToken.nestingAddress(), 2n);
- expect(await newToken.getBalance(targetToken.nestingAddress())).to.be.equal(2n);
+ await newToken.transfer(charlie, targetToken.nestingAccount(), 2n);
+ expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(2n);
});
itSub.ifWithPallets('ReFungible: allows an Owner to nest/unnest their token (Restricted nesting)', [Pallets.ReFungible], async ({helper}) => {
@@ -320,20 +320,20 @@
await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionRFT.collectionId]}});
await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
await collectionRFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
await collectionRFT.addToAllowList(alice, {Substrate: charlie.address});
- await collectionRFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionRFT.addToAllowList(alice, targetToken.nestingAccount());
// Create an immediately nested token
- const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAddress());
- expect(await nestedToken.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAccount());
+ expect(await nestedToken.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
// Create a token to be nested and nest
const newToken = await collectionRFT.mintToken(charlie, 5n);
- await newToken.transfer(charlie, targetToken.nestingAddress(), 2n);
- expect(await newToken.getBalance(targetToken.nestingAddress())).to.be.equal(2n);
+ await newToken.transfer(charlie, targetToken.nestingAccount(), 2n);
+ expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(2n);
});
});
@@ -356,11 +356,11 @@
// Create a nested-token matryoshka
for (let i = 0; i < maxNestingLevel; i++) {
- token = await collection.mintToken(alice, token.nestingAddress());
+ token = await collection.mintToken(alice, token.nestingAccount());
}
// The nesting depth is limited by `maxNestingLevel`
- await expect(collection.mintToken(alice, token.nestingAddress()))
+ await expect(collection.mintToken(alice, token.nestingAccount()))
.to.be.rejectedWith(/structure\.DepthLimit/);
expect(await token.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
expect(await token.getChildren()).to.be.length(0);
@@ -374,7 +374,7 @@
const targetToken = await collection.mintToken(alice);
// Try to create an immediately nested token as collection admin when it's disallowed
- await expect(collection.mintToken(bob, targetToken.nestingAddress()))
+ await expect(collection.mintToken(bob, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
// Try to create a token to be nested and nest
@@ -390,10 +390,10 @@
const collection = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {collectionAdmin: true}}});
const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
await collection.addToAllowList(alice, {Substrate: bob.address});
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
// Try to create a nested token as token owner when it's disallowed
- await expect(collection.mintToken(bob, targetToken.nestingAddress()))
+ await expect(collection.mintToken(bob, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
// Try to create a token to be nested and nest
@@ -410,7 +410,7 @@
//await collection.addAdmin(alice, {Substrate: bob.address});
const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
await collection.addToAllowList(alice, {Substrate: bob.address});
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
// Try to nest somebody else's token
const newToken = await collection.mintToken(bob);
@@ -418,13 +418,13 @@
.to.be.rejectedWith(/common\.NoPermission/);
// Try to unnest a token belonging to someone else as collection admin
- const nestedToken = await collection.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
await expect(nestedToken.unnest(alice, targetToken, {Substrate: bob.address}))
.to.be.rejectedWith(/common\.AddressNotInAllowlist/);
expect(await targetToken.getChildren()).to.be.length(1);
expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
itSub('Admin (NFT): disallows an Admin to nest a token from an unlisted collection (Restricted nesting)', async ({helper}) => {
@@ -434,7 +434,7 @@
const targetToken = await collectionA.mintToken(alice);
// Try to create a nested token from another collection
- await expect(collectionB.mintToken(alice, targetToken.nestingAddress()))
+ await expect(collectionB.mintToken(alice, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
// Create a token in another collection yet to be nested and try to nest
@@ -454,7 +454,7 @@
const targetToken = await collection.mintToken(alice);
// Try to create a nested token as token owner when it's disallowed
- await expect(collection.mintToken(alice, targetToken.nestingAddress()))
+ await expect(collection.mintToken(alice, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
// Try to create a token to be nested and nest
@@ -472,7 +472,7 @@
await collection.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
await collection.addToAllowList(alice, {Substrate: bob.address});
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
// Try to create a token to be nested and nest
const newToken = await collection.mintToken(alice);
@@ -488,11 +488,11 @@
await collection.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
await collection.addToAllowList(alice, {Substrate: bob.address});
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
const collectionB = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true}});
await collectionB.addToAllowList(alice, {Substrate: bob.address});
- await collectionB.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionB.addToAllowList(alice, targetToken.nestingAccount());
// Try to create a token to be nested and nest
const newToken = await collectionB.mintToken(alice);
@@ -508,10 +508,10 @@
const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
await collection.addToAllowList(alice, {Substrate: bob.address});
- await collection.addToAllowList(alice, targetToken.nestingAddress());
+ await collection.addToAllowList(alice, targetToken.nestingAccount());
// Try to mint in own collection after allowlisting the accounts
- await expect(collection.mintToken(bob, targetToken.nestingAddress()))
+ await expect(collection.mintToken(bob, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
});
@@ -523,12 +523,12 @@
const targetToken = await collectionNFT.mintToken(alice);
// Try to create an immediately nested token
- await expect(collectionFT.mint(alice, 5n, targetToken.nestingAddress()))
+ await expect(collectionFT.mint(alice, 5n, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
// Try to create a token to be nested and nest
await collectionFT.mint(alice, 5n);
- await expect(collectionFT.transfer(alice, targetToken.nestingAddress(), 2n))
+ await expect(collectionFT.transfer(alice, targetToken.nestingAccount(), 2n))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(5n);
});
@@ -539,12 +539,12 @@
const targetToken = await collectionNFT.mintToken(alice, {Substrate: bob.address});
// Nest some tokens as Alice into Bob's token
- await collectionFT.mint(alice, 5n, targetToken.nestingAddress());
+ await collectionFT.mint(alice, 5n, targetToken.nestingAccount());
// Try to pull it out
- await expect(collectionFT.transferFrom(alice, targetToken.nestingAddress(), {Substrate: bob.address}, 1n))
+ await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: bob.address}, 1n))
.to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
});
itSub('Fungible: disallows a non-Owner to unnest someone else\'s token (Restricted nesting)', async ({helper}) => {
@@ -555,12 +555,12 @@
await collectionNFT.setPermissions(alice, {nesting: {collectionAdmin: true, tokenOwner: true, restricted: [collectionFT.collectionId]}});
// Nest some tokens as Alice into Bob's token
- await collectionFT.mint(alice, 5n, targetToken.nestingAddress());
+ await collectionFT.mint(alice, 5n, targetToken.nestingAccount());
// Try to pull it out as Alice still
- await expect(collectionFT.transferFrom(alice, targetToken.nestingAddress(), {Substrate: bob.address}, 1n))
+ await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: bob.address}, 1n))
.to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(5n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
});
itSub('Fungible: disallows to nest token in an unlisted collection', async ({helper}) => {
@@ -569,15 +569,15 @@
const targetToken = await collectionNFT.mintToken(alice);
// Try to mint an immediately nested token
- await expect(collectionFT.mint(alice, 5n, targetToken.nestingAddress()))
+ await expect(collectionFT.mint(alice, 5n, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
// Mint a token and try to nest it
await collectionFT.mint(alice, 5n);
- await expect(collectionFT.transfer(alice, targetToken.nestingAddress(), 1n))
+ await expect(collectionFT.transfer(alice, targetToken.nestingAccount(), 1n))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(0n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(5n);
});
@@ -589,12 +589,12 @@
const targetToken = await collectionNFT.mintToken(alice);
// Try to create an immediately nested token
- await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAddress()))
+ await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
// Try to create a token to be nested and nest
const token = await collectionRFT.mintToken(alice, 5n);
- await expect(token.transfer(alice, targetToken.nestingAddress(), 2n))
+ await expect(token.transfer(alice, targetToken.nestingAccount(), 2n))
.to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(5n);
});
@@ -606,22 +606,22 @@
await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
await collectionNFT.addToAllowList(alice, {Substrate: bob.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
// Try to create a token to be nested and nest
const newToken = await collectionRFT.mintToken(alice);
- await expect(newToken.transfer(bob, targetToken.nestingAddress())).to.be.rejectedWith(/common\.TokenValueTooLow/);
+ await expect(newToken.transfer(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.TokenValueTooLow/);
expect(await targetToken.getChildren()).to.be.length(0);
expect(await newToken.getBalance({Substrate: alice.address})).to.be.equal(1n);
// Nest some tokens as Alice into Bob's token
- await newToken.transfer(alice, targetToken.nestingAddress());
+ await newToken.transfer(alice, targetToken.nestingAccount());
// Try to pull it out
- await expect(newToken.transferFrom(bob, targetToken.nestingAddress(), {Substrate: alice.address}, 1n))
+ await expect(newToken.transferFrom(bob, targetToken.nestingAccount(), {Substrate: alice.address}, 1n))
.to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await newToken.getBalance(targetToken.nestingAddress())).to.be.equal(1n);
+ expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
});
itSub.ifWithPallets('ReFungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', [Pallets.ReFungible], async ({helper}) => {
@@ -631,22 +631,22 @@
await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted: [collectionRFT.collectionId]}});
await collectionNFT.addToAllowList(alice, {Substrate: bob.address});
- await collectionNFT.addToAllowList(alice, targetToken.nestingAddress());
+ await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
// Try to create a token to be nested and nest
const newToken = await collectionRFT.mintToken(alice);
- await expect(newToken.transfer(bob, targetToken.nestingAddress())).to.be.rejectedWith(/common\.TokenValueTooLow/);
+ await expect(newToken.transfer(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.TokenValueTooLow/);
expect(await targetToken.getChildren()).to.be.length(0);
expect(await newToken.getBalance({Substrate: alice.address})).to.be.equal(1n);
// Nest some tokens as Alice into Bob's token
- await newToken.transfer(alice, targetToken.nestingAddress());
+ await newToken.transfer(alice, targetToken.nestingAccount());
// Try to pull it out
- await expect(newToken.transferFrom(bob, targetToken.nestingAddress(), {Substrate: alice.address}, 1n))
+ await expect(newToken.transferFrom(bob, targetToken.nestingAccount(), {Substrate: alice.address}, 1n))
.to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await newToken.getBalance(targetToken.nestingAddress())).to.be.equal(1n);
+ expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
});
itSub.ifWithPallets('ReFungible: disallows to nest token to an unlisted collection', [Pallets.ReFungible], async ({helper}) => {
@@ -655,12 +655,12 @@
const targetToken = await collectionNFT.mintToken(alice);
// Try to create an immediately nested token
- await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAddress()))
+ await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAccount()))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
// Try to create a token to be nested and nest
const token = await collectionRFT.mintToken(alice, 5n);
- await expect(token.transfer(alice, targetToken.nestingAddress(), 2n))
+ await expect(token.transfer(alice, targetToken.nestingAccount(), 2n))
.to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(5n);
});
tests/src/nesting/properties.test.tsdiffbeforeafterboth--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -651,7 +651,7 @@
const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
const collectionB = await helper.nft.mintCollection(alice);
const targetToken = await collectionA.mintToken(alice);
- const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
await collectionB.addAdmin(alice, {Substrate: bob.address});
await targetToken.transfer(alice, {Substrate: charlie.address});
@@ -692,7 +692,7 @@
const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
const collectionB = await helper.nft.mintCollection(alice);
const targetToken = await collectionA.mintToken(alice);
- const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
await collectionB.addAdmin(alice, {Substrate: bob.address});
await targetToken.transfer(alice, {Substrate: charlie.address});
@@ -739,7 +739,7 @@
const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
const collectionB = await helper.nft.mintCollection(alice);
const targetToken = await collectionA.mintToken(alice);
- const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
await collectionB.addAdmin(alice, {Substrate: bob.address});
await targetToken.transfer(alice, {Substrate: charlie.address});
tests/src/nesting/unnest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -32,15 +32,15 @@
const targetToken = await collection.mintToken(alice);
// Create a nested token
- const nestedToken = await collection.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
// Unnest
- await expect(nestedToken.transferFrom(alice, targetToken.nestingAddress(), {Substrate: alice.address}), 'while unnesting').to.be.fulfilled;
+ await expect(nestedToken.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}), 'while unnesting').to.be.fulfilled;
expect(await nestedToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
// Nest and burn
await nestedToken.nest(alice, targetToken);
- await expect(nestedToken.burnFrom(alice, targetToken.nestingAddress()), 'while burning').to.be.fulfilled;
+ await expect(nestedToken.burnFrom(alice, targetToken.nestingAccount()), 'while burning').to.be.fulfilled;
await expect(nestedToken.getOwner()).to.be.rejected;
});
@@ -51,16 +51,16 @@
const collectionFT = await helper.ft.mintCollection(alice);
// Nest and unnest
- await collectionFT.mint(alice, 10n, targetToken.nestingAddress());
- await expect(collectionFT.transferFrom(alice, targetToken.nestingAddress(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
+ await collectionFT.mint(alice, 10n, targetToken.nestingAccount());
+ await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(9n);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(1n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
// Nest and burn
- await collectionFT.transfer(alice, targetToken.nestingAddress(), 5n);
- await expect(collectionFT.burnTokensFrom(alice, targetToken.nestingAddress(), 6n), 'while burning').to.be.fulfilled;
+ await collectionFT.transfer(alice, targetToken.nestingAccount(), 5n);
+ await expect(collectionFT.burnTokensFrom(alice, targetToken.nestingAccount(), 6n), 'while burning').to.be.fulfilled;
expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(4n);
- expect(await collectionFT.getBalance(targetToken.nestingAddress())).to.be.equal(0n);
+ expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
expect(await targetToken.getChildren()).to.be.length(0);
});
@@ -71,16 +71,16 @@
const collectionRFT = await helper.rft.mintCollection(alice);
// Nest and unnest
- const token = await collectionRFT.mintToken(alice, 10n, targetToken.nestingAddress());
- await expect(token.transferFrom(alice, targetToken.nestingAddress(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
+ const token = await collectionRFT.mintToken(alice, 10n, targetToken.nestingAccount());
+ await expect(token.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(9n);
- expect(await token.getBalance(targetToken.nestingAddress())).to.be.equal(1n);
+ expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
// Nest and burn
- await token.transfer(alice, targetToken.nestingAddress(), 5n);
- await expect(token.burnFrom(alice, targetToken.nestingAddress(), 6n), 'while burning').to.be.fulfilled;
+ await token.transfer(alice, targetToken.nestingAccount(), 5n);
+ await expect(token.burnFrom(alice, targetToken.nestingAccount(), 6n), 'while burning').to.be.fulfilled;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(4n);
- expect(await token.getBalance(targetToken.nestingAddress())).to.be.equal(0n);
+ expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
expect(await targetToken.getChildren()).to.be.length(0);
});
});
@@ -101,15 +101,15 @@
const targetToken = await collection.mintToken(alice);
// Create a nested token
- const nestedToken = await collection.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
// Try to unnest
await expect(nestedToken.unnest(bob, targetToken, {Substrate: alice.address})).to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
// Try to burn
- await expect(nestedToken.burnFrom(bob, targetToken.nestingAddress())).to.be.rejectedWith(/common\.ApprovedValueTooLow/);
- expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAddress());
+ await expect(nestedToken.burnFrom(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+ expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccount());
});
// todo another test for creating excessive depth matryoshka with Ethereum?
@@ -120,7 +120,7 @@
const targetToken = await collection.mintToken(alice);
// Fail to create a nested token ouroboros
- const nestedToken = await collection.mintToken(alice, targetToken.nestingAddress());
+ const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
await expect(targetToken.nest(alice, nestedToken)).to.be.rejectedWith(/^structure\.OuroborosDetected$/);
});
});
tests/src/util/playgrounds/types.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {IKeyringPair} from '@polkadot/types/types';56export interface IEvent {7 section: string;8 method: string;9 index: [number, number] | string;10 data: any[];11 phase: {applyExtrinsic: number} | 'Initialization',12}1314export interface ITransactionResult {15 status: 'Fail' | 'Success';16 result: {17 events: {18 phase: any, // {ApplyExtrinsic: number} | 'Initialization',19 event: IEvent;20 }[];21 },22 moduleError?: string;23}2425export interface ISubscribeBlockEventsData {26 number: number;27 hash: string;28 timestamp: number; 29 events: IEvent[];30}3132export interface ILogger {33 log: (msg: any, level?: string) => void;34 level: {35 ERROR: 'ERROR';36 WARNING: 'WARNING';37 INFO: 'INFO';38 [key: string]: string;39 }40}4142export interface IUniqueHelperLog {43 executedAt: number;44 executionTime: number;45 type: 'extrinsic' | 'rpc';46 status: 'Fail' | 'Success';47 call: string;48 params: any[];49 moduleError?: string;50 events?: any;51}5253export interface IApiListeners {54 connected?: (...args: any[]) => any;55 disconnected?: (...args: any[]) => any;56 error?: (...args: any[]) => any;57 ready?: (...args: any[]) => any; 58 decorated?: (...args: any[]) => any;59}6061export interface ICrossAccountId {62 Substrate?: TSubstrateAccount;63 Ethereum?: TEthereumAccount;64}6566export interface ICrossAccountIdLower {67 substrate?: TSubstrateAccount;68 ethereum?: TEthereumAccount;69}7071export interface ICollectionLimits {72 accountTokenOwnershipLimit?: number | null;73 sponsoredDataSize?: number | null;74 sponsoredDataRateLimit?: {blocks: number} | {sponsoringDisabled: null} | null;75 tokenLimit?: number | null;76 sponsorTransferTimeout?: number | null;77 sponsorApproveTimeout?: number | null;78 ownerCanTransfer?: boolean | null;79 ownerCanDestroy?: boolean | null;80 transfersEnabled?: boolean | null;81}8283export interface INestingPermissions {84 tokenOwner?: boolean;85 collectionAdmin?: boolean;86 restricted?: number[] | null;87}8889export interface ICollectionPermissions {90 access?: 'Normal' | 'AllowList';91 mintMode?: boolean;92 nesting?: INestingPermissions;93}9495export interface IProperty {96 key: string;97 value?: string;98}99100export interface ITokenPropertyPermission {101 key: string;102 permission: {103 mutable?: boolean;104 tokenOwner?: boolean;105 collectionAdmin?: boolean;106 }107}108109export interface IToken {110 collectionId: number;111 tokenId: number;112 //nestingAddress: () => {Ethereum: string};113}114115export interface IBlock {116 extrinsics: IExtrinsic[]117 header: {118 parentHash: string,119 number: number,120 };121}122123export interface IExtrinsic {124 isSigned: boolean,125 method: {126 method: string,127 section: string,128 args: any[]129 }130}131132export interface ICollectionCreationOptions {133 name?: string | number[];134 description?: string | number[];135 tokenPrefix?: string | number[];136 mode?: {137 nft?: null;138 refungible?: null;139 fungible?: number;140 }141 permissions?: ICollectionPermissions;142 properties?: IProperty[];143 tokenPropertyPermissions?: ITokenPropertyPermission[];144 limits?: ICollectionLimits;145 pendingSponsor?: TSubstrateAccount;146}147148export interface IChainProperties {149 ss58Format: number;150 tokenDecimals: number[];151 tokenSymbol: string[]152}153154export interface ISubstrateBalance {155 free: bigint,156 reserved: bigint,157 miscFrozen: bigint,158 feeFrozen: bigint159}160161export interface IStakingInfo {162 block: bigint,163 amount: bigint,164}165166export type TSubstrateAccount = string;167export type TEthereumAccount = string;168export type TApiAllowedListeners = 'connected' | 'disconnected' | 'error' | 'ready' | 'decorated';169export type TUniqueNetworks = 'opal' | 'quartz' | 'unique';170export type TSigner = IKeyringPair; // | 'string'1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {IKeyringPair} from '@polkadot/types/types';56export interface IEvent {7 section: string;8 method: string;9 index: [number, number] | string;10 data: any[];11 phase: {applyExtrinsic: number} | 'Initialization',12}1314export interface ITransactionResult {15 status: 'Fail' | 'Success';16 result: {17 events: {18 phase: any, // {ApplyExtrinsic: number} | 'Initialization',19 event: IEvent;20 }[];21 },22 moduleError?: string;23}2425export interface ISubscribeBlockEventsData {26 number: number;27 hash: string;28 timestamp: number; 29 events: IEvent[];30}3132export interface ILogger {33 log: (msg: any, level?: string) => void;34 level: {35 ERROR: 'ERROR';36 WARNING: 'WARNING';37 INFO: 'INFO';38 [key: string]: string;39 }40}4142export interface IUniqueHelperLog {43 executedAt: number;44 executionTime: number;45 type: 'extrinsic' | 'rpc';46 status: 'Fail' | 'Success';47 call: string;48 params: any[];49 moduleError?: string;50 events?: any;51}5253export interface IApiListeners {54 connected?: (...args: any[]) => any;55 disconnected?: (...args: any[]) => any;56 error?: (...args: any[]) => any;57 ready?: (...args: any[]) => any; 58 decorated?: (...args: any[]) => any;59}6061export interface ICrossAccountId {62 Substrate?: TSubstrateAccount;63 Ethereum?: TEthereumAccount;64}6566export interface ICrossAccountIdLower {67 substrate?: TSubstrateAccount;68 ethereum?: TEthereumAccount;69}7071export interface ICollectionLimits {72 accountTokenOwnershipLimit?: number | null;73 sponsoredDataSize?: number | null;74 sponsoredDataRateLimit?: {blocks: number} | {sponsoringDisabled: null} | null;75 tokenLimit?: number | null;76 sponsorTransferTimeout?: number | null;77 sponsorApproveTimeout?: number | null;78 ownerCanTransfer?: boolean | null;79 ownerCanDestroy?: boolean | null;80 transfersEnabled?: boolean | null;81}8283export interface INestingPermissions {84 tokenOwner?: boolean;85 collectionAdmin?: boolean;86 restricted?: number[] | null;87}8889export interface ICollectionPermissions {90 access?: 'Normal' | 'AllowList';91 mintMode?: boolean;92 nesting?: INestingPermissions;93}9495export interface IProperty {96 key: string;97 value?: string;98}99100export interface ITokenPropertyPermission {101 key: string;102 permission: {103 mutable?: boolean;104 tokenOwner?: boolean;105 collectionAdmin?: boolean;106 }107}108109export interface IToken {110 collectionId: number;111 tokenId: number;112}113114export interface IBlock {115 extrinsics: IExtrinsic[]116 header: {117 parentHash: string,118 number: number,119 };120}121122export interface IExtrinsic {123 isSigned: boolean,124 method: {125 method: string,126 section: string,127 args: any[]128 }129}130131export interface ICollectionCreationOptions {132 name?: string | number[];133 description?: string | number[];134 tokenPrefix?: string | number[];135 mode?: {136 nft?: null;137 refungible?: null;138 fungible?: number;139 }140 permissions?: ICollectionPermissions;141 properties?: IProperty[];142 tokenPropertyPermissions?: ITokenPropertyPermission[];143 limits?: ICollectionLimits;144 pendingSponsor?: TSubstrateAccount;145}146147export interface IChainProperties {148 ss58Format: number;149 tokenDecimals: number[];150 tokenSymbol: string[]151}152153export interface ISubstrateBalance {154 free: bigint,155 reserved: bigint,156 miscFrozen: bigint,157 feeFrozen: bigint158}159160export interface IStakingInfo {161 block: bigint,162 amount: bigint,163}164165export type TSubstrateAccount = string;166export type TEthereumAccount = string;167export type TApiAllowedListeners = 'connected' | 'disconnected' | 'error' | 'ready' | 'decorated';168export type TUniqueNetworks = 'opal' | 'quartz' | 'unique';169export type TSigner = IKeyringPair; // | 'string'tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -55,11 +55,11 @@
RPC: 'rpc',
};
- static getNestingTokenAddress(token: IToken) {
- return {Ethereum: this.getNestingTokenAddressRaw(token).toLowerCase()};
+ static getTokenAccount(token: IToken) {
+ return {Ethereum: this.getTokenAddress(token).toLowerCase()};
}
- static getNestingTokenAddressRaw(token: IToken) {
+ static getTokenAddress(token: IToken) {
return nesting.tokenIdToAddress(token.collectionId, token.tokenId);
}
@@ -1370,7 +1370,7 @@
* @returns ```true``` if extrinsic success, otherwise ```false```
*/
async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {
- const rootTokenAddress = this.helper.util.getNestingTokenAddress(rootTokenObj);
+ const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);
const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);
if(!result) {
throw Error('Unable to nest token!');
@@ -1388,7 +1388,7 @@
* @returns ```true``` if extrinsic success, otherwise ```false```
*/
async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {
- const rootTokenAddress = this.helper.util.getNestingTokenAddress(rootTokenObj);
+ const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);
const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);
if(!result) {
throw Error('Unable to unnest token!');
@@ -2566,8 +2566,8 @@
return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);
}
- nestingAddress() {
- return this.collection.helper.util.getNestingTokenAddress(this);
+ nestingAccount() {
+ return this.collection.helper.util.getTokenAccount(this);
}
}