difftreelog
tests(nesting): revert majority of last commit + refactor token and collection naming convention
in: master
6 files changed
tests/src/fungible.test.tsdiffbeforeafterboth--- a/tests/src/fungible.test.ts
+++ b/tests/src/fungible.test.ts
@@ -15,7 +15,9 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect, U128_MAX} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+
+const U128_MAX = (1n << 128n) - 1n;
describe('integration test: Fungible functionality:', () => {
let alice: IKeyringPair;
tests/src/nesting/graphs.test.tsdiffbeforeafterboth--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -16,8 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {expect, itSub, usingPlaygrounds} from '../util/playgrounds';
-import {ITokenNonfungible} from '../util/playgrounds/types';
-import {UniqueHelper} from '../util/playgrounds/unique';
+import {UniqueHelper, UniqueNFToken} from '../util/playgrounds/unique';
/**
* ```dot
@@ -26,7 +25,7 @@
* 8 -> 5
* ```
*/
-async function buildComplexObjectGraph(helper: UniqueHelper, sender: IKeyringPair): Promise<ITokenNonfungible[]> {
+async function buildComplexObjectGraph(helper: UniqueHelper, sender: IKeyringPair): Promise<UniqueNFToken[]> {
const collection = await helper.nft.mintCollection(sender, {permissions: {nesting: {tokenOwner: true}}});
const tokens = await collection.mintMultipleTokens(sender, Array(8).fill({owner: {Substrate: sender.address}}));
tests/src/nesting/properties.test.tsdiffbeforeafterboth--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -16,8 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from '../util/playgrounds';
-import {ICollectionBase, ICollectionNFT, ITokenNonfungible, ICollectionRFT, ITokenRefungible} from '../util/playgrounds/types';
-import {UniqueHelper} from '../util/playgrounds/unique';
+import {UniqueHelper, UniqueBaseCollection, UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection, UniqueRFToken} from '../util/playgrounds/unique';
// ---------- COLLECTION PROPERTIES
@@ -37,7 +36,7 @@
expect(await collection.getProperties()).to.be.empty;
});
- async function testSetsPropertiesForCollection(collection: ICollectionBase) {
+ async function testSetsPropertiesForCollection(collection: UniqueBaseCollection) {
// As owner
await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}])).to.be.fulfilled;
@@ -61,7 +60,7 @@
await testSetsPropertiesForCollection(await helper.rft.mintCollection(alice));
});
- async function testCheckValidNames(collection: ICollectionBase) {
+ async function testCheckValidNames(collection: UniqueBaseCollection) {
// alpha symbols
await expect(collection.setProperties(alice, [{key: 'answer'}])).to.be.fulfilled;
@@ -95,7 +94,7 @@
await testCheckValidNames(await helper.rft.mintCollection(alice));
});
- async function testChangesProperties(collection: ICollectionBase) {
+ async function testChangesProperties(collection: UniqueBaseCollection) {
await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: ''}])).to.be.fulfilled;
// Mutate the properties
@@ -116,7 +115,7 @@
await testChangesProperties(await helper.rft.mintCollection(alice));
});
- async function testDeleteProperties(collection: ICollectionBase) {
+ async function testDeleteProperties(collection: UniqueBaseCollection) {
await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}])).to.be.fulfilled;
await expect(collection.deleteProperties(alice, ['electron'])).to.be.fulfilled;
@@ -147,7 +146,7 @@
});
});
- async function testFailsSetPropertiesIfNotOwnerOrAdmin(collection: ICollectionBase) {
+ async function testFailsSetPropertiesIfNotOwnerOrAdmin(collection: UniqueBaseCollection) {
await expect(collection.setProperties(bob, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}]))
.to.be.rejectedWith(/common\.NoPermission/);
@@ -162,7 +161,7 @@
await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.rft.mintCollection(alice));
});
- async function testFailsSetPropertiesThatExeedLimits(collection: ICollectionBase) {
+ async function testFailsSetPropertiesThatExeedLimits(collection: UniqueBaseCollection) {
const spaceLimit = (await (collection.helper!.api! as any).query.common.collectionProperties(collection.collectionId)).spaceLimit.toNumber();
// Mute the general tx parsing error, too many bytes to process
@@ -191,7 +190,7 @@
await testFailsSetPropertiesThatExeedLimits(await helper.rft.mintCollection(alice));
});
- async function testFailsSetMorePropertiesThanAllowed(collection: ICollectionBase) {
+ async function testFailsSetMorePropertiesThanAllowed(collection: UniqueBaseCollection) {
const propertiesToBeSet = [];
for (let i = 0; i < 65; i++) {
propertiesToBeSet.push({
@@ -214,7 +213,7 @@
await testFailsSetMorePropertiesThanAllowed(await helper.rft.mintCollection(alice));
});
- async function testFailsSetPropertiesWithInvalidNames(collection: ICollectionBase) {
+ async function testFailsSetPropertiesWithInvalidNames(collection: UniqueBaseCollection) {
const invalidProperties = [
[{key: 'electron', value: 'negative'}, {key: 'string theory', value: 'understandable'}],
[{key: 'Mr/Sandman', value: 'Bring me a gene'}],
@@ -281,7 +280,7 @@
expect(propertyRights).to.be.empty;
});
- async function testSetsAccessRightsToProperties(collection: ICollectionNFT | ICollectionRFT) {
+ async function testSetsAccessRightsToProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true}}]))
.to.be.fulfilled;
@@ -305,7 +304,7 @@
await testSetsAccessRightsToProperties(await helper.rft.mintCollection(alice));
});
- async function testChangesAccessRightsToProperty(collection: ICollectionNFT | ICollectionRFT) {
+ async function testChangesAccessRightsToProperty(collection: UniqueNFTCollection | UniqueRFTCollection) {
await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]))
.to.be.fulfilled;
@@ -338,7 +337,7 @@
});
});
- async function testPreventsFromSettingAccessRightsNotAdminOrOwner(collection: ICollectionNFT | ICollectionRFT) {
+ async function testPreventsFromSettingAccessRightsNotAdminOrOwner(collection: UniqueNFTCollection | UniqueRFTCollection) {
await expect(collection.setTokenPropertyPermissions(bob, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]))
.to.be.rejectedWith(/common\.NoPermission/);
@@ -354,7 +353,7 @@
await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.rft.mintCollection(alice));
});
- async function testPreventFromAddingTooManyPossibleProperties(collection: ICollectionNFT | ICollectionRFT) {
+ async function testPreventFromAddingTooManyPossibleProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
const constitution = [];
for (let i = 0; i < 65; i++) {
constitution.push({
@@ -378,7 +377,7 @@
await testPreventFromAddingTooManyPossibleProperties(await helper.rft.mintCollection(alice));
});
- async function testPreventAccessRightsModifiedIfConstant(collection: ICollectionNFT | ICollectionRFT) {
+ async function testPreventAccessRightsModifiedIfConstant(collection: UniqueNFTCollection | UniqueRFTCollection) {
await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
.to.be.fulfilled;
@@ -399,7 +398,7 @@
await testPreventAccessRightsModifiedIfConstant(await helper.rft.mintCollection(alice));
});
- async function testPreventsAddingPropertiesWithInvalidNames(collection: ICollectionNFT | ICollectionRFT) {
+ async function testPreventsAddingPropertiesWithInvalidNames(collection: UniqueNFTCollection | UniqueRFTCollection) {
const invalidProperties = [
[{key: 'skullduggery', permission: {tokenOwner: true}}, {key: 'im possible', permission: {collectionAdmin: true}}],
[{key: 'G#4', permission: {tokenOwner: true}}],
@@ -469,7 +468,7 @@
];
});
- async function testReadsYetEmptyProperties(token: ITokenNonfungible | ITokenRefungible) {
+ async function testReadsYetEmptyProperties(token: UniqueNFToken | UniqueRFToken) {
const properties = await token.getProperties();
expect(properties).to.be.empty;
@@ -489,7 +488,7 @@
await testReadsYetEmptyProperties(token);
});
- async function testAssignPropertiesAccordingToPermissions(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testAssignPropertiesAccordingToPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
await token.collection.addAdmin(alice, {Substrate: bob.address});
await token.transfer(alice, {Substrate: charlie.address}, pieces);
@@ -535,7 +534,7 @@
await testAssignPropertiesAccordingToPermissions(token, 100n);
});
- async function testChangesPropertiesAccordingPermission(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testChangesPropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
await token.collection.addAdmin(alice, {Substrate: bob.address});
await token.transfer(alice, {Substrate: charlie.address}, pieces);
@@ -588,7 +587,7 @@
await testChangesPropertiesAccordingPermission(token, 100n);
});
- async function testDeletePropertiesAccordingPermission(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testDeletePropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
await token.collection.addAdmin(alice, {Substrate: bob.address});
await token.transfer(alice, {Substrate: charlie.address}, pieces);
@@ -799,7 +798,7 @@
return (await (mode == 'NFT' ? api.query.nonfungible : api.query.refungible).tokenProperties(collectionId, tokenId)).toJSON().consumedSpace;
}
- async function prepare(token: ITokenNonfungible | ITokenRefungible, pieces: bigint): Promise<number> {
+ async function prepare(token: UniqueNFToken | UniqueRFToken, pieces: bigint): Promise<number> {
await token.collection.addAdmin(alice, {Substrate: bob.address});
await token.transfer(alice, {Substrate: charlie.address}, pieces);
@@ -823,7 +822,7 @@
return originalSpace;
}
- async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
const originalSpace = await prepare(token, pieces);
let i = 0;
@@ -858,7 +857,7 @@
await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, 100n);
});
- async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
const originalSpace = await prepare(token, pieces);
let i = 0;
@@ -893,7 +892,7 @@
await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, 100n);
});
- async function testForbidsAddingPropertiesIfPropertyNotDeclared(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testForbidsAddingPropertiesIfPropertyNotDeclared(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
const originalSpace = await prepare(token, pieces);
await expect(
@@ -929,7 +928,7 @@
await testForbidsAddingPropertiesIfPropertyNotDeclared(token, 100n);
});
- async function testForbidsAddingTooManyProperties(token: ITokenNonfungible | ITokenRefungible, pieces: bigint) {
+ async function testForbidsAddingTooManyProperties(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
const originalSpace = await prepare(token, pieces);
await expect(
@@ -984,7 +983,7 @@
});
});
- async function prepare(helper: UniqueHelper): Promise<ITokenRefungible> {
+ async function prepare(helper: UniqueHelper): Promise<UniqueRFToken> {
const collection = await helper.rft.mintCollection(alice);
const token = await collection.mintToken(alice, 100n);
tests/src/util/playgrounds/index.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/index.ts
+++ b/tests/src/util/playgrounds/index.ts
@@ -12,13 +12,6 @@
chai.use(chaiAsPromised);
export const expect = chai.expect;
-export const U128_MAX = (1n << 128n) - 1n;
-
-const MICROUNIQUE = 1_000_000_000_000n;
-const MILLIUNIQUE = 1_000n * MICROUNIQUE;
-const CENTIUNIQUE = 10n * MILLIUNIQUE;
-export const UNIQUE = 100n * CENTIUNIQUE;
-
export const usingPlaygrounds = async (code: (helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>, url: string = config.substrateUrl) => {
const silentConsole = new SilentConsole();
silentConsole.enable();
tests/src/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
import {IKeyringPair} from '@polkadot/types/types';
-import {UniqueHelper} from './unique';
export interface IEvent {
section: string;
@@ -107,7 +106,7 @@
}
}
-export interface ITokenAddress {
+export interface IToken {
collectionId: number;
tokenId: number;
}
@@ -168,169 +167,3 @@
export type TApiAllowedListeners = 'connected' | 'disconnected' | 'error' | 'ready' | 'decorated';
export type TUniqueNetworks = 'opal' | 'quartz' | 'unique';
export type TSigner = IKeyringPair; // | 'string'
-
-export interface ICollectionBase {
- helper: UniqueHelper;
- collectionId: number;
- getData: () => Promise<{
- id: number;
- name: string;
- description: string;
- tokensCount: number;
- admins: ICrossAccountId[];
- normalizedOwner: TSubstrateAccount;
- raw: any
- } | null>;
- getLastTokenId: () => Promise<number>;
- isTokenExists: (tokenId: number) => Promise<boolean>;
- getAdmins: () => Promise<ICrossAccountId[]>;
- getAllowList: () => Promise<ICrossAccountId[]>;
- getEffectiveLimits: () => Promise<ICollectionLimits>;
- getProperties: (propertyKeys?: string[]) => Promise<IProperty[]>;
- getTokenNextSponsored: (tokenId: number, addressObj: ICrossAccountId) => Promise<number | null>;
- setSponsor: (signer: TSigner, sponsorAddress: TSubstrateAccount) => Promise<boolean>;
- confirmSponsorship: (signer: TSigner) => Promise<boolean>;
- removeSponsor: (signer: TSigner) => Promise<boolean>;
- setLimits: (signer: TSigner, limits: ICollectionLimits) => Promise<boolean>;
- changeOwner: (signer: TSigner, ownerAddress: TSubstrateAccount) => Promise<boolean>;
- addAdmin: (signer: TSigner, adminAddressObj: ICrossAccountId) => Promise<boolean>;
- addToAllowList: (signer: TSigner, addressObj: ICrossAccountId) => Promise<boolean>;
- removeFromAllowList: (signer: TSigner, addressObj: ICrossAccountId) => Promise<boolean>;
- removeAdmin: (signer: TSigner, adminAddressObj: ICrossAccountId) => Promise<boolean>;
- setProperties: (signer: TSigner, properties: IProperty[]) => Promise<boolean>;
- deleteProperties: (signer: TSigner, propertyKeys: string[]) => Promise<boolean>;
- setPermissions: (signer: TSigner, permissions: ICollectionPermissions) => Promise<boolean>;
- enableNesting: (signer: TSigner, permissions: INestingPermissions) => Promise<boolean>;
- disableNesting: (signer: TSigner) => Promise<boolean>;
- burn: (signer: TSigner) => Promise<boolean>;
-}
-
-export interface ICollectionNFT extends ICollectionBase {
- getTokenObject: (tokenId: number) => ITokenNonfungible; // todo:playgrounds
- getTokensByAddress: (addressObj: ICrossAccountId) => Promise<number[]>;
- getToken: (tokenId: number, blockHashAt?: string) => Promise<{
- properties: IProperty[];
- owner: ICrossAccountId;
- normalizedOwner: ICrossAccountId;
- }| null>;
- getTokenOwner: (tokenId: number, blockHashAt?: string) => Promise<ICrossAccountId>;
- getTokenTopmostOwner: (tokenId: number, blockHashAt?: string) => Promise<ICrossAccountId | null>;
- getTokenChildren: (tokenId: number, blockHashAt?: string) => Promise<ITokenAddress[]>; // todo:playgrounds
- getPropertyPermissions: (propertyKeys?: string[]) => Promise<ITokenPropertyPermission[]>;
- getTokenProperties: (tokenId: number, propertyKeys?: string[]) => Promise<IProperty[]>;
- transferToken: (signer: TSigner, tokenId: number, addressObj: ICrossAccountId) => Promise<boolean>;
- transferTokenFrom: (signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) => Promise<boolean>;
- approveToken: (signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId) => Promise<boolean>;
- isTokenApproved: (tokenId: number, toAddressObj: ICrossAccountId) => Promise<boolean>;
- mintToken: (signer: TSigner, owner: ICrossAccountId, properties?: IProperty[]) => Promise<ITokenNonfungible>;// todo:playgrounds
- mintMultipleTokens: (signer: TSigner, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]) => Promise<ITokenNonfungible[]>;// todo:playgrounds
- burnToken: (signer: TSigner, tokenId: number) => Promise<{
- success: boolean,
- token: number | null
- }>;
- burnTokenFrom: (signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId) => Promise<boolean>;
- setTokenProperties: (signer: TSigner, tokenId: number, properties: IProperty[]) => Promise<boolean>;
- deleteTokenProperties: (signer: TSigner, tokenId: number, propertyKeys: string[]) => Promise<boolean>;
- setTokenPropertyPermissions: (signer: TSigner, permissions: ITokenPropertyPermission[]) => Promise<boolean>;
- nestToken: (signer: TSigner, tokenId: number, toTokenObj: ITokenAddress) => Promise<boolean>;
- unnestToken: (signer: TSigner, tokenId: number, fromTokenObj: ITokenAddress, toAddressObj: ICrossAccountId) => Promise<boolean>;
-}
-
-export interface ICollectionRFT extends ICollectionBase {
- getTokenObject: (tokenId: number) => ITokenRefungible;
- getToken: (tokenId: number, blockHashAt?: string) => Promise<{
- properties: IProperty[];
- owner: ICrossAccountId;
- normalizedOwner: ICrossAccountId;
- }| null>;
- getTokensByAddress: (addressObj: ICrossAccountId) => Promise<number[]>;
- getTop10TokenOwners: (tokenId: number) => Promise<ICrossAccountId[]>;
- getTokenBalance: (tokenId: number, addressObj: ICrossAccountId) => Promise<bigint>;
- getTokenTotalPieces: (tokenId: number) => Promise<bigint>;
- getTokenApprovedPieces: (tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) => Promise<bigint>;
- getPropertyPermissions: (propertyKeys?: string[] | null) => Promise<ITokenPropertyPermission[]>;
- getTokenProperties: (tokenId: number, propertyKeys?: string[]) => Promise<IProperty[]>;
- transferToken: (signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- transferTokenFrom: (signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- approveToken: (signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- repartitionToken: (signer: TSigner, tokenId: number, amount: bigint) => Promise<boolean>;
- mintToken: (signer: TSigner, pieces: bigint, owner: ICrossAccountId, properties?: IProperty[]) => Promise<ITokenRefungible>;
- mintMultipleTokens: (signer: TSigner, tokens: {pieces: bigint, owner: ICrossAccountId, properties?: IProperty[]}[]) => Promise<ITokenRefungible[]>; // todo:playgrounds
- burnToken: (signer: TSigner, tokenId: number, amount: bigint) => Promise<{
- success: boolean,
- token: number | null
- }>;
- burnTokenFrom: (signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- setTokenProperties: (signer: TSigner, tokenId: number, properties: IProperty[]) => Promise<boolean>;
- deleteTokenProperties: (signer: TSigner, tokenId: number, propertyKeys: string[]) => Promise<boolean>;
- setTokenPropertyPermissions: (signer: TSigner, permissions: ITokenPropertyPermission[]) => Promise<boolean>;
-}
-
-export interface ICollectionFT extends ICollectionBase {
- getBalance: (addressObj: ICrossAccountId) => Promise<bigint>;
- getTotalPieces: () => Promise<bigint>;
- getApprovedTokens: (fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) => Promise<bigint>;
- getTop10Owners: () => Promise<ICrossAccountId[]>;
- mint: (signer: TSigner, amount: bigint, owner: ICrossAccountId) => Promise<boolean>;
- mintWithOneOwner: (signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId) => Promise<boolean>;
- transfer: (signer: TSigner, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- transferFrom: (signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- burnTokens: (signer: TSigner, amount: bigint) => Promise<boolean>;
- burnTokensFrom: (signer: TSigner, fromAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- approveTokens: (signer: TSigner, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
-}
-
-export interface ITokenBase extends ITokenAddress {
- collection: ICollectionNFT | ICollectionRFT;
- getNextSponsored: (addressObj: ICrossAccountId) => Promise<number|null>;
- getProperties: (propertyKeys?: string[]) => Promise<IProperty[]>;
- setProperties: (signer: TSigner, properties: IProperty[]) => Promise<boolean>;
- deleteProperties: (signer: TSigner, propertyKeys: string[]) => Promise<boolean>;
- nestingAccount: () => ICrossAccountId;
- nestingAccountInLowerCase: () => ICrossAccountId;
-}
-
-export interface ITokenNonfungible extends ITokenBase {
- collection: ICollectionNFT;
- getData: (blockHashAt?: string) => Promise<{
- properties: IProperty[];
- owner: ICrossAccountId;
- normalizedOwner: ICrossAccountId;
- }| null>;
- getOwner: (blockHashAt?: string) => Promise<ICrossAccountId>;
- getTopmostOwner: (blockHashAt?: string) => Promise<ICrossAccountId | null>;
- getChildren: (blockHashAt?: string) => Promise<ITokenAddress[]>; // todo:playgrounds
- nest: (signer: TSigner, toTokenObj: ITokenAddress) => Promise<boolean>;
- unnest: (signer: TSigner, fromTokenObj: ITokenAddress, toAddressObj: ICrossAccountId) => Promise<boolean>;
- transfer: (signer: TSigner, addressObj: ICrossAccountId) => Promise<boolean>;
- transferFrom: (signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) => Promise<boolean>;
- approve: (signer: TSigner, toAddressObj: ICrossAccountId) => Promise<boolean>;
- isApproved: (toAddressObj: ICrossAccountId) => Promise<boolean>;
- burn: (signer: TSigner) => Promise<{
- success: boolean,
- token: number | null
- }>;
- burnFrom: (signer: TSigner, fromAddressObj: ICrossAccountId) => Promise<boolean>;
-}
-
-export interface ITokenRefungible extends ITokenBase {
- collection: ICollectionRFT;
- getData: (blockHashAt?: string) => Promise<{
- properties: IProperty[];
- owner: ICrossAccountId;
- normalizedOwner: ICrossAccountId;
- }| null>;
- getTop10Owners: () => Promise<ICrossAccountId[]>;
- getBalance: (addressObj: ICrossAccountId) => Promise<bigint>;
- getTotalPieces: () => Promise<bigint>;
- getApprovedPieces: (fromAddressObj: ICrossAccountId, toAccountObj: ICrossAccountId) => Promise<bigint>;
- transfer: (signer: TSigner, addressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- transferFrom: (signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- approve: (signer: TSigner, toAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
- repartition: (signer: TSigner, amount: bigint) => Promise<boolean>;
- burn: (signer: TSigner, amount: bigint) => Promise<{
- success: boolean,
- token: number | null
- }>;
- burnFrom: (signer: TSigner, fromAddressObj: ICrossAccountId, amount: bigint) => Promise<boolean>;
-}
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';11import {IKeyringPair} from '@polkadot/types/types';11import {IKeyringPair} from '@polkadot/types/types';12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISubstrateBalance, ITokenAddress, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, TUniqueNetworks, ICollectionBase, ICollectionNFT, ICollectionRFT, ITokenBase, ITokenNonfungible, ITokenRefungible, ICollectionFT} from './types';12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, TUniqueNetworks} from './types';131314export const crossAccountIdFromLower = (lowerAddress: ICrossAccountIdLower): ICrossAccountId => {14export const crossAccountIdFromLower = (lowerAddress: ICrossAccountIdLower): ICrossAccountId => {15 const address = {} as ICrossAccountId;15 const address = {} as ICrossAccountId;55 RPC: 'rpc',55 RPC: 'rpc',56 };56 };575758 static getTokenAccount(token: ITokenAddress): ICrossAccountId {58 static getTokenAccount(token: IToken): ICrossAccountId {59 return {Ethereum: this.getTokenAddress(token)};59 return {Ethereum: this.getTokenAddress(token)};60 }60 }616162 static getTokenAccountInLowerCase(token: ITokenAddress): ICrossAccountId {62 static getTokenAccountInLowerCase(token: IToken): ICrossAccountId {63 return {Ethereum: this.getTokenAddress(token).toLowerCase()};63 return {Ethereum: this.getTokenAddress(token).toLowerCase()};64 }64 }656566 static getTokenAddress(token: ITokenAddress): string {66 static getTokenAddress(token: IToken): string {67 return nesting.tokenIdToAddress(token.collectionId, token.tokenId);67 return nesting.tokenIdToAddress(token.collectionId, token.tokenId);68 }68 }69691218 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")1218 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")1219 * @returns object of the created collection1219 * @returns object of the created collection1220 */1220 */1221 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueCollectionBase> {1221 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueBaseCollection> {1222 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1222 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1223 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};1223 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};1224 for (const key of ['name', 'description', 'tokenPrefix']) {1224 for (const key of ['name', 'description', 'tokenPrefix']) {1260 * @example getTokenObject(10, 5);1260 * @example getTokenObject(10, 5);1261 * @returns instance of UniqueNFTToken1261 * @returns instance of UniqueNFTToken1262 */1262 */1263 getTokenObject(collectionId: number, tokenId: number): UniqueNFTToken {1263 getTokenObject(collectionId: number, tokenId: number): UniqueNFToken {1264 return new UniqueNFTToken(tokenId, this.getCollectionObject(collectionId));1264 return new UniqueNFToken(tokenId, this.getCollectionObject(collectionId));1265 }1265 }126612661267 /**1267 /**1352 * @example getTokenChildren(10, 5);1352 * @example getTokenChildren(10, 5);1353 * @returns tokens whose depth of nesting is <= 51353 * @returns tokens whose depth of nesting is <= 51354 */1354 */1355 async getTokenChildren(collectionId: number, tokenId: number, blockHashAt?: string): Promise<ITokenAddress[]> {1355 async getTokenChildren(collectionId: number, tokenId: number, blockHashAt?: string): Promise<IToken[]> {1356 let children;1356 let children;1357 if(typeof blockHashAt === 'undefined') {1357 if(typeof blockHashAt === 'undefined') {1358 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId]);1358 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId]);1373 * @example nestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4});1373 * @example nestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4});1374 * @returns ```true``` if extrinsic success, otherwise ```false```1374 * @returns ```true``` if extrinsic success, otherwise ```false```1375 */1375 */1376 async nestToken(signer: TSigner, tokenObj: ITokenAddress, rootTokenObj: ITokenAddress): Promise<boolean> {1376 async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {1377 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1377 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1378 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);1378 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);1379 if(!result) {1379 if(!result) {1391 * @example unnestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4}, {Substrate: "5DyN4Y92vZCjv38fg..."});1391 * @example unnestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4}, {Substrate: "5DyN4Y92vZCjv38fg..."});1392 * @returns ```true``` if extrinsic success, otherwise ```false```1392 * @returns ```true``` if extrinsic success, otherwise ```false```1393 */1393 */1394 async unnestToken(signer: TSigner, tokenObj: ITokenAddress, rootTokenObj: ITokenAddress, toAddressObj: ICrossAccountId): Promise<boolean> {1394 async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {1395 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1395 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1396 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);1396 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);1397 if(!result) {1397 if(!result) {1422 * @param data token data1422 * @param data token data1423 * @returns created token object1423 * @returns created token object1424 */1424 */1425 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFTToken> {1425 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFToken> {1426 const creationResult = await this.helper.executeExtrinsic(1426 const creationResult = await this.helper.executeExtrinsic(1427 signer,1427 signer,1428 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1428 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1453 * }]);1453 * }]);1454 * @returns ```true``` if extrinsic success, otherwise ```false```1454 * @returns ```true``` if extrinsic success, otherwise ```false```1455 */1455 */1456 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFTToken[]> {1456 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1457 const creationResult = await this.helper.executeExtrinsic(1457 const creationResult = await this.helper.executeExtrinsic(1458 signer,1458 signer,1459 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],1459 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],1460 true,1460 true,1461 );1461 );1462 const collection = this.getCollectionObject(collectionId);1462 const collection = this.getCollectionObject(collectionId);1463 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: ITokenAddress) => collection.getTokenObject(x.tokenId));1463 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1464 }1464 }146514651466 /**1466 /**1481 * }]);1481 * }]);1482 * @returns array of newly created tokens1482 * @returns array of newly created tokens1483 */1483 */1484 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFTToken[]> {1484 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1485 const rawTokens = [];1485 const rawTokens = [];1486 for (const token of tokens) {1486 for (const token of tokens) {1487 const raw = {NFT: {properties: token.properties}};1487 const raw = {NFT: {properties: token.properties}};1493 true,1493 true,1494 );1494 );1495 const collection = this.getCollectionObject(collectionId);1495 const collection = this.getCollectionObject(collectionId);1496 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: ITokenAddress) => collection.getTokenObject(x.tokenId));1496 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1497 }1497 }149814981499 /**1499 /**1530 * @example getTokenObject(10, 5);1530 * @example getTokenObject(10, 5);1531 * @returns instance of UniqueNFTToken1531 * @returns instance of UniqueNFTToken1532 */1532 */1533 getTokenObject(collectionId: number, tokenId: number): UniqueRFTToken {1533 getTokenObject(collectionId: number, tokenId: number): UniqueRFToken {1534 return new UniqueRFTToken(tokenId, this.getCollectionObject(collectionId));1534 return new UniqueRFToken(tokenId, this.getCollectionObject(collectionId));1535 }1535 }153615361537 /**1537 /**1609 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});1609 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});1610 * @returns created token object1610 * @returns created token object1611 */1611 */1612 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFTToken> {1612 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFToken> {1613 const creationResult = await this.helper.executeExtrinsic(1613 const creationResult = await this.helper.executeExtrinsic(1614 signer,1614 signer,1615 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1615 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1626 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1626 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1627 }1627 }162816281629 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFTToken[]> {1629 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1630 throw Error('Not implemented');1630 throw Error('Not implemented');1631 const creationResult = await this.helper.executeExtrinsic(1631 const creationResult = await this.helper.executeExtrinsic(1632 signer,1632 signer,1633 'api.tx.unique.createMultipleItemsEx', [collectionId, {RefungibleMultipleOwners: tokens}],1633 'api.tx.unique.createMultipleItemsEx', [collectionId, {RefungibleMultipleOwners: tokens}],1634 true, // `Unable to mint RFT tokens for ${label}`,1634 true, // `Unable to mint RFT tokens for ${label}`,1635 );1635 );1636 const collection = this.getCollectionObject(collectionId);1636 const collection = this.getCollectionObject(collectionId);1637 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: ITokenAddress) => collection.getTokenObject(x.tokenId));1637 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1638 }1638 }163916391640 /**1640 /**1646 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);1646 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);1647 * @returns array of newly created RFT tokens1647 * @returns array of newly created RFT tokens1648 */1648 */1649 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFTToken[]> {1649 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1650 const rawTokens = [];1650 const rawTokens = [];1651 for (const token of tokens) {1651 for (const token of tokens) {1652 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};1652 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};1658 true,1658 true,1659 );1659 );1660 const collection = this.getCollectionObject(collectionId);1660 const collection = this.getCollectionObject(collectionId);1661 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: ITokenAddress) => collection.getTokenObject(x.tokenId));1661 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1662 }1662 }166316631664 /**1664 /**19841984198519851986class BalanceGroup extends HelperGroup {1986class BalanceGroup extends HelperGroup {1987 /**1987 /**1988 * Representation of the native token in the smallest unit1988 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).1989 * @example getOneTokenNominal()1989 * @example getOneTokenNominal()1990 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.1990 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.1991 */1991 */1992 getOneTokenNominal(): bigint {1992 getOneTokenNominal(): bigint {1993 const chainProperties = this.helper.chain.getChainProperties();1993 const chainProperties = this.helper.chain.getChainProperties();1994 return 10n ** BigInt((chainProperties.tokenDecimals || [18])[0]);1994 return 10n ** BigInt((chainProperties.tokenDecimals || [18])[0]);2223}2223}22242224222522252226class UniqueCollectionBase implements ICollectionBase {2226export class UniqueBaseCollection {2227 helper: UniqueHelper;2227 helper: UniqueHelper;2228 collectionId: number;2228 collectionId: number;222922292326}2326}23272327232823282329class UniqueNFTCollection extends UniqueCollectionBase implements ICollectionNFT {2329export class UniqueNFTCollection extends UniqueBaseCollection {2330 getTokenObject(tokenId: number) {2330 getTokenObject(tokenId: number) {2331 return new UniqueNFTToken(tokenId, this);2331 return new UniqueNFToken(tokenId, this);2332 }2332 }233323332334 async getTokensByAddress(addressObj: ICrossAccountId) {2334 async getTokensByAddress(addressObj: ICrossAccountId) {2403 return await this.helper.nft.setTokenPropertyPermissions(signer, this.collectionId, permissions);2403 return await this.helper.nft.setTokenPropertyPermissions(signer, this.collectionId, permissions);2404 }2404 }240524052406 async nestToken(signer: TSigner, tokenId: number, toTokenObj: ITokenAddress) {2406 async nestToken(signer: TSigner, tokenId: number, toTokenObj: IToken) {2407 return await this.helper.nft.nestToken(signer, {collectionId: this.collectionId, tokenId}, toTokenObj);2407 return await this.helper.nft.nestToken(signer, {collectionId: this.collectionId, tokenId}, toTokenObj);2408 }2408 }240924092410 async unnestToken(signer: TSigner, tokenId: number, fromTokenObj: ITokenAddress, toAddressObj: ICrossAccountId) {2410 async unnestToken(signer: TSigner, tokenId: number, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {2411 return await this.helper.nft.unnestToken(signer, {collectionId: this.collectionId, tokenId}, fromTokenObj, toAddressObj);2411 return await this.helper.nft.unnestToken(signer, {collectionId: this.collectionId, tokenId}, fromTokenObj, toAddressObj);2412 }2412 }2413}2413}24142414241524152416class UniqueRFTCollection extends UniqueCollectionBase implements ICollectionRFT {2416export class UniqueRFTCollection extends UniqueBaseCollection {2417 getTokenObject(tokenId: number) {2417 getTokenObject(tokenId: number) {2418 return new UniqueRFTToken(tokenId, this);2418 return new UniqueRFToken(tokenId, this);2419 }2419 }242024202421 async getToken(tokenId: number, blockHashAt?: string) {2421 async getToken(tokenId: number, blockHashAt?: string) {2496}2496}24972497249824982499class UniqueFTCollection extends UniqueCollectionBase implements ICollectionFT {2499export class UniqueFTCollection extends UniqueBaseCollection {2500 async getBalance(addressObj: ICrossAccountId) {2500 async getBalance(addressObj: ICrossAccountId) {2501 return await this.helper.ft.getBalance(this.collectionId, addressObj);2501 return await this.helper.ft.getBalance(this.collectionId, addressObj);2502 }2502 }2543}2543}25442544254525452546class UniqueTokenBase implements ITokenBase {2546export class UniqueBaseToken {2547 collection: UniqueNFTCollection | UniqueRFTCollection;2547 collection: UniqueNFTCollection | UniqueRFTCollection;2548 collectionId: number;2548 collectionId: number;2549 tokenId: number;2549 tokenId: number;2580}2580}25812581258225822583class UniqueNFTToken extends UniqueTokenBase implements ITokenNonfungible {2583export class UniqueNFToken extends UniqueBaseToken {2584 collection: UniqueNFTCollection;2584 collection: UniqueNFTCollection;258525852586 constructor(tokenId: number, collection: UniqueNFTCollection) {2586 constructor(tokenId: number, collection: UniqueNFTCollection) {2604 return await this.collection.getTokenChildren(this.tokenId, blockHashAt);2604 return await this.collection.getTokenChildren(this.tokenId, blockHashAt);2605 }2605 }260626062607 async nest(signer: TSigner, toTokenObj: ITokenAddress) {2607 async nest(signer: TSigner, toTokenObj: IToken) {2608 return await this.collection.nestToken(signer, this.tokenId, toTokenObj);2608 return await this.collection.nestToken(signer, this.tokenId, toTokenObj);2609 }2609 }261026102611 async unnest(signer: TSigner, fromTokenObj: ITokenAddress, toAddressObj: ICrossAccountId) {2611 async unnest(signer: TSigner, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {2612 return await this.collection.unnestToken(signer, this.tokenId, fromTokenObj, toAddressObj);2612 return await this.collection.unnestToken(signer, this.tokenId, fromTokenObj, toAddressObj);2613 }2613 }261426142637 }2637 }2638}2638}263926392640class UniqueRFTToken extends UniqueTokenBase implements ITokenRefungible {2640export class UniqueRFToken extends UniqueBaseToken {2641 collection: UniqueRFTCollection;2641 collection: UniqueRFTCollection;264226422643 constructor(tokenId: number, collection: UniqueRFTCollection) {2643 constructor(tokenId: number, collection: UniqueRFTCollection) {