difftreelog
Merge pull request #655 from UniqueNetwork/tests/feed-alices
in: master
Parallel tests
139 files changed
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -5,11 +5,11 @@
"main": "",
"devDependencies": {
"@polkadot/ts": "0.4.22",
- "@polkadot/typegen": "9.2.2",
+ "@polkadot/typegen": "9.5.1",
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/chai-like": "^1.1.1",
- "@types/mocha": "^9.1.1",
+ "@types/mocha": "^10.0.0",
"@types/node": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
@@ -21,34 +21,37 @@
},
"mocha": {
"timeout": 9999999,
- "require": "ts-node/register"
+ "require": ["ts-node/register"]
},
"scripts": {
"lint": "eslint --ext .ts,.js src/",
"fix": "eslint --ext .ts,.js src/ --fix",
- "test": "mocha --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",
- "testEth": "mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.test.ts'",
- "testEthMarketplace": "mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.test.ts'",
- "testEthNesting": "mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.test.ts'",
- "testEthFractionalizer": "mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.test.ts'",
+ "setup": "ts-node ./src/util/globalSetup.ts",
+
+ "test": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.*test.ts'",
+ "testParallelFull": "yarn testParallel && yarn testSequential",
+ "testParallel": "yarn setup && mocha --parallel --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",
+ "testSequential": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.seqtest.ts'",
+ "testStructure": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/nesting/*.*test.ts",
+ "testEth": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.*test.ts'",
+ "testEthNesting": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.*test.ts'",
+ "testEthFractionalizer": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.*test.ts'",
+ "testEthMarketplace": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.*test.ts'",
+ "testEvent": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.*test.ts",
+ "testRmrk": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/rmrk/*.*test.ts",
+
"testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",
+ "testEthTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/eth/tokenProperties.test.ts",
"testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",
- "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",
- "loadTransfer": "ts-node src/transfer.nload.ts",
- "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",
- "testEvent": "mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.test.ts",
"testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",
"testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",
- "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",
"testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",
"testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",
- "testRmrk": "mocha --timeout 9999999 -r ts-node/register ./**/rmrk/**.test.ts",
"testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",
- "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",
"testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",
"testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",
"testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",
- "testConfirmSponsorship": "mocha --timeout 9999999 -r ts-node/register ./**/confirmSponsorship.test.ts",
+ "testConfirmSponsorship": "mocha --timeout 9999999 --parallel -r ts-node/register ./**/confirmSponsorship.test.ts",
"testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",
"testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",
"testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",
@@ -78,12 +81,6 @@
"testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",
"testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",
"testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",
- "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",
- "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",
- "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",
- "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",
- "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",
- "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",
"testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",
"testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
"testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",
@@ -96,7 +93,18 @@
"testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",
"testEthFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/fungible.test.ts",
"testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",
- "testPromotion": "mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.test.ts",
+ "testPromotion": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.test.ts",
+
+ "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",
+ "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",
+ "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",
+ "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",
+ "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",
+ "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",
+
+ "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",
+ "loadTransfer": "ts-node src/transfer.nload.ts",
+
"polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",
"polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",
"polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",
@@ -106,14 +114,14 @@
"license": "SEE LICENSE IN ../LICENSE",
"homepage": "",
"dependencies": {
- "@polkadot/api": "9.2.2",
- "@polkadot/api-contract": "9.2.2",
- "@polkadot/util-crypto": "10.1.7",
- "bignumber.js": "^9.0.2",
+ "@polkadot/api": "9.5.1",
+ "@polkadot/api-contract": "9.5.1",
+ "@polkadot/util-crypto": "10.1.10",
+ "bignumber.js": "^9.1.0",
"chai-as-promised": "^7.1.1",
"chai-like": "^1.1.1",
"find-process": "^1.4.7",
- "solc": "0.8.14-fixed",
+ "solc": "0.8.17",
"web3": "^1.7.3"
},
"standard": {
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
describe('Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {
let donor: IKeyringPair;
before(async () => {
- await usingPlaygrounds(async (_, privateKeyWrapper) => {
- donor = privateKeyWrapper('//Alice');
+ await usingPlaygrounds(async (_, privateKey) => {
+ donor = await privateKey({filename: __filename});
});
});
@@ -44,8 +44,8 @@
let donor: IKeyringPair;
before(async () => {
- await usingPlaygrounds(async (_, privateKeyWrapper) => {
- donor = privateKeyWrapper('//Alice');
+ await usingPlaygrounds(async (_, privateKey) => {
+ donor = await privateKey({filename: __filename});
});
});
tests/src/adminTransferAndBurn.test.tsdiffbeforeafterboth--- a/tests/src/adminTransferAndBurn.test.ts
+++ b/tests/src/adminTransferAndBurn.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from './util';
describe('Integration Test: ownerCanTransfer allows admins to use only transferFrom/burnFrom:', () => {
let alice: IKeyringPair;
@@ -24,7 +24,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
tests/src/allowLists.test.tsdiffbeforeafterboth--- a/tests/src/allowLists.test.ts
+++ b/tests/src/allowLists.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from './util';
import {ICollectionPermissions} from './util/playgrounds/types';
describe('Integration Test ext. Allow list tests', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([30n, 10n, 10n], donor);
});
});
@@ -87,7 +87,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([30n, 10n, 10n], donor);
});
});
@@ -163,7 +163,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([30n, 10n, 10n], donor);
});
});
@@ -291,7 +291,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/app-promotion.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/app-promotion.seqtest.ts
@@ -0,0 +1,82 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, usingPlaygrounds, Pallets, requirePalletsOrSkip} from './util';
+import {expect} from './eth/util';
+
+let superuser: IKeyringPair;
+let donor: IKeyringPair;
+let palletAdmin: IKeyringPair;
+
+describe('App promotion', () => {
+ before(async function () {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ requirePalletsOrSkip(this, helper, [Pallets.AppPromotion]);
+ superuser = await privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
+ palletAdmin = await privateKey('//PromotionAdmin');
+ const api = helper.getApi();
+ await helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})));
+ });
+ });
+
+ after(async function () {
+ await usingPlaygrounds(async (helper) => {
+ if (helper.fetchMissingPalletNames([Pallets.AppPromotion]).length != 0) return;
+ const api = helper.getApi();
+ await helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})));
+ });
+ });
+
+ describe('admin adress', () => {
+ itSub('can be set by sudo only', async ({helper}) => {
+ const api = helper.getApi();
+ const [nonAdmin] = await helper.arrange.createAccounts([10n], donor);
+ // nonAdmin can not set admin not from himself nor as a sudo
+ await expect(helper.signTransaction(nonAdmin, api.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address}))).to.be.rejected;
+ await expect(helper.signTransaction(nonAdmin, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address})))).to.be.rejected;
+ });
+
+ itSub('can be any valid CrossAccountId', async ({helper}) => {
+ // We are not going to set an eth address as a sponsor,
+ // but we do want to check, it doesn't break anything;
+ const api = helper.getApi();
+ const [account] = await helper.arrange.createAccounts([10n], donor);
+ const ethAccount = helper.address.substrateToEth(account.address);
+ // Alice sets Ethereum address as a sudo. Then Substrate address back...
+ await expect(helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Ethereum: ethAccount})))).to.be.fulfilled;
+ await expect(helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.fulfilled;
+
+ // ...It doesn't break anything;
+ const collection = await helper.nft.mintCollection(account, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'});
+ await expect(helper.signTransaction(account, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.rejected;
+ });
+
+ itSub('can be reassigned', async ({helper}) => {
+ const api = helper.getApi();
+ const [oldAdmin, newAdmin, collectionOwner] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
+ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'});
+
+ await expect(helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: oldAdmin.address})))).to.be.fulfilled;
+ await expect(helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: newAdmin.address})))).to.be.fulfilled;
+ await expect(helper.signTransaction(oldAdmin, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.rejected;
+
+ await expect(helper.signTransaction(newAdmin, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.fulfilled;
+ });
+ });
+});
+
tests/src/app-promotion.test.tsdiffbeforeafterboth--- a/tests/src/app-promotion.test.ts
+++ b/tests/src/app-promotion.test.ts
@@ -15,17 +15,15 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, Pallets, requirePalletsOrSkip} from './util/playgrounds';
-import {encodeAddress} from '@polkadot/util-crypto';
-import {stringToU8a} from '@polkadot/util';
+import {itSub, usingPlaygrounds, Pallets, requirePalletsOrSkip} from './util';
import {DevUniqueHelper} from './util/playgrounds/unique.dev';
-import {itEth, expect, SponsoringMode} from './eth/util/playgrounds';
+import {itEth, expect, SponsoringMode} from './eth/util';
-let alice: IKeyringPair;
+let donor: IKeyringPair;
let palletAdmin: IKeyringPair;
let nominal: bigint;
-const palletAddress = calculatePalleteAddress('appstake');
-let accounts: IKeyringPair[] = [];
+let palletAddress: string;
+let accounts: IKeyringPair[];
const LOCKING_PERIOD = 20n; // 20 blocks of relay
const UNLOCKING_PERIOD = 10n; // 10 blocks of parachain
const rewardAvailableInBlock = (stakedInBlock: bigint) => {
@@ -37,14 +35,11 @@
before(async function () {
await usingPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.AppPromotion]);
- alice = privateKey('//Alice');
- palletAdmin = privateKey('//Charlie'); // TODO use custom address
- const api = helper.getApi();
- await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})));
+ donor = await privateKey({filename: __filename});
+ palletAddress = helper.arrange.calculatePalletAddress('appstake');
+ palletAdmin = await privateKey('//PromotionAdmin');
nominal = helper.balance.getOneTokenNominal();
- await helper.balance.transferToSubstrate(alice, palletAdmin.address, 1000n * nominal);
- await helper.balance.transferToSubstrate(alice, palletAddress, 1000n * nominal);
- accounts = await helper.arrange.createCrowd(100, 1000n, alice); // create accounts-pool to speed up tests
+ accounts = await helper.arrange.createCrowd(100, 1000n, donor); // create accounts-pool to speed up tests
});
});
@@ -76,7 +71,7 @@
});
itSub('should allow to create maximum 10 stakes for account', async ({helper}) => {
- const [staker] = await helper.arrange.createAccounts([2000n], alice);
+ const [staker] = await helper.arrange.createAccounts([2000n], donor);
for (let i = 0; i < 10; i++) {
await helper.staking.stake(staker, 100n * nominal);
}
@@ -144,7 +139,7 @@
expect(await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(999n);
// staker can transfer:
- await helper.balance.transferToSubstrate(staker, alice.address, 998n * nominal);
+ await helper.balance.transferToSubstrate(staker, donor.address, 998n * nominal);
expect(await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(1n);
});
@@ -224,55 +219,7 @@
});
});
- describe('admin adress', () => {
- itSub('can be set by sudo only', async ({helper}) => {
- const api = helper.getApi();
- const nonAdmin = accounts.pop()!;
- // nonAdmin can not set admin not from himself nor as a sudo
- await expect(helper.signTransaction(nonAdmin, api.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address}))).to.be.rejected;
- await expect(helper.signTransaction(nonAdmin, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address})))).to.be.rejected;
-
- // Alice can
- await expect(helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.fulfilled;
- });
-
- itSub('can be any valid CrossAccountId', async ({helper}) => {
- // We are not going to set an eth address as a sponsor,
- // but we do want to check, it doesn't break anything;
- const api = helper.getApi();
- const account = accounts.pop()!;
- const ethAccount = helper.address.substrateToEth(account.address);
- // Alice sets Ethereum address as a sudo. Then Substrate address back...
- await expect(helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Ethereum: ethAccount})))).to.be.fulfilled;
- await expect(helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.fulfilled;
-
- // ...It doesn't break anything;
- const collection = await helper.nft.mintCollection(account, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'});
- await expect(helper.signTransaction(account, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.rejected;
- });
-
- itSub('can be reassigned', async ({helper}) => {
- const api = helper.getApi();
- const [oldAdmin, newAdmin, collectionOwner] = [accounts.pop()!, accounts.pop()!, accounts.pop()!];
- const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'});
-
- await expect(helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: oldAdmin.address})))).to.be.fulfilled;
- await expect(helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: newAdmin.address})))).to.be.fulfilled;
- await expect(helper.signTransaction(oldAdmin, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.rejected;
-
- await expect(helper.signTransaction(newAdmin, api.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.fulfilled;
- });
- });
-
describe('collection sponsoring', () => {
- before(async function () {
- await usingPlaygrounds(async (helper) => {
- const api = helper.getApi();
- const tx = api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address}));
- await helper.signTransaction(alice, tx);
- });
- });
-
itSub('should actually sponsor transactions', async ({helper}) => {
const api = helper.getApi();
const [collectionOwner, tokenSender, receiver] = [accounts.pop()!, accounts.pop()!, accounts.pop()!];
@@ -343,7 +290,7 @@
itSub('should not overwrite collection limits set by the owner earlier', async ({helper}) => {
const api = helper.getApi();
const limits = {ownerCanDestroy: true, ownerCanTransfer: true, sponsorTransferTimeout: 0};
- const collectionWithLimits = await helper.nft.mintCollection(alice, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion', limits});
+ const collectionWithLimits = await helper.nft.mintCollection(accounts.pop()!, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion', limits});
await expect(helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorCollection(collectionWithLimits.collectionId))).to.be.fulfilled;
expect((await collectionWithLimits.getData())?.raw.limits).to.be.deep.contain(limits);
@@ -416,7 +363,7 @@
describe('contract sponsoring', () => {
itEth('should set palletes address as a sponsor', async ({helper}) => {
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner); // await deployFlipper(web3, contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
@@ -432,7 +379,7 @@
});
itEth('should overwrite sponsoring mode and existed sponsor', async ({helper}) => {
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner); // await deployFlipper(web3, contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
@@ -459,7 +406,7 @@
});
itEth('can be overwritten by contract owner', async ({helper}) => {
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner); // await deployFlipper(web3, contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
@@ -480,7 +427,7 @@
itEth('can not be set by non admin', async ({helper}) => {
const nonAdmin = accounts.pop()!;
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner); // await deployFlipper(web3, contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
@@ -499,18 +446,18 @@
itEth('should actually sponsor transactions', async ({helper}) => {
// Contract caller
- const caller = await helper.eth.createAccountWithBalance(alice, 1000n);
+ const caller = await helper.eth.createAccountWithBalance(donor, 1000n);
const palletBalanceBefore = await helper.balance.getSubstrate(palletAddress);
// Deploy flipper
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner); // await deployFlipper(web3, contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
// Owner sets to sponsor every tx
await contractHelper.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: contractOwner});
await contractHelper.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: contractOwner});
- await helper.eth.transferBalanceFromSubstrate(alice, flipper.options.address, 1000n); // transferBalanceToEth(api, alice, flipper.options.address, 1000n);
+ await helper.eth.transferBalanceFromSubstrate(donor, flipper.options.address, 1000n); // transferBalanceToEth(api, alice, flipper.options.address, 1000n);
// Set promotion to the Flipper
await helper.executeExtrinsic(palletAdmin, 'api.tx.appPromotion.sponsorContract', [flipper.options.address], true);
@@ -533,10 +480,10 @@
describe('stopSponsoringContract', () => {
itEth('should remove pallet address from contract sponsors', async ({helper}) => {
- const caller = await helper.eth.createAccountWithBalance(alice, 1000n);
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const caller = await helper.eth.createAccountWithBalance(donor, 1000n);
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner);
- await helper.eth.transferBalanceFromSubstrate(alice, flipper.options.address);
+ await helper.eth.transferBalanceFromSubstrate(donor, flipper.options.address);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
await contractHelper.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: contractOwner});
@@ -557,12 +504,12 @@
// caller payed for call
expect(1000n * nominal > callerBalance).to.be.true;
- expect(contractBalanceAfter).to.be.equal(1000n * nominal);
+ expect(contractBalanceAfter).to.be.equal(100n * nominal);
});
itEth('can not be called by non-admin', async ({helper}) => {
const nonAdmin = accounts.pop()!;
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner);
await helper.executeExtrinsic(palletAdmin, 'api.tx.appPromotion.sponsorContract', [flipper.options.address]);
@@ -572,7 +519,7 @@
itEth('should not affect a contract which is not sponsored by pallete', async ({helper}) => {
const nonAdmin = accounts.pop()!;
- const contractOwner = (await helper.eth.createAccountWithBalance(alice, 1000n)).toLowerCase();
+ const contractOwner = (await helper.eth.createAccountWithBalance(donor, 1000n)).toLowerCase();
const flipper = await helper.eth.deployFlipper(contractOwner);
const contractHelper = helper.ethNativeContract.contractHelpers(contractOwner);
await expect(contractHelper.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.fulfilled;
@@ -613,7 +560,7 @@
await helper.staking.stake(staker, 200n * nominal);
// wait rewards are available:
- const [_, stake2] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});
+ const [_stake1, stake2] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});
await helper.wait.forRelayBlockNumber(rewardAvailableInBlock(stake2.block));
const payoutToStaker = (await helper.admin.payoutStakers(palletAdmin, 100)).find((payout) => payout.staker === staker.address)?.payout;
@@ -678,7 +625,7 @@
itSub.skip('can be paid 1000 rewards in a time', async ({helper}) => {
// all other stakes should be unstaked
- const oneHundredStakers = await helper.arrange.createCrowd(100, 1050n, alice);
+ const oneHundredStakers = await helper.arrange.createCrowd(100, 1050n, donor);
// stakers stakes 10 times each
for (let i = 0; i < 10; i++) {
@@ -689,7 +636,6 @@
});
itSub.skip('can handle 40.000 rewards', async ({helper}) => {
- const [donor] = await helper.arrange.createAccounts([7_000_000n], alice);
const crowdStakes = async () => {
// each account in the crowd stakes 2 times
const crowd = await helper.arrange.createCrowd(500, 300n, donor);
@@ -706,11 +652,6 @@
});
});
});
-
-function calculatePalleteAddress(palletId: any) {
- const address = stringToU8a(('modl' + palletId).padEnd(32, '\0'));
- return encodeAddress(address);
-}
function calculateIncome(base: bigint, calcPeriod: bigint, iter = 0): bigint {
const DAY = 7200n;
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
+import {expect, itSub, Pallets, usingPlaygrounds} from './util';
describe('Integration Test approve(spender, collection_id, item_id, amount):', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -104,7 +104,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -141,7 +141,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -184,7 +184,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -227,7 +227,7 @@
});
});
-describe('Approved amount decreases by the transferred amount.:', () => {
+describe('Approved amount decreases by the transferred amount:', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
let charlie: IKeyringPair;
@@ -235,7 +235,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
});
});
@@ -265,7 +265,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -320,7 +320,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -357,7 +357,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
});
});
@@ -423,7 +423,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
});
});
@@ -474,7 +474,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -495,7 +495,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
tests/src/block-production.test.tsdiffbeforeafterboth--- a/tests/src/block-production.test.ts
+++ b/tests/src/block-production.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {ApiPromise} from '@polkadot/api';
-import {expect, itSub} from './util/playgrounds';
+import {expect, itSub} from './util';
const BLOCK_TIME_MS = 12000;
const TOLERANCE_MS = 3000;
tests/src/burnItem.test.tsdiffbeforeafterboth--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
+import {expect, itSub, Pallets, usingPlaygrounds} from './util';
describe('integration test: ext. burnItem():', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
@@ -80,7 +80,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
@@ -123,7 +123,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/calibrate.tsdiffbeforeafterboth--- a/tests/src/calibrate.ts
+++ b/tests/src/calibrate.ts
@@ -1,6 +1,6 @@
import {IKeyringPair} from '@polkadot/types/types';
-import {usingEthPlaygrounds, EthUniqueHelper} from './eth/util/playgrounds';
+import {usingEthPlaygrounds, EthUniqueHelper} from './eth/util';
function linearRegression(points: { x: bigint, y: bigint }[]) {
@@ -56,9 +56,9 @@
}).reduce((a, b) => a + b, 0n) / BigInt(points.length));
}
-async function calibrateWeightToFee(helper: EthUniqueHelper, privateKey: (account: string) => IKeyringPair) {
- const alice = privateKey('//Alice');
- const bob = privateKey('//Bob');
+async function calibrateWeightToFee(helper: EthUniqueHelper, privateKey: (account: string) => Promise<IKeyringPair>) {
+ const alice = await privateKey('//Alice');
+ const bob = await privateKey('//Bob');
const dataPoints = [];
{
@@ -106,8 +106,8 @@
}
}
-async function calibrateMinGasPrice(helper: EthUniqueHelper, privateKey: (account: string) => IKeyringPair) {
- const alice = privateKey('//Alice');
+async function calibrateMinGasPrice(helper: EthUniqueHelper, privateKey: (account: string) => Promise<IKeyringPair>) {
+ const alice = await privateKey('//Alice');
const caller = await helper.eth.createAccountWithBalance(alice);
const receiver = helper.eth.createAccount();
const dataPoints = [];
tests/src/change-collection-owner.test.tsdiffbeforeafterboth--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from './util';
describe('Integration Test changeCollectionOwner(collection_id, new_owner):', () => {
let alice: IKeyringPair;
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
@@ -46,7 +46,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -108,7 +108,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
tests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/burnItemEvent.test.ts
+++ b/tests/src/check-event/burnItemEvent.test.ts
@@ -16,7 +16,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from '../util';
import {IEvent} from '../util/playgrounds/types';
@@ -24,7 +24,7 @@
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/check-event/createCollectionEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/createCollectionEvent.test.ts
+++ b/tests/src/check-event/createCollectionEvent.test.ts
@@ -16,14 +16,14 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';
+import {usingPlaygrounds, itSub, expect} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Create collection event ', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/createItemEvent.test.ts
+++ b/tests/src/check-event/createItemEvent.test.ts
@@ -16,14 +16,14 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Create Item event ', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/createMultipleItemsEvent.test.ts
+++ b/tests/src/check-event/createMultipleItemsEvent.test.ts
@@ -16,14 +16,14 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';
+import {usingPlaygrounds, itSub, expect} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Create Multiple Items Event event ', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/check-event/destroyCollectionEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/destroyCollectionEvent.test.ts
+++ b/tests/src/check-event/destroyCollectionEvent.test.ts
@@ -16,14 +16,14 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Destroy collection event ', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/check-event/transferEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/transferEvent.test.ts
+++ b/tests/src/check-event/transferEvent.test.ts
@@ -16,7 +16,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Transfer event ', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
});
});
tests/src/check-event/transferFromEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/transferFromEvent.test.ts
+++ b/tests/src/check-event/transferFromEvent.test.ts
@@ -16,7 +16,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
+import {usingPlaygrounds, expect, itSub} from '../util';
import {IEvent} from '../util/playgrounds/types';
describe('Transfer event ', () => {
@@ -24,7 +24,7 @@
let bob: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
});
});
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub, Pallets} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub, Pallets} from './util';
async function setSponsorHelper(collection: any, signer: IKeyringPair, sponsorAddress: string) {
await collection.setSponsor(signer, sponsorAddress);
@@ -37,7 +37,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie, zeroBalance] = await helper.arrange.createAccounts([100n, 100n, 100n, 0n], donor);
});
});
@@ -73,7 +73,7 @@
});
itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {
- const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
@@ -109,7 +109,9 @@
});
itSub('NFT: Sponsoring of transfers is rate limited', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+ sponsorTransferTimeout: 1000,
+ }});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
@@ -125,7 +127,9 @@
});
itSub('Fungible: Sponsoring is rate limited', async ({helper}) => {
- const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+ sponsorTransferTimeout: 1000,
+ }});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
@@ -141,7 +145,9 @@
});
itSub.ifWithPallets('ReFungible: Sponsoring is rate limited', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+ sponsorTransferTimeout: 1000,
+ }});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
@@ -157,7 +163,10 @@
});
itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+ sponsoredDataRateLimit: {blocks: 1000},
+ sponsorTransferTimeout: 1000,
+ }});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});
@@ -183,13 +192,13 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie, ownerZeroBalance, senderZeroBalance] = await helper.arrange.createAccounts([100n, 100n, 100n, 0n, 0n], donor);
});
});
itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
- const collectionId = 1_000_000;
+ const collectionId = (1 << 32) - 1;
const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/connection.test.tsdiffbeforeafterboth--- a/tests/src/connection.test.ts
+++ b/tests/src/connection.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {itSub, expect, usingPlaygrounds} from './util/playgrounds';
+import {itSub, expect, usingPlaygrounds} from './util';
describe('Connection smoke test', () => {
itSub('Connection can be established', async ({helper}) => {
tests/src/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/createCollection.test.ts
+++ b/tests/src/createCollection.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub, Pallets} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub, Pallets} from './util';
import {ICollectionCreationOptions, IProperty} from './util/playgrounds/types';
import {UniqueHelper} from './util/playgrounds/unique';
@@ -49,7 +49,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([100n], donor);
});
});
@@ -110,7 +110,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([100n], donor);
});
});
tests/src/createItem.test.tsdiffbeforeafterboth--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, itSub, Pallets} from './util/playgrounds';
+import {usingPlaygrounds, expect, itSub, Pallets} from './util';
import {IProperty, ICrossAccountId} from './util/playgrounds/types';
import {UniqueHelper} from './util/playgrounds/unique';
@@ -50,7 +50,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
@@ -179,7 +179,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/createMultipleItems.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, Pallets, itSub} from './util/playgrounds';
+import {usingPlaygrounds, expect, Pallets, itSub} from './util';
describe('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([100n], donor);
});
});
@@ -168,7 +168,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItemsEx.test.ts
+++ b/tests/src/createMultipleItemsEx.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, expect, Pallets, itSub} from './util/playgrounds';
+import {usingPlaygrounds, expect, Pallets, itSub} from './util';
import {IProperty} from './util/playgrounds/types';
describe('Integration Test: createMultipleItemsEx', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
@@ -264,7 +264,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});
tests/src/creditFeesToTreasury.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/creditFeesToTreasury.seqtest.ts
@@ -0,0 +1,165 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import './interfaces/augment-api-consts';
+import {IKeyringPair} from '@polkadot/types/types';
+import {ApiPromise} from '@polkadot/api';
+import {usingPlaygrounds, expect, itSub} from './util';
+
+const TREASURY = '5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z';
+const saneMinimumFee = 0.05;
+const saneMaximumFee = 0.5;
+const createCollectionDeposit = 100;
+
+// Skip the inflation block pauses if the block is close to inflation block
+// until the inflation happens
+/*eslint no-async-promise-executor: "off"*/
+function skipInflationBlock(api: ApiPromise): Promise<void> {
+ const promise = new Promise<void>(async (resolve) => {
+ const blockInterval = api.consts.inflation.inflationBlockInterval.toNumber();
+ const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
+ const currentBlock = head.number.toNumber();
+ if (currentBlock % blockInterval < blockInterval - 10) {
+ unsubscribe();
+ resolve();
+ } else {
+ console.log(`Skipping inflation block, current block: ${currentBlock}`);
+ }
+ });
+ });
+
+ return promise;
+}
+
+describe('integration test: Fees must be credited to Treasury:', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
+ });
+ });
+
+ itSub('Total issuance does not change', async ({helper}) => {
+ const api = helper.getApi();
+ await skipInflationBlock(api);
+ await helper.wait.newBlocks(1);
+
+ const totalBefore = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();
+
+ await helper.balance.transferToSubstrate(alice, bob.address, 1n);
+
+ const totalAfter = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();
+
+ expect(totalAfter).to.be.equal(totalBefore);
+ });
+
+ itSub('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async ({helper}) => {
+ await skipInflationBlock(helper.getApi());
+ await helper.wait.newBlocks(1);
+
+ const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
+ const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
+
+ const amount = 1n;
+ await helper.balance.transferToSubstrate(alice, bob.address, amount);
+
+ const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
+ const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
+
+ const fee = aliceBalanceBefore - aliceBalanceAfter - amount;
+ const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
+
+ expect(treasuryIncrease).to.be.equal(fee);
+ });
+
+ itSub('Treasury balance increased by failed tx fee', async ({helper}) => {
+ const api = helper.getApi();
+ await helper.wait.newBlocks(1);
+
+ const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
+ const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+
+ await expect(helper.signTransaction(bob, api.tx.balances.setBalance(alice.address, 0, 0))).to.be.rejected;
+
+ const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
+ const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
+
+ const fee = bobBalanceBefore - bobBalanceAfter;
+ const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
+
+ expect(treasuryIncrease).to.be.equal(fee);
+ });
+
+ itSub('NFT Transactions also send fees to Treasury', async ({helper}) => {
+ await skipInflationBlock(helper.getApi());
+ await helper.wait.newBlocks(1);
+
+ const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
+ const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
+
+ await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
+
+ const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
+ const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
+ const fee = aliceBalanceBefore - aliceBalanceAfter;
+ const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
+
+ expect(treasuryIncrease).to.be.equal(fee);
+ });
+
+ itSub('Fees are sane', async ({helper}) => {
+ const unique = helper.balance.getOneTokenNominal();
+ await skipInflationBlock(helper.getApi());
+ await helper.wait.newBlocks(1);
+
+ const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
+
+ await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
+
+ const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
+ const fee = aliceBalanceBefore - aliceBalanceAfter;
+
+ expect(fee / unique < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
+ expect(fee / unique < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
+ });
+
+ itSub('NFT Transfer fee is close to 0.1 Unique', async ({helper}) => {
+ await skipInflationBlock(helper.getApi());
+ await helper.wait.newBlocks(1);
+
+ const collection = await helper.nft.mintCollection(alice, {
+ name: 'test',
+ description: 'test',
+ tokenPrefix: 'test',
+ });
+ // const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
+ const token = await collection.mintToken(alice, {Substrate: alice.address});
+
+ const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
+ await token.transfer(alice, {Substrate: bob.address});
+ const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
+
+ const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal());
+ const expectedTransferFee = 0.1;
+ // fee drifts because of NextFeeMultiplier
+ const tolerance = 0.001;
+
+ expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);
+ });
+});
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-import './interfaces/augment-api-consts';
-import {IKeyringPair} from '@polkadot/types/types';
-import {ApiPromise} from '@polkadot/api';
-import {usingPlaygrounds, expect, itSub} from './util/playgrounds';
-
-const TREASURY = '5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z';
-const saneMinimumFee = 0.05;
-const saneMaximumFee = 0.5;
-const createCollectionDeposit = 100;
-
-// Skip the inflation block pauses if the block is close to inflation block
-// until the inflation happens
-/*eslint no-async-promise-executor: "off"*/
-function skipInflationBlock(api: ApiPromise): Promise<void> {
- const promise = new Promise<void>(async (resolve) => {
- const blockInterval = api.consts.inflation.inflationBlockInterval.toNumber();
- const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
- const currentBlock = head.number.toNumber();
- if (currentBlock % blockInterval < blockInterval - 10) {
- unsubscribe();
- resolve();
- } else {
- console.log(`Skipping inflation block, current block: ${currentBlock}`);
- }
- });
- });
-
- return promise;
-}
-
-describe('integration test: Fees must be credited to Treasury:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
- });
- });
-
- itSub('Total issuance does not change', async ({helper}) => {
- const api = helper.getApi();
- await skipInflationBlock(api);
- await helper.wait.newBlocks(1);
-
- const totalBefore = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();
-
- await helper.balance.transferToSubstrate(alice, bob.address, 1n);
-
- const totalAfter = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();
-
- expect(totalAfter).to.be.equal(totalBefore);
- });
-
- itSub('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async ({helper}) => {
- await skipInflationBlock(helper.getApi());
- await helper.wait.newBlocks(1);
-
- const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
- const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
-
- const amount = 1n;
- await helper.balance.transferToSubstrate(alice, bob.address, amount);
-
- const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
- const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
-
- const fee = aliceBalanceBefore - aliceBalanceAfter - amount;
- const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
-
- expect(treasuryIncrease).to.be.equal(fee);
- });
-
- itSub('Treasury balance increased by failed tx fee', async ({helper}) => {
- const api = helper.getApi();
- await helper.wait.newBlocks(1);
-
- const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
- const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
-
- await expect(helper.signTransaction(bob, api.tx.balances.setBalance(alice.address, 0, 0))).to.be.rejected;
-
- const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
- const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
-
- const fee = bobBalanceBefore - bobBalanceAfter;
- const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
-
- expect(treasuryIncrease).to.be.equal(fee);
- });
-
- itSub('NFT Transactions also send fees to Treasury', async ({helper}) => {
- await skipInflationBlock(helper.getApi());
- await helper.wait.newBlocks(1);
-
- const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
- const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
-
- await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-
- const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
- const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
- const fee = aliceBalanceBefore - aliceBalanceAfter;
- const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;
-
- expect(treasuryIncrease).to.be.equal(fee);
- });
-
- itSub('Fees are sane', async ({helper}) => {
- const unique = helper.balance.getOneTokenNominal();
- await skipInflationBlock(helper.getApi());
- await helper.wait.newBlocks(1);
-
- const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
-
- await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-
- const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
- const fee = aliceBalanceBefore - aliceBalanceAfter;
-
- expect(fee / unique < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
- expect(fee / unique < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
- });
-
- itSub('NFT Transfer fee is close to 0.1 Unique', async ({helper}) => {
- await skipInflationBlock(helper.getApi());
- await helper.wait.newBlocks(1);
-
- const collection = await helper.nft.mintCollection(alice, {
- name: 'test',
- description: 'test',
- tokenPrefix: 'test',
- });
- // const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
- const token = await collection.mintToken(alice, {Substrate: alice.address});
-
- const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
- await token.transfer(alice, {Substrate: bob.address});
- const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);
-
- const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal());
- const expectedTransferFee = 0.1;
- // fee drifts because of NextFeeMultiplier
- const tolerance = 0.001;
-
- expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);
- });
-});
tests/src/destroyCollection.test.tsdiffbeforeafterboth--- a/tests/src/destroyCollection.test.ts
+++ b/tests/src/destroyCollection.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, expect, usingPlaygrounds, Pallets} from './util/playgrounds';
+import {itSub, expect, usingPlaygrounds, Pallets} from './util';
describe('integration test: ext. destroyCollection():', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([100n], donor);
});
});
@@ -62,7 +62,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/enableDisableTransfer.test.tsdiffbeforeafterboth--- a/tests/src/enableDisableTransfer.test.ts
+++ b/tests/src/enableDisableTransfer.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
describe('Enable/Disable Transfers', () => {
let alice: IKeyringPair;
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
@@ -62,7 +62,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
tests/src/eth/allowlist.test.tsdiffbeforeafterboth--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itEth, usingEthPlaygrounds, expect} from './util/playgrounds';
+import {itEth, usingEthPlaygrounds, expect} from './util';
describe('EVM contract allowlist', () => {
let donor: IKeyringPair;
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -70,7 +70,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/base.test.tsdiffbeforeafterboth--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -17,7 +17,7 @@
import {Contract} from 'web3-eth-contract';
import {IKeyringPair} from '@polkadot/types/types';
-import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from './util/playgrounds';
+import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from './util';
describe('Contract calls', () => {
@@ -25,7 +25,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -78,7 +78,7 @@
before(async () => {
await usingEthPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
const [alice] = await helper.arrange.createAccounts([10n], donor);
({collectionId: collection} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}));
minter = helper.eth.createAccount();
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -14,7 +14,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util/playgrounds';
+import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util';
async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise<any>) {
const before = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress));
@@ -32,7 +32,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -144,7 +144,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -272,7 +272,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -314,7 +314,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -1,4 +1,20 @@
-import {itEth, usingEthPlaygrounds, expect} from './util/playgrounds';
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {itEth, usingEthPlaygrounds, expect} from './util';
import {IKeyringPair} from '@polkadot/types/types';
describe('EVM collection properties', () => {
@@ -7,7 +23,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await _helper.arrange.createAccounts([10n], donor);
});
});
tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -1,6 +1,22 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds} from './../util/playgrounds/index';
-import {itEth, expect} from '../eth/util/playgrounds';
+import {usingPlaygrounds} from '../util/index';
+import {itEth, expect} from './util';
describe('evm collection sponsoring', () => {
let donor: IKeyringPair;
@@ -9,17 +25,12 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
+ [alice] = await helper.arrange.createAccounts([100n], donor);
nominal = helper.balance.getOneTokenNominal();
});
});
-
- beforeEach(async () => {
- await usingPlaygrounds(async (helper) => {
- [alice] = await helper.arrange.createAccounts([1000n], donor);
- });
- });
-
+
itEth('sponsors mint transactions', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'spnr', permissions: {mintMode: true}});
await collection.setSponsor(alice, alice.address);
tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -16,8 +16,8 @@
import {IKeyringPair} from '@polkadot/types/types';
import {EthUniqueHelper} from './util/playgrounds/unique.dev';
-import {itEth, expect, SponsoringMode, usingEthPlaygrounds} from '../eth/util/playgrounds';
-import {usingPlaygrounds} from '../util/playgrounds';
+import {itEth, expect, SponsoringMode, usingEthPlaygrounds} from './util';
+import {usingPlaygrounds} from '../util';
import {CompiledContract} from './util/playgrounds/types';
describe('Sponsoring EVM contracts', () => {
@@ -25,11 +25,11 @@
before(async () => {
await usingPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
- itEth('Self sponsored can be set by the address that deployed the contract', async ({helper, privateKey}) => {
+ itEth('Self sponsored can be set by the address that deployed the contract', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const flipper = await helper.eth.deployFlipper(owner);
const helpers = helper.ethNativeContract.contractHelpers(owner);
@@ -378,7 +378,7 @@
// Balance should be taken from flipper instead of caller
// FIXME the comment is wrong! What check should be here?
const balanceAfter = await helper.balance.getEthereum(flipper.options.address);
- expect(balanceAfter).to.be.equals(originalFlipperBalance);
+ expect(balanceAfter).to.be.equal(originalFlipperBalance);
});
itEth('Sponsoring is set, an address that has UNQ can send a transaction and it works. User balance should not change', async ({helper}) => {
@@ -406,7 +406,7 @@
const sponsorBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(sponsor));
const callerBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(caller));
expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
- expect(callerBalanceAfter).to.be.equals(callerBalanceBefore);
+ expect(callerBalanceAfter).to.be.equal(callerBalanceBefore);
});
itEth('Sponsoring is limited, with setContractRateLimit. The limitation is working if transactions are sent more often, the sender pays the commission.', async ({helper}) => {
@@ -431,23 +431,24 @@
await flipper.methods.flip().send({from: caller});
expect(await flipper.methods.getValue().call()).to.be.true;
- expect(await helper.balance.getEthereum(caller)).to.be.equals(originalCallerBalance);
+ expect(await helper.balance.getEthereum(caller)).to.be.equal(originalCallerBalance);
const newFlipperBalance = await helper.balance.getEthereum(sponsor);
- expect(newFlipperBalance).to.be.not.equals(originalFlipperBalance);
+ expect(newFlipperBalance).to.be.not.equal(originalFlipperBalance);
await flipper.methods.flip().send({from: caller});
+ // todo:playgrounds fails rarely (expected 99893341659775672580n to equal 99912598679356033129n) (again, 99893341659775672580n)
expect(await helper.balance.getEthereum(sponsor)).to.be.equal(newFlipperBalance);
- expect(await helper.balance.getEthereum(caller)).to.be.not.equals(originalCallerBalance);
+ expect(await helper.balance.getEthereum(caller)).to.be.not.equal(originalCallerBalance);
});
// TODO: Find a way to calculate default rate limit
- itEth('Default rate limit equals 7200', async ({helper}) => {
+ itEth('Default rate limit equal 7200', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const helpers = helper.ethNativeContract.contractHelpers(owner);
const flipper = await helper.eth.deployFlipper(owner);
- expect(await helpers.methods.sponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');
+ expect(await helpers.methods.sponsoringRateLimit(flipper.options.address).call()).to.be.equal('7200');
});
});
@@ -490,24 +491,18 @@
}
before(async () => {
- await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ await usingEthPlaygrounds(async (helper, privateKey) => {
+ donor = await privateKey({filename: __filename});
+ [alice] = await helper.arrange.createAccounts([100n], donor);
});
});
-
- beforeEach(async () => {
- await usingPlaygrounds(async (helper) => {
- [alice] = await helper.arrange.createAccounts([1000n], donor);
- });
- });
-
itEth('Default fee limit', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const helpers = helper.ethNativeContract.contractHelpers(owner);
const flipper = await helper.eth.deployFlipper(owner);
- expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');
+ expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equal('115792089237316195423570985008687907853269984665640564039457584007913129639935');
});
itEth('Set fee limit', async ({helper}) => {
@@ -516,7 +511,7 @@
const flipper = await helper.eth.deployFlipper(owner);
await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();
- expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');
+ expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equal('100');
});
itEth('Negative test - set fee limit by non-owner', async ({helper}) => {
@@ -554,7 +549,7 @@
expect(await helper.balance.getEthereum(user)).to.not.be.equal(originalUserBalance);
});
- itEth('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({helper, privateKey}) => {
+ itEth('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const sponsor = await helper.eth.createAccountWithBalance(donor);
const helpers = helper.ethNativeContract.contractHelpers(owner);
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -16,7 +16,7 @@
import {evmToAddress} from '@polkadot/util-crypto';
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {expect, itEth, usingEthPlaygrounds} from './util';
describe('Create NFT collection from EVM', () => {
@@ -24,7 +24,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -35,24 +35,17 @@
const description = 'Some description';
const prefix = 'token prefix';
- // todo:playgrounds this might fail when in async environment.
- const collectionCountBefore = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
const {collectionId} = await helper.eth.createNonfungibleCollection(owner, name, description, prefix);
- const collectionCountAfter = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
-
- const collection = helper.nft.getCollectionObject(collectionId);
- const data = (await collection.getData())!;
+ const data = (await helper.rft.getData(collectionId))!;
- expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
- expect(collectionId).to.be.eq(collectionCountAfter);
expect(data.name).to.be.eq(name);
expect(data.description).to.be.eq(description);
expect(data.raw.tokenPrefix).to.be.eq(prefix);
expect(data.raw.mode).to.be.eq('NFT');
});
- // todo:playgrounds this test will fail when in async environment.
- itEth('Check collection address exist', async ({helper}) => {
+ // this test will occasionally fail when in async environment.
+ itEth.skip('Check collection address exist', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
@@ -151,7 +144,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
nominal = helper.balance.getOneTokenNominal();
});
});
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -16,8 +16,8 @@
import {evmToAddress} from '@polkadot/util-crypto';
import {IKeyringPair} from '@polkadot/types/types';
-import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {Pallets, requirePalletsOrSkip} from '../util';
+import {expect, itEth, usingEthPlaygrounds} from './util';
describe('Create RFT collection from EVM', () => {
@@ -26,7 +26,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -37,23 +37,17 @@
const description = 'Some description';
const prefix = 'token prefix';
- // todo:playgrounds this might fail when in async environment.
- const collectionCountBefore = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
const {collectionId} = await helper.eth.createRefungibleCollection(owner, name, description, prefix);
- const collectionCountAfter = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
-
const data = (await helper.rft.getData(collectionId))!;
- expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
- expect(collectionId).to.be.eq(collectionCountAfter);
expect(data.name).to.be.eq(name);
expect(data.description).to.be.eq(description);
expect(data.raw.tokenPrefix).to.be.eq(prefix);
expect(data.raw.mode).to.be.eq('ReFungible');
});
-
- // todo:playgrounds this test will fail when in async environment.
- itEth('Check collection address exist', async ({helper}) => {
+
+ // this test will occasionally fail when in async environment.
+ itEth.skip('Check collection address exist', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
@@ -153,7 +147,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
nominal = helper.balance.getOneTokenNominal();
});
});
tests/src/eth/crossTransfer.test.tsdiffbeforeafterboth--- a/tests/src/eth/crossTransfer.test.ts
+++ b/tests/src/eth/crossTransfer.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {itEth, usingEthPlaygrounds} from './util';
import {CrossAccountId} from '../util/playgrounds/unique';
import {IKeyringPair} from '@polkadot/types/types';
@@ -26,7 +26,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
@@ -69,7 +69,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
tests/src/eth/evmCoder.test.tsdiffbeforeafterboth--- a/tests/src/eth/evmCoder.test.ts
+++ b/tests/src/eth/evmCoder.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itEth, expect, usingEthPlaygrounds} from './util/playgrounds';
+import {itEth, expect, usingEthPlaygrounds} from './util';
const getContractSource = (collectionAddress: string, contractAddress: string): string => {
return `
@@ -59,7 +59,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -22,9 +22,9 @@
import {Contract} from 'web3-eth-contract';
-import {usingEthPlaygrounds, expect, itEth, EthUniqueHelper} from '../util/playgrounds';
+import {usingEthPlaygrounds, expect, itEth, EthUniqueHelper} from '../util';
import {CompiledContract} from '../util/playgrounds/types';
-import {requirePalletsOrSkip, Pallets} from '../../util/playgrounds';
+import {requirePalletsOrSkip, Pallets} from '../../util';
let compiledFractionalizer: CompiledContract;
@@ -85,7 +85,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -225,7 +225,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
describe('Fungible: Information getting', () => {
@@ -23,7 +23,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -55,7 +55,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -224,7 +224,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -277,7 +277,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -294,9 +294,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
await collection.approveTokens(alice, {Ethereum: receiver}, 100n);
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
+
expect(event.event).to.be.equal('Approval');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.owner).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -318,9 +320,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
await collection.transferFrom(bob, {Substrate: alice.address}, {Ethereum: receiver}, 51n);
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
let event = events[0];
+
expect(event.event).to.be.equal('Transfer');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -347,9 +351,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
await collection.transfer(alice, {Ethereum:receiver}, 51n);
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
+
expect(event.event).to.be.equal('Transfer');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
tests/src/eth/helpersSmoke.test.tsdiffbeforeafterboth--- a/tests/src/eth/helpersSmoke.test.ts
+++ b/tests/src/eth/helpersSmoke.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
describe('Helpers sanity check', () => {
@@ -22,7 +22,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth--- a/tests/src/eth/marketplace/marketplace.test.ts
+++ b/tests/src/eth/marketplace/marketplace.test.ts
@@ -14,10 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {usingPlaygrounds} from './../../util/playgrounds/index';
import {IKeyringPair} from '@polkadot/types/types';
import {readFile} from 'fs/promises';
-import {itEth, expect, SponsoringMode} from '../util/playgrounds';
+import {itEth, usingEthPlaygrounds, expect, SponsoringMode} from '../util';
describe('Matcher contract usage', () => {
const PRICE = 2000n;
@@ -29,17 +28,17 @@
let sellerMirror: string;
before(async () => {
- await usingPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ await usingEthPlaygrounds(async (_helper, privateKey) => {
+ donor = await privateKey({filename: __filename});
});
});
beforeEach(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- [alice] = await helper.arrange.createAccounts([10000n], donor);
+ await usingEthPlaygrounds(async (helper, privateKey) => {
+ [alice] = await helper.arrange.createAccounts([1000n], donor);
aliceMirror = helper.address.substrateToEth(alice.address).toLowerCase();
aliceDoubleMirror = helper.address.ethToSubstrate(aliceMirror);
- seller = privateKey(`//Seller/${Date.now()}`);
+ seller = await privateKey(`//Seller/${Date.now()}`);
sellerMirror = helper.address.substrateToEth(seller.address).toLowerCase();
await helper.balance.transferToSubstrate(donor, aliceDoubleMirror, 10_000_000_000_000_000_000n);
tests/src/eth/migration.test.tsdiffbeforeafterboth--- a/tests/src/eth/migration.test.ts
+++ b/tests/src/eth/migration.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
describe('EVM Migrations', () => {
@@ -22,7 +22,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- superuser = privateKey('//Alice');
+ superuser = await privateKey('//Alice');
});
});
tests/src/eth/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/eth/nesting/nest.test.ts
+++ b/tests/src/eth/nesting/nest.test.ts
@@ -1,7 +1,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {Contract} from 'web3-eth-contract';
-import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util/playgrounds';
+import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util';
const createNestingCollection = async (
helper: EthUniqueHelper,
@@ -21,7 +21,7 @@
before(async function() {
await usingEthPlaygrounds(async (_, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util/playgrounds';
+import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
import {IKeyringPair} from '@polkadot/types/types';
import {Contract} from 'web3-eth-contract';
@@ -25,7 +25,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -75,7 +75,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -137,7 +137,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -318,7 +318,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -371,7 +371,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -385,9 +385,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
const {tokenId} = await collection.mintToken(alice);
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.event).to.be.equal('Transfer');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');
@@ -408,8 +410,9 @@
});
await token.burn(alice);
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.event).to.be.equal('Transfer');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -432,8 +435,9 @@
});
await token.approve(alice, {Ethereum: receiver});
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.event).to.be.equal('Approval');
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.owner).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -458,8 +462,9 @@
});
await token.transferFrom(bob, {Substrate: alice.address}, {Ethereum: receiver});
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
+
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
expect(event.returnValues.to).to.be.equal(receiver);
@@ -481,8 +486,9 @@
});
await token.transfer(alice, {Ethereum: receiver});
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
+
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
expect(event.returnValues.to).to.be.equal(receiver);
@@ -496,7 +502,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -16,14 +16,14 @@
import {IKeyringPair} from '@polkadot/types/types';
-import {itEth, expect, usingEthPlaygrounds, EthUniqueHelper} from './util/playgrounds';
+import {itEth, expect, usingEthPlaygrounds, EthUniqueHelper} from './util';
describe('EVM payable contracts', () => {
let donor: IKeyringPair;
before(async function() {
await usingEthPlaygrounds(async (_, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -68,7 +68,7 @@
expect(await contract.methods.getUnaccounted().call()).to.be.equal(weiCount.toString());
});
- itEth('Balance can be retrieved from evm contract', async({helper, privateKey}) => {
+ itEth('Balance can be retrieved from evm contract', async({helper}) => {
const FEE_BALANCE = 10n * helper.balance.getOneTokenNominal();
const CONTRACT_BALANCE = 1n * helper.balance.getOneTokenNominal();
@@ -80,7 +80,7 @@
await web3.eth.sendTransaction({from: deployer, to: contract.options.address, value: CONTRACT_BALANCE.toString(), gas: helper.eth.DEFAULT_GAS});
- const receiver = privateKey(`//Receiver${Date.now()}`);
+ const [receiver] = await helper.arrange.createAccounts([0n], donor);
// First receive balance on eth balance of bob
{
@@ -110,7 +110,7 @@
before(async function() {
await usingEthPlaygrounds(async (_, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/proxy/fungibleProxy.test.tsdiffbeforeafterboth--- a/tests/src/eth/proxy/fungibleProxy.test.ts
+++ b/tests/src/eth/proxy/fungibleProxy.test.ts
@@ -17,7 +17,7 @@
import {expect} from 'chai';
import {readFile} from 'fs/promises';
import {IKeyringPair} from '@polkadot/types/types';
-import {EthUniqueHelper, itEth, usingEthPlaygrounds} from '../util/playgrounds';
+import {EthUniqueHelper, itEth, usingEthPlaygrounds} from '../util';
async function proxyWrap(helper: EthUniqueHelper, wrapped: any, donor: IKeyringPair) {
// Proxy owner has no special privilegies, we don't need to reuse them
@@ -37,7 +37,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -76,7 +76,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -16,7 +16,7 @@
import {readFile} from 'fs/promises';
import {IKeyringPair} from '@polkadot/types/types';
-import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from '../util/playgrounds';
+import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from '../util';
async function proxyWrap(helper: EthUniqueHelper, wrapped: any, donor: IKeyringPair) {
@@ -37,7 +37,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -94,7 +94,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';
-import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {Pallets, requirePalletsOrSkip} from '../util';
+import {expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
describe('Refungible: Information getting', () => {
@@ -25,7 +25,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -117,7 +117,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -286,9 +286,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
await tokenContract.methods.transfer(receiver, 1).send();
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.address).to.equal(collectionAddress);
expect(event.returnValues.from).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');
expect(event.returnValues.to).to.equal(receiver);
@@ -312,9 +314,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
await tokenContract.methods.transfer(receiver, 1).send();
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.address).to.equal(collectionAddress);
expect(event.returnValues.from).to.equal(caller);
expect(event.returnValues.to).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');
@@ -329,7 +333,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -370,7 +374,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';
-import {EthUniqueHelper, expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {Pallets, requirePalletsOrSkip} from '../util';
+import {EthUniqueHelper, expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
import {Contract} from 'web3-eth-contract';
@@ -28,7 +28,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([20n], donor);
});
});
@@ -72,7 +72,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
@@ -136,7 +136,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([50n], donor);
});
});
@@ -311,6 +311,7 @@
});
await tokenContract.methods.burnFrom(caller, 1).send();
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
expect(event.address).to.be.equal(collectionAddress);
expect(event.returnValues.from).to.be.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');
@@ -327,7 +328,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([50n], donor);
});
});
@@ -382,7 +383,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([50n], donor);
});
});
@@ -399,9 +400,11 @@
contract.events.allEvents((_: any, event: any) => {
events.push(event);
});
+
expect(await token.approve(alice, {Ethereum: receiver}, 100n)).to.be.true;
-
+ if (events.length == 0) await helper.wait.newBlocks(1);
const event = events[0];
+
expect(event.event).to.be.equal('Approval');
expect(event.address).to.be.equal(tokenAddress);
expect(event.returnValues.owner).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -425,6 +428,7 @@
});
expect(await token.transferFrom(bob, {Substrate: alice.address}, {Ethereum: receiver}, 51n)).to.be.true;
+ if (events.length == 0) await helper.wait.newBlocks(1);
let event = events[0];
expect(event.event).to.be.equal('Transfer');
@@ -455,8 +459,9 @@
});
expect(await token.transfer(alice, {Ethereum: receiver}, 51n)).to.be.true;
+ if (events.length == 0) await helper.wait.newBlocks(1);
+ const event = events[0];
- const event = events[0];
expect(event.event).to.be.equal('Transfer');
expect(event.address).to.be.equal(tokenAddress);
expect(event.returnValues.from).to.be.equal(helper.address.substrateToEth(alice.address));
@@ -472,7 +477,7 @@
await usingEthPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/sponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/sponsoring.test.ts
+++ b/tests/src/eth/sponsoring.test.ts
@@ -15,15 +15,15 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itEth, expect, SponsoringMode} from '../eth/util/playgrounds';
-import {usingPlaygrounds} from './../util/playgrounds/index';
+import {itEth, expect, SponsoringMode} from './util';
+import {usingPlaygrounds} from '../util/index';
describe('EVM sponsoring', () => {
let donor: IKeyringPair;
before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ await usingPlaygrounds(async (_helper, privateKey) => {
+ donor = await privateKey({filename: __filename});
});
});
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -1,32 +1,45 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {itEth, usingEthPlaygrounds, expect} from './util';
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds} from './../util/playgrounds/index';
-import {itEth, expect} from '../eth/util/playgrounds';
describe('EVM token properties', () => {
let donor: IKeyringPair;
let alice: IKeyringPair;
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
- [alice] = await helper.arrange.createAccounts([1000n], donor);
+ before(async function() {
+ await usingEthPlaygrounds(async (helper, privateKey) => {
+ donor = await privateKey({filename: __filename});
+ [alice] = await helper.arrange.createAccounts([100n], donor);
});
});
itEth('Can be reconfigured', async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
-
for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {
- const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'ethp'});
+ const collection = await helper.nft.mintCollection(alice);
await collection.addAdmin(alice, {Ethereum: caller});
-
+
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
-
+
await contract.methods.setTokenPropertyPermission('testKey', mutable, collectionAdmin, tokenOwner).send({from: caller});
- const state = await collection.getPropertyPermissions();
- expect(state).to.be.deep.equal([{
+ expect(await collection.getPropertyPermissions()).to.be.deep.equal([{
key: 'testKey',
permission: {mutable, collectionAdmin, tokenOwner},
}]);
@@ -36,7 +49,6 @@
itEth('Can be set', async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
const collection = await helper.nft.mintCollection(alice, {
- tokenPrefix: 'ethp',
tokenPropertyPermissions: [{
key: 'testKey',
permission: {
@@ -60,7 +72,6 @@
itEth('Can be deleted', async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
const collection = await helper.nft.mintCollection(alice, {
- tokenPrefix: 'ethp',
tokenPropertyPermissions: [{
key: 'testKey',
permission: {
@@ -69,11 +80,11 @@
},
}],
});
+
+ const token = await collection.mintToken(alice);
+ await token.setProperties(alice, [{key: 'testKey', value: 'testValue'}]);
await collection.addAdmin(alice, {Ethereum: caller});
-
- const token = await collection.mintToken(alice);
- await token.setProperties(alice, [{key: 'testKey', value: 'testValue'}]);
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
@@ -85,9 +96,8 @@
});
itEth('Can be read', async({helper}) => {
- const caller = await helper.eth.createAccountWithBalance(donor);
+ const caller = helper.eth.createAccount();
const collection = await helper.nft.mintCollection(alice, {
- tokenPrefix: 'ethp',
tokenPropertyPermissions: [{
key: 'testKey',
permission: {
@@ -95,6 +105,7 @@
},
}],
});
+
const token = await collection.mintToken(alice);
await token.setProperties(alice, [{key: 'testKey', value: 'testValue'}]);
@@ -116,4 +127,4 @@
for(const value of args[0]) {
yield* cartesian([...internalRest, value], ...args.slice(1)) as any;
}
-}
\ No newline at end of file
+}
tests/src/eth/util/index.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/util/index.ts
@@ -0,0 +1,83 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// SPDX-License-Identifier: Apache-2.0
+
+import * as path from 'path';
+import {IKeyringPair} from '@polkadot/types/types';
+
+import config from '../../config';
+
+import {EthUniqueHelper} from './playgrounds/unique.dev';
+import {SilentLogger, SilentConsole} from '../../util/playgrounds/unique.dev';
+
+export {EthUniqueHelper} from './playgrounds/unique.dev';
+
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import chaiLike from 'chai-like';
+import {getTestSeed, requirePalletsOrSkip} from '../../util';
+
+chai.use(chaiAsPromised);
+chai.use(chaiLike);
+export const expect = chai.expect;
+
+export enum SponsoringMode {
+ Disabled = 0,
+ Allowlisted = 1,
+ Generous = 2,
+}
+
+export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair>) => Promise<void>) => {
+ const silentConsole = new SilentConsole();
+ silentConsole.enable();
+
+ const helper = new EthUniqueHelper(new SilentLogger());
+
+ try {
+ await helper.connect(config.substrateUrl);
+ await helper.connectWeb3(config.substrateUrl);
+ const ss58Format = helper.chain.getChainProperties().ss58Format;
+ const privateKey = async (seed: string | {filename: string}) => {
+ if (typeof seed === 'string') {
+ return helper.util.fromSeed(seed, ss58Format);
+ }
+ else {
+ const actualSeed = getTestSeed(seed.filename);
+ let account = helper.util.fromSeed(actualSeed, ss58Format);
+ if (await helper.balance.getSubstrate(account.address) == 0n) {
+ console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);
+ account = helper.util.fromSeed('//Alice', ss58Format);
+ }
+ return account;
+ }
+ };
+ await code(helper, privateKey);
+ }
+ finally {
+ await helper.disconnect();
+ silentConsole.disable();
+ }
+};
+
+export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+ (opts.only ? it.only :
+ opts.skip ? it.skip : it)(name, async function() {
+ await usingEthPlaygrounds(async (helper, privateKey) => {
+ if (opts.requiredPallets) {
+ requirePalletsOrSkip(this, helper, opts.requiredPallets);
+ }
+
+ await cb({helper, privateKey});
+ });
+ });
+}
+
+export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+ return itEth(name, cb, {requiredPallets: required, ...opts});
+}
+
+itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEth(name, cb, {only: true});
+itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEth(name, cb, {skip: true});
+
+itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEthIfWithPallet(name, required, cb, {only: true});
+itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});
+itEth.ifWithPallets = itEthIfWithPallet;
tests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/index.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-import {IKeyringPair} from '@polkadot/types/types';
-
-import config from '../../../config';
-
-import {EthUniqueHelper} from './unique.dev';
-import {SilentLogger, SilentConsole} from '../../../util/playgrounds/unique.dev';
-
-export {EthUniqueHelper} from './unique.dev';
-
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import chaiLike from 'chai-like';
-import {requirePalletsOrSkip} from '../../../util/playgrounds';
-chai.use(chaiAsPromised);
-chai.use(chaiLike);
-export const expect = chai.expect;
-
-export enum SponsoringMode {
- Disabled = 0,
- Allowlisted = 1,
- Generous = 2,
-}
-
-export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- const silentConsole = new SilentConsole();
- silentConsole.enable();
-
- const helper = new EthUniqueHelper(new SilentLogger());
-
- try {
- await helper.connect(config.substrateUrl);
- await helper.connectWeb3(config.substrateUrl);
- const ss58Format = helper.chain.getChainProperties().ss58Format;
- const privateKey = (seed: string) => helper.util.fromSeed(seed, ss58Format);
- await code(helper, privateKey);
- }
- finally {
- await helper.disconnect();
- silentConsole.disable();
- }
-};
-
-export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
- (opts.only ? it.only :
- opts.skip ? it.skip : it)(name, async function() {
- await usingEthPlaygrounds(async (helper, privateKey) => {
- if (opts.requiredPallets) {
- requirePalletsOrSkip(this, helper, opts.requiredPallets);
- }
-
- await cb({helper, privateKey});
- });
- });
-}
-
-export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
- return itEth(name, cb, {requiredPallets: required, ...opts});
-}
-
-itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {only: true});
-itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {skip: true});
-
-itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {only: true});
-itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});
-itEth.ifWithPallets = itEthIfWithPallet;
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
@@ -142,14 +142,14 @@
return account.address;
}
- async createAccountWithBalance(donor: IKeyringPair, amount=1000n) {
+ async createAccountWithBalance(donor: IKeyringPair, amount=100n) {
const account = this.createAccount();
await this.transferBalanceFromSubstrate(donor, account, amount);
return account;
}
- async transferBalanceFromSubstrate(donor: IKeyringPair, recepient: string, amount=1000n, inTokens=true) {
+ async transferBalanceFromSubstrate(donor: IKeyringPair, recepient: string, amount=100n, inTokens=true) {
return await this.helper.balance.transferToSubstrate(donor, evmToAddress(recepient), amount * (inTokens ? this.helper.balance.getOneTokenNominal() : 1n));
}
tests/src/fungible.test.tsdiffbeforeafterboth--- a/tests/src/fungible.test.ts
+++ b/tests/src/fungible.test.ts
@@ -15,17 +15,18 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
const U128_MAX = (1n << 128n) - 1n;
describe('integration test: Fungible functionality:', () => {
+ let donor: IKeyringPair;
let alice: IKeyringPair;
let bob: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
});
});
@@ -43,9 +44,9 @@
expect(aliceBalance).to.be.equal(U128_MAX);
});
- itSub('RPC method tokenOnewrs for fungible collection and token', async ({helper, privateKey}) => {
+ itSub('RPC method tokenOnewrs for fungible collection and token', async ({helper}) => {
const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
- const facelessCrowd = Array(7).fill(0).map((_, i) => ({Substrate: privateKey(`//Alice+${i}`).address}));
+ const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});
const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
@@ -64,7 +65,7 @@
expect(owners).to.deep.include.members([{Substrate: alice.address}, ethAcc, {Substrate: bob.address}, ...facelessCrowd]);
expect(owners.length).to.be.equal(10);
- const eleven = privateKey('//ALice+11');
+ const [eleven] = await helper.arrange.createAccounts([0n], donor);
expect(await collection.transfer(alice, {Substrate: eleven.address}, 10n)).to.be.true;
expect((await collection.getTop10Owners()).length).to.be.equal(10);
});
tests/src/getPropertiesRpc.test.tsdiffbeforeafterboth--- a/tests/src/getPropertiesRpc.test.ts
+++ b/tests/src/getPropertiesRpc.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
import {UniqueHelper, UniqueNFTCollection} from './util/playgrounds/unique';
const collectionProps = [
@@ -63,7 +63,7 @@
before(async () => {
await usingPlaygrounds(async (_, privateKey) => {
- alice = privateKey('//Alice');
+ alice = await privateKey({filename: __filename});
});
});
tests/src/inflation.test.tsdiffbeforeafterboth--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, usingPlaygrounds} from './util/playgrounds';
+import {expect, itSub, usingPlaygrounds} from './util';
// todo:playgrounds requires sudo, look into on the later stage
describe('integration test: Inflation', () => {
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (_, privateKey) => {
- superuser = privateKey('//Alice');
+ superuser = await privateKey('//Alice');
});
});
tests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-consts.ts
+++ b/tests/src/interfaces/augment-api-consts.ts
@@ -8,7 +8,7 @@
import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
import type { Option, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types';
-import type { Perbill, Permill } from '@polkadot/types/interfaces/runtime';
+import type { Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion, XcmV1MultiLocation } from '@polkadot/types/lookup';
export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
@@ -97,7 +97,7 @@
* The maximum weight that may be scheduled per block for any dispatchables of less
* priority than `schedule::HARD_DEADLINE`.
**/
- maximumWeight: u64 & AugmentedConst<ApiType>;
+ maximumWeight: Weight & AugmentedConst<ApiType>;
/**
* The maximum number of scheduled calls in the queue for a single block.
* Not strictly enforced, but used for weight estimation.
@@ -126,7 +126,7 @@
**/
dbWeight: FrameSupportWeightsRuntimeDbWeight & AugmentedConst<ApiType>;
/**
- * The designated SS85 prefix of this chain.
+ * The designated SS58 prefix of this chain.
*
* This replaces the "ss58Format" property declared in the chain spec. Reason is
* that the runtime should know about the prefix in order to make use of it as
tests/src/interfaces/augment-api-events.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-events.ts
+++ b/tests/src/interfaces/augment-api-events.ts
@@ -8,7 +8,7 @@
import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U256, U8aFixed, bool, u128, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
-import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
+import type { AccountId32, H160, H256, Weight } from '@polkadot/types/interfaces/runtime';
import type { EthereumLog, EvmCoreErrorExitReason, FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, OrmlVestingVestingSchedule, PalletEvmAccountBasicCrossAccountIdRepr, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, RmrkTraitsNftAccountIdOrCollectionNftTuple, SpRuntimeDispatchError, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetMultiAssets, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
@@ -184,11 +184,11 @@
/**
* Downward message is overweight and was placed in the overweight queue.
**/
- OverweightEnqueued: AugmentedEvent<ApiType, [messageId: U8aFixed, overweightIndex: u64, requiredWeight: u64], { messageId: U8aFixed, overweightIndex: u64, requiredWeight: u64 }>;
+ OverweightEnqueued: AugmentedEvent<ApiType, [messageId: U8aFixed, overweightIndex: u64, requiredWeight: Weight], { messageId: U8aFixed, overweightIndex: u64, requiredWeight: Weight }>;
/**
* Downward message from the overweight queue was executed.
**/
- OverweightServiced: AugmentedEvent<ApiType, [overweightIndex: u64, weightUsed: u64], { overweightIndex: u64, weightUsed: u64 }>;
+ OverweightServiced: AugmentedEvent<ApiType, [overweightIndex: u64, weightUsed: Weight], { overweightIndex: u64, weightUsed: Weight }>;
/**
* Downward message is unsupported version of XCM.
**/
@@ -196,7 +196,7 @@
/**
* The weight limit for handling downward messages was reached.
**/
- WeightExhausted: AugmentedEvent<ApiType, [messageId: U8aFixed, remainingWeight: u64, requiredWeight: u64], { messageId: U8aFixed, remainingWeight: u64, requiredWeight: u64 }>;
+ WeightExhausted: AugmentedEvent<ApiType, [messageId: U8aFixed, remainingWeight: Weight, requiredWeight: Weight], { messageId: U8aFixed, remainingWeight: Weight, requiredWeight: Weight }>;
/**
* Generic event
**/
@@ -290,7 +290,7 @@
/**
* Downward messages were processed using the given weight.
**/
- DownwardMessagesProcessed: AugmentedEvent<ApiType, [weightUsed: u64, dmqHead: H256], { weightUsed: u64, dmqHead: H256 }>;
+ DownwardMessagesProcessed: AugmentedEvent<ApiType, [weightUsed: Weight, dmqHead: H256], { weightUsed: Weight, dmqHead: H256 }>;
/**
* Some downward messages have been received and will be processed.
**/
@@ -378,7 +378,7 @@
*
* \[ id, pallet index, call index, actual weight, max budgeted weight \]
**/
- NotifyOverweight: AugmentedEvent<ApiType, [u64, u8, u8, u64, u64]>;
+ NotifyOverweight: AugmentedEvent<ApiType, [u64, u8, u8, Weight, Weight]>;
/**
* A given location which had a version change subscription was dropped owing to an error
* migrating the location to our new XCM format.
@@ -769,19 +769,19 @@
/**
* Some XCM failed.
**/
- Fail: AugmentedEvent<ApiType, [messageHash: Option<H256>, error: XcmV2TraitsError, weight: u64], { messageHash: Option<H256>, error: XcmV2TraitsError, weight: u64 }>;
+ Fail: AugmentedEvent<ApiType, [messageHash: Option<H256>, error: XcmV2TraitsError, weight: Weight], { messageHash: Option<H256>, error: XcmV2TraitsError, weight: Weight }>;
/**
* An XCM exceeded the individual message weight budget.
**/
- OverweightEnqueued: AugmentedEvent<ApiType, [sender: u32, sentAt: u32, index: u64, required: u64], { sender: u32, sentAt: u32, index: u64, required: u64 }>;
+ OverweightEnqueued: AugmentedEvent<ApiType, [sender: u32, sentAt: u32, index: u64, required: Weight], { sender: u32, sentAt: u32, index: u64, required: Weight }>;
/**
* An XCM from the overweight queue was executed with the given actual weight used.
**/
- OverweightServiced: AugmentedEvent<ApiType, [index: u64, used: u64], { index: u64, used: u64 }>;
+ OverweightServiced: AugmentedEvent<ApiType, [index: u64, used: Weight], { index: u64, used: Weight }>;
/**
* Some XCM was executed ok.
**/
- Success: AugmentedEvent<ApiType, [messageHash: Option<H256>, weight: u64], { messageHash: Option<H256>, weight: u64 }>;
+ Success: AugmentedEvent<ApiType, [messageHash: Option<H256>, weight: Weight], { messageHash: Option<H256>, weight: Weight }>;
/**
* An upward message was sent to the relay chain.
**/
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -8,8 +8,8 @@
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { BTreeMap, Bytes, Option, U256, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
-import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
-import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, EthereumBlock, EthereumLog, EthereumReceiptReceiptV3, EthereumTransactionTransactionV2, FpRpcTransactionStatus, FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmContractHelpersSponsoringModeT, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletNonfungibleItemData, PalletRefungibleItemData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletUniqueSchedulerScheduledV3, PhantomTypeUpDataStructs, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, UpDataStructsCollection, UpDataStructsCollectionStats, UpDataStructsProperties, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, XcmV1MultiLocation } from '@polkadot/types/lookup';
+import type { AccountId32, H160, H256, Weight } from '@polkadot/types/interfaces/runtime';
+import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, EthereumBlock, EthereumLog, EthereumReceiptReceiptV3, EthereumTransactionTransactionV2, FpRpcTransactionStatus, FrameSupportWeightsPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmContractHelpersSponsoringModeT, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletNonfungibleItemData, PalletRefungibleItemData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletUniqueSchedulerScheduledV3, PhantomTypeUpDataStructs, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, UpDataStructsCollection, UpDataStructsCollectionStats, UpDataStructsProperties, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, XcmV1MultiLocation } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
@@ -555,12 +555,12 @@
* The weight we reserve at the beginning of the block for processing DMP messages. This
* overrides the amount set in the Config trait.
**/
- reservedDmpWeightOverride: AugmentedQuery<ApiType, () => Observable<Option<u64>>, []> & QueryableStorageEntry<ApiType, []>;
+ reservedDmpWeightOverride: AugmentedQuery<ApiType, () => Observable<Option<Weight>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The weight we reserve at the beginning of the block for processing XCMP messages. This
* overrides the amount set in the Config trait.
**/
- reservedXcmpWeightOverride: AugmentedQuery<ApiType, () => Observable<Option<u64>>, []> & QueryableStorageEntry<ApiType, []>;
+ reservedXcmpWeightOverride: AugmentedQuery<ApiType, () => Observable<Option<Weight>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* An option which indicates if the relay-chain restricts signalling a validation code upgrade.
* In other words, if this is `Some` and [`NewValidationCode`] is `Some` then the produced
@@ -716,7 +716,7 @@
/**
* The current weight for the block.
**/
- blockWeight: AugmentedQuery<ApiType, () => Observable<FrameSupportWeightsPerDispatchClassU64>, []> & QueryableStorageEntry<ApiType, []>;
+ blockWeight: AugmentedQuery<ApiType, () => Observable<FrameSupportWeightsPerDispatchClassWeight>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Digest of the current block, also part of the block header.
**/
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -161,22 +161,27 @@
};
contracts: {
/**
+ * @deprecated Use the runtime interface `api.call.contractsApi.call` instead
* Executes a call to a contract
**/
call: AugmentedRpc<(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractExecResult>>;
/**
+ * @deprecated Use the runtime interface `api.call.contractsApi.getStorage` instead
* Returns the value under a specified storage key in a contract
**/
getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<Bytes>>>;
/**
+ * @deprecated Use the runtime interface `api.call.contractsApi.instantiate` instead
* Instantiate a new contract
**/
instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
/**
+ * @deprecated Not available in newer versions of the contracts interfaces
* Returns the projected time a given contract will be able to sustain paying its rent
**/
rentProjection: AugmentedRpc<(address: AccountId | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<BlockNumber>>>;
/**
+ * @deprecated Use the runtime interface `api.call.contractsApi.uploadCode` instead
* Upload new code without instantiating a contract from it
**/
uploadCode: AugmentedRpc<(uploadRequest: CodeUploadRequest | { origin?: any; code?: any; storageDepositLimit?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<CodeUploadResult>>;
@@ -515,6 +520,7 @@
**/
getChildStorageSize: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<u64>>;
/**
+ * @deprecated Use `api.rpc.state.getKeysPaged` to retrieve keys
* Retrieves the keys with a certain prefix
**/
getKeys: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
@@ -527,6 +533,7 @@
**/
getMetadata: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<Metadata>>;
/**
+ * @deprecated Use `api.rpc.state.getKeysPaged` to retrieve keys
* Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)
**/
getPairs: AugmentedRpc<(prefix: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<KeyValue>>>;
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -8,7 +8,7 @@
import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types';
import type { Bytes, Compact, Option, U256, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
-import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime';
+import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';
import type { CumulusPrimitivesParachainInherentParachainInherentData, EthereumTransactionTransactionV2, FrameSupportScheduleMaybeHashed, OrmlVestingVestingSchedule, PalletEvmAccountBasicCrossAccountIdRepr, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsPartEquippableList, RmrkTraitsPartPartType, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCreateCollectionData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;
@@ -243,7 +243,7 @@
* Events:
* - `OverweightServiced`: On success.
**/
- serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, u64]>;
+ serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, Weight]>;
/**
* Generic tx
**/
@@ -367,7 +367,7 @@
* NOTE: A successful return to this does *not* imply that the `msg` was executed successfully
* to completion; only that *some* of it was executed.
**/
- execute: AugmentedSubmittable<(message: XcmVersionedXcm | { V0: any } | { V1: any } | { V2: any } | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedXcm, u64]>;
+ execute: AugmentedSubmittable<(message: XcmVersionedXcm | { V0: any } | { V1: any } | { V2: any } | string | Uint8Array, maxWeight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedXcm, Weight]>;
/**
* Set a safe XCM version (the version that XCM should be encoded with if the most recent
* version a destination can accept is unknown).
@@ -902,7 +902,7 @@
* - The weight of this call is defined by the caller.
* # </weight>
**/
- sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, u64]>;
+ sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Weight]>;
/**
* Generic tx
**/
@@ -1683,7 +1683,7 @@
* Events:
* - `OverweightServiced`: On success.
**/
- serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, u64]>;
+ serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, Weight]>;
/**
* Suspends all XCM executions for the XCMP queue, regardless of the sender's origin.
*
@@ -1720,7 +1720,7 @@
* - `origin`: Must pass `Root`.
* - `new`: Desired value for `QueueConfigData.threshold_weight`
**/
- updateThresholdWeight: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;
+ updateThresholdWeight: AugmentedSubmittable<(updated: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Weight]>;
/**
* Overwrites the speed to which the available weight approaches the maximum weight.
* A lower number results in a faster progression. A value of 1 makes the entire weight available initially.
@@ -1728,7 +1728,7 @@
* - `origin`: Must pass `Root`.
* - `new`: Desired value for `QueueConfigData.weight_restrict_decay`.
**/
- updateWeightRestrictDecay: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;
+ updateWeightRestrictDecay: AugmentedSubmittable<(updated: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Weight]>;
/**
* Overwrite the maximum amount of weight any individual message may consume.
* Messages above this weight go into the overweight queue and may only be serviced explicitly.
@@ -1736,7 +1736,7 @@
* - `origin`: Must pass `Root`.
* - `new`: Desired value for `QueueConfigData.xcmp_max_individual_weight`.
**/
- updateXcmpMaxIndividualWeight: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;
+ updateXcmpMaxIndividualWeight: AugmentedSubmittable<(updated: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Weight]>;
/**
* Generic tx
**/
tests/src/interfaces/augment-types.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-types.ts
+++ b/tests/src/interfaces/augment-types.ts
@@ -5,7 +5,7 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/types/types/registry';
-import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmOrigin, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportScheduleLookupError, FrameSupportScheduleMaybeHashed, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeOriginCaller, OpalRuntimeRuntime, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensModuleCall, OrmlTokensModuleError, OrmlTokensModuleEvent, OrmlTokensReserveData, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, OrmlXtokensModuleCall, OrmlXtokensModuleError, OrmlXtokensModuleEvent, PalletAppPromotionCall, PalletAppPromotionError, PalletAppPromotionEvent, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletConfigurationCall, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEthereumRawOrigin, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersEvent, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletForeignAssetsModuleCall, PalletForeignAssetsModuleError, PalletForeignAssetsModuleEvent, PalletForeignAssetsNativeCurrency, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletRmrkCoreCall, PalletRmrkCoreError, PalletRmrkCoreEvent, PalletRmrkEquipCall, PalletRmrkEquipError, PalletRmrkEquipEvent, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletUniqueSchedulerCall, PalletUniqueSchedulerError, PalletUniqueSchedulerEvent, PalletUniqueSchedulerScheduledV3, PalletXcmCall, PalletXcmError, PalletXcmEvent, PalletXcmOrigin, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, RmrkTraitsBaseBaseInfo, RmrkTraitsCollectionCollectionInfo, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsNftNftChild, RmrkTraitsNftNftInfo, RmrkTraitsNftRoyaltyInfo, RmrkTraitsPartEquippableList, RmrkTraitsPartFixedPart, RmrkTraitsPartPartType, RmrkTraitsPartSlotPart, RmrkTraitsPropertyPropertyInfo, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceInfo, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, RmrkTraitsThemeThemeProperty, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpCoreVoid, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExMultipleOwners, UpDataStructsCreateRefungibleExSingleOwner, UpDataStructsNestingPermissions, UpDataStructsOwnerRestrictedSet, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipStateAccountId32, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './default';
+import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmOrigin, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportScheduleLookupError, FrameSupportScheduleMaybeHashed, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassWeight, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeOriginCaller, OpalRuntimeRuntime, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensModuleCall, OrmlTokensModuleError, OrmlTokensModuleEvent, OrmlTokensReserveData, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, OrmlXtokensModuleCall, OrmlXtokensModuleError, OrmlXtokensModuleEvent, PalletAppPromotionCall, PalletAppPromotionError, PalletAppPromotionEvent, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletConfigurationCall, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEthereumRawOrigin, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersEvent, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletForeignAssetsModuleCall, PalletForeignAssetsModuleError, PalletForeignAssetsModuleEvent, PalletForeignAssetsNativeCurrency, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletRmrkCoreCall, PalletRmrkCoreError, PalletRmrkCoreEvent, PalletRmrkEquipCall, PalletRmrkEquipError, PalletRmrkEquipEvent, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletUniqueSchedulerCall, PalletUniqueSchedulerError, PalletUniqueSchedulerEvent, PalletUniqueSchedulerScheduledV3, PalletXcmCall, PalletXcmError, PalletXcmEvent, PalletXcmOrigin, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, RmrkTraitsBaseBaseInfo, RmrkTraitsCollectionCollectionInfo, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsNftNftChild, RmrkTraitsNftNftInfo, RmrkTraitsNftRoyaltyInfo, RmrkTraitsPartEquippableList, RmrkTraitsPartFixedPart, RmrkTraitsPartPartType, RmrkTraitsPartSlotPart, RmrkTraitsPropertyPropertyInfo, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceInfo, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, RmrkTraitsThemeThemeProperty, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpCoreVoid, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExMultipleOwners, UpDataStructsCreateRefungibleExSingleOwner, UpDataStructsNestingPermissions, UpDataStructsOwnerRestrictedSet, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipStateAccountId32, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './default';
import type { Data, StorageKey } from '@polkadot/types';
import type { BitVec, Bool, Bytes, F32, F64, I128, I16, I256, I32, I64, I8, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, f32, f64, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
@@ -25,7 +25,7 @@
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
-import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
+import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractContractSpecV4, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractMetadataV4, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
import type { CollationInfo, CollationInfoV1, ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
@@ -53,7 +53,7 @@
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
-import type { AccountId, AccountId20, AccountId32, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
+import type { AccountId, AccountId20, AccountId32, AccountId33, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier, WeightV1, WeightV2 } from '@polkadot/types/interfaces/runtime';
import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -79,6 +79,7 @@
AccountId: AccountId;
AccountId20: AccountId20;
AccountId32: AccountId32;
+ AccountId33: AccountId33;
AccountIdOf: AccountIdOf;
AccountIndex: AccountIndex;
AccountInfo: AccountInfo;
@@ -253,6 +254,7 @@
ContractContractSpecV1: ContractContractSpecV1;
ContractContractSpecV2: ContractContractSpecV2;
ContractContractSpecV3: ContractContractSpecV3;
+ ContractContractSpecV4: ContractContractSpecV4;
ContractCryptoHasher: ContractCryptoHasher;
ContractDiscriminant: ContractDiscriminant;
ContractDisplayName: ContractDisplayName;
@@ -296,6 +298,7 @@
ContractMetadataV1: ContractMetadataV1;
ContractMetadataV2: ContractMetadataV2;
ContractMetadataV3: ContractMetadataV3;
+ ContractMetadataV4: ContractMetadataV4;
ContractProject: ContractProject;
ContractProjectContract: ContractProjectContract;
ContractProjectInfo: ContractProjectInfo;
@@ -524,7 +527,7 @@
FrameSupportWeightsDispatchInfo: FrameSupportWeightsDispatchInfo;
FrameSupportWeightsPays: FrameSupportWeightsPays;
FrameSupportWeightsPerDispatchClassU32: FrameSupportWeightsPerDispatchClassU32;
- FrameSupportWeightsPerDispatchClassU64: FrameSupportWeightsPerDispatchClassU64;
+ FrameSupportWeightsPerDispatchClassWeight: FrameSupportWeightsPerDispatchClassWeight;
FrameSupportWeightsPerDispatchClassWeightsPerClass: FrameSupportWeightsPerDispatchClassWeightsPerClass;
FrameSupportWeightsRuntimeDbWeight: FrameSupportWeightsRuntimeDbWeight;
FrameSystemAccountInfo: FrameSystemAccountInfo;
@@ -1375,6 +1378,8 @@
WeightMultiplier: WeightMultiplier;
WeightPerClass: WeightPerClass;
WeightToFeeCoefficient: WeightToFeeCoefficient;
+ WeightV1: WeightV1;
+ WeightV2: WeightV2;
WildFungibility: WildFungibility;
WildFungibilityV0: WildFungibilityV0;
WildFungibilityV1: WildFungibilityV1;
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -3,7 +3,7 @@
import type { BTreeMap, BTreeSet, Bytes, Compact, Enum, Null, Option, Result, Struct, Text, U256, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
-import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime';
+import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';
import type { Event } from '@polkadot/types/interfaces/system';
/** @name CumulusPalletDmpQueueCall */
@@ -11,14 +11,14 @@
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
readonly index: u64;
- readonly weightLimit: u64;
+ readonly weightLimit: Weight;
} & Struct;
readonly type: 'ServiceOverweight';
}
/** @name CumulusPalletDmpQueueConfigData */
export interface CumulusPalletDmpQueueConfigData extends Struct {
- readonly maxIndividual: u64;
+ readonly maxIndividual: Weight;
}
/** @name CumulusPalletDmpQueueError */
@@ -46,19 +46,19 @@
readonly isWeightExhausted: boolean;
readonly asWeightExhausted: {
readonly messageId: U8aFixed;
- readonly remainingWeight: u64;
- readonly requiredWeight: u64;
+ readonly remainingWeight: Weight;
+ readonly requiredWeight: Weight;
} & Struct;
readonly isOverweightEnqueued: boolean;
readonly asOverweightEnqueued: {
readonly messageId: U8aFixed;
readonly overweightIndex: u64;
- readonly requiredWeight: u64;
+ readonly requiredWeight: Weight;
} & Struct;
readonly isOverweightServiced: boolean;
readonly asOverweightServiced: {
readonly overweightIndex: u64;
- readonly weightUsed: u64;
+ readonly weightUsed: Weight;
} & Struct;
readonly type: 'InvalidFormat' | 'UnsupportedVersion' | 'ExecutedDownward' | 'WeightExhausted' | 'OverweightEnqueued' | 'OverweightServiced';
}
@@ -122,7 +122,7 @@
} & Struct;
readonly isDownwardMessagesProcessed: boolean;
readonly asDownwardMessagesProcessed: {
- readonly weightUsed: u64;
+ readonly weightUsed: Weight;
readonly dmqHead: H256;
} & Struct;
readonly type: 'ValidationFunctionStored' | 'ValidationFunctionApplied' | 'ValidationFunctionDiscarded' | 'UpgradeAuthorized' | 'DownwardMessagesReceived' | 'DownwardMessagesProcessed';
@@ -166,7 +166,7 @@
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
readonly index: u64;
- readonly weightLimit: u64;
+ readonly weightLimit: Weight;
} & Struct;
readonly isSuspendXcmExecution: boolean;
readonly isResumeXcmExecution: boolean;
@@ -184,15 +184,15 @@
} & Struct;
readonly isUpdateThresholdWeight: boolean;
readonly asUpdateThresholdWeight: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly isUpdateWeightRestrictDecay: boolean;
readonly asUpdateWeightRestrictDecay: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly isUpdateXcmpMaxIndividualWeight: boolean;
readonly asUpdateXcmpMaxIndividualWeight: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly type: 'ServiceOverweight' | 'SuspendXcmExecution' | 'ResumeXcmExecution' | 'UpdateSuspendThreshold' | 'UpdateDropThreshold' | 'UpdateResumeThreshold' | 'UpdateThresholdWeight' | 'UpdateWeightRestrictDecay' | 'UpdateXcmpMaxIndividualWeight';
}
@@ -212,13 +212,13 @@
readonly isSuccess: boolean;
readonly asSuccess: {
readonly messageHash: Option<H256>;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isFail: boolean;
readonly asFail: {
readonly messageHash: Option<H256>;
readonly error: XcmV2TraitsError;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isBadVersion: boolean;
readonly asBadVersion: {
@@ -241,12 +241,12 @@
readonly sender: u32;
readonly sentAt: u32;
readonly index: u64;
- readonly required: u64;
+ readonly required: Weight;
} & Struct;
readonly isOverweightServiced: boolean;
readonly asOverweightServiced: {
readonly index: u64;
- readonly used: u64;
+ readonly used: Weight;
} & Struct;
readonly type: 'Success' | 'Fail' | 'BadVersion' | 'BadFormat' | 'UpwardMessageSent' | 'XcmpMessageSent' | 'OverweightEnqueued' | 'OverweightServiced';
}
@@ -286,9 +286,9 @@
readonly suspendThreshold: u32;
readonly dropThreshold: u32;
readonly resumeThreshold: u32;
- readonly thresholdWeight: u64;
- readonly weightRestrictDecay: u64;
- readonly xcmpMaxIndividualWeight: u64;
+ readonly thresholdWeight: Weight;
+ readonly weightRestrictDecay: Weight;
+ readonly xcmpMaxIndividualWeight: Weight;
}
/** @name CumulusPrimitivesParachainInherentParachainInherentData */
@@ -546,7 +546,7 @@
/** @name FrameSupportWeightsDispatchInfo */
export interface FrameSupportWeightsDispatchInfo extends Struct {
- readonly weight: u64;
+ readonly weight: Weight;
readonly class: FrameSupportWeightsDispatchClass;
readonly paysFee: FrameSupportWeightsPays;
}
@@ -565,11 +565,11 @@
readonly mandatory: u32;
}
-/** @name FrameSupportWeightsPerDispatchClassU64 */
-export interface FrameSupportWeightsPerDispatchClassU64 extends Struct {
- readonly normal: u64;
- readonly operational: u64;
- readonly mandatory: u64;
+/** @name FrameSupportWeightsPerDispatchClassWeight */
+export interface FrameSupportWeightsPerDispatchClassWeight extends Struct {
+ readonly normal: Weight;
+ readonly operational: Weight;
+ readonly mandatory: Weight;
}
/** @name FrameSupportWeightsPerDispatchClassWeightsPerClass */
@@ -710,17 +710,17 @@
/** @name FrameSystemLimitsBlockWeights */
export interface FrameSystemLimitsBlockWeights extends Struct {
- readonly baseBlock: u64;
- readonly maxBlock: u64;
+ readonly baseBlock: Weight;
+ readonly maxBlock: Weight;
readonly perClass: FrameSupportWeightsPerDispatchClassWeightsPerClass;
}
/** @name FrameSystemLimitsWeightsPerClass */
export interface FrameSystemLimitsWeightsPerClass extends Struct {
- readonly baseExtrinsic: u64;
- readonly maxExtrinsic: Option<u64>;
- readonly maxTotal: Option<u64>;
- readonly reserved: Option<u64>;
+ readonly baseExtrinsic: Weight;
+ readonly maxExtrinsic: Option<Weight>;
+ readonly maxTotal: Option<Weight>;
+ readonly reserved: Option<Weight>;
}
/** @name FrameSystemPhase */
@@ -1929,7 +1929,7 @@
readonly isSudoUncheckedWeight: boolean;
readonly asSudoUncheckedWeight: {
readonly call: Call;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isSetKey: boolean;
readonly asSetKey: {
@@ -2372,7 +2372,7 @@
readonly isExecute: boolean;
readonly asExecute: {
readonly message: XcmVersionedXcm;
- readonly maxWeight: u64;
+ readonly maxWeight: Weight;
} & Struct;
readonly isForceXcmVersion: boolean;
readonly asForceXcmVersion: {
@@ -2441,7 +2441,7 @@
readonly isNotified: boolean;
readonly asNotified: ITuple<[u64, u8, u8]>;
readonly isNotifyOverweight: boolean;
- readonly asNotifyOverweight: ITuple<[u64, u8, u8, u64, u64]>;
+ readonly asNotifyOverweight: ITuple<[u64, u8, u8, Weight, Weight]>;
readonly isNotifyDispatchError: boolean;
readonly asNotifyDispatchError: ITuple<[u64, u8, u8]>;
readonly isNotifyDecodeFailed: boolean;
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -24,21 +24,21 @@
feeFrozen: 'u128'
},
/**
- * Lookup7: frame_support::weights::PerDispatchClass<T>
+ * Lookup7: frame_support::weights::PerDispatchClass<frame_support::weights::weight_v2::Weight>
**/
- FrameSupportWeightsPerDispatchClassU64: {
- normal: 'u64',
- operational: 'u64',
- mandatory: 'u64'
+ FrameSupportWeightsPerDispatchClassWeight: {
+ normal: 'Weight',
+ operational: 'Weight',
+ mandatory: 'Weight'
},
/**
- * Lookup11: sp_runtime::generic::digest::Digest
+ * Lookup12: sp_runtime::generic::digest::Digest
**/
SpRuntimeDigest: {
logs: 'Vec<SpRuntimeDigestDigestItem>'
},
/**
- * Lookup13: sp_runtime::generic::digest::DigestItem
+ * Lookup14: sp_runtime::generic::digest::DigestItem
**/
SpRuntimeDigestDigestItem: {
_enum: {
@@ -54,7 +54,7 @@
}
},
/**
- * Lookup16: frame_system::EventRecord<opal_runtime::Event, primitive_types::H256>
+ * Lookup17: frame_system::EventRecord<opal_runtime::Event, primitive_types::H256>
**/
FrameSystemEventRecord: {
phase: 'FrameSystemPhase',
@@ -62,7 +62,7 @@
topics: 'Vec<H256>'
},
/**
- * Lookup18: frame_system::pallet::Event<T>
+ * Lookup19: frame_system::pallet::Event<T>
**/
FrameSystemEvent: {
_enum: {
@@ -90,27 +90,27 @@
}
},
/**
- * Lookup19: frame_support::weights::DispatchInfo
+ * Lookup20: frame_support::weights::DispatchInfo
**/
FrameSupportWeightsDispatchInfo: {
- weight: 'u64',
+ weight: 'Weight',
class: 'FrameSupportWeightsDispatchClass',
paysFee: 'FrameSupportWeightsPays'
},
/**
- * Lookup20: frame_support::weights::DispatchClass
+ * Lookup21: frame_support::weights::DispatchClass
**/
FrameSupportWeightsDispatchClass: {
_enum: ['Normal', 'Operational', 'Mandatory']
},
/**
- * Lookup21: frame_support::weights::Pays
+ * Lookup22: frame_support::weights::Pays
**/
FrameSupportWeightsPays: {
_enum: ['Yes', 'No']
},
/**
- * Lookup22: sp_runtime::DispatchError
+ * Lookup23: sp_runtime::DispatchError
**/
SpRuntimeDispatchError: {
_enum: {
@@ -127,32 +127,32 @@
}
},
/**
- * Lookup23: sp_runtime::ModuleError
+ * Lookup24: sp_runtime::ModuleError
**/
SpRuntimeModuleError: {
index: 'u8',
error: '[u8;4]'
},
/**
- * Lookup24: sp_runtime::TokenError
+ * Lookup25: sp_runtime::TokenError
**/
SpRuntimeTokenError: {
_enum: ['NoFunds', 'WouldDie', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported']
},
/**
- * Lookup25: sp_runtime::ArithmeticError
+ * Lookup26: sp_runtime::ArithmeticError
**/
SpRuntimeArithmeticError: {
_enum: ['Underflow', 'Overflow', 'DivisionByZero']
},
/**
- * Lookup26: sp_runtime::TransactionalError
+ * Lookup27: sp_runtime::TransactionalError
**/
SpRuntimeTransactionalError: {
_enum: ['LimitReached', 'NoLayer']
},
/**
- * Lookup27: cumulus_pallet_parachain_system::pallet::Event<T>
+ * Lookup28: cumulus_pallet_parachain_system::pallet::Event<T>
**/
CumulusPalletParachainSystemEvent: {
_enum: {
@@ -168,13 +168,13 @@
count: 'u32',
},
DownwardMessagesProcessed: {
- weightUsed: 'u64',
+ weightUsed: 'Weight',
dmqHead: 'H256'
}
}
},
/**
- * Lookup28: pallet_balances::pallet::Event<T, I>
+ * Lookup29: pallet_balances::pallet::Event<T, I>
**/
PalletBalancesEvent: {
_enum: {
@@ -225,13 +225,13 @@
}
},
/**
- * Lookup29: frame_support::traits::tokens::misc::BalanceStatus
+ * Lookup30: frame_support::traits::tokens::misc::BalanceStatus
**/
FrameSupportTokensMiscBalanceStatus: {
_enum: ['Free', 'Reserved']
},
/**
- * Lookup30: pallet_transaction_payment::pallet::Event<T>
+ * Lookup31: pallet_transaction_payment::pallet::Event<T>
**/
PalletTransactionPaymentEvent: {
_enum: {
@@ -243,7 +243,7 @@
}
},
/**
- * Lookup31: pallet_treasury::pallet::Event<T, I>
+ * Lookup32: pallet_treasury::pallet::Event<T, I>
**/
PalletTreasuryEvent: {
_enum: {
@@ -279,7 +279,7 @@
}
},
/**
- * Lookup32: pallet_sudo::pallet::Event<T>
+ * Lookup33: pallet_sudo::pallet::Event<T>
**/
PalletSudoEvent: {
_enum: {
@@ -295,7 +295,7 @@
}
},
/**
- * Lookup36: orml_vesting::module::Event<T>
+ * Lookup37: orml_vesting::module::Event<T>
**/
OrmlVestingModuleEvent: {
_enum: {
@@ -314,7 +314,7 @@
}
},
/**
- * Lookup37: orml_vesting::VestingSchedule<BlockNumber, Balance>
+ * Lookup38: orml_vesting::VestingSchedule<BlockNumber, Balance>
**/
OrmlVestingVestingSchedule: {
start: 'u32',
@@ -323,7 +323,7 @@
perPeriod: 'Compact<u128>'
},
/**
- * Lookup39: orml_xtokens::module::Event<T>
+ * Lookup40: orml_xtokens::module::Event<T>
**/
OrmlXtokensModuleEvent: {
_enum: {
@@ -336,18 +336,18 @@
}
},
/**
- * Lookup40: xcm::v1::multiasset::MultiAssets
+ * Lookup41: xcm::v1::multiasset::MultiAssets
**/
XcmV1MultiassetMultiAssets: 'Vec<XcmV1MultiAsset>',
/**
- * Lookup42: xcm::v1::multiasset::MultiAsset
+ * Lookup43: xcm::v1::multiasset::MultiAsset
**/
XcmV1MultiAsset: {
id: 'XcmV1MultiassetAssetId',
fun: 'XcmV1MultiassetFungibility'
},
/**
- * Lookup43: xcm::v1::multiasset::AssetId
+ * Lookup44: xcm::v1::multiasset::AssetId
**/
XcmV1MultiassetAssetId: {
_enum: {
@@ -356,14 +356,14 @@
}
},
/**
- * Lookup44: xcm::v1::multilocation::MultiLocation
+ * Lookup45: xcm::v1::multilocation::MultiLocation
**/
XcmV1MultiLocation: {
parents: 'u8',
interior: 'XcmV1MultilocationJunctions'
},
/**
- * Lookup45: xcm::v1::multilocation::Junctions
+ * Lookup46: xcm::v1::multilocation::Junctions
**/
XcmV1MultilocationJunctions: {
_enum: {
@@ -379,7 +379,7 @@
}
},
/**
- * Lookup46: xcm::v1::junction::Junction
+ * Lookup47: xcm::v1::junction::Junction
**/
XcmV1Junction: {
_enum: {
@@ -407,7 +407,7 @@
}
},
/**
- * Lookup48: xcm::v0::junction::NetworkId
+ * Lookup49: xcm::v0::junction::NetworkId
**/
XcmV0JunctionNetworkId: {
_enum: {
@@ -418,7 +418,7 @@
}
},
/**
- * Lookup52: xcm::v0::junction::BodyId
+ * Lookup53: xcm::v0::junction::BodyId
**/
XcmV0JunctionBodyId: {
_enum: {
@@ -432,7 +432,7 @@
}
},
/**
- * Lookup53: xcm::v0::junction::BodyPart
+ * Lookup54: xcm::v0::junction::BodyPart
**/
XcmV0JunctionBodyPart: {
_enum: {
@@ -455,7 +455,7 @@
}
},
/**
- * Lookup54: xcm::v1::multiasset::Fungibility
+ * Lookup55: xcm::v1::multiasset::Fungibility
**/
XcmV1MultiassetFungibility: {
_enum: {
@@ -464,7 +464,7 @@
}
},
/**
- * Lookup55: xcm::v1::multiasset::AssetInstance
+ * Lookup56: xcm::v1::multiasset::AssetInstance
**/
XcmV1MultiassetAssetInstance: {
_enum: {
@@ -478,7 +478,7 @@
}
},
/**
- * Lookup58: orml_tokens::module::Event<T>
+ * Lookup59: orml_tokens::module::Event<T>
**/
OrmlTokensModuleEvent: {
_enum: {
@@ -555,7 +555,7 @@
}
},
/**
- * Lookup59: pallet_foreign_assets::AssetIds
+ * Lookup60: pallet_foreign_assets::AssetIds
**/
PalletForeignAssetsAssetIds: {
_enum: {
@@ -564,24 +564,24 @@
}
},
/**
- * Lookup60: pallet_foreign_assets::NativeCurrency
+ * Lookup61: pallet_foreign_assets::NativeCurrency
**/
PalletForeignAssetsNativeCurrency: {
_enum: ['Here', 'Parent']
},
/**
- * Lookup61: cumulus_pallet_xcmp_queue::pallet::Event<T>
+ * Lookup62: cumulus_pallet_xcmp_queue::pallet::Event<T>
**/
CumulusPalletXcmpQueueEvent: {
_enum: {
Success: {
messageHash: 'Option<H256>',
- weight: 'u64',
+ weight: 'Weight',
},
Fail: {
messageHash: 'Option<H256>',
error: 'XcmV2TraitsError',
- weight: 'u64',
+ weight: 'Weight',
},
BadVersion: {
messageHash: 'Option<H256>',
@@ -599,16 +599,16 @@
sender: 'u32',
sentAt: 'u32',
index: 'u64',
- required: 'u64',
+ required: 'Weight',
},
OverweightServiced: {
index: 'u64',
- used: 'u64'
+ used: 'Weight'
}
}
},
/**
- * Lookup63: xcm::v2::traits::Error
+ * Lookup64: xcm::v2::traits::Error
**/
XcmV2TraitsError: {
_enum: {
@@ -641,7 +641,7 @@
}
},
/**
- * Lookup65: pallet_xcm::pallet::Event<T>
+ * Lookup66: pallet_xcm::pallet::Event<T>
**/
PalletXcmEvent: {
_enum: {
@@ -650,7 +650,7 @@
UnexpectedResponse: '(XcmV1MultiLocation,u64)',
ResponseReady: '(u64,XcmV2Response)',
Notified: '(u64,u8,u8)',
- NotifyOverweight: '(u64,u8,u8,u64,u64)',
+ NotifyOverweight: '(u64,u8,u8,Weight,Weight)',
NotifyDispatchError: '(u64,u8,u8)',
NotifyDecodeFailed: '(u64,u8,u8)',
InvalidResponder: '(XcmV1MultiLocation,u64,Option<XcmV1MultiLocation>)',
@@ -664,7 +664,7 @@
}
},
/**
- * Lookup66: xcm::v2::traits::Outcome
+ * Lookup67: xcm::v2::traits::Outcome
**/
XcmV2TraitsOutcome: {
_enum: {
@@ -674,11 +674,11 @@
}
},
/**
- * Lookup67: xcm::v2::Xcm<Call>
+ * Lookup68: xcm::v2::Xcm<Call>
**/
XcmV2Xcm: 'Vec<XcmV2Instruction>',
/**
- * Lookup69: xcm::v2::Instruction<Call>
+ * Lookup70: xcm::v2::Instruction<Call>
**/
XcmV2Instruction: {
_enum: {
@@ -776,7 +776,7 @@
}
},
/**
- * Lookup70: xcm::v2::Response
+ * Lookup71: xcm::v2::Response
**/
XcmV2Response: {
_enum: {
@@ -787,19 +787,19 @@
}
},
/**
- * Lookup73: xcm::v0::OriginKind
+ * Lookup74: xcm::v0::OriginKind
**/
XcmV0OriginKind: {
_enum: ['Native', 'SovereignAccount', 'Superuser', 'Xcm']
},
/**
- * Lookup74: xcm::double_encoded::DoubleEncoded<T>
+ * Lookup75: xcm::double_encoded::DoubleEncoded<T>
**/
XcmDoubleEncoded: {
encoded: 'Bytes'
},
/**
- * Lookup75: xcm::v1::multiasset::MultiAssetFilter
+ * Lookup76: xcm::v1::multiasset::MultiAssetFilter
**/
XcmV1MultiassetMultiAssetFilter: {
_enum: {
@@ -808,7 +808,7 @@
}
},
/**
- * Lookup76: xcm::v1::multiasset::WildMultiAsset
+ * Lookup77: xcm::v1::multiasset::WildMultiAsset
**/
XcmV1MultiassetWildMultiAsset: {
_enum: {
@@ -820,13 +820,13 @@
}
},
/**
- * Lookup77: xcm::v1::multiasset::WildFungibility
+ * Lookup78: xcm::v1::multiasset::WildFungibility
**/
XcmV1MultiassetWildFungibility: {
_enum: ['Fungible', 'NonFungible']
},
/**
- * Lookup78: xcm::v2::WeightLimit
+ * Lookup79: xcm::v2::WeightLimit
**/
XcmV2WeightLimit: {
_enum: {
@@ -835,7 +835,7 @@
}
},
/**
- * Lookup80: xcm::VersionedMultiAssets
+ * Lookup81: xcm::VersionedMultiAssets
**/
XcmVersionedMultiAssets: {
_enum: {
@@ -844,7 +844,7 @@
}
},
/**
- * Lookup82: xcm::v0::multi_asset::MultiAsset
+ * Lookup83: xcm::v0::multi_asset::MultiAsset
**/
XcmV0MultiAsset: {
_enum: {
@@ -883,7 +883,7 @@
}
},
/**
- * Lookup83: xcm::v0::multi_location::MultiLocation
+ * Lookup84: xcm::v0::multi_location::MultiLocation
**/
XcmV0MultiLocation: {
_enum: {
@@ -899,7 +899,7 @@
}
},
/**
- * Lookup84: xcm::v0::junction::Junction
+ * Lookup85: xcm::v0::junction::Junction
**/
XcmV0Junction: {
_enum: {
@@ -928,7 +928,7 @@
}
},
/**
- * Lookup85: xcm::VersionedMultiLocation
+ * Lookup86: xcm::VersionedMultiLocation
**/
XcmVersionedMultiLocation: {
_enum: {
@@ -937,7 +937,7 @@
}
},
/**
- * Lookup86: cumulus_pallet_xcm::pallet::Event<T>
+ * Lookup87: cumulus_pallet_xcm::pallet::Event<T>
**/
CumulusPalletXcmEvent: {
_enum: {
@@ -947,7 +947,7 @@
}
},
/**
- * Lookup87: cumulus_pallet_dmp_queue::pallet::Event<T>
+ * Lookup88: cumulus_pallet_dmp_queue::pallet::Event<T>
**/
CumulusPalletDmpQueueEvent: {
_enum: {
@@ -963,22 +963,22 @@
},
WeightExhausted: {
messageId: '[u8;32]',
- remainingWeight: 'u64',
- requiredWeight: 'u64',
+ remainingWeight: 'Weight',
+ requiredWeight: 'Weight',
},
OverweightEnqueued: {
messageId: '[u8;32]',
overweightIndex: 'u64',
- requiredWeight: 'u64',
+ requiredWeight: 'Weight',
},
OverweightServiced: {
overweightIndex: 'u64',
- weightUsed: 'u64'
+ weightUsed: 'Weight'
}
}
},
/**
- * Lookup88: pallet_unique::RawEvent<sp_core::crypto::AccountId32, pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup89: pallet_unique::RawEvent<sp_core::crypto::AccountId32, pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
PalletUniqueRawEvent: {
_enum: {
@@ -995,7 +995,7 @@
}
},
/**
- * Lookup89: pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>
+ * Lookup90: pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>
**/
PalletEvmAccountBasicCrossAccountIdRepr: {
_enum: {
@@ -1004,7 +1004,7 @@
}
},
/**
- * Lookup92: pallet_unique_scheduler::pallet::Event<T>
+ * Lookup93: pallet_unique_scheduler::pallet::Event<T>
**/
PalletUniqueSchedulerEvent: {
_enum: {
@@ -1029,13 +1029,13 @@
}
},
/**
- * Lookup95: frame_support::traits::schedule::LookupError
+ * Lookup96: frame_support::traits::schedule::LookupError
**/
FrameSupportScheduleLookupError: {
_enum: ['Unknown', 'BadFormat']
},
/**
- * Lookup96: pallet_common::pallet::Event<T>
+ * Lookup97: pallet_common::pallet::Event<T>
**/
PalletCommonEvent: {
_enum: {
@@ -1053,7 +1053,7 @@
}
},
/**
- * Lookup99: pallet_structure::pallet::Event<T>
+ * Lookup100: pallet_structure::pallet::Event<T>
**/
PalletStructureEvent: {
_enum: {
@@ -1061,7 +1061,7 @@
}
},
/**
- * Lookup100: pallet_rmrk_core::pallet::Event<T>
+ * Lookup101: pallet_rmrk_core::pallet::Event<T>
**/
PalletRmrkCoreEvent: {
_enum: {
@@ -1138,7 +1138,7 @@
}
},
/**
- * Lookup101: rmrk_traits::nft::AccountIdOrCollectionNftTuple<sp_core::crypto::AccountId32>
+ * Lookup102: rmrk_traits::nft::AccountIdOrCollectionNftTuple<sp_core::crypto::AccountId32>
**/
RmrkTraitsNftAccountIdOrCollectionNftTuple: {
_enum: {
@@ -1147,7 +1147,7 @@
}
},
/**
- * Lookup106: pallet_rmrk_equip::pallet::Event<T>
+ * Lookup107: pallet_rmrk_equip::pallet::Event<T>
**/
PalletRmrkEquipEvent: {
_enum: {
@@ -1162,7 +1162,7 @@
}
},
/**
- * Lookup107: pallet_app_promotion::pallet::Event<T>
+ * Lookup108: pallet_app_promotion::pallet::Event<T>
**/
PalletAppPromotionEvent: {
_enum: {
@@ -1173,7 +1173,7 @@
}
},
/**
- * Lookup108: pallet_foreign_assets::module::Event<T>
+ * Lookup109: pallet_foreign_assets::module::Event<T>
**/
PalletForeignAssetsModuleEvent: {
_enum: {
@@ -1198,7 +1198,7 @@
}
},
/**
- * Lookup109: pallet_foreign_assets::module::AssetMetadata<Balance>
+ * Lookup110: pallet_foreign_assets::module::AssetMetadata<Balance>
**/
PalletForeignAssetsModuleAssetMetadata: {
name: 'Bytes',
@@ -1207,7 +1207,7 @@
minimalBalance: 'u128'
},
/**
- * Lookup110: pallet_evm::pallet::Event<T>
+ * Lookup111: pallet_evm::pallet::Event<T>
**/
PalletEvmEvent: {
_enum: {
@@ -1221,7 +1221,7 @@
}
},
/**
- * Lookup111: ethereum::log::Log
+ * Lookup112: ethereum::log::Log
**/
EthereumLog: {
address: 'H160',
@@ -1229,7 +1229,7 @@
data: 'Bytes'
},
/**
- * Lookup115: pallet_ethereum::pallet::Event
+ * Lookup116: pallet_ethereum::pallet::Event
**/
PalletEthereumEvent: {
_enum: {
@@ -1237,7 +1237,7 @@
}
},
/**
- * Lookup116: evm_core::error::ExitReason
+ * Lookup117: evm_core::error::ExitReason
**/
EvmCoreErrorExitReason: {
_enum: {
@@ -1248,13 +1248,13 @@
}
},
/**
- * Lookup117: evm_core::error::ExitSucceed
+ * Lookup118: evm_core::error::ExitSucceed
**/
EvmCoreErrorExitSucceed: {
_enum: ['Stopped', 'Returned', 'Suicided']
},
/**
- * Lookup118: evm_core::error::ExitError
+ * Lookup119: evm_core::error::ExitError
**/
EvmCoreErrorExitError: {
_enum: {
@@ -1276,13 +1276,13 @@
}
},
/**
- * Lookup121: evm_core::error::ExitRevert
+ * Lookup122: evm_core::error::ExitRevert
**/
EvmCoreErrorExitRevert: {
_enum: ['Reverted']
},
/**
- * Lookup122: evm_core::error::ExitFatal
+ * Lookup123: evm_core::error::ExitFatal
**/
EvmCoreErrorExitFatal: {
_enum: {
@@ -1293,7 +1293,7 @@
}
},
/**
- * Lookup123: pallet_evm_contract_helpers::pallet::Event<T>
+ * Lookup124: pallet_evm_contract_helpers::pallet::Event<T>
**/
PalletEvmContractHelpersEvent: {
_enum: {
@@ -1303,7 +1303,7 @@
}
},
/**
- * Lookup124: frame_system::Phase
+ * Lookup125: frame_system::Phase
**/
FrameSystemPhase: {
_enum: {
@@ -1313,14 +1313,14 @@
}
},
/**
- * Lookup126: frame_system::LastRuntimeUpgradeInfo
+ * Lookup127: frame_system::LastRuntimeUpgradeInfo
**/
FrameSystemLastRuntimeUpgradeInfo: {
specVersion: 'Compact<u32>',
specName: 'Text'
},
/**
- * Lookup127: frame_system::pallet::Call<T>
+ * Lookup128: frame_system::pallet::Call<T>
**/
FrameSystemCall: {
_enum: {
@@ -1358,15 +1358,15 @@
}
},
/**
- * Lookup132: frame_system::limits::BlockWeights
+ * Lookup133: frame_system::limits::BlockWeights
**/
FrameSystemLimitsBlockWeights: {
- baseBlock: 'u64',
- maxBlock: 'u64',
+ baseBlock: 'Weight',
+ maxBlock: 'Weight',
perClass: 'FrameSupportWeightsPerDispatchClassWeightsPerClass'
},
/**
- * Lookup133: frame_support::weights::PerDispatchClass<frame_system::limits::WeightsPerClass>
+ * Lookup134: frame_support::weights::PerDispatchClass<frame_system::limits::WeightsPerClass>
**/
FrameSupportWeightsPerDispatchClassWeightsPerClass: {
normal: 'FrameSystemLimitsWeightsPerClass',
@@ -1374,22 +1374,22 @@
mandatory: 'FrameSystemLimitsWeightsPerClass'
},
/**
- * Lookup134: frame_system::limits::WeightsPerClass
+ * Lookup135: frame_system::limits::WeightsPerClass
**/
FrameSystemLimitsWeightsPerClass: {
- baseExtrinsic: 'u64',
- maxExtrinsic: 'Option<u64>',
- maxTotal: 'Option<u64>',
- reserved: 'Option<u64>'
+ baseExtrinsic: 'Weight',
+ maxExtrinsic: 'Option<Weight>',
+ maxTotal: 'Option<Weight>',
+ reserved: 'Option<Weight>'
},
/**
- * Lookup136: frame_system::limits::BlockLength
+ * Lookup137: frame_system::limits::BlockLength
**/
FrameSystemLimitsBlockLength: {
max: 'FrameSupportWeightsPerDispatchClassU32'
},
/**
- * Lookup137: frame_support::weights::PerDispatchClass<T>
+ * Lookup138: frame_support::weights::PerDispatchClass<T>
**/
FrameSupportWeightsPerDispatchClassU32: {
normal: 'u32',
@@ -1397,14 +1397,14 @@
mandatory: 'u32'
},
/**
- * Lookup138: frame_support::weights::RuntimeDbWeight
+ * Lookup139: frame_support::weights::RuntimeDbWeight
**/
FrameSupportWeightsRuntimeDbWeight: {
read: 'u64',
write: 'u64'
},
/**
- * Lookup139: sp_version::RuntimeVersion
+ * Lookup140: sp_version::RuntimeVersion
**/
SpVersionRuntimeVersion: {
specName: 'Text',
@@ -1417,13 +1417,13 @@
stateVersion: 'u8'
},
/**
- * Lookup144: frame_system::pallet::Error<T>
+ * Lookup145: frame_system::pallet::Error<T>
**/
FrameSystemError: {
_enum: ['InvalidSpecName', 'SpecVersionNeedsToIncrease', 'FailedToExtractRuntimeVersion', 'NonDefaultComposite', 'NonZeroRefCount', 'CallFiltered']
},
/**
- * Lookup145: polkadot_primitives::v2::PersistedValidationData<primitive_types::H256, N>
+ * Lookup146: polkadot_primitives::v2::PersistedValidationData<primitive_types::H256, N>
**/
PolkadotPrimitivesV2PersistedValidationData: {
parentHead: 'Bytes',
@@ -1432,19 +1432,19 @@
maxPovSize: 'u32'
},
/**
- * Lookup148: polkadot_primitives::v2::UpgradeRestriction
+ * Lookup149: polkadot_primitives::v2::UpgradeRestriction
**/
PolkadotPrimitivesV2UpgradeRestriction: {
_enum: ['Present']
},
/**
- * Lookup149: sp_trie::storage_proof::StorageProof
+ * Lookup150: sp_trie::storage_proof::StorageProof
**/
SpTrieStorageProof: {
trieNodes: 'BTreeSet<Bytes>'
},
/**
- * Lookup151: cumulus_pallet_parachain_system::relay_state_snapshot::MessagingStateSnapshot
+ * Lookup152: cumulus_pallet_parachain_system::relay_state_snapshot::MessagingStateSnapshot
**/
CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot: {
dmqMqcHead: 'H256',
@@ -1453,7 +1453,7 @@
egressChannels: 'Vec<(u32,PolkadotPrimitivesV2AbridgedHrmpChannel)>'
},
/**
- * Lookup154: polkadot_primitives::v2::AbridgedHrmpChannel
+ * Lookup155: polkadot_primitives::v2::AbridgedHrmpChannel
**/
PolkadotPrimitivesV2AbridgedHrmpChannel: {
maxCapacity: 'u32',
@@ -1464,7 +1464,7 @@
mqcHead: 'Option<H256>'
},
/**
- * Lookup155: polkadot_primitives::v2::AbridgedHostConfiguration
+ * Lookup156: polkadot_primitives::v2::AbridgedHostConfiguration
**/
PolkadotPrimitivesV2AbridgedHostConfiguration: {
maxCodeSize: 'u32',
@@ -1478,14 +1478,14 @@
validationUpgradeDelay: 'u32'
},
/**
- * Lookup161: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
+ * Lookup162: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
**/
PolkadotCorePrimitivesOutboundHrmpMessage: {
recipient: 'u32',
data: 'Bytes'
},
/**
- * Lookup162: cumulus_pallet_parachain_system::pallet::Call<T>
+ * Lookup163: cumulus_pallet_parachain_system::pallet::Call<T>
**/
CumulusPalletParachainSystemCall: {
_enum: {
@@ -1504,7 +1504,7 @@
}
},
/**
- * Lookup163: cumulus_primitives_parachain_inherent::ParachainInherentData
+ * Lookup164: cumulus_primitives_parachain_inherent::ParachainInherentData
**/
CumulusPrimitivesParachainInherentParachainInherentData: {
validationData: 'PolkadotPrimitivesV2PersistedValidationData',
@@ -1513,27 +1513,27 @@
horizontalMessages: 'BTreeMap<u32, Vec<PolkadotCorePrimitivesInboundHrmpMessage>>'
},
/**
- * Lookup165: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
+ * Lookup166: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
**/
PolkadotCorePrimitivesInboundDownwardMessage: {
sentAt: 'u32',
msg: 'Bytes'
},
/**
- * Lookup168: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
+ * Lookup169: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
**/
PolkadotCorePrimitivesInboundHrmpMessage: {
sentAt: 'u32',
data: 'Bytes'
},
/**
- * Lookup171: cumulus_pallet_parachain_system::pallet::Error<T>
+ * Lookup172: cumulus_pallet_parachain_system::pallet::Error<T>
**/
CumulusPalletParachainSystemError: {
_enum: ['OverlappingUpgrades', 'ProhibitedByPolkadot', 'TooBig', 'ValidationDataNotAvailable', 'HostConfigurationNotAvailable', 'NotScheduled', 'NothingAuthorized', 'Unauthorized']
},
/**
- * Lookup173: pallet_balances::BalanceLock<Balance>
+ * Lookup174: pallet_balances::BalanceLock<Balance>
**/
PalletBalancesBalanceLock: {
id: '[u8;8]',
@@ -1541,26 +1541,26 @@
reasons: 'PalletBalancesReasons'
},
/**
- * Lookup174: pallet_balances::Reasons
+ * Lookup175: pallet_balances::Reasons
**/
PalletBalancesReasons: {
_enum: ['Fee', 'Misc', 'All']
},
/**
- * Lookup177: pallet_balances::ReserveData<ReserveIdentifier, Balance>
+ * Lookup178: pallet_balances::ReserveData<ReserveIdentifier, Balance>
**/
PalletBalancesReserveData: {
id: '[u8;16]',
amount: 'u128'
},
/**
- * Lookup179: pallet_balances::Releases
+ * Lookup180: pallet_balances::Releases
**/
PalletBalancesReleases: {
_enum: ['V1_0_0', 'V2_0_0']
},
/**
- * Lookup180: pallet_balances::pallet::Call<T, I>
+ * Lookup181: pallet_balances::pallet::Call<T, I>
**/
PalletBalancesCall: {
_enum: {
@@ -1593,13 +1593,13 @@
}
},
/**
- * Lookup183: pallet_balances::pallet::Error<T, I>
+ * Lookup184: pallet_balances::pallet::Error<T, I>
**/
PalletBalancesError: {
_enum: ['VestingBalance', 'LiquidityRestrictions', 'InsufficientBalance', 'ExistentialDeposit', 'KeepAlive', 'ExistingVestingSchedule', 'DeadAccount', 'TooManyReserves']
},
/**
- * Lookup185: pallet_timestamp::pallet::Call<T>
+ * Lookup186: pallet_timestamp::pallet::Call<T>
**/
PalletTimestampCall: {
_enum: {
@@ -1609,13 +1609,13 @@
}
},
/**
- * Lookup187: pallet_transaction_payment::Releases
+ * Lookup188: pallet_transaction_payment::Releases
**/
PalletTransactionPaymentReleases: {
_enum: ['V1Ancient', 'V2']
},
/**
- * Lookup188: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
+ * Lookup189: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
**/
PalletTreasuryProposal: {
proposer: 'AccountId32',
@@ -1624,7 +1624,7 @@
bond: 'u128'
},
/**
- * Lookup191: pallet_treasury::pallet::Call<T, I>
+ * Lookup192: pallet_treasury::pallet::Call<T, I>
**/
PalletTreasuryCall: {
_enum: {
@@ -1648,17 +1648,17 @@
}
},
/**
- * Lookup194: frame_support::PalletId
+ * Lookup195: frame_support::PalletId
**/
FrameSupportPalletId: '[u8;8]',
/**
- * Lookup195: pallet_treasury::pallet::Error<T, I>
+ * Lookup196: pallet_treasury::pallet::Error<T, I>
**/
PalletTreasuryError: {
_enum: ['InsufficientProposersBalance', 'InvalidIndex', 'TooManyApprovals', 'InsufficientPermission', 'ProposalNotApproved']
},
/**
- * Lookup196: pallet_sudo::pallet::Call<T>
+ * Lookup197: pallet_sudo::pallet::Call<T>
**/
PalletSudoCall: {
_enum: {
@@ -1667,7 +1667,7 @@
},
sudo_unchecked_weight: {
call: 'Call',
- weight: 'u64',
+ weight: 'Weight',
},
set_key: {
_alias: {
@@ -1682,7 +1682,7 @@
}
},
/**
- * Lookup198: orml_vesting::module::Call<T>
+ * Lookup199: orml_vesting::module::Call<T>
**/
OrmlVestingModuleCall: {
_enum: {
@@ -1701,7 +1701,7 @@
}
},
/**
- * Lookup200: orml_xtokens::module::Call<T>
+ * Lookup201: orml_xtokens::module::Call<T>
**/
OrmlXtokensModuleCall: {
_enum: {
@@ -1744,7 +1744,7 @@
}
},
/**
- * Lookup201: xcm::VersionedMultiAsset
+ * Lookup202: xcm::VersionedMultiAsset
**/
XcmVersionedMultiAsset: {
_enum: {
@@ -1753,7 +1753,7 @@
}
},
/**
- * Lookup204: orml_tokens::module::Call<T>
+ * Lookup205: orml_tokens::module::Call<T>
**/
OrmlTokensModuleCall: {
_enum: {
@@ -1787,13 +1787,13 @@
}
},
/**
- * Lookup205: cumulus_pallet_xcmp_queue::pallet::Call<T>
+ * Lookup206: cumulus_pallet_xcmp_queue::pallet::Call<T>
**/
CumulusPalletXcmpQueueCall: {
_enum: {
service_overweight: {
index: 'u64',
- weightLimit: 'u64',
+ weightLimit: 'Weight',
},
suspend_xcm_execution: 'Null',
resume_xcm_execution: 'Null',
@@ -1819,24 +1819,24 @@
_alias: {
new_: 'new',
},
- new_: 'u64',
+ new_: 'Weight',
},
update_weight_restrict_decay: {
_alias: {
new_: 'new',
},
- new_: 'u64',
+ new_: 'Weight',
},
update_xcmp_max_individual_weight: {
_alias: {
new_: 'new',
},
- new_: 'u64'
+ new_: 'Weight'
}
}
},
/**
- * Lookup206: pallet_xcm::pallet::Call<T>
+ * Lookup207: pallet_xcm::pallet::Call<T>
**/
PalletXcmCall: {
_enum: {
@@ -1858,7 +1858,7 @@
},
execute: {
message: 'XcmVersionedXcm',
- maxWeight: 'u64',
+ maxWeight: 'Weight',
},
force_xcm_version: {
location: 'XcmV1MultiLocation',
@@ -1890,7 +1890,7 @@
}
},
/**
- * Lookup207: xcm::VersionedXcm<Call>
+ * Lookup208: xcm::VersionedXcm<Call>
**/
XcmVersionedXcm: {
_enum: {
@@ -1900,7 +1900,7 @@
}
},
/**
- * Lookup208: xcm::v0::Xcm<Call>
+ * Lookup209: xcm::v0::Xcm<Call>
**/
XcmV0Xcm: {
_enum: {
@@ -1954,7 +1954,7 @@
}
},
/**
- * Lookup210: xcm::v0::order::Order<Call>
+ * Lookup211: xcm::v0::order::Order<Call>
**/
XcmV0Order: {
_enum: {
@@ -1997,7 +1997,7 @@
}
},
/**
- * Lookup212: xcm::v0::Response
+ * Lookup213: xcm::v0::Response
**/
XcmV0Response: {
_enum: {
@@ -2005,7 +2005,7 @@
}
},
/**
- * Lookup213: xcm::v1::Xcm<Call>
+ * Lookup214: xcm::v1::Xcm<Call>
**/
XcmV1Xcm: {
_enum: {
@@ -2064,7 +2064,7 @@
}
},
/**
- * Lookup215: xcm::v1::order::Order<Call>
+ * Lookup216: xcm::v1::order::Order<Call>
**/
XcmV1Order: {
_enum: {
@@ -2109,7 +2109,7 @@
}
},
/**
- * Lookup217: xcm::v1::Response
+ * Lookup218: xcm::v1::Response
**/
XcmV1Response: {
_enum: {
@@ -2118,22 +2118,22 @@
}
},
/**
- * Lookup231: cumulus_pallet_xcm::pallet::Call<T>
+ * Lookup232: cumulus_pallet_xcm::pallet::Call<T>
**/
CumulusPalletXcmCall: 'Null',
/**
- * Lookup232: cumulus_pallet_dmp_queue::pallet::Call<T>
+ * Lookup233: cumulus_pallet_dmp_queue::pallet::Call<T>
**/
CumulusPalletDmpQueueCall: {
_enum: {
service_overweight: {
index: 'u64',
- weightLimit: 'u64'
+ weightLimit: 'Weight'
}
}
},
/**
- * Lookup233: pallet_inflation::pallet::Call<T>
+ * Lookup234: pallet_inflation::pallet::Call<T>
**/
PalletInflationCall: {
_enum: {
@@ -2143,7 +2143,7 @@
}
},
/**
- * Lookup234: pallet_unique::Call<T>
+ * Lookup235: pallet_unique::Call<T>
**/
PalletUniqueCall: {
_enum: {
@@ -2275,7 +2275,7 @@
}
},
/**
- * Lookup239: up_data_structs::CollectionMode
+ * Lookup240: up_data_structs::CollectionMode
**/
UpDataStructsCollectionMode: {
_enum: {
@@ -2285,7 +2285,7 @@
}
},
/**
- * Lookup240: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
+ * Lookup241: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
**/
UpDataStructsCreateCollectionData: {
mode: 'UpDataStructsCollectionMode',
@@ -2300,13 +2300,13 @@
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup242: up_data_structs::AccessMode
+ * Lookup243: up_data_structs::AccessMode
**/
UpDataStructsAccessMode: {
_enum: ['Normal', 'AllowList']
},
/**
- * Lookup244: up_data_structs::CollectionLimits
+ * Lookup245: up_data_structs::CollectionLimits
**/
UpDataStructsCollectionLimits: {
accountTokenOwnershipLimit: 'Option<u32>',
@@ -2320,7 +2320,7 @@
transfersEnabled: 'Option<bool>'
},
/**
- * Lookup246: up_data_structs::SponsoringRateLimit
+ * Lookup247: up_data_structs::SponsoringRateLimit
**/
UpDataStructsSponsoringRateLimit: {
_enum: {
@@ -2329,7 +2329,7 @@
}
},
/**
- * Lookup249: up_data_structs::CollectionPermissions
+ * Lookup250: up_data_structs::CollectionPermissions
**/
UpDataStructsCollectionPermissions: {
access: 'Option<UpDataStructsAccessMode>',
@@ -2337,7 +2337,7 @@
nesting: 'Option<UpDataStructsNestingPermissions>'
},
/**
- * Lookup251: up_data_structs::NestingPermissions
+ * Lookup252: up_data_structs::NestingPermissions
**/
UpDataStructsNestingPermissions: {
tokenOwner: 'bool',
@@ -2345,18 +2345,18 @@
restricted: 'Option<UpDataStructsOwnerRestrictedSet>'
},
/**
- * Lookup253: up_data_structs::OwnerRestrictedSet
+ * Lookup254: up_data_structs::OwnerRestrictedSet
**/
UpDataStructsOwnerRestrictedSet: 'BTreeSet<u32>',
/**
- * Lookup258: up_data_structs::PropertyKeyPermission
+ * Lookup259: up_data_structs::PropertyKeyPermission
**/
UpDataStructsPropertyKeyPermission: {
key: 'Bytes',
permission: 'UpDataStructsPropertyPermission'
},
/**
- * Lookup259: up_data_structs::PropertyPermission
+ * Lookup260: up_data_structs::PropertyPermission
**/
UpDataStructsPropertyPermission: {
mutable: 'bool',
@@ -2364,14 +2364,14 @@
tokenOwner: 'bool'
},
/**
- * Lookup262: up_data_structs::Property
+ * Lookup263: up_data_structs::Property
**/
UpDataStructsProperty: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup265: up_data_structs::CreateItemData
+ * Lookup266: up_data_structs::CreateItemData
**/
UpDataStructsCreateItemData: {
_enum: {
@@ -2381,26 +2381,26 @@
}
},
/**
- * Lookup266: up_data_structs::CreateNftData
+ * Lookup267: up_data_structs::CreateNftData
**/
UpDataStructsCreateNftData: {
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup267: up_data_structs::CreateFungibleData
+ * Lookup268: up_data_structs::CreateFungibleData
**/
UpDataStructsCreateFungibleData: {
value: 'u128'
},
/**
- * Lookup268: up_data_structs::CreateReFungibleData
+ * Lookup269: up_data_structs::CreateReFungibleData
**/
UpDataStructsCreateReFungibleData: {
pieces: 'u128',
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup271: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup272: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateItemExData: {
_enum: {
@@ -2411,14 +2411,14 @@
}
},
/**
- * Lookup273: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup274: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateNftExData: {
properties: 'Vec<UpDataStructsProperty>',
owner: 'PalletEvmAccountBasicCrossAccountIdRepr'
},
/**
- * Lookup280: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup281: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateRefungibleExSingleOwner: {
user: 'PalletEvmAccountBasicCrossAccountIdRepr',
@@ -2426,14 +2426,14 @@
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup282: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup283: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateRefungibleExMultipleOwners: {
users: 'BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>',
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup283: pallet_unique_scheduler::pallet::Call<T>
+ * Lookup284: pallet_unique_scheduler::pallet::Call<T>
**/
PalletUniqueSchedulerCall: {
_enum: {
@@ -2457,7 +2457,7 @@
}
},
/**
- * Lookup285: frame_support::traits::schedule::MaybeHashed<opal_runtime::Call, primitive_types::H256>
+ * Lookup286: frame_support::traits::schedule::MaybeHashed<opal_runtime::Call, primitive_types::H256>
**/
FrameSupportScheduleMaybeHashed: {
_enum: {
@@ -2466,7 +2466,7 @@
}
},
/**
- * Lookup286: pallet_configuration::pallet::Call<T>
+ * Lookup287: pallet_configuration::pallet::Call<T>
**/
PalletConfigurationCall: {
_enum: {
@@ -2479,15 +2479,15 @@
}
},
/**
- * Lookup287: pallet_template_transaction_payment::Call<T>
+ * Lookup289: pallet_template_transaction_payment::Call<T>
**/
PalletTemplateTransactionPaymentCall: 'Null',
/**
- * Lookup288: pallet_structure::pallet::Call<T>
+ * Lookup290: pallet_structure::pallet::Call<T>
**/
PalletStructureCall: 'Null',
/**
- * Lookup289: pallet_rmrk_core::pallet::Call<T>
+ * Lookup291: pallet_rmrk_core::pallet::Call<T>
**/
PalletRmrkCoreCall: {
_enum: {
@@ -2578,7 +2578,7 @@
}
},
/**
- * Lookup295: rmrk_traits::resource::ResourceTypes<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup297: rmrk_traits::resource::ResourceTypes<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceResourceTypes: {
_enum: {
@@ -2588,7 +2588,7 @@
}
},
/**
- * Lookup297: rmrk_traits::resource::BasicResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup299: rmrk_traits::resource::BasicResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceBasicResource: {
src: 'Option<Bytes>',
@@ -2597,7 +2597,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup299: rmrk_traits::resource::ComposableResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup301: rmrk_traits::resource::ComposableResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceComposableResource: {
parts: 'Vec<u32>',
@@ -2608,7 +2608,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup300: rmrk_traits::resource::SlotResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup302: rmrk_traits::resource::SlotResource<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceSlotResource: {
base: 'u32',
@@ -2619,7 +2619,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup303: pallet_rmrk_equip::pallet::Call<T>
+ * Lookup305: pallet_rmrk_equip::pallet::Call<T>
**/
PalletRmrkEquipCall: {
_enum: {
@@ -2640,7 +2640,7 @@
}
},
/**
- * Lookup306: rmrk_traits::part::PartType<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup308: rmrk_traits::part::PartType<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartPartType: {
_enum: {
@@ -2649,7 +2649,7 @@
}
},
/**
- * Lookup308: rmrk_traits::part::FixedPart<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup310: rmrk_traits::part::FixedPart<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartFixedPart: {
id: 'u32',
@@ -2657,7 +2657,7 @@
src: 'Bytes'
},
/**
- * Lookup309: rmrk_traits::part::SlotPart<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup311: rmrk_traits::part::SlotPart<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartSlotPart: {
id: 'u32',
@@ -2666,7 +2666,7 @@
z: 'u32'
},
/**
- * Lookup310: rmrk_traits::part::EquippableList<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup312: rmrk_traits::part::EquippableList<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartEquippableList: {
_enum: {
@@ -2676,7 +2676,7 @@
}
},
/**
- * Lookup312: rmrk_traits::theme::Theme<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>, S>>
+ * Lookup314: rmrk_traits::theme::Theme<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>, S>>
**/
RmrkTraitsTheme: {
name: 'Bytes',
@@ -2684,14 +2684,14 @@
inherit: 'bool'
},
/**
- * Lookup314: rmrk_traits::theme::ThemeProperty<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup316: rmrk_traits::theme::ThemeProperty<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsThemeThemeProperty: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup316: pallet_app_promotion::pallet::Call<T>
+ * Lookup318: pallet_app_promotion::pallet::Call<T>
**/
PalletAppPromotionCall: {
_enum: {
@@ -2720,7 +2720,7 @@
}
},
/**
- * Lookup318: pallet_foreign_assets::module::Call<T>
+ * Lookup320: pallet_foreign_assets::module::Call<T>
**/
PalletForeignAssetsModuleCall: {
_enum: {
@@ -2737,7 +2737,7 @@
}
},
/**
- * Lookup319: pallet_evm::pallet::Call<T>
+ * Lookup321: pallet_evm::pallet::Call<T>
**/
PalletEvmCall: {
_enum: {
@@ -2780,7 +2780,7 @@
}
},
/**
- * Lookup323: pallet_ethereum::pallet::Call<T>
+ * Lookup325: pallet_ethereum::pallet::Call<T>
**/
PalletEthereumCall: {
_enum: {
@@ -2790,7 +2790,7 @@
}
},
/**
- * Lookup324: ethereum::transaction::TransactionV2
+ * Lookup326: ethereum::transaction::TransactionV2
**/
EthereumTransactionTransactionV2: {
_enum: {
@@ -2800,7 +2800,7 @@
}
},
/**
- * Lookup325: ethereum::transaction::LegacyTransaction
+ * Lookup327: ethereum::transaction::LegacyTransaction
**/
EthereumTransactionLegacyTransaction: {
nonce: 'U256',
@@ -2812,7 +2812,7 @@
signature: 'EthereumTransactionTransactionSignature'
},
/**
- * Lookup326: ethereum::transaction::TransactionAction
+ * Lookup328: ethereum::transaction::TransactionAction
**/
EthereumTransactionTransactionAction: {
_enum: {
@@ -2821,7 +2821,7 @@
}
},
/**
- * Lookup327: ethereum::transaction::TransactionSignature
+ * Lookup329: ethereum::transaction::TransactionSignature
**/
EthereumTransactionTransactionSignature: {
v: 'u64',
@@ -2829,7 +2829,7 @@
s: 'H256'
},
/**
- * Lookup329: ethereum::transaction::EIP2930Transaction
+ * Lookup331: ethereum::transaction::EIP2930Transaction
**/
EthereumTransactionEip2930Transaction: {
chainId: 'u64',
@@ -2845,14 +2845,14 @@
s: 'H256'
},
/**
- * Lookup331: ethereum::transaction::AccessListItem
+ * Lookup333: ethereum::transaction::AccessListItem
**/
EthereumTransactionAccessListItem: {
address: 'H160',
storageKeys: 'Vec<H256>'
},
/**
- * Lookup332: ethereum::transaction::EIP1559Transaction
+ * Lookup334: ethereum::transaction::EIP1559Transaction
**/
EthereumTransactionEip1559Transaction: {
chainId: 'u64',
@@ -2869,7 +2869,7 @@
s: 'H256'
},
/**
- * Lookup333: pallet_evm_migration::pallet::Call<T>
+ * Lookup335: pallet_evm_migration::pallet::Call<T>
**/
PalletEvmMigrationCall: {
_enum: {
@@ -2887,32 +2887,32 @@
}
},
/**
- * Lookup336: pallet_sudo::pallet::Error<T>
+ * Lookup338: pallet_sudo::pallet::Error<T>
**/
PalletSudoError: {
_enum: ['RequireSudo']
},
/**
- * Lookup338: orml_vesting::module::Error<T>
+ * Lookup340: orml_vesting::module::Error<T>
**/
OrmlVestingModuleError: {
_enum: ['ZeroVestingPeriod', 'ZeroVestingPeriodCount', 'InsufficientBalanceToLock', 'TooManyVestingSchedules', 'AmountLow', 'MaxVestingSchedulesExceeded']
},
/**
- * Lookup339: orml_xtokens::module::Error<T>
+ * Lookup341: orml_xtokens::module::Error<T>
**/
OrmlXtokensModuleError: {
_enum: ['AssetHasNoReserve', 'NotCrossChainTransfer', 'InvalidDest', 'NotCrossChainTransferableCurrency', 'UnweighableMessage', 'XcmExecutionFailed', 'CannotReanchor', 'InvalidAncestry', 'InvalidAsset', 'DestinationNotInvertible', 'BadVersion', 'DistinctReserveForAssetAndFee', 'ZeroFee', 'ZeroAmount', 'TooManyAssetsBeingSent', 'AssetIndexNonExistent', 'FeeNotEnough', 'NotSupportedMultiLocation', 'MinXcmFeeNotDefined']
},
/**
- * Lookup342: orml_tokens::BalanceLock<Balance>
+ * Lookup344: orml_tokens::BalanceLock<Balance>
**/
OrmlTokensBalanceLock: {
id: '[u8;8]',
amount: 'u128'
},
/**
- * Lookup344: orml_tokens::AccountData<Balance>
+ * Lookup346: orml_tokens::AccountData<Balance>
**/
OrmlTokensAccountData: {
free: 'u128',
@@ -2920,20 +2920,20 @@
frozen: 'u128'
},
/**
- * Lookup346: orml_tokens::ReserveData<ReserveIdentifier, Balance>
+ * Lookup348: orml_tokens::ReserveData<ReserveIdentifier, Balance>
**/
OrmlTokensReserveData: {
id: 'Null',
amount: 'u128'
},
/**
- * Lookup348: orml_tokens::module::Error<T>
+ * Lookup350: orml_tokens::module::Error<T>
**/
OrmlTokensModuleError: {
_enum: ['BalanceTooLow', 'AmountIntoBalanceFailed', 'LiquidityRestrictions', 'MaxLocksExceeded', 'KeepAlive', 'ExistentialDeposit', 'DeadAccount', 'TooManyReserves']
},
/**
- * Lookup350: cumulus_pallet_xcmp_queue::InboundChannelDetails
+ * Lookup352: cumulus_pallet_xcmp_queue::InboundChannelDetails
**/
CumulusPalletXcmpQueueInboundChannelDetails: {
sender: 'u32',
@@ -2941,19 +2941,19 @@
messageMetadata: 'Vec<(u32,PolkadotParachainPrimitivesXcmpMessageFormat)>'
},
/**
- * Lookup351: cumulus_pallet_xcmp_queue::InboundState
+ * Lookup353: cumulus_pallet_xcmp_queue::InboundState
**/
CumulusPalletXcmpQueueInboundState: {
_enum: ['Ok', 'Suspended']
},
/**
- * Lookup354: polkadot_parachain::primitives::XcmpMessageFormat
+ * Lookup356: polkadot_parachain::primitives::XcmpMessageFormat
**/
PolkadotParachainPrimitivesXcmpMessageFormat: {
_enum: ['ConcatenatedVersionedXcm', 'ConcatenatedEncodedBlob', 'Signals']
},
/**
- * Lookup357: cumulus_pallet_xcmp_queue::OutboundChannelDetails
+ * Lookup359: cumulus_pallet_xcmp_queue::OutboundChannelDetails
**/
CumulusPalletXcmpQueueOutboundChannelDetails: {
recipient: 'u32',
@@ -2963,46 +2963,46 @@
lastIndex: 'u16'
},
/**
- * Lookup358: cumulus_pallet_xcmp_queue::OutboundState
+ * Lookup360: cumulus_pallet_xcmp_queue::OutboundState
**/
CumulusPalletXcmpQueueOutboundState: {
_enum: ['Ok', 'Suspended']
},
/**
- * Lookup360: cumulus_pallet_xcmp_queue::QueueConfigData
+ * Lookup362: cumulus_pallet_xcmp_queue::QueueConfigData
**/
CumulusPalletXcmpQueueQueueConfigData: {
suspendThreshold: 'u32',
dropThreshold: 'u32',
resumeThreshold: 'u32',
- thresholdWeight: 'u64',
- weightRestrictDecay: 'u64',
- xcmpMaxIndividualWeight: 'u64'
+ thresholdWeight: 'Weight',
+ weightRestrictDecay: 'Weight',
+ xcmpMaxIndividualWeight: 'Weight'
},
/**
- * Lookup362: cumulus_pallet_xcmp_queue::pallet::Error<T>
+ * Lookup364: cumulus_pallet_xcmp_queue::pallet::Error<T>
**/
CumulusPalletXcmpQueueError: {
_enum: ['FailedToSend', 'BadXcmOrigin', 'BadXcm', 'BadOverweightIndex', 'WeightOverLimit']
},
/**
- * Lookup363: pallet_xcm::pallet::Error<T>
+ * Lookup365: pallet_xcm::pallet::Error<T>
**/
PalletXcmError: {
_enum: ['Unreachable', 'SendFailure', 'Filtered', 'UnweighableMessage', 'DestinationNotInvertible', 'Empty', 'CannotReanchor', 'TooManyAssets', 'InvalidOrigin', 'BadVersion', 'BadLocation', 'NoSubscription', 'AlreadySubscribed']
},
/**
- * Lookup364: cumulus_pallet_xcm::pallet::Error<T>
+ * Lookup366: cumulus_pallet_xcm::pallet::Error<T>
**/
CumulusPalletXcmError: 'Null',
/**
- * Lookup365: cumulus_pallet_dmp_queue::ConfigData
+ * Lookup367: cumulus_pallet_dmp_queue::ConfigData
**/
CumulusPalletDmpQueueConfigData: {
- maxIndividual: 'u64'
+ maxIndividual: 'Weight'
},
/**
- * Lookup366: cumulus_pallet_dmp_queue::PageIndexData
+ * Lookup368: cumulus_pallet_dmp_queue::PageIndexData
**/
CumulusPalletDmpQueuePageIndexData: {
beginUsed: 'u32',
@@ -3010,19 +3010,19 @@
overweightCount: 'u64'
},
/**
- * Lookup369: cumulus_pallet_dmp_queue::pallet::Error<T>
+ * Lookup371: cumulus_pallet_dmp_queue::pallet::Error<T>
**/
CumulusPalletDmpQueueError: {
_enum: ['Unknown', 'OverLimit']
},
/**
- * Lookup373: pallet_unique::Error<T>
+ * Lookup375: pallet_unique::Error<T>
**/
PalletUniqueError: {
_enum: ['CollectionDecimalPointLimitExceeded', 'ConfirmUnsetSponsorFail', 'EmptyArgument', 'RepartitionCalledOnNonRefungibleCollection']
},
/**
- * Lookup376: pallet_unique_scheduler::ScheduledV3<frame_support::traits::schedule::MaybeHashed<opal_runtime::Call, primitive_types::H256>, BlockNumber, opal_runtime::OriginCaller, sp_core::crypto::AccountId32>
+ * Lookup378: pallet_unique_scheduler::ScheduledV3<frame_support::traits::schedule::MaybeHashed<opal_runtime::Call, primitive_types::H256>, BlockNumber, opal_runtime::OriginCaller, sp_core::crypto::AccountId32>
**/
PalletUniqueSchedulerScheduledV3: {
maybeId: 'Option<[u8;16]>',
@@ -3032,7 +3032,7 @@
origin: 'OpalRuntimeOriginCaller'
},
/**
- * Lookup377: opal_runtime::OriginCaller
+ * Lookup379: opal_runtime::OriginCaller
**/
OpalRuntimeOriginCaller: {
_enum: {
@@ -3141,7 +3141,7 @@
}
},
/**
- * Lookup378: frame_support::dispatch::RawOrigin<sp_core::crypto::AccountId32>
+ * Lookup380: frame_support::dispatch::RawOrigin<sp_core::crypto::AccountId32>
**/
FrameSupportDispatchRawOrigin: {
_enum: {
@@ -3151,7 +3151,7 @@
}
},
/**
- * Lookup379: pallet_xcm::pallet::Origin
+ * Lookup381: pallet_xcm::pallet::Origin
**/
PalletXcmOrigin: {
_enum: {
@@ -3160,7 +3160,7 @@
}
},
/**
- * Lookup380: cumulus_pallet_xcm::pallet::Origin
+ * Lookup382: cumulus_pallet_xcm::pallet::Origin
**/
CumulusPalletXcmOrigin: {
_enum: {
@@ -3169,7 +3169,7 @@
}
},
/**
- * Lookup381: pallet_ethereum::RawOrigin
+ * Lookup383: pallet_ethereum::RawOrigin
**/
PalletEthereumRawOrigin: {
_enum: {
@@ -3177,17 +3177,17 @@
}
},
/**
- * Lookup382: sp_core::Void
+ * Lookup384: sp_core::Void
**/
SpCoreVoid: 'Null',
/**
- * Lookup383: pallet_unique_scheduler::pallet::Error<T>
+ * Lookup385: pallet_unique_scheduler::pallet::Error<T>
**/
PalletUniqueSchedulerError: {
_enum: ['FailedToSchedule', 'NotFound', 'TargetBlockNumberInPast', 'RescheduleNoChange']
},
/**
- * Lookup384: up_data_structs::Collection<sp_core::crypto::AccountId32>
+ * Lookup386: up_data_structs::Collection<sp_core::crypto::AccountId32>
**/
UpDataStructsCollection: {
owner: 'AccountId32',
@@ -3201,7 +3201,7 @@
flags: '[u8;1]'
},
/**
- * Lookup385: up_data_structs::SponsorshipState<sp_core::crypto::AccountId32>
+ * Lookup387: up_data_structs::SponsorshipState<sp_core::crypto::AccountId32>
**/
UpDataStructsSponsorshipStateAccountId32: {
_enum: {
@@ -3211,7 +3211,7 @@
}
},
/**
- * Lookup387: up_data_structs::Properties
+ * Lookup389: up_data_structs::Properties
**/
UpDataStructsProperties: {
map: 'UpDataStructsPropertiesMapBoundedVec',
@@ -3219,15 +3219,15 @@
spaceLimit: 'u32'
},
/**
- * Lookup388: up_data_structs::PropertiesMap<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup390: up_data_structs::PropertiesMap<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsPropertiesMapBoundedVec: 'BTreeMap<Bytes, Bytes>',
/**
- * Lookup393: up_data_structs::PropertiesMap<up_data_structs::PropertyPermission>
+ * Lookup395: up_data_structs::PropertiesMap<up_data_structs::PropertyPermission>
**/
UpDataStructsPropertiesMapPropertyPermission: 'BTreeMap<Bytes, UpDataStructsPropertyPermission>',
/**
- * Lookup400: up_data_structs::CollectionStats
+ * Lookup402: up_data_structs::CollectionStats
**/
UpDataStructsCollectionStats: {
created: 'u32',
@@ -3235,18 +3235,18 @@
alive: 'u32'
},
/**
- * Lookup401: up_data_structs::TokenChild
+ * Lookup403: up_data_structs::TokenChild
**/
UpDataStructsTokenChild: {
token: 'u32',
collection: 'u32'
},
/**
- * Lookup402: PhantomType::up_data_structs<T>
+ * Lookup404: PhantomType::up_data_structs<T>
**/
PhantomTypeUpDataStructs: '[(UpDataStructsTokenData,UpDataStructsRpcCollection,RmrkTraitsCollectionCollectionInfo,RmrkTraitsNftNftInfo,RmrkTraitsResourceResourceInfo,RmrkTraitsPropertyPropertyInfo,RmrkTraitsBaseBaseInfo,RmrkTraitsPartPartType,RmrkTraitsTheme,RmrkTraitsNftNftChild);0]',
/**
- * Lookup404: up_data_structs::TokenData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup406: up_data_structs::TokenData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsTokenData: {
properties: 'Vec<UpDataStructsProperty>',
@@ -3254,7 +3254,7 @@
pieces: 'u128'
},
/**
- * Lookup406: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>
+ * Lookup408: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>
**/
UpDataStructsRpcCollection: {
owner: 'AccountId32',
@@ -3271,7 +3271,7 @@
foreign: 'bool'
},
/**
- * Lookup407: rmrk_traits::collection::CollectionInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_core::crypto::AccountId32>
+ * Lookup409: rmrk_traits::collection::CollectionInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_core::crypto::AccountId32>
**/
RmrkTraitsCollectionCollectionInfo: {
issuer: 'AccountId32',
@@ -3281,7 +3281,7 @@
nftsCount: 'u32'
},
/**
- * Lookup408: rmrk_traits::nft::NftInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup410: rmrk_traits::nft::NftInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsNftNftInfo: {
owner: 'RmrkTraitsNftAccountIdOrCollectionNftTuple',
@@ -3291,14 +3291,14 @@
pending: 'bool'
},
/**
- * Lookup410: rmrk_traits::nft::RoyaltyInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill>
+ * Lookup412: rmrk_traits::nft::RoyaltyInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill>
**/
RmrkTraitsNftRoyaltyInfo: {
recipient: 'AccountId32',
amount: 'Permill'
},
/**
- * Lookup411: rmrk_traits::resource::ResourceInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup413: rmrk_traits::resource::ResourceInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceResourceInfo: {
id: 'u32',
@@ -3307,14 +3307,14 @@
pendingRemoval: 'bool'
},
/**
- * Lookup412: rmrk_traits::property::PropertyInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup414: rmrk_traits::property::PropertyInfo<sp_runtime::bounded::bounded_vec::BoundedVec<T, S>, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPropertyPropertyInfo: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup413: rmrk_traits::base::BaseInfo<sp_core::crypto::AccountId32, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup415: rmrk_traits::base::BaseInfo<sp_core::crypto::AccountId32, sp_runtime::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsBaseBaseInfo: {
issuer: 'AccountId32',
@@ -3322,92 +3322,92 @@
symbol: 'Bytes'
},
/**
- * Lookup414: rmrk_traits::nft::NftChild
+ * Lookup416: rmrk_traits::nft::NftChild
**/
RmrkTraitsNftNftChild: {
collectionId: 'u32',
nftId: 'u32'
},
/**
- * Lookup416: pallet_common::pallet::Error<T>
+ * Lookup418: pallet_common::pallet::Error<T>
**/
PalletCommonError: {
_enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'UserIsNotAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey', 'CollectionIsExternal', 'CollectionIsInternal']
},
/**
- * Lookup418: pallet_fungible::pallet::Error<T>
+ * Lookup420: pallet_fungible::pallet::Error<T>
**/
PalletFungibleError: {
_enum: ['NotFungibleDataUsedToMintFungibleCollectionToken', 'FungibleItemsHaveNoId', 'FungibleItemsDontHaveData', 'FungibleDisallowsNesting', 'SettingPropertiesNotAllowed']
},
/**
- * Lookup419: pallet_refungible::ItemData
+ * Lookup421: pallet_refungible::ItemData
**/
PalletRefungibleItemData: {
constData: 'Bytes'
},
/**
- * Lookup424: pallet_refungible::pallet::Error<T>
+ * Lookup426: pallet_refungible::pallet::Error<T>
**/
PalletRefungibleError: {
_enum: ['NotRefungibleDataUsedToMintFungibleCollectionToken', 'WrongRefungiblePieces', 'RepartitionWhileNotOwningAllPieces', 'RefungibleDisallowsNesting', 'SettingPropertiesNotAllowed']
},
/**
- * Lookup425: pallet_nonfungible::ItemData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup427: pallet_nonfungible::ItemData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
PalletNonfungibleItemData: {
owner: 'PalletEvmAccountBasicCrossAccountIdRepr'
},
/**
- * Lookup427: up_data_structs::PropertyScope
+ * Lookup429: up_data_structs::PropertyScope
**/
UpDataStructsPropertyScope: {
_enum: ['None', 'Rmrk']
},
/**
- * Lookup429: pallet_nonfungible::pallet::Error<T>
+ * Lookup431: pallet_nonfungible::pallet::Error<T>
**/
PalletNonfungibleError: {
_enum: ['NotNonfungibleDataUsedToMintFungibleCollectionToken', 'NonfungibleItemsHaveNoAmount', 'CantBurnNftWithChildren']
},
/**
- * Lookup430: pallet_structure::pallet::Error<T>
+ * Lookup432: pallet_structure::pallet::Error<T>
**/
PalletStructureError: {
_enum: ['OuroborosDetected', 'DepthLimit', 'BreadthLimit', 'TokenNotFound']
},
/**
- * Lookup431: pallet_rmrk_core::pallet::Error<T>
+ * Lookup433: pallet_rmrk_core::pallet::Error<T>
**/
PalletRmrkCoreError: {
_enum: ['CorruptedCollectionType', 'RmrkPropertyKeyIsTooLong', 'RmrkPropertyValueIsTooLong', 'RmrkPropertyIsNotFound', 'UnableToDecodeRmrkData', 'CollectionNotEmpty', 'NoAvailableCollectionId', 'NoAvailableNftId', 'CollectionUnknown', 'NoPermission', 'NonTransferable', 'CollectionFullOrLocked', 'ResourceDoesntExist', 'CannotSendToDescendentOrSelf', 'CannotAcceptNonOwnedNft', 'CannotRejectNonOwnedNft', 'CannotRejectNonPendingNft', 'ResourceNotPending', 'NoAvailableResourceId']
},
/**
- * Lookup433: pallet_rmrk_equip::pallet::Error<T>
+ * Lookup435: pallet_rmrk_equip::pallet::Error<T>
**/
PalletRmrkEquipError: {
_enum: ['PermissionError', 'NoAvailableBaseId', 'NoAvailablePartId', 'BaseDoesntExist', 'NeedsDefaultThemeFirst', 'PartDoesntExist', 'NoEquippableOnFixedPart']
},
/**
- * Lookup439: pallet_app_promotion::pallet::Error<T>
+ * Lookup441: pallet_app_promotion::pallet::Error<T>
**/
PalletAppPromotionError: {
_enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFunds', 'PendingForBlockOverflow', 'SponsorNotSet', 'IncorrectLockedBalanceOperation']
},
/**
- * Lookup440: pallet_foreign_assets::module::Error<T>
+ * Lookup442: pallet_foreign_assets::module::Error<T>
**/
PalletForeignAssetsModuleError: {
_enum: ['BadLocation', 'MultiLocationExisted', 'AssetIdNotExists', 'AssetIdExisted']
},
/**
- * Lookup443: pallet_evm::pallet::Error<T>
+ * Lookup445: pallet_evm::pallet::Error<T>
**/
PalletEvmError: {
_enum: ['BalanceLow', 'FeeOverflow', 'PaymentOverflow', 'WithdrawFailed', 'GasPriceTooLow', 'InvalidNonce']
},
/**
- * Lookup446: fp_rpc::TransactionStatus
+ * Lookup448: fp_rpc::TransactionStatus
**/
FpRpcTransactionStatus: {
transactionHash: 'H256',
@@ -3419,11 +3419,11 @@
logsBloom: 'EthbloomBloom'
},
/**
- * Lookup448: ethbloom::Bloom
+ * Lookup450: ethbloom::Bloom
**/
EthbloomBloom: '[u8;256]',
/**
- * Lookup450: ethereum::receipt::ReceiptV3
+ * Lookup452: ethereum::receipt::ReceiptV3
**/
EthereumReceiptReceiptV3: {
_enum: {
@@ -3433,7 +3433,7 @@
}
},
/**
- * Lookup451: ethereum::receipt::EIP658ReceiptData
+ * Lookup453: ethereum::receipt::EIP658ReceiptData
**/
EthereumReceiptEip658ReceiptData: {
statusCode: 'u8',
@@ -3442,7 +3442,7 @@
logs: 'Vec<EthereumLog>'
},
/**
- * Lookup452: ethereum::block::Block<ethereum::transaction::TransactionV2>
+ * Lookup454: ethereum::block::Block<ethereum::transaction::TransactionV2>
**/
EthereumBlock: {
header: 'EthereumHeader',
@@ -3450,7 +3450,7 @@
ommers: 'Vec<EthereumHeader>'
},
/**
- * Lookup453: ethereum::header::Header
+ * Lookup455: ethereum::header::Header
**/
EthereumHeader: {
parentHash: 'H256',
@@ -3470,23 +3470,23 @@
nonce: 'EthereumTypesHashH64'
},
/**
- * Lookup454: ethereum_types::hash::H64
+ * Lookup456: ethereum_types::hash::H64
**/
EthereumTypesHashH64: '[u8;8]',
/**
- * Lookup459: pallet_ethereum::pallet::Error<T>
+ * Lookup461: pallet_ethereum::pallet::Error<T>
**/
PalletEthereumError: {
_enum: ['InvalidSignature', 'PreLogExists']
},
/**
- * Lookup460: pallet_evm_coder_substrate::pallet::Error<T>
+ * Lookup462: pallet_evm_coder_substrate::pallet::Error<T>
**/
PalletEvmCoderSubstrateError: {
_enum: ['OutOfGas', 'OutOfFund']
},
/**
- * Lookup461: up_data_structs::SponsorshipState<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup463: up_data_structs::SponsorshipState<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsSponsorshipStateBasicCrossAccountIdRepr: {
_enum: {
@@ -3496,25 +3496,25 @@
}
},
/**
- * Lookup462: pallet_evm_contract_helpers::SponsoringModeT
+ * Lookup464: pallet_evm_contract_helpers::SponsoringModeT
**/
PalletEvmContractHelpersSponsoringModeT: {
_enum: ['Disabled', 'Allowlisted', 'Generous']
},
/**
- * Lookup468: pallet_evm_contract_helpers::pallet::Error<T>
+ * Lookup470: pallet_evm_contract_helpers::pallet::Error<T>
**/
PalletEvmContractHelpersError: {
_enum: ['NoPermission', 'NoPendingSponsor', 'TooManyMethodsHaveSponsoredLimit']
},
/**
- * Lookup469: pallet_evm_migration::pallet::Error<T>
+ * Lookup471: pallet_evm_migration::pallet::Error<T>
**/
PalletEvmMigrationError: {
_enum: ['AccountNotEmpty', 'AccountIsNotMigrating']
},
/**
- * Lookup471: sp_runtime::MultiSignature
+ * Lookup473: sp_runtime::MultiSignature
**/
SpRuntimeMultiSignature: {
_enum: {
@@ -3524,47 +3524,47 @@
}
},
/**
- * Lookup472: sp_core::ed25519::Signature
+ * Lookup474: sp_core::ed25519::Signature
**/
SpCoreEd25519Signature: '[u8;64]',
/**
- * Lookup474: sp_core::sr25519::Signature
+ * Lookup476: sp_core::sr25519::Signature
**/
SpCoreSr25519Signature: '[u8;64]',
/**
- * Lookup475: sp_core::ecdsa::Signature
+ * Lookup477: sp_core::ecdsa::Signature
**/
SpCoreEcdsaSignature: '[u8;65]',
/**
- * Lookup478: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
+ * Lookup480: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
**/
FrameSystemExtensionsCheckSpecVersion: 'Null',
/**
- * Lookup479: frame_system::extensions::check_tx_version::CheckTxVersion<T>
+ * Lookup481: frame_system::extensions::check_tx_version::CheckTxVersion<T>
**/
FrameSystemExtensionsCheckTxVersion: 'Null',
/**
- * Lookup480: frame_system::extensions::check_genesis::CheckGenesis<T>
+ * Lookup482: frame_system::extensions::check_genesis::CheckGenesis<T>
**/
FrameSystemExtensionsCheckGenesis: 'Null',
/**
- * Lookup483: frame_system::extensions::check_nonce::CheckNonce<T>
+ * Lookup485: frame_system::extensions::check_nonce::CheckNonce<T>
**/
FrameSystemExtensionsCheckNonce: 'Compact<u32>',
/**
- * Lookup484: frame_system::extensions::check_weight::CheckWeight<T>
+ * Lookup486: frame_system::extensions::check_weight::CheckWeight<T>
**/
FrameSystemExtensionsCheckWeight: 'Null',
/**
- * Lookup485: pallet_template_transaction_payment::ChargeTransactionPayment<opal_runtime::Runtime>
+ * Lookup487: pallet_template_transaction_payment::ChargeTransactionPayment<opal_runtime::Runtime>
**/
PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
/**
- * Lookup486: opal_runtime::Runtime
+ * Lookup488: opal_runtime::Runtime
**/
OpalRuntimeRuntime: 'Null',
/**
- * Lookup487: pallet_ethereum::FakeTransactionFinalizer<opal_runtime::Runtime>
+ * Lookup489: pallet_ethereum::FakeTransactionFinalizer<opal_runtime::Runtime>
**/
PalletEthereumFakeTransactionFinalizer: 'Null'
};
tests/src/interfaces/registry.tsdiffbeforeafterboth--- a/tests/src/interfaces/registry.ts
+++ b/tests/src/interfaces/registry.ts
@@ -5,7 +5,7 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/types/types/registry';
-import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmOrigin, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportScheduleLookupError, FrameSupportScheduleMaybeHashed, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeOriginCaller, OpalRuntimeRuntime, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensModuleCall, OrmlTokensModuleError, OrmlTokensModuleEvent, OrmlTokensReserveData, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, OrmlXtokensModuleCall, OrmlXtokensModuleError, OrmlXtokensModuleEvent, PalletAppPromotionCall, PalletAppPromotionError, PalletAppPromotionEvent, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletConfigurationCall, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEthereumRawOrigin, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersEvent, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletForeignAssetsModuleCall, PalletForeignAssetsModuleError, PalletForeignAssetsModuleEvent, PalletForeignAssetsNativeCurrency, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletRmrkCoreCall, PalletRmrkCoreError, PalletRmrkCoreEvent, PalletRmrkEquipCall, PalletRmrkEquipError, PalletRmrkEquipEvent, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletUniqueSchedulerCall, PalletUniqueSchedulerError, PalletUniqueSchedulerEvent, PalletUniqueSchedulerScheduledV3, PalletXcmCall, PalletXcmError, PalletXcmEvent, PalletXcmOrigin, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, RmrkTraitsBaseBaseInfo, RmrkTraitsCollectionCollectionInfo, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsNftNftChild, RmrkTraitsNftNftInfo, RmrkTraitsNftRoyaltyInfo, RmrkTraitsPartEquippableList, RmrkTraitsPartFixedPart, RmrkTraitsPartPartType, RmrkTraitsPartSlotPart, RmrkTraitsPropertyPropertyInfo, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceInfo, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, RmrkTraitsThemeThemeProperty, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpCoreVoid, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExMultipleOwners, UpDataStructsCreateRefungibleExSingleOwner, UpDataStructsNestingPermissions, UpDataStructsOwnerRestrictedSet, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipStateAccountId32, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
+import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmOrigin, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportScheduleLookupError, FrameSupportScheduleMaybeHashed, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassWeight, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeOriginCaller, OpalRuntimeRuntime, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensModuleCall, OrmlTokensModuleError, OrmlTokensModuleEvent, OrmlTokensReserveData, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, OrmlXtokensModuleCall, OrmlXtokensModuleError, OrmlXtokensModuleEvent, PalletAppPromotionCall, PalletAppPromotionError, PalletAppPromotionEvent, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletConfigurationCall, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEthereumRawOrigin, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersEvent, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, PalletForeignAssetsModuleCall, PalletForeignAssetsModuleError, PalletForeignAssetsModuleEvent, PalletForeignAssetsNativeCurrency, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletRmrkCoreCall, PalletRmrkCoreError, PalletRmrkCoreEvent, PalletRmrkEquipCall, PalletRmrkEquipError, PalletRmrkEquipEvent, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletUniqueSchedulerCall, PalletUniqueSchedulerError, PalletUniqueSchedulerEvent, PalletUniqueSchedulerScheduledV3, PalletXcmCall, PalletXcmError, PalletXcmEvent, PalletXcmOrigin, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, RmrkTraitsBaseBaseInfo, RmrkTraitsCollectionCollectionInfo, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsNftNftChild, RmrkTraitsNftNftInfo, RmrkTraitsNftRoyaltyInfo, RmrkTraitsPartEquippableList, RmrkTraitsPartFixedPart, RmrkTraitsPartPartType, RmrkTraitsPartSlotPart, RmrkTraitsPropertyPropertyInfo, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceInfo, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, RmrkTraitsThemeThemeProperty, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpCoreVoid, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExMultipleOwners, UpDataStructsCreateRefungibleExSingleOwner, UpDataStructsNestingPermissions, UpDataStructsOwnerRestrictedSet, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsPropertyScope, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipStateAccountId32, UpDataStructsSponsorshipStateBasicCrossAccountIdRepr, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
declare module '@polkadot/types/types/registry' {
interface InterfaceTypes {
@@ -60,7 +60,7 @@
FrameSupportWeightsDispatchInfo: FrameSupportWeightsDispatchInfo;
FrameSupportWeightsPays: FrameSupportWeightsPays;
FrameSupportWeightsPerDispatchClassU32: FrameSupportWeightsPerDispatchClassU32;
- FrameSupportWeightsPerDispatchClassU64: FrameSupportWeightsPerDispatchClassU64;
+ FrameSupportWeightsPerDispatchClassWeight: FrameSupportWeightsPerDispatchClassWeight;
FrameSupportWeightsPerDispatchClassWeightsPerClass: FrameSupportWeightsPerDispatchClassWeightsPerClass;
FrameSupportWeightsRuntimeDbWeight: FrameSupportWeightsRuntimeDbWeight;
FrameSystemAccountInfo: FrameSystemAccountInfo;
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -7,7 +7,7 @@
import type { BTreeMap, BTreeSet, Bytes, Compact, Enum, Null, Option, Result, Struct, Text, U256, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
-import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime';
+import type { AccountId32, Call, H160, H256, MultiAddress, Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';
import type { Event } from '@polkadot/types/interfaces/system';
declare module '@polkadot/types/lookup' {
@@ -28,19 +28,19 @@
readonly feeFrozen: u128;
}
- /** @name FrameSupportWeightsPerDispatchClassU64 (7) */
- interface FrameSupportWeightsPerDispatchClassU64 extends Struct {
- readonly normal: u64;
- readonly operational: u64;
- readonly mandatory: u64;
+ /** @name FrameSupportWeightsPerDispatchClassWeight (7) */
+ interface FrameSupportWeightsPerDispatchClassWeight extends Struct {
+ readonly normal: Weight;
+ readonly operational: Weight;
+ readonly mandatory: Weight;
}
- /** @name SpRuntimeDigest (11) */
+ /** @name SpRuntimeDigest (12) */
interface SpRuntimeDigest extends Struct {
readonly logs: Vec<SpRuntimeDigestDigestItem>;
}
- /** @name SpRuntimeDigestDigestItem (13) */
+ /** @name SpRuntimeDigestDigestItem (14) */
interface SpRuntimeDigestDigestItem extends Enum {
readonly isOther: boolean;
readonly asOther: Bytes;
@@ -54,14 +54,14 @@
readonly type: 'Other' | 'Consensus' | 'Seal' | 'PreRuntime' | 'RuntimeEnvironmentUpdated';
}
- /** @name FrameSystemEventRecord (16) */
+ /** @name FrameSystemEventRecord (17) */
interface FrameSystemEventRecord extends Struct {
readonly phase: FrameSystemPhase;
readonly event: Event;
readonly topics: Vec<H256>;
}
- /** @name FrameSystemEvent (18) */
+ /** @name FrameSystemEvent (19) */
interface FrameSystemEvent extends Enum {
readonly isExtrinsicSuccess: boolean;
readonly asExtrinsicSuccess: {
@@ -89,14 +89,14 @@
readonly type: 'ExtrinsicSuccess' | 'ExtrinsicFailed' | 'CodeUpdated' | 'NewAccount' | 'KilledAccount' | 'Remarked';
}
- /** @name FrameSupportWeightsDispatchInfo (19) */
+ /** @name FrameSupportWeightsDispatchInfo (20) */
interface FrameSupportWeightsDispatchInfo extends Struct {
- readonly weight: u64;
+ readonly weight: Weight;
readonly class: FrameSupportWeightsDispatchClass;
readonly paysFee: FrameSupportWeightsPays;
}
- /** @name FrameSupportWeightsDispatchClass (20) */
+ /** @name FrameSupportWeightsDispatchClass (21) */
interface FrameSupportWeightsDispatchClass extends Enum {
readonly isNormal: boolean;
readonly isOperational: boolean;
@@ -104,14 +104,14 @@
readonly type: 'Normal' | 'Operational' | 'Mandatory';
}
- /** @name FrameSupportWeightsPays (21) */
+ /** @name FrameSupportWeightsPays (22) */
interface FrameSupportWeightsPays extends Enum {
readonly isYes: boolean;
readonly isNo: boolean;
readonly type: 'Yes' | 'No';
}
- /** @name SpRuntimeDispatchError (22) */
+ /** @name SpRuntimeDispatchError (23) */
interface SpRuntimeDispatchError extends Enum {
readonly isOther: boolean;
readonly isCannotLookup: boolean;
@@ -130,13 +130,13 @@
readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'TooManyConsumers' | 'Token' | 'Arithmetic' | 'Transactional';
}
- /** @name SpRuntimeModuleError (23) */
+ /** @name SpRuntimeModuleError (24) */
interface SpRuntimeModuleError extends Struct {
readonly index: u8;
readonly error: U8aFixed;
}
- /** @name SpRuntimeTokenError (24) */
+ /** @name SpRuntimeTokenError (25) */
interface SpRuntimeTokenError extends Enum {
readonly isNoFunds: boolean;
readonly isWouldDie: boolean;
@@ -148,7 +148,7 @@
readonly type: 'NoFunds' | 'WouldDie' | 'BelowMinimum' | 'CannotCreate' | 'UnknownAsset' | 'Frozen' | 'Unsupported';
}
- /** @name SpRuntimeArithmeticError (25) */
+ /** @name SpRuntimeArithmeticError (26) */
interface SpRuntimeArithmeticError extends Enum {
readonly isUnderflow: boolean;
readonly isOverflow: boolean;
@@ -156,14 +156,14 @@
readonly type: 'Underflow' | 'Overflow' | 'DivisionByZero';
}
- /** @name SpRuntimeTransactionalError (26) */
+ /** @name SpRuntimeTransactionalError (27) */
interface SpRuntimeTransactionalError extends Enum {
readonly isLimitReached: boolean;
readonly isNoLayer: boolean;
readonly type: 'LimitReached' | 'NoLayer';
}
- /** @name CumulusPalletParachainSystemEvent (27) */
+ /** @name CumulusPalletParachainSystemEvent (28) */
interface CumulusPalletParachainSystemEvent extends Enum {
readonly isValidationFunctionStored: boolean;
readonly isValidationFunctionApplied: boolean;
@@ -181,13 +181,13 @@
} & Struct;
readonly isDownwardMessagesProcessed: boolean;
readonly asDownwardMessagesProcessed: {
- readonly weightUsed: u64;
+ readonly weightUsed: Weight;
readonly dmqHead: H256;
} & Struct;
readonly type: 'ValidationFunctionStored' | 'ValidationFunctionApplied' | 'ValidationFunctionDiscarded' | 'UpgradeAuthorized' | 'DownwardMessagesReceived' | 'DownwardMessagesProcessed';
}
- /** @name PalletBalancesEvent (28) */
+ /** @name PalletBalancesEvent (29) */
interface PalletBalancesEvent extends Enum {
readonly isEndowed: boolean;
readonly asEndowed: {
@@ -246,14 +246,14 @@
readonly type: 'Endowed' | 'DustLost' | 'Transfer' | 'BalanceSet' | 'Reserved' | 'Unreserved' | 'ReserveRepatriated' | 'Deposit' | 'Withdraw' | 'Slashed';
}
- /** @name FrameSupportTokensMiscBalanceStatus (29) */
+ /** @name FrameSupportTokensMiscBalanceStatus (30) */
interface FrameSupportTokensMiscBalanceStatus extends Enum {
readonly isFree: boolean;
readonly isReserved: boolean;
readonly type: 'Free' | 'Reserved';
}
- /** @name PalletTransactionPaymentEvent (30) */
+ /** @name PalletTransactionPaymentEvent (31) */
interface PalletTransactionPaymentEvent extends Enum {
readonly isTransactionFeePaid: boolean;
readonly asTransactionFeePaid: {
@@ -264,7 +264,7 @@
readonly type: 'TransactionFeePaid';
}
- /** @name PalletTreasuryEvent (31) */
+ /** @name PalletTreasuryEvent (32) */
interface PalletTreasuryEvent extends Enum {
readonly isProposed: boolean;
readonly asProposed: {
@@ -306,7 +306,7 @@
readonly type: 'Proposed' | 'Spending' | 'Awarded' | 'Rejected' | 'Burnt' | 'Rollover' | 'Deposit' | 'SpendApproved';
}
- /** @name PalletSudoEvent (32) */
+ /** @name PalletSudoEvent (33) */
interface PalletSudoEvent extends Enum {
readonly isSudid: boolean;
readonly asSudid: {
@@ -323,7 +323,7 @@
readonly type: 'Sudid' | 'KeyChanged' | 'SudoAsDone';
}
- /** @name OrmlVestingModuleEvent (36) */
+ /** @name OrmlVestingModuleEvent (37) */
interface OrmlVestingModuleEvent extends Enum {
readonly isVestingScheduleAdded: boolean;
readonly asVestingScheduleAdded: {
@@ -343,7 +343,7 @@
readonly type: 'VestingScheduleAdded' | 'Claimed' | 'VestingSchedulesUpdated';
}
- /** @name OrmlVestingVestingSchedule (37) */
+ /** @name OrmlVestingVestingSchedule (38) */
interface OrmlVestingVestingSchedule extends Struct {
readonly start: u32;
readonly period: u32;
@@ -351,7 +351,7 @@
readonly perPeriod: Compact<u128>;
}
- /** @name OrmlXtokensModuleEvent (39) */
+ /** @name OrmlXtokensModuleEvent (40) */
interface OrmlXtokensModuleEvent extends Enum {
readonly isTransferredMultiAssets: boolean;
readonly asTransferredMultiAssets: {
@@ -363,16 +363,16 @@
readonly type: 'TransferredMultiAssets';
}
- /** @name XcmV1MultiassetMultiAssets (40) */
+ /** @name XcmV1MultiassetMultiAssets (41) */
interface XcmV1MultiassetMultiAssets extends Vec<XcmV1MultiAsset> {}
- /** @name XcmV1MultiAsset (42) */
+ /** @name XcmV1MultiAsset (43) */
interface XcmV1MultiAsset extends Struct {
readonly id: XcmV1MultiassetAssetId;
readonly fun: XcmV1MultiassetFungibility;
}
- /** @name XcmV1MultiassetAssetId (43) */
+ /** @name XcmV1MultiassetAssetId (44) */
interface XcmV1MultiassetAssetId extends Enum {
readonly isConcrete: boolean;
readonly asConcrete: XcmV1MultiLocation;
@@ -381,13 +381,13 @@
readonly type: 'Concrete' | 'Abstract';
}
- /** @name XcmV1MultiLocation (44) */
+ /** @name XcmV1MultiLocation (45) */
interface XcmV1MultiLocation extends Struct {
readonly parents: u8;
readonly interior: XcmV1MultilocationJunctions;
}
- /** @name XcmV1MultilocationJunctions (45) */
+ /** @name XcmV1MultilocationJunctions (46) */
interface XcmV1MultilocationJunctions extends Enum {
readonly isHere: boolean;
readonly isX1: boolean;
@@ -409,7 +409,7 @@
readonly type: 'Here' | 'X1' | 'X2' | 'X3' | 'X4' | 'X5' | 'X6' | 'X7' | 'X8';
}
- /** @name XcmV1Junction (46) */
+ /** @name XcmV1Junction (47) */
interface XcmV1Junction extends Enum {
readonly isParachain: boolean;
readonly asParachain: Compact<u32>;
@@ -443,7 +443,7 @@
readonly type: 'Parachain' | 'AccountId32' | 'AccountIndex64' | 'AccountKey20' | 'PalletInstance' | 'GeneralIndex' | 'GeneralKey' | 'OnlyChild' | 'Plurality';
}
- /** @name XcmV0JunctionNetworkId (48) */
+ /** @name XcmV0JunctionNetworkId (49) */
interface XcmV0JunctionNetworkId extends Enum {
readonly isAny: boolean;
readonly isNamed: boolean;
@@ -453,7 +453,7 @@
readonly type: 'Any' | 'Named' | 'Polkadot' | 'Kusama';
}
- /** @name XcmV0JunctionBodyId (52) */
+ /** @name XcmV0JunctionBodyId (53) */
interface XcmV0JunctionBodyId extends Enum {
readonly isUnit: boolean;
readonly isNamed: boolean;
@@ -467,7 +467,7 @@
readonly type: 'Unit' | 'Named' | 'Index' | 'Executive' | 'Technical' | 'Legislative' | 'Judicial';
}
- /** @name XcmV0JunctionBodyPart (53) */
+ /** @name XcmV0JunctionBodyPart (54) */
interface XcmV0JunctionBodyPart extends Enum {
readonly isVoice: boolean;
readonly isMembers: boolean;
@@ -492,7 +492,7 @@
readonly type: 'Voice' | 'Members' | 'Fraction' | 'AtLeastProportion' | 'MoreThanProportion';
}
- /** @name XcmV1MultiassetFungibility (54) */
+ /** @name XcmV1MultiassetFungibility (55) */
interface XcmV1MultiassetFungibility extends Enum {
readonly isFungible: boolean;
readonly asFungible: Compact<u128>;
@@ -501,7 +501,7 @@
readonly type: 'Fungible' | 'NonFungible';
}
- /** @name XcmV1MultiassetAssetInstance (55) */
+ /** @name XcmV1MultiassetAssetInstance (56) */
interface XcmV1MultiassetAssetInstance extends Enum {
readonly isUndefined: boolean;
readonly isIndex: boolean;
@@ -519,7 +519,7 @@
readonly type: 'Undefined' | 'Index' | 'Array4' | 'Array8' | 'Array16' | 'Array32' | 'Blob';
}
- /** @name OrmlTokensModuleEvent (58) */
+ /** @name OrmlTokensModuleEvent (59) */
interface OrmlTokensModuleEvent extends Enum {
readonly isEndowed: boolean;
readonly asEndowed: {
@@ -607,7 +607,7 @@
readonly type: 'Endowed' | 'DustLost' | 'Transfer' | 'Reserved' | 'Unreserved' | 'ReserveRepatriated' | 'BalanceSet' | 'TotalIssuanceSet' | 'Withdrawn' | 'Slashed' | 'Deposited' | 'LockSet' | 'LockRemoved';
}
- /** @name PalletForeignAssetsAssetIds (59) */
+ /** @name PalletForeignAssetsAssetIds (60) */
interface PalletForeignAssetsAssetIds extends Enum {
readonly isForeignAssetId: boolean;
readonly asForeignAssetId: u32;
@@ -616,25 +616,25 @@
readonly type: 'ForeignAssetId' | 'NativeAssetId';
}
- /** @name PalletForeignAssetsNativeCurrency (60) */
+ /** @name PalletForeignAssetsNativeCurrency (61) */
interface PalletForeignAssetsNativeCurrency extends Enum {
readonly isHere: boolean;
readonly isParent: boolean;
readonly type: 'Here' | 'Parent';
}
- /** @name CumulusPalletXcmpQueueEvent (61) */
+ /** @name CumulusPalletXcmpQueueEvent (62) */
interface CumulusPalletXcmpQueueEvent extends Enum {
readonly isSuccess: boolean;
readonly asSuccess: {
readonly messageHash: Option<H256>;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isFail: boolean;
readonly asFail: {
readonly messageHash: Option<H256>;
readonly error: XcmV2TraitsError;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isBadVersion: boolean;
readonly asBadVersion: {
@@ -657,17 +657,17 @@
readonly sender: u32;
readonly sentAt: u32;
readonly index: u64;
- readonly required: u64;
+ readonly required: Weight;
} & Struct;
readonly isOverweightServiced: boolean;
readonly asOverweightServiced: {
readonly index: u64;
- readonly used: u64;
+ readonly used: Weight;
} & Struct;
readonly type: 'Success' | 'Fail' | 'BadVersion' | 'BadFormat' | 'UpwardMessageSent' | 'XcmpMessageSent' | 'OverweightEnqueued' | 'OverweightServiced';
}
- /** @name XcmV2TraitsError (63) */
+ /** @name XcmV2TraitsError (64) */
interface XcmV2TraitsError extends Enum {
readonly isOverflow: boolean;
readonly isUnimplemented: boolean;
@@ -700,7 +700,7 @@
readonly type: 'Overflow' | 'Unimplemented' | 'UntrustedReserveLocation' | 'UntrustedTeleportLocation' | 'MultiLocationFull' | 'MultiLocationNotInvertible' | 'BadOrigin' | 'InvalidLocation' | 'AssetNotFound' | 'FailedToTransactAsset' | 'NotWithdrawable' | 'LocationCannotHold' | 'ExceedsMaxMessageSize' | 'DestinationUnsupported' | 'Transport' | 'Unroutable' | 'UnknownClaim' | 'FailedToDecode' | 'MaxWeightInvalid' | 'NotHoldingFees' | 'TooExpensive' | 'Trap' | 'UnhandledXcmVersion' | 'WeightLimitReached' | 'Barrier' | 'WeightNotComputable';
}
- /** @name PalletXcmEvent (65) */
+ /** @name PalletXcmEvent (66) */
interface PalletXcmEvent extends Enum {
readonly isAttempted: boolean;
readonly asAttempted: XcmV2TraitsOutcome;
@@ -713,7 +713,7 @@
readonly isNotified: boolean;
readonly asNotified: ITuple<[u64, u8, u8]>;
readonly isNotifyOverweight: boolean;
- readonly asNotifyOverweight: ITuple<[u64, u8, u8, u64, u64]>;
+ readonly asNotifyOverweight: ITuple<[u64, u8, u8, Weight, Weight]>;
readonly isNotifyDispatchError: boolean;
readonly asNotifyDispatchError: ITuple<[u64, u8, u8]>;
readonly isNotifyDecodeFailed: boolean;
@@ -737,7 +737,7 @@
readonly type: 'Attempted' | 'Sent' | 'UnexpectedResponse' | 'ResponseReady' | 'Notified' | 'NotifyOverweight' | 'NotifyDispatchError' | 'NotifyDecodeFailed' | 'InvalidResponder' | 'InvalidResponderVersion' | 'ResponseTaken' | 'AssetsTrapped' | 'VersionChangeNotified' | 'SupportedVersionChanged' | 'NotifyTargetSendFail' | 'NotifyTargetMigrationFail';
}
- /** @name XcmV2TraitsOutcome (66) */
+ /** @name XcmV2TraitsOutcome (67) */
interface XcmV2TraitsOutcome extends Enum {
readonly isComplete: boolean;
readonly asComplete: u64;
@@ -748,10 +748,10 @@
readonly type: 'Complete' | 'Incomplete' | 'Error';
}
- /** @name XcmV2Xcm (67) */
+ /** @name XcmV2Xcm (68) */
interface XcmV2Xcm extends Vec<XcmV2Instruction> {}
- /** @name XcmV2Instruction (69) */
+ /** @name XcmV2Instruction (70) */
interface XcmV2Instruction extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: XcmV1MultiassetMultiAssets;
@@ -871,7 +871,7 @@
readonly type: 'WithdrawAsset' | 'ReserveAssetDeposited' | 'ReceiveTeleportedAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'ClearOrigin' | 'DescendOrigin' | 'ReportError' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution' | 'RefundSurplus' | 'SetErrorHandler' | 'SetAppendix' | 'ClearError' | 'ClaimAsset' | 'Trap' | 'SubscribeVersion' | 'UnsubscribeVersion';
}
- /** @name XcmV2Response (70) */
+ /** @name XcmV2Response (71) */
interface XcmV2Response extends Enum {
readonly isNull: boolean;
readonly isAssets: boolean;
@@ -883,7 +883,7 @@
readonly type: 'Null' | 'Assets' | 'ExecutionResult' | 'Version';
}
- /** @name XcmV0OriginKind (73) */
+ /** @name XcmV0OriginKind (74) */
interface XcmV0OriginKind extends Enum {
readonly isNative: boolean;
readonly isSovereignAccount: boolean;
@@ -892,12 +892,12 @@
readonly type: 'Native' | 'SovereignAccount' | 'Superuser' | 'Xcm';
}
- /** @name XcmDoubleEncoded (74) */
+ /** @name XcmDoubleEncoded (75) */
interface XcmDoubleEncoded extends Struct {
readonly encoded: Bytes;
}
- /** @name XcmV1MultiassetMultiAssetFilter (75) */
+ /** @name XcmV1MultiassetMultiAssetFilter (76) */
interface XcmV1MultiassetMultiAssetFilter extends Enum {
readonly isDefinite: boolean;
readonly asDefinite: XcmV1MultiassetMultiAssets;
@@ -906,7 +906,7 @@
readonly type: 'Definite' | 'Wild';
}
- /** @name XcmV1MultiassetWildMultiAsset (76) */
+ /** @name XcmV1MultiassetWildMultiAsset (77) */
interface XcmV1MultiassetWildMultiAsset extends Enum {
readonly isAll: boolean;
readonly isAllOf: boolean;
@@ -917,14 +917,14 @@
readonly type: 'All' | 'AllOf';
}
- /** @name XcmV1MultiassetWildFungibility (77) */
+ /** @name XcmV1MultiassetWildFungibility (78) */
interface XcmV1MultiassetWildFungibility extends Enum {
readonly isFungible: boolean;
readonly isNonFungible: boolean;
readonly type: 'Fungible' | 'NonFungible';
}
- /** @name XcmV2WeightLimit (78) */
+ /** @name XcmV2WeightLimit (79) */
interface XcmV2WeightLimit extends Enum {
readonly isUnlimited: boolean;
readonly isLimited: boolean;
@@ -932,7 +932,7 @@
readonly type: 'Unlimited' | 'Limited';
}
- /** @name XcmVersionedMultiAssets (80) */
+ /** @name XcmVersionedMultiAssets (81) */
interface XcmVersionedMultiAssets extends Enum {
readonly isV0: boolean;
readonly asV0: Vec<XcmV0MultiAsset>;
@@ -941,7 +941,7 @@
readonly type: 'V0' | 'V1';
}
- /** @name XcmV0MultiAsset (82) */
+ /** @name XcmV0MultiAsset (83) */
interface XcmV0MultiAsset extends Enum {
readonly isNone: boolean;
readonly isAll: boolean;
@@ -986,7 +986,7 @@
readonly type: 'None' | 'All' | 'AllFungible' | 'AllNonFungible' | 'AllAbstractFungible' | 'AllAbstractNonFungible' | 'AllConcreteFungible' | 'AllConcreteNonFungible' | 'AbstractFungible' | 'AbstractNonFungible' | 'ConcreteFungible' | 'ConcreteNonFungible';
}
- /** @name XcmV0MultiLocation (83) */
+ /** @name XcmV0MultiLocation (84) */
interface XcmV0MultiLocation extends Enum {
readonly isNull: boolean;
readonly isX1: boolean;
@@ -1008,7 +1008,7 @@
readonly type: 'Null' | 'X1' | 'X2' | 'X3' | 'X4' | 'X5' | 'X6' | 'X7' | 'X8';
}
- /** @name XcmV0Junction (84) */
+ /** @name XcmV0Junction (85) */
interface XcmV0Junction extends Enum {
readonly isParent: boolean;
readonly isParachain: boolean;
@@ -1043,7 +1043,7 @@
readonly type: 'Parent' | 'Parachain' | 'AccountId32' | 'AccountIndex64' | 'AccountKey20' | 'PalletInstance' | 'GeneralIndex' | 'GeneralKey' | 'OnlyChild' | 'Plurality';
}
- /** @name XcmVersionedMultiLocation (85) */
+ /** @name XcmVersionedMultiLocation (86) */
interface XcmVersionedMultiLocation extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0MultiLocation;
@@ -1052,7 +1052,7 @@
readonly type: 'V0' | 'V1';
}
- /** @name CumulusPalletXcmEvent (86) */
+ /** @name CumulusPalletXcmEvent (87) */
interface CumulusPalletXcmEvent extends Enum {
readonly isInvalidFormat: boolean;
readonly asInvalidFormat: U8aFixed;
@@ -1063,7 +1063,7 @@
readonly type: 'InvalidFormat' | 'UnsupportedVersion' | 'ExecutedDownward';
}
- /** @name CumulusPalletDmpQueueEvent (87) */
+ /** @name CumulusPalletDmpQueueEvent (88) */
interface CumulusPalletDmpQueueEvent extends Enum {
readonly isInvalidFormat: boolean;
readonly asInvalidFormat: {
@@ -1081,24 +1081,24 @@
readonly isWeightExhausted: boolean;
readonly asWeightExhausted: {
readonly messageId: U8aFixed;
- readonly remainingWeight: u64;
- readonly requiredWeight: u64;
+ readonly remainingWeight: Weight;
+ readonly requiredWeight: Weight;
} & Struct;
readonly isOverweightEnqueued: boolean;
readonly asOverweightEnqueued: {
readonly messageId: U8aFixed;
readonly overweightIndex: u64;
- readonly requiredWeight: u64;
+ readonly requiredWeight: Weight;
} & Struct;
readonly isOverweightServiced: boolean;
readonly asOverweightServiced: {
readonly overweightIndex: u64;
- readonly weightUsed: u64;
+ readonly weightUsed: Weight;
} & Struct;
readonly type: 'InvalidFormat' | 'UnsupportedVersion' | 'ExecutedDownward' | 'WeightExhausted' | 'OverweightEnqueued' | 'OverweightServiced';
}
- /** @name PalletUniqueRawEvent (88) */
+ /** @name PalletUniqueRawEvent (89) */
interface PalletUniqueRawEvent extends Enum {
readonly isCollectionSponsorRemoved: boolean;
readonly asCollectionSponsorRemoved: u32;
@@ -1123,7 +1123,7 @@
readonly type: 'CollectionSponsorRemoved' | 'CollectionAdminAdded' | 'CollectionOwnedChanged' | 'CollectionSponsorSet' | 'SponsorshipConfirmed' | 'CollectionAdminRemoved' | 'AllowListAddressRemoved' | 'AllowListAddressAdded' | 'CollectionLimitSet' | 'CollectionPermissionSet';
}
- /** @name PalletEvmAccountBasicCrossAccountIdRepr (89) */
+ /** @name PalletEvmAccountBasicCrossAccountIdRepr (90) */
interface PalletEvmAccountBasicCrossAccountIdRepr extends Enum {
readonly isSubstrate: boolean;
readonly asSubstrate: AccountId32;
@@ -1132,7 +1132,7 @@
readonly type: 'Substrate' | 'Ethereum';
}
- /** @name PalletUniqueSchedulerEvent (92) */
+ /** @name PalletUniqueSchedulerEvent (93) */
interface PalletUniqueSchedulerEvent extends Enum {
readonly isScheduled: boolean;
readonly asScheduled: {
@@ -1159,14 +1159,14 @@
readonly type: 'Scheduled' | 'Canceled' | 'Dispatched' | 'CallLookupFailed';
}
- /** @name FrameSupportScheduleLookupError (95) */
+ /** @name FrameSupportScheduleLookupError (96) */
interface FrameSupportScheduleLookupError extends Enum {
readonly isUnknown: boolean;
readonly isBadFormat: boolean;
readonly type: 'Unknown' | 'BadFormat';
}
- /** @name PalletCommonEvent (96) */
+ /** @name PalletCommonEvent (97) */
interface PalletCommonEvent extends Enum {
readonly isCollectionCreated: boolean;
readonly asCollectionCreated: ITuple<[u32, u8, AccountId32]>;
@@ -1193,14 +1193,14 @@
readonly type: 'CollectionCreated' | 'CollectionDestroyed' | 'ItemCreated' | 'ItemDestroyed' | 'Transfer' | 'Approved' | 'CollectionPropertySet' | 'CollectionPropertyDeleted' | 'TokenPropertySet' | 'TokenPropertyDeleted' | 'PropertyPermissionSet';
}
- /** @name PalletStructureEvent (99) */
+ /** @name PalletStructureEvent (100) */
interface PalletStructureEvent extends Enum {
readonly isExecuted: boolean;
readonly asExecuted: Result<Null, SpRuntimeDispatchError>;
readonly type: 'Executed';
}
- /** @name PalletRmrkCoreEvent (100) */
+ /** @name PalletRmrkCoreEvent (101) */
interface PalletRmrkCoreEvent extends Enum {
readonly isCollectionCreated: boolean;
readonly asCollectionCreated: {
@@ -1290,7 +1290,7 @@
readonly type: 'CollectionCreated' | 'CollectionDestroyed' | 'IssuerChanged' | 'CollectionLocked' | 'NftMinted' | 'NftBurned' | 'NftSent' | 'NftAccepted' | 'NftRejected' | 'PropertySet' | 'ResourceAdded' | 'ResourceRemoval' | 'ResourceAccepted' | 'ResourceRemovalAccepted' | 'PrioritySet';
}
- /** @name RmrkTraitsNftAccountIdOrCollectionNftTuple (101) */
+ /** @name RmrkTraitsNftAccountIdOrCollectionNftTuple (102) */
interface RmrkTraitsNftAccountIdOrCollectionNftTuple extends Enum {
readonly isAccountId: boolean;
readonly asAccountId: AccountId32;
@@ -1299,7 +1299,7 @@
readonly type: 'AccountId' | 'CollectionAndNftTuple';
}
- /** @name PalletRmrkEquipEvent (106) */
+ /** @name PalletRmrkEquipEvent (107) */
interface PalletRmrkEquipEvent extends Enum {
readonly isBaseCreated: boolean;
readonly asBaseCreated: {
@@ -1314,7 +1314,7 @@
readonly type: 'BaseCreated' | 'EquippablesUpdated';
}
- /** @name PalletAppPromotionEvent (107) */
+ /** @name PalletAppPromotionEvent (108) */
interface PalletAppPromotionEvent extends Enum {
readonly isStakingRecalculation: boolean;
readonly asStakingRecalculation: ITuple<[AccountId32, u128, u128]>;
@@ -1327,7 +1327,7 @@
readonly type: 'StakingRecalculation' | 'Stake' | 'Unstake' | 'SetAdmin';
}
- /** @name PalletForeignAssetsModuleEvent (108) */
+ /** @name PalletForeignAssetsModuleEvent (109) */
interface PalletForeignAssetsModuleEvent extends Enum {
readonly isForeignAssetRegistered: boolean;
readonly asForeignAssetRegistered: {
@@ -1354,7 +1354,7 @@
readonly type: 'ForeignAssetRegistered' | 'ForeignAssetUpdated' | 'AssetRegistered' | 'AssetUpdated';
}
- /** @name PalletForeignAssetsModuleAssetMetadata (109) */
+ /** @name PalletForeignAssetsModuleAssetMetadata (110) */
interface PalletForeignAssetsModuleAssetMetadata extends Struct {
readonly name: Bytes;
readonly symbol: Bytes;
@@ -1362,7 +1362,7 @@
readonly minimalBalance: u128;
}
- /** @name PalletEvmEvent (110) */
+ /** @name PalletEvmEvent (111) */
interface PalletEvmEvent extends Enum {
readonly isLog: boolean;
readonly asLog: EthereumLog;
@@ -1381,21 +1381,21 @@
readonly type: 'Log' | 'Created' | 'CreatedFailed' | 'Executed' | 'ExecutedFailed' | 'BalanceDeposit' | 'BalanceWithdraw';
}
- /** @name EthereumLog (111) */
+ /** @name EthereumLog (112) */
interface EthereumLog extends Struct {
readonly address: H160;
readonly topics: Vec<H256>;
readonly data: Bytes;
}
- /** @name PalletEthereumEvent (115) */
+ /** @name PalletEthereumEvent (116) */
interface PalletEthereumEvent extends Enum {
readonly isExecuted: boolean;
readonly asExecuted: ITuple<[H160, H160, H256, EvmCoreErrorExitReason]>;
readonly type: 'Executed';
}
- /** @name EvmCoreErrorExitReason (116) */
+ /** @name EvmCoreErrorExitReason (117) */
interface EvmCoreErrorExitReason extends Enum {
readonly isSucceed: boolean;
readonly asSucceed: EvmCoreErrorExitSucceed;
@@ -1408,7 +1408,7 @@
readonly type: 'Succeed' | 'Error' | 'Revert' | 'Fatal';
}
- /** @name EvmCoreErrorExitSucceed (117) */
+ /** @name EvmCoreErrorExitSucceed (118) */
interface EvmCoreErrorExitSucceed extends Enum {
readonly isStopped: boolean;
readonly isReturned: boolean;
@@ -1416,7 +1416,7 @@
readonly type: 'Stopped' | 'Returned' | 'Suicided';
}
- /** @name EvmCoreErrorExitError (118) */
+ /** @name EvmCoreErrorExitError (119) */
interface EvmCoreErrorExitError extends Enum {
readonly isStackUnderflow: boolean;
readonly isStackOverflow: boolean;
@@ -1437,13 +1437,13 @@
readonly type: 'StackUnderflow' | 'StackOverflow' | 'InvalidJump' | 'InvalidRange' | 'DesignatedInvalid' | 'CallTooDeep' | 'CreateCollision' | 'CreateContractLimit' | 'OutOfOffset' | 'OutOfGas' | 'OutOfFund' | 'PcUnderflow' | 'CreateEmpty' | 'Other' | 'InvalidCode';
}
- /** @name EvmCoreErrorExitRevert (121) */
+ /** @name EvmCoreErrorExitRevert (122) */
interface EvmCoreErrorExitRevert extends Enum {
readonly isReverted: boolean;
readonly type: 'Reverted';
}
- /** @name EvmCoreErrorExitFatal (122) */
+ /** @name EvmCoreErrorExitFatal (123) */
interface EvmCoreErrorExitFatal extends Enum {
readonly isNotSupported: boolean;
readonly isUnhandledInterrupt: boolean;
@@ -1454,7 +1454,7 @@
readonly type: 'NotSupported' | 'UnhandledInterrupt' | 'CallErrorAsFatal' | 'Other';
}
- /** @name PalletEvmContractHelpersEvent (123) */
+ /** @name PalletEvmContractHelpersEvent (124) */
interface PalletEvmContractHelpersEvent extends Enum {
readonly isContractSponsorSet: boolean;
readonly asContractSponsorSet: ITuple<[H160, AccountId32]>;
@@ -1465,7 +1465,7 @@
readonly type: 'ContractSponsorSet' | 'ContractSponsorshipConfirmed' | 'ContractSponsorRemoved';
}
- /** @name FrameSystemPhase (124) */
+ /** @name FrameSystemPhase (125) */
interface FrameSystemPhase extends Enum {
readonly isApplyExtrinsic: boolean;
readonly asApplyExtrinsic: u32;
@@ -1474,13 +1474,13 @@
readonly type: 'ApplyExtrinsic' | 'Finalization' | 'Initialization';
}
- /** @name FrameSystemLastRuntimeUpgradeInfo (126) */
+ /** @name FrameSystemLastRuntimeUpgradeInfo (127) */
interface FrameSystemLastRuntimeUpgradeInfo extends Struct {
readonly specVersion: Compact<u32>;
readonly specName: Text;
}
- /** @name FrameSystemCall (127) */
+ /** @name FrameSystemCall (128) */
interface FrameSystemCall extends Enum {
readonly isFillBlock: boolean;
readonly asFillBlock: {
@@ -1522,47 +1522,47 @@
readonly type: 'FillBlock' | 'Remark' | 'SetHeapPages' | 'SetCode' | 'SetCodeWithoutChecks' | 'SetStorage' | 'KillStorage' | 'KillPrefix' | 'RemarkWithEvent';
}
- /** @name FrameSystemLimitsBlockWeights (132) */
+ /** @name FrameSystemLimitsBlockWeights (133) */
interface FrameSystemLimitsBlockWeights extends Struct {
- readonly baseBlock: u64;
- readonly maxBlock: u64;
+ readonly baseBlock: Weight;
+ readonly maxBlock: Weight;
readonly perClass: FrameSupportWeightsPerDispatchClassWeightsPerClass;
}
- /** @name FrameSupportWeightsPerDispatchClassWeightsPerClass (133) */
+ /** @name FrameSupportWeightsPerDispatchClassWeightsPerClass (134) */
interface FrameSupportWeightsPerDispatchClassWeightsPerClass extends Struct {
readonly normal: FrameSystemLimitsWeightsPerClass;
readonly operational: FrameSystemLimitsWeightsPerClass;
readonly mandatory: FrameSystemLimitsWeightsPerClass;
}
- /** @name FrameSystemLimitsWeightsPerClass (134) */
+ /** @name FrameSystemLimitsWeightsPerClass (135) */
interface FrameSystemLimitsWeightsPerClass extends Struct {
- readonly baseExtrinsic: u64;
- readonly maxExtrinsic: Option<u64>;
- readonly maxTotal: Option<u64>;
- readonly reserved: Option<u64>;
+ readonly baseExtrinsic: Weight;
+ readonly maxExtrinsic: Option<Weight>;
+ readonly maxTotal: Option<Weight>;
+ readonly reserved: Option<Weight>;
}
- /** @name FrameSystemLimitsBlockLength (136) */
+ /** @name FrameSystemLimitsBlockLength (137) */
interface FrameSystemLimitsBlockLength extends Struct {
readonly max: FrameSupportWeightsPerDispatchClassU32;
}
- /** @name FrameSupportWeightsPerDispatchClassU32 (137) */
+ /** @name FrameSupportWeightsPerDispatchClassU32 (138) */
interface FrameSupportWeightsPerDispatchClassU32 extends Struct {
readonly normal: u32;
readonly operational: u32;
readonly mandatory: u32;
}
- /** @name FrameSupportWeightsRuntimeDbWeight (138) */
+ /** @name FrameSupportWeightsRuntimeDbWeight (139) */
interface FrameSupportWeightsRuntimeDbWeight extends Struct {
readonly read: u64;
readonly write: u64;
}
- /** @name SpVersionRuntimeVersion (139) */
+ /** @name SpVersionRuntimeVersion (140) */
interface SpVersionRuntimeVersion extends Struct {
readonly specName: Text;
readonly implName: Text;
@@ -1574,7 +1574,7 @@
readonly stateVersion: u8;
}
- /** @name FrameSystemError (144) */
+ /** @name FrameSystemError (145) */
interface FrameSystemError extends Enum {
readonly isInvalidSpecName: boolean;
readonly isSpecVersionNeedsToIncrease: boolean;
@@ -1585,7 +1585,7 @@
readonly type: 'InvalidSpecName' | 'SpecVersionNeedsToIncrease' | 'FailedToExtractRuntimeVersion' | 'NonDefaultComposite' | 'NonZeroRefCount' | 'CallFiltered';
}
- /** @name PolkadotPrimitivesV2PersistedValidationData (145) */
+ /** @name PolkadotPrimitivesV2PersistedValidationData (146) */
interface PolkadotPrimitivesV2PersistedValidationData extends Struct {
readonly parentHead: Bytes;
readonly relayParentNumber: u32;
@@ -1593,18 +1593,18 @@
readonly maxPovSize: u32;
}
- /** @name PolkadotPrimitivesV2UpgradeRestriction (148) */
+ /** @name PolkadotPrimitivesV2UpgradeRestriction (149) */
interface PolkadotPrimitivesV2UpgradeRestriction extends Enum {
readonly isPresent: boolean;
readonly type: 'Present';
}
- /** @name SpTrieStorageProof (149) */
+ /** @name SpTrieStorageProof (150) */
interface SpTrieStorageProof extends Struct {
readonly trieNodes: BTreeSet<Bytes>;
}
- /** @name CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot (151) */
+ /** @name CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot (152) */
interface CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot extends Struct {
readonly dmqMqcHead: H256;
readonly relayDispatchQueueSize: ITuple<[u32, u32]>;
@@ -1612,7 +1612,7 @@
readonly egressChannels: Vec<ITuple<[u32, PolkadotPrimitivesV2AbridgedHrmpChannel]>>;
}
- /** @name PolkadotPrimitivesV2AbridgedHrmpChannel (154) */
+ /** @name PolkadotPrimitivesV2AbridgedHrmpChannel (155) */
interface PolkadotPrimitivesV2AbridgedHrmpChannel extends Struct {
readonly maxCapacity: u32;
readonly maxTotalSize: u32;
@@ -1622,7 +1622,7 @@
readonly mqcHead: Option<H256>;
}
- /** @name PolkadotPrimitivesV2AbridgedHostConfiguration (155) */
+ /** @name PolkadotPrimitivesV2AbridgedHostConfiguration (156) */
interface PolkadotPrimitivesV2AbridgedHostConfiguration extends Struct {
readonly maxCodeSize: u32;
readonly maxHeadDataSize: u32;
@@ -1635,13 +1635,13 @@
readonly validationUpgradeDelay: u32;
}
- /** @name PolkadotCorePrimitivesOutboundHrmpMessage (161) */
+ /** @name PolkadotCorePrimitivesOutboundHrmpMessage (162) */
interface PolkadotCorePrimitivesOutboundHrmpMessage extends Struct {
readonly recipient: u32;
readonly data: Bytes;
}
- /** @name CumulusPalletParachainSystemCall (162) */
+ /** @name CumulusPalletParachainSystemCall (163) */
interface CumulusPalletParachainSystemCall extends Enum {
readonly isSetValidationData: boolean;
readonly asSetValidationData: {
@@ -1662,7 +1662,7 @@
readonly type: 'SetValidationData' | 'SudoSendUpwardMessage' | 'AuthorizeUpgrade' | 'EnactAuthorizedUpgrade';
}
- /** @name CumulusPrimitivesParachainInherentParachainInherentData (163) */
+ /** @name CumulusPrimitivesParachainInherentParachainInherentData (164) */
interface CumulusPrimitivesParachainInherentParachainInherentData extends Struct {
readonly validationData: PolkadotPrimitivesV2PersistedValidationData;
readonly relayChainState: SpTrieStorageProof;
@@ -1670,19 +1670,19 @@
readonly horizontalMessages: BTreeMap<u32, Vec<PolkadotCorePrimitivesInboundHrmpMessage>>;
}
- /** @name PolkadotCorePrimitivesInboundDownwardMessage (165) */
+ /** @name PolkadotCorePrimitivesInboundDownwardMessage (166) */
interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct {
readonly sentAt: u32;
readonly msg: Bytes;
}
- /** @name PolkadotCorePrimitivesInboundHrmpMessage (168) */
+ /** @name PolkadotCorePrimitivesInboundHrmpMessage (169) */
interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct {
readonly sentAt: u32;
readonly data: Bytes;
}
- /** @name CumulusPalletParachainSystemError (171) */
+ /** @name CumulusPalletParachainSystemError (172) */
interface CumulusPalletParachainSystemError extends Enum {
readonly isOverlappingUpgrades: boolean;
readonly isProhibitedByPolkadot: boolean;
@@ -1695,14 +1695,14 @@
readonly type: 'OverlappingUpgrades' | 'ProhibitedByPolkadot' | 'TooBig' | 'ValidationDataNotAvailable' | 'HostConfigurationNotAvailable' | 'NotScheduled' | 'NothingAuthorized' | 'Unauthorized';
}
- /** @name PalletBalancesBalanceLock (173) */
+ /** @name PalletBalancesBalanceLock (174) */
interface PalletBalancesBalanceLock extends Struct {
readonly id: U8aFixed;
readonly amount: u128;
readonly reasons: PalletBalancesReasons;
}
- /** @name PalletBalancesReasons (174) */
+ /** @name PalletBalancesReasons (175) */
interface PalletBalancesReasons extends Enum {
readonly isFee: boolean;
readonly isMisc: boolean;
@@ -1710,20 +1710,20 @@
readonly type: 'Fee' | 'Misc' | 'All';
}
- /** @name PalletBalancesReserveData (177) */
+ /** @name PalletBalancesReserveData (178) */
interface PalletBalancesReserveData extends Struct {
readonly id: U8aFixed;
readonly amount: u128;
}
- /** @name PalletBalancesReleases (179) */
+ /** @name PalletBalancesReleases (180) */
interface PalletBalancesReleases extends Enum {
readonly isV100: boolean;
readonly isV200: boolean;
readonly type: 'V100' | 'V200';
}
- /** @name PalletBalancesCall (180) */
+ /** @name PalletBalancesCall (181) */
interface PalletBalancesCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -1760,7 +1760,7 @@
readonly type: 'Transfer' | 'SetBalance' | 'ForceTransfer' | 'TransferKeepAlive' | 'TransferAll' | 'ForceUnreserve';
}
- /** @name PalletBalancesError (183) */
+ /** @name PalletBalancesError (184) */
interface PalletBalancesError extends Enum {
readonly isVestingBalance: boolean;
readonly isLiquidityRestrictions: boolean;
@@ -1773,7 +1773,7 @@
readonly type: 'VestingBalance' | 'LiquidityRestrictions' | 'InsufficientBalance' | 'ExistentialDeposit' | 'KeepAlive' | 'ExistingVestingSchedule' | 'DeadAccount' | 'TooManyReserves';
}
- /** @name PalletTimestampCall (185) */
+ /** @name PalletTimestampCall (186) */
interface PalletTimestampCall extends Enum {
readonly isSet: boolean;
readonly asSet: {
@@ -1782,14 +1782,14 @@
readonly type: 'Set';
}
- /** @name PalletTransactionPaymentReleases (187) */
+ /** @name PalletTransactionPaymentReleases (188) */
interface PalletTransactionPaymentReleases extends Enum {
readonly isV1Ancient: boolean;
readonly isV2: boolean;
readonly type: 'V1Ancient' | 'V2';
}
- /** @name PalletTreasuryProposal (188) */
+ /** @name PalletTreasuryProposal (189) */
interface PalletTreasuryProposal extends Struct {
readonly proposer: AccountId32;
readonly value: u128;
@@ -1797,7 +1797,7 @@
readonly bond: u128;
}
- /** @name PalletTreasuryCall (191) */
+ /** @name PalletTreasuryCall (192) */
interface PalletTreasuryCall extends Enum {
readonly isProposeSpend: boolean;
readonly asProposeSpend: {
@@ -1824,10 +1824,10 @@
readonly type: 'ProposeSpend' | 'RejectProposal' | 'ApproveProposal' | 'Spend' | 'RemoveApproval';
}
- /** @name FrameSupportPalletId (194) */
+ /** @name FrameSupportPalletId (195) */
interface FrameSupportPalletId extends U8aFixed {}
- /** @name PalletTreasuryError (195) */
+ /** @name PalletTreasuryError (196) */
interface PalletTreasuryError extends Enum {
readonly isInsufficientProposersBalance: boolean;
readonly isInvalidIndex: boolean;
@@ -1837,7 +1837,7 @@
readonly type: 'InsufficientProposersBalance' | 'InvalidIndex' | 'TooManyApprovals' | 'InsufficientPermission' | 'ProposalNotApproved';
}
- /** @name PalletSudoCall (196) */
+ /** @name PalletSudoCall (197) */
interface PalletSudoCall extends Enum {
readonly isSudo: boolean;
readonly asSudo: {
@@ -1846,7 +1846,7 @@
readonly isSudoUncheckedWeight: boolean;
readonly asSudoUncheckedWeight: {
readonly call: Call;
- readonly weight: u64;
+ readonly weight: Weight;
} & Struct;
readonly isSetKey: boolean;
readonly asSetKey: {
@@ -1860,7 +1860,7 @@
readonly type: 'Sudo' | 'SudoUncheckedWeight' | 'SetKey' | 'SudoAs';
}
- /** @name OrmlVestingModuleCall (198) */
+ /** @name OrmlVestingModuleCall (199) */
interface OrmlVestingModuleCall extends Enum {
readonly isClaim: boolean;
readonly isVestedTransfer: boolean;
@@ -1880,7 +1880,7 @@
readonly type: 'Claim' | 'VestedTransfer' | 'UpdateVestingSchedules' | 'ClaimFor';
}
- /** @name OrmlXtokensModuleCall (200) */
+ /** @name OrmlXtokensModuleCall (201) */
interface OrmlXtokensModuleCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -1927,7 +1927,7 @@
readonly type: 'Transfer' | 'TransferMultiasset' | 'TransferWithFee' | 'TransferMultiassetWithFee' | 'TransferMulticurrencies' | 'TransferMultiassets';
}
- /** @name XcmVersionedMultiAsset (201) */
+ /** @name XcmVersionedMultiAsset (202) */
interface XcmVersionedMultiAsset extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0MultiAsset;
@@ -1936,7 +1936,7 @@
readonly type: 'V0' | 'V1';
}
- /** @name OrmlTokensModuleCall (204) */
+ /** @name OrmlTokensModuleCall (205) */
interface OrmlTokensModuleCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -1973,12 +1973,12 @@
readonly type: 'Transfer' | 'TransferAll' | 'TransferKeepAlive' | 'ForceTransfer' | 'SetBalance';
}
- /** @name CumulusPalletXcmpQueueCall (205) */
+ /** @name CumulusPalletXcmpQueueCall (206) */
interface CumulusPalletXcmpQueueCall extends Enum {
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
readonly index: u64;
- readonly weightLimit: u64;
+ readonly weightLimit: Weight;
} & Struct;
readonly isSuspendXcmExecution: boolean;
readonly isResumeXcmExecution: boolean;
@@ -1996,20 +1996,20 @@
} & Struct;
readonly isUpdateThresholdWeight: boolean;
readonly asUpdateThresholdWeight: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly isUpdateWeightRestrictDecay: boolean;
readonly asUpdateWeightRestrictDecay: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly isUpdateXcmpMaxIndividualWeight: boolean;
readonly asUpdateXcmpMaxIndividualWeight: {
- readonly new_: u64;
+ readonly new_: Weight;
} & Struct;
readonly type: 'ServiceOverweight' | 'SuspendXcmExecution' | 'ResumeXcmExecution' | 'UpdateSuspendThreshold' | 'UpdateDropThreshold' | 'UpdateResumeThreshold' | 'UpdateThresholdWeight' | 'UpdateWeightRestrictDecay' | 'UpdateXcmpMaxIndividualWeight';
}
- /** @name PalletXcmCall (206) */
+ /** @name PalletXcmCall (207) */
interface PalletXcmCall extends Enum {
readonly isSend: boolean;
readonly asSend: {
@@ -2033,7 +2033,7 @@
readonly isExecute: boolean;
readonly asExecute: {
readonly message: XcmVersionedXcm;
- readonly maxWeight: u64;
+ readonly maxWeight: Weight;
} & Struct;
readonly isForceXcmVersion: boolean;
readonly asForceXcmVersion: {
@@ -2071,7 +2071,7 @@
readonly type: 'Send' | 'TeleportAssets' | 'ReserveTransferAssets' | 'Execute' | 'ForceXcmVersion' | 'ForceDefaultXcmVersion' | 'ForceSubscribeVersionNotify' | 'ForceUnsubscribeVersionNotify' | 'LimitedReserveTransferAssets' | 'LimitedTeleportAssets';
}
- /** @name XcmVersionedXcm (207) */
+ /** @name XcmVersionedXcm (208) */
interface XcmVersionedXcm extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0Xcm;
@@ -2082,7 +2082,7 @@
readonly type: 'V0' | 'V1' | 'V2';
}
- /** @name XcmV0Xcm (208) */
+ /** @name XcmV0Xcm (209) */
interface XcmV0Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -2145,7 +2145,7 @@
readonly type: 'WithdrawAsset' | 'ReserveAssetDeposit' | 'TeleportAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom';
}
- /** @name XcmV0Order (210) */
+ /** @name XcmV0Order (211) */
interface XcmV0Order extends Enum {
readonly isNull: boolean;
readonly isDepositAsset: boolean;
@@ -2193,14 +2193,14 @@
readonly type: 'Null' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
}
- /** @name XcmV0Response (212) */
+ /** @name XcmV0Response (213) */
interface XcmV0Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: Vec<XcmV0MultiAsset>;
readonly type: 'Assets';
}
- /** @name XcmV1Xcm (213) */
+ /** @name XcmV1Xcm (214) */
interface XcmV1Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -2269,7 +2269,7 @@
readonly type: 'WithdrawAsset' | 'ReserveAssetDeposited' | 'ReceiveTeleportedAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom' | 'SubscribeVersion' | 'UnsubscribeVersion';
}
- /** @name XcmV1Order (215) */
+ /** @name XcmV1Order (216) */
interface XcmV1Order extends Enum {
readonly isNoop: boolean;
readonly isDepositAsset: boolean;
@@ -2319,7 +2319,7 @@
readonly type: 'Noop' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
}
- /** @name XcmV1Response (217) */
+ /** @name XcmV1Response (218) */
interface XcmV1Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -2328,20 +2328,20 @@
readonly type: 'Assets' | 'Version';
}
- /** @name CumulusPalletXcmCall (231) */
+ /** @name CumulusPalletXcmCall (232) */
type CumulusPalletXcmCall = Null;
- /** @name CumulusPalletDmpQueueCall (232) */
+ /** @name CumulusPalletDmpQueueCall (233) */
interface CumulusPalletDmpQueueCall extends Enum {
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
readonly index: u64;
- readonly weightLimit: u64;
+ readonly weightLimit: Weight;
} & Struct;
readonly type: 'ServiceOverweight';
}
- /** @name PalletInflationCall (233) */
+ /** @name PalletInflationCall (234) */
interface PalletInflationCall extends Enum {
readonly isStartInflation: boolean;
readonly asStartInflation: {
@@ -2350,7 +2350,7 @@
readonly type: 'StartInflation';
}
- /** @name PalletUniqueCall (234) */
+ /** @name PalletUniqueCall (235) */
interface PalletUniqueCall extends Enum {
readonly isCreateCollection: boolean;
readonly asCreateCollection: {
@@ -2508,7 +2508,7 @@
readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition';
}
- /** @name UpDataStructsCollectionMode (239) */
+ /** @name UpDataStructsCollectionMode (240) */
interface UpDataStructsCollectionMode extends Enum {
readonly isNft: boolean;
readonly isFungible: boolean;
@@ -2517,7 +2517,7 @@
readonly type: 'Nft' | 'Fungible' | 'ReFungible';
}
- /** @name UpDataStructsCreateCollectionData (240) */
+ /** @name UpDataStructsCreateCollectionData (241) */
interface UpDataStructsCreateCollectionData extends Struct {
readonly mode: UpDataStructsCollectionMode;
readonly access: Option<UpDataStructsAccessMode>;
@@ -2531,14 +2531,14 @@
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsAccessMode (242) */
+ /** @name UpDataStructsAccessMode (243) */
interface UpDataStructsAccessMode extends Enum {
readonly isNormal: boolean;
readonly isAllowList: boolean;
readonly type: 'Normal' | 'AllowList';
}
- /** @name UpDataStructsCollectionLimits (244) */
+ /** @name UpDataStructsCollectionLimits (245) */
interface UpDataStructsCollectionLimits extends Struct {
readonly accountTokenOwnershipLimit: Option<u32>;
readonly sponsoredDataSize: Option<u32>;
@@ -2551,7 +2551,7 @@
readonly transfersEnabled: Option<bool>;
}
- /** @name UpDataStructsSponsoringRateLimit (246) */
+ /** @name UpDataStructsSponsoringRateLimit (247) */
interface UpDataStructsSponsoringRateLimit extends Enum {
readonly isSponsoringDisabled: boolean;
readonly isBlocks: boolean;
@@ -2559,43 +2559,43 @@
readonly type: 'SponsoringDisabled' | 'Blocks';
}
- /** @name UpDataStructsCollectionPermissions (249) */
+ /** @name UpDataStructsCollectionPermissions (250) */
interface UpDataStructsCollectionPermissions extends Struct {
readonly access: Option<UpDataStructsAccessMode>;
readonly mintMode: Option<bool>;
readonly nesting: Option<UpDataStructsNestingPermissions>;
}
- /** @name UpDataStructsNestingPermissions (251) */
+ /** @name UpDataStructsNestingPermissions (252) */
interface UpDataStructsNestingPermissions extends Struct {
readonly tokenOwner: bool;
readonly collectionAdmin: bool;
readonly restricted: Option<UpDataStructsOwnerRestrictedSet>;
}
- /** @name UpDataStructsOwnerRestrictedSet (253) */
+ /** @name UpDataStructsOwnerRestrictedSet (254) */
interface UpDataStructsOwnerRestrictedSet extends BTreeSet<u32> {}
- /** @name UpDataStructsPropertyKeyPermission (258) */
+ /** @name UpDataStructsPropertyKeyPermission (259) */
interface UpDataStructsPropertyKeyPermission extends Struct {
readonly key: Bytes;
readonly permission: UpDataStructsPropertyPermission;
}
- /** @name UpDataStructsPropertyPermission (259) */
+ /** @name UpDataStructsPropertyPermission (260) */
interface UpDataStructsPropertyPermission extends Struct {
readonly mutable: bool;
readonly collectionAdmin: bool;
readonly tokenOwner: bool;
}
- /** @name UpDataStructsProperty (262) */
+ /** @name UpDataStructsProperty (263) */
interface UpDataStructsProperty extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name UpDataStructsCreateItemData (265) */
+ /** @name UpDataStructsCreateItemData (266) */
interface UpDataStructsCreateItemData extends Enum {
readonly isNft: boolean;
readonly asNft: UpDataStructsCreateNftData;
@@ -2606,23 +2606,23 @@
readonly type: 'Nft' | 'Fungible' | 'ReFungible';
}
- /** @name UpDataStructsCreateNftData (266) */
+ /** @name UpDataStructsCreateNftData (267) */
interface UpDataStructsCreateNftData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateFungibleData (267) */
+ /** @name UpDataStructsCreateFungibleData (268) */
interface UpDataStructsCreateFungibleData extends Struct {
readonly value: u128;
}
- /** @name UpDataStructsCreateReFungibleData (268) */
+ /** @name UpDataStructsCreateReFungibleData (269) */
interface UpDataStructsCreateReFungibleData extends Struct {
readonly pieces: u128;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateItemExData (271) */
+ /** @name UpDataStructsCreateItemExData (272) */
interface UpDataStructsCreateItemExData extends Enum {
readonly isNft: boolean;
readonly asNft: Vec<UpDataStructsCreateNftExData>;
@@ -2635,26 +2635,26 @@
readonly type: 'Nft' | 'Fungible' | 'RefungibleMultipleItems' | 'RefungibleMultipleOwners';
}
- /** @name UpDataStructsCreateNftExData (273) */
+ /** @name UpDataStructsCreateNftExData (274) */
interface UpDataStructsCreateNftExData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: PalletEvmAccountBasicCrossAccountIdRepr;
}
- /** @name UpDataStructsCreateRefungibleExSingleOwner (280) */
+ /** @name UpDataStructsCreateRefungibleExSingleOwner (281) */
interface UpDataStructsCreateRefungibleExSingleOwner extends Struct {
readonly user: PalletEvmAccountBasicCrossAccountIdRepr;
readonly pieces: u128;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateRefungibleExMultipleOwners (282) */
+ /** @name UpDataStructsCreateRefungibleExMultipleOwners (283) */
interface UpDataStructsCreateRefungibleExMultipleOwners extends Struct {
readonly users: BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name PalletUniqueSchedulerCall (283) */
+ /** @name PalletUniqueSchedulerCall (284) */
interface PalletUniqueSchedulerCall extends Enum {
readonly isScheduleNamed: boolean;
readonly asScheduleNamed: {
@@ -2679,7 +2679,7 @@
readonly type: 'ScheduleNamed' | 'CancelNamed' | 'ScheduleNamedAfter';
}
- /** @name FrameSupportScheduleMaybeHashed (285) */
+ /** @name FrameSupportScheduleMaybeHashed (286) */
interface FrameSupportScheduleMaybeHashed extends Enum {
readonly isValue: boolean;
readonly asValue: Call;
@@ -2688,7 +2688,7 @@
readonly type: 'Value' | 'Hash';
}
- /** @name PalletConfigurationCall (286) */
+ /** @name PalletConfigurationCall (287) */
interface PalletConfigurationCall extends Enum {
readonly isSetWeightToFeeCoefficientOverride: boolean;
readonly asSetWeightToFeeCoefficientOverride: {
@@ -2701,13 +2701,13 @@
readonly type: 'SetWeightToFeeCoefficientOverride' | 'SetMinGasPriceOverride';
}
- /** @name PalletTemplateTransactionPaymentCall (287) */
+ /** @name PalletTemplateTransactionPaymentCall (289) */
type PalletTemplateTransactionPaymentCall = Null;
- /** @name PalletStructureCall (288) */
+ /** @name PalletStructureCall (290) */
type PalletStructureCall = Null;
- /** @name PalletRmrkCoreCall (289) */
+ /** @name PalletRmrkCoreCall (291) */
interface PalletRmrkCoreCall extends Enum {
readonly isCreateCollection: boolean;
readonly asCreateCollection: {
@@ -2813,7 +2813,7 @@
readonly type: 'CreateCollection' | 'DestroyCollection' | 'ChangeCollectionIssuer' | 'LockCollection' | 'MintNft' | 'BurnNft' | 'Send' | 'AcceptNft' | 'RejectNft' | 'AcceptResource' | 'AcceptResourceRemoval' | 'SetProperty' | 'SetPriority' | 'AddBasicResource' | 'AddComposableResource' | 'AddSlotResource' | 'RemoveResource';
}
- /** @name RmrkTraitsResourceResourceTypes (295) */
+ /** @name RmrkTraitsResourceResourceTypes (297) */
interface RmrkTraitsResourceResourceTypes extends Enum {
readonly isBasic: boolean;
readonly asBasic: RmrkTraitsResourceBasicResource;
@@ -2824,7 +2824,7 @@
readonly type: 'Basic' | 'Composable' | 'Slot';
}
- /** @name RmrkTraitsResourceBasicResource (297) */
+ /** @name RmrkTraitsResourceBasicResource (299) */
interface RmrkTraitsResourceBasicResource extends Struct {
readonly src: Option<Bytes>;
readonly metadata: Option<Bytes>;
@@ -2832,7 +2832,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name RmrkTraitsResourceComposableResource (299) */
+ /** @name RmrkTraitsResourceComposableResource (301) */
interface RmrkTraitsResourceComposableResource extends Struct {
readonly parts: Vec<u32>;
readonly base: u32;
@@ -2842,7 +2842,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name RmrkTraitsResourceSlotResource (300) */
+ /** @name RmrkTraitsResourceSlotResource (302) */
interface RmrkTraitsResourceSlotResource extends Struct {
readonly base: u32;
readonly src: Option<Bytes>;
@@ -2852,7 +2852,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name PalletRmrkEquipCall (303) */
+ /** @name PalletRmrkEquipCall (305) */
interface PalletRmrkEquipCall extends Enum {
readonly isCreateBase: boolean;
readonly asCreateBase: {
@@ -2874,7 +2874,7 @@
readonly type: 'CreateBase' | 'ThemeAdd' | 'Equippable';
}
- /** @name RmrkTraitsPartPartType (306) */
+ /** @name RmrkTraitsPartPartType (308) */
interface RmrkTraitsPartPartType extends Enum {
readonly isFixedPart: boolean;
readonly asFixedPart: RmrkTraitsPartFixedPart;
@@ -2883,14 +2883,14 @@
readonly type: 'FixedPart' | 'SlotPart';
}
- /** @name RmrkTraitsPartFixedPart (308) */
+ /** @name RmrkTraitsPartFixedPart (310) */
interface RmrkTraitsPartFixedPart extends Struct {
readonly id: u32;
readonly z: u32;
readonly src: Bytes;
}
- /** @name RmrkTraitsPartSlotPart (309) */
+ /** @name RmrkTraitsPartSlotPart (311) */
interface RmrkTraitsPartSlotPart extends Struct {
readonly id: u32;
readonly equippable: RmrkTraitsPartEquippableList;
@@ -2898,7 +2898,7 @@
readonly z: u32;
}
- /** @name RmrkTraitsPartEquippableList (310) */
+ /** @name RmrkTraitsPartEquippableList (312) */
interface RmrkTraitsPartEquippableList extends Enum {
readonly isAll: boolean;
readonly isEmpty: boolean;
@@ -2907,20 +2907,20 @@
readonly type: 'All' | 'Empty' | 'Custom';
}
- /** @name RmrkTraitsTheme (312) */
+ /** @name RmrkTraitsTheme (314) */
interface RmrkTraitsTheme extends Struct {
readonly name: Bytes;
readonly properties: Vec<RmrkTraitsThemeThemeProperty>;
readonly inherit: bool;
}
- /** @name RmrkTraitsThemeThemeProperty (314) */
+ /** @name RmrkTraitsThemeThemeProperty (316) */
interface RmrkTraitsThemeThemeProperty extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name PalletAppPromotionCall (316) */
+ /** @name PalletAppPromotionCall (318) */
interface PalletAppPromotionCall extends Enum {
readonly isSetAdminAddress: boolean;
readonly asSetAdminAddress: {
@@ -2954,7 +2954,7 @@
readonly type: 'SetAdminAddress' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorContract' | 'StopSponsoringContract' | 'PayoutStakers';
}
- /** @name PalletForeignAssetsModuleCall (318) */
+ /** @name PalletForeignAssetsModuleCall (320) */
interface PalletForeignAssetsModuleCall extends Enum {
readonly isRegisterForeignAsset: boolean;
readonly asRegisterForeignAsset: {
@@ -2971,7 +2971,7 @@
readonly type: 'RegisterForeignAsset' | 'UpdateForeignAsset';
}
- /** @name PalletEvmCall (319) */
+ /** @name PalletEvmCall (321) */
interface PalletEvmCall extends Enum {
readonly isWithdraw: boolean;
readonly asWithdraw: {
@@ -3016,7 +3016,7 @@
readonly type: 'Withdraw' | 'Call' | 'Create' | 'Create2';
}
- /** @name PalletEthereumCall (323) */
+ /** @name PalletEthereumCall (325) */
interface PalletEthereumCall extends Enum {
readonly isTransact: boolean;
readonly asTransact: {
@@ -3025,7 +3025,7 @@
readonly type: 'Transact';
}
- /** @name EthereumTransactionTransactionV2 (324) */
+ /** @name EthereumTransactionTransactionV2 (326) */
interface EthereumTransactionTransactionV2 extends Enum {
readonly isLegacy: boolean;
readonly asLegacy: EthereumTransactionLegacyTransaction;
@@ -3036,7 +3036,7 @@
readonly type: 'Legacy' | 'Eip2930' | 'Eip1559';
}
- /** @name EthereumTransactionLegacyTransaction (325) */
+ /** @name EthereumTransactionLegacyTransaction (327) */
interface EthereumTransactionLegacyTransaction extends Struct {
readonly nonce: U256;
readonly gasPrice: U256;
@@ -3047,7 +3047,7 @@
readonly signature: EthereumTransactionTransactionSignature;
}
- /** @name EthereumTransactionTransactionAction (326) */
+ /** @name EthereumTransactionTransactionAction (328) */
interface EthereumTransactionTransactionAction extends Enum {
readonly isCall: boolean;
readonly asCall: H160;
@@ -3055,14 +3055,14 @@
readonly type: 'Call' | 'Create';
}
- /** @name EthereumTransactionTransactionSignature (327) */
+ /** @name EthereumTransactionTransactionSignature (329) */
interface EthereumTransactionTransactionSignature extends Struct {
readonly v: u64;
readonly r: H256;
readonly s: H256;
}
- /** @name EthereumTransactionEip2930Transaction (329) */
+ /** @name EthereumTransactionEip2930Transaction (331) */
interface EthereumTransactionEip2930Transaction extends Struct {
readonly chainId: u64;
readonly nonce: U256;
@@ -3077,13 +3077,13 @@
readonly s: H256;
}
- /** @name EthereumTransactionAccessListItem (331) */
+ /** @name EthereumTransactionAccessListItem (333) */
interface EthereumTransactionAccessListItem extends Struct {
readonly address: H160;
readonly storageKeys: Vec<H256>;
}
- /** @name EthereumTransactionEip1559Transaction (332) */
+ /** @name EthereumTransactionEip1559Transaction (334) */
interface EthereumTransactionEip1559Transaction extends Struct {
readonly chainId: u64;
readonly nonce: U256;
@@ -3099,7 +3099,7 @@
readonly s: H256;
}
- /** @name PalletEvmMigrationCall (333) */
+ /** @name PalletEvmMigrationCall (335) */
interface PalletEvmMigrationCall extends Enum {
readonly isBegin: boolean;
readonly asBegin: {
@@ -3118,13 +3118,13 @@
readonly type: 'Begin' | 'SetData' | 'Finish';
}
- /** @name PalletSudoError (336) */
+ /** @name PalletSudoError (338) */
interface PalletSudoError extends Enum {
readonly isRequireSudo: boolean;
readonly type: 'RequireSudo';
}
- /** @name OrmlVestingModuleError (338) */
+ /** @name OrmlVestingModuleError (340) */
interface OrmlVestingModuleError extends Enum {
readonly isZeroVestingPeriod: boolean;
readonly isZeroVestingPeriodCount: boolean;
@@ -3135,7 +3135,7 @@
readonly type: 'ZeroVestingPeriod' | 'ZeroVestingPeriodCount' | 'InsufficientBalanceToLock' | 'TooManyVestingSchedules' | 'AmountLow' | 'MaxVestingSchedulesExceeded';
}
- /** @name OrmlXtokensModuleError (339) */
+ /** @name OrmlXtokensModuleError (341) */
interface OrmlXtokensModuleError extends Enum {
readonly isAssetHasNoReserve: boolean;
readonly isNotCrossChainTransfer: boolean;
@@ -3159,26 +3159,26 @@
readonly type: 'AssetHasNoReserve' | 'NotCrossChainTransfer' | 'InvalidDest' | 'NotCrossChainTransferableCurrency' | 'UnweighableMessage' | 'XcmExecutionFailed' | 'CannotReanchor' | 'InvalidAncestry' | 'InvalidAsset' | 'DestinationNotInvertible' | 'BadVersion' | 'DistinctReserveForAssetAndFee' | 'ZeroFee' | 'ZeroAmount' | 'TooManyAssetsBeingSent' | 'AssetIndexNonExistent' | 'FeeNotEnough' | 'NotSupportedMultiLocation' | 'MinXcmFeeNotDefined';
}
- /** @name OrmlTokensBalanceLock (342) */
+ /** @name OrmlTokensBalanceLock (344) */
interface OrmlTokensBalanceLock extends Struct {
readonly id: U8aFixed;
readonly amount: u128;
}
- /** @name OrmlTokensAccountData (344) */
+ /** @name OrmlTokensAccountData (346) */
interface OrmlTokensAccountData extends Struct {
readonly free: u128;
readonly reserved: u128;
readonly frozen: u128;
}
- /** @name OrmlTokensReserveData (346) */
+ /** @name OrmlTokensReserveData (348) */
interface OrmlTokensReserveData extends Struct {
readonly id: Null;
readonly amount: u128;
}
- /** @name OrmlTokensModuleError (348) */
+ /** @name OrmlTokensModuleError (350) */
interface OrmlTokensModuleError extends Enum {
readonly isBalanceTooLow: boolean;
readonly isAmountIntoBalanceFailed: boolean;
@@ -3191,21 +3191,21 @@
readonly type: 'BalanceTooLow' | 'AmountIntoBalanceFailed' | 'LiquidityRestrictions' | 'MaxLocksExceeded' | 'KeepAlive' | 'ExistentialDeposit' | 'DeadAccount' | 'TooManyReserves';
}
- /** @name CumulusPalletXcmpQueueInboundChannelDetails (350) */
+ /** @name CumulusPalletXcmpQueueInboundChannelDetails (352) */
interface CumulusPalletXcmpQueueInboundChannelDetails extends Struct {
readonly sender: u32;
readonly state: CumulusPalletXcmpQueueInboundState;
readonly messageMetadata: Vec<ITuple<[u32, PolkadotParachainPrimitivesXcmpMessageFormat]>>;
}
- /** @name CumulusPalletXcmpQueueInboundState (351) */
+ /** @name CumulusPalletXcmpQueueInboundState (353) */
interface CumulusPalletXcmpQueueInboundState extends Enum {
readonly isOk: boolean;
readonly isSuspended: boolean;
readonly type: 'Ok' | 'Suspended';
}
- /** @name PolkadotParachainPrimitivesXcmpMessageFormat (354) */
+ /** @name PolkadotParachainPrimitivesXcmpMessageFormat (356) */
interface PolkadotParachainPrimitivesXcmpMessageFormat extends Enum {
readonly isConcatenatedVersionedXcm: boolean;
readonly isConcatenatedEncodedBlob: boolean;
@@ -3213,7 +3213,7 @@
readonly type: 'ConcatenatedVersionedXcm' | 'ConcatenatedEncodedBlob' | 'Signals';
}
- /** @name CumulusPalletXcmpQueueOutboundChannelDetails (357) */
+ /** @name CumulusPalletXcmpQueueOutboundChannelDetails (359) */
interface CumulusPalletXcmpQueueOutboundChannelDetails extends Struct {
readonly recipient: u32;
readonly state: CumulusPalletXcmpQueueOutboundState;
@@ -3222,24 +3222,24 @@
readonly lastIndex: u16;
}
- /** @name CumulusPalletXcmpQueueOutboundState (358) */
+ /** @name CumulusPalletXcmpQueueOutboundState (360) */
interface CumulusPalletXcmpQueueOutboundState extends Enum {
readonly isOk: boolean;
readonly isSuspended: boolean;
readonly type: 'Ok' | 'Suspended';
}
- /** @name CumulusPalletXcmpQueueQueueConfigData (360) */
+ /** @name CumulusPalletXcmpQueueQueueConfigData (362) */
interface CumulusPalletXcmpQueueQueueConfigData extends Struct {
readonly suspendThreshold: u32;
readonly dropThreshold: u32;
readonly resumeThreshold: u32;
- readonly thresholdWeight: u64;
- readonly weightRestrictDecay: u64;
- readonly xcmpMaxIndividualWeight: u64;
+ readonly thresholdWeight: Weight;
+ readonly weightRestrictDecay: Weight;
+ readonly xcmpMaxIndividualWeight: Weight;
}
- /** @name CumulusPalletXcmpQueueError (362) */
+ /** @name CumulusPalletXcmpQueueError (364) */
interface CumulusPalletXcmpQueueError extends Enum {
readonly isFailedToSend: boolean;
readonly isBadXcmOrigin: boolean;
@@ -3249,7 +3249,7 @@
readonly type: 'FailedToSend' | 'BadXcmOrigin' | 'BadXcm' | 'BadOverweightIndex' | 'WeightOverLimit';
}
- /** @name PalletXcmError (363) */
+ /** @name PalletXcmError (365) */
interface PalletXcmError extends Enum {
readonly isUnreachable: boolean;
readonly isSendFailure: boolean;
@@ -3267,29 +3267,29 @@
readonly type: 'Unreachable' | 'SendFailure' | 'Filtered' | 'UnweighableMessage' | 'DestinationNotInvertible' | 'Empty' | 'CannotReanchor' | 'TooManyAssets' | 'InvalidOrigin' | 'BadVersion' | 'BadLocation' | 'NoSubscription' | 'AlreadySubscribed';
}
- /** @name CumulusPalletXcmError (364) */
+ /** @name CumulusPalletXcmError (366) */
type CumulusPalletXcmError = Null;
- /** @name CumulusPalletDmpQueueConfigData (365) */
+ /** @name CumulusPalletDmpQueueConfigData (367) */
interface CumulusPalletDmpQueueConfigData extends Struct {
- readonly maxIndividual: u64;
+ readonly maxIndividual: Weight;
}
- /** @name CumulusPalletDmpQueuePageIndexData (366) */
+ /** @name CumulusPalletDmpQueuePageIndexData (368) */
interface CumulusPalletDmpQueuePageIndexData extends Struct {
readonly beginUsed: u32;
readonly endUsed: u32;
readonly overweightCount: u64;
}
- /** @name CumulusPalletDmpQueueError (369) */
+ /** @name CumulusPalletDmpQueueError (371) */
interface CumulusPalletDmpQueueError extends Enum {
readonly isUnknown: boolean;
readonly isOverLimit: boolean;
readonly type: 'Unknown' | 'OverLimit';
}
- /** @name PalletUniqueError (373) */
+ /** @name PalletUniqueError (375) */
interface PalletUniqueError extends Enum {
readonly isCollectionDecimalPointLimitExceeded: boolean;
readonly isConfirmUnsetSponsorFail: boolean;
@@ -3298,7 +3298,7 @@
readonly type: 'CollectionDecimalPointLimitExceeded' | 'ConfirmUnsetSponsorFail' | 'EmptyArgument' | 'RepartitionCalledOnNonRefungibleCollection';
}
- /** @name PalletUniqueSchedulerScheduledV3 (376) */
+ /** @name PalletUniqueSchedulerScheduledV3 (378) */
interface PalletUniqueSchedulerScheduledV3 extends Struct {
readonly maybeId: Option<U8aFixed>;
readonly priority: u8;
@@ -3307,7 +3307,7 @@
readonly origin: OpalRuntimeOriginCaller;
}
- /** @name OpalRuntimeOriginCaller (377) */
+ /** @name OpalRuntimeOriginCaller (379) */
interface OpalRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSupportDispatchRawOrigin;
@@ -3321,7 +3321,7 @@
readonly type: 'System' | 'Void' | 'PolkadotXcm' | 'CumulusXcm' | 'Ethereum';
}
- /** @name FrameSupportDispatchRawOrigin (378) */
+ /** @name FrameSupportDispatchRawOrigin (380) */
interface FrameSupportDispatchRawOrigin extends Enum {
readonly isRoot: boolean;
readonly isSigned: boolean;
@@ -3330,7 +3330,7 @@
readonly type: 'Root' | 'Signed' | 'None';
}
- /** @name PalletXcmOrigin (379) */
+ /** @name PalletXcmOrigin (381) */
interface PalletXcmOrigin extends Enum {
readonly isXcm: boolean;
readonly asXcm: XcmV1MultiLocation;
@@ -3339,7 +3339,7 @@
readonly type: 'Xcm' | 'Response';
}
- /** @name CumulusPalletXcmOrigin (380) */
+ /** @name CumulusPalletXcmOrigin (382) */
interface CumulusPalletXcmOrigin extends Enum {
readonly isRelay: boolean;
readonly isSiblingParachain: boolean;
@@ -3347,17 +3347,17 @@
readonly type: 'Relay' | 'SiblingParachain';
}
- /** @name PalletEthereumRawOrigin (381) */
+ /** @name PalletEthereumRawOrigin (383) */
interface PalletEthereumRawOrigin extends Enum {
readonly isEthereumTransaction: boolean;
readonly asEthereumTransaction: H160;
readonly type: 'EthereumTransaction';
}
- /** @name SpCoreVoid (382) */
+ /** @name SpCoreVoid (384) */
type SpCoreVoid = Null;
- /** @name PalletUniqueSchedulerError (383) */
+ /** @name PalletUniqueSchedulerError (385) */
interface PalletUniqueSchedulerError extends Enum {
readonly isFailedToSchedule: boolean;
readonly isNotFound: boolean;
@@ -3366,7 +3366,7 @@
readonly type: 'FailedToSchedule' | 'NotFound' | 'TargetBlockNumberInPast' | 'RescheduleNoChange';
}
- /** @name UpDataStructsCollection (384) */
+ /** @name UpDataStructsCollection (386) */
interface UpDataStructsCollection extends Struct {
readonly owner: AccountId32;
readonly mode: UpDataStructsCollectionMode;
@@ -3379,7 +3379,7 @@
readonly flags: U8aFixed;
}
- /** @name UpDataStructsSponsorshipStateAccountId32 (385) */
+ /** @name UpDataStructsSponsorshipStateAccountId32 (387) */
interface UpDataStructsSponsorshipStateAccountId32 extends Enum {
readonly isDisabled: boolean;
readonly isUnconfirmed: boolean;
@@ -3389,43 +3389,43 @@
readonly type: 'Disabled' | 'Unconfirmed' | 'Confirmed';
}
- /** @name UpDataStructsProperties (387) */
+ /** @name UpDataStructsProperties (389) */
interface UpDataStructsProperties extends Struct {
readonly map: UpDataStructsPropertiesMapBoundedVec;
readonly consumedSpace: u32;
readonly spaceLimit: u32;
}
- /** @name UpDataStructsPropertiesMapBoundedVec (388) */
+ /** @name UpDataStructsPropertiesMapBoundedVec (390) */
interface UpDataStructsPropertiesMapBoundedVec extends BTreeMap<Bytes, Bytes> {}
- /** @name UpDataStructsPropertiesMapPropertyPermission (393) */
+ /** @name UpDataStructsPropertiesMapPropertyPermission (395) */
interface UpDataStructsPropertiesMapPropertyPermission extends BTreeMap<Bytes, UpDataStructsPropertyPermission> {}
- /** @name UpDataStructsCollectionStats (400) */
+ /** @name UpDataStructsCollectionStats (402) */
interface UpDataStructsCollectionStats extends Struct {
readonly created: u32;
readonly destroyed: u32;
readonly alive: u32;
}
- /** @name UpDataStructsTokenChild (401) */
+ /** @name UpDataStructsTokenChild (403) */
interface UpDataStructsTokenChild extends Struct {
readonly token: u32;
readonly collection: u32;
}
- /** @name PhantomTypeUpDataStructs (402) */
+ /** @name PhantomTypeUpDataStructs (404) */
interface PhantomTypeUpDataStructs extends Vec<ITuple<[UpDataStructsTokenData, UpDataStructsRpcCollection, RmrkTraitsCollectionCollectionInfo, RmrkTraitsNftNftInfo, RmrkTraitsResourceResourceInfo, RmrkTraitsPropertyPropertyInfo, RmrkTraitsBaseBaseInfo, RmrkTraitsPartPartType, RmrkTraitsTheme, RmrkTraitsNftNftChild]>> {}
- /** @name UpDataStructsTokenData (404) */
+ /** @name UpDataStructsTokenData (406) */
interface UpDataStructsTokenData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: Option<PalletEvmAccountBasicCrossAccountIdRepr>;
readonly pieces: u128;
}
- /** @name UpDataStructsRpcCollection (406) */
+ /** @name UpDataStructsRpcCollection (408) */
interface UpDataStructsRpcCollection extends Struct {
readonly owner: AccountId32;
readonly mode: UpDataStructsCollectionMode;
@@ -3441,7 +3441,7 @@
readonly foreign: bool;
}
- /** @name RmrkTraitsCollectionCollectionInfo (407) */
+ /** @name RmrkTraitsCollectionCollectionInfo (409) */
interface RmrkTraitsCollectionCollectionInfo extends Struct {
readonly issuer: AccountId32;
readonly metadata: Bytes;
@@ -3450,7 +3450,7 @@
readonly nftsCount: u32;
}
- /** @name RmrkTraitsNftNftInfo (408) */
+ /** @name RmrkTraitsNftNftInfo (410) */
interface RmrkTraitsNftNftInfo extends Struct {
readonly owner: RmrkTraitsNftAccountIdOrCollectionNftTuple;
readonly royalty: Option<RmrkTraitsNftRoyaltyInfo>;
@@ -3459,13 +3459,13 @@
readonly pending: bool;
}
- /** @name RmrkTraitsNftRoyaltyInfo (410) */
+ /** @name RmrkTraitsNftRoyaltyInfo (412) */
interface RmrkTraitsNftRoyaltyInfo extends Struct {
readonly recipient: AccountId32;
readonly amount: Permill;
}
- /** @name RmrkTraitsResourceResourceInfo (411) */
+ /** @name RmrkTraitsResourceResourceInfo (413) */
interface RmrkTraitsResourceResourceInfo extends Struct {
readonly id: u32;
readonly resource: RmrkTraitsResourceResourceTypes;
@@ -3473,26 +3473,26 @@
readonly pendingRemoval: bool;
}
- /** @name RmrkTraitsPropertyPropertyInfo (412) */
+ /** @name RmrkTraitsPropertyPropertyInfo (414) */
interface RmrkTraitsPropertyPropertyInfo extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name RmrkTraitsBaseBaseInfo (413) */
+ /** @name RmrkTraitsBaseBaseInfo (415) */
interface RmrkTraitsBaseBaseInfo extends Struct {
readonly issuer: AccountId32;
readonly baseType: Bytes;
readonly symbol: Bytes;
}
- /** @name RmrkTraitsNftNftChild (414) */
+ /** @name RmrkTraitsNftNftChild (416) */
interface RmrkTraitsNftNftChild extends Struct {
readonly collectionId: u32;
readonly nftId: u32;
}
- /** @name PalletCommonError (416) */
+ /** @name PalletCommonError (418) */
interface PalletCommonError extends Enum {
readonly isCollectionNotFound: boolean;
readonly isMustBeTokenOwner: boolean;
@@ -3531,7 +3531,7 @@
readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal';
}
- /** @name PalletFungibleError (418) */
+ /** @name PalletFungibleError (420) */
interface PalletFungibleError extends Enum {
readonly isNotFungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isFungibleItemsHaveNoId: boolean;
@@ -3541,12 +3541,12 @@
readonly type: 'NotFungibleDataUsedToMintFungibleCollectionToken' | 'FungibleItemsHaveNoId' | 'FungibleItemsDontHaveData' | 'FungibleDisallowsNesting' | 'SettingPropertiesNotAllowed';
}
- /** @name PalletRefungibleItemData (419) */
+ /** @name PalletRefungibleItemData (421) */
interface PalletRefungibleItemData extends Struct {
readonly constData: Bytes;
}
- /** @name PalletRefungibleError (424) */
+ /** @name PalletRefungibleError (426) */
interface PalletRefungibleError extends Enum {
readonly isNotRefungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isWrongRefungiblePieces: boolean;
@@ -3556,19 +3556,19 @@
readonly type: 'NotRefungibleDataUsedToMintFungibleCollectionToken' | 'WrongRefungiblePieces' | 'RepartitionWhileNotOwningAllPieces' | 'RefungibleDisallowsNesting' | 'SettingPropertiesNotAllowed';
}
- /** @name PalletNonfungibleItemData (425) */
+ /** @name PalletNonfungibleItemData (427) */
interface PalletNonfungibleItemData extends Struct {
readonly owner: PalletEvmAccountBasicCrossAccountIdRepr;
}
- /** @name UpDataStructsPropertyScope (427) */
+ /** @name UpDataStructsPropertyScope (429) */
interface UpDataStructsPropertyScope extends Enum {
readonly isNone: boolean;
readonly isRmrk: boolean;
readonly type: 'None' | 'Rmrk';
}
- /** @name PalletNonfungibleError (429) */
+ /** @name PalletNonfungibleError (431) */
interface PalletNonfungibleError extends Enum {
readonly isNotNonfungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isNonfungibleItemsHaveNoAmount: boolean;
@@ -3576,7 +3576,7 @@
readonly type: 'NotNonfungibleDataUsedToMintFungibleCollectionToken' | 'NonfungibleItemsHaveNoAmount' | 'CantBurnNftWithChildren';
}
- /** @name PalletStructureError (430) */
+ /** @name PalletStructureError (432) */
interface PalletStructureError extends Enum {
readonly isOuroborosDetected: boolean;
readonly isDepthLimit: boolean;
@@ -3585,7 +3585,7 @@
readonly type: 'OuroborosDetected' | 'DepthLimit' | 'BreadthLimit' | 'TokenNotFound';
}
- /** @name PalletRmrkCoreError (431) */
+ /** @name PalletRmrkCoreError (433) */
interface PalletRmrkCoreError extends Enum {
readonly isCorruptedCollectionType: boolean;
readonly isRmrkPropertyKeyIsTooLong: boolean;
@@ -3609,7 +3609,7 @@
readonly type: 'CorruptedCollectionType' | 'RmrkPropertyKeyIsTooLong' | 'RmrkPropertyValueIsTooLong' | 'RmrkPropertyIsNotFound' | 'UnableToDecodeRmrkData' | 'CollectionNotEmpty' | 'NoAvailableCollectionId' | 'NoAvailableNftId' | 'CollectionUnknown' | 'NoPermission' | 'NonTransferable' | 'CollectionFullOrLocked' | 'ResourceDoesntExist' | 'CannotSendToDescendentOrSelf' | 'CannotAcceptNonOwnedNft' | 'CannotRejectNonOwnedNft' | 'CannotRejectNonPendingNft' | 'ResourceNotPending' | 'NoAvailableResourceId';
}
- /** @name PalletRmrkEquipError (433) */
+ /** @name PalletRmrkEquipError (435) */
interface PalletRmrkEquipError extends Enum {
readonly isPermissionError: boolean;
readonly isNoAvailableBaseId: boolean;
@@ -3621,7 +3621,7 @@
readonly type: 'PermissionError' | 'NoAvailableBaseId' | 'NoAvailablePartId' | 'BaseDoesntExist' | 'NeedsDefaultThemeFirst' | 'PartDoesntExist' | 'NoEquippableOnFixedPart';
}
- /** @name PalletAppPromotionError (439) */
+ /** @name PalletAppPromotionError (441) */
interface PalletAppPromotionError extends Enum {
readonly isAdminNotSet: boolean;
readonly isNoPermission: boolean;
@@ -3632,7 +3632,7 @@
readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFunds' | 'PendingForBlockOverflow' | 'SponsorNotSet' | 'IncorrectLockedBalanceOperation';
}
- /** @name PalletForeignAssetsModuleError (440) */
+ /** @name PalletForeignAssetsModuleError (442) */
interface PalletForeignAssetsModuleError extends Enum {
readonly isBadLocation: boolean;
readonly isMultiLocationExisted: boolean;
@@ -3641,7 +3641,7 @@
readonly type: 'BadLocation' | 'MultiLocationExisted' | 'AssetIdNotExists' | 'AssetIdExisted';
}
- /** @name PalletEvmError (443) */
+ /** @name PalletEvmError (445) */
interface PalletEvmError extends Enum {
readonly isBalanceLow: boolean;
readonly isFeeOverflow: boolean;
@@ -3652,7 +3652,7 @@
readonly type: 'BalanceLow' | 'FeeOverflow' | 'PaymentOverflow' | 'WithdrawFailed' | 'GasPriceTooLow' | 'InvalidNonce';
}
- /** @name FpRpcTransactionStatus (446) */
+ /** @name FpRpcTransactionStatus (448) */
interface FpRpcTransactionStatus extends Struct {
readonly transactionHash: H256;
readonly transactionIndex: u32;
@@ -3663,10 +3663,10 @@
readonly logsBloom: EthbloomBloom;
}
- /** @name EthbloomBloom (448) */
+ /** @name EthbloomBloom (450) */
interface EthbloomBloom extends U8aFixed {}
- /** @name EthereumReceiptReceiptV3 (450) */
+ /** @name EthereumReceiptReceiptV3 (452) */
interface EthereumReceiptReceiptV3 extends Enum {
readonly isLegacy: boolean;
readonly asLegacy: EthereumReceiptEip658ReceiptData;
@@ -3677,7 +3677,7 @@
readonly type: 'Legacy' | 'Eip2930' | 'Eip1559';
}
- /** @name EthereumReceiptEip658ReceiptData (451) */
+ /** @name EthereumReceiptEip658ReceiptData (453) */
interface EthereumReceiptEip658ReceiptData extends Struct {
readonly statusCode: u8;
readonly usedGas: U256;
@@ -3685,14 +3685,14 @@
readonly logs: Vec<EthereumLog>;
}
- /** @name EthereumBlock (452) */
+ /** @name EthereumBlock (454) */
interface EthereumBlock extends Struct {
readonly header: EthereumHeader;
readonly transactions: Vec<EthereumTransactionTransactionV2>;
readonly ommers: Vec<EthereumHeader>;
}
- /** @name EthereumHeader (453) */
+ /** @name EthereumHeader (455) */
interface EthereumHeader extends Struct {
readonly parentHash: H256;
readonly ommersHash: H256;
@@ -3711,24 +3711,24 @@
readonly nonce: EthereumTypesHashH64;
}
- /** @name EthereumTypesHashH64 (454) */
+ /** @name EthereumTypesHashH64 (456) */
interface EthereumTypesHashH64 extends U8aFixed {}
- /** @name PalletEthereumError (459) */
+ /** @name PalletEthereumError (461) */
interface PalletEthereumError extends Enum {
readonly isInvalidSignature: boolean;
readonly isPreLogExists: boolean;
readonly type: 'InvalidSignature' | 'PreLogExists';
}
- /** @name PalletEvmCoderSubstrateError (460) */
+ /** @name PalletEvmCoderSubstrateError (462) */
interface PalletEvmCoderSubstrateError extends Enum {
readonly isOutOfGas: boolean;
readonly isOutOfFund: boolean;
readonly type: 'OutOfGas' | 'OutOfFund';
}
- /** @name UpDataStructsSponsorshipStateBasicCrossAccountIdRepr (461) */
+ /** @name UpDataStructsSponsorshipStateBasicCrossAccountIdRepr (463) */
interface UpDataStructsSponsorshipStateBasicCrossAccountIdRepr extends Enum {
readonly isDisabled: boolean;
readonly isUnconfirmed: boolean;
@@ -3738,7 +3738,7 @@
readonly type: 'Disabled' | 'Unconfirmed' | 'Confirmed';
}
- /** @name PalletEvmContractHelpersSponsoringModeT (462) */
+ /** @name PalletEvmContractHelpersSponsoringModeT (464) */
interface PalletEvmContractHelpersSponsoringModeT extends Enum {
readonly isDisabled: boolean;
readonly isAllowlisted: boolean;
@@ -3746,7 +3746,7 @@
readonly type: 'Disabled' | 'Allowlisted' | 'Generous';
}
- /** @name PalletEvmContractHelpersError (468) */
+ /** @name PalletEvmContractHelpersError (470) */
interface PalletEvmContractHelpersError extends Enum {
readonly isNoPermission: boolean;
readonly isNoPendingSponsor: boolean;
@@ -3754,14 +3754,14 @@
readonly type: 'NoPermission' | 'NoPendingSponsor' | 'TooManyMethodsHaveSponsoredLimit';
}
- /** @name PalletEvmMigrationError (469) */
+ /** @name PalletEvmMigrationError (471) */
interface PalletEvmMigrationError extends Enum {
readonly isAccountNotEmpty: boolean;
readonly isAccountIsNotMigrating: boolean;
readonly type: 'AccountNotEmpty' | 'AccountIsNotMigrating';
}
- /** @name SpRuntimeMultiSignature (471) */
+ /** @name SpRuntimeMultiSignature (473) */
interface SpRuntimeMultiSignature extends Enum {
readonly isEd25519: boolean;
readonly asEd25519: SpCoreEd25519Signature;
@@ -3772,37 +3772,37 @@
readonly type: 'Ed25519' | 'Sr25519' | 'Ecdsa';
}
- /** @name SpCoreEd25519Signature (472) */
+ /** @name SpCoreEd25519Signature (474) */
interface SpCoreEd25519Signature extends U8aFixed {}
- /** @name SpCoreSr25519Signature (474) */
+ /** @name SpCoreSr25519Signature (476) */
interface SpCoreSr25519Signature extends U8aFixed {}
- /** @name SpCoreEcdsaSignature (475) */
+ /** @name SpCoreEcdsaSignature (477) */
interface SpCoreEcdsaSignature extends U8aFixed {}
- /** @name FrameSystemExtensionsCheckSpecVersion (478) */
+ /** @name FrameSystemExtensionsCheckSpecVersion (480) */
type FrameSystemExtensionsCheckSpecVersion = Null;
- /** @name FrameSystemExtensionsCheckTxVersion (479) */
+ /** @name FrameSystemExtensionsCheckTxVersion (481) */
type FrameSystemExtensionsCheckTxVersion = Null;
- /** @name FrameSystemExtensionsCheckGenesis (480) */
+ /** @name FrameSystemExtensionsCheckGenesis (482) */
type FrameSystemExtensionsCheckGenesis = Null;
- /** @name FrameSystemExtensionsCheckNonce (483) */
+ /** @name FrameSystemExtensionsCheckNonce (485) */
interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
- /** @name FrameSystemExtensionsCheckWeight (484) */
+ /** @name FrameSystemExtensionsCheckWeight (486) */
type FrameSystemExtensionsCheckWeight = Null;
- /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (485) */
+ /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (487) */
interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
- /** @name OpalRuntimeRuntime (486) */
+ /** @name OpalRuntimeRuntime (488) */
type OpalRuntimeRuntime = Null;
- /** @name PalletEthereumFakeTransactionFinalizer (487) */
+ /** @name PalletEthereumFakeTransactionFinalizer (489) */
type PalletEthereumFakeTransactionFinalizer = Null;
} // declare module
tests/src/limits.test.tsdiffbeforeafterboth--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util/playgrounds';
+import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
describe('Number of tokens per address (NFT)', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -60,7 +60,7 @@
await usingPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
@@ -292,7 +292,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
@@ -333,7 +333,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
@@ -366,7 +366,7 @@
await usingPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
});
});
@@ -404,7 +404,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/nesting/collectionProperties.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/nesting/collectionProperties.test.ts
@@ -0,0 +1,261 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, Pallets, usingPlaygrounds, expect} from '../util';
+import {UniqueBaseCollection} from '../util/playgrounds/unique';
+
+describe('Integration Test: Collection Properties', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
+ });
+ });
+
+ itSub('Properties are initially empty', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(alice);
+ expect(await collection.getProperties()).to.be.empty;
+ });
+
+ async function testSetsPropertiesForCollection(collection: UniqueBaseCollection) {
+ // As owner
+ await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}])).to.be.fulfilled;
+
+ await collection.addAdmin(alice, {Substrate: bob.address});
+
+ // As administrator
+ await expect(collection.setProperties(bob, [{key: 'black_hole'}])).to.be.fulfilled;
+
+ const properties = await collection.getProperties();
+ expect(properties).to.include.deep.members([
+ {key: 'electron', value: 'come bond'},
+ {key: 'black_hole', value: ''},
+ ]);
+ }
+
+ itSub('Sets properties for a NFT collection', async ({helper}) => {
+ await testSetsPropertiesForCollection(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Sets properties for a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+ await testSetsPropertiesForCollection(await helper.rft.mintCollection(alice));
+ });
+
+ async function testCheckValidNames(collection: UniqueBaseCollection) {
+ // alpha symbols
+ await expect(collection.setProperties(alice, [{key: 'answer'}])).to.be.fulfilled;
+
+ // numeric symbols
+ await expect(collection.setProperties(alice, [{key: '451'}])).to.be.fulfilled;
+
+ // underscore symbol
+ await expect(collection.setProperties(alice, [{key: 'black_hole'}])).to.be.fulfilled;
+
+ // dash symbol
+ await expect(collection.setProperties(alice, [{key: '-'}])).to.be.fulfilled;
+
+ // dot symbol
+ await expect(collection.setProperties(alice, [{key: 'once.in.a.long.long.while...', value: 'you get a little lost'}])).to.be.fulfilled;
+
+ const properties = await collection.getProperties();
+ expect(properties).to.include.deep.members([
+ {key: 'answer', value: ''},
+ {key: '451', value: ''},
+ {key: 'black_hole', value: ''},
+ {key: '-', value: ''},
+ {key: 'once.in.a.long.long.while...', value: 'you get a little lost'},
+ ]);
+ }
+
+ itSub('Check valid names for NFT collection properties keys', async ({helper}) => {
+ await testCheckValidNames(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Check valid names for ReFungible collection properties keys', [Pallets.ReFungible], async ({helper}) => {
+ await testCheckValidNames(await helper.rft.mintCollection(alice));
+ });
+
+ 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
+ await expect(collection.setProperties(alice, [{key: 'black_hole', value: 'LIGO'}])).to.be.fulfilled;
+
+ const properties = await collection.getProperties();
+ expect(properties).to.include.deep.members([
+ {key: 'electron', value: 'come bond'},
+ {key: 'black_hole', value: 'LIGO'},
+ ]);
+ }
+
+ itSub('Changes properties of a NFT collection', async ({helper}) => {
+ await testChangesProperties(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Changes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+ await testChangesProperties(await helper.rft.mintCollection(alice));
+ });
+
+ 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;
+
+ const properties = await collection.getProperties(['black_hole', 'electron']);
+ expect(properties).to.be.deep.equal([
+ {key: 'black_hole', value: 'LIGO'},
+ ]);
+ }
+
+ itSub('Deletes properties of a NFT collection', async ({helper}) => {
+ await testDeleteProperties(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Deletes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+ await testDeleteProperties(await helper.rft.mintCollection(alice));
+ });
+});
+
+describe('Negative Integration Test: Collection Properties', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
+ });
+ });
+
+ 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/);
+
+ expect(await collection.getProperties()).to.be.empty;
+ }
+
+ itSub('Fails to set properties in a NFT collection if not its onwer/administrator', async ({helper}) => {
+ await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Fails to set properties in a ReFungible collection if not its onwer/administrator', [Pallets.ReFungible], async ({helper}) => {
+ await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.rft.mintCollection(alice));
+ });
+
+ 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
+ {
+ console.error = () => {};
+ await expect(collection.setProperties(alice, [
+ {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 9))},
+ ])).to.be.rejected;
+ }
+
+ expect(await collection.getProperties(['electron'])).to.be.empty;
+
+ await expect(collection.setProperties(alice, [
+ {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 18))},
+ {key: 'black_hole', value: '0'.repeat(Math.ceil(spaceLimit! / 2))},
+ ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
+
+ expect(await collection.getProperties(['electron', 'black_hole'])).to.be.empty;
+ }
+
+ itSub('Fails to set properties that exceed the limits (NFT)', async ({helper}) => {
+ await testFailsSetPropertiesThatExeedLimits(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Fails to set properties that exceed the limits (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testFailsSetPropertiesThatExeedLimits(await helper.rft.mintCollection(alice));
+ });
+
+ async function testFailsSetMorePropertiesThanAllowed(collection: UniqueBaseCollection) {
+ const propertiesToBeSet = [];
+ for (let i = 0; i < 65; i++) {
+ propertiesToBeSet.push({
+ key: 'electron_' + i,
+ value: Math.random() > 0.5 ? 'high' : 'low',
+ });
+ }
+
+ await expect(collection.setProperties(alice, propertiesToBeSet)).
+ to.be.rejectedWith(/common\.PropertyLimitReached/);
+
+ expect(await collection.getProperties()).to.be.empty;
+ }
+
+ itSub('Fails to set more properties than it is allowed (NFT)', async ({helper}) => {
+ await testFailsSetMorePropertiesThanAllowed(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Fails to set more properties than it is allowed (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testFailsSetMorePropertiesThanAllowed(await helper.rft.mintCollection(alice));
+ });
+
+ async function testFailsSetPropertiesWithInvalidNames(collection: UniqueBaseCollection) {
+ const invalidProperties = [
+ [{key: 'electron', value: 'negative'}, {key: 'string theory', value: 'understandable'}],
+ [{key: 'Mr/Sandman', value: 'Bring me a gene'}],
+ [{key: 'déjà vu', value: 'hmm...'}],
+ ];
+
+ for (let i = 0; i < invalidProperties.length; i++) {
+ await expect(
+ collection.setProperties(alice, invalidProperties[i]),
+ `on rejecting the new badly-named property #${i}`,
+ ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+ }
+
+ await expect(
+ collection.setProperties(alice, [{key: '', value: 'nothing must not exist'}]),
+ 'on rejecting an unnamed property',
+ ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
+
+ await expect(
+ collection.setProperties(alice, [{key: 'CRISPR-Cas9', value: 'rewriting nature!'}]),
+ 'on setting the correctly-but-still-badly-named property',
+ ).to.be.fulfilled;
+
+ const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat('CRISPR-Cas9').concat('');
+
+ const properties = await collection.getProperties(keys);
+ expect(properties).to.be.deep.equal([
+ {key: 'CRISPR-Cas9', value: 'rewriting nature!'},
+ ]);
+
+ for (let i = 0; i < invalidProperties.length; i++) {
+ await expect(
+ collection.deleteProperties(alice, invalidProperties[i].map(propertySet => propertySet.key)),
+ `on trying to delete the non-existent badly-named property #${i}`,
+ ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+ }
+ }
+
+ itSub('Fails to set properties with invalid names (NFT)', async ({helper}) => {
+ await testFailsSetPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Fails to set properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testFailsSetPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
+ });
+});
+
\ No newline at end of file
tests/src/nesting/graphs.test.tsdiffbeforeafterboth--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, usingPlaygrounds} from '../util/playgrounds';
+import {expect, itSub, usingPlaygrounds} from '../util';
import {UniqueHelper, UniqueNFToken} from '../util/playgrounds/unique';
/**
@@ -45,7 +45,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([10n], donor);
});
});
tests/src/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, usingPlaygrounds} from '../util/playgrounds';
+import {expect, itSub, Pallets, usingPlaygrounds} from '../util';
describe('Integration Test: Composite nesting tests', () => {
let alice: IKeyringPair;
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
});
});
@@ -137,7 +137,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([50n, 10n, 10n], donor);
});
});
@@ -343,7 +343,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 50n], donor);
});
});
tests/src/nesting/properties.test.tsdiffbeforeafterboth--- a/tests/src/nesting/properties.test.ts
+++ /dev/null
@@ -1,1047 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from '../util/playgrounds';
-import {UniqueHelper, UniqueBaseCollection, UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection, UniqueRFToken} from '../util/playgrounds/unique';
-
-// ---------- COLLECTION PROPERTIES
-
-describe('Integration Test: Collection Properties', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
- });
- });
-
- itSub('Properties are initially empty', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- expect(await collection.getProperties()).to.be.empty;
- });
-
- async function testSetsPropertiesForCollection(collection: UniqueBaseCollection) {
- // As owner
- await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}])).to.be.fulfilled;
-
- await collection.addAdmin(alice, {Substrate: bob.address});
-
- // As administrator
- await expect(collection.setProperties(bob, [{key: 'black_hole'}])).to.be.fulfilled;
-
- const properties = await collection.getProperties();
- expect(properties).to.include.deep.members([
- {key: 'electron', value: 'come bond'},
- {key: 'black_hole', value: ''},
- ]);
- }
-
- itSub('Sets properties for a NFT collection', async ({helper}) => {
- await testSetsPropertiesForCollection(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Sets properties for a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
- await testSetsPropertiesForCollection(await helper.rft.mintCollection(alice));
- });
-
- async function testCheckValidNames(collection: UniqueBaseCollection) {
- // alpha symbols
- await expect(collection.setProperties(alice, [{key: 'answer'}])).to.be.fulfilled;
-
- // numeric symbols
- await expect(collection.setProperties(alice, [{key: '451'}])).to.be.fulfilled;
-
- // underscore symbol
- await expect(collection.setProperties(alice, [{key: 'black_hole'}])).to.be.fulfilled;
-
- // dash symbol
- await expect(collection.setProperties(alice, [{key: '-'}])).to.be.fulfilled;
-
- // dot symbol
- await expect(collection.setProperties(alice, [{key: 'once.in.a.long.long.while...', value: 'you get a little lost'}])).to.be.fulfilled;
-
- const properties = await collection.getProperties();
- expect(properties).to.include.deep.members([
- {key: 'answer', value: ''},
- {key: '451', value: ''},
- {key: 'black_hole', value: ''},
- {key: '-', value: ''},
- {key: 'once.in.a.long.long.while...', value: 'you get a little lost'},
- ]);
- }
-
- itSub('Check valid names for NFT collection properties keys', async ({helper}) => {
- await testCheckValidNames(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Check valid names for ReFungible collection properties keys', [Pallets.ReFungible], async ({helper}) => {
- await testCheckValidNames(await helper.rft.mintCollection(alice));
- });
-
- 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
- await expect(collection.setProperties(alice, [{key: 'black_hole', value: 'LIGO'}])).to.be.fulfilled;
-
- const properties = await collection.getProperties();
- expect(properties).to.include.deep.members([
- {key: 'electron', value: 'come bond'},
- {key: 'black_hole', value: 'LIGO'},
- ]);
- }
-
- itSub('Changes properties of a NFT collection', async ({helper}) => {
- await testChangesProperties(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Changes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
- await testChangesProperties(await helper.rft.mintCollection(alice));
- });
-
- 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;
-
- const properties = await collection.getProperties(['black_hole', 'electron']);
- expect(properties).to.be.deep.equal([
- {key: 'black_hole', value: 'LIGO'},
- ]);
- }
-
- itSub('Deletes properties of a NFT collection', async ({helper}) => {
- await testDeleteProperties(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Deletes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
- await testDeleteProperties(await helper.rft.mintCollection(alice));
- });
-});
-
-describe('Negative Integration Test: Collection Properties', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
- });
- });
-
- 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/);
-
- expect(await collection.getProperties()).to.be.empty;
- }
-
- itSub('Fails to set properties in a NFT collection if not its onwer/administrator', async ({helper}) => {
- await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Fails to set properties in a ReFungible collection if not its onwer/administrator', [Pallets.ReFungible], async ({helper}) => {
- await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.rft.mintCollection(alice));
- });
-
- 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
- {
- console.error = () => {};
- await expect(collection.setProperties(alice, [
- {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 9))},
- ])).to.be.rejected;
- }
-
- expect(await collection.getProperties(['electron'])).to.be.empty;
-
- await expect(collection.setProperties(alice, [
- {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 18))},
- {key: 'black_hole', value: '0'.repeat(Math.ceil(spaceLimit! / 2))},
- ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
-
- expect(await collection.getProperties(['electron', 'black_hole'])).to.be.empty;
- }
-
- itSub('Fails to set properties that exceed the limits (NFT)', async ({helper}) => {
- await testFailsSetPropertiesThatExeedLimits(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Fails to set properties that exceed the limits (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testFailsSetPropertiesThatExeedLimits(await helper.rft.mintCollection(alice));
- });
-
- async function testFailsSetMorePropertiesThanAllowed(collection: UniqueBaseCollection) {
- const propertiesToBeSet = [];
- for (let i = 0; i < 65; i++) {
- propertiesToBeSet.push({
- key: 'electron_' + i,
- value: Math.random() > 0.5 ? 'high' : 'low',
- });
- }
-
- await expect(collection.setProperties(alice, propertiesToBeSet)).
- to.be.rejectedWith(/common\.PropertyLimitReached/);
-
- expect(await collection.getProperties()).to.be.empty;
- }
-
- itSub('Fails to set more properties than it is allowed (NFT)', async ({helper}) => {
- await testFailsSetMorePropertiesThanAllowed(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Fails to set more properties than it is allowed (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testFailsSetMorePropertiesThanAllowed(await helper.rft.mintCollection(alice));
- });
-
- async function testFailsSetPropertiesWithInvalidNames(collection: UniqueBaseCollection) {
- const invalidProperties = [
- [{key: 'electron', value: 'negative'}, {key: 'string theory', value: 'understandable'}],
- [{key: 'Mr/Sandman', value: 'Bring me a gene'}],
- [{key: 'déjà vu', value: 'hmm...'}],
- ];
-
- for (let i = 0; i < invalidProperties.length; i++) {
- await expect(
- collection.setProperties(alice, invalidProperties[i]),
- `on rejecting the new badly-named property #${i}`,
- ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
- }
-
- await expect(
- collection.setProperties(alice, [{key: '', value: 'nothing must not exist'}]),
- 'on rejecting an unnamed property',
- ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
-
- await expect(
- collection.setProperties(alice, [{key: 'CRISPR-Cas9', value: 'rewriting nature!'}]),
- 'on setting the correctly-but-still-badly-named property',
- ).to.be.fulfilled;
-
- const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat('CRISPR-Cas9').concat('');
-
- const properties = await collection.getProperties(keys);
- expect(properties).to.be.deep.equal([
- {key: 'CRISPR-Cas9', value: 'rewriting nature!'},
- ]);
-
- for (let i = 0; i < invalidProperties.length; i++) {
- await expect(
- collection.deleteProperties(alice, invalidProperties[i].map(propertySet => propertySet.key)),
- `on trying to delete the non-existent badly-named property #${i}`,
- ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
- }
- }
-
- itSub('Fails to set properties with invalid names (NFT)', async ({helper}) => {
- await testFailsSetPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Fails to set properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testFailsSetPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
- });
-});
-
-// ---------- ACCESS RIGHTS
-
-describe('Integration Test: Access Rights to Token Properties', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
- });
- });
-
- itSub('Reads access rights to properties of a collection', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const propertyRights = (await helper.callRpc('api.query.common.collectionPropertyPermissions', [collection.collectionId])).toJSON();
- expect(propertyRights).to.be.empty;
- });
-
- async function testSetsAccessRightsToProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
- await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true}}]))
- .to.be.fulfilled;
-
- await collection.addAdmin(alice, {Substrate: bob.address});
-
- await expect(collection.setTokenPropertyPermissions(bob, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]))
- .to.be.fulfilled;
-
- const propertyRights = await collection.getPropertyPermissions(['skullduggery', 'mindgame']);
- expect(propertyRights).to.include.deep.members([
- {key: 'skullduggery', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}},
- {key: 'mindgame', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
- ]);
- }
-
- itSub('Sets access rights to properties of a collection (NFT)', async ({helper}) => {
- await testSetsAccessRightsToProperties(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Sets access rights to properties of a collection (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testSetsAccessRightsToProperties(await helper.rft.mintCollection(alice));
- });
-
- async function testChangesAccessRightsToProperty(collection: UniqueNFTCollection | UniqueRFTCollection) {
- await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]))
- .to.be.fulfilled;
-
- await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
- .to.be.fulfilled;
-
- const propertyRights = await collection.getPropertyPermissions();
- expect(propertyRights).to.be.deep.equal([
- {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
- ]);
- }
-
- itSub('Changes access rights to properties of a NFT collection', async ({helper}) => {
- await testChangesAccessRightsToProperty(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Changes access rights to properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
- await testChangesAccessRightsToProperty(await helper.rft.mintCollection(alice));
- });
-});
-
-describe('Negative Integration Test: Access Rights to Token Properties', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
- });
- });
-
- async function testPreventsFromSettingAccessRightsNotAdminOrOwner(collection: UniqueNFTCollection | UniqueRFTCollection) {
- await expect(collection.setTokenPropertyPermissions(bob, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]))
- .to.be.rejectedWith(/common\.NoPermission/);
-
- const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
- expect(propertyRights).to.be.empty;
- }
-
- itSub('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async ({helper}) => {
- await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', [Pallets.ReFungible], async ({helper}) => {
- await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.rft.mintCollection(alice));
- });
-
- async function testPreventFromAddingTooManyPossibleProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
- const constitution = [];
- for (let i = 0; i < 65; i++) {
- constitution.push({
- key: 'property_' + i,
- permission: Math.random() > 0.5 ? {mutable: true, collectionAdmin: true, tokenOwner: true} : {},
- });
- }
-
- await expect(collection.setTokenPropertyPermissions(alice, constitution))
- .to.be.rejectedWith(/common\.PropertyLimitReached/);
-
- const propertyRights = await collection.getPropertyPermissions();
- expect(propertyRights).to.be.empty;
- }
-
- itSub('Prevents from adding too many possible properties (NFT)', async ({helper}) => {
- await testPreventFromAddingTooManyPossibleProperties(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Prevents from adding too many possible properties (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testPreventFromAddingTooManyPossibleProperties(await helper.rft.mintCollection(alice));
- });
-
- async function testPreventAccessRightsModifiedIfConstant(collection: UniqueNFTCollection | UniqueRFTCollection) {
- await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
- .to.be.fulfilled;
-
- await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {collectionAdmin: true}}]))
- .to.be.rejectedWith(/common\.NoPermission/);
-
- const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
- expect(propertyRights).to.deep.equal([
- {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
- ]);
- }
-
- itSub('Prevents access rights to be modified if constant (NFT)', async ({helper}) => {
- await testPreventAccessRightsModifiedIfConstant(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Prevents access rights to be modified if constant (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testPreventAccessRightsModifiedIfConstant(await helper.rft.mintCollection(alice));
- });
-
- 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}}],
- [{key: 'HÆMILTON', permission: {mutable: false, collectionAdmin: true, tokenOwner: true}}],
- ];
-
- for (let i = 0; i < invalidProperties.length; i++) {
- await expect(
- collection.setTokenPropertyPermissions(alice, invalidProperties[i]),
- `on setting the new badly-named property #${i}`,
- ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
- }
-
- await expect(
- collection.setTokenPropertyPermissions(alice, [{key: '', permission: {}}]),
- 'on rejecting an unnamed property',
- ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
-
- const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
- await expect(
- collection.setTokenPropertyPermissions(alice, [
- {key: correctKey, permission: {collectionAdmin: true}},
- ]),
- 'on setting the correctly-but-still-badly-named property',
- ).to.be.fulfilled;
-
- const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat(correctKey).concat('');
-
- const propertyRights = await collection.getPropertyPermissions(keys);
- expect(propertyRights).to.be.deep.equal([
- {key: correctKey, permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
- ]);
- }
-
- itSub('Prevents adding properties with invalid names (NFT)', async ({helper}) => {
- await testPreventsAddingPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
- });
-
- itSub.ifWithPallets('Prevents adding properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- await testPreventsAddingPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
- });
-});
-
-// ---------- TOKEN PROPERTIES
-
-describe('Integration Test: Token Properties', () => {
- let alice: IKeyringPair; // collection owner
- let bob: IKeyringPair; // collection admin
- let charlie: IKeyringPair; // token owner
-
- let permissions: {permission: any, signers: IKeyringPair[]}[];
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
- });
-
- // todo:playgrounds probably separate these tests later
- permissions = [
- {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob]},
- {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob]},
- {permission: {mutable: true, tokenOwner: true}, signers: [charlie]},
- {permission: {mutable: false, tokenOwner: true}, signers: [charlie]},
- {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
- {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
- ];
- });
-
- async function testReadsYetEmptyProperties(token: UniqueNFToken | UniqueRFToken) {
- const properties = await token.getProperties();
- expect(properties).to.be.empty;
-
- const tokenData = await token.getData();
- expect(tokenData!.properties).to.be.empty;
- }
-
- itSub('Reads yet empty properties of a token (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testReadsYetEmptyProperties(token);
- });
-
- itSub.ifWithPallets('Reads yet empty properties of a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testReadsYetEmptyProperties(token);
- });
-
- async function testAssignPropertiesAccordingToPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- await token.collection.addAdmin(alice, {Substrate: bob.address});
- await token.transfer(alice, {Substrate: charlie.address}, pieces);
-
- const propertyKeys: string[] = [];
- let i = 0;
- for (const permission of permissions) {
- i++;
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(signer, [{key: key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- const properties = await token.getProperties(propertyKeys);
- const tokenData = await token.getData();
- for (let i = 0; i < properties.length; i++) {
- expect(properties[i].value).to.be.equal('Serotonin increase');
- expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
- }
- }
-
- itSub('Assigns properties to a token according to permissions (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testAssignPropertiesAccordingToPermissions(token, 1n);
- });
-
- itSub.ifWithPallets('Assigns properties to a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testAssignPropertiesAccordingToPermissions(token, 100n);
- });
-
- async function testChangesPropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- await token.collection.addAdmin(alice, {Substrate: bob.address});
- await token.transfer(alice, {Substrate: charlie.address}, pieces);
-
- const propertyKeys: string[] = [];
- let i = 0;
- for (const permission of permissions) {
- i++;
- if (!permission.permission.mutable) continue;
-
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(signer, [{key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(signer, [{key, value: 'Serotonin stable'}]),
- `on changing property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- const properties = await token.getProperties(propertyKeys);
- const tokenData = await token.getData();
- for (let i = 0; i < properties.length; i++) {
- expect(properties[i].value).to.be.equal('Serotonin stable');
- expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
- }
- }
-
- itSub('Changes properties of a token according to permissions (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testChangesPropertiesAccordingPermission(token, 1n);
- });
-
- itSub.ifWithPallets('Changes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testChangesPropertiesAccordingPermission(token, 100n);
- });
-
- async function testDeletePropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- await token.collection.addAdmin(alice, {Substrate: bob.address});
- await token.transfer(alice, {Substrate: charlie.address}, pieces);
-
- const propertyKeys: string[] = [];
- let i = 0;
-
- for (const permission of permissions) {
- i++;
- if (!permission.permission.mutable) continue;
-
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(signer, [{key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
-
- await expect(
- token.deleteProperties(signer, [key]),
- `on deleting property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- expect(await token.getProperties(propertyKeys)).to.be.empty;
- expect((await token.getData())!.properties).to.be.empty;
- }
-
- itSub('Deletes properties of a token according to permissions (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testDeletePropertiesAccordingPermission(token, 1n);
- });
-
- itSub.ifWithPallets('Deletes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testDeletePropertiesAccordingPermission(token, 100n);
- });
-
- itSub('Assigns properties to a nested token according to permissions', async ({helper}) => {
- 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.nestingAccount());
-
- await collectionB.addAdmin(alice, {Substrate: bob.address});
- await targetToken.transfer(alice, {Substrate: charlie.address});
-
- const propertyKeys: string[] = [];
- let i = 0;
- for (const permission of permissions) {
- i++;
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- const properties = await nestedToken.getProperties(propertyKeys);
- const tokenData = await nestedToken.getData();
- for (let i = 0; i < properties.length; i++) {
- expect(properties[i].value).to.be.equal('Serotonin increase');
- expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
- }
- expect(await targetToken.getProperties()).to.be.empty;
- });
-
- itSub('Changes properties of a nested token according to permissions', async ({helper}) => {
- 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.nestingAccount());
-
- await collectionB.addAdmin(alice, {Substrate: bob.address});
- await targetToken.transfer(alice, {Substrate: charlie.address});
-
- const propertyKeys: string[] = [];
- let i = 0;
- for (const permission of permissions) {
- i++;
- if (!permission.permission.mutable) continue;
-
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
-
- await expect(
- nestedToken.setProperties(signer, [{key, value: 'Serotonin stable'}]),
- `on changing property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- const properties = await nestedToken.getProperties(propertyKeys);
- const tokenData = await nestedToken.getData();
- for (let i = 0; i < properties.length; i++) {
- expect(properties[i].value).to.be.equal('Serotonin stable');
- expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
- }
- expect(await targetToken.getProperties()).to.be.empty;
- });
-
- itSub('Deletes properties of a nested token according to permissions', async ({helper}) => {
- 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.nestingAccount());
-
- await collectionB.addAdmin(alice, {Substrate: bob.address});
- await targetToken.transfer(alice, {Substrate: charlie.address});
-
- const propertyKeys: string[] = [];
- let i = 0;
- for (const permission of permissions) {
- i++;
- if (!permission.permission.mutable) continue;
-
- let j = 0;
- for (const signer of permission.signers) {
- j++;
- const key = i + '_' + signer.address;
- propertyKeys.push(key);
-
- await expect(
- nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]),
- `on setting permission #${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
- `on adding property #${i} by signer #${j}`,
- ).to.be.fulfilled;
-
- await expect(
- nestedToken.deleteProperties(signer, [key]),
- `on deleting property #${i} by signer #${j}`,
- ).to.be.fulfilled;
- }
- }
-
- expect(await nestedToken.getProperties(propertyKeys)).to.be.empty;
- expect((await nestedToken.getData())!.properties).to.be.empty;
- expect(await targetToken.getProperties()).to.be.empty;
- });
-});
-
-describe('Negative Integration Test: Token Properties', () => {
- let alice: IKeyringPair; // collection owner
- let bob: IKeyringPair; // collection admin
- let charlie: IKeyringPair; // token owner
-
- let constitution: {permission: any, signers: IKeyringPair[], sinner: IKeyringPair}[];
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
- let dave: IKeyringPair;
- [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
-
- // todo:playgrounds probably separate these tests later
- constitution = [
- {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
- {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
- {permission: {mutable: true, tokenOwner: true}, signers: [charlie], sinner: alice},
- {permission: {mutable: false, tokenOwner: true}, signers: [charlie], sinner: alice},
- {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie], sinner: dave},
- {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie], sinner: dave},
- ];
- });
- });
-
- async function getConsumedSpace(api: any, collectionId: number, tokenId: number, mode: 'NFT' | 'RFT'): Promise<number> {
- return (await (mode == 'NFT' ? api.query.nonfungible : api.query.refungible).tokenProperties(collectionId, tokenId)).toJSON().consumedSpace;
- }
-
- 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);
-
- let i = 0;
- for (const passage of constitution) {
- i++;
- const signer = passage.signers[0];
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [{key: `${i}`, permission: passage.permission}]),
- `on setting permission ${i} by alice`,
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(signer, [{key: `${i}`, value: 'Serotonin increase'}]),
- `on adding property ${i} by ${signer.address}`,
- ).to.be.fulfilled;
- }
-
- const originalSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
- return originalSpace;
- }
-
- async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- const originalSpace = await prepare(token, pieces);
-
- let i = 0;
- for (const forbiddance of constitution) {
- i++;
- if (!forbiddance.permission.mutable) continue;
-
- await expect(
- token.setProperties(forbiddance.sinner, [{key: `${i}`, value: 'Serotonin down'}]),
- `on failing to change property ${i} by the malefactor`,
- ).to.be.rejectedWith(/common\.NoPermission/);
-
- await expect(
- token.deleteProperties(forbiddance.sinner, [`${i}`]),
- `on failing to delete property ${i} by the malefactor`,
- ).to.be.rejectedWith(/common\.NoPermission/);
- }
-
- const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
- expect(consumedSpace).to.be.equal(originalSpace);
- }
-
- itSub('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, 1n);
- });
-
- itSub.ifWithPallets('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, 100n);
- });
-
- async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- const originalSpace = await prepare(token, pieces);
-
- let i = 0;
- for (const permission of constitution) {
- i++;
- if (permission.permission.mutable) continue;
-
- await expect(
- token.setProperties(permission.signers[0], [{key: `${i}`, value: 'Serotonin down'}]),
- `on failing to change property ${i} by signer #0`,
- ).to.be.rejectedWith(/common\.NoPermission/);
-
- await expect(
- token.deleteProperties(permission.signers[0], [i.toString()]),
- `on failing to delete property ${i} by signer #0`,
- ).to.be.rejectedWith(/common\.NoPermission/);
- }
-
- const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
- expect(consumedSpace).to.be.equal(originalSpace);
- }
-
- itSub('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, 1n);
- });
-
- itSub.ifWithPallets('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, 100n);
- });
-
- async function testForbidsAddingPropertiesIfPropertyNotDeclared(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- const originalSpace = await prepare(token, pieces);
-
- await expect(
- token.setProperties(alice, [{key: 'non-existent', value: 'I exist!'}]),
- 'on failing to add a previously non-existent property',
- ).to.be.rejectedWith(/common\.NoPermission/);
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [{key: 'now-existent', permission: {}}]),
- 'on setting a new non-permitted property',
- ).to.be.fulfilled;
-
- await expect(
- token.setProperties(alice, [{key: 'now-existent', value: 'I exist!'}]),
- 'on failing to add a property forbidden by the \'None\' permission',
- ).to.be.rejectedWith(/common\.NoPermission/);
-
- expect(await token.getProperties(['non-existent', 'now-existent'])).to.be.empty;
-
- const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
- expect(consumedSpace).to.be.equal(originalSpace);
- }
-
- itSub('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testForbidsAddingPropertiesIfPropertyNotDeclared(token, 1n);
- });
-
- itSub.ifWithPallets('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testForbidsAddingPropertiesIfPropertyNotDeclared(token, 100n);
- });
-
- async function testForbidsAddingTooManyProperties(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
- const originalSpace = await prepare(token, pieces);
-
- await expect(
- token.collection.setTokenPropertyPermissions(alice, [
- {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}},
- {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
- ]),
- 'on setting new permissions for properties',
- ).to.be.fulfilled;
-
- // Mute the general tx parsing error
- {
- console.error = () => {};
- await expect(token.setProperties(alice, [{key: 'a_holy_book', value: 'word '.repeat(6554)}]))
- .to.be.rejected;
- }
-
- await expect(token.setProperties(alice, [
- {key: 'a_holy_book', value: 'word '.repeat(3277)},
- {key: 'young_years', value: 'neverending'.repeat(1490)},
- ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
-
- expect(await token.getProperties(['a_holy_book', 'young_years'])).to.be.empty;
- const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
- expect(consumedSpace).to.be.equal(originalSpace);
- }
-
- itSub('Forbids adding too many properties to a token (NFT)', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice);
- const token = await collection.mintToken(alice);
- await testForbidsAddingTooManyProperties(token, 1n);
- });
-
- itSub.ifWithPallets('Forbids adding too many properties to a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
- await testForbidsAddingTooManyProperties(token, 100n);
- });
-});
-
-describe('ReFungible token properties permissions tests', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
-
- before(async function() {
- await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
-
- const donor = privateKey('//Alice');
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
- });
- });
-
- async function prepare(helper: UniqueHelper): Promise<UniqueRFToken> {
- const collection = await helper.rft.mintCollection(alice);
- const token = await collection.mintToken(alice, 100n);
-
- await collection.addAdmin(alice, {Substrate: bob.address});
- await collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable: true, tokenOwner: true}}]);
-
- return token;
- }
-
- itSub('Forbids adding token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) => {
- const token = await prepare(helper);
-
- await token.transfer(alice, {Substrate: charlie.address}, 33n);
-
- await expect(token.setProperties(alice, [
- {key: 'fractals', value: 'multiverse'},
- ])).to.be.rejectedWith(/common\.NoPermission/);
- });
-
- itSub('Forbids mutating token property with tokenOwher==true when signer doesn\'t have all pieces', async ({helper}) => {
- const token = await prepare(helper);
-
- await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, tokenOwner: true}}]))
- .to.be.fulfilled;
-
- await expect(token.setProperties(alice, [
- {key: 'fractals', value: 'multiverse'},
- ])).to.be.fulfilled;
-
- await token.transfer(alice, {Substrate: charlie.address}, 33n);
-
- await expect(token.setProperties(alice, [
- {key: 'fractals', value: 'want to rule the world'},
- ])).to.be.rejectedWith(/common\.NoPermission/);
- });
-
- itSub('Forbids deleting token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) => {
- const token = await prepare(helper);
-
- await expect(token.setProperties(alice, [
- {key: 'fractals', value: 'one headline - why believe it'},
- ])).to.be.fulfilled;
-
- await token.transfer(alice, {Substrate: charlie.address}, 33n);
-
- await expect(token.deleteProperties(alice, ['fractals'])).
- to.be.rejectedWith(/common\.NoPermission/);
- });
-
- itSub('Allows token property mutation with collectionOwner==true when admin doesn\'t have all pieces', async ({helper}) => {
- const token = await prepare(helper);
-
- await token.transfer(alice, {Substrate: charlie.address}, 33n);
-
- await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, collectionAdmin: true}}]))
- .to.be.fulfilled;
-
- await expect(token.setProperties(alice, [
- {key: 'fractals', value: 'multiverse'},
- ])).to.be.fulfilled;
- });
-});
tests/src/nesting/propertyPermissions.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/nesting/propertyPermissions.test.ts
@@ -0,0 +1,198 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, Pallets, usingPlaygrounds, expect} from '../util';
+import {UniqueNFTCollection, UniqueRFTCollection} from '../util/playgrounds/unique';
+
+describe('Integration Test: Access Rights to Token Properties', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
+ });
+ });
+
+ itSub('Reads access rights to properties of a collection', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(alice);
+ const propertyRights = (await helper.callRpc('api.query.common.collectionPropertyPermissions', [collection.collectionId])).toJSON();
+ expect(propertyRights).to.be.empty;
+ });
+
+ async function testSetsAccessRightsToProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
+ await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true}}]))
+ .to.be.fulfilled;
+
+ await collection.addAdmin(alice, {Substrate: bob.address});
+
+ await expect(collection.setTokenPropertyPermissions(bob, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]))
+ .to.be.fulfilled;
+
+ const propertyRights = await collection.getPropertyPermissions(['skullduggery', 'mindgame']);
+ expect(propertyRights).to.include.deep.members([
+ {key: 'skullduggery', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}},
+ {key: 'mindgame', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
+ ]);
+ }
+
+ itSub('Sets access rights to properties of a collection (NFT)', async ({helper}) => {
+ await testSetsAccessRightsToProperties(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Sets access rights to properties of a collection (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testSetsAccessRightsToProperties(await helper.rft.mintCollection(alice));
+ });
+
+ async function testChangesAccessRightsToProperty(collection: UniqueNFTCollection | UniqueRFTCollection) {
+ await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]))
+ .to.be.fulfilled;
+
+ await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
+ .to.be.fulfilled;
+
+ const propertyRights = await collection.getPropertyPermissions();
+ expect(propertyRights).to.be.deep.equal([
+ {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
+ ]);
+ }
+
+ itSub('Changes access rights to properties of a NFT collection', async ({helper}) => {
+ await testChangesAccessRightsToProperty(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Changes access rights to properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+ await testChangesAccessRightsToProperty(await helper.rft.mintCollection(alice));
+ });
+});
+
+describe('Negative Integration Test: Access Rights to Token Properties', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
+ });
+ });
+
+ async function testPreventsFromSettingAccessRightsNotAdminOrOwner(collection: UniqueNFTCollection | UniqueRFTCollection) {
+ await expect(collection.setTokenPropertyPermissions(bob, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]))
+ .to.be.rejectedWith(/common\.NoPermission/);
+
+ const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
+ expect(propertyRights).to.be.empty;
+ }
+
+ itSub('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async ({helper}) => {
+ await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', [Pallets.ReFungible], async ({helper}) => {
+ await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.rft.mintCollection(alice));
+ });
+
+ async function testPreventFromAddingTooManyPossibleProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {
+ const constitution = [];
+ for (let i = 0; i < 65; i++) {
+ constitution.push({
+ key: 'property_' + i,
+ permission: Math.random() > 0.5 ? {mutable: true, collectionAdmin: true, tokenOwner: true} : {},
+ });
+ }
+
+ await expect(collection.setTokenPropertyPermissions(alice, constitution))
+ .to.be.rejectedWith(/common\.PropertyLimitReached/);
+
+ const propertyRights = await collection.getPropertyPermissions();
+ expect(propertyRights).to.be.empty;
+ }
+
+ itSub('Prevents from adding too many possible properties (NFT)', async ({helper}) => {
+ await testPreventFromAddingTooManyPossibleProperties(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Prevents from adding too many possible properties (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testPreventFromAddingTooManyPossibleProperties(await helper.rft.mintCollection(alice));
+ });
+
+ async function testPreventAccessRightsModifiedIfConstant(collection: UniqueNFTCollection | UniqueRFTCollection) {
+ await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
+ .to.be.fulfilled;
+
+ await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {collectionAdmin: true}}]))
+ .to.be.rejectedWith(/common\.NoPermission/);
+
+ const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
+ expect(propertyRights).to.deep.equal([
+ {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
+ ]);
+ }
+
+ itSub('Prevents access rights to be modified if constant (NFT)', async ({helper}) => {
+ await testPreventAccessRightsModifiedIfConstant(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Prevents access rights to be modified if constant (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testPreventAccessRightsModifiedIfConstant(await helper.rft.mintCollection(alice));
+ });
+
+ 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}}],
+ [{key: 'HÆMILTON', permission: {mutable: false, collectionAdmin: true, tokenOwner: true}}],
+ ];
+
+ for (let i = 0; i < invalidProperties.length; i++) {
+ await expect(
+ collection.setTokenPropertyPermissions(alice, invalidProperties[i]),
+ `on setting the new badly-named property #${i}`,
+ ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+ }
+
+ await expect(
+ collection.setTokenPropertyPermissions(alice, [{key: '', permission: {}}]),
+ 'on rejecting an unnamed property',
+ ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
+
+ const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
+ await expect(
+ collection.setTokenPropertyPermissions(alice, [
+ {key: correctKey, permission: {collectionAdmin: true}},
+ ]),
+ 'on setting the correctly-but-still-badly-named property',
+ ).to.be.fulfilled;
+
+ const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat(correctKey).concat('');
+
+ const propertyRights = await collection.getPropertyPermissions(keys);
+ expect(propertyRights).to.be.deep.equal([
+ {key: correctKey, permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
+ ]);
+ }
+
+ itSub('Prevents adding properties with invalid names (NFT)', async ({helper}) => {
+ await testPreventsAddingPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
+ });
+
+ itSub.ifWithPallets('Prevents adding properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ await testPreventsAddingPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
+ });
+});
\ No newline at end of file
tests/src/nesting/tokenProperties.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/nesting/tokenProperties.test.ts
@@ -0,0 +1,594 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from '../util';
+import {UniqueHelper, UniqueNFToken, UniqueRFToken} from '../util/playgrounds/unique';
+
+describe('Integration Test: Token Properties', () => {
+ let alice: IKeyringPair; // collection owner
+ let bob: IKeyringPair; // collection admin
+ let charlie: IKeyringPair; // token owner
+
+ let permissions: {permission: any, signers: IKeyringPair[]}[];
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+
+ permissions = [
+ {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob]},
+ {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob]},
+ {permission: {mutable: true, tokenOwner: true}, signers: [charlie]},
+ {permission: {mutable: false, tokenOwner: true}, signers: [charlie]},
+ {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
+ {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
+ ];
+ });
+
+ async function mintCollectionWithAllPermissionsAndToken(helper: UniqueHelper, mode: 'NFT' | 'RFT'): Promise<[UniqueNFToken | UniqueRFToken, bigint]> {
+ const collection = await (mode == 'NFT' ? helper.nft : helper.rft).mintCollection(alice, {
+ tokenPropertyPermissions: permissions.flatMap(({permission, signers}, i) =>
+ signers.map(signer => {return {key: `${i+1}_${signer.address}`, permission};})),
+ });
+ return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n), 100n];
+ }
+
+ async function testReadsYetEmptyProperties(token: UniqueNFToken | UniqueRFToken) {
+ const properties = await token.getProperties();
+ expect(properties).to.be.empty;
+
+ const tokenData = await token.getData();
+ expect(tokenData!.properties).to.be.empty;
+ }
+
+ itSub('Reads yet empty properties of a token (NFT)', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(alice);
+ const token = await collection.mintToken(alice);
+ await testReadsYetEmptyProperties(token);
+ });
+
+ itSub.ifWithPallets('Reads yet empty properties of a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const collection = await helper.rft.mintCollection(alice);
+ const token = await collection.mintToken(alice);
+ await testReadsYetEmptyProperties(token);
+ });
+
+ async function testAssignPropertiesAccordingToPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ await token.collection.addAdmin(alice, {Substrate: bob.address});
+ await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+ for (const permission of permissions) {
+ i++;
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ token.setProperties(signer, [{key: key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ const properties = await token.getProperties(propertyKeys);
+ const tokenData = await token.getData();
+ for (let i = 0; i < properties.length; i++) {
+ expect(properties[i].value).to.be.equal('Serotonin increase');
+ expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
+ }
+ }
+
+ itSub('Assigns properties to a token according to permissions (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testAssignPropertiesAccordingToPermissions(token, amount);
+ });
+
+ itSub.ifWithPallets('Assigns properties to a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testAssignPropertiesAccordingToPermissions(token, amount);
+ });
+
+ async function testChangesPropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ await token.collection.addAdmin(alice, {Substrate: bob.address});
+ await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+ for (const permission of permissions) {
+ i++;
+ if (!permission.permission.mutable) continue;
+
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ token.setProperties(signer, [{key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+
+ await expect(
+ token.setProperties(signer, [{key, value: 'Serotonin stable'}]),
+ `on changing property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ const properties = await token.getProperties(propertyKeys);
+ const tokenData = await token.getData();
+ for (let i = 0; i < properties.length; i++) {
+ expect(properties[i].value).to.be.equal('Serotonin stable');
+ expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
+ }
+ }
+
+ itSub('Changes properties of a token according to permissions (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testChangesPropertiesAccordingPermission(token, amount);
+ });
+
+ itSub.ifWithPallets('Changes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testChangesPropertiesAccordingPermission(token, amount);
+ });
+
+ async function testDeletePropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ await token.collection.addAdmin(alice, {Substrate: bob.address});
+ await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+
+ for (const permission of permissions) {
+ i++;
+ if (!permission.permission.mutable) continue;
+
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ token.setProperties(signer, [{key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+
+ await expect(
+ token.deleteProperties(signer, [key]),
+ `on deleting property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ expect(await token.getProperties(propertyKeys)).to.be.empty;
+ expect((await token.getData())!.properties).to.be.empty;
+ }
+
+ itSub('Deletes properties of a token according to permissions (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testDeletePropertiesAccordingPermission(token, amount);
+ });
+
+ itSub.ifWithPallets('Deletes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testDeletePropertiesAccordingPermission(token, amount);
+ });
+
+ itSub('Assigns properties to a nested token according to permissions', async ({helper}) => {
+ const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+ const collectionB = await helper.nft.mintCollection(alice, {
+ tokenPropertyPermissions: permissions.flatMap(({permission, signers}, i) =>
+ signers.map(signer => {return {key: `${i+1}_${signer.address}`, permission};})),
+ });
+ const targetToken = await collectionA.mintToken(alice);
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
+
+ await collectionB.addAdmin(alice, {Substrate: bob.address});
+ await targetToken.transfer(alice, {Substrate: charlie.address});
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+ for (const permission of permissions) {
+ i++;
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ const properties = await nestedToken.getProperties(propertyKeys);
+ const tokenData = await nestedToken.getData();
+ for (let i = 0; i < properties.length; i++) {
+ expect(properties[i].value).to.be.equal('Serotonin increase');
+ expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
+ }
+ expect(await targetToken.getProperties()).to.be.empty;
+ });
+
+ itSub('Changes properties of a nested token according to permissions', async ({helper}) => {
+ const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+ const collectionB = await helper.nft.mintCollection(alice, {
+ tokenPropertyPermissions: permissions.flatMap(({permission, signers}, i) =>
+ signers.map(signer => {return {key: `${i+1}_${signer.address}`, permission};})),
+ });
+ const targetToken = await collectionA.mintToken(alice);
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
+
+ await collectionB.addAdmin(alice, {Substrate: bob.address});
+ await targetToken.transfer(alice, {Substrate: charlie.address});
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+ for (const permission of permissions) {
+ i++;
+ if (!permission.permission.mutable) continue;
+
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+
+ await expect(
+ nestedToken.setProperties(signer, [{key, value: 'Serotonin stable'}]),
+ `on changing property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ const properties = await nestedToken.getProperties(propertyKeys);
+ const tokenData = await nestedToken.getData();
+ for (let i = 0; i < properties.length; i++) {
+ expect(properties[i].value).to.be.equal('Serotonin stable');
+ expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
+ }
+ expect(await targetToken.getProperties()).to.be.empty;
+ });
+
+ itSub('Deletes properties of a nested token according to permissions', async ({helper}) => {
+ const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+ const collectionB = await helper.nft.mintCollection(alice, {
+ tokenPropertyPermissions: permissions.flatMap(({permission, signers}, i) =>
+ signers.map(signer => {return {key: `${i+1}_${signer.address}`, permission};})),
+ });
+ const targetToken = await collectionA.mintToken(alice);
+ const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
+
+ await collectionB.addAdmin(alice, {Substrate: bob.address});
+ await targetToken.transfer(alice, {Substrate: charlie.address});
+
+ const propertyKeys: string[] = [];
+ let i = 0;
+ for (const permission of permissions) {
+ i++;
+ if (!permission.permission.mutable) continue;
+
+ let j = 0;
+ for (const signer of permission.signers) {
+ j++;
+ const key = i + '_' + signer.address;
+ propertyKeys.push(key);
+
+ await expect(
+ nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]),
+ `on adding property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+
+ await expect(
+ nestedToken.deleteProperties(signer, [key]),
+ `on deleting property #${i} by signer #${j}`,
+ ).to.be.fulfilled;
+ }
+ }
+
+ expect(await nestedToken.getProperties(propertyKeys)).to.be.empty;
+ expect((await nestedToken.getData())!.properties).to.be.empty;
+ expect(await targetToken.getProperties()).to.be.empty;
+ });
+});
+
+describe('Negative Integration Test: Token Properties', () => {
+ let alice: IKeyringPair; // collection owner
+ let bob: IKeyringPair; // collection admin
+ let charlie: IKeyringPair; // token owner
+
+ let constitution: {permission: any, signers: IKeyringPair[], sinner: IKeyringPair}[];
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ let dave: IKeyringPair;
+ [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
+
+ // todo:playgrounds probably separate these tests later
+ constitution = [
+ {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
+ {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
+ {permission: {mutable: true, tokenOwner: true}, signers: [charlie], sinner: alice},
+ {permission: {mutable: false, tokenOwner: true}, signers: [charlie], sinner: alice},
+ {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie], sinner: dave},
+ {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie], sinner: dave},
+ ];
+ });
+ });
+
+ async function mintCollectionWithAllPermissionsAndToken(helper: UniqueHelper, mode: 'NFT' | 'RFT'): Promise<[UniqueNFToken | UniqueRFToken, bigint]> {
+ const collection = await (mode == 'NFT' ? helper.nft : helper.rft).mintCollection(alice, {
+ tokenPropertyPermissions: constitution.map(({permission}, i) => {return {key: `${i+1}`, permission};}),
+ });
+ return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n), 100n];
+ }
+
+ async function getConsumedSpace(api: any, collectionId: number, tokenId: number, mode: 'NFT' | 'RFT'): Promise<number> {
+ return (await (mode == 'NFT' ? api.query.nonfungible : api.query.refungible).tokenProperties(collectionId, tokenId)).toJSON().consumedSpace;
+ }
+
+ 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);
+
+ let i = 0;
+ for (const passage of constitution) {
+ i++;
+ const signer = passage.signers[0];
+ await expect(
+ token.setProperties(signer, [{key: `${i}`, value: 'Serotonin increase'}]),
+ `on adding property ${i} by ${signer.address}`,
+ ).to.be.fulfilled;
+ }
+
+ const originalSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
+ return originalSpace;
+ }
+
+ async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ const originalSpace = await prepare(token, pieces);
+
+ let i = 0;
+ for (const forbiddance of constitution) {
+ i++;
+ if (!forbiddance.permission.mutable) continue;
+
+ await expect(
+ token.setProperties(forbiddance.sinner, [{key: `${i}`, value: 'Serotonin down'}]),
+ `on failing to change property ${i} by the malefactor`,
+ ).to.be.rejectedWith(/common\.NoPermission/);
+
+ await expect(
+ token.deleteProperties(forbiddance.sinner, [`${i}`]),
+ `on failing to delete property ${i} by the malefactor`,
+ ).to.be.rejectedWith(/common\.NoPermission/);
+ }
+
+ const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
+ expect(consumedSpace).to.be.equal(originalSpace);
+ }
+
+ itSub('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, amount);
+ });
+
+ itSub.ifWithPallets('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, amount);
+ });
+
+ async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ const originalSpace = await prepare(token, pieces);
+
+ let i = 0;
+ for (const permission of constitution) {
+ i++;
+ if (permission.permission.mutable) continue;
+
+ await expect(
+ token.setProperties(permission.signers[0], [{key: `${i}`, value: 'Serotonin down'}]),
+ `on failing to change property ${i} by signer #0`,
+ ).to.be.rejectedWith(/common\.NoPermission/);
+
+ await expect(
+ token.deleteProperties(permission.signers[0], [i.toString()]),
+ `on failing to delete property ${i} by signer #0`,
+ ).to.be.rejectedWith(/common\.NoPermission/);
+ }
+
+ const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
+ expect(consumedSpace).to.be.equal(originalSpace);
+ }
+
+ itSub('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, amount);
+ });
+
+ itSub.ifWithPallets('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, amount);
+ });
+
+ async function testForbidsAddingPropertiesIfPropertyNotDeclared(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ const originalSpace = await prepare(token, pieces);
+
+ await expect(
+ token.setProperties(alice, [{key: 'non-existent', value: 'I exist!'}]),
+ 'on failing to add a previously non-existent property',
+ ).to.be.rejectedWith(/common\.NoPermission/);
+
+ await expect(
+ token.collection.setTokenPropertyPermissions(alice, [{key: 'now-existent', permission: {}}]),
+ 'on setting a new non-permitted property',
+ ).to.be.fulfilled;
+
+ await expect(
+ token.setProperties(alice, [{key: 'now-existent', value: 'I exist!'}]),
+ 'on failing to add a property forbidden by the \'None\' permission',
+ ).to.be.rejectedWith(/common\.NoPermission/);
+
+ expect(await token.getProperties(['non-existent', 'now-existent'])).to.be.empty;
+
+ const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
+ expect(consumedSpace).to.be.equal(originalSpace);
+ }
+
+ itSub('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testForbidsAddingPropertiesIfPropertyNotDeclared(token, amount);
+ });
+
+ itSub.ifWithPallets('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testForbidsAddingPropertiesIfPropertyNotDeclared(token, amount);
+ });
+
+ async function testForbidsAddingTooManyProperties(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+ const originalSpace = await prepare(token, pieces);
+
+ await expect(
+ token.collection.setTokenPropertyPermissions(alice, [
+ {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}},
+ {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
+ ]),
+ 'on setting new permissions for properties',
+ ).to.be.fulfilled;
+
+ // Mute the general tx parsing error
+ {
+ console.error = () => {};
+ await expect(token.setProperties(alice, [{key: 'a_holy_book', value: 'word '.repeat(6554)}]))
+ .to.be.rejected;
+ }
+
+ await expect(token.setProperties(alice, [
+ {key: 'a_holy_book', value: 'word '.repeat(3277)},
+ {key: 'young_years', value: 'neverending'.repeat(1490)},
+ ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
+
+ expect(await token.getProperties(['a_holy_book', 'young_years'])).to.be.empty;
+ const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT');
+ expect(consumedSpace).to.be.equal(originalSpace);
+ }
+
+ itSub('Forbids adding too many properties to a token (NFT)', async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'NFT');
+ await testForbidsAddingTooManyProperties(token, amount);
+ });
+
+ itSub.ifWithPallets('Forbids adding too many properties to a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+ const [token, amount] = await mintCollectionWithAllPermissionsAndToken(helper, 'RFT');
+ await testForbidsAddingTooManyProperties(token, amount);
+ });
+});
+
+describe('ReFungible token properties permissions tests', () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+
+ before(async function() {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
+
+ async function prepare(helper: UniqueHelper): Promise<UniqueRFToken> {
+ const collection = await helper.rft.mintCollection(alice);
+ const token = await collection.mintToken(alice, 100n);
+
+ await collection.addAdmin(alice, {Substrate: bob.address});
+ await collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable: true, tokenOwner: true}}]);
+
+ return token;
+ }
+
+ itSub('Forbids adding token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) => {
+ const token = await prepare(helper);
+
+ await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+ await expect(token.setProperties(alice, [
+ {key: 'fractals', value: 'multiverse'},
+ ])).to.be.rejectedWith(/common\.NoPermission/);
+ });
+
+ itSub('Forbids mutating token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) => {
+ const token = await prepare(helper);
+
+ await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, tokenOwner: true}}]))
+ .to.be.fulfilled;
+
+ await expect(token.setProperties(alice, [
+ {key: 'fractals', value: 'multiverse'},
+ ])).to.be.fulfilled;
+
+ await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+ await expect(token.setProperties(alice, [
+ {key: 'fractals', value: 'want to rule the world'},
+ ])).to.be.rejectedWith(/common\.NoPermission/);
+ });
+
+ itSub('Forbids deleting token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) => {
+ const token = await prepare(helper);
+
+ await expect(token.setProperties(alice, [
+ {key: 'fractals', value: 'one headline - why believe it'},
+ ])).to.be.fulfilled;
+
+ await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+ await expect(token.deleteProperties(alice, ['fractals'])).
+ to.be.rejectedWith(/common\.NoPermission/);
+ });
+
+ itSub('Allows token property mutation with collectionOwner==true when admin doesn\'t have all pieces', async ({helper}) => {
+ const token = await prepare(helper);
+
+ await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+ await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, collectionAdmin: true}}]))
+ .to.be.fulfilled;
+
+ await expect(token.setProperties(alice, [
+ {key: 'fractals', value: 'multiverse'},
+ ])).to.be.fulfilled;
+ });
+});
tests/src/nesting/unnest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -15,14 +15,14 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, usingPlaygrounds} from '../util/playgrounds';
+import {expect, itSub, Pallets, usingPlaygrounds} from '../util';
describe('Integration Test: Unnesting', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice] = await helper.arrange.createAccounts([50n], donor);
});
});
@@ -91,7 +91,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
});
});
tests/src/nextSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/nextSponsoring.test.ts
+++ b/tests/src/nextSponsoring.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
+import {expect, itSub, Pallets, usingPlaygrounds} from './util';
const SPONSORING_TIMEOUT = 5;
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
});
});
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
// Pallets that must always be present
const requiredPallets = [
tests/src/refungible.test.tsdiffbeforeafterboth--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -15,11 +15,12 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from './util';
const MAX_REFUNGIBLE_PIECES = 1_000_000_000_000_000_000_000n;
describe('integration test: Refungible functionality:', async () => {
+ let donor: IKeyringPair;
let alice: IKeyringPair;
let bob: IKeyringPair;
@@ -27,7 +28,7 @@
await usingPlaygrounds(async (helper, privateKey) => {
requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
- const donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);
});
});
@@ -61,9 +62,9 @@
.to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);
});
- itSub('RPC method tokenOnewrs for refungible collection and token', async ({helper, privateKey}) => {
+ itSub('RPC method tokenOwners for refungible collection and token', async ({helper}) => {
const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
- const facelessCrowd = Array(7).fill(0).map((_, i) => ({Substrate: privateKey(`//Alice+${i}`).address}));
+ const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});
const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
@@ -82,7 +83,7 @@
expect(owners).to.deep.include.members([{Substrate: alice.address}, ethAcc, {Substrate: bob.address}, ...facelessCrowd]);
expect(owners.length).to.be.equal(10);
- const eleven = privateKey('//ALice+11');
+ const [eleven] = await helper.arrange.createAccounts([0n], donor);
expect(await token.transfer(alice, {Substrate: eleven.address}, 10n)).to.be.true;
expect((await token.getTop10Owners()).length).to.be.equal(10);
});
@@ -211,7 +212,8 @@
const token = await collection.mintToken(alice, 100n);
await token.repartition(alice, 200n);
const chainEvents = helper.chainLog.slice(-1)[0].events;
- expect(chainEvents).to.deep.include({
+ const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemCreated');
+ expect(event).to.deep.include({
section: 'common',
method: 'ItemCreated',
index: [66, 2],
@@ -221,7 +223,6 @@
{substrate: alice.address},
100n,
],
- phase: {applyExtrinsic: 2},
});
});
@@ -230,9 +231,10 @@
const token = await collection.mintToken(alice, 100n);
await token.repartition(alice, 50n);
const chainEvents = helper.chainLog.slice(-1)[0].events;
- expect(chainEvents).to.deep.include({
- method: 'ItemDestroyed',
+ const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemDestroyed');
+ expect(event).to.deep.include({
section: 'common',
+ method: 'ItemDestroyed',
index: [66, 3],
data: [
collection.collectionId,
@@ -240,7 +242,6 @@
{substrate: alice.address},
50n,
],
- phase: {applyExtrinsic: 2},
});
});
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
describe('Integration Test removeCollectionAdmin(collection_id, account_id):', () => {
let alice: IKeyringPair;
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
});
});
@@ -62,7 +62,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([20n, 10n, 10n], donor);
});
});
tests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
describe('integration test: ext. removeCollectionSponsor():', () => {
let donor: IKeyringPair;
@@ -24,7 +24,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
});
});
@@ -78,7 +78,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([20n, 10n, 10n], donor);
});
});
tests/src/rmrk/acceptNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/acceptNft.seqtest.ts
@@ -0,0 +1,107 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {
+ createCollection,
+ mintNft,
+ sendNft,
+ acceptNft,
+} from './util/tx';
+import {NftIdTuple} from './util/fetch';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
+
+describe('integration test: accept NFT', () => {
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ const createTestCollection = async (issuerUri: string) => {
+ return await createCollection(
+ api,
+ issuerUri,
+ 'accept-metadata',
+ null,
+ 'acpt',
+ );
+ };
+
+ it('accept NFT', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
+ await acceptNft(api, alice, bobCollectionId, childNftId, newOwnerNFT);
+
+ const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.true;
+ });
+
+ it('[negative] unable to accept NFT by a not-an-owner', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
+ const tx = acceptNft(api, bob, bobCollectionId, childNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative] unable to accept non-existing NFT', async () => {
+ const collectionId = 0;
+ const maxNftId = 0xFFFFFFFF;
+
+ const owner = alice;
+ const aliceCollectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, owner, aliceCollectionId, 'parent-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ const tx = acceptNft(api, alice, collectionId, maxNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] unable to accept NFT which is not sent', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ const tx = acceptNft(api, alice, bobCollectionId, childNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+
+ const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.false;
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/acceptNft.test.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {
- createCollection,
- mintNft,
- sendNft,
- acceptNft,
-} from './util/tx';
-import {NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
-
-describe('integration test: accept NFT', () => {
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- const createTestCollection = async (issuerUri: string) => {
- return await createCollection(
- api,
- issuerUri,
- 'accept-metadata',
- null,
- 'acpt',
- );
- };
-
- it('accept NFT', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
- await acceptNft(api, alice, bobCollectionId, childNftId, newOwnerNFT);
-
- const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.true;
- });
-
- it('[negative] unable to accept NFT by a not-an-owner', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
- const tx = acceptNft(api, bob, bobCollectionId, childNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative] unable to accept non-existing NFT', async () => {
- const collectionId = 0;
- const maxNftId = 0xFFFFFFFF;
-
- const owner = alice;
- const aliceCollectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, owner, aliceCollectionId, 'parent-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- const tx = acceptNft(api, alice, collectionId, maxNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] unable to accept NFT which is not sent', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- const tx = acceptNft(api, alice, bobCollectionId, childNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
-
- const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.false;
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/addResource.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/addResource.seqtest.ts
@@ -0,0 +1,437 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {NftIdTuple} from './util/fetch';
+import {expectTxFailure, getResourceById, requirePallets, Pallets} from './util/helpers';
+import {
+ addNftBasicResource,
+ acceptNftResource,
+ createCollection,
+ mintNft,
+ sendNft,
+ addNftSlotResource,
+ addNftComposableResource,
+} from './util/tx';
+import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';
+
+describe('integration test: add NFT resource', () => {
+ const alice = '//Alice';
+ const bob = '//Bob';
+ const src = 'test-res-src';
+ const metadata = 'test-res-metadata';
+ const license = 'test-res-license';
+ const thumb = 'test-res-thumb';
+
+ const nonexistentId = 99999;
+
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ it('add resource', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+ });
+
+ it('add a resource to the nested NFT', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(api, alice, alice, collectionIdAlice, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, alice, collectionIdAlice, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionIdAlice, childNftId, newOwnerNFT);
+
+ await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ childNftId,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+ });
+
+ it('add multiple resources', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const baseId = 42;
+ const slotId = 10;
+ const parts = [0, 5, 2];
+
+ const resourcesInfo = [];
+ const resourceNum = 4;
+
+ const checkResource = async (resource: ResourceInfo, resType: string, expectedId: number, expected: {
+ src: string,
+ metadata: string,
+ license: string,
+ thumb: string
+ }) => {
+
+ // FIXME A workaround. It seems it is a PolkadotJS bug.
+ // All of the following are `false`.
+ //
+ // console.log('>>> basic:', resource.resource.isBasic);
+ // console.log('>>> composable:', resource.resource.isComposable);
+ // console.log('>>> slot:', resource.resource.isSlot);
+ const resourceJson = (resource.resource.toHuman() as any)[resType];
+
+ expect(resource.id.toNumber(), 'Error: Invalid resource Id')
+ .to.be.eq(expectedId);
+
+ expect(resourceJson.src, 'Error: Invalid resource src')
+ .to.be.eq(expected.src);
+ expect(resourceJson.metadata, 'Error: Invalid resource metadata')
+ .to.be.eq(expected.metadata);
+ expect(resourceJson.license, 'Error: Invalid resource license')
+ .to.be.eq(expected.license);
+ expect(resourceJson.thumb, 'Error: Invalid resource thumb')
+ .to.be.eq(expected.thumb);
+ };
+
+ for (let i = 0; i < resourceNum; i++) {
+ resourcesInfo.push({
+ src: src + 'r-' + i,
+ metadata: metadata + 'r-' + i,
+ license: license + 'r-' + i,
+ thumb: thumb + 'r-' + i,
+ });
+ }
+
+ const firstBasicResourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ resourcesInfo[0].src,
+ resourcesInfo[0].metadata,
+ resourcesInfo[0].license,
+ resourcesInfo[0].thumb,
+ );
+
+ const secondBasicResourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ resourcesInfo[1].src,
+ resourcesInfo[1].metadata,
+ resourcesInfo[1].license,
+ resourcesInfo[1].thumb,
+ );
+
+ const composableResourceId = await addNftComposableResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ parts,
+ baseId,
+ resourcesInfo[2].src,
+ resourcesInfo[2].metadata,
+ resourcesInfo[2].license,
+ resourcesInfo[2].thumb,
+ );
+
+ const slotResourceId = await addNftSlotResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ baseId,
+ slotId,
+ resourcesInfo[3].src,
+ resourcesInfo[3].metadata,
+ resourcesInfo[3].license,
+ resourcesInfo[3].thumb,
+ );
+
+ const firstResource = await getResourceById(api, collectionIdAlice, nftAlice, firstBasicResourceId);
+ await checkResource(firstResource, 'Basic', firstBasicResourceId, resourcesInfo[0]);
+
+ const secondResource = await getResourceById(api, collectionIdAlice, nftAlice, secondBasicResourceId);
+ await checkResource(secondResource, 'Basic', secondBasicResourceId, resourcesInfo[1]);
+
+ const composableResource = await getResourceById(api, collectionIdAlice, nftAlice, composableResourceId);
+ await checkResource(composableResource, 'Composable', composableResourceId, resourcesInfo[2]);
+
+ const slotResource = await getResourceById(api, collectionIdAlice, nftAlice, slotResourceId);
+ await checkResource(slotResource, 'Slot', slotResourceId, resourcesInfo[3]);
+ });
+
+ it('[negative]: unable to add a resource to the non-existing NFT', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const tx = addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nonexistentId,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative]: unable to add a resource by a not-an-owner user', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const tx = addNftBasicResource(
+ api,
+ bob,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative]: unable to add a resource to the nested NFT if it isnt root owned by the caller', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(api, alice, alice, collectionIdAlice, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, alice, collectionIdAlice, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionIdAlice, childNftId, newOwnerNFT);
+
+ const tx = addNftBasicResource(
+ api,
+ bob,
+ 'added',
+ collectionIdAlice,
+ childNftId,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('accept resource', async () => {
+ const collectionIdBob = await createCollection(
+ api,
+ bob,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ bob,
+ alice,
+ collectionIdBob,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ bob,
+ 'pending',
+ collectionIdBob,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await acceptNftResource(api, alice, collectionIdBob, nftAlice, resourceId);
+ });
+
+ it('[negative]: unable to accept a non-existing resource', async () => {
+ const collectionIdBob = await createCollection(
+ api,
+ bob,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ bob,
+ alice,
+ collectionIdBob,
+ 'nft-metadata',
+ );
+
+ const tx = acceptNftResource(api, alice, collectionIdBob, nftAlice, nonexistentId);
+ await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
+ });
+
+ it('[negative]: unable to accept a resource by a not-an-NFT-owner user', async () => {
+ const collectionIdBob = await createCollection(
+ api,
+ bob,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ bob,
+ alice,
+ collectionIdBob,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ bob,
+ 'pending',
+ collectionIdBob,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = acceptNftResource(api, bob, collectionIdBob, nftAlice, resourceId);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative]: unable to accept a resource to a non-target NFT', async () => {
+ const collectionIdBob = await createCollection(
+ api,
+ bob,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ bob,
+ alice,
+ collectionIdBob,
+ 'nft-metadata',
+ );
+
+ const wrongNft = await mintNft(
+ api,
+ bob,
+ alice,
+ collectionIdBob,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ bob,
+ 'pending',
+ collectionIdBob,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = acceptNftResource(api, bob, collectionIdBob, wrongNft, resourceId);
+
+ await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
+ });
+
+
+ after(() => {
+ after(async() => { await api.disconnect(); });
+ });
+});
tests/src/rmrk/addResource.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/addResource.test.ts
+++ /dev/null
@@ -1,437 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {NftIdTuple} from './util/fetch';
-import {expectTxFailure, getResourceById, requirePallets, Pallets} from './util/helpers';
-import {
- addNftBasicResource,
- acceptNftResource,
- createCollection,
- mintNft,
- sendNft,
- addNftSlotResource,
- addNftComposableResource,
-} from './util/tx';
-import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';
-
-describe('integration test: add NFT resource', () => {
- const Alice = '//Alice';
- const Bob = '//Bob';
- const src = 'test-res-src';
- const metadata = 'test-res-metadata';
- const license = 'test-res-license';
- const thumb = 'test-res-thumb';
-
- const nonexistentId = 99999;
-
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- it('add resource', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
- });
-
- it('add a resource to the nested NFT', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');
- const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);
-
- await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- childNftId,
- src,
- metadata,
- license,
- thumb,
- );
- });
-
- it('add multiple resources', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const baseId = 42;
- const slotId = 10;
- const parts = [0, 5, 2];
-
- const resourcesInfo = [];
- const resourceNum = 4;
-
- const checkResource = async (resource: ResourceInfo, resType: string, expectedId: number, expected: {
- src: string,
- metadata: string,
- license: string,
- thumb: string
- }) => {
-
- // FIXME A workaround. It seems it is a PolkadotJS bug.
- // All of the following are `false`.
- //
- // console.log('>>> basic:', resource.resource.isBasic);
- // console.log('>>> composable:', resource.resource.isComposable);
- // console.log('>>> slot:', resource.resource.isSlot);
- const resourceJson = (resource.resource.toHuman() as any)[resType];
-
- expect(resource.id.toNumber(), 'Error: Invalid resource Id')
- .to.be.eq(expectedId);
-
- expect(resourceJson.src, 'Error: Invalid resource src')
- .to.be.eq(expected.src);
- expect(resourceJson.metadata, 'Error: Invalid resource metadata')
- .to.be.eq(expected.metadata);
- expect(resourceJson.license, 'Error: Invalid resource license')
- .to.be.eq(expected.license);
- expect(resourceJson.thumb, 'Error: Invalid resource thumb')
- .to.be.eq(expected.thumb);
- };
-
- for (let i = 0; i < resourceNum; i++) {
- resourcesInfo.push({
- src: src + 'r-' + i,
- metadata: metadata + 'r-' + i,
- license: license + 'r-' + i,
- thumb: thumb + 'r-' + i,
- });
- }
-
- const firstBasicResourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- resourcesInfo[0].src,
- resourcesInfo[0].metadata,
- resourcesInfo[0].license,
- resourcesInfo[0].thumb,
- );
-
- const secondBasicResourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- resourcesInfo[1].src,
- resourcesInfo[1].metadata,
- resourcesInfo[1].license,
- resourcesInfo[1].thumb,
- );
-
- const composableResourceId = await addNftComposableResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- parts,
- baseId,
- resourcesInfo[2].src,
- resourcesInfo[2].metadata,
- resourcesInfo[2].license,
- resourcesInfo[2].thumb,
- );
-
- const slotResourceId = await addNftSlotResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- baseId,
- slotId,
- resourcesInfo[3].src,
- resourcesInfo[3].metadata,
- resourcesInfo[3].license,
- resourcesInfo[3].thumb,
- );
-
- const firstResource = await getResourceById(api, collectionIdAlice, nftAlice, firstBasicResourceId);
- await checkResource(firstResource, 'Basic', firstBasicResourceId, resourcesInfo[0]);
-
- const secondResource = await getResourceById(api, collectionIdAlice, nftAlice, secondBasicResourceId);
- await checkResource(secondResource, 'Basic', secondBasicResourceId, resourcesInfo[1]);
-
- const composableResource = await getResourceById(api, collectionIdAlice, nftAlice, composableResourceId);
- await checkResource(composableResource, 'Composable', composableResourceId, resourcesInfo[2]);
-
- const slotResource = await getResourceById(api, collectionIdAlice, nftAlice, slotResourceId);
- await checkResource(slotResource, 'Slot', slotResourceId, resourcesInfo[3]);
- });
-
- it('[negative]: unable to add a resource to the non-existing NFT', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const tx = addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nonexistentId,
- src,
- metadata,
- license,
- thumb,
- );
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative]: unable to add a resource by a not-an-owner user', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const tx = addNftBasicResource(
- api,
- Bob,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative]: unable to add a resource to the nested NFT if it isnt root owned by the caller', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');
- const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);
-
- const tx = addNftBasicResource(
- api,
- Bob,
- 'added',
- collectionIdAlice,
- childNftId,
- src,
- metadata,
- license,
- thumb,
- );
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('accept resource', async () => {
- const collectionIdBob = await createCollection(
- api,
- Bob,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Bob,
- Alice,
- collectionIdBob,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Bob,
- 'pending',
- collectionIdBob,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- await acceptNftResource(api, Alice, collectionIdBob, nftAlice, resourceId);
- });
-
- it('[negative]: unable to accept a non-existing resource', async () => {
- const collectionIdBob = await createCollection(
- api,
- Bob,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Bob,
- Alice,
- collectionIdBob,
- 'nft-metadata',
- );
-
- const tx = acceptNftResource(api, Alice, collectionIdBob, nftAlice, nonexistentId);
- await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
- });
-
- it('[negative]: unable to accept a resource by a not-an-NFT-owner user', async () => {
- const collectionIdBob = await createCollection(
- api,
- Bob,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Bob,
- Alice,
- collectionIdBob,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Bob,
- 'pending',
- collectionIdBob,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = acceptNftResource(api, Bob, collectionIdBob, nftAlice, resourceId);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative]: unable to accept a resource to a non-target NFT', async () => {
- const collectionIdBob = await createCollection(
- api,
- Bob,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Bob,
- Alice,
- collectionIdBob,
- 'nft-metadata',
- );
-
- const wrongNft = await mintNft(
- api,
- Bob,
- Alice,
- collectionIdBob,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Bob,
- 'pending',
- collectionIdBob,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = acceptNftResource(api, Bob, collectionIdBob, wrongNft, resourceId);
-
- await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
- });
-
-
- after(() => {
- after(async() => { await api.disconnect(); });
- });
-});
tests/src/rmrk/addTheme.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/addTheme.seqtest.ts
@@ -0,0 +1,129 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {createBase, addTheme} from './util/tx';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {getThemeNames} from './util/fetch';
+
+describe('integration test: add Theme to Base', () => {
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkEquip]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ it('add default theme', async () => {
+ const baseId = await createBase(api, alice, 'default-themed-base', 'DTBase', []);
+ await addTheme(api, alice, baseId, {
+ name: 'default',
+ properties: [
+ {
+ key: 'some-key',
+ value: 'some-key-value',
+ },
+ {
+ key: 'another-key',
+ value: 'another-key-value',
+ },
+ ],
+ });
+ });
+
+ it('add default theme and a custom one', async () => {
+ const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);
+ await addTheme(api, alice, baseId, {
+ name: 'default',
+ properties: [
+ {
+ key: 'default-key',
+ value: 'default-key-value',
+ },
+ ],
+ });
+ await addTheme(api, alice, baseId, {
+ name: 'custom-theme',
+ properties: [
+ {
+ key: 'custom-key-0',
+ value: 'custom-key-value-0',
+ },
+ {
+ key: 'custom-key-1',
+ value: 'custom-key-value-1',
+ },
+ ],
+ });
+ });
+
+ it('fetch filtered theme keys', async () => {
+ const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);
+ await addTheme(api, alice, baseId, {
+ name: 'default',
+ properties: [
+ {
+ key: 'first-key',
+ value: 'first-key-value',
+ },
+ {
+ key: 'second-key',
+ value: 'second-key-value',
+ },
+ ],
+ }, ['second-key']);
+ });
+
+ it('fetch theme names', async() => {
+ const baseId = await createBase(api, alice, '3-themed-base', '3TBase', []);
+ const names = [
+ 'default',
+ 'first-theme',
+ 'second-theme',
+ ];
+
+ for (let i = 0; i < names.length; i++) {
+ await addTheme(api, alice, baseId, {name: names[i], properties: [{key: 'dummy', value: 'dummy'}]});
+ }
+
+ const fetchedNames = await getThemeNames(api, baseId);
+
+ for (let i = 0; i < names.length; i++) {
+ const isFound = fetchedNames.find((name) => name === names[i]) !== undefined;
+
+ expect(isFound, 'Error: invalid theme names').to.be.true;
+ }
+ });
+
+ it('[negative] unable to add theme to non-existing base', async () => {
+ const maxBaseId = 0xFFFFFFFF;
+ const tx = addTheme(api, alice, maxBaseId, {
+ name: 'default',
+ properties: [],
+ });
+
+ await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);
+ });
+
+ it('[negative] unable to add custom theme if no default theme', async () => {
+ const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);
+ const tx = addTheme(api, alice, baseId, {
+ name: 'custom-theme',
+ properties: [],
+ });
+
+ await expectTxFailure(/rmrkEquip\.NeedsDefaultThemeFirst/, tx);
+ });
+
+ it('[negative] unable to add theme by a not-an-owner', async () => {
+ const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);
+ const tx = addTheme(api, bob, baseId, {
+ name: 'default',
+ properties: [],
+ });
+
+ await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/addTheme.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/addTheme.test.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {createBase, addTheme} from './util/tx';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {getThemeNames} from './util/fetch';
-
-describe('integration test: add Theme to Base', () => {
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkEquip]);
- });
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- it('add default theme', async () => {
- const baseId = await createBase(api, alice, 'default-themed-base', 'DTBase', []);
- await addTheme(api, alice, baseId, {
- name: 'default',
- properties: [
- {
- key: 'some-key',
- value: 'some-key-value',
- },
- {
- key: 'another-key',
- value: 'another-key-value',
- },
- ],
- });
- });
-
- it('add default theme and a custom one', async () => {
- const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);
- await addTheme(api, alice, baseId, {
- name: 'default',
- properties: [
- {
- key: 'default-key',
- value: 'default-key-value',
- },
- ],
- });
- await addTheme(api, alice, baseId, {
- name: 'custom-theme',
- properties: [
- {
- key: 'custom-key-0',
- value: 'custom-key-value-0',
- },
- {
- key: 'custom-key-1',
- value: 'custom-key-value-1',
- },
- ],
- });
- });
-
- it('fetch filtered theme keys', async () => {
- const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);
- await addTheme(api, alice, baseId, {
- name: 'default',
- properties: [
- {
- key: 'first-key',
- value: 'first-key-value',
- },
- {
- key: 'second-key',
- value: 'second-key-value',
- },
- ],
- }, ['second-key']);
- });
-
- it('fetch theme names', async() => {
- const baseId = await createBase(api, alice, '3-themed-base', '3TBase', []);
- const names = [
- 'default',
- 'first-theme',
- 'second-theme',
- ];
-
- for (let i = 0; i < names.length; i++) {
- await addTheme(api, alice, baseId, {name: names[i], properties: [{key: 'dummy', value: 'dummy'}]});
- }
-
- const fetchedNames = await getThemeNames(api, baseId);
-
- for (let i = 0; i < names.length; i++) {
- const isFound = fetchedNames.find((name) => name === names[i]) !== undefined;
-
- expect(isFound, 'Error: invalid theme names').to.be.true;
- }
- });
-
- it('[negative] unable to add theme to non-existing base', async () => {
- const maxBaseId = 0xFFFFFFFF;
- const tx = addTheme(api, alice, maxBaseId, {
- name: 'default',
- properties: [],
- });
-
- await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);
- });
-
- it('[negative] unable to add custom theme if no default theme', async () => {
- const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);
- const tx = addTheme(api, alice, baseId, {
- name: 'custom-theme',
- properties: [],
- });
-
- await expectTxFailure(/rmrkEquip\.NeedsDefaultThemeFirst/, tx);
- });
-
- it('[negative] unable to add theme by a not-an-owner', async () => {
- const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);
- const tx = addTheme(api, bob, baseId, {
- name: 'default',
- properties: [],
- });
-
- await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/burnNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/burnNft.seqtest.ts
@@ -0,0 +1,170 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {NftIdTuple, getChildren} from './util/fetch';
+import {burnNft, createCollection, sendNft, mintNft} from './util/tx';
+
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+
+describe('integration test: burn nft', () => {
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+ it('burn nft', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const nftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+ await burnNft(api, alice, collectionId, nftId);
+ });
+ });
+
+ it('burn nft with children', async () => {
+ const collectionId = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const childNftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ const childrenBefore = await getChildren(api, collectionId, parentNftId);
+ expect(childrenBefore.length === 1, 'Error: parent NFT should have children')
+ .to.be.true;
+
+ const child = childrenBefore[0];
+ expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')
+ .to.be.true;
+
+ expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')
+ .to.be.true;
+
+ await burnNft(api, alice, collectionId, parentNftId);
+
+ const childrenAfter = await getChildren(api, collectionId, parentNftId);
+
+ expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;
+ });
+
+ it('burn child nft', async () => {
+ const collectionId = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const childNftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ const childrenBefore = await getChildren(api, collectionId, parentNftId);
+ expect(childrenBefore.length === 1, 'Error: parent NFT should have children')
+ .to.be.true;
+
+ const child = childrenBefore[0];
+ expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')
+ .to.be.true;
+
+ expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')
+ .to.be.true;
+
+ await burnNft(api, alice, collectionId, childNftId);
+
+ const childrenAfter = await getChildren(api, collectionId, parentNftId);
+
+ expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;
+ });
+
+ it('[negative] burn non-existing NFT', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const tx = burnNft(api, alice, collectionId, 99999);
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+ });
+
+ it('[negative] burn not an owner NFT user', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const nftId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+ const tx = burnNft(api, bob, collectionId, nftId);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/burnNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/burnNft.test.ts
+++ /dev/null
@@ -1,170 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {NftIdTuple, getChildren} from './util/fetch';
-import {burnNft, createCollection, sendNft, mintNft} from './util/tx';
-
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-
-describe('integration test: burn nft', () => {
- const Alice = '//Alice';
- const Bob = '//Bob';
-
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
- it('burn nft', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const nftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
- await burnNft(api, Alice, collectionId, nftId);
- });
- });
-
- it('burn nft with children', async () => {
- const collectionId = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const childNftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionId, childNftId, newOwnerNFT);
-
- const childrenBefore = await getChildren(api, collectionId, parentNftId);
- expect(childrenBefore.length === 1, 'Error: parent NFT should have children')
- .to.be.true;
-
- const child = childrenBefore[0];
- expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')
- .to.be.true;
-
- expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')
- .to.be.true;
-
- await burnNft(api, Alice, collectionId, parentNftId);
-
- const childrenAfter = await getChildren(api, collectionId, parentNftId);
-
- expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;
- });
-
- it('burn child nft', async () => {
- const collectionId = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const childNftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionId, childNftId, newOwnerNFT);
-
- const childrenBefore = await getChildren(api, collectionId, parentNftId);
- expect(childrenBefore.length === 1, 'Error: parent NFT should have children')
- .to.be.true;
-
- const child = childrenBefore[0];
- expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')
- .to.be.true;
-
- expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')
- .to.be.true;
-
- await burnNft(api, Alice, collectionId, childNftId);
-
- const childrenAfter = await getChildren(api, collectionId, parentNftId);
-
- expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;
- });
-
- it('[negative] burn non-existing NFT', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const tx = burnNft(api, Alice, collectionId, 99999);
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
- });
-
- it('[negative] burn not an owner NFT user', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const nftId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
- const tx = burnNft(api, Bob, collectionId, nftId);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/changeCollectionIssuer.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/changeCollectionIssuer.seqtest.ts
@@ -0,0 +1,53 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {
+ changeIssuer,
+ createCollection,
+} from './util/tx';
+
+describe('integration test: collection issuer', () => {
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+
+ it('change collection issuer', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ await changeIssuer(api, alice, collectionId, bob);
+ });
+ });
+
+ it('[negative] change not an owner NFT collection issuer', async () => {
+ await createCollection(api, bob, 'test-metadata', null, 'test-symbol').then(async (collectionId) => {
+ const tx = changeIssuer(api, alice, collectionId, bob);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+ });
+
+ it('[negative] change non-existigit NFT collection issuer', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async () => {
+ const tx = changeIssuer(api, alice, 99999, bob);
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/changeCollectionIssuer.test.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {
- changeIssuer,
- createCollection,
-} from './util/tx';
-
-describe('integration test: collection issuer', () => {
- const Alice = '//Alice';
- const Bob = '//Bob';
-
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
-
- it('change collection issuer', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- await changeIssuer(api, Alice, collectionId, Bob);
- });
- });
-
- it('[negative] change not an owner NFT collection issuer', async () => {
- await createCollection(api, Bob, 'test-metadata', null, 'test-symbol').then(async (collectionId) => {
- const tx = changeIssuer(api, Alice, collectionId, Bob);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
- });
-
- it('[negative] change non-existigit NFT collection issuer', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async () => {
- const tx = changeIssuer(api, Alice, 99999, Bob);
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/createBase.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/createBase.seqtest.ts
@@ -0,0 +1,88 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {requirePallets, Pallets} from './util/helpers';
+import {createCollection, createBase} from './util/tx';
+
+describe('integration test: create new Base', () => {
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);
+ });
+
+ const alice = '//Alice';
+
+ it('create empty Base', async () => {
+ await createBase(api, alice, 'empty-base-type', 'EBase', []);
+ });
+
+ it('create Base with fixed part', async () => {
+ await createBase(api, alice, 'fixedpart-base-type', 'FPBase', [
+ {
+ 'FixedPart': {
+ id: 42,
+ z: 0,
+ src: 'some-fixed-url',
+ },
+ },
+ ]);
+ });
+
+ it('create Base with slot part (no collection)', async () => {
+ await createBase(api, alice, 'slotpart-base-type', 'SPBase', [
+ {
+ 'SlotPart': {
+ id: 112,
+ equippable: 'Empty',
+ z: 0,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+ });
+
+ it('create Base with slot part (any collection)', async () => {
+ await createBase(api, alice, 'slotpartany-base-type', 'SPABase', [
+ {
+ 'SlotPart': {
+ id: 222,
+ equippable: 'All',
+ z: 1,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+ });
+
+ it('create Base with slot part (custom collections)', async () => {
+ const firstCollectionId = await createCollection(
+ api,
+ alice,
+ 'first-collection-meta',
+ null,
+ 'first-collection',
+ );
+
+ const secondCollectionId = await createCollection(
+ api,
+ alice,
+ 'first-collection-meta',
+ null,
+ 'first-collection',
+ );
+
+ await createBase(api, alice, 'slotpartcustom-base-type', 'SPCBase', [
+ {
+ 'SlotPart': {
+ id: 1024,
+ equippable: {
+ 'Custom': [firstCollectionId, secondCollectionId],
+ },
+ z: 2,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/createBase.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/createBase.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from './util/helpers';
-import {createCollection, createBase} from './util/tx';
-
-describe('integration test: create new Base', () => {
- let api: any;
- before(async function() {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);
- });
-
- const alice = '//Alice';
-
- it('create empty Base', async () => {
- await createBase(api, alice, 'empty-base-type', 'EBase', []);
- });
-
- it('create Base with fixed part', async () => {
- await createBase(api, alice, 'fixedpart-base-type', 'FPBase', [
- {
- 'FixedPart': {
- id: 42,
- z: 0,
- src: 'some-fixed-url',
- },
- },
- ]);
- });
-
- it('create Base with slot part (no collection)', async () => {
- await createBase(api, alice, 'slotpart-base-type', 'SPBase', [
- {
- 'SlotPart': {
- id: 112,
- equippable: 'Empty',
- z: 0,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
- });
-
- it('create Base with slot part (any collection)', async () => {
- await createBase(api, alice, 'slotpartany-base-type', 'SPABase', [
- {
- 'SlotPart': {
- id: 222,
- equippable: 'All',
- z: 1,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
- });
-
- it('create Base with slot part (custom collections)', async () => {
- const firstCollectionId = await createCollection(
- api,
- alice,
- 'first-collection-meta',
- null,
- 'first-collection',
- );
-
- const secondCollectionId = await createCollection(
- api,
- alice,
- 'first-collection-meta',
- null,
- 'first-collection',
- );
-
- await createBase(api, alice, 'slotpartcustom-base-type', 'SPCBase', [
- {
- 'SlotPart': {
- id: 1024,
- equippable: {
- 'Custom': [firstCollectionId, secondCollectionId],
- },
- z: 2,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/createCollection.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/createCollection.seqtest.ts
@@ -0,0 +1,25 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {requirePallets, Pallets} from './util/helpers';
+import {createCollection} from './util/tx';
+
+describe('Integration test: create new collection', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+
+ const alice = '//Alice';
+
+ it('create NFT collection', async () => {
+ await createCollection(api, alice, 'test-metadata', 42, 'test-symbol');
+ });
+
+ it('create NFT collection without token limit', async () => {
+ await createCollection(api, alice, 'no-limit-metadata', null, 'no-limit-symbol');
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/createCollection.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from './util/helpers';
-import {createCollection} from './util/tx';
-
-describe('Integration test: create new collection', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
-
- const alice = '//Alice';
-
- it('create NFT collection', async () => {
- await createCollection(api, alice, 'test-metadata', 42, 'test-symbol');
- });
-
- it('create NFT collection without token limit', async () => {
- await createCollection(api, alice, 'no-limit-metadata', null, 'no-limit-symbol');
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/deleteCollection.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/deleteCollection.seqtest.ts
@@ -0,0 +1,46 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, deleteCollection} from './util/tx';
+
+describe('integration test: delete collection', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ it('delete NFT collection', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ await deleteCollection(api, alice, collectionId.toString());
+ });
+ });
+
+ it('[negative] delete non-existing NFT collection', async () => {
+ const tx = deleteCollection(api, alice, '99999');
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
+ });
+
+ it('[negative] delete not an owner NFT collection', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const tx = deleteCollection(api, bob, collectionId.toString());
+ await expectTxFailure(/rmrkCore.NoPermission/, tx);
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/deleteCollection.test.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, deleteCollection} from './util/tx';
-
-describe('integration test: delete collection', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const Alice = '//Alice';
- const Bob = '//Bob';
-
- it('delete NFT collection', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- await deleteCollection(api, Alice, collectionId.toString());
- });
- });
-
- it('[negative] delete non-existing NFT collection', async () => {
- const tx = deleteCollection(api, Alice, '99999');
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
- });
-
- it('[negative] delete not an owner NFT collection', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const tx = deleteCollection(api, Bob, collectionId.toString());
- await expectTxFailure(/rmrkCore.NoPermission/, tx);
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/equipNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/equipNft.seqtest.ts
@@ -0,0 +1,340 @@
+import {ApiPromise} from '@polkadot/api';
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {getNft, NftIdTuple} from './util/fetch';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {
+ addNftComposableResource,
+ addNftSlotResource,
+ createBase,
+ createCollection,
+ equipNft,
+ mintNft,
+ sendNft,
+ unequipNft,
+} from './util/tx';
+
+const alice = '//Alice';
+const bob = '//Bob';
+
+const composableParts: number[] = [5, 2, 7];
+const composableSrc = 'test-cmp-src';
+const composableMetadata = 'test-cmp-metadata';
+const composableLicense = 'test-comp-license';
+const composableThumb = 'test-comp-thumb';
+
+const slotSrc = 'test-slot-src';
+const slotLicense = 'test-slot-license';
+const slotMetadata = 'test-slot-metadata';
+const slotThumb = 'test-slot-thumb';
+
+const slotId = 1;
+
+async function createTestCollection(api: ApiPromise): Promise<number> {
+ return createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+}
+
+async function mintTestNft(api: ApiPromise, collectionId: number): Promise<number> {
+ return await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+}
+
+async function mintChildNft(api: ApiPromise, collectionId: number, parentNftId: number): Promise<number> {
+ const nftChildId = await mintTestNft(api, collectionId);
+
+ const parentNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, nftChildId, parentNFT);
+
+ return nftChildId;
+}
+
+async function createTestBase(api: ApiPromise): Promise<number> {
+ return createBase(api, alice, 'test-base', 'DTBase', [
+ {
+ SlotPart: {
+ id: slotId,
+ equippable: 'All',
+ z: 1,
+ src: slotSrc,
+ },
+ },
+ ]);
+}
+
+async function addTestComposable(api: ApiPromise, collectionId: number, nftId: number, baseId: number) {
+ await addNftComposableResource(
+ api,
+ alice,
+ 'added',
+ collectionId,
+ nftId,
+ composableParts,
+ baseId,
+ composableSrc,
+ composableMetadata,
+ composableLicense,
+ composableThumb,
+ );
+}
+
+async function addTestSlot(api: ApiPromise, collectionId: number, nftId: number, baseId: number, slotId: number): Promise<number> {
+ return await addNftSlotResource(
+ api,
+ alice,
+ 'added',
+ collectionId,
+ nftId,
+ baseId,
+ slotId,
+ slotSrc,
+ slotMetadata,
+ slotLicense,
+ slotThumb,
+ );
+}
+
+async function checkEquipStatus(
+ api: ApiPromise,
+ expectedStatus: 'equipped' | 'unequipped',
+ collectionId: number,
+ nftId: number,
+) {
+ const itemNftDataOpt = await getNft(api, collectionId, nftId);
+ expect(itemNftDataOpt.isSome, 'Error: unable to fetch item NFT data');
+
+ const itemNftData = itemNftDataOpt.unwrap();
+ expect(itemNftData.equipped.isTrue, `Error: item NFT should be ${expectedStatus}`)
+ .to.be.equal(expectedStatus === 'equipped');
+}
+
+describe.skip('integration test: Equip NFT', () => {
+
+ let api: any;
+
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);
+ });
+
+ it('equip nft', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ await equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+
+ await checkEquipStatus(api, 'equipped', collectionId, nftChildId);
+ });
+
+ it('unequip nft', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ await equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+
+ await checkEquipStatus(api, 'equipped', collectionId, nftChildId);
+
+ await unequipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+ await checkEquipStatus(api, 'unequipped', collectionId, nftChildId);
+ });
+
+ it('[negative] equip NFT onto non-existing NFT', async () => {
+ const collectionId = await createTestCollection(api);
+
+ const nftChildId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+ const invalidEquipperNFT: NftIdTuple = [collectionId, 9999999];
+
+ const baseId = 0;
+ const resourceId = 0;
+
+ const tx = equipNft(api, alice, itemNFT, invalidEquipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] equip non-existing NFT', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'nft-metadata',
+ );
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const invalidItemNFT: NftIdTuple = [collectionId, 99999999];
+
+ const resourceId = 0;
+
+ const tx = equipNft(api, alice, invalidItemNFT, equipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] equip NFT by a not-an-owner user', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const tx = equipNft(api, bob, itemNFT, equipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
+ });
+
+ it('[negative] unable to equip NFT onto indirect parent NFT', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+ const nftGrandchildId = await mintChildNft(api, collectionId, nftChildId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftGrandchildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftGrandchildId];
+
+ const tx = equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkEquip\.MustBeDirectParent/, tx);
+ });
+
+ it('[negative] unable to equip NFT onto parent NFT with another base', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ const invalidBaseId = 99999;
+
+ const tx = equipNft(api, alice, itemNFT, equipperNFT, resourceId, invalidBaseId, slotId);
+ await expectTxFailure(/rmrkEquip\.NoResourceForThisBaseFoundOnNft/, tx);
+ });
+
+ it('[negative] unable to equip NFT into slot with another id', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createTestBase(api);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ const incorrectSlotId = slotId + 1;
+ const tx = equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, incorrectSlotId);
+ await expectTxFailure(/rmrkEquip\.ItemHasNoResourceToEquipThere/, tx);
+ });
+
+ it('[negative] unable to equip NFT with incorrect slot (fixed part)', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createBase(api, alice, 'test-base', 'DTBase', [
+ {
+ FixedPart: {
+ id: slotId,
+ equippable: 'All',
+ z: 1,
+ src: slotSrc,
+ },
+ },
+ ]);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ const tx = equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkEquip\.CantEquipFixedPart/, tx);
+ });
+
+ it('[negative] unable to equip NFT from a collection that is not allowed by the slot', async () => {
+ const collectionId = await createTestCollection(api);
+ const nftParentId = await mintTestNft(api, collectionId);
+ const nftChildId = await mintChildNft(api, collectionId, nftParentId);
+
+ const baseId = await createBase(api, alice, 'test-base', 'DTBase', [
+ {
+ SlotPart: {
+ id: 1,
+ z: 1,
+ equippable: 'Empty',
+ src: slotSrc,
+ },
+ },
+ ]);
+
+ await addTestComposable(api, collectionId, nftParentId, baseId);
+ const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
+
+ const equipperNFT: NftIdTuple = [collectionId, nftParentId];
+ const itemNFT: NftIdTuple = [collectionId, nftChildId];
+
+ const tx = equipNft(api, alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
+ await expectTxFailure(/rmrkEquip\.CollectionNotEquippable/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/equipNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/equipNft.test.ts
+++ /dev/null
@@ -1,340 +0,0 @@
-import {ApiPromise} from '@polkadot/api';
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {getNft, getParts, NftIdTuple} from './util/fetch';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {
- addNftComposableResource,
- addNftSlotResource,
- createBase,
- createCollection,
- equipNft,
- mintNft,
- sendNft,
- unequipNft,
-} from './util/tx';
-
-const Alice = '//Alice';
-const Bob = '//Bob';
-
-const composableParts: number[] = [5, 2, 7];
-const composableSrc = 'test-cmp-src';
-const composableMetadata = 'test-cmp-metadata';
-const composableLicense = 'test-comp-license';
-const composableThumb = 'test-comp-thumb';
-
-const slotSrc = 'test-slot-src';
-const slotLicense = 'test-slot-license';
-const slotMetadata = 'test-slot-metadata';
-const slotThumb = 'test-slot-thumb';
-
-const slotId = 1;
-
-async function createTestCollection(api: ApiPromise): Promise<number> {
- return createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-}
-
-async function mintTestNft(api: ApiPromise, collectionId: number): Promise<number> {
- return await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-}
-
-async function mintChildNft(api: ApiPromise, collectionId: number, parentNftId: number): Promise<number> {
- const nftChildId = await mintTestNft(api, collectionId);
-
- const parentNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionId, nftChildId, parentNFT);
-
- return nftChildId;
-}
-
-async function createTestBase(api: ApiPromise): Promise<number> {
- return createBase(api, Alice, 'test-base', 'DTBase', [
- {
- SlotPart: {
- id: slotId,
- equippable: 'All',
- z: 1,
- src: slotSrc,
- },
- },
- ]);
-}
-
-async function addTestComposable(api: ApiPromise, collectionId: number, nftId: number, baseId: number) {
- await addNftComposableResource(
- api,
- Alice,
- 'added',
- collectionId,
- nftId,
- composableParts,
- baseId,
- composableSrc,
- composableMetadata,
- composableLicense,
- composableThumb,
- );
-}
-
-async function addTestSlot(api: ApiPromise, collectionId: number, nftId: number, baseId: number, slotId: number): Promise<number> {
- return await addNftSlotResource(
- api,
- Alice,
- 'added',
- collectionId,
- nftId,
- baseId,
- slotId,
- slotSrc,
- slotMetadata,
- slotLicense,
- slotThumb,
- );
-}
-
-async function checkEquipStatus(
- api: ApiPromise,
- expectedStatus: 'equipped' | 'unequipped',
- collectionId: number,
- nftId: number,
-) {
- const itemNftDataOpt = await getNft(api, collectionId, nftId);
- expect(itemNftDataOpt.isSome, 'Error: unable to fetch item NFT data');
-
- const itemNftData = itemNftDataOpt.unwrap();
- expect(itemNftData.equipped.isTrue, `Error: item NFT should be ${expectedStatus}`)
- .to.be.equal(expectedStatus === 'equipped');
-}
-
-describe.skip('integration test: Equip NFT', () => {
-
- let api: any;
-
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);
- });
-
- it('equip nft', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
-
- await checkEquipStatus(api, 'equipped', collectionId, nftChildId);
- });
-
- it('unequip nft', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
-
- await checkEquipStatus(api, 'equipped', collectionId, nftChildId);
-
- await unequipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
- await checkEquipStatus(api, 'unequipped', collectionId, nftChildId);
- });
-
- it('[negative] equip NFT onto non-existing NFT', async () => {
- const collectionId = await createTestCollection(api);
-
- const nftChildId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
- const invalidEquipperNFT: NftIdTuple = [collectionId, 9999999];
-
- const baseId = 0;
- const resourceId = 0;
-
- const tx = equipNft(api, Alice, itemNFT, invalidEquipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] equip non-existing NFT', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'nft-metadata',
- );
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const invalidItemNFT: NftIdTuple = [collectionId, 99999999];
-
- const resourceId = 0;
-
- const tx = equipNft(api, Alice, invalidItemNFT, equipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] equip NFT by a not-an-owner user', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const tx = equipNft(api, Bob, itemNFT, equipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
- });
-
- it('[negative] unable to equip NFT onto indirect parent NFT', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
- const nftGrandchildId = await mintChildNft(api, collectionId, nftChildId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftGrandchildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftGrandchildId];
-
- const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkEquip\.MustBeDirectParent/, tx);
- });
-
- it('[negative] unable to equip NFT onto parent NFT with another base', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- const invalidBaseId = 99999;
-
- const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, invalidBaseId, slotId);
- await expectTxFailure(/rmrkEquip\.NoResourceForThisBaseFoundOnNft/, tx);
- });
-
- it('[negative] unable to equip NFT into slot with another id', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createTestBase(api);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- const incorrectSlotId = slotId + 1;
- const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, incorrectSlotId);
- await expectTxFailure(/rmrkEquip\.ItemHasNoResourceToEquipThere/, tx);
- });
-
- it('[negative] unable to equip NFT with incorrect slot (fixed part)', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [
- {
- FixedPart: {
- id: slotId,
- equippable: 'All',
- z: 1,
- src: slotSrc,
- },
- },
- ]);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkEquip\.CantEquipFixedPart/, tx);
- });
-
- it('[negative] unable to equip NFT from a collection that is not allowed by the slot', async () => {
- const collectionId = await createTestCollection(api);
- const nftParentId = await mintTestNft(api, collectionId);
- const nftChildId = await mintChildNft(api, collectionId, nftParentId);
-
- const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [
- {
- SlotPart: {
- id: 1,
- z: 1,
- equippable: 'Empty',
- src: slotSrc,
- },
- },
- ]);
-
- await addTestComposable(api, collectionId, nftParentId, baseId);
- const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);
-
- const equipperNFT: NftIdTuple = [collectionId, nftParentId];
- const itemNFT: NftIdTuple = [collectionId, nftChildId];
-
- const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);
- await expectTxFailure(/rmrkEquip\.CollectionNotEquippable/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/getOwnedNfts.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/getOwnedNfts.seqtest.ts
@@ -0,0 +1,80 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {requirePallets, Pallets} from './util/helpers';
+import {getOwnedNfts} from './util/fetch';
+import {mintNft, createCollection} from './util/tx';
+
+describe('integration test: get owned NFTs', () => {
+ let api: any;
+
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+ const alice = '//Alice';
+
+ it('fetch all NFTs owned by a user', async () => {
+ const owner = alice;
+ const collectionMetadata = 'aliceCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'AliceSym';
+ const recipientUri = null;
+ const royalty = null;
+ const nftMetadata = 'alice-NFT-metadata';
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ const nftIds = [
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata + '-0',
+ recipientUri,
+ royalty,
+ ),
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata + '-1',
+ recipientUri,
+ royalty,
+ ),
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata + '-2',
+ recipientUri,
+ royalty,
+ ),
+ ];
+
+ const ownedNfts = await getOwnedNfts(api, alice, collectionId);
+
+ const isFound = (nftId: number) => {
+ return ownedNfts.find((ownedNftId) => {
+ return ownedNftId === nftId;
+ }) !== undefined;
+ };
+
+ nftIds.forEach((nftId) => {
+ expect(isFound(nftId), `NFT ${nftId} should be owned by ${alice}`)
+ .to.be.true;
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/getOwnedNfts.test.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from './util/helpers';
-import {getOwnedNfts} from './util/fetch';
-import {mintNft, createCollection} from './util/tx';
-
-describe('integration test: get owned NFTs', () => {
- let api: any;
-
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
- const alice = '//Alice';
-
- it('fetch all NFTs owned by a user', async () => {
- const owner = alice;
- const collectionMetadata = 'aliceCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'AliceSym';
- const recipientUri = null;
- const royalty = null;
- const nftMetadata = 'alice-NFT-metadata';
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- const nftIds = [
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata + '-0',
- recipientUri,
- royalty,
- ),
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata + '-1',
- recipientUri,
- royalty,
- ),
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata + '-2',
- recipientUri,
- royalty,
- ),
- ];
-
- const ownedNfts = await getOwnedNfts(api, alice, collectionId);
-
- const isFound = (nftId: number) => {
- return ownedNfts.find((ownedNftId) => {
- return ownedNftId === nftId;
- }) !== undefined;
- };
-
- nftIds.forEach((nftId) => {
- expect(isFound(nftId), `NFT ${nftId} should be owned by ${alice}`)
- .to.be.true;
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/lockCollection.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/lockCollection.seqtest.ts
@@ -0,0 +1,116 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, lockCollection, mintNft} from './util/tx';
+
+describe('integration test: lock collection', () => {
+ const alice = '//Alice';
+ const bob = '//Bob';
+ const max = 5;
+
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ it('lock collection', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ await lockCollection(api, alice, collectionId);
+ });
+ });
+
+ it('[negative] lock non-existing NFT collection', async () => {
+ const tx = lockCollection(api, alice, 99999);
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
+ });
+
+ it('[negative] lock not an owner NFT collection issuer', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const tx = lockCollection(api, bob, collectionId);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+ });
+
+ it('lock collection with minting', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ max,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ for (let i = 0; i < 5; i++) {
+ await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'test-metadata',
+ null,
+ null,
+ );
+ }
+ await lockCollection(api, alice, collectionId, max);
+ });
+ });
+
+ it('[negative] unable to mint NFT inside a locked collection', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ max,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ await lockCollection(api, alice, collectionId);
+ const tx = mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'test-metadata',
+ null,
+ null,
+ );
+ await expectTxFailure(/rmrkCore\.CollectionFullOrLocked/, tx);
+ });
+ });
+
+ it('[negative] unable to mint NFT inside a full collection', async () => {
+ await createCollection(api, alice, 'test-metadata', 1, 'test-symbol').then(async (collectionId) => {
+ await mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'test-metadata',
+ null,
+ null,
+ );
+ const tx = mintNft(
+ api,
+ alice,
+ alice,
+ collectionId,
+ 'test-metadata',
+ null,
+ null,
+ );
+ await expectTxFailure(/rmrkCore\.CollectionFullOrLocked/, tx);
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/lockCollection.test.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, lockCollection, mintNft} from './util/tx';
-
-describe('integration test: lock collection', () => {
- const Alice = '//Alice';
- const Bob = '//Bob';
- const Max = 5;
-
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- it('lock collection', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- await lockCollection(api, Alice, collectionId);
- });
- });
-
- it('[negative] lock non-existing NFT collection', async () => {
- const tx = lockCollection(api, Alice, 99999);
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
- });
-
- it('[negative] lock not an owner NFT collection issuer', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const tx = lockCollection(api, Bob, collectionId);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
- });
-
- it('lock collection with minting', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- Max,
- 'test-symbol',
- ).then(async (collectionId) => {
- for (let i = 0; i < 5; i++) {
- await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'test-metadata',
- null,
- null,
- );
- }
- await lockCollection(api, Alice, collectionId, Max);
- });
- });
-
- it('[negative] unable to mint NFT inside a locked collection', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- Max,
- 'test-symbol',
- ).then(async (collectionId) => {
- await lockCollection(api, Alice, collectionId);
- const tx = mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'test-metadata',
- null,
- null,
- );
- await expectTxFailure(/rmrkCore\.CollectionFullOrLocked/, tx);
- });
- });
-
- it('[negative] unable to mint NFT inside a full collection', async () => {
- await createCollection(api, Alice, 'test-metadata', 1, 'test-symbol').then(async (collectionId) => {
- await mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'test-metadata',
- null,
- null,
- );
- const tx = mintNft(
- api,
- Alice,
- Alice,
- collectionId,
- 'test-metadata',
- null,
- null,
- );
- await expectTxFailure(/rmrkCore\.CollectionFullOrLocked/, tx);
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/mintNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/mintNft.seqtest.ts
@@ -0,0 +1,211 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {getNft} from './util/fetch';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, mintNft} from './util/tx';
+
+describe('integration test: mint new NFT', () => {
+ let api: any;
+
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+ const maxCollectionId = 0xFFFFFFFF;
+ const maxNftId = 0xFFFFFFFF;
+
+ it('mint NFT', async () => {
+ const owner = null;
+ const collectionMetadata = 'mintingCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'MCS';
+ const recipientUri = null;
+ const royalty = null;
+ const nftMetadata = 'NFT-test-metadata';
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata,
+ recipientUri,
+ royalty,
+ );
+ });
+
+ it('mint NFT and set another owner', async () => {
+ const owner = bob;
+ const collectionMetadata = 'setOwnerCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'SOCS';
+ const recipientUri = null;
+ const royalty = null;
+ const nftMetadata = 'setOwner-NFT-metadata';
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata,
+ recipientUri,
+ royalty,
+ );
+ });
+
+ it('mint NFT with recipient and roalty', async () => {
+ const owner = alice;
+ const collectionMetadata = 'mintingCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'MCS';
+ const recipientUri = bob;
+ const royalty = 70000;
+ const nftMetadata = 'recipient-royalty-NFT-test-metadata';
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata,
+ recipientUri,
+ royalty,
+ );
+ });
+
+ it('mint NFT with resources', async () => {
+ const owner = alice;
+ const collectionMetadata = 'mintingCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'MCS';
+ const nftMetadata = 'NFT-with-resources-test-metadata';
+ const resources = [
+ {
+ basic: {
+ metadata: 'basic-resource-nft-minting',
+ },
+ }, {
+ slot: {
+ metadata: 'slot-resource-nft-minting',
+ slot: 9,
+ },
+ }, {
+ composable: {
+ metadata: 'composable-resource-nft-minting',
+ parts: [0, 5, 2],
+ },
+ }, {
+ slot: {
+ metadata: 'slot-resource-nft-minting-2',
+ thumb: 'srnm2',
+ base: 5,
+ },
+ },
+ ];
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ await mintNft(
+ api,
+ alice,
+ owner,
+ collectionId,
+ nftMetadata,
+ null,
+ null,
+ true,
+ resources,
+ );
+ });
+
+ it('[negative] unable to mint NFT within non-existing collection', async () => {
+ const owner = alice;
+ const recipientUri = null;
+ const royalty = null;
+ const nftMetadata = 'NFT-test-metadata';
+
+ const tx = mintNft(
+ api,
+ alice,
+ owner,
+ maxCollectionId,
+ nftMetadata,
+ recipientUri,
+ royalty,
+ );
+
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
+ });
+
+ it("[negative] unable to mint NFT by a user that isn't the owner of the collection", async () => {
+ const owner = alice;
+ const collectionMetadata = 'mintingCollectionMetadata';
+ const collectionMax = null;
+ const collectionSymbol = 'MCS';
+ const recipientUri = null;
+ const royalty = null;
+ const nftMetadata = 'NFT-test-metadata';
+
+ const collectionId = await createCollection(
+ api,
+ alice,
+ collectionMetadata,
+ collectionMax,
+ collectionSymbol,
+ );
+
+ const tx = mintNft(
+ api,
+ bob,
+ owner,
+ collectionId,
+ nftMetadata,
+ recipientUri,
+ royalty,
+ );
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative] unable to fetch non-existing NFT', async () => {
+ const nft = await getNft(api, maxCollectionId, maxNftId);
+ expect(nft.isSome).to.be.false;
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/mintNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/mintNft.test.ts
+++ /dev/null
@@ -1,211 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {getNft} from './util/fetch';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, mintNft} from './util/tx';
-
-describe('integration test: mint new NFT', () => {
- let api: any;
-
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
- const alice = '//Alice';
- const bob = '//Bob';
- const maxCollectionId = 0xFFFFFFFF;
- const maxNftId = 0xFFFFFFFF;
-
- it('mint NFT', async () => {
- const owner = null;
- const collectionMetadata = 'mintingCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'MCS';
- const recipientUri = null;
- const royalty = null;
- const nftMetadata = 'NFT-test-metadata';
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata,
- recipientUri,
- royalty,
- );
- });
-
- it('mint NFT and set another owner', async () => {
- const owner = bob;
- const collectionMetadata = 'setOwnerCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'SOCS';
- const recipientUri = null;
- const royalty = null;
- const nftMetadata = 'setOwner-NFT-metadata';
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata,
- recipientUri,
- royalty,
- );
- });
-
- it('mint NFT with recipient and roalty', async () => {
- const owner = alice;
- const collectionMetadata = 'mintingCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'MCS';
- const recipientUri = bob;
- const royalty = 70000;
- const nftMetadata = 'recipient-royalty-NFT-test-metadata';
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata,
- recipientUri,
- royalty,
- );
- });
-
- it('mint NFT with resources', async () => {
- const owner = alice;
- const collectionMetadata = 'mintingCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'MCS';
- const nftMetadata = 'NFT-with-resources-test-metadata';
- const resources = [
- {
- basic: {
- metadata: 'basic-resource-nft-minting',
- },
- }, {
- slot: {
- metadata: 'slot-resource-nft-minting',
- slot: 9,
- },
- }, {
- composable: {
- metadata: 'composable-resource-nft-minting',
- parts: [0, 5, 2],
- },
- }, {
- slot: {
- metadata: 'slot-resource-nft-minting-2',
- thumb: 'srnm2',
- base: 5,
- },
- },
- ];
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- await mintNft(
- api,
- alice,
- owner,
- collectionId,
- nftMetadata,
- null,
- null,
- true,
- resources,
- );
- });
-
- it('[negative] unable to mint NFT within non-existing collection', async () => {
- const owner = alice;
- const recipientUri = null;
- const royalty = null;
- const nftMetadata = 'NFT-test-metadata';
-
- const tx = mintNft(
- api,
- alice,
- owner,
- maxCollectionId,
- nftMetadata,
- recipientUri,
- royalty,
- );
-
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
- });
-
- it("[negative] unable to mint NFT by a user that isn't the owner of the collection", async () => {
- const owner = alice;
- const collectionMetadata = 'mintingCollectionMetadata';
- const collectionMax = null;
- const collectionSymbol = 'MCS';
- const recipientUri = null;
- const royalty = null;
- const nftMetadata = 'NFT-test-metadata';
-
- const collectionId = await createCollection(
- api,
- alice,
- collectionMetadata,
- collectionMax,
- collectionSymbol,
- );
-
- const tx = mintNft(
- api,
- bob,
- owner,
- collectionId,
- nftMetadata,
- recipientUri,
- royalty,
- );
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative] unable to fetch non-existing NFT', async () => {
- const nft = await getNft(api, maxCollectionId, maxNftId);
- expect(nft.isSome).to.be.false;
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/rejectNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/rejectNft.seqtest.ts
@@ -0,0 +1,94 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {
+ createCollection,
+ mintNft,
+ sendNft,
+ rejectNft,
+} from './util/tx';
+import {NftIdTuple} from './util/fetch';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
+
+describe('integration test: reject NFT', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ const createTestCollection = async (issuerUri: string) => {
+ return await createCollection(
+ api,
+ issuerUri,
+ 'reject-metadata',
+ null,
+ 'rjct',
+ );
+ };
+
+ it('reject NFT', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
+ await rejectNft(api, alice, bobCollectionId, childNftId);
+
+ const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
+ expect(isChild, 'Error: rejected NFT is still a child of the target NFT').to.be.false;
+ });
+
+ it('[negative] unable to reject NFT by a not-an-owner', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
+ const tx = rejectNft(api, bob, bobCollectionId, childNftId);
+
+ await expectTxFailure(/rmrkCore\.CannotRejectNonOwnedNft/, tx);
+ });
+
+ it('[negative] unable to reject non-existing NFT', async () => {
+ const maxNftId = 0xFFFFFFFF;
+
+ const collectionId = await createTestCollection(alice);
+
+ const tx = rejectNft(api, alice, collectionId, maxNftId);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] unable to reject NFT which is not sent', async () => {
+ const ownerAlice = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'parent-nft-metadata');
+
+ const tx = rejectNft(api, alice, collectionId, nftId);
+
+ await expectTxFailure(/rmrkCore\.CannotRejectNonPendingNft/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rejectNft.test.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {
- createCollection,
- mintNft,
- sendNft,
- rejectNft,
-} from './util/tx';
-import {getChildren, NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
-
-describe('integration test: reject NFT', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
-
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- const createTestCollection = async (issuerUri: string) => {
- return await createCollection(
- api,
- issuerUri,
- 'reject-metadata',
- null,
- 'rjct',
- );
- };
-
- it('reject NFT', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
- await rejectNft(api, alice, bobCollectionId, childNftId);
-
- const isChild = await isNftChildOfAnother(api, bobCollectionId, childNftId, newOwnerNFT);
- expect(isChild, 'Error: rejected NFT is still a child of the target NFT').to.be.false;
- });
-
- it('[negative] unable to reject NFT by a not-an-owner', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- await sendNft(api, 'pending', ownerBob, bobCollectionId, childNftId, newOwnerNFT);
- const tx = rejectNft(api, bob, bobCollectionId, childNftId);
-
- await expectTxFailure(/rmrkCore\.CannotRejectNonOwnedNft/, tx);
- });
-
- it('[negative] unable to reject non-existing NFT', async () => {
- const maxNftId = 0xFFFFFFFF;
-
- const collectionId = await createTestCollection(alice);
-
- const tx = rejectNft(api, alice, collectionId, maxNftId);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] unable to reject NFT which is not sent', async () => {
- const ownerAlice = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'parent-nft-metadata');
-
- const tx = rejectNft(api, alice, collectionId, nftId);
-
- await expectTxFailure(/rmrkCore\.CannotRejectNonPendingNft/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/removeResource.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/removeResource.seqtest.ts
@@ -0,0 +1,340 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {NftIdTuple} from './util/fetch';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {
+ acceptResourceRemoval, addNftBasicResource, createCollection, mintNft, removeNftResource, sendNft,
+} from './util/tx';
+
+
+
+
+describe('Integration test: remove nft resource', () => {
+ let api: any;
+ before(async function() {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+ const src = 'test-basic-src';
+ const metadata = 'test-basic-metadata';
+ const license = 'test-basic-license';
+ const thumb = 'test-basic-thumb';
+
+ it('deleting a resource directly by the NFT owner', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await removeNftResource(api, 'removed', alice, collectionIdAlice, nftAlice, resourceId);
+ });
+
+ it('deleting resources indirectly by the NFT owner', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(api, alice, alice, collectionIdAlice, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, alice, collectionIdAlice, 'child-nft-metadata');
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ childNftId,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionIdAlice, childNftId, newOwnerNFT);
+
+ await removeNftResource(api, 'removed', alice, collectionIdAlice, childNftId, resourceId);
+ });
+
+ it('deleting a resource by the collection owner', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftBob = await mintNft(
+ api,
+ alice,
+ bob,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'pending',
+ collectionIdAlice,
+ nftBob,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ await removeNftResource(api, 'pending', alice, collectionIdAlice, nftBob, resourceId);
+ await acceptResourceRemoval(api, bob, collectionIdAlice, nftBob, resourceId);
+ });
+
+ it('deleting a resource in a nested NFT by the collection owner', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const parentNftId = await mintNft(
+ api,
+ alice,
+ bob,
+ collectionIdAlice,
+ 'parent-nft-metadata',
+ );
+ const childNftId = await mintNft(
+ api,
+ alice,
+ bob,
+ collectionIdAlice,
+ 'child-nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'pending',
+ collectionIdAlice,
+ childNftId,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
+
+ await sendNft(api, 'sent', bob, collectionIdAlice, childNftId, newOwnerNFT);
+
+ await removeNftResource(api, 'pending', alice, collectionIdAlice, childNftId, resourceId);
+ await acceptResourceRemoval(api, bob, collectionIdAlice, childNftId, resourceId);
+ });
+
+ it('[negative]: can\'t delete a resource in a non-existing collection', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = removeNftResource(api, 'removed', alice, 0xFFFFFFFF, nftAlice, resourceId);
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx); // FIXME: inappropriate error message (NoAvailableNftId)
+ });
+
+ it('[negative]: only collection owner can delete a resource', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = removeNftResource(api, 'removed', bob, collectionIdAlice, nftAlice, resourceId);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative]: cannot delete a resource that does not exist', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const tx = removeNftResource(api, 'removed', alice, collectionIdAlice, nftAlice, 127);
+ await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
+ });
+
+ it('[negative]: Cannot accept deleting resource without owner attempt do delete it', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftBob = await mintNft(
+ api,
+ alice,
+ bob,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'pending',
+ collectionIdAlice,
+ nftBob,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = acceptResourceRemoval(api, bob, collectionIdAlice, nftBob, resourceId);
+ await expectTxFailure(/rmrkCore\.ResourceNotPending/, tx);
+ });
+
+ it('[negative]: cannot confirm the deletion of a non-existing resource', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftBob = await mintNft(
+ api,
+ alice,
+ bob,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const tx = acceptResourceRemoval(api, bob, collectionIdAlice, nftBob, 127);
+ await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
+ });
+
+ it('[negative]: Non-owner user cannot confirm the deletion of resource', async () => {
+ const collectionIdAlice = await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ );
+
+ const nftAlice = await mintNft(
+ api,
+ alice,
+ alice,
+ collectionIdAlice,
+ 'nft-metadata',
+ );
+
+ const resourceId = await addNftBasicResource(
+ api,
+ alice,
+ 'added',
+ collectionIdAlice,
+ nftAlice,
+ src,
+ metadata,
+ license,
+ thumb,
+ );
+
+ const tx = acceptResourceRemoval(api, bob, collectionIdAlice, nftAlice, resourceId);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/removeResource.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/removeResource.test.ts
+++ /dev/null
@@ -1,347 +0,0 @@
-import {expect} from 'chai';
-import privateKey from '../substrate/privateKey';
-import {executeTransaction, getApiConnection} from '../substrate/substrate-api';
-import {getNft, NftIdTuple} from './util/fetch';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {
- acceptNft, acceptResourceRemoval, addNftBasicResource,
- createBase,
- createCollection,
- mintNft, removeNftResource, sendNft,
-} from './util/tx';
-
-
-
-
-describe('Integration test: remove nft resource', () => {
- let api: any;
- let ss58Format: string;
- before(async function() {
- api = await getApiConnection();
- ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const Alice = '//Alice';
- const Bob = '//Bob';
- const src = 'test-basic-src';
- const metadata = 'test-basic-metadata';
- const license = 'test-basic-license';
- const thumb = 'test-basic-thumb';
-
- it('deleting a resource directly by the NFT owner', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- await removeNftResource(api, 'removed', Alice, collectionIdAlice, nftAlice, resourceId);
- });
-
- it('deleting resources indirectly by the NFT owner', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');
- const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- childNftId,
- src,
- metadata,
- license,
- thumb,
- );
-
- const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
-
- await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);
-
- await removeNftResource(api, 'removed', Alice, collectionIdAlice, childNftId, resourceId);
- });
-
- it('deleting a resource by the collection owner', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftBob = await mintNft(
- api,
- Alice,
- Bob,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'pending',
- collectionIdAlice,
- nftBob,
- src,
- metadata,
- license,
- thumb,
- );
-
- await removeNftResource(api, 'pending', Alice, collectionIdAlice, nftBob, resourceId);
- await acceptResourceRemoval(api, Bob, collectionIdAlice, nftBob, resourceId);
- });
-
- it('deleting a resource in a nested NFT by the collection owner', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const parentNftId = await mintNft(
- api,
- Alice,
- Bob,
- collectionIdAlice,
- 'parent-nft-metadata',
- );
- const childNftId = await mintNft(
- api,
- Alice,
- Bob,
- collectionIdAlice,
- 'child-nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'pending',
- collectionIdAlice,
- childNftId,
- src,
- metadata,
- license,
- thumb,
- );
-
- const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];
-
- await sendNft(api, 'sent', Bob, collectionIdAlice, childNftId, newOwnerNFT);
-
- await removeNftResource(api, 'pending', Alice, collectionIdAlice, childNftId, resourceId);
- await acceptResourceRemoval(api, Bob, collectionIdAlice, childNftId, resourceId);
- });
-
- it('[negative]: can\'t delete a resource in a non-existing collection', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = removeNftResource(api, 'removed', Alice, 0xFFFFFFFF, nftAlice, resourceId);
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx); // FIXME: inappropriate error message (NoAvailableNftId)
- });
-
- it('[negative]: only collection owner can delete a resource', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = removeNftResource(api, 'removed', Bob, collectionIdAlice, nftAlice, resourceId);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative]: cannot delete a resource that does not exist', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const tx = removeNftResource(api, 'removed', Alice, collectionIdAlice, nftAlice, 127);
- await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
- });
-
- it('[negative]: Cannot accept deleting resource without owner attempt do delete it', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftBob = await mintNft(
- api,
- Alice,
- Bob,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'pending',
- collectionIdAlice,
- nftBob,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = acceptResourceRemoval(api, Bob, collectionIdAlice, nftBob, resourceId);
- await expectTxFailure(/rmrkCore\.ResourceNotPending/, tx);
- });
-
- it('[negative]: cannot confirm the deletion of a non-existing resource', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftBob = await mintNft(
- api,
- Alice,
- Bob,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const tx = acceptResourceRemoval(api, Bob, collectionIdAlice, nftBob, 127);
- await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);
- });
-
- it('[negative]: Non-owner user cannot confirm the deletion of resource', async () => {
- const collectionIdAlice = await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- );
-
- const nftAlice = await mintNft(
- api,
- Alice,
- Alice,
- collectionIdAlice,
- 'nft-metadata',
- );
-
- const resourceId = await addNftBasicResource(
- api,
- Alice,
- 'added',
- collectionIdAlice,
- nftAlice,
- src,
- metadata,
- license,
- thumb,
- );
-
- const tx = acceptResourceRemoval(api, Bob, collectionIdAlice, nftAlice, resourceId);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/rmrkIsolation.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/rmrkIsolation.seqtest.ts
@@ -0,0 +1,225 @@
+import {executeTransaction} from '../substrate/substrate-api';
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, expect, usingPlaygrounds, Pallets, requirePalletsOrSkip} from '../util';
+import {UniqueHelper} from '../util/playgrounds/unique';
+
+let alice: IKeyringPair;
+let bob: IKeyringPair;
+
+async function createRmrkCollection(helper: UniqueHelper, sender: IKeyringPair): Promise<{uniqueId: number, rmrkId: number}> {
+ const result = await helper.executeExtrinsic(sender, 'api.tx.rmrkCore.createCollection', ['metadata', null, 'symbol'], true);
+
+ const uniqueId = helper.util.extractCollectionIdFromCreationResult(result);
+
+ let rmrkId = null;
+ result.result.events.forEach(({event: {data, method, section}}) => {
+ if ((section === 'rmrkCore') && (method === 'CollectionCreated')) {
+ rmrkId = parseInt(data[1].toString(), 10);
+ }
+ });
+
+ if (rmrkId === null) {
+ throw Error('No rmrkCore.CollectionCreated event was found!');
+ }
+
+ return {
+ uniqueId,
+ rmrkId,
+ };
+}
+
+async function createRmrkNft(helper: UniqueHelper, sender: IKeyringPair, collectionId: number): Promise<number> {
+ const result = await helper.executeExtrinsic(
+ sender,
+ 'api.tx.rmrkCore.mintNft',
+ [
+ sender.address,
+ collectionId,
+ sender.address,
+ null,
+ 'nft-metadata',
+ true,
+ null,
+ ],
+ true,
+ );
+
+ let rmrkNftId = null;
+ result.result.events.forEach(({event: {data, method, section}}) => {
+ if ((section === 'rmrkCore') && (method === 'NftMinted')) {
+ rmrkNftId = parseInt(data[2].toString(), 10);
+ }
+ });
+
+ if (rmrkNftId === null) {
+ throw Error('No rmrkCore.NftMinted event was found!');
+ }
+
+ return rmrkNftId;
+}
+
+describe('RMRK External Integration Test', async () => {
+ before(async function() {
+ await usingPlaygrounds(async (_helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ });
+ });
+
+ itSub.ifWithPallets('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', [Pallets.RmrkCore], async ({helper}) => {
+ // throw away collection to bump last Unique collection ID to test ID mapping
+ await helper.nft.mintCollection(alice, {tokenPrefix: 'unqt'});
+
+ const collectionIds = await createRmrkCollection(helper, alice);
+
+ expect(collectionIds.rmrkId).to.be.lessThan(collectionIds.uniqueId, 'collection ID mapping');
+
+ const collection = (await helper.nft.getCollectionObject(collectionIds.uniqueId).getData())!; // (await getDetailedCollectionInfo(api, collectionIds.uniqueId))!;
+ expect(collection.raw.readOnly, 'tagged external').to.be.true;
+ });
+});
+
+describe('Negative Integration Test: External Collections, Internal Ops', async () => {
+ let uniqueCollectionId: number;
+ let rmrkCollectionId: number;
+ let rmrkNftId: number;
+ let normalizedAlice: {Substrate: string};
+
+ before(async function() {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ bob = await privateKey('//Bob');
+ normalizedAlice = {Substrate: helper.address.normalizeSubstrateToChainFormat(alice.address)};
+
+ requirePalletsOrSkip(this, helper, [Pallets.RmrkCore]);
+
+ const collectionIds = await createRmrkCollection(helper, alice);
+ uniqueCollectionId = collectionIds.uniqueId;
+ rmrkCollectionId = collectionIds.rmrkId;
+
+ rmrkNftId = await createRmrkNft(helper, alice, rmrkCollectionId);
+ });
+ });
+
+ itSub.ifWithPallets('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', [Pallets.RmrkCore], async ({helper}) => {
+ // Collection item creation
+
+ await expect(helper.nft.mintToken(alice, {collectionId: uniqueCollectionId, owner: {Substrate: alice.address}}), 'creating item')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ const txCreateMultipleItems = helper.getApi().tx.unique.createMultipleItems(uniqueCollectionId, normalizedAlice, [{NFT: {}}, {NFT: {}}]);
+ await expect(executeTransaction(helper.getApi(), alice, txCreateMultipleItems), 'creating multiple')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.mintMultipleTokens(alice, uniqueCollectionId, [{owner: {Substrate: alice.address}}]), 'creating multiple ex')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // Collection properties
+
+ await expect(helper.nft.setProperties(alice, uniqueCollectionId, [{key: 'a', value: '1'}, {key: 'b'}]), 'setting collection properties')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.deleteProperties(alice, uniqueCollectionId, ['a']), 'deleting collection properties')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.setTokenPropertyPermissions(alice, uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]), 'setting property permissions')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // NFT
+
+ await expect(helper.nft.burnToken(alice, uniqueCollectionId, rmrkNftId, 1n), 'burning')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.burnTokenFrom(alice, uniqueCollectionId, rmrkNftId, {Substrate: alice.address}, 1n), 'burning-from')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.transferToken(alice, uniqueCollectionId, rmrkNftId, {Substrate: bob.address}), 'transferring')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.approveToken(alice, uniqueCollectionId, rmrkNftId, {Substrate: bob.address}), 'approving')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.transferTokenFrom(alice, uniqueCollectionId, rmrkNftId, {Substrate: alice.address}, {Substrate: bob.address}), 'transferring-from')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // NFT properties
+
+ await expect(helper.nft.setTokenProperties(alice, uniqueCollectionId, rmrkNftId, [{key: 'a', value: '2'}]), 'setting token properties')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.deleteTokenProperties(alice, uniqueCollectionId, rmrkNftId, ['a']))
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+ });
+
+ itSub.ifWithPallets('[Negative] Forbids Unique collection operations with an external collection', [Pallets.RmrkCore], async ({helper}) => {
+ await expect(helper.nft.burn(alice, uniqueCollectionId), 'destroying collection')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // Allow list
+
+ await expect(helper.nft.addToAllowList(alice, uniqueCollectionId, {Substrate: bob.address}), 'adding to allow list')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.removeFromAllowList(alice, uniqueCollectionId, {Substrate: bob.address}), 'removing from allowlist')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // Owner / Admin / Sponsor
+
+ await expect(helper.nft.changeOwner(alice, uniqueCollectionId, bob.address), 'changing owner')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.addAdmin(alice, uniqueCollectionId, {Substrate: bob.address}), 'adding admin')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.removeAdmin(alice, uniqueCollectionId, {Substrate: bob.address}), 'removing admin')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.setSponsor(alice, uniqueCollectionId, bob.address), 'setting sponsor')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.confirmSponsorship(alice, uniqueCollectionId), 'confirming sponsor')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.removeSponsor(alice, uniqueCollectionId), 'removing sponsor')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ // Limits / permissions / transfers
+
+ const txSetTransfers = helper.getApi().tx.unique.setTransfersEnabledFlag(uniqueCollectionId, true);
+ await expect(executeTransaction(helper.getApi(), alice, txSetTransfers), 'setting transfers enabled flag')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.setLimits(alice, uniqueCollectionId, {transfersEnabled: false}), 'setting collection limits')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+
+ await expect(helper.nft.setPermissions(alice, uniqueCollectionId, {access: 'AllowList'}), 'setting collection permissions')
+ .to.be.rejectedWith(/common\.CollectionIsExternal/);
+ });
+});
+
+describe('Negative Integration Test: Internal Collections, External Ops', async () => {
+ let collectionId: number;
+ let nftId: number;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ bob = await privateKey('//Bob');
+
+ const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'iceo'});
+ collectionId = collection.collectionId;
+ nftId = (await collection.mintToken(alice)).tokenId;
+ });
+ });
+
+ itSub.ifWithPallets('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', [Pallets.RmrkCore], async ({helper}) => {
+ const api = helper.getApi();
+
+ const txChangeOwner = api.tx.rmrkCore.changeCollectionIssuer(collectionId, bob.address);
+ await expect(executeTransaction(api, alice, txChangeOwner), 'changing collection issuer')
+ .to.be.rejectedWith(/rmrkCore\.CollectionUnknown/);
+
+ const maxBurns = 10;
+ const txBurnItem = api.tx.rmrkCore.burnNft(collectionId, nftId, maxBurns);
+ await expect(executeTransaction(api, alice, txBurnItem), 'burning NFT').to.be.rejectedWith(/rmrkCore\.CollectionUnknown/);
+ });
+});
tests/src/rmrk/rmrkIsolation.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rmrkIsolation.test.ts
+++ /dev/null
@@ -1,225 +0,0 @@
-import {executeTransaction} from '../substrate/substrate-api';
-import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, expect, usingPlaygrounds, Pallets, requirePalletsOrSkip} from '../util/playgrounds';
-import {UniqueHelper} from '../util/playgrounds/unique';
-
-let alice: IKeyringPair;
-let bob: IKeyringPair;
-
-async function createRmrkCollection(helper: UniqueHelper, sender: IKeyringPair): Promise<{uniqueId: number, rmrkId: number}> {
- const result = await helper.executeExtrinsic(sender, 'api.tx.rmrkCore.createCollection', ['metadata', null, 'symbol'], true);
-
- const uniqueId = helper.util.extractCollectionIdFromCreationResult(result);
-
- let rmrkId = null;
- result.result.events.forEach(({event: {data, method, section}}) => {
- if ((section === 'rmrkCore') && (method === 'CollectionCreated')) {
- rmrkId = parseInt(data[1].toString(), 10);
- }
- });
-
- if (rmrkId === null) {
- throw Error('No rmrkCore.CollectionCreated event was found!');
- }
-
- return {
- uniqueId,
- rmrkId,
- };
-}
-
-async function createRmrkNft(helper: UniqueHelper, sender: IKeyringPair, collectionId: number): Promise<number> {
- const result = await helper.executeExtrinsic(
- sender,
- 'api.tx.rmrkCore.mintNft',
- [
- sender.address,
- collectionId,
- sender.address,
- null,
- 'nft-metadata',
- true,
- null,
- ],
- true,
- );
-
- let rmrkNftId = null;
- result.result.events.forEach(({event: {data, method, section}}) => {
- if ((section === 'rmrkCore') && (method === 'NftMinted')) {
- rmrkNftId = parseInt(data[2].toString(), 10);
- }
- });
-
- if (rmrkNftId === null) {
- throw Error('No rmrkCore.NftMinted event was found!');
- }
-
- return rmrkNftId;
-}
-
-describe('RMRK External Integration Test', async () => {
- before(async function() {
- await usingPlaygrounds(async (_helper, privateKey) => {
- alice = privateKey('//Alice');
- });
- });
-
- itSub.ifWithPallets('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', [Pallets.RmrkCore], async ({helper}) => {
- // throw away collection to bump last Unique collection ID to test ID mapping
- await helper.nft.mintCollection(alice, {tokenPrefix: 'unqt'});
-
- const collectionIds = await createRmrkCollection(helper, alice);
-
- expect(collectionIds.rmrkId).to.be.lessThan(collectionIds.uniqueId, 'collection ID mapping');
-
- const collection = (await helper.nft.getCollectionObject(collectionIds.uniqueId).getData())!; // (await getDetailedCollectionInfo(api, collectionIds.uniqueId))!;
- expect(collection.raw.readOnly, 'tagged external').to.be.true;
- });
-});
-
-describe('Negative Integration Test: External Collections, Internal Ops', async () => {
- let uniqueCollectionId: number;
- let rmrkCollectionId: number;
- let rmrkNftId: number;
- let normalizedAlice: {Substrate: string};
-
- before(async function() {
- await usingPlaygrounds(async (helper, privateKey) => {
- alice = privateKey('//Alice');
- bob = privateKey('//Bob');
- normalizedAlice = {Substrate: helper.address.normalizeSubstrateToChainFormat(alice.address)};
-
- await requirePalletsOrSkip(this, helper, [Pallets.RmrkCore]);
-
- const collectionIds = await createRmrkCollection(helper, alice);
- uniqueCollectionId = collectionIds.uniqueId;
- rmrkCollectionId = collectionIds.rmrkId;
-
- rmrkNftId = await createRmrkNft(helper, alice, rmrkCollectionId);
- });
- });
-
- itSub.ifWithPallets('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', [Pallets.RmrkCore], async ({helper}) => {
- // Collection item creation
-
- await expect(helper.nft.mintToken(alice, {collectionId: uniqueCollectionId, owner: {Substrate: alice.address}}), 'creating item')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- const txCreateMultipleItems = helper.getApi().tx.unique.createMultipleItems(uniqueCollectionId, normalizedAlice, [{NFT: {}}, {NFT: {}}]);
- await expect(executeTransaction(helper.getApi(), alice, txCreateMultipleItems), 'creating multiple')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.mintMultipleTokens(alice, uniqueCollectionId, [{owner: {Substrate: alice.address}}]), 'creating multiple ex')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // Collection properties
-
- await expect(helper.nft.setProperties(alice, uniqueCollectionId, [{key: 'a', value: '1'}, {key: 'b'}]), 'setting collection properties')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.deleteProperties(alice, uniqueCollectionId, ['a']), 'deleting collection properties')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.setTokenPropertyPermissions(alice, uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]), 'setting property permissions')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // NFT
-
- await expect(helper.nft.burnToken(alice, uniqueCollectionId, rmrkNftId, 1n), 'burning')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.burnTokenFrom(alice, uniqueCollectionId, rmrkNftId, {Substrate: alice.address}, 1n), 'burning-from')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.transferToken(alice, uniqueCollectionId, rmrkNftId, {Substrate: bob.address}), 'transferring')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.approveToken(alice, uniqueCollectionId, rmrkNftId, {Substrate: bob.address}), 'approving')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.transferTokenFrom(alice, uniqueCollectionId, rmrkNftId, {Substrate: alice.address}, {Substrate: bob.address}), 'transferring-from')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // NFT properties
-
- await expect(helper.nft.setTokenProperties(alice, uniqueCollectionId, rmrkNftId, [{key: 'a', value: '2'}]), 'setting token properties')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.deleteTokenProperties(alice, uniqueCollectionId, rmrkNftId, ['a']))
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
- });
-
- itSub.ifWithPallets('[Negative] Forbids Unique collection operations with an external collection', [Pallets.RmrkCore], async ({helper}) => {
- await expect(helper.nft.burn(alice, uniqueCollectionId), 'destroying collection')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // Allow list
-
- await expect(helper.nft.addToAllowList(alice, uniqueCollectionId, {Substrate: bob.address}), 'adding to allow list')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.removeFromAllowList(alice, uniqueCollectionId, {Substrate: bob.address}), 'removing from allowlist')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // Owner / Admin / Sponsor
-
- await expect(helper.nft.changeOwner(alice, uniqueCollectionId, bob.address), 'changing owner')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.addAdmin(alice, uniqueCollectionId, {Substrate: bob.address}), 'adding admin')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.removeAdmin(alice, uniqueCollectionId, {Substrate: bob.address}), 'removing admin')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.setSponsor(alice, uniqueCollectionId, bob.address), 'setting sponsor')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.confirmSponsorship(alice, uniqueCollectionId), 'confirming sponsor')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.removeSponsor(alice, uniqueCollectionId), 'removing sponsor')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- // Limits / permissions / transfers
-
- const txSetTransfers = helper.getApi().tx.unique.setTransfersEnabledFlag(uniqueCollectionId, true);
- await expect(executeTransaction(helper.getApi(), alice, txSetTransfers), 'setting transfers enabled flag')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.setLimits(alice, uniqueCollectionId, {transfersEnabled: false}), 'setting collection limits')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
-
- await expect(helper.nft.setPermissions(alice, uniqueCollectionId, {access: 'AllowList'}), 'setting collection permissions')
- .to.be.rejectedWith(/common\.CollectionIsExternal/);
- });
-});
-
-describe('Negative Integration Test: Internal Collections, External Ops', async () => {
- let collectionId: number;
- let nftId: number;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- alice = privateKey('//Alice');
- bob = privateKey('//Bob');
-
- const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'iceo'});
- collectionId = collection.collectionId;
- nftId = (await collection.mintToken(alice)).tokenId;
- });
- });
-
- itSub.ifWithPallets('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', [Pallets.RmrkCore], async ({helper}) => {
- const api = helper.getApi();
-
- const txChangeOwner = api.tx.rmrkCore.changeCollectionIssuer(collectionId, bob.address);
- await expect(executeTransaction(api, alice, txChangeOwner), 'changing collection issuer')
- .to.be.rejectedWith(/rmrkCore\.CollectionUnknown/);
-
- const maxBurns = 10;
- const txBurnItem = api.tx.rmrkCore.burnNft(collectionId, nftId, maxBurns);
- await expect(executeTransaction(api, alice, txBurnItem), 'burning NFT').to.be.rejectedWith(/rmrkCore\.CollectionUnknown/);
- });
-});
tests/src/rmrk/sendNft.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/sendNft.seqtest.ts
@@ -0,0 +1,255 @@
+import {expect} from 'chai';
+import {getApiConnection} from '../substrate/substrate-api';
+import {createCollection, mintNft, sendNft} from './util/tx';
+import {NftIdTuple} from './util/fetch';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
+
+describe('integration test: send NFT', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const maxNftId = 0xFFFFFFFF;
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ const createTestCollection = async (issuerUri: string) => {
+ return await createCollection(
+ api,
+ issuerUri,
+ 'nft-collection-metadata',
+ null,
+ 'nft-collection',
+ );
+ };
+
+
+ it('send NFT to another user', async () => {
+ const originalOwnerUri = alice;
+ const newOwnerUri = bob;
+
+ const collectionId = await createTestCollection(alice);
+
+ const nftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'nft-metadata');
+
+ await sendNft(api, 'sent', originalOwnerUri, collectionId, nftId, newOwnerUri);
+ });
+
+ it('[negative] unable to send non-existing NFT', async () => {
+ const originalOwnerUri = alice;
+ const newOwnerUri = bob;
+
+ const collectionId = 0;
+ const tx = sendNft(api, 'sent', originalOwnerUri, collectionId, maxNftId, newOwnerUri);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] unable to send NFT by a not-an-owner', async () => {
+ const originalOwnerUri = alice;
+ const newOwnerUri = bob;
+
+ const collectionId = await createTestCollection(alice);
+
+ const nftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'nft-metadata');
+
+ const tx = sendNft(api, 'sent', newOwnerUri, collectionId, nftId, newOwnerUri);
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('send NFT to another NFT (same owner)', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.true;
+ });
+
+ it('[negative] send non-existing NFT to another NFT', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
+ const childNftId = maxNftId;
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ const tx = sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.false;
+ });
+
+ it('send NFT to another NFT (by not-an-owner)', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const author = alice;
+ const attacker = bob;
+
+ const parentNftId = await mintNft(api, author, originalOwnerUri, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, author, originalOwnerUri, collectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ const tx = sendNft(api, 'sent', attacker, collectionId, childNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.false;
+ });
+
+ it('[negative] send NFT to non-existing NFT', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = maxNftId;
+ const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ const tx = sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.false;
+ });
+
+ it('send NFT to another NFT owned by another user', async () => {
+ const ownerAlice = alice;
+ const ownerBob = bob;
+
+ const aliceCollectionId = await createTestCollection(alice);
+ const bobCollectionId = await createTestCollection(bob);
+
+ const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
+
+ await sendNft(api, 'pending', bob, bobCollectionId, childNftId, newOwnerNFT);
+ });
+
+ it('[negative] unable to send NFT to itself', async () => {
+ const nftOwner = alice;
+ const collectionId = await createTestCollection(alice);
+
+ const nftId = await mintNft(api, alice, nftOwner, collectionId, 'ouroboros-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionId, nftId];
+
+ const tx = sendNft(api, 'sent', alice, collectionId, nftId, newOwnerNFT);
+
+ await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, nftId, newOwnerNFT);
+ expect(isChild).to.be.false;
+ });
+
+ it('[negative] unable to send NFT to child NFT', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
+
+ const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
+ expect(isChild).to.be.true;
+
+ const descendentOwner: NftIdTuple = [collectionId, childNftId];
+ const tx = sendNft(api, 'sent', alice, collectionId, parentNftId, descendentOwner);
+
+ await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
+ const isOuroboros = await isNftChildOfAnother(api, collectionId, parentNftId, descendentOwner);
+ expect(isOuroboros).to.be.false;
+ });
+
+ it('[negative] unable to send NFT to descendent NFT', async () => {
+ const originalOwnerUri = alice;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
+ const grandsonNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'grandson-nft-metadata');
+
+ const ownerParentNFT: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', alice, collectionId, childNftId, ownerParentNFT);
+
+ const isChild = await isNftChildOfAnother(api, collectionId, childNftId, ownerParentNFT);
+ expect(isChild).to.be.true;
+
+ const ownerChildNFT: NftIdTuple = [collectionId, childNftId];
+ await sendNft(api, 'sent', alice, collectionId, grandsonNftId, ownerChildNFT);
+
+ const isGrandson = await isNftChildOfAnother(api, collectionId, grandsonNftId, ownerChildNFT);
+ expect(isGrandson).to.be.true;
+
+ const ownerGrandsonNFT: NftIdTuple = [collectionId, grandsonNftId];
+ const tx = sendNft(api, 'sent', alice, collectionId, parentNftId, ownerGrandsonNFT);
+
+ await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
+ const isOuroboros = await isNftChildOfAnother(api, collectionId, parentNftId, ownerGrandsonNFT);
+ expect(isOuroboros).to.be.false;
+ });
+
+ it('send nested NFT to another user', async () => {
+ const originalOwner = alice;
+ const newOwner = bob;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwner, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, originalOwner, collectionId, 'child-nft-metadata');
+
+ const parentNftTuple: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', originalOwner, collectionId, childNftId, parentNftTuple);
+
+ await sendNft(api, 'sent', originalOwner, collectionId, childNftId, newOwner);
+ });
+
+ it('[negative] send nested NFT to another user (by a not-root-owner)', async () => {
+ const originalOwner = alice;
+ const newOwner = bob;
+
+ const collectionId = await createTestCollection(alice);
+
+ const parentNftId = await mintNft(api, alice, originalOwner, collectionId, 'parent-nft-metadata');
+ const childNftId = await mintNft(api, alice, originalOwner, collectionId, 'child-nft-metadata');
+
+ const parentNftTuple: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', originalOwner, collectionId, childNftId, parentNftTuple);
+
+ const tx = sendNft(api, 'sent', newOwner, collectionId, childNftId, newOwner);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/sendNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/sendNft.test.ts
+++ /dev/null
@@ -1,255 +0,0 @@
-import {expect} from 'chai';
-import {getApiConnection} from '../substrate/substrate-api';
-import {createCollection, mintNft, sendNft} from './util/tx';
-import {NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
-
-describe('integration test: send NFT', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const maxNftId = 0xFFFFFFFF;
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- const createTestCollection = async (issuerUri: string) => {
- return await createCollection(
- api,
- issuerUri,
- 'nft-collection-metadata',
- null,
- 'nft-collection',
- );
- };
-
-
- it('send NFT to another user', async () => {
- const originalOwnerUri = alice;
- const newOwnerUri = bob;
-
- const collectionId = await createTestCollection(alice);
-
- const nftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'nft-metadata');
-
- await sendNft(api, 'sent', originalOwnerUri, collectionId, nftId, newOwnerUri);
- });
-
- it('[negative] unable to send non-existing NFT', async () => {
- const originalOwnerUri = alice;
- const newOwnerUri = bob;
-
- const collectionId = 0;
- const tx = sendNft(api, 'sent', originalOwnerUri, collectionId, maxNftId, newOwnerUri);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] unable to send NFT by a not-an-owner', async () => {
- const originalOwnerUri = alice;
- const newOwnerUri = bob;
-
- const collectionId = await createTestCollection(alice);
-
- const nftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'nft-metadata');
-
- const tx = sendNft(api, 'sent', newOwnerUri, collectionId, nftId, newOwnerUri);
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('send NFT to another NFT (same owner)', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.true;
- });
-
- it('[negative] send non-existing NFT to another NFT', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
- const childNftId = maxNftId;
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- const tx = sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.false;
- });
-
- it('send NFT to another NFT (by not-an-owner)', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const author = alice;
- const attacker = bob;
-
- const parentNftId = await mintNft(api, author, originalOwnerUri, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, author, originalOwnerUri, collectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- const tx = sendNft(api, 'sent', attacker, collectionId, childNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.false;
- });
-
- it('[negative] send NFT to non-existing NFT', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = maxNftId;
- const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- const tx = sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.false;
- });
-
- it('send NFT to another NFT owned by another user', async () => {
- const ownerAlice = alice;
- const ownerBob = bob;
-
- const aliceCollectionId = await createTestCollection(alice);
- const bobCollectionId = await createTestCollection(bob);
-
- const parentNftId = await mintNft(api, alice, ownerAlice, aliceCollectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, bob, ownerBob, bobCollectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [aliceCollectionId, parentNftId];
-
- await sendNft(api, 'pending', bob, bobCollectionId, childNftId, newOwnerNFT);
- });
-
- it('[negative] unable to send NFT to itself', async () => {
- const nftOwner = alice;
- const collectionId = await createTestCollection(alice);
-
- const nftId = await mintNft(api, alice, nftOwner, collectionId, 'ouroboros-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionId, nftId];
-
- const tx = sendNft(api, 'sent', alice, collectionId, nftId, newOwnerNFT);
-
- await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
-
- const isChild = await isNftChildOfAnother(api, collectionId, nftId, newOwnerNFT);
- expect(isChild).to.be.false;
- });
-
- it('[negative] unable to send NFT to child NFT', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
-
- const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', alice, collectionId, childNftId, newOwnerNFT);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, newOwnerNFT);
- expect(isChild).to.be.true;
-
- const descendentOwner: NftIdTuple = [collectionId, childNftId];
- const tx = sendNft(api, 'sent', alice, collectionId, parentNftId, descendentOwner);
-
- await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
- const isOuroboros = await isNftChildOfAnother(api, collectionId, parentNftId, descendentOwner);
- expect(isOuroboros).to.be.false;
- });
-
- it('[negative] unable to send NFT to descendent NFT', async () => {
- const originalOwnerUri = alice;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'child-nft-metadata');
- const grandsonNftId = await mintNft(api, alice, originalOwnerUri, collectionId, 'grandson-nft-metadata');
-
- const ownerParentNFT: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', alice, collectionId, childNftId, ownerParentNFT);
-
- const isChild = await isNftChildOfAnother(api, collectionId, childNftId, ownerParentNFT);
- expect(isChild).to.be.true;
-
- const ownerChildNFT: NftIdTuple = [collectionId, childNftId];
- await sendNft(api, 'sent', alice, collectionId, grandsonNftId, ownerChildNFT);
-
- const isGrandson = await isNftChildOfAnother(api, collectionId, grandsonNftId, ownerChildNFT);
- expect(isGrandson).to.be.true;
-
- const ownerGrandsonNFT: NftIdTuple = [collectionId, grandsonNftId];
- const tx = sendNft(api, 'sent', alice, collectionId, parentNftId, ownerGrandsonNFT);
-
- await expectTxFailure(/rmrkCore\.CannotSendToDescendentOrSelf/, tx);
- const isOuroboros = await isNftChildOfAnother(api, collectionId, parentNftId, ownerGrandsonNFT);
- expect(isOuroboros).to.be.false;
- });
-
- it('send nested NFT to another user', async () => {
- const originalOwner = alice;
- const newOwner = bob;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwner, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, alice, originalOwner, collectionId, 'child-nft-metadata');
-
- const parentNftTuple: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', originalOwner, collectionId, childNftId, parentNftTuple);
-
- await sendNft(api, 'sent', originalOwner, collectionId, childNftId, newOwner);
- });
-
- it('[negative] send nested NFT to another user (by a not-root-owner)', async () => {
- const originalOwner = alice;
- const newOwner = bob;
-
- const collectionId = await createTestCollection(alice);
-
- const parentNftId = await mintNft(api, alice, originalOwner, collectionId, 'parent-nft-metadata');
- const childNftId = await mintNft(api, alice, originalOwner, collectionId, 'child-nft-metadata');
-
- const parentNftTuple: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', originalOwner, collectionId, childNftId, parentNftTuple);
-
- const tx = sendNft(api, 'sent', newOwner, collectionId, childNftId, newOwner);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/setCollectionProperty.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/setCollectionProperty.seqtest.ts
@@ -0,0 +1,66 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, setPropertyCollection} from './util/tx';
+
+describe('integration test: set collection property', () => {
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ it('set collection property', async () => {
+ await createCollection(
+ api,
+ alice,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ await setPropertyCollection(api, alice, collectionId, 'test_key', '42');
+ await setPropertyCollection(api, alice, collectionId, 'test_key', '10');
+ await setPropertyCollection(
+ api,
+ alice,
+ collectionId,
+ 'second_test_key',
+ '111',
+ );
+ });
+ });
+
+ it('[negative] set non-existing collection property', async () => {
+ const tx = setPropertyCollection(
+ api,
+ alice,
+ 9999,
+ 'test_key',
+ '42',
+ );
+ await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
+ });
+
+ it('[negative] set property not an owner NFT collection issuer', async () => {
+ await createCollection(
+ api,
+ bob,
+ 'test-metadata',
+ null,
+ 'test-symbol',
+ ).then(async (collectionId) => {
+ const tx = setPropertyCollection(
+ api,
+ alice,
+ collectionId,
+ 'test_key',
+ '42',
+ );
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setCollectionProperty.test.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, setPropertyCollection} from './util/tx';
-
-describe('integration test: set collection property', () => {
- const Alice = '//Alice';
- const Bob = '//Bob';
-
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- it('set collection property', async () => {
- await createCollection(
- api,
- Alice,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- await setPropertyCollection(api, Alice, collectionId, 'test_key', '42');
- await setPropertyCollection(api, Alice, collectionId, 'test_key', '10');
- await setPropertyCollection(
- api,
- Alice,
- collectionId,
- 'second_test_key',
- '111',
- );
- });
- });
-
- it('[negative] set non-existing collection property', async () => {
- const tx = setPropertyCollection(
- api,
- Alice,
- 9999,
- 'test_key',
- '42',
- );
- await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);
- });
-
- it('[negative] set property not an owner NFT collection issuer', async () => {
- await createCollection(
- api,
- Bob,
- 'test-metadata',
- null,
- 'test-symbol',
- ).then(async (collectionId) => {
- const tx = setPropertyCollection(
- api,
- Alice,
- collectionId,
- 'test_key',
- '42',
- );
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/setEquippableList.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/setEquippableList.seqtest.ts
@@ -0,0 +1,114 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, createBase, setEquippableList} from './util/tx';
+
+describe("integration test: set slot's Equippable List", () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ it("set Base's slot Equippable List", async () => {
+ const collectionIds = [
+ await createCollection(
+ api,
+ alice,
+ 'equiplist-collection-metadata',
+ null,
+ 'equiplist-0',
+ ),
+ await createCollection(
+ api,
+ alice,
+ 'equiplist-collection-metadata',
+ null,
+ 'equiplist-1',
+ ),
+ ];
+
+ const slotId = 202;
+
+ const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
+ {
+ 'SlotPart': {
+ id: slotId,
+ equippable: 'All',
+ z: 1,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+
+ await setEquippableList(api, alice, baseId, slotId, 'All');
+ await setEquippableList(api, alice, baseId, slotId, 'Empty');
+ await setEquippableList(api, alice, baseId, slotId, {'Custom': collectionIds});
+ });
+
+ it('[negative] unable to set equippable list of a slot of non-existing base', async () => {
+ const maxBaseId = 0xFFFFFFFF;
+ const slotId = 0;
+
+ const tx = setEquippableList(api, alice, maxBaseId, slotId, 'All');
+ await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);
+ });
+
+ it('[negative] unable to set equippable list by a not-an-owner', async () => {
+ const slotId = 42;
+
+ const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
+ {
+ 'SlotPart': {
+ id: slotId,
+ equippable: 'All',
+ z: 1,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+
+ const tx = setEquippableList(api, bob, baseId, slotId, 'All');
+ await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
+ });
+
+ it('[negative] unable to set equippable list to a fixed part', async () => {
+ const fixedPartId = 42;
+
+ const baseId = await createBase(api, alice, 'fixedpart-base-type', 'fixedpart', [
+ {
+ 'FixedPart': {
+ id: fixedPartId,
+ z: 0,
+ src: 'fixed-part-url',
+ },
+ },
+ ]);
+
+ const tx = setEquippableList(api, alice, baseId, fixedPartId, 'All');
+ await expectTxFailure(/rmrkEquip\.NoEquippableOnFixedPart/, tx);
+ });
+
+ it('[negative] unable to set equippable list to non-existing slot', async () => {
+ const slotId = 777;
+ const maxSlotId = 0xFFFFFFFF;
+
+ const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
+ {
+ 'SlotPart': {
+ id: slotId,
+ equippable: 'All',
+ z: 1,
+ src: 'some-fallback-slot-url',
+ },
+ },
+ ]);
+
+ const tx = setEquippableList(api, alice, baseId, maxSlotId, 'All');
+ await expectTxFailure(/rmrkEquip\.PartDoesntExist/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setEquippableList.test.ts
+++ /dev/null
@@ -1,114 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, createBase, setEquippableList} from './util/tx';
-
-describe("integration test: set slot's Equippable List", () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- it("set Base's slot Equippable List", async () => {
- const collectionIds = [
- await createCollection(
- api,
- alice,
- 'equiplist-collection-metadata',
- null,
- 'equiplist-0',
- ),
- await createCollection(
- api,
- alice,
- 'equiplist-collection-metadata',
- null,
- 'equiplist-1',
- ),
- ];
-
- const slotId = 202;
-
- const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
- {
- 'SlotPart': {
- id: slotId,
- equippable: 'All',
- z: 1,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
-
- await setEquippableList(api, alice, baseId, slotId, 'All');
- await setEquippableList(api, alice, baseId, slotId, 'Empty');
- await setEquippableList(api, alice, baseId, slotId, {'Custom': collectionIds});
- });
-
- it('[negative] unable to set equippable list of a slot of non-existing base', async () => {
- const maxBaseId = 0xFFFFFFFF;
- const slotId = 0;
-
- const tx = setEquippableList(api, alice, maxBaseId, slotId, 'All');
- await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);
- });
-
- it('[negative] unable to set equippable list by a not-an-owner', async () => {
- const slotId = 42;
-
- const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
- {
- 'SlotPart': {
- id: slotId,
- equippable: 'All',
- z: 1,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
-
- const tx = setEquippableList(api, bob, baseId, slotId, 'All');
- await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
- });
-
- it('[negative] unable to set equippable list to a fixed part', async () => {
- const fixedPartId = 42;
-
- const baseId = await createBase(api, alice, 'fixedpart-base-type', 'fixedpart', [
- {
- 'FixedPart': {
- id: fixedPartId,
- z: 0,
- src: 'fixed-part-url',
- },
- },
- ]);
-
- const tx = setEquippableList(api, alice, baseId, fixedPartId, 'All');
- await expectTxFailure(/rmrkEquip\.NoEquippableOnFixedPart/, tx);
- });
-
- it('[negative] unable to set equippable list to non-existing slot', async () => {
- const slotId = 777;
- const maxSlotId = 0xFFFFFFFF;
-
- const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [
- {
- 'SlotPart': {
- id: slotId,
- equippable: 'All',
- z: 1,
- src: 'some-fallback-slot-url',
- },
- },
- ]);
-
- const tx = setEquippableList(api, alice, baseId, maxSlotId, 'All');
- await expectTxFailure(/rmrkEquip\.PartDoesntExist/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/setNftProperty.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/setNftProperty.seqtest.ts
@@ -0,0 +1,88 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {NftIdTuple} from './util/fetch';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';
+
+describe('integration test: set NFT property', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ const createTestCollection = async (issuerUri: string) => {
+ return await createCollection(
+ api,
+ issuerUri,
+ 'setprop-nft-collection-metadata',
+ null,
+ 'setprop',
+ );
+ };
+
+ it('set NFT property', async () => {
+ const ownerAlice = alice;
+
+ const collectionId = await createTestCollection(alice);
+ const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');
+
+ await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'test-key-value');
+ await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'updated-key-value');
+ await setNftProperty(api, alice, collectionId, nftId, 'second-test-key', 'second-test-key-value');
+ });
+
+ it('[negative] unable to set a property of non-existing NFT', async () => {
+ const collectionId = 0;
+ const maxNftId = 0xFFFFFFFF;
+
+ const tx = setNftProperty(api, alice, collectionId, maxNftId, 'test-key', 'test-value');
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ it('[negative] unable to set a property by not-an-owner', async () => {
+ const ownerAlice = alice;
+
+ const collectionId = await createTestCollection(alice);
+ const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');
+
+ const tx = setNftProperty(api, bob, collectionId, nftId, 'test-key', 'test-key-value');
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('set a property to nested NFT', async () => {
+ const ownerAlice = alice;
+
+ const collectionId = await createTestCollection(alice);
+ const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');
+ const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');
+
+ const ownerNft: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);
+
+ await setNftProperty(api, alice, collectionId, childNftId, 'test-key', 'test-key-value');
+ });
+
+ it('[negative] set a property to nested NFT (by not-root-owner)', async () => {
+ const ownerAlice = alice;
+
+ const collectionId = await createTestCollection(alice);
+ const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');
+ const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');
+
+ const ownerNft: NftIdTuple = [collectionId, parentNftId];
+
+ await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);
+
+ const tx = setNftProperty(api, bob, collectionId, childNftId, 'test-key', 'test-key-value');
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setNftProperty.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {NftIdTuple} from './util/fetch';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';
-
-describe('integration test: set NFT property', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- const createTestCollection = async (issuerUri: string) => {
- return await createCollection(
- api,
- issuerUri,
- 'setprop-nft-collection-metadata',
- null,
- 'setprop',
- );
- };
-
- it('set NFT property', async () => {
- const ownerAlice = alice;
-
- const collectionId = await createTestCollection(alice);
- const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');
-
- await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'test-key-value');
- await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'updated-key-value');
- await setNftProperty(api, alice, collectionId, nftId, 'second-test-key', 'second-test-key-value');
- });
-
- it('[negative] unable to set a property of non-existing NFT', async () => {
- const collectionId = 0;
- const maxNftId = 0xFFFFFFFF;
-
- const tx = setNftProperty(api, alice, collectionId, maxNftId, 'test-key', 'test-value');
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- it('[negative] unable to set a property by not-an-owner', async () => {
- const ownerAlice = alice;
-
- const collectionId = await createTestCollection(alice);
- const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');
-
- const tx = setNftProperty(api, bob, collectionId, nftId, 'test-key', 'test-key-value');
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('set a property to nested NFT', async () => {
- const ownerAlice = alice;
-
- const collectionId = await createTestCollection(alice);
- const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');
- const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');
-
- const ownerNft: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);
-
- await setNftProperty(api, alice, collectionId, childNftId, 'test-key', 'test-key-value');
- });
-
- it('[negative] set a property to nested NFT (by not-root-owner)', async () => {
- const ownerAlice = alice;
-
- const collectionId = await createTestCollection(alice);
- const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');
- const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');
-
- const ownerNft: NftIdTuple = [collectionId, parentNftId];
-
- await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);
-
- const tx = setNftProperty(api, bob, collectionId, childNftId, 'test-key', 'test-key-value');
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/setResourcePriorities.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rmrk/setResourcePriorities.seqtest.ts
@@ -0,0 +1,56 @@
+import {getApiConnection} from '../substrate/substrate-api';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
+import {mintNft, createCollection, setResourcePriorities} from './util/tx';
+
+describe('integration test: set NFT resource priorities', () => {
+ let api: any;
+ before(async function () {
+ api = await getApiConnection();
+ await requirePallets(this, [Pallets.RmrkCore]);
+ });
+
+ const alice = '//Alice';
+ const bob = '//Bob';
+
+ const createTestCollection = (issuerUri: string) => {
+ return createCollection(
+ api,
+ issuerUri,
+ 'resprio-collection-metadata',
+ null,
+ 'resprio',
+ );
+ };
+
+ it('set NFT resource priorities', async () => {
+ const owner = alice;
+
+ const collectionId = await createTestCollection(alice);
+ const nftId = await mintNft(api, alice, owner, collectionId, 'resprio-nft-metadata');
+
+ await setResourcePriorities(api, alice, collectionId, nftId, [10, 42]);
+ });
+
+ it('[negative] set NFT resource priorities by a not-an-owner', async () => {
+ const owner = alice;
+ const attacker = bob;
+
+ const collectionId = await createTestCollection(alice);
+ const nftId = await mintNft(api, alice, owner, collectionId, 'resprio-nft-metadata');
+
+ const tx = setResourcePriorities(api, attacker, collectionId, nftId, [10, 42]);
+
+ await expectTxFailure(/rmrkCore\.NoPermission/, tx);
+ });
+
+ it('[negative] set NFT resource priorities to non-existing NFT', async () => {
+ const collectionId = 0;
+ const maxNftId = 0xFFFFFFFF;
+
+ const tx = setResourcePriorities(api, alice, collectionId, maxNftId, [10, 42]);
+
+ await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
+ });
+
+ after(async() => { await api.disconnect(); });
+});
tests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setResourcePriorities.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
-import {mintNft, createCollection, setResourcePriorities} from './util/tx';
-
-describe('integration test: set NFT resource priorities', () => {
- let api: any;
- before(async function () {
- api = await getApiConnection();
- await requirePallets(this, [Pallets.RmrkCore]);
- });
-
- const alice = '//Alice';
- const bob = '//Bob';
-
- const createTestCollection = (issuerUri: string) => {
- return createCollection(
- api,
- issuerUri,
- 'resprio-collection-metadata',
- null,
- 'resprio',
- );
- };
-
- it('set NFT resource priorities', async () => {
- const owner = alice;
-
- const collectionId = await createTestCollection(alice);
- const nftId = await mintNft(api, alice, owner, collectionId, 'resprio-nft-metadata');
-
- await setResourcePriorities(api, alice, collectionId, nftId, [10, 42]);
- });
-
- it('[negative] set NFT resource priorities by a not-an-owner', async () => {
- const owner = alice;
- const attacker = bob;
-
- const collectionId = await createTestCollection(alice);
- const nftId = await mintNft(api, alice, owner, collectionId, 'resprio-nft-metadata');
-
- const tx = setResourcePriorities(api, attacker, collectionId, nftId, [10, 42]);
-
- await expectTxFailure(/rmrkCore\.NoPermission/, tx);
- });
-
- it('[negative] set NFT resource priorities to non-existing NFT', async () => {
- const owner = alice;
-
- const collectionId = 0;
- const maxNftId = 0xFFFFFFFF;
-
- const tx = setResourcePriorities(api, alice, collectionId, maxNftId, [10, 42]);
-
- await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
- });
-
- after(async() => { await api.disconnect(); });
-});
tests/src/rmrk/util/fetch.tsdiffbeforeafterboth--- a/tests/src/rmrk/util/fetch.ts
+++ b/tests/src/rmrk/util/fetch.ts
@@ -1,5 +1,5 @@
import {ApiPromise} from '@polkadot/api';
-import type {Option, Bytes} from '@polkadot/types-codec';
+import type {Option} from '@polkadot/types-codec';
import type {
RmrkTraitsCollectionCollectionInfo as Collection,
RmrkTraitsNftNftInfo as Nft,
tests/src/rmrk/util/helpers.tsdiffbeforeafterboth--- a/tests/src/rmrk/util/helpers.ts
+++ b/tests/src/rmrk/util/helpers.ts
@@ -149,7 +149,7 @@
export function isTxResultSuccess(events: EventRecord[]): boolean {
let success = false;
- events.forEach(({event: {data, method, section}}) => {
+ events.forEach(({event: {method}}) => {
if (method == 'ExtrinsicSuccess') {
success = true;
}
tests/src/rpc.test.tsdiffbeforeafterboth--- a/tests/src/rpc.test.ts
+++ b/tests/src/rpc.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {usingPlaygrounds, itSub, expect} from './util/playgrounds';
+import {usingPlaygrounds, itSub, expect} from './util';
import {CrossAccountId} from './util/playgrounds/unique';
describe('integration test: RPC methods', () => {
@@ -25,7 +25,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
});
});
tests/src/setCollectionLimits.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionLimits.test.ts
+++ b/tests/src/setCollectionLimits.test.ts
@@ -16,7 +16,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
const accountTokenOwnershipLimit = 0;
const sponsoredDataSize = 0;
@@ -29,7 +29,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
});
});
@@ -104,7 +104,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
});
});
tests/src/setCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionSponsor.test.ts
+++ b/tests/src/setCollectionSponsor.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect, Pallets} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect, Pallets} from './util';
describe('integration test: ext. setCollectionSponsor():', () => {
let alice: IKeyringPair;
@@ -24,7 +24,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([20n, 10n, 10n], donor);
});
});
@@ -93,7 +93,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 5n], donor);
});
});
tests/src/setPermissions.test.tsdiffbeforeafterboth--- a/tests/src/setPermissions.test.ts
+++ b/tests/src/setPermissions.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
describe('Integration Test: Set Permissions', () => {
let alice: IKeyringPair;
@@ -23,7 +23,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
});
});
@@ -79,7 +79,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
});
});
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -15,16 +15,17 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itEth, usingEthPlaygrounds} from './eth/util/playgrounds';
-import {itSub, Pallets, usingPlaygrounds, expect} from './util/playgrounds';
+import {itEth, usingEthPlaygrounds} from './eth/util';
+import {itSub, Pallets, usingPlaygrounds, expect} from './util';
describe('Integration Test Transfer(recipient, collection_id, item_id, value)', () => {
+ let donor: IKeyringPair;
let alice: IKeyringPair;
let bob: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
});
});
@@ -42,8 +43,7 @@
expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true;
});
- itSub('Inability to pay fees error message is correct', async ({helper, privateKey}) => {
- const donor = privateKey('//Alice');
+ itSub('Inability to pay fees error message is correct', async ({helper}) => {
const [zero] = await helper.arrange.createAccounts([0n], donor);
// console.error = () => {};
@@ -117,7 +117,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
});
});
@@ -256,7 +256,7 @@
before(async function() {
await usingEthPlaygrounds(async (_, privateKey) => {
- donor = privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
});
});
tests/src/transferFrom.test.tsdiffbeforeafterboth--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {IKeyringPair} from '@polkadot/types/types';
-import {itSub, Pallets, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, Pallets, usingPlaygrounds, expect} from './util';
describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {
let alice: IKeyringPair;
@@ -24,7 +24,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([20n, 10n, 10n], donor);
});
});
@@ -91,7 +91,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- const donor = privateKey('//Alice');
+ const donor = await privateKey({filename: __filename});
[alice, bob, charlie] = await helper.arrange.createAccounts([50n, 10n, 10n], donor);
});
});
tests/src/tx-version-presence.test.tsdiffbeforeafterboth--- a/tests/src/tx-version-presence.test.ts
+++ b/tests/src/tx-version-presence.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {Metadata} from '@polkadot/types';
-import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+import {itSub, usingPlaygrounds, expect} from './util';
let metadata: Metadata;
tests/src/util/globalSetup.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/util/globalSetup.ts
@@ -0,0 +1,104 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// SPDX-License-Identifier: Apache-2.0
+
+import {usingPlaygrounds, Pallets, DONOR_FUNDING, MINIMUM_DONOR_FUND} from './index';
+import * as path from 'path';
+import {promises as fs} from 'fs';
+
+// This function should be called before running test suites.
+const globalSetup = async (): Promise<void> => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ try {
+ // 1. Create donors for test files
+ await fundFilenamesWithRetries(3)
+ .then((result) => {
+ if (!result) Promise.reject();
+ });
+
+ // 2. Set up App Promotion admin
+ const missingPallets = helper.fetchMissingPalletNames([Pallets.AppPromotion]);
+ if (missingPallets.length === 0) {
+ const superuser = await privateKey('//Alice');
+ const palletAddress = helper.arrange.calculatePalletAddress('appstake');
+ const palletAdmin = await privateKey('//PromotionAdmin');
+ const api = helper.getApi();
+ await helper.signTransaction(superuser, api.tx.sudo.sudo(api.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})));
+ const nominal = helper.balance.getOneTokenNominal();
+ await helper.balance.transferToSubstrate(superuser, palletAdmin.address, 1000n * nominal);
+ await helper.balance.transferToSubstrate(superuser, palletAddress, 1000n * nominal);
+ }
+ } catch (error) {
+ console.error(error);
+ Promise.reject();
+ }
+ });
+};
+
+async function getFiles(rootPath: string): Promise<string[]> {
+ const files = await fs.readdir(rootPath, {withFileTypes: true});
+ const filenames: string[] = [];
+ for (const entry of files) {
+ const res = path.resolve(rootPath, entry.name);
+ if (entry.isDirectory()) {
+ filenames.push(...await getFiles(res));
+ } else {
+ filenames.push(res);
+ }
+ }
+ return filenames;
+}
+
+const fundFilenames = async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const oneToken = helper.balance.getOneTokenNominal();
+ const alice = await privateKey('//Alice');
+ const nonce = await helper.chain.getNonce(alice.address);
+ const filenames = await getFiles(path.resolve(__dirname, '..'));
+
+ // batching is actually undesireable, it takes away the time while all the transactions actually succeed
+ const batchSize = 300;
+ let balanceGrantedCounter = 0;
+ for (let b = 0; b < filenames.length; b += batchSize) {
+ const tx = [];
+ let batchBalanceGrantedCounter = 0;
+ for (let i = 0; batchBalanceGrantedCounter < batchSize && b + i < filenames.length; i++) {
+ const f = filenames[b + i];
+ if (!f.endsWith('.test.ts') && !f.endsWith('seqtest.ts') || f.includes('.outdated')) continue;
+ const account = await privateKey({filename: f, ignoreFundsPresence: true});
+ const aliceBalance = await helper.balance.getSubstrate(account.address);
+
+ if (aliceBalance < MINIMUM_DONOR_FUND * oneToken) {
+ tx.push(helper.executeExtrinsic(
+ alice,
+ 'api.tx.balances.transfer',
+ [account.address, DONOR_FUNDING * oneToken],
+ true,
+ {nonce: nonce + balanceGrantedCounter++},
+ ).then(() => true).catch(() => {console.error(`Transaction to ${path.basename(f)} registered as failed. Strange.`); return false;}));
+ batchBalanceGrantedCounter++;
+ }
+ }
+
+ if(tx.length > 0) {
+ console.log(`Granting funds to ${batchBalanceGrantedCounter} filename accounts.`);
+ const result = await Promise.all(tx);
+ if (result && result.lastIndexOf(false) > -1) throw new Error('The transactions actually probably succeeded, should check the balances.');
+ }
+ }
+
+ if (balanceGrantedCounter == 0) console.log('No account needs additional funding.');
+ });
+};
+
+const fundFilenamesWithRetries = async (retriesLeft: number): Promise<boolean> => {
+ if (retriesLeft <= 0) return Promise.resolve(false);
+ return fundFilenames()
+ .then(() => Promise.resolve(true))
+ .catch(e => {
+ console.error(e);
+ console.error(`Some transactions might have failed. ${retriesLeft > 1 ? 'Retrying...' : 'Something is wrong.'}\n`);
+ return fundFilenamesWithRetries(--retriesLeft);
+ });
+};
+
+globalSetup().catch(() => process.exit(1));
tests/src/util/index.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/util/index.ts
@@ -0,0 +1,138 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// SPDX-License-Identifier: Apache-2.0
+
+import * as path from 'path';
+import * as crypto from 'crypto';
+import {IKeyringPair} from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import {Context} from 'mocha';
+import config from '../config';
+import {ChainHelperBase} from './playgrounds/unique';
+import {ILogger} from './playgrounds/types';
+import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper} from './playgrounds/unique.dev';
+
+chai.use(chaiAsPromised);
+export const expect = chai.expect;
+
+const getTestHash = (filename: string) => {
+ return crypto.createHash('md5').update(filename).digest('hex');
+};
+
+export const getTestSeed = (filename: string) => {
+ return `//Alice+${getTestHash(filename)}`;
+};
+
+async function usingPlaygroundsGeneral<T extends ChainHelperBase>(helperType: new(logger: ILogger) => T, url: string, code: (helper: T, privateKey: (seed: string | {filename: string, ignoreFundsPresence?: boolean}) => Promise<IKeyringPair>) => Promise<void>) {
+ const silentConsole = new SilentConsole();
+ silentConsole.enable();
+
+ const helper = new helperType(new SilentLogger());
+
+ try {
+ await helper.connect(url);
+ const ss58Format = helper.chain.getChainProperties().ss58Format;
+ const privateKey = async (seed: string | {filename: string, ignoreFundsPresence?: boolean}) => {
+ if (typeof seed === 'string') {
+ return helper.util.fromSeed(seed, ss58Format);
+ }
+ else {
+ const actualSeed = getTestSeed(seed.filename);
+ let account = helper.util.fromSeed(actualSeed, ss58Format);
+ // here's to hoping that no
+ if (!seed.ignoreFundsPresence && ((helper as any)['balance'] == undefined || await (helper as any).balance.getSubstrate(account.address) < MINIMUM_DONOR_FUND)) {
+ console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);
+ account = helper.util.fromSeed('//Alice', ss58Format);
+ }
+ return account;
+ }
+ };
+ await code(helper, privateKey);
+ }
+ finally {
+ await helper.disconnect();
+ silentConsole.disable();
+ }
+}
+
+export const usingPlaygrounds = (code: (helper: DevUniqueHelper, privateKey: (seed: string | {filename: string, ignoreFundsPresence?: boolean}) => Promise<IKeyringPair>) => Promise<void>, url: string = config.substrateUrl) => {
+ return usingPlaygroundsGeneral<DevUniqueHelper>(DevUniqueHelper, url, code);
+};
+
+export const usingWestmintPlaygrounds = async (url: string, code: (helper: DevWestmintHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevWestmintHelper>(DevWestmintHelper, url, code);
+};
+
+export const usingRelayPlaygrounds = async (url: string, code: (helper: DevRelayHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevRelayHelper>(DevRelayHelper, url, code);
+};
+
+export const usingAcalaPlaygrounds = async (url: string, code: (helper: DevAcalaHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevAcalaHelper>(DevAcalaHelper, url, code);
+};
+
+export const usingKaruraPlaygrounds = async (url: string, code: (helper: DevKaruraHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevKaruraHelper>(DevAcalaHelper, url, code);
+};
+
+export const usingMoonbeamPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevMoonbeamHelper>(DevMoonbeamHelper, url, code);
+};
+
+export const usingMoonriverPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevMoonriverHelper>(DevMoonriverHelper, url, code);
+};
+
+export const MINIMUM_DONOR_FUND = 100_000n;
+export const DONOR_FUNDING = 1_000_000n;
+
+export enum Pallets {
+ Inflation = 'inflation',
+ RmrkCore = 'rmrkcore',
+ RmrkEquip = 'rmrkequip',
+ ReFungible = 'refungible',
+ Fungible = 'fungible',
+ NFT = 'nonfungible',
+ Scheduler = 'scheduler',
+ AppPromotion = 'apppromotion',
+}
+
+export function requirePalletsOrSkip(test: Context, helper: DevUniqueHelper, requiredPallets: string[]) {
+ const missingPallets = helper.fetchMissingPalletNames(requiredPallets);
+
+ if (missingPallets.length > 0) {
+ const skipMsg = `\tSkipping test '${test.test?.title}'.\n\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;
+ console.warn('\x1b[38:5:208m%s\x1b[0m', skipMsg);
+ test.skip();
+ }
+}
+
+export async function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+ (opts.only ? it.only :
+ opts.skip ? it.skip : it)(name, async function () {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ if (opts.requiredPallets) {
+ requirePalletsOrSkip(this, helper, opts.requiredPallets);
+ }
+
+ await cb({helper, privateKey});
+ });
+ });
+}
+export async function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+ return itSub(name, cb, {requiredPallets: required, ...opts});
+}
+itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSub(name, cb, {only: true});
+itSub.skip = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSub(name, cb, {skip: true});
+
+itSubIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {only: true});
+itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
+itSub.ifWithPallets = itSubIfWithPallet;
+
+export async function describeXCM(title: string, fn: (this: Mocha.Suite) => void, opts: {skip?: boolean} = {}) {
+ (process.env.RUN_XCM_TESTS && !opts.skip
+ ? describe
+ : describe.skip)(title, fn);
+}
+
+describeXCM.skip = (name: string, fn: (this: Mocha.Suite) => void) => describeXCM(name, fn, {skip: true});
tests/src/util/playgrounds/index.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/index.ts
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-import {IKeyringPair} from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import {Context} from 'mocha';
-import config from '../../config';
-import '../../interfaces/augment-api-events';
-import {ChainHelperBase} from './unique';
-import {ILogger} from './types';
-import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper} from './unique.dev';
-
-chai.use(chaiAsPromised);
-export const expect = chai.expect;
-
-async function usingPlaygroundsGeneral<T extends ChainHelperBase>(helperType: new(logger: ILogger) => T, url: string, code: (helper: T, privateKey: (seed: string) => IKeyringPair) => Promise<void>) {
- const silentConsole = new SilentConsole();
- silentConsole.enable();
-
- const helper = new helperType(new SilentLogger());
-
- try {
- await helper.connect(url);
- const ss58Format = helper.chain.getChainProperties().ss58Format;
- const privateKey = (seed: string) => helper.util.fromSeed(seed, ss58Format);
- await code(helper, privateKey);
- }
- finally {
- await helper.disconnect();
- silentConsole.disable();
- }
-}
-
-export const usingPlaygrounds = (code: (helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>, url: string = config.substrateUrl) => {
- return usingPlaygroundsGeneral<DevUniqueHelper>(DevUniqueHelper, url, code);
-};
-
-export const usingWestmintPlaygrounds = async (url: string, code: (helper: DevWestmintHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevWestmintHelper>(DevWestmintHelper, url, code);
-};
-
-export const usingRelayPlaygrounds = async (url: string, code: (helper: DevRelayHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevRelayHelper>(DevRelayHelper, url, code);
-};
-
-export const usingAcalaPlaygrounds = async (url: string, code: (helper: DevAcalaHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevAcalaHelper>(DevAcalaHelper, url, code);
-};
-
-export const usingKaruraPlaygrounds = async (url: string, code: (helper: DevKaruraHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevKaruraHelper>(DevAcalaHelper, url, code);
-};
-
-export const usingMoonbeamPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevMoonbeamHelper>(DevMoonbeamHelper, url, code);
-};
-
-export const usingMoonriverPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {
- return usingPlaygroundsGeneral<DevMoonriverHelper>(DevMoonriverHelper, url, code);
-};
-
-export enum Pallets {
- Inflation = 'inflation',
- RmrkCore = 'rmrkcore',
- RmrkEquip = 'rmrkequip',
- ReFungible = 'refungible',
- Fungible = 'fungible',
- NFT = 'nonfungible',
- Scheduler = 'scheduler',
- AppPromotion = 'apppromotion',
-}
-
-export function requirePalletsOrSkip(test: Context, helper: DevUniqueHelper, requiredPallets: string[]) {
- const missingPallets = helper.fetchMissingPalletNames(requiredPallets);
-
- if (missingPallets.length > 0) {
- const skipMsg = `\tSkipping test '${test.test?.title}'.\n\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;
- console.warn('\x1b[38:5:208m%s\x1b[0m', skipMsg);
- test.skip();
- }
-}
-
-export async function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
- (opts.only ? it.only :
- opts.skip ? it.skip : it)(name, async function () {
- await usingPlaygrounds(async (helper, privateKey) => {
- if (opts.requiredPallets) {
- requirePalletsOrSkip(this, helper, opts.requiredPallets);
- }
-
- await cb({helper, privateKey});
- });
- });
-}
-export async function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
- return itSub(name, cb, {requiredPallets: required, ...opts});
-}
-itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {only: true});
-itSub.skip = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {skip: true});
-
-itSubIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSubIfWithPallet(name, required, cb, {only: true});
-itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
-itSub.ifWithPallets = itSubIfWithPallet;
-
-export async function describeXcm(name: string, cb: () => any) {
- (
- process.env.RUN_XCM_TESTS ? describe : describe.skip
- )(name, cb);
-}
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -1,7 +1,8 @@
// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
// SPDX-License-Identifier: Apache-2.0
-import {mnemonicGenerate} from '@polkadot/util-crypto';
+import {stringToU8a} from '@polkadot/util';
+import {encodeAddress, mnemonicGenerate} from '@polkadot/util-crypto';
import {UniqueHelper, MoonbeamHelper, ChainHelperBase, AcalaHelper, RelayHelper, WestmintHelper} from './unique';
import {ApiPromise, Keyring, WsProvider} from '@polkadot/api';
import * as defs from '../../interfaces/definitions';
@@ -197,8 +198,9 @@
};
let accountsCreated = false;
- // checkBalances retry up to 5 blocks
- for (let index = 0; index < 5; index++) {
+ const maxBlocksChecked = await this.helper.arrange.isDevNode() ? 50 : 5;
+ // checkBalances retry up to 5-50 blocks
+ for (let index = 0; index < maxBlocksChecked; index++) {
accountsCreated = await checkBalances();
if(accountsCreated) break;
await wait.newBlocks(1);
@@ -258,8 +260,13 @@
};
isDevNode = async () => {
- const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [1])]);
- const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [2])]);
+ let blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();
+ if (blockNumber == 0) {
+ await this.helper.wait.newBlocks(1);
+ blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();
+ }
+ const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])]);
+ const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber - 1])]);
const findCreationDate = async (block: any) => {
const humanBlock = block.toHuman();
let date;
@@ -285,6 +292,11 @@
return balance;
}
+
+ calculatePalletAddress(palletId: any) {
+ const address = stringToU8a(('modl' + palletId).padEnd(32, '\0'));
+ return encodeAddress(address);
+ }
}
class MoonbeamAccountGroup {
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034/* eslint-disable @typescript-eslint/no-var-requires */5/* eslint-disable function-call-argument-newline */6/* eslint-disable no-prototype-builtins */78import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';11import {IKeyringPair} from '@polkadot/types/types';12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, IForeignAssetMetadata, TNetworks, MoonbeamAssetInfo, DemocracyStandardAccountVote, AcalaAssetMetadata} from './types';1314export class CrossAccountId implements ICrossAccountId {15 Substrate?: TSubstrateAccount;16 Ethereum?: TEthereumAccount;1718 constructor(account: ICrossAccountId) {19 if (account.Substrate) this.Substrate = account.Substrate;20 if (account.Ethereum) this.Ethereum = account.Ethereum;21 }2223 static fromKeyring(account: IKeyringPair, domain: 'Substrate' | 'Ethereum' = 'Substrate') {24 switch (domain) {25 case 'Substrate': return new CrossAccountId({Substrate: account.address});26 case 'Ethereum': return new CrossAccountId({Substrate: account.address}).toEthereum();27 }28 }2930 static fromLowerCaseKeys(address: ICrossAccountIdLower): CrossAccountId {31 return new CrossAccountId({Substrate: address.substrate, Ethereum: address.ethereum});32 }3334 static normalizeSubstrateAddress(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {35 return encodeAddress(decodeAddress(address), ss58Format);36 }3738 static withNormalizedSubstrate(address: TSubstrateAccount, ss58Format = 42): CrossAccountId {39 return new CrossAccountId({Substrate: CrossAccountId.normalizeSubstrateAddress(address, ss58Format)});40 }41 42 withNormalizedSubstrate(ss58Format = 42): CrossAccountId {43 if (this.Substrate) return CrossAccountId.withNormalizedSubstrate(this.Substrate, ss58Format);44 return this;45 }4647 static translateSubToEth(address: TSubstrateAccount): TEthereumAccount {48 return nesting.toChecksumAddress('0x' + Array.from(addressToEvm(address), i => i.toString(16).padStart(2, '0')).join(''));49 }5051 toEthereum(): CrossAccountId {52 if (this.Substrate) return new CrossAccountId({Ethereum: CrossAccountId.translateSubToEth(this.Substrate)});53 return this;54 }5556 static translateEthToSub(address: TEthereumAccount, ss58Format?: number): TSubstrateAccount {57 return evmToAddress(address, ss58Format);58 }5960 toSubstrate(ss58Format?: number): CrossAccountId {61 if (this.Ethereum) return new CrossAccountId({Substrate: CrossAccountId.translateEthToSub(this.Ethereum, ss58Format)});62 return this;63 }64 65 toLowerCase(): CrossAccountId {66 if (this.Substrate) this.Substrate = this.Substrate.toLowerCase();67 if (this.Ethereum) this.Ethereum = this.Ethereum.toLowerCase();68 return this;69 }70}7172const nesting = {73 toChecksumAddress(address: string): string {74 if (typeof address === 'undefined') return '';7576 if(!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error(`Given address "${address}" is not a valid Ethereum address.`);7778 address = address.toLowerCase().replace(/^0x/i,'');79 const addressHash = keccakAsHex(address).replace(/^0x/i,'');80 const checksumAddress = ['0x'];8182 for (let i = 0; i < address.length; i++) {83 // If ith character is 8 to f then make it uppercase84 if (parseInt(addressHash[i], 16) > 7) {85 checksumAddress.push(address[i].toUpperCase());86 } else {87 checksumAddress.push(address[i]);88 }89 }90 return checksumAddress.join('');91 },92 tokenIdToAddress(collectionId: number, tokenId: number) {93 return this.toChecksumAddress(`0xf8238ccfff8ed887463fd5e0${collectionId.toString(16).padStart(8,'0')}${tokenId.toString(16).padStart(8,'0')}`);94 },95};9697class UniqueUtil {98 static transactionStatus = {99 NOT_READY: 'NotReady',100 FAIL: 'Fail',101 SUCCESS: 'Success',102 };103104 static chainLogType = {105 EXTRINSIC: 'extrinsic',106 RPC: 'rpc',107 };108109 static getTokenAccount(token: IToken): CrossAccountId {110 return new CrossAccountId({Ethereum: this.getTokenAddress(token)});111 }112113 static getTokenAddress(token: IToken): string {114 return nesting.tokenIdToAddress(token.collectionId, token.tokenId);115 }116117 static getDefaultLogger(): ILogger {118 return {119 log(msg: any, level = 'INFO') {120 console[level.toLocaleLowerCase() === 'error' ? 'error' : 'log'](...(Array.isArray(msg) ? msg : [msg]));121 },122 level: {123 ERROR: 'ERROR',124 WARNING: 'WARNING',125 INFO: 'INFO',126 },127 };128 }129130 static vec2str(arr: string[] | number[]) {131 return arr.map(x => String.fromCharCode(parseInt(x.toString()))).join('');132 }133134 static str2vec(string: string) {135 if (typeof string !== 'string') return string;136 return Array.from(string).map(x => x.charCodeAt(0));137 }138139 static fromSeed(seed: string, ss58Format = 42) {140 const keyring = new Keyring({type: 'sr25519', ss58Format});141 return keyring.addFromUri(seed);142 }143144 static extractCollectionIdFromCreationResult(creationResult: ITransactionResult): number {145 if (creationResult.status !== this.transactionStatus.SUCCESS) {146 throw Error('Unable to create collection!');147 }148149 let collectionId = null;150 creationResult.result.events.forEach(({event: {data, method, section}}) => {151 if ((section === 'common') && (method === 'CollectionCreated')) {152 collectionId = parseInt(data[0].toString(), 10);153 }154 });155156 if (collectionId === null) {157 throw Error('No CollectionCreated event was found!');158 }159160 return collectionId;161 }162163 static extractTokensFromCreationResult(creationResult: ITransactionResult): {164 success: boolean, 165 tokens: {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[],166 } {167 if (creationResult.status !== this.transactionStatus.SUCCESS) {168 throw Error('Unable to create tokens!');169 }170 let success = false;171 const tokens = [] as {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[];172 creationResult.result.events.forEach(({event: {data, method, section}}) => {173 if (method === 'ExtrinsicSuccess') {174 success = true;175 } else if ((section === 'common') && (method === 'ItemCreated')) {176 tokens.push({177 collectionId: parseInt(data[0].toString(), 10),178 tokenId: parseInt(data[1].toString(), 10),179 owner: data[2].toHuman(),180 amount: data[3].toBigInt(),181 });182 }183 });184 return {success, tokens};185 }186187 static extractTokensFromBurnResult(burnResult: ITransactionResult): {188 success: boolean, 189 tokens: {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[],190 } {191 if (burnResult.status !== this.transactionStatus.SUCCESS) {192 throw Error('Unable to burn tokens!');193 }194 let success = false;195 const tokens = [] as {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[];196 burnResult.result.events.forEach(({event: {data, method, section}}) => {197 if (method === 'ExtrinsicSuccess') {198 success = true;199 } else if ((section === 'common') && (method === 'ItemDestroyed')) {200 tokens.push({201 collectionId: parseInt(data[0].toString(), 10),202 tokenId: parseInt(data[1].toString(), 10),203 owner: data[2].toHuman(),204 amount: data[3].toBigInt(),205 });206 }207 });208 return {success, tokens};209 }210211 static findCollectionInEvents(events: {event: IEvent}[], collectionId: number, expectedSection: string, expectedMethod: string): boolean {212 let eventId = null;213 events.forEach(({event: {data, method, section}}) => {214 if ((section === expectedSection) && (method === expectedMethod)) {215 eventId = parseInt(data[0].toString(), 10);216 }217 });218219 if (eventId === null) {220 throw Error(`No ${expectedMethod} event was found!`);221 }222 return eventId === collectionId;223 }224225 static isTokenTransferSuccess(events: {event: IEvent}[], collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {226 const normalizeAddress = (address: string | ICrossAccountId) => {227 if(typeof address === 'string') return address;228 const obj = {} as any;229 Object.keys(address).forEach(k => {230 obj[k.toLocaleLowerCase()] = address[k as 'Substrate' | 'Ethereum'];231 });232 if(obj.substrate) return CrossAccountId.withNormalizedSubstrate(obj.substrate);233 if(obj.ethereum) return CrossAccountId.fromLowerCaseKeys(obj).toLowerCase();234 return address;235 };236 let transfer = {collectionId: null, tokenId: null, from: null, to: null, amount: 1} as any;237 events.forEach(({event: {data, method, section}}) => {238 if ((section === 'common') && (method === 'Transfer')) {239 const hData = (data as any).toJSON();240 transfer = {241 collectionId: hData[0],242 tokenId: hData[1],243 from: normalizeAddress(hData[2]),244 to: normalizeAddress(hData[3]),245 amount: BigInt(hData[4]),246 };247 }248 });249 let isSuccess = parseInt(collectionId.toString()) === transfer.collectionId && parseInt(tokenId.toString()) === transfer.tokenId;250 isSuccess = isSuccess && JSON.stringify(normalizeAddress(fromAddressObj)) === JSON.stringify(transfer.from);251 isSuccess = isSuccess && JSON.stringify(normalizeAddress(toAddressObj)) === JSON.stringify(transfer.to);252 isSuccess = isSuccess && amount === transfer.amount;253 return isSuccess;254 }255256 static bigIntToDecimals(number: bigint, decimals = 18) {257 const numberStr = number.toString();258 const dotPos = numberStr.length - decimals;259 260 if (dotPos <= 0) {261 return '0.' + '0'.repeat(Math.abs(dotPos)) + numberStr;262 } else {263 const intPart = numberStr.substring(0, dotPos);264 const fractPart = numberStr.substring(dotPos);265 return intPart + '.' + fractPart;266 }267 }268}269270class UniqueEventHelper {271 private static extractIndex(index: any): [number, number] | string {272 if(index.toRawType() === '[u8;2]') return [index[0], index[1]];273 return index.toJSON();274 }275276 private static extractSub(data: any, subTypes: any): {[key: string]: any} {277 let obj: any = {};278 let index = 0;279280 if (data.entries) {281 for(const [key, value] of data.entries()) {282 obj[key] = this.extractData(value, subTypes[index]);283 index++;284 }285 } else obj = data.toJSON();286287 return obj;288 }289 290 private static extractData(data: any, type: any): any {291 if(!type) return data.toHuman();292 if (['u16', 'u32'].indexOf(type.type) > -1) return data.toNumber();293 if (['u64', 'u128', 'u256'].indexOf(type.type) > -1) return data.toBigInt();294 if(type.hasOwnProperty('sub')) return this.extractSub(data, type.sub);295 return data.toHuman();296 }297298 public static extractEvents(records: ITransactionResult): IEvent[] {299 const parsedEvents: IEvent[] = [];300301 records.result.events.forEach((record) => {302 const {event, phase} = record;303 const types = (event as any).typeDef;304305 const eventData: IEvent = {306 section: event.section.toString(),307 method: event.method.toString(),308 index: this.extractIndex(event.index),309 data: [],310 phase: phase.toJSON(),311 };312313 event.data.forEach((val: any, index: number) => {314 eventData.data.push(this.extractData(val, types[index]));315 });316317 parsedEvents.push(eventData);318 });319320 return parsedEvents;321 }322}323324export class ChainHelperBase {325 helperBase: any;326327 transactionStatus = UniqueUtil.transactionStatus;328 chainLogType = UniqueUtil.chainLogType;329 util: typeof UniqueUtil;330 eventHelper: typeof UniqueEventHelper;331 logger: ILogger;332 api: ApiPromise | null;333 forcedNetwork: TNetworks | null;334 network: TNetworks | null;335 chainLog: IUniqueHelperLog[];336 children: ChainHelperBase[];337 address: AddressGroup;338 chain: ChainGroup;339340 constructor(logger?: ILogger, helperBase?: any) {341 this.helperBase = helperBase;342343 this.util = UniqueUtil;344 this.eventHelper = UniqueEventHelper;345 if (typeof logger == 'undefined') logger = this.util.getDefaultLogger();346 this.logger = logger;347 this.api = null;348 this.forcedNetwork = null;349 this.network = null;350 this.chainLog = [];351 this.children = [];352 this.address = new AddressGroup(this);353 this.chain = new ChainGroup(this);354 }355356 clone(helperCls: ChainHelperBaseConstructor, options: {[key: string]: any} = {}) {357 Object.setPrototypeOf(helperCls.prototype, this);358 const newHelper = new helperCls(this.logger, options);359360 newHelper.api = this.api;361 newHelper.network = this.network;362 newHelper.forceNetwork = this.forceNetwork;363364 this.children.push(newHelper);365366 return newHelper;367 }368369 getApi(): ApiPromise {370 if(this.api === null) throw Error('API not initialized');371 return this.api;372 }373374 clearChainLog(): void {375 this.chainLog = [];376 }377378 forceNetwork(value: TNetworks): void {379 this.forcedNetwork = value;380 }381382 async connect(wsEndpoint: string, listeners?: IApiListeners) {383 if (this.api !== null) throw Error('Already connected');384 const {api, network} = await ChainHelperBase.createConnection(wsEndpoint, listeners, this.forcedNetwork);385 this.api = api;386 this.network = network;387 }388389 async disconnect() {390 for (const child of this.children) {391 child.clearApi();392 }393394 if (this.api === null) return;395 await this.api.disconnect();396 this.clearApi();397 }398399 clearApi() {400 this.api = null;401 this.network = null;402 }403404 static async detectNetwork(api: ApiPromise): Promise<TNetworks> {405 const spec = (await api.query.system.lastRuntimeUpgrade()).toJSON() as any;406 const xcmChains = ['rococo', 'westend', 'westmint', 'acala', 'karura', 'moonbeam', 'moonriver'];407408 if(xcmChains.indexOf(spec.specName) > -1) return spec.specName;409410 if(['quartz', 'unique'].indexOf(spec.specName) > -1) return spec.specName;411 return 'opal';412 }413414 static async detectNetworkByWsEndpoint(wsEndpoint: string): Promise<TNetworks> {415 const api = new ApiPromise({provider: new WsProvider(wsEndpoint)});416 await api.isReady;417418 const network = await this.detectNetwork(api);419420 await api.disconnect();421422 return network;423 }424425 static async createConnection(wsEndpoint: string, listeners?: IApiListeners, network?: TNetworks | null): Promise<{426 api: ApiPromise;427 network: TNetworks;428 }> {429 if(typeof network === 'undefined' || network === null) network = 'opal';430 const supportedRPC = {431 opal: {432 unique: require('@unique-nft/opal-testnet-types/definitions').unique.rpc,433 },434 quartz: {435 unique: require('@unique-nft/quartz-mainnet-types/definitions').unique.rpc,436 },437 unique: {438 unique: require('@unique-nft/unique-mainnet-types/definitions').unique.rpc,439 },440 rococo: {},441 westend: {},442 moonbeam: {},443 moonriver: {},444 acala: {},445 karura: {},446 westmint: {},447 };448 if(!supportedRPC.hasOwnProperty(network)) network = await this.detectNetworkByWsEndpoint(wsEndpoint);449 const rpc = supportedRPC[network];450451 // TODO: investigate how to replace rpc in runtime452 // api._rpcCore.addUserInterfaces(rpc);453454 const api = new ApiPromise({provider: new WsProvider(wsEndpoint), rpc});455456 await api.isReadyOrError;457458 if (typeof listeners === 'undefined') listeners = {};459 for (const event of ['connected', 'disconnected', 'error', 'ready', 'decorated']) {460 if (!listeners.hasOwnProperty(event) || typeof listeners[event as TApiAllowedListeners] === 'undefined') continue;461 api.on(event as ApiInterfaceEvents, listeners[event as TApiAllowedListeners] as (...args: any[]) => any);462 }463464 return {api, network};465 }466467 getTransactionStatus(data: {events: {event: IEvent}[], status: any}) {468 const {events, status} = data;469 if (status.isReady) {470 return this.transactionStatus.NOT_READY;471 }472 if (status.isBroadcast) {473 return this.transactionStatus.NOT_READY;474 }475 if (status.isInBlock || status.isFinalized) {476 const errors = events.filter(e => e.event.method === 'ExtrinsicFailed');477 if (errors.length > 0) {478 return this.transactionStatus.FAIL;479 }480 if (events.filter(e => e.event.method === 'ExtrinsicSuccess').length > 0) {481 return this.transactionStatus.SUCCESS;482 }483 }484485 return this.transactionStatus.FAIL;486 }487488 signTransaction(sender: TSigner, transaction: any, options: Partial<SignerOptions> | null = null, label = 'transaction') {489 const sign = (callback: any) => {490 if(options !== null) return transaction.signAndSend(sender, options, callback);491 return transaction.signAndSend(sender, callback);492 };493 // eslint-disable-next-line no-async-promise-executor494 return new Promise(async (resolve, reject) => {495 try {496 const unsub = await sign((result: any) => {497 const status = this.getTransactionStatus(result);498499 if (status === this.transactionStatus.SUCCESS) {500 this.logger.log(`${label} successful`);501 unsub();502 resolve({result, status});503 } else if (status === this.transactionStatus.FAIL) {504 let moduleError = null;505506 if (result.hasOwnProperty('dispatchError')) {507 const dispatchError = result['dispatchError'];508509 if (dispatchError) {510 if (dispatchError.isModule) {511 const modErr = dispatchError.asModule;512 const errorMeta = dispatchError.registry.findMetaError(modErr);513514 moduleError = `${errorMeta.section}.${errorMeta.name}`;515 } else {516 moduleError = dispatchError.toHuman();517 }518 } else {519 this.logger.log(result, this.logger.level.ERROR);520 }521 }522523 this.logger.log(`Something went wrong with ${label}. Status: ${status}`, this.logger.level.ERROR);524 unsub();525 reject({status, moduleError, result});526 }527 });528 } catch (e) {529 this.logger.log(e, this.logger.level.ERROR);530 reject(e);531 }532 });533 }534535 constructApiCall(apiCall: string, params: any[]) {536 if(!apiCall.startsWith('api.')) throw Error(`Invalid api call: ${apiCall}`);537 let call = this.getApi() as any;538 for(const part of apiCall.slice(4).split('.')) {539 call = call[part];540 }541 return call(...params);542 }543544 async executeExtrinsic(sender: TSigner, extrinsic: string, params: any[], expectSuccess=true, options: Partial<SignerOptions>|null = null/*, failureMessage='expected success'*/) {545 if(this.api === null) throw Error('API not initialized');546 if(!extrinsic.startsWith('api.tx.')) throw Error(`${extrinsic} is not transaction`);547548 const startTime = (new Date()).getTime();549 let result: ITransactionResult;550 let events: IEvent[] = [];551 try {552 result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), options, extrinsic) as ITransactionResult;553 events = this.eventHelper.extractEvents(result);554 }555 catch(e) {556 if(!(e as object).hasOwnProperty('status')) throw e;557 result = e as ITransactionResult;558 }559560 const endTime = (new Date()).getTime();561562 const log = {563 executedAt: endTime,564 executionTime: endTime - startTime,565 type: this.chainLogType.EXTRINSIC,566 status: result.status,567 call: extrinsic,568 signer: this.getSignerAddress(sender),569 params,570 } as IUniqueHelperLog;571572 if(result.status !== this.transactionStatus.SUCCESS) {573 if (result.moduleError) log.moduleError = result.moduleError;574 else if (result.result.dispatchError) log.dispatchError = result.result.dispatchError;575 }576 if(events.length > 0) log.events = events;577578 this.chainLog.push(log);579580 if(expectSuccess && result.status !== this.transactionStatus.SUCCESS) {581 if (result.moduleError) throw Error(`${result.moduleError}`);582 else if (result.result.dispatchError) throw Error(JSON.stringify(result.result.dispatchError));583 }584 return result;585 }586587 async callRpc(rpc: string, params?: any[]) {588 if(typeof params === 'undefined') params = [];589 if(this.api === null) throw Error('API not initialized');590 if(!rpc.startsWith('api.rpc.') && !rpc.startsWith('api.query.')) throw Error(`${rpc} is not RPC call`);591592 const startTime = (new Date()).getTime();593 let result;594 let error = null;595 const log = {596 type: this.chainLogType.RPC,597 call: rpc,598 params,599 } as IUniqueHelperLog;600601 try {602 result = await this.constructApiCall(rpc, params);603 }604 catch(e) {605 error = e;606 }607608 const endTime = (new Date()).getTime();609610 log.executedAt = endTime;611 log.status = (error === null ? this.transactionStatus.SUCCESS : this.transactionStatus.FAIL) as 'Fail' | 'Success';612 log.executionTime = endTime - startTime;613614 this.chainLog.push(log);615616 if(error !== null) throw error;617618 return result;619 }620621 getSignerAddress(signer: IKeyringPair | string): string {622 if(typeof signer === 'string') return signer;623 return signer.address;624 }625626 fetchAllPalletNames(): string[] {627 if(this.api === null) throw Error('API not initialized');628 return this.api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());629 }630631 fetchMissingPalletNames(requiredPallets: string[]): string[] {632 const palletNames = this.fetchAllPalletNames();633 return requiredPallets.filter(p => !palletNames.includes(p));634 }635}636637638class HelperGroup<T extends ChainHelperBase> {639 helper: T;640641 constructor(uniqueHelper: T) {642 this.helper = uniqueHelper;643 }644}645646647class CollectionGroup extends HelperGroup<UniqueHelper> {648 /**649 * Get number of blocks when sponsored transaction is available.650 *651 * @param collectionId ID of collection652 * @param tokenId ID of token653 * @param addressObj address for which the sponsorship is checked654 * @example await getTokenNextSponsored(1, 2, {Substrate: '5DfhbVfww7ThF8q6f3...'});655 * @returns number of blocks or null if sponsorship hasn't been set656 */657 async getTokenNextSponsored(collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<number | null> {658 return (await this.helper.callRpc('api.rpc.unique.nextSponsored', [collectionId, addressObj, tokenId])).toJSON();659 }660661 /**662 * Get the number of created collections.663 *664 * @returns number of created collections665 */666 async getTotalCount(): Promise<number> {667 return (await this.helper.callRpc('api.rpc.unique.collectionStats')).created.toNumber();668 }669670 /**671 * Get information about the collection with additional data,672 * including the number of tokens it contains, its administrators,673 * the normalized address of the collection's owner, and decoded name and description.674 *675 * @param collectionId ID of collection676 * @example await getData(2)677 * @returns collection information object678 */679 async getData(collectionId: number): Promise<{680 id: number;681 name: string;682 description: string;683 tokensCount: number;684 admins: CrossAccountId[];685 normalizedOwner: TSubstrateAccount;686 raw: any687 } | null> {688 const collection = await this.helper.callRpc('api.rpc.unique.collectionById', [collectionId]);689 const humanCollection = collection.toHuman(), collectionData = {690 id: collectionId, name: null, description: null, tokensCount: 0, admins: [],691 raw: humanCollection,692 } as any, jsonCollection = collection.toJSON();693 if (humanCollection === null) return null;694 collectionData.raw.limits = jsonCollection.limits;695 collectionData.raw.permissions = jsonCollection.permissions;696 collectionData.normalizedOwner = this.helper.address.normalizeSubstrate(collectionData.raw.owner);697 for (const key of ['name', 'description']) {698 collectionData[key] = this.helper.util.vec2str(humanCollection[key]);699 }700701 collectionData.tokensCount = (['RFT', 'NFT'].includes(humanCollection.mode))702 ? await this.helper[humanCollection.mode.toLocaleLowerCase() as 'nft' | 'rft'].getLastTokenId(collectionId)703 : 0;704 collectionData.admins = await this.getAdmins(collectionId);705706 return collectionData;707 }708709 /**710 * Get the addresses of the collection's administrators, optionally normalized.711 *712 * @param collectionId ID of collection713 * @param normalize whether to normalize the addresses to the default ss58 format714 * @example await getAdmins(1)715 * @returns array of administrators716 */717 async getAdmins(collectionId: number, normalize = false): Promise<CrossAccountId[]> {718 const admins = (await this.helper.callRpc('api.rpc.unique.adminlist', [collectionId])).toHuman();719720 return normalize721 ? admins.map((address: CrossAccountId) => address.withNormalizedSubstrate())722 : admins;723 }724725 /**726 * Get the addresses added to the collection allow-list, optionally normalized.727 * @param collectionId ID of collection728 * @param normalize whether to normalize the addresses to the default ss58 format729 * @example await getAllowList(1)730 * @returns array of allow-listed addresses731 */732 async getAllowList(collectionId: number, normalize = false): Promise<CrossAccountId[]> {733 const allowListed = (await this.helper.callRpc('api.rpc.unique.allowlist', [collectionId])).toHuman();734 return normalize735 ? allowListed.map((address: CrossAccountId) => address.withNormalizedSubstrate())736 : allowListed;737 }738739 /**740 * Get the effective limits of the collection instead of null for default values741 *742 * @param collectionId ID of collection743 * @example await getEffectiveLimits(2)744 * @returns object of collection limits745 */746 async getEffectiveLimits(collectionId: number): Promise<ICollectionLimits> {747 return (await this.helper.callRpc('api.rpc.unique.effectiveCollectionLimits', [collectionId])).toJSON();748 }749750 /**751 * Burns the collection if the signer has sufficient permissions and collection is empty.752 *753 * @param signer keyring of signer754 * @param collectionId ID of collection755 * @example await helper.collection.burn(aliceKeyring, 3);756 * @returns ```true``` if extrinsic success, otherwise ```false```757 */758 async burn(signer: TSigner, collectionId: number): Promise<boolean> {759 const result = await this.helper.executeExtrinsic(760 signer,761 'api.tx.unique.destroyCollection', [collectionId],762 true,763 );764765 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionDestroyed');766 }767768 /**769 * Sets the sponsor for the collection (Requires the Substrate address). Needs confirmation by the sponsor.770 *771 * @param signer keyring of signer772 * @param collectionId ID of collection773 * @param sponsorAddress Sponsor substrate address774 * @example setSponsor(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...")775 * @returns ```true``` if extrinsic success, otherwise ```false```776 */777 async setSponsor(signer: TSigner, collectionId: number, sponsorAddress: TSubstrateAccount): Promise<boolean> {778 const result = await this.helper.executeExtrinsic(779 signer,780 'api.tx.unique.setCollectionSponsor', [collectionId, sponsorAddress],781 true,782 );783784 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionSponsorSet');785 }786787 /**788 * Confirms consent to sponsor the collection on behalf of the signer.789 *790 * @param signer keyring of signer791 * @param collectionId ID of collection792 * @example confirmSponsorship(aliceKeyring, 10)793 * @returns ```true``` if extrinsic success, otherwise ```false```794 */795 async confirmSponsorship(signer: TSigner, collectionId: number): Promise<boolean> {796 const result = await this.helper.executeExtrinsic(797 signer,798 'api.tx.unique.confirmSponsorship', [collectionId],799 true,800 );801802 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'SponsorshipConfirmed');803 }804805 /**806 * Removes the sponsor of a collection, regardless if it consented or not.807 *808 * @param signer keyring of signer809 * @param collectionId ID of collection810 * @example removeSponsor(aliceKeyring, 10)811 * @returns ```true``` if extrinsic success, otherwise ```false```812 */813 async removeSponsor(signer: TSigner, collectionId: number): Promise<boolean> {814 const result = await this.helper.executeExtrinsic(815 signer,816 'api.tx.unique.removeCollectionSponsor', [collectionId],817 true,818 );819820 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionSponsorRemoved');821 }822823 /**824 * Sets the limits of the collection. At least one limit must be specified for a correct call.825 *826 * @param signer keyring of signer827 * @param collectionId ID of collection828 * @param limits collection limits object829 * @example830 * await setLimits(831 * aliceKeyring,832 * 10,833 * {834 * sponsorTransferTimeout: 0,835 * ownerCanDestroy: false836 * }837 * )838 * @returns ```true``` if extrinsic success, otherwise ```false```839 */840 async setLimits(signer: TSigner, collectionId: number, limits: ICollectionLimits): Promise<boolean> {841 const result = await this.helper.executeExtrinsic(842 signer,843 'api.tx.unique.setCollectionLimits', [collectionId, limits],844 true,845 );846847 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionLimitSet');848 }849850 /**851 * Changes the owner of the collection to the new Substrate address.852 *853 * @param signer keyring of signer854 * @param collectionId ID of collection855 * @param ownerAddress substrate address of new owner856 * @example changeOwner(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...")857 * @returns ```true``` if extrinsic success, otherwise ```false```858 */859 async changeOwner(signer: TSigner, collectionId: number, ownerAddress: TSubstrateAccount): Promise<boolean> {860 const result = await this.helper.executeExtrinsic(861 signer,862 'api.tx.unique.changeCollectionOwner', [collectionId, ownerAddress],863 true,864 );865866 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionOwnedChanged');867 }868869 /**870 * Adds a collection administrator.871 *872 * @param signer keyring of signer873 * @param collectionId ID of collection874 * @param adminAddressObj Administrator address (substrate or ethereum)875 * @example addAdmin(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."})876 * @returns ```true``` if extrinsic success, otherwise ```false```877 */878 async addAdmin(signer: TSigner, collectionId: number, adminAddressObj: ICrossAccountId): Promise<boolean> {879 const result = await this.helper.executeExtrinsic(880 signer,881 'api.tx.unique.addCollectionAdmin', [collectionId, adminAddressObj],882 true,883 );884885 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminAdded');886 }887888 /**889 * Removes a collection administrator.890 *891 * @param signer keyring of signer892 * @param collectionId ID of collection893 * @param adminAddressObj Administrator address (substrate or ethereum)894 * @example removeAdmin(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."})895 * @returns ```true``` if extrinsic success, otherwise ```false```896 */897 async removeAdmin(signer: TSigner, collectionId: number, adminAddressObj: ICrossAccountId): Promise<boolean> {898 const result = await this.helper.executeExtrinsic(899 signer,900 'api.tx.unique.removeCollectionAdmin', [collectionId, adminAddressObj],901 true,902 );903904 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminRemoved');905 }906907 /**908 * Check if user is in allow list.909 * 910 * @param collectionId ID of collection911 * @param user Account to check912 * @example await getAdmins(1)913 * @returns is user in allow list914 */915 async allowed(collectionId: number, user: ICrossAccountId): Promise<boolean> {916 return (await this.helper.callRpc('api.rpc.unique.allowed', [collectionId, user])).toJSON();917 }918919 /**920 * Adds an address to allow list921 * @param signer keyring of signer922 * @param collectionId ID of collection923 * @param addressObj address to add to the allow list924 * @returns ```true``` if extrinsic success, otherwise ```false```925 */926 async addToAllowList(signer: TSigner, collectionId: number, addressObj: ICrossAccountId): Promise<boolean> {927 const result = await this.helper.executeExtrinsic(928 signer,929 'api.tx.unique.addToAllowList', [collectionId, addressObj],930 true,931 );932933 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'AllowListAddressAdded');934 }935936 /**937 * Removes an address from allow list938 *939 * @param signer keyring of signer940 * @param collectionId ID of collection941 * @param addressObj address to remove from the allow list942 * @returns ```true``` if extrinsic success, otherwise ```false```943 */944 async removeFromAllowList(signer: TSigner, collectionId: number, addressObj: ICrossAccountId): Promise<boolean> {945 const result = await this.helper.executeExtrinsic(946 signer,947 'api.tx.unique.removeFromAllowList', [collectionId, addressObj],948 true,949 );950951 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'AllowListAddressRemoved');952 }953954 /**955 * Sets onchain permissions for selected collection.956 *957 * @param signer keyring of signer958 * @param collectionId ID of collection959 * @param permissions collection permissions object960 * @example setPermissions(aliceKeyring, 10, {access:'AllowList', mintMode: true, nesting: {collectionAdmin: true, tokenOwner: true}});961 * @returns ```true``` if extrinsic success, otherwise ```false```962 */963 async setPermissions(signer: TSigner, collectionId: number, permissions: ICollectionPermissions): Promise<boolean> {964 const result = await this.helper.executeExtrinsic(965 signer,966 'api.tx.unique.setCollectionPermissions', [collectionId, permissions],967 true,968 );969970 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionPermissionSet');971 }972973 /**974 * Enables nesting for selected collection. If `restricted` set, you can nest only tokens from specified collections.975 *976 * @param signer keyring of signer977 * @param collectionId ID of collection978 * @param permissions nesting permissions object979 * @example enableNesting(aliceKeyring, 10, {collectionAdmin: true, tokenOwner: true});980 * @returns ```true``` if extrinsic success, otherwise ```false```981 */982 async enableNesting(signer: TSigner, collectionId: number, permissions: INestingPermissions): Promise<boolean> {983 return await this.setPermissions(signer, collectionId, {nesting: permissions});984 }985986 /**987 * Disables nesting for selected collection.988 *989 * @param signer keyring of signer990 * @param collectionId ID of collection991 * @example disableNesting(aliceKeyring, 10);992 * @returns ```true``` if extrinsic success, otherwise ```false```993 */994 async disableNesting(signer: TSigner, collectionId: number): Promise<boolean> {995 return await this.setPermissions(signer, collectionId, {nesting: {tokenOwner: false, collectionAdmin: false}});996 }997998 /**999 * Sets onchain properties to the collection.1000 *1001 * @param signer keyring of signer1002 * @param collectionId ID of collection1003 * @param properties array of property objects1004 * @example setProperties(aliceKeyring, 10, [{key: "gender", value: "male"}]);1005 * @returns ```true``` if extrinsic success, otherwise ```false```1006 */1007 async setProperties(signer: TSigner, collectionId: number, properties: IProperty[]): Promise<boolean> {1008 const result = await this.helper.executeExtrinsic(1009 signer,1010 'api.tx.unique.setCollectionProperties', [collectionId, properties],1011 true,1012 );10131014 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionPropertySet');1015 }10161017 /**1018 * Get collection properties.1019 * 1020 * @param collectionId ID of collection1021 * @param propertyKeys optionally filter the returned properties to only these keys1022 * @example getProperties(1219, ['location', 'date', 'time', 'isParadise']);1023 * @returns array of key-value pairs1024 */1025 async getProperties(collectionId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {1026 return (await this.helper.callRpc('api.rpc.unique.collectionProperties', [collectionId, propertyKeys])).toHuman();1027 }10281029 /**1030 * Deletes onchain properties from the collection.1031 *1032 * @param signer keyring of signer1033 * @param collectionId ID of collection1034 * @param propertyKeys array of property keys to delete1035 * @example deleteProperties(aliceKeyring, 10, ["gender", "age"]);1036 * @returns ```true``` if extrinsic success, otherwise ```false```1037 */1038 async deleteProperties(signer: TSigner, collectionId: number, propertyKeys: string[]): Promise<boolean> {1039 const result = await this.helper.executeExtrinsic(1040 signer,1041 'api.tx.unique.deleteCollectionProperties', [collectionId, propertyKeys],1042 true,1043 );10441045 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionPropertyDeleted');1046 }10471048 /**1049 * Changes the owner of the token.1050 *1051 * @param signer keyring of signer1052 * @param collectionId ID of collection1053 * @param tokenId ID of token1054 * @param addressObj address of a new owner1055 * @param amount amount of tokens to be transfered. For NFT must be set to 1n1056 * @example transferToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1057 * @returns true if the token success, otherwise false1058 */1059 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId, amount=1n): Promise<boolean> {1060 const result = await this.helper.executeExtrinsic(1061 signer,1062 'api.tx.unique.transfer', [addressObj, collectionId, tokenId, amount],1063 true, // `Unable to transfer token #${tokenId} from collection #${collectionId}`,1064 );10651066 return this.helper.util.isTokenTransferSuccess(result.result.events, collectionId, tokenId, {Substrate: typeof signer === 'string' ? signer : signer.address}, addressObj, amount);1067 }10681069 /**1070 *1071 * Change ownership of a token(s) on behalf of the owner.1072 *1073 * @param signer keyring of signer1074 * @param collectionId ID of collection1075 * @param tokenId ID of token1076 * @param fromAddressObj address on behalf of which the token will be sent1077 * @param toAddressObj new token owner1078 * @param amount amount of tokens to be transfered. For NFT must be set to 1n1079 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg"}, {Ethereum: "0x9F0583DbB85..."})1080 * @returns true if the token success, otherwise false1081 */1082 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1083 const result = await this.helper.executeExtrinsic(1084 signer,1085 'api.tx.unique.transferFrom', [fromAddressObj, toAddressObj, collectionId, tokenId, amount],1086 true, // `Unable to transfer token #${tokenId} from collection #${collectionId}`,1087 );1088 return this.helper.util.isTokenTransferSuccess(result.result.events, collectionId, tokenId, fromAddressObj, toAddressObj, amount);1089 }10901091 /**1092 *1093 * Destroys a concrete instance of NFT/RFT or burns a specified amount of fungible tokens.1094 *1095 * @param signer keyring of signer1096 * @param collectionId ID of collection1097 * @param tokenId ID of token1098 * @param amount amount of tokens to be burned. For NFT must be set to 1n1099 * @example burnToken(aliceKeyring, 10, 5);1100 * @returns ```true``` if the extrinsic is successful, otherwise ```false```1101 */1102 async burnToken(signer: TSigner, collectionId: number, tokenId: number, amount=1n): Promise<boolean> {1103 const burnResult = await this.helper.executeExtrinsic(1104 signer,1105 'api.tx.unique.burnItem', [collectionId, tokenId, amount],1106 true, // `Unable to burn token for ${label}`,1107 );1108 const burnedTokens = this.helper.util.extractTokensFromBurnResult(burnResult);1109 if (burnedTokens.tokens.length > 1) throw Error('Burned multiple tokens');1110 return burnedTokens.success;1111 }11121113 /**1114 * Destroys a concrete instance of NFT on behalf of the owner1115 *1116 * @param signer keyring of signer1117 * @param collectionId ID of collection1118 * @param tokenId ID of token1119 * @param fromAddressObj address on behalf of which the token will be burnt1120 * @param amount amount of tokens to be burned. For NFT must be set to 1n1121 * @example burnTokenFrom(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."}, 5, {Ethereum: "0x9F0583DbB85..."})1122 * @returns ```true``` if extrinsic success, otherwise ```false```1123 */1124 async burnTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1125 const burnResult = await this.helper.executeExtrinsic(1126 signer,1127 'api.tx.unique.burnFrom', [collectionId, fromAddressObj, tokenId, amount],1128 true, // `Unable to burn token from for ${label}`,1129 );1130 const burnedTokens = this.helper.util.extractTokensFromBurnResult(burnResult);1131 return burnedTokens.success && burnedTokens.tokens.length > 0;1132 }11331134 /**1135 * Set, change, or remove approved address to transfer the ownership of the NFT.1136 *1137 * @param signer keyring of signer1138 * @param collectionId ID of collection1139 * @param tokenId ID of token1140 * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens1141 * @param amount amount of token to be approved. For NFT must be set to 1n1142 * @returns ```true``` if extrinsic success, otherwise ```false```1143 */1144 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1145 const approveResult = await this.helper.executeExtrinsic(1146 signer,1147 'api.tx.unique.approve', [toAddressObj, collectionId, tokenId, amount],1148 true, // `Unable to approve token for ${label}`,1149 );11501151 return this.helper.util.findCollectionInEvents(approveResult.result.events, collectionId, 'common', 'Approved');1152 }11531154 /**1155 * Get the amount of token pieces approved to transfer or burn. Normally 0.1156 *1157 * @param collectionId ID of collection1158 * @param tokenId ID of token1159 * @param toAccountObj address which is approved to use token pieces1160 * @param fromAccountObj address which may have allowed the use of its owned tokens1161 * @example getTokenApprovedPieces(10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Substrate: "5ERZNF88Mm7UGfPP3mdG..."})1162 * @returns number of approved to transfer pieces1163 */1164 async getTokenApprovedPieces(collectionId: number, tokenId: number, toAccountObj: ICrossAccountId, fromAccountObj: ICrossAccountId): Promise<bigint> {1165 return (await this.helper.callRpc('api.rpc.unique.allowance', [collectionId, fromAccountObj, toAccountObj, tokenId])).toBigInt();1166 }11671168 /**1169 * Get the last created token ID in a collection1170 *1171 * @param collectionId ID of collection1172 * @example getLastTokenId(10);1173 * @returns id of the last created token1174 */1175 async getLastTokenId(collectionId: number): Promise<number> {1176 return (await this.helper.callRpc('api.rpc.unique.lastTokenId', [collectionId])).toNumber();1177 }11781179 /**1180 * Check if token exists1181 *1182 * @param collectionId ID of collection1183 * @param tokenId ID of token1184 * @example doesTokenExist(10, 20);1185 * @returns true if the token exists, otherwise false1186 */1187 async doesTokenExist(collectionId: number, tokenId: number): Promise<boolean> {1188 return (await this.helper.callRpc('api.rpc.unique.tokenExists', [collectionId, tokenId])).toJSON();1189 }1190}11911192class NFTnRFT extends CollectionGroup {1193 /**1194 * Get tokens owned by account1195 *1196 * @param collectionId ID of collection1197 * @param addressObj tokens owner1198 * @example getTokensByAddress(10, {Substrate: "5DyN4Y92vZCjv38fg..."})1199 * @returns array of token ids owned by account1200 */1201 async getTokensByAddress(collectionId: number, addressObj: ICrossAccountId): Promise<number[]> {1202 return (await this.helper.callRpc('api.rpc.unique.accountTokens', [collectionId, addressObj])).toJSON();1203 }12041205 /**1206 * Get token data1207 *1208 * @param collectionId ID of collection1209 * @param tokenId ID of token1210 * @param propertyKeys optionally filter the token properties to only these keys1211 * @param blockHashAt optionally query the data at some block with this hash1212 * @example getToken(10, 5);1213 * @returns human readable token data1214 */1215 async getToken(collectionId: number, tokenId: number, propertyKeys: string[] = [], blockHashAt?: string): Promise<{1216 properties: IProperty[];1217 owner: CrossAccountId;1218 normalizedOwner: CrossAccountId;1219 }| null> {1220 let tokenData;1221 if(typeof blockHashAt === 'undefined') {1222 tokenData = await this.helper.callRpc('api.rpc.unique.tokenData', [collectionId, tokenId]);1223 }1224 else {1225 if(propertyKeys.length == 0) {1226 const collection = (await this.helper.callRpc('api.rpc.unique.collectionById', [collectionId])).toHuman();1227 if(!collection) return null;1228 propertyKeys = collection.tokenPropertyPermissions.map((x: ITokenPropertyPermission) => x.key);1229 }1230 tokenData = await this.helper.callRpc('api.rpc.unique.tokenData', [collectionId, tokenId, propertyKeys, blockHashAt]);1231 }1232 tokenData = tokenData.toHuman();1233 if (tokenData === null || tokenData.owner === null) return null;1234 const owner = {} as any;1235 for (const key of Object.keys(tokenData.owner)) {1236 owner[key.toLocaleLowerCase()] = key.toLocaleLowerCase() == 'substrate' 1237 ? CrossAccountId.normalizeSubstrateAddress(tokenData.owner[key]) 1238 : tokenData.owner[key];1239 }1240 tokenData.normalizedOwner = CrossAccountId.fromLowerCaseKeys(owner);1241 return tokenData;1242 }12431244 /**1245 * Set permissions to change token properties1246 *1247 * @param signer keyring of signer1248 * @param collectionId ID of collection1249 * @param permissions permissions to change a property by the collection admin or token owner1250 * @example setTokenPropertyPermissions(1251 * aliceKeyring, 10, [{key: "gender", permission: {tokenOwner: true, mutable: true, collectionAdmin: true}}]1252 * )1253 * @returns true if extrinsic success otherwise false1254 */1255 async setTokenPropertyPermissions(signer: TSigner, collectionId: number, permissions: ITokenPropertyPermission[]): Promise<boolean> {1256 const result = await this.helper.executeExtrinsic(1257 signer,1258 'api.tx.unique.setTokenPropertyPermissions', [collectionId, permissions],1259 true,1260 );12611262 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'PropertyPermissionSet');1263 }12641265 /**1266 * Get token property permissions.1267 * 1268 * @param collectionId ID of collection1269 * @param propertyKeys optionally filter the returned property permissions to only these keys1270 * @example getPropertyPermissions(1219, ['location', 'date', 'time', 'isParadise']);1271 * @returns array of key-permission pairs1272 */1273 async getPropertyPermissions(collectionId: number, propertyKeys: string[] | null = null): Promise<ITokenPropertyPermission[]> {1274 return (await this.helper.callRpc('api.rpc.unique.propertyPermissions', [collectionId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();1275 }12761277 /**1278 * Set token properties1279 *1280 * @param signer keyring of signer1281 * @param collectionId ID of collection1282 * @param tokenId ID of token1283 * @param properties key-value pairs of metadata which to add to a token. Keys must be permitted in the collection1284 * @example setTokenProperties(aliceKeyring, 10, 5, [{key: "gender", value: "female"}, {key: "age", value: "23"}])1285 * @returns ```true``` if extrinsic success, otherwise ```false```1286 */1287 async setTokenProperties(signer: TSigner, collectionId: number, tokenId: number, properties: IProperty[]): Promise<boolean> {1288 const result = await this.helper.executeExtrinsic(1289 signer,1290 'api.tx.unique.setTokenProperties', [collectionId, tokenId, properties],1291 true,1292 );12931294 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'TokenPropertySet');1295 }12961297 /**1298 * Get properties, metadata assigned to a token.1299 * 1300 * @param collectionId ID of collection1301 * @param tokenId ID of token1302 * @param propertyKeys optionally filter the returned properties to only these keys1303 * @example getTokenProperties(1219, ['location', 'date', 'time', 'isParadise']);1304 * @returns array of key-value pairs1305 */1306 async getTokenProperties(collectionId: number, tokenId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {1307 return (await this.helper.callRpc('api.rpc.unique.tokenProperties', [collectionId, tokenId, propertyKeys])).toHuman();1308 }13091310 /**1311 * Delete the provided properties of a token1312 * @param signer keyring of signer1313 * @param collectionId ID of collection1314 * @param tokenId ID of token1315 * @param propertyKeys property keys to be deleted1316 * @example deleteTokenProperties(aliceKeyring, 10, 5, ["gender", "age"])1317 * @returns ```true``` if extrinsic success, otherwise ```false```1318 */1319 async deleteTokenProperties(signer: TSigner, collectionId: number, tokenId: number, propertyKeys: string[]): Promise<boolean> {1320 const result = await this.helper.executeExtrinsic(1321 signer,1322 'api.tx.unique.deleteTokenProperties', [collectionId, tokenId, propertyKeys],1323 true,1324 );13251326 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'TokenPropertyDeleted');1327 }13281329 /**1330 * Mint new collection1331 *1332 * @param signer keyring of signer1333 * @param collectionOptions basic collection options and properties1334 * @param mode NFT or RFT type of a collection1335 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")1336 * @returns object of the created collection1337 */1338 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueBaseCollection> {1339 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1340 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};1341 for (const key of ['name', 'description', 'tokenPrefix']) {1342 if (typeof collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] === 'string') collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] = this.helper.util.str2vec(collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] as string);1343 }1344 const creationResult = await this.helper.executeExtrinsic(1345 signer,1346 'api.tx.unique.createCollectionEx', [collectionOptions],1347 true, // errorLabel,1348 );1349 return this.getCollectionObject(this.helper.util.extractCollectionIdFromCreationResult(creationResult));1350 }13511352 getCollectionObject(_collectionId: number): any {1353 return null;1354 }13551356 getTokenObject(_collectionId: number, _tokenId: number): any {1357 return null;1358 }1359}136013611362class NFTGroup extends NFTnRFT {1363 /**1364 * Get collection object1365 * @param collectionId ID of collection1366 * @example getCollectionObject(2);1367 * @returns instance of UniqueNFTCollection1368 */1369 getCollectionObject(collectionId: number): UniqueNFTCollection {1370 return new UniqueNFTCollection(collectionId, this.helper);1371 }13721373 /**1374 * Get token object1375 * @param collectionId ID of collection1376 * @param tokenId ID of token1377 * @example getTokenObject(10, 5);1378 * @returns instance of UniqueNFTToken1379 */1380 getTokenObject(collectionId: number, tokenId: number): UniqueNFToken {1381 return new UniqueNFToken(tokenId, this.getCollectionObject(collectionId));1382 }13831384 /**1385 * Get token's owner1386 * @param collectionId ID of collection1387 * @param tokenId ID of token1388 * @param blockHashAt optionally query the data at the block with this hash1389 * @example getTokenOwner(10, 5);1390 * @returns Address in CrossAccountId format, e.g. {Substrate: "5DnSF6RRjwteE3BrCj..."}1391 */1392 async getTokenOwner(collectionId: number, tokenId: number, blockHashAt?: string): Promise<CrossAccountId> {1393 let owner;1394 if (typeof blockHashAt === 'undefined') {1395 owner = await this.helper.callRpc('api.rpc.unique.tokenOwner', [collectionId, tokenId]);1396 } else {1397 owner = await this.helper.callRpc('api.rpc.unique.tokenOwner', [collectionId, tokenId, blockHashAt]);1398 }1399 return CrossAccountId.fromLowerCaseKeys(owner.toJSON());1400 }14011402 /**1403 * Is token approved to transfer1404 * @param collectionId ID of collection1405 * @param tokenId ID of token1406 * @param toAccountObj address to be approved1407 * @returns ```true``` if extrinsic success, otherwise ```false```1408 */1409 async isTokenApproved(collectionId: number, tokenId: number, toAccountObj: ICrossAccountId): Promise<boolean> {1410 return (await this.getTokenApprovedPieces(collectionId, tokenId, toAccountObj, await this.getTokenOwner(collectionId, tokenId))) === 1n;1411 }14121413 /**1414 * Changes the owner of the token.1415 *1416 * @param signer keyring of signer1417 * @param collectionId ID of collection1418 * @param tokenId ID of token1419 * @param addressObj address of a new owner1420 * @example transferToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1421 * @returns ```true``` if extrinsic success, otherwise ```false```1422 */1423 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<boolean> {1424 return await super.transferToken(signer, collectionId, tokenId, addressObj, 1n);1425 }14261427 /**1428 *1429 * Change ownership of a NFT on behalf of the owner.1430 *1431 * @param signer keyring of signer1432 * @param collectionId ID of collection1433 * @param tokenId ID of token1434 * @param fromAddressObj address on behalf of which the token will be sent1435 * @param toAddressObj new token owner1436 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Ethereum: "0x9F0583DbB85..."})1437 * @returns ```true``` if extrinsic success, otherwise ```false```1438 */1439 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId): Promise<boolean> {1440 return await super.transferTokenFrom(signer, collectionId, tokenId, fromAddressObj, toAddressObj, 1n);1441 }14421443 /**1444 * Recursively find the address that owns the token1445 * @param collectionId ID of collection1446 * @param tokenId ID of token1447 * @param blockHashAt1448 * @example getTokenTopmostOwner(10, 5);1449 * @returns address in CrossAccountId format, e.g. {Substrate: "5DyN4Y92vZCjv38fg..."}1450 */1451 async getTokenTopmostOwner(collectionId: number, tokenId: number, blockHashAt?: string): Promise<CrossAccountId | null> {1452 let owner;1453 if (typeof blockHashAt === 'undefined') {1454 owner = await this.helper.callRpc('api.rpc.unique.topmostTokenOwner', [collectionId, tokenId]);1455 } else {1456 owner = await this.helper.callRpc('api.rpc.unique.topmostTokenOwner', [collectionId, tokenId, blockHashAt]);1457 }14581459 if (owner === null) return null;14601461 return owner.toHuman();1462 }14631464 /**1465 * Get tokens nested in the provided token1466 * @param collectionId ID of collection1467 * @param tokenId ID of token1468 * @param blockHashAt optionally query the data at the block with this hash1469 * @example getTokenChildren(10, 5);1470 * @returns tokens whose depth of nesting is <= 51471 */1472 async getTokenChildren(collectionId: number, tokenId: number, blockHashAt?: string): Promise<IToken[]> {1473 let children;1474 if(typeof blockHashAt === 'undefined') {1475 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId]);1476 } else {1477 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId, blockHashAt]);1478 }14791480 return children.toJSON().map((x: any) => {1481 return {collectionId: x.collection, tokenId: x.token};1482 });1483 }14841485 /**1486 * Nest one token into another1487 * @param signer keyring of signer1488 * @param tokenObj token to be nested1489 * @param rootTokenObj token to be parent1490 * @example nestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4});1491 * @returns ```true``` if extrinsic success, otherwise ```false```1492 */1493 async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {1494 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1495 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);1496 if(!result) {1497 throw Error('Unable to nest token!');1498 }1499 return result;1500 }15011502 /**1503 * Remove token from nested state1504 * @param signer keyring of signer1505 * @param tokenObj token to unnest1506 * @param rootTokenObj parent of a token1507 * @param toAddressObj address of a new token owner1508 * @example unnestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4}, {Substrate: "5DyN4Y92vZCjv38fg..."});1509 * @returns ```true``` if extrinsic success, otherwise ```false```1510 */1511 async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {1512 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1513 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);1514 if(!result) {1515 throw Error('Unable to unnest token!');1516 }1517 return result;1518 }15191520 /**1521 * Mint new collection1522 * @param signer keyring of signer1523 * @param collectionOptions Collection options1524 * @example1525 * mintCollection(aliceKeyring, {1526 * name: 'New',1527 * description: 'New collection',1528 * tokenPrefix: 'NEW',1529 * })1530 * @returns object of the created collection1531 */1532 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueNFTCollection> {1533 return await super.mintCollection(signer, collectionOptions, 'NFT') as UniqueNFTCollection;1534 }15351536 /**1537 * Mint new token1538 * @param signer keyring of signer1539 * @param data token data1540 * @returns created token object1541 */1542 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFToken> {1543 const creationResult = await this.helper.executeExtrinsic(1544 signer,1545 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1546 nft: {1547 properties: data.properties,1548 },1549 }],1550 true,1551 );1552 const createdTokens = this.helper.util.extractTokensFromCreationResult(creationResult);1553 if (createdTokens.tokens.length > 1) throw Error('Minted multiple tokens');1554 if (createdTokens.tokens.length < 1) throw Error('No tokens minted');1555 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1556 }15571558 /**1559 * Mint multiple NFT tokens1560 * @param signer keyring of signer1561 * @param collectionId ID of collection1562 * @param tokens array of tokens with owner and properties1563 * @example1564 * mintMultipleTokens(aliceKeyring, 10, [{1565 * owner: {Substrate: "5DyN4Y92vZCjv38fg..."},1566 * properties: [{key: "gender", value: "male"},{key: "age", value: "45"}],1567 * },{1568 * owner: {Ethereum: "0x9F0583DbB855d..."},1569 * properties: [{key: "gender", value: "female"},{key: "age", value: "22"}],1570 * }]);1571 * @returns ```true``` if extrinsic success, otherwise ```false```1572 */1573 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1574 const creationResult = await this.helper.executeExtrinsic(1575 signer,1576 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],1577 true,1578 );1579 const collection = this.getCollectionObject(collectionId);1580 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1581 }15821583 /**1584 * Mint multiple NFT tokens with one owner1585 * @param signer keyring of signer1586 * @param collectionId ID of collection1587 * @param owner tokens owner1588 * @param tokens array of tokens with owner and properties1589 * @example1590 * mintMultipleTokensWithOneOwner(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...", [{1591 * properties: [{1592 * key: "gender",1593 * value: "female",1594 * },{1595 * key: "age",1596 * value: "33",1597 * }],1598 * }]);1599 * @returns array of newly created tokens1600 */1601 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1602 const rawTokens = [];1603 for (const token of tokens) {1604 const raw = {NFT: {properties: token.properties}};1605 rawTokens.push(raw);1606 }1607 const creationResult = await this.helper.executeExtrinsic(1608 signer,1609 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1610 true,1611 );1612 const collection = this.getCollectionObject(collectionId);1613 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1614 }16151616 /**1617 * Set, change, or remove approved address to transfer the ownership of the NFT.1618 *1619 * @param signer keyring of signer1620 * @param collectionId ID of collection1621 * @param tokenId ID of token1622 * @param toAddressObj address to approve1623 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1624 * @returns ```true``` if extrinsic success, otherwise ```false```1625 */1626 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {1627 return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);1628 }1629}163016311632class RFTGroup extends NFTnRFT {1633 /**1634 * Get collection object1635 * @param collectionId ID of collection1636 * @example getCollectionObject(2);1637 * @returns instance of UniqueRFTCollection1638 */1639 getCollectionObject(collectionId: number): UniqueRFTCollection {1640 return new UniqueRFTCollection(collectionId, this.helper);1641 }16421643 /**1644 * Get token object1645 * @param collectionId ID of collection1646 * @param tokenId ID of token1647 * @example getTokenObject(10, 5);1648 * @returns instance of UniqueNFTToken1649 */1650 getTokenObject(collectionId: number, tokenId: number): UniqueRFToken {1651 return new UniqueRFToken(tokenId, this.getCollectionObject(collectionId));1652 }16531654 /**1655 * Get top 10 token owners with the largest number of pieces1656 * @param collectionId ID of collection1657 * @param tokenId ID of token1658 * @example getTokenTop10Owners(10, 5);1659 * @returns array of top 10 owners1660 */1661 async getTokenTop10Owners(collectionId: number, tokenId: number): Promise<CrossAccountId[]> {1662 return (await this.helper.callRpc('api.rpc.unique.tokenOwners', [collectionId, tokenId])).toJSON().map(CrossAccountId.fromLowerCaseKeys);1663 }16641665 /**1666 * Get number of pieces owned by address1667 * @param collectionId ID of collection1668 * @param tokenId ID of token1669 * @param addressObj address token owner1670 * @example getTokenBalance(10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."});1671 * @returns number of pieces ownerd by address1672 */1673 async getTokenBalance(collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<bigint> {1674 return (await this.helper.callRpc('api.rpc.unique.balance', [collectionId, addressObj, tokenId])).toBigInt();1675 }16761677 /**1678 * Transfer pieces of token to another address1679 * @param signer keyring of signer1680 * @param collectionId ID of collection1681 * @param tokenId ID of token1682 * @param addressObj address of a new owner1683 * @param amount number of pieces to be transfered1684 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, 2000n)1685 * @returns ```true``` if extrinsic success, otherwise ```false```1686 */1687 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId, amount=1n): Promise<boolean> {1688 return await super.transferToken(signer, collectionId, tokenId, addressObj, amount);1689 }16901691 /**1692 * Change ownership of some pieces of RFT on behalf of the owner.1693 * @param signer keyring of signer1694 * @param collectionId ID of collection1695 * @param tokenId ID of token1696 * @param fromAddressObj address on behalf of which the token will be sent1697 * @param toAddressObj new token owner1698 * @param amount number of pieces to be transfered1699 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Substrate: "5DfhbVfww7ThF8q6f3i..."}, 2000n)1700 * @returns ```true``` if extrinsic success, otherwise ```false```1701 */1702 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1703 return await super.transferTokenFrom(signer, collectionId, tokenId, fromAddressObj, toAddressObj, amount);1704 }17051706 /**1707 * Mint new collection1708 * @param signer keyring of signer1709 * @param collectionOptions Collection options1710 * @example1711 * mintCollection(aliceKeyring, {1712 * name: 'New',1713 * description: 'New collection',1714 * tokenPrefix: 'NEW',1715 * })1716 * @returns object of the created collection1717 */1718 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueRFTCollection> {1719 return await super.mintCollection(signer, collectionOptions, 'RFT') as UniqueRFTCollection;1720 }17211722 /**1723 * Mint new token1724 * @param signer keyring of signer1725 * @param data token data1726 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});1727 * @returns created token object1728 */1729 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFToken> {1730 const creationResult = await this.helper.executeExtrinsic(1731 signer,1732 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1733 refungible: {1734 pieces: data.pieces,1735 properties: data.properties,1736 },1737 }],1738 true,1739 );1740 const createdTokens = this.helper.util.extractTokensFromCreationResult(creationResult);1741 if (createdTokens.tokens.length > 1) throw Error('Minted multiple tokens');1742 if (createdTokens.tokens.length < 1) throw Error('No tokens minted');1743 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1744 }17451746 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1747 throw Error('Not implemented');1748 const creationResult = await this.helper.executeExtrinsic(1749 signer,1750 'api.tx.unique.createMultipleItemsEx', [collectionId, {RefungibleMultipleOwners: tokens}],1751 true, // `Unable to mint RFT tokens for ${label}`,1752 );1753 const collection = this.getCollectionObject(collectionId);1754 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1755 }17561757 /**1758 * Mint multiple RFT tokens with one owner1759 * @param signer keyring of signer1760 * @param collectionId ID of collection1761 * @param owner tokens owner1762 * @param tokens array of tokens with properties and pieces1763 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);1764 * @returns array of newly created RFT tokens1765 */1766 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1767 const rawTokens = [];1768 for (const token of tokens) {1769 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};1770 rawTokens.push(raw);1771 }1772 const creationResult = await this.helper.executeExtrinsic(1773 signer,1774 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1775 true,1776 );1777 const collection = this.getCollectionObject(collectionId);1778 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1779 }17801781 /**1782 * Destroys a concrete instance of RFT.1783 * @param signer keyring of signer1784 * @param collectionId ID of collection1785 * @param tokenId ID of token1786 * @param amount number of pieces to be burnt1787 * @example burnToken(aliceKeyring, 10, 5);1788 * @returns ```true``` if the extrinsic is successful, otherwise ```false```1789 */1790 async burnToken(signer: IKeyringPair, collectionId: number, tokenId: number, amount=1n): Promise<boolean> {1791 return await super.burnToken(signer, collectionId, tokenId, amount);1792 }17931794 /**1795 * Destroys a concrete instance of RFT on behalf of the owner.1796 * @param signer keyring of signer1797 * @param collectionId ID of collection1798 * @param tokenId ID of token1799 * @param fromAddressObj address on behalf of which the token will be burnt1800 * @param amount number of pieces to be burnt1801 * @example burnTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, 2n)1802 * @returns ```true``` if extrinsic success, otherwise ```false```1803 */1804 async burnTokenFrom(signer: IKeyringPair, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1805 return await super.burnTokenFrom(signer, collectionId, tokenId, fromAddressObj, amount);1806 }18071808 /**1809 * Set, change, or remove approved address to transfer the ownership of the RFT.1810 *1811 * @param signer keyring of signer1812 * @param collectionId ID of collection1813 * @param tokenId ID of token1814 * @param toAddressObj address to approve1815 * @param amount number of pieces to be approved1816 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5GHoZe9c73RYbVzq..."}, "", 10000n);1817 * @returns true if the token success, otherwise false1818 */1819 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1820 return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);1821 }18221823 /**1824 * Get total number of pieces1825 * @param collectionId ID of collection1826 * @param tokenId ID of token1827 * @example getTokenTotalPieces(10, 5);1828 * @returns number of pieces1829 */1830 async getTokenTotalPieces(collectionId: number, tokenId: number): Promise<bigint> {1831 return (await this.helper.callRpc('api.rpc.unique.totalPieces', [collectionId, tokenId])).unwrap().toBigInt();1832 }18331834 /**1835 * Change number of token pieces. Signer must be the owner of all token pieces.1836 * @param signer keyring of signer1837 * @param collectionId ID of collection1838 * @param tokenId ID of token1839 * @param amount new number of pieces1840 * @example repartitionToken(aliceKeyring, 10, 5, 12345n);1841 * @returns true if the repartion was success, otherwise false1842 */1843 async repartitionToken(signer: TSigner, collectionId: number, tokenId: number, amount: bigint): Promise<boolean> {1844 const currentAmount = await this.getTokenTotalPieces(collectionId, tokenId);1845 const repartitionResult = await this.helper.executeExtrinsic(1846 signer,1847 'api.tx.unique.repartition', [collectionId, tokenId, amount],1848 true,1849 );1850 if(currentAmount < amount) return this.helper.util.findCollectionInEvents(repartitionResult.result.events, collectionId, 'common', 'ItemCreated');1851 return this.helper.util.findCollectionInEvents(repartitionResult.result.events, collectionId, 'common', 'ItemDestroyed');1852 }1853}185418551856class FTGroup extends CollectionGroup {1857 /**1858 * Get collection object1859 * @param collectionId ID of collection1860 * @example getCollectionObject(2);1861 * @returns instance of UniqueFTCollection1862 */1863 getCollectionObject(collectionId: number): UniqueFTCollection {1864 return new UniqueFTCollection(collectionId, this.helper);1865 }18661867 /**1868 * Mint new fungible collection1869 * @param signer keyring of signer1870 * @param collectionOptions Collection options1871 * @param decimalPoints number of token decimals1872 * @example1873 * mintCollection(aliceKeyring, {1874 * name: 'New',1875 * description: 'New collection',1876 * tokenPrefix: 'NEW',1877 * }, 18)1878 * @returns newly created fungible collection1879 */1880 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}, decimalPoints = 0): Promise<UniqueFTCollection> {1881 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1882 if(collectionOptions.tokenPropertyPermissions) throw Error('Fungible collections has no tokenPropertyPermissions');1883 collectionOptions.mode = {fungible: decimalPoints};1884 for (const key of ['name', 'description', 'tokenPrefix']) {1885 if (typeof collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] === 'string') collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] = this.helper.util.str2vec(collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] as string);1886 }1887 const creationResult = await this.helper.executeExtrinsic(1888 signer,1889 'api.tx.unique.createCollectionEx', [collectionOptions],1890 true,1891 );1892 return this.getCollectionObject(this.helper.util.extractCollectionIdFromCreationResult(creationResult));1893 }18941895 /**1896 * Mint tokens1897 * @param signer keyring of signer1898 * @param collectionId ID of collection1899 * @param owner address owner of new tokens1900 * @param amount amount of tokens to be meanted1901 * @example mintTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq"}, 1000n);1902 * @returns ```true``` if extrinsic success, otherwise ```false```1903 */1904 async mintTokens(signer: TSigner, collectionId: number, amount: bigint, owner: ICrossAccountId | string): Promise<boolean> {1905 const creationResult = await this.helper.executeExtrinsic(1906 signer,1907 'api.tx.unique.createItem', [collectionId, (typeof owner === 'string') ? {Substrate: owner} : owner, {1908 fungible: {1909 value: amount,1910 },1911 }],1912 true, // `Unable to mint fungible tokens for ${label}`,1913 );1914 return this.helper.util.findCollectionInEvents(creationResult.result.events, collectionId, 'common', 'ItemCreated');1915 }19161917 /**1918 * Mint multiple Fungible tokens with one owner1919 * @param signer keyring of signer1920 * @param collectionId ID of collection1921 * @param owner tokens owner1922 * @param tokens array of tokens with properties and pieces1923 * @returns ```true``` if extrinsic success, otherwise ```false```1924 */1925 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, tokens: {value: bigint}[], owner: ICrossAccountId): Promise<boolean> {1926 const rawTokens = [];1927 for (const token of tokens) {1928 const raw = {Fungible: {Value: token.value}};1929 rawTokens.push(raw);1930 }1931 const creationResult = await this.helper.executeExtrinsic(1932 signer,1933 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1934 true,1935 );1936 return this.helper.util.findCollectionInEvents(creationResult.result.events, collectionId, 'common', 'ItemCreated');1937 }19381939 /**1940 * Get the top 10 owners with the largest balance for the Fungible collection1941 * @param collectionId ID of collection1942 * @example getTop10Owners(10);1943 * @returns array of ```ICrossAccountId```1944 */1945 async getTop10Owners(collectionId: number): Promise<CrossAccountId[]> {1946 return (await this.helper.callRpc('api.rpc.unique.tokenOwners', [collectionId, 0])).toJSON().map(CrossAccountId.fromLowerCaseKeys);1947 }19481949 /**1950 * Get account balance1951 * @param collectionId ID of collection1952 * @param addressObj address of owner1953 * @example getBalance(10, {Substrate: "5GHoZe9c73RYbVzq..."})1954 * @returns amount of fungible tokens owned by address1955 */1956 async getBalance(collectionId: number, addressObj: ICrossAccountId): Promise<bigint> {1957 return (await this.helper.callRpc('api.rpc.unique.balance', [collectionId, addressObj, 0])).toBigInt();1958 }19591960 /**1961 * Transfer tokens to address1962 * @param signer keyring of signer1963 * @param collectionId ID of collection1964 * @param toAddressObj address recipient1965 * @param amount amount of tokens to be sent1966 * @example transfer(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n);1967 * @returns ```true``` if extrinsic success, otherwise ```false```1968 */1969 async transfer(signer: TSigner, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {1970 return await super.transferToken(signer, collectionId, 0, toAddressObj, amount);1971 }19721973 /**1974 * Transfer some tokens on behalf of the owner.1975 * @param signer keyring of signer1976 * @param collectionId ID of collection1977 * @param fromAddressObj address on behalf of which tokens will be sent1978 * @param toAddressObj address where token to be sent1979 * @param amount number of tokens to be sent1980 * @example transferFrom(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, {Substrate: "5DfhbVfww7ThF8q6f3ij..."}, 10000n);1981 * @returns ```true``` if extrinsic success, otherwise ```false```1982 */1983 async transferFrom(signer: TSigner, collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {1984 return await super.transferTokenFrom(signer, collectionId, 0, fromAddressObj, toAddressObj, amount);1985 }19861987 /**1988 * Destroy some amount of tokens1989 * @param signer keyring of signer1990 * @param collectionId ID of collection1991 * @param amount amount of tokens to be destroyed1992 * @example burnTokens(aliceKeyring, 10, 1000n);1993 * @returns ```true``` if extrinsic success, otherwise ```false```1994 */1995 async burnTokens(signer: IKeyringPair, collectionId: number, amount=1n): Promise<boolean> {1996 return await super.burnToken(signer, collectionId, 0, amount);1997 }19981999 /**2000 * Burn some tokens on behalf of the owner.2001 * @param signer keyring of signer2002 * @param collectionId ID of collection2003 * @param fromAddressObj address on behalf of which tokens will be burnt2004 * @param amount amount of tokens to be burnt2005 * @example burnTokensFrom(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n);2006 * @returns ```true``` if extrinsic success, otherwise ```false```2007 */2008 async burnTokensFrom(signer: IKeyringPair, collectionId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {2009 return await super.burnTokenFrom(signer, collectionId, 0, fromAddressObj, amount);2010 }20112012 /**2013 * Get total collection supply2014 * @param collectionId2015 * @returns2016 */2017 async getTotalPieces(collectionId: number): Promise<bigint> {2018 return (await this.helper.callRpc('api.rpc.unique.totalPieces', [collectionId, 0])).unwrap().toBigInt();2019 }20202021 /**2022 * Set, change, or remove approved address to transfer tokens.2023 *2024 * @param signer keyring of signer2025 * @param collectionId ID of collection2026 * @param toAddressObj address to be approved2027 * @param amount amount of tokens to be approved2028 * @example approveTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n)2029 * @returns ```true``` if extrinsic success, otherwise ```false```2030 */2031 async approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {2032 return super.approveToken(signer, collectionId, 0, toAddressObj, amount);2033 }20342035 /**2036 * Get amount of fungible tokens approved to transfer2037 * @param collectionId ID of collection2038 * @param fromAddressObj owner of tokens2039 * @param toAddressObj the address approved for the transfer of tokens on behalf of the owner2040 * @returns number of tokens approved for the transfer2041 */2042 async getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2043 return super.getTokenApprovedPieces(collectionId, 0, toAddressObj, fromAddressObj);2044 }2045}204620472048class ChainGroup extends HelperGroup<ChainHelperBase> {2049 /**2050 * Get system properties of a chain2051 * @example getChainProperties();2052 * @returns ss58Format, token decimals, and token symbol2053 */2054 getChainProperties(): IChainProperties {2055 const properties = (this.helper.getApi() as any).registry.getChainProperties().toJSON();2056 return {2057 ss58Format: properties.ss58Format.toJSON(),2058 tokenDecimals: properties.tokenDecimals.toJSON(),2059 tokenSymbol: properties.tokenSymbol.toJSON(),2060 };2061 }20622063 /**2064 * Get chain header2065 * @example getLatestBlockNumber();2066 * @returns the number of the last block2067 */2068 async getLatestBlockNumber(): Promise<number> {2069 return (await this.helper.callRpc('api.rpc.chain.getHeader')).number.toNumber();2070 }20712072 /**2073 * Get block hash by block number2074 * @param blockNumber number of block2075 * @example getBlockHashByNumber(12345);2076 * @returns hash of a block2077 */2078 async getBlockHashByNumber(blockNumber: number): Promise<string | null> {2079 const blockHash = (await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])).toJSON();2080 if(blockHash === '0x0000000000000000000000000000000000000000000000000000000000000000') return null;2081 return blockHash;2082 }20832084 // TODO add docs2085 async getBlock(blockHashOrNumber: string | number): Promise<IBlock | null> {2086 const blockHash = typeof blockHashOrNumber === 'string' ? blockHashOrNumber : await this.getBlockHashByNumber(blockHashOrNumber);2087 if (!blockHash) return null;2088 return (await this.helper.callRpc('api.rpc.chain.getBlock', [blockHash])).toHuman().block;2089 }20902091 /**2092 * Get account nonce2093 * @param address substrate address2094 * @example getNonce("5GrwvaEF5zXb26Fz...");2095 * @returns number, account's nonce2096 */2097 async getNonce(address: TSubstrateAccount): Promise<number> {2098 return (await this.helper.callRpc('api.query.system.account', [address])).nonce.toNumber();2099 }2100}21012102class SubstrateBalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2103 /**2104 * Get substrate address balance2105 * @param address substrate address2106 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2107 * @returns amount of tokens on address2108 */2109 async getSubstrate(address: TSubstrateAccount): Promise<bigint> {2110 return (await this.helper.callRpc('api.query.system.account', [address])).data.free.toBigInt();2111 }21122113 /**2114 * Transfer tokens to substrate address2115 * @param signer keyring of signer2116 * @param address substrate address of a recipient2117 * @param amount amount of tokens to be transfered2118 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2119 * @returns ```true``` if extrinsic success, otherwise ```false```2120 */2121 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2122 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true/*, `Unable to transfer balance from ${this.helper.getSignerAddress(signer)} to ${address}`*/);21232124 let transfer = {from: null, to: null, amount: 0n} as any;2125 result.result.events.forEach(({event: {data, method, section}}) => {2126 if ((section === 'balances') && (method === 'Transfer')) {2127 transfer = {2128 from: this.helper.address.normalizeSubstrate(data[0]),2129 to: this.helper.address.normalizeSubstrate(data[1]),2130 amount: BigInt(data[2]),2131 };2132 }2133 });2134 const isSuccess = this.helper.address.normalizeSubstrate(typeof signer === 'string' ? signer : signer.address) === transfer.from 2135 && this.helper.address.normalizeSubstrate(address) === transfer.to 2136 && BigInt(amount) === transfer.amount;2137 return isSuccess;2138 }21392140 /**2141 * Get full substrate balance including free, miscFrozen, feeFrozen, and reserved2142 * @param address substrate address2143 * @returns2144 */2145 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2146 const accountInfo = (await this.helper.callRpc('api.query.system.account', [address])).data;2147 return {free: accountInfo.free.toBigInt(), miscFrozen: accountInfo.miscFrozen.toBigInt(), feeFrozen: accountInfo.feeFrozen.toBigInt(), reserved: accountInfo.reserved.toBigInt()};2148 }2149}21502151class EthereumBalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2152 /**2153 * Get ethereum address balance2154 * @param address ethereum address2155 * @example getEthereum("0x9F0583DbB855d...")2156 * @returns amount of tokens on address2157 */2158 async getEthereum(address: TEthereumAccount): Promise<bigint> {2159 return (await this.helper.callRpc('api.rpc.eth.getBalance', [address])).toBigInt();2160 }21612162 /**2163 * Transfer tokens to address2164 * @param signer keyring of signer2165 * @param address Ethereum address of a recipient2166 * @param amount amount of tokens to be transfered2167 * @example transferToEthereum(alithKeyring, "0x9F0583DbB855d...", 100_000_000_000n);2168 * @returns ```true``` if extrinsic success, otherwise ```false```2169 */2170 async transferToEthereum(signer: TSigner, address: TEthereumAccount, amount: bigint | string): Promise<boolean> {2171 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true);21722173 let transfer = {from: null, to: null, amount: 0n} as any;2174 result.result.events.forEach(({event: {data, method, section}}) => {2175 if ((section === 'balances') && (method === 'Transfer')) {2176 transfer = {2177 from: data[0].toString(),2178 to: data[1].toString(),2179 amount: BigInt(data[2]),2180 };2181 }2182 });2183 const isSuccess = (typeof signer === 'string' ? signer : signer.address) === transfer.from 2184 && address === transfer.to 2185 && BigInt(amount) === transfer.amount;2186 return isSuccess;2187 }2188}21892190class BalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2191 subBalanceGroup: SubstrateBalanceGroup<T>;2192 ethBalanceGroup: EthereumBalanceGroup<T>;21932194 constructor(helper: T) {2195 super(helper);2196 this.subBalanceGroup = new SubstrateBalanceGroup(helper);2197 this.ethBalanceGroup = new EthereumBalanceGroup(helper);2198 }21992200 getCollectionCreationPrice(): bigint {2201 return 2n * this.getOneTokenNominal();2202 }2203 /**2204 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).2205 * @example getOneTokenNominal()2206 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.2207 */2208 getOneTokenNominal(): bigint {2209 const chainProperties = this.helper.chain.getChainProperties();2210 return 10n ** BigInt((chainProperties.tokenDecimals || [18])[0]);2211 }22122213 /**2214 * Get substrate address balance2215 * @param address substrate address2216 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2217 * @returns amount of tokens on address2218 */2219 async getSubstrate(address: TSubstrateAccount): Promise<bigint> {2220 return this.subBalanceGroup.getSubstrate(address);2221 }22222223 /**2224 * Get full substrate balance including free, miscFrozen, feeFrozen, and reserved2225 * @param address substrate address2226 * @returns2227 */2228 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2229 return this.subBalanceGroup.getSubstrateFull(address);2230 }22312232 /**2233 * Get ethereum address balance2234 * @param address ethereum address2235 * @example getEthereum("0x9F0583DbB855d...")2236 * @returns amount of tokens on address2237 */2238 async getEthereum(address: TEthereumAccount): Promise<bigint> {2239 return this.ethBalanceGroup.getEthereum(address);2240 }22412242 /**2243 * Transfer tokens to substrate address2244 * @param signer keyring of signer2245 * @param address substrate address of a recipient2246 * @param amount amount of tokens to be transfered2247 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2248 * @returns ```true``` if extrinsic success, otherwise ```false```2249 */2250 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2251 return this.subBalanceGroup.transferToSubstrate(signer, address, amount);2252 }2253}22542255class AddressGroup extends HelperGroup<ChainHelperBase> {2256 /**2257 * Normalizes the address to the specified ss58 format, by default ```42```.2258 * @param address substrate address2259 * @param ss58Format format for address conversion, by default ```42```2260 * @example normalizeSubstrate("unjKJQJrRd238pkUZZvzDQrfKuM39zBSnQ5zjAGAGcdRhaJTx") // returns 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY2261 * @returns substrate address converted to normalized (i.e., starting with 5) or specified explicitly representation2262 */2263 normalizeSubstrate(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {2264 return CrossAccountId.normalizeSubstrateAddress(address, ss58Format);2265 }22662267 /**2268 * Get address in the connected chain format2269 * @param address substrate address2270 * @example normalizeSubstrateToChainFormat("5GrwvaEF5zXb26Fz...") // returns unjKJQJrRd238pkUZZ... for Unique Network2271 * @returns address in chain format2272 */2273 normalizeSubstrateToChainFormat(address: TSubstrateAccount): TSubstrateAccount {2274 return this.normalizeSubstrate(address, this.helper.chain.getChainProperties().ss58Format);2275 }22762277 /**2278 * Get substrate mirror of an ethereum address2279 * @param ethAddress ethereum address2280 * @param toChainFormat false for normalized account2281 * @example ethToSubstrate('0x9F0583DbB855d...')2282 * @returns substrate mirror of a provided ethereum address2283 */2284 ethToSubstrate(ethAddress: TEthereumAccount, toChainFormat=false): TSubstrateAccount {2285 return CrossAccountId.translateEthToSub(ethAddress, toChainFormat ? this.helper.chain.getChainProperties().ss58Format : undefined);2286 }22872288 /**2289 * Get ethereum mirror of a substrate address2290 * @param subAddress substrate account2291 * @example substrateToEth("5DnSF6RRjwteE3BrC...")2292 * @returns ethereum mirror of a provided substrate address2293 */2294 substrateToEth(subAddress: TSubstrateAccount): TEthereumAccount {2295 return CrossAccountId.translateSubToEth(subAddress);2296 }22972298 paraSiblingSovereignAccount(paraid: number) {2299 // We are getting a *sibling* parachain sovereign account,2300 // so we need a sibling prefix: encoded(b"sibl") == 0x7369626c2301 const siblingPrefix = '0x7369626c';23022303 const encodedParaId = this.helper.getApi().createType('u32', paraid).toHex(true).substring(2);2304 const suffix = '000000000000000000000000000000000000000000000000';23052306 return siblingPrefix + encodedParaId + suffix;2307 }2308}23092310class StakingGroup extends HelperGroup<UniqueHelper> {2311 /**2312 * Stake tokens for App Promotion2313 * @param signer keyring of signer2314 * @param amountToStake amount of tokens to stake2315 * @param label extra label for log2316 * @returns2317 */2318 async stake(signer: TSigner, amountToStake: bigint, label?: string): Promise<boolean> {2319 if(typeof label === 'undefined') label = `${signer.address} amount: ${amountToStake}`;2320 const _stakeResult = await this.helper.executeExtrinsic(2321 signer, 'api.tx.appPromotion.stake',2322 [amountToStake], true,2323 );2324 // TODO extract info from stakeResult2325 return true;2326 }23272328 /**2329 * Unstake tokens for App Promotion2330 * @param signer keyring of signer2331 * @param amountToUnstake amount of tokens to unstake2332 * @param label extra label for log2333 * @returns block number where balances will be unlocked2334 */2335 async unstake(signer: TSigner, label?: string): Promise<number> {2336 if(typeof label === 'undefined') label = `${signer.address}`;2337 const _unstakeResult = await this.helper.executeExtrinsic(2338 signer, 'api.tx.appPromotion.unstake',2339 [], true,2340 );2341 // TODO extract block number fron events2342 return 1;2343 }23442345 /**2346 * Get total staked amount for address2347 * @param address substrate or ethereum address2348 * @returns total staked amount2349 */2350 async getTotalStaked(address?: ICrossAccountId): Promise<bigint> {2351 if (address) return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked', [address])).toBigInt();2352 return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked')).toBigInt();2353 }23542355 /**2356 * Get total staked per block2357 * @param address substrate or ethereum address2358 * @returns array of stakes. `block` – the number of the block in which the stake was made. `amount` - the number of tokens staked in the block2359 */2360 async getTotalStakedPerBlock(address: ICrossAccountId): Promise<IStakingInfo[]> {2361 const rawTotalStakerdPerBlock = await this.helper.callRpc('api.rpc.appPromotion.totalStakedPerBlock', [address]);2362 return rawTotalStakerdPerBlock.map(([block, amount]: any[]) => {2363 return { 2364 block: block.toBigInt(),2365 amount: amount.toBigInt(),2366 };2367 });2368 }23692370 /**2371 * Get total pending unstake amount for address2372 * @param address substrate or ethereum address2373 * @returns total pending unstake amount2374 */2375 async getPendingUnstake(address: ICrossAccountId): Promise<bigint> {2376 return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstake', [address])).toBigInt();2377 }23782379 /**2380 * Get pending unstake amount per block for address2381 * @param address substrate or ethereum address2382 * @returns array of pending stakes. `block` – the number of the block in which the unstake was made. `amount` - the number of tokens unstaked in the block2383 */2384 async getPendingUnstakePerBlock(address: ICrossAccountId): Promise<IStakingInfo[]> {2385 const rawUnstakedPerBlock = await this.helper.callRpc('api.rpc.appPromotion.pendingUnstakePerBlock', [address]);2386 const result = rawUnstakedPerBlock.map(([block, amount]: any[]) => {2387 return {2388 block: block.toBigInt(),2389 amount: amount.toBigInt(),2390 };2391 });2392 return result;2393 }2394}23952396class SchedulerGroup extends HelperGroup<UniqueHelper> {2397 constructor(helper: UniqueHelper) {2398 super(helper);2399 }24002401 async cancelScheduled(signer: TSigner, scheduledId: string) {2402 return this.helper.executeExtrinsic(2403 signer,2404 'api.tx.scheduler.cancelNamed',2405 [scheduledId],2406 true,2407 );2408 }24092410 async changePriority(signer: TSigner, scheduledId: string, priority: number) {2411 return this.helper.executeExtrinsic(2412 signer,2413 'api.tx.scheduler.changeNamedPriority',2414 [scheduledId, priority],2415 true,2416 );2417 }24182419 scheduleAt<T extends UniqueHelper>(2420 scheduledId: string,2421 executionBlockNumber: number,2422 options: ISchedulerOptions = {},2423 ) {2424 return this.schedule<T>('scheduleNamed', scheduledId, executionBlockNumber, options);2425 }24262427 scheduleAfter<T extends UniqueHelper>(2428 scheduledId: string,2429 blocksBeforeExecution: number,2430 options: ISchedulerOptions = {},2431 ) {2432 return this.schedule<T>('scheduleNamedAfter', scheduledId, blocksBeforeExecution, options);2433 }24342435 schedule<T extends UniqueHelper>(2436 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',2437 scheduledId: string,2438 blocksNum: number,2439 options: ISchedulerOptions = {},2440 ) {2441 // eslint-disable-next-line @typescript-eslint/naming-convention2442 const ScheduledHelperType = ScheduledUniqueHelper(this.helper.helperBase);2443 return this.helper.clone(ScheduledHelperType, {2444 scheduleFn,2445 scheduledId,2446 blocksNum,2447 options,2448 }) as T;2449 }2450}24512452class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {2453 async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {2454 await this.helper.executeExtrinsic(2455 signer,2456 'api.tx.foreignAssets.registerForeignAsset',2457 [ownerAddress, location, metadata],2458 true,2459 );2460 }24612462 async update(signer: TSigner, foreignAssetId: number, location: any, metadata: IForeignAssetMetadata) {2463 await this.helper.executeExtrinsic(2464 signer,2465 'api.tx.foreignAssets.updateForeignAsset',2466 [foreignAssetId, location, metadata],2467 true,2468 );2469 }2470}24712472class XcmGroup<T extends ChainHelperBase> extends HelperGroup<T> {2473 palletName: string;24742475 constructor(helper: T, palletName: string) {2476 super(helper);24772478 this.palletName = palletName;2479 }24802481 async limitedReserveTransferAssets(signer: TSigner, destination: any, beneficiary: any, assets: any, feeAssetItem: number, weightLimit: number) {2482 await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.limitedReserveTransferAssets`, [destination, beneficiary, assets, feeAssetItem, {Limited: weightLimit}], true);2483 }2484}24852486class XTokensGroup<T extends ChainHelperBase> extends HelperGroup<T> {2487 async transfer(signer: TSigner, currencyId: any, amount: bigint, destination: any, destWeight: number) {2488 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transfer', [currencyId, amount, destination, destWeight], true);2489 }24902491 async transferMultiasset(signer: TSigner, asset: any, destination: any, destWeight: number) {2492 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transferMultiasset', [asset, destination, destWeight], true);2493 }24942495 async transferMulticurrencies(signer: TSigner, currencies: any[], feeItem: number, destLocation: any, destWeight: number) {2496 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transferMulticurrencies', [currencies, feeItem, destLocation, destWeight], true);2497 }2498}24992500class TokensGroup<T extends ChainHelperBase> extends HelperGroup<T> {2501 async accounts(address: string, currencyId: any) {2502 const {free} = (await this.helper.callRpc('api.query.tokens.accounts', [address, currencyId])).toJSON() as any;2503 return BigInt(free);2504 }2505}25062507class AssetsGroup<T extends ChainHelperBase> extends HelperGroup<T> {2508 async create(signer: TSigner, assetId: number, admin: string, minimalBalance: bigint) {2509 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);2510 }25112512 async setMetadata(signer: TSigner, assetId: number, name: string, symbol: string, decimals: number) {2513 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);2514 }25152516 async mint(signer: TSigner, assetId: number, beneficiary: string, amount: bigint) {2517 await this.helper.executeExtrinsic(signer, 'api.tx.assets.mint', [assetId, beneficiary, amount], true);2518 }25192520 async account(assetId: string | number, address: string) {2521 const accountAsset = (2522 await this.helper.callRpc('api.query.assets.account', [assetId, address])2523 ).toJSON()! as any;25242525 if (accountAsset !== null) {2526 return BigInt(accountAsset['balance']);2527 } else {2528 return null;2529 }2530 }2531}25322533class AcalaAssetRegistryGroup extends HelperGroup<AcalaHelper> {2534 async registerForeignAsset(signer: TSigner, destination: any, metadata: AcalaAssetMetadata) {2535 await this.helper.executeExtrinsic(signer, 'api.tx.assetRegistry.registerForeignAsset', [destination, metadata], true);2536 }2537}25382539class MoonbeamAssetManagerGroup extends HelperGroup<MoonbeamHelper> {2540 makeRegisterForeignAssetProposal(assetInfo: MoonbeamAssetInfo) {2541 const apiPrefix = 'api.tx.assetManager.';25422543 const registerTx = this.helper.constructApiCall(2544 apiPrefix + 'registerForeignAsset',2545 [assetInfo.location, assetInfo.metadata, assetInfo.existentialDeposit, assetInfo.isSufficient],2546 );25472548 const setUnitsTx = this.helper.constructApiCall(2549 apiPrefix + 'setAssetUnitsPerSecond',2550 [assetInfo.location, assetInfo.unitsPerSecond, assetInfo.numAssetsWeightHint],2551 );25522553 const batchCall = this.helper.getApi().tx.utility.batchAll([registerTx, setUnitsTx]);2554 const encodedProposal = batchCall?.method.toHex() || '';2555 return encodedProposal;2556 }25572558 async assetTypeId(location: any) {2559 return await this.helper.callRpc('api.query.assetManager.assetTypeId', [location]);2560 }2561}25622563class MoonbeamDemocracyGroup extends HelperGroup<MoonbeamHelper> {2564 async notePreimage(signer: TSigner, encodedProposal: string) {2565 await this.helper.executeExtrinsic(signer, 'api.tx.democracy.notePreimage', [encodedProposal], true);2566 }25672568 externalProposeMajority(proposalHash: string) {2569 return this.helper.constructApiCall('api.tx.democracy.externalProposeMajority', [proposalHash]);2570 }25712572 fastTrack(proposalHash: string, votingPeriod: number, delayPeriod: number) {2573 return this.helper.constructApiCall('api.tx.democracy.fastTrack', [proposalHash, votingPeriod, delayPeriod]);2574 }25752576 async referendumVote(signer: TSigner, referendumIndex: number, accountVote: DemocracyStandardAccountVote) {2577 await this.helper.executeExtrinsic(signer, 'api.tx.democracy.vote', [referendumIndex, {Standard: accountVote}], true);2578 }2579}25802581class MoonbeamCollectiveGroup extends HelperGroup<MoonbeamHelper> {2582 collective: string;25832584 constructor(helper: MoonbeamHelper, collective: string) {2585 super(helper);25862587 this.collective = collective;2588 }25892590 async propose(signer: TSigner, threshold: number, proposalHash: string, lengthBound: number) {2591 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.propose`, [threshold, proposalHash, lengthBound], true);2592 }25932594 async vote(signer: TSigner, proposalHash: string, proposalIndex: number, approve: boolean) {2595 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.vote`, [proposalHash, proposalIndex, approve], true);2596 }25972598 async close(signer: TSigner, proposalHash: string, proposalIndex: number, weightBound: number, lengthBound: number) {2599 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.close`, [proposalHash, proposalIndex, weightBound, lengthBound], true);2600 }26012602 async proposalCount() {2603 return Number(await this.helper.callRpc(`api.query.${this.collective}.proposalCount`, []));2604 }2605}26062607export type ChainHelperBaseConstructor = new(...args: any[]) => ChainHelperBase;2608export type UniqueHelperConstructor = new(...args: any[]) => UniqueHelper;26092610export class UniqueHelper extends ChainHelperBase {2611 balance: BalanceGroup<UniqueHelper>;2612 collection: CollectionGroup;2613 nft: NFTGroup;2614 rft: RFTGroup;2615 ft: FTGroup;2616 staking: StakingGroup;2617 scheduler: SchedulerGroup;2618 foreignAssets: ForeignAssetsGroup;2619 xcm: XcmGroup<UniqueHelper>;2620 xTokens: XTokensGroup<UniqueHelper>;2621 tokens: TokensGroup<UniqueHelper>;26222623 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2624 super(logger, options.helperBase ?? UniqueHelper);26252626 this.balance = new BalanceGroup(this);2627 this.collection = new CollectionGroup(this);2628 this.nft = new NFTGroup(this);2629 this.rft = new RFTGroup(this);2630 this.ft = new FTGroup(this);2631 this.staking = new StakingGroup(this);2632 this.scheduler = new SchedulerGroup(this);2633 this.foreignAssets = new ForeignAssetsGroup(this);2634 this.xcm = new XcmGroup(this, 'polkadotXcm');2635 this.xTokens = new XTokensGroup(this);2636 this.tokens = new TokensGroup(this);2637 }26382639 getSudo<T extends UniqueHelper>() {2640 // eslint-disable-next-line @typescript-eslint/naming-convention2641 const SudoHelperType = SudoHelper(this.helperBase);2642 return this.clone(SudoHelperType) as T;2643 }2644}26452646export class XcmChainHelper extends ChainHelperBase {2647 async connect(wsEndpoint: string, _listeners?: any): Promise<void> {2648 const wsProvider = new WsProvider(wsEndpoint);2649 this.api = new ApiPromise({2650 provider: wsProvider,2651 });2652 await this.api.isReadyOrError;2653 this.network = await UniqueHelper.detectNetwork(this.api);2654 }2655}26562657export class RelayHelper extends XcmChainHelper {2658 xcm: XcmGroup<RelayHelper>;26592660 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2661 super(logger, options.helperBase ?? RelayHelper);26622663 this.xcm = new XcmGroup(this, 'xcmPallet');2664 }2665}26662667export class WestmintHelper extends XcmChainHelper {2668 balance: SubstrateBalanceGroup<WestmintHelper>;2669 xcm: XcmGroup<WestmintHelper>;2670 assets: AssetsGroup<WestmintHelper>;2671 xTokens: XTokensGroup<WestmintHelper>;26722673 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2674 super(logger, options.helperBase ?? WestmintHelper);26752676 this.balance = new SubstrateBalanceGroup(this);2677 this.xcm = new XcmGroup(this, 'polkadotXcm');2678 this.assets = new AssetsGroup(this);2679 this.xTokens = new XTokensGroup(this);2680 }2681}26822683export class MoonbeamHelper extends XcmChainHelper {2684 balance: EthereumBalanceGroup<MoonbeamHelper>;2685 assetManager: MoonbeamAssetManagerGroup;2686 assets: AssetsGroup<MoonbeamHelper>;2687 xTokens: XTokensGroup<MoonbeamHelper>;2688 democracy: MoonbeamDemocracyGroup;2689 collective: {2690 council: MoonbeamCollectiveGroup,2691 techCommittee: MoonbeamCollectiveGroup,2692 };26932694 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2695 super(logger, options.helperBase ?? MoonbeamHelper);26962697 this.balance = new EthereumBalanceGroup(this);2698 this.assetManager = new MoonbeamAssetManagerGroup(this);2699 this.assets = new AssetsGroup(this);2700 this.xTokens = new XTokensGroup(this);2701 this.democracy = new MoonbeamDemocracyGroup(this);2702 this.collective = {2703 council: new MoonbeamCollectiveGroup(this, 'councilCollective'),2704 techCommittee: new MoonbeamCollectiveGroup(this, 'techCommitteeCollective'),2705 };2706 }2707}27082709export class AcalaHelper extends XcmChainHelper {2710 balance: SubstrateBalanceGroup<AcalaHelper>;2711 assetRegistry: AcalaAssetRegistryGroup;2712 xTokens: XTokensGroup<AcalaHelper>;2713 tokens: TokensGroup<AcalaHelper>;27142715 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2716 super(logger, options.helperBase ?? AcalaHelper);27172718 this.balance = new SubstrateBalanceGroup(this);2719 this.assetRegistry = new AcalaAssetRegistryGroup(this);2720 this.xTokens = new XTokensGroup(this);2721 this.tokens = new TokensGroup(this);2722 }27232724 getSudo<T extends AcalaHelper>() {2725 // eslint-disable-next-line @typescript-eslint/naming-convention2726 const SudoHelperType = SudoHelper(this.helperBase);2727 return this.clone(SudoHelperType) as T;2728 }2729}27302731// eslint-disable-next-line @typescript-eslint/naming-convention2732function ScheduledUniqueHelper<T extends UniqueHelperConstructor>(Base: T) {2733 return class extends Base {2734 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter';2735 scheduledId: string;2736 blocksNum: number;2737 options: ISchedulerOptions;27382739 constructor(...args: any[]) {2740 const logger = args[0] as ILogger;2741 const options = args[1] as {2742 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',2743 scheduledId: string,2744 blocksNum: number,2745 options: ISchedulerOptions2746 };27472748 super(logger);27492750 this.scheduleFn = options.scheduleFn;2751 this.scheduledId = options.scheduledId;2752 this.blocksNum = options.blocksNum;2753 this.options = options.options;2754 }27552756 executeExtrinsic(sender: IKeyringPair, scheduledExtrinsic: string, scheduledParams: any[], expectSuccess?: boolean): Promise<ITransactionResult> {2757 const scheduledTx = this.constructApiCall(scheduledExtrinsic, scheduledParams);2758 const extrinsic = 'api.tx.scheduler.' + this.scheduleFn;27592760 return super.executeExtrinsic(2761 sender,2762 extrinsic,2763 [2764 this.scheduledId,2765 this.blocksNum,2766 this.options.periodic ? [this.options.periodic.period, this.options.periodic.repetitions] : null,2767 this.options.priority ?? null,2768 {Value: scheduledTx},2769 ],2770 expectSuccess,2771 );2772 }2773 };2774}27752776// eslint-disable-next-line @typescript-eslint/naming-convention2777function SudoHelper<T extends ChainHelperBaseConstructor>(Base: T) {2778 return class extends Base {2779 constructor(...args: any[]) {2780 super(...args);2781 }27822783 executeExtrinsic (2784 sender: IKeyringPair,2785 extrinsic: string,2786 params: any[],2787 expectSuccess?: boolean,2788 ): Promise<ITransactionResult> {2789 const call = this.constructApiCall(extrinsic, params);27902791 return super.executeExtrinsic(2792 sender,2793 'api.tx.sudo.sudo',2794 [call],2795 expectSuccess,2796 );2797 }2798 };2799}28002801export class UniqueBaseCollection {2802 helper: UniqueHelper;2803 collectionId: number;28042805 constructor(collectionId: number, uniqueHelper: UniqueHelper) {2806 this.collectionId = collectionId;2807 this.helper = uniqueHelper;2808 }28092810 async getData() {2811 return await this.helper.collection.getData(this.collectionId);2812 }28132814 async getLastTokenId() {2815 return await this.helper.collection.getLastTokenId(this.collectionId);2816 }28172818 async doesTokenExist(tokenId: number) {2819 return await this.helper.collection.doesTokenExist(this.collectionId, tokenId);2820 }28212822 async getAdmins() {2823 return await this.helper.collection.getAdmins(this.collectionId);2824 }28252826 async getAllowList() {2827 return await this.helper.collection.getAllowList(this.collectionId);2828 }28292830 async getEffectiveLimits() {2831 return await this.helper.collection.getEffectiveLimits(this.collectionId);2832 }28332834 async getProperties(propertyKeys?: string[] | null) {2835 return await this.helper.collection.getProperties(this.collectionId, propertyKeys);2836 }28372838 async getTokenNextSponsored(tokenId: number, addressObj: ICrossAccountId) {2839 return await this.helper.collection.getTokenNextSponsored(this.collectionId, tokenId, addressObj);2840 }28412842 async setSponsor(signer: TSigner, sponsorAddress: TSubstrateAccount) {2843 return await this.helper.collection.setSponsor(signer, this.collectionId, sponsorAddress);2844 }28452846 async confirmSponsorship(signer: TSigner) {2847 return await this.helper.collection.confirmSponsorship(signer, this.collectionId);2848 }28492850 async removeSponsor(signer: TSigner) {2851 return await this.helper.collection.removeSponsor(signer, this.collectionId);2852 }28532854 async setLimits(signer: TSigner, limits: ICollectionLimits) {2855 return await this.helper.collection.setLimits(signer, this.collectionId, limits);2856 }28572858 async changeOwner(signer: TSigner, ownerAddress: TSubstrateAccount) {2859 return await this.helper.collection.changeOwner(signer, this.collectionId, ownerAddress);2860 }28612862 async addAdmin(signer: TSigner, adminAddressObj: ICrossAccountId) {2863 return await this.helper.collection.addAdmin(signer, this.collectionId, adminAddressObj);2864 }28652866 async addToAllowList(signer: TSigner, addressObj: ICrossAccountId) {2867 return await this.helper.collection.addToAllowList(signer, this.collectionId, addressObj);2868 }28692870 async removeFromAllowList(signer: TSigner, addressObj: ICrossAccountId) {2871 return await this.helper.collection.removeFromAllowList(signer, this.collectionId, addressObj);2872 }28732874 async removeAdmin(signer: TSigner, adminAddressObj: ICrossAccountId) {2875 return await this.helper.collection.removeAdmin(signer, this.collectionId, adminAddressObj);2876 }28772878 async setProperties(signer: TSigner, properties: IProperty[]) {2879 return await this.helper.collection.setProperties(signer, this.collectionId, properties);2880 }28812882 async deleteProperties(signer: TSigner, propertyKeys: string[]) {2883 return await this.helper.collection.deleteProperties(signer, this.collectionId, propertyKeys);2884 }28852886 async setPermissions(signer: TSigner, permissions: ICollectionPermissions) {2887 return await this.helper.collection.setPermissions(signer, this.collectionId, permissions);2888 }28892890 async enableNesting(signer: TSigner, permissions: INestingPermissions) {2891 return await this.helper.collection.enableNesting(signer, this.collectionId, permissions);2892 }28932894 async disableNesting(signer: TSigner) {2895 return await this.helper.collection.disableNesting(signer, this.collectionId);2896 }28972898 async burn(signer: TSigner) {2899 return await this.helper.collection.burn(signer, this.collectionId);2900 }29012902 scheduleAt<T extends UniqueHelper>(2903 scheduledId: string,2904 executionBlockNumber: number,2905 options: ISchedulerOptions = {},2906 ) {2907 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);2908 return new UniqueBaseCollection(this.collectionId, scheduledHelper);2909 }29102911 scheduleAfter<T extends UniqueHelper>(2912 scheduledId: string,2913 blocksBeforeExecution: number,2914 options: ISchedulerOptions = {},2915 ) {2916 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);2917 return new UniqueBaseCollection(this.collectionId, scheduledHelper);2918 }29192920 getSudo<T extends UniqueHelper>() {2921 return new UniqueBaseCollection(this.collectionId, this.helper.getSudo<T>());2922 }2923}292429252926export class UniqueNFTCollection extends UniqueBaseCollection {2927 getTokenObject(tokenId: number) {2928 return new UniqueNFToken(tokenId, this);2929 }29302931 async getTokensByAddress(addressObj: ICrossAccountId) {2932 return await this.helper.nft.getTokensByAddress(this.collectionId, addressObj);2933 }29342935 async getToken(tokenId: number, blockHashAt?: string) {2936 return await this.helper.nft.getToken(this.collectionId, tokenId, [], blockHashAt);2937 }29382939 async getTokenOwner(tokenId: number, blockHashAt?: string) {2940 return await this.helper.nft.getTokenOwner(this.collectionId, tokenId, blockHashAt);2941 }29422943 async getTokenTopmostOwner(tokenId: number, blockHashAt?: string) {2944 return await this.helper.nft.getTokenTopmostOwner(this.collectionId, tokenId, blockHashAt);2945 }29462947 async getTokenChildren(tokenId: number, blockHashAt?: string) {2948 return await this.helper.nft.getTokenChildren(this.collectionId, tokenId, blockHashAt);2949 }29502951 async getPropertyPermissions(propertyKeys: string[] | null = null) {2952 return await this.helper.nft.getPropertyPermissions(this.collectionId, propertyKeys);2953 }29542955 async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {2956 return await this.helper.nft.getTokenProperties(this.collectionId, tokenId, propertyKeys);2957 }29582959 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {2960 return await this.helper.nft.transferToken(signer, this.collectionId, tokenId, addressObj);2961 }29622963 async transferTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2964 return await this.helper.nft.transferTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, toAddressObj);2965 }29662967 async approveToken(signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId) {2968 return await this.helper.nft.approveToken(signer, this.collectionId, tokenId, toAddressObj);2969 }29702971 async isTokenApproved(tokenId: number, toAddressObj: ICrossAccountId) {2972 return await this.helper.nft.isTokenApproved(this.collectionId, tokenId, toAddressObj);2973 }29742975 async mintToken(signer: TSigner, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {2976 return await this.helper.nft.mintToken(signer, {collectionId: this.collectionId, owner, properties});2977 }29782979 async mintMultipleTokens(signer: TSigner, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]) {2980 return await this.helper.nft.mintMultipleTokens(signer, this.collectionId, tokens);2981 }29822983 async burnToken(signer: TSigner, tokenId: number) {2984 return await this.helper.nft.burnToken(signer, this.collectionId, tokenId);2985 }29862987 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId) {2988 return await this.helper.nft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj);2989 }29902991 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {2992 return await this.helper.nft.setTokenProperties(signer, this.collectionId, tokenId, properties);2993 }29942995 async deleteTokenProperties(signer: TSigner, tokenId: number, propertyKeys: string[]) {2996 return await this.helper.nft.deleteTokenProperties(signer, this.collectionId, tokenId, propertyKeys);2997 }29982999 async setTokenPropertyPermissions(signer: TSigner, permissions: ITokenPropertyPermission[]) {3000 return await this.helper.nft.setTokenPropertyPermissions(signer, this.collectionId, permissions);3001 }30023003 async nestToken(signer: TSigner, tokenId: number, toTokenObj: IToken) {3004 return await this.helper.nft.nestToken(signer, {collectionId: this.collectionId, tokenId}, toTokenObj);3005 }30063007 async unnestToken(signer: TSigner, tokenId: number, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {3008 return await this.helper.nft.unnestToken(signer, {collectionId: this.collectionId, tokenId}, fromTokenObj, toAddressObj);3009 }30103011 scheduleAt<T extends UniqueHelper>(3012 scheduledId: string,3013 executionBlockNumber: number,3014 options: ISchedulerOptions = {},3015 ) {3016 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3017 return new UniqueNFTCollection(this.collectionId, scheduledHelper);3018 }30193020 scheduleAfter<T extends UniqueHelper>(3021 scheduledId: string,3022 blocksBeforeExecution: number,3023 options: ISchedulerOptions = {},3024 ) {3025 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3026 return new UniqueNFTCollection(this.collectionId, scheduledHelper);3027 }30283029 getSudo<T extends UniqueHelper>() {3030 return new UniqueNFTCollection(this.collectionId, this.helper.getSudo<T>());3031 }3032}303330343035export class UniqueRFTCollection extends UniqueBaseCollection {3036 getTokenObject(tokenId: number) {3037 return new UniqueRFToken(tokenId, this);3038 }30393040 async getToken(tokenId: number, blockHashAt?: string) {3041 return await this.helper.rft.getToken(this.collectionId, tokenId, [], blockHashAt);3042 }30433044 async getTokensByAddress(addressObj: ICrossAccountId) {3045 return await this.helper.rft.getTokensByAddress(this.collectionId, addressObj);3046 }30473048 async getTop10TokenOwners(tokenId: number) {3049 return await this.helper.rft.getTokenTop10Owners(this.collectionId, tokenId);3050 }30513052 async getTokenBalance(tokenId: number, addressObj: ICrossAccountId) {3053 return await this.helper.rft.getTokenBalance(this.collectionId, tokenId, addressObj);3054 }30553056 async getTokenTotalPieces(tokenId: number) {3057 return await this.helper.rft.getTokenTotalPieces(this.collectionId, tokenId);3058 }30593060 async getTokenApprovedPieces(tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3061 return await this.helper.rft.getTokenApprovedPieces(this.collectionId, tokenId, toAddressObj, fromAddressObj);3062 }30633064 async getPropertyPermissions(propertyKeys: string[] | null = null) {3065 return await this.helper.rft.getPropertyPermissions(this.collectionId, propertyKeys);3066 }30673068 async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {3069 return await this.helper.rft.getTokenProperties(this.collectionId, tokenId, propertyKeys);3070 }30713072 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount=1n) {3073 return await this.helper.rft.transferToken(signer, this.collectionId, tokenId, addressObj, amount);3074 }30753076 async transferTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3077 return await this.helper.rft.transferTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, toAddressObj, amount);3078 }30793080 async approveToken(signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {3081 return await this.helper.rft.approveToken(signer, this.collectionId, tokenId, toAddressObj, amount);3082 }30833084 async repartitionToken(signer: TSigner, tokenId: number, amount: bigint) {3085 return await this.helper.rft.repartitionToken(signer, this.collectionId, tokenId, amount);3086 }30873088 async mintToken(signer: TSigner, pieces=1n, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {3089 return await this.helper.rft.mintToken(signer, {collectionId: this.collectionId, owner, pieces, properties});3090 }30913092 async mintMultipleTokens(signer: TSigner, tokens: {pieces: bigint, owner: ICrossAccountId, properties?: IProperty[]}[]) {3093 return await this.helper.rft.mintMultipleTokens(signer, this.collectionId, tokens);3094 }30953096 async burnToken(signer: TSigner, tokenId: number, amount=1n) {3097 return await this.helper.rft.burnToken(signer, this.collectionId, tokenId, amount);3098 }30993100 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n) {3101 return await this.helper.rft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, amount);3102 }31033104 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {3105 return await this.helper.rft.setTokenProperties(signer, this.collectionId, tokenId, properties);3106 }31073108 async deleteTokenProperties(signer: TSigner, tokenId: number, propertyKeys: string[]) {3109 return await this.helper.rft.deleteTokenProperties(signer, this.collectionId, tokenId, propertyKeys);3110 }31113112 async setTokenPropertyPermissions(signer: TSigner, permissions: ITokenPropertyPermission[]) {3113 return await this.helper.rft.setTokenPropertyPermissions(signer, this.collectionId, permissions);3114 }31153116 scheduleAt<T extends UniqueHelper>(3117 scheduledId: string,3118 executionBlockNumber: number,3119 options: ISchedulerOptions = {},3120 ) {3121 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3122 return new UniqueRFTCollection(this.collectionId, scheduledHelper);3123 }31243125 scheduleAfter<T extends UniqueHelper>(3126 scheduledId: string,3127 blocksBeforeExecution: number,3128 options: ISchedulerOptions = {},3129 ) {3130 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3131 return new UniqueRFTCollection(this.collectionId, scheduledHelper);3132 }31333134 getSudo<T extends UniqueHelper>() {3135 return new UniqueRFTCollection(this.collectionId, this.helper.getSudo<T>());3136 }3137}313831393140export class UniqueFTCollection extends UniqueBaseCollection {3141 async getBalance(addressObj: ICrossAccountId) {3142 return await this.helper.ft.getBalance(this.collectionId, addressObj);3143 }31443145 async getTotalPieces() {3146 return await this.helper.ft.getTotalPieces(this.collectionId);3147 }31483149 async getApprovedTokens(fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3150 return await this.helper.ft.getApprovedTokens(this.collectionId, fromAddressObj, toAddressObj);3151 }31523153 async getTop10Owners() {3154 return await this.helper.ft.getTop10Owners(this.collectionId);3155 }31563157 async mint(signer: TSigner, amount=1n, owner: ICrossAccountId = {Substrate: signer.address}) {3158 return await this.helper.ft.mintTokens(signer, this.collectionId, amount, owner);3159 }31603161 async mintWithOneOwner(signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId = {Substrate: signer.address}) {3162 return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, tokens, owner);3163 }31643165 async transfer(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3166 return await this.helper.ft.transfer(signer, this.collectionId, toAddressObj, amount);3167 }31683169 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3170 return await this.helper.ft.transferFrom(signer, this.collectionId, fromAddressObj, toAddressObj, amount);3171 }31723173 async burnTokens(signer: TSigner, amount=1n) {3174 return await this.helper.ft.burnTokens(signer, this.collectionId, amount);3175 }31763177 async burnTokensFrom(signer: TSigner, fromAddressObj: ICrossAccountId, amount=1n) {3178 return await this.helper.ft.burnTokensFrom(signer, this.collectionId, fromAddressObj, amount);3179 }31803181 async approveTokens(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3182 return await this.helper.ft.approveTokens(signer, this.collectionId, toAddressObj, amount);3183 }31843185 scheduleAt<T extends UniqueHelper>(3186 scheduledId: string,3187 executionBlockNumber: number,3188 options: ISchedulerOptions = {},3189 ) {3190 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3191 return new UniqueFTCollection(this.collectionId, scheduledHelper);3192 }31933194 scheduleAfter<T extends UniqueHelper>(3195 scheduledId: string,3196 blocksBeforeExecution: number,3197 options: ISchedulerOptions = {},3198 ) {3199 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3200 return new UniqueFTCollection(this.collectionId, scheduledHelper);3201 }32023203 getSudo<T extends UniqueHelper>() {3204 return new UniqueFTCollection(this.collectionId, this.helper.getSudo<T>());3205 }3206}320732083209export class UniqueBaseToken {3210 collection: UniqueNFTCollection | UniqueRFTCollection;3211 collectionId: number;3212 tokenId: number;32133214 constructor(tokenId: number, collection: UniqueNFTCollection | UniqueRFTCollection) {3215 this.collection = collection;3216 this.collectionId = collection.collectionId;3217 this.tokenId = tokenId;3218 }32193220 async getNextSponsored(addressObj: ICrossAccountId) {3221 return await this.collection.getTokenNextSponsored(this.tokenId, addressObj);3222 }32233224 async getProperties(propertyKeys?: string[] | null) {3225 return await this.collection.getTokenProperties(this.tokenId, propertyKeys);3226 }32273228 async setProperties(signer: TSigner, properties: IProperty[]) {3229 return await this.collection.setTokenProperties(signer, this.tokenId, properties);3230 }32313232 async deleteProperties(signer: TSigner, propertyKeys: string[]) {3233 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);3234 }32353236 async doesExist() {3237 return await this.collection.doesTokenExist(this.tokenId);3238 }32393240 nestingAccount() {3241 return this.collection.helper.util.getTokenAccount(this);3242 }32433244 scheduleAt<T extends UniqueHelper>(3245 scheduledId: string,3246 executionBlockNumber: number,3247 options: ISchedulerOptions = {},3248 ) {3249 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3250 return new UniqueBaseToken(this.tokenId, scheduledCollection);3251 }32523253 scheduleAfter<T extends UniqueHelper>(3254 scheduledId: string,3255 blocksBeforeExecution: number,3256 options: ISchedulerOptions = {},3257 ) {3258 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3259 return new UniqueBaseToken(this.tokenId, scheduledCollection);3260 }32613262 getSudo<T extends UniqueHelper>() {3263 return new UniqueBaseToken(this.tokenId, this.collection.getSudo<T>());3264 }3265}326632673268export class UniqueNFToken extends UniqueBaseToken {3269 collection: UniqueNFTCollection;32703271 constructor(tokenId: number, collection: UniqueNFTCollection) {3272 super(tokenId, collection);3273 this.collection = collection;3274 }32753276 async getData(blockHashAt?: string) {3277 return await this.collection.getToken(this.tokenId, blockHashAt);3278 }32793280 async getOwner(blockHashAt?: string) {3281 return await this.collection.getTokenOwner(this.tokenId, blockHashAt);3282 }32833284 async getTopmostOwner(blockHashAt?: string) {3285 return await this.collection.getTokenTopmostOwner(this.tokenId, blockHashAt);3286 }32873288 async getChildren(blockHashAt?: string) {3289 return await this.collection.getTokenChildren(this.tokenId, blockHashAt);3290 }32913292 async nest(signer: TSigner, toTokenObj: IToken) {3293 return await this.collection.nestToken(signer, this.tokenId, toTokenObj);3294 }32953296 async unnest(signer: TSigner, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {3297 return await this.collection.unnestToken(signer, this.tokenId, fromTokenObj, toAddressObj);3298 }32993300 async transfer(signer: TSigner, addressObj: ICrossAccountId) {3301 return await this.collection.transferToken(signer, this.tokenId, addressObj);3302 }33033304 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3305 return await this.collection.transferTokenFrom(signer, this.tokenId, fromAddressObj, toAddressObj);3306 }33073308 async approve(signer: TSigner, toAddressObj: ICrossAccountId) {3309 return await this.collection.approveToken(signer, this.tokenId, toAddressObj);3310 }33113312 async isApproved(toAddressObj: ICrossAccountId) {3313 return await this.collection.isTokenApproved(this.tokenId, toAddressObj);3314 }33153316 async burn(signer: TSigner) {3317 return await this.collection.burnToken(signer, this.tokenId);3318 }33193320 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId) {3321 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj);3322 }33233324 scheduleAt<T extends UniqueHelper>(3325 scheduledId: string,3326 executionBlockNumber: number,3327 options: ISchedulerOptions = {},3328 ) {3329 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3330 return new UniqueNFToken(this.tokenId, scheduledCollection);3331 }33323333 scheduleAfter<T extends UniqueHelper>(3334 scheduledId: string,3335 blocksBeforeExecution: number,3336 options: ISchedulerOptions = {},3337 ) {3338 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3339 return new UniqueNFToken(this.tokenId, scheduledCollection);3340 }33413342 getSudo<T extends UniqueHelper>() {3343 return new UniqueNFToken(this.tokenId, this.collection.getSudo<T>());3344 }3345}33463347export class UniqueRFToken extends UniqueBaseToken {3348 collection: UniqueRFTCollection;33493350 constructor(tokenId: number, collection: UniqueRFTCollection) {3351 super(tokenId, collection);3352 this.collection = collection;3353 }33543355 async getData(blockHashAt?: string) {3356 return await this.collection.getToken(this.tokenId, blockHashAt);3357 }33583359 async getTop10Owners() {3360 return await this.collection.getTop10TokenOwners(this.tokenId);3361 }33623363 async getBalance(addressObj: ICrossAccountId) {3364 return await this.collection.getTokenBalance(this.tokenId, addressObj);3365 }33663367 async getTotalPieces() {3368 return await this.collection.getTokenTotalPieces(this.tokenId);3369 }33703371 async getApprovedPieces(fromAddressObj: ICrossAccountId, toAccountObj: ICrossAccountId) {3372 return await this.collection.getTokenApprovedPieces(this.tokenId, fromAddressObj, toAccountObj);3373 }33743375 async transfer(signer: TSigner, addressObj: ICrossAccountId, amount=1n) {3376 return await this.collection.transferToken(signer, this.tokenId, addressObj, amount);3377 }33783379 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3380 return await this.collection.transferTokenFrom(signer, this.tokenId, fromAddressObj, toAddressObj, amount);3381 }33823383 async approve(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3384 return await this.collection.approveToken(signer, this.tokenId, toAddressObj, amount);3385 }33863387 async repartition(signer: TSigner, amount: bigint) {3388 return await this.collection.repartitionToken(signer, this.tokenId, amount);3389 }33903391 async burn(signer: TSigner, amount=1n) {3392 return await this.collection.burnToken(signer, this.tokenId, amount);3393 }33943395 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId, amount=1n) {3396 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj, amount);3397 }33983399 scheduleAt<T extends UniqueHelper>(3400 scheduledId: string,3401 executionBlockNumber: number,3402 options: ISchedulerOptions = {},3403 ) {3404 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3405 return new UniqueRFToken(this.tokenId, scheduledCollection);3406 }34073408 scheduleAfter<T extends UniqueHelper>(3409 scheduledId: string,3410 blocksBeforeExecution: number,3411 options: ISchedulerOptions = {},3412 ) {3413 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3414 return new UniqueRFToken(this.tokenId, scheduledCollection);3415 }34163417 getSudo<T extends UniqueHelper>() {3418 return new UniqueRFToken(this.tokenId, this.collection.getSudo<T>());3419 }3420}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034/* eslint-disable @typescript-eslint/no-var-requires */5/* eslint-disable function-call-argument-newline */6/* eslint-disable no-prototype-builtins */78import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';11import {IKeyringPair} from '@polkadot/types/types';12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, IForeignAssetMetadata, TNetworks, MoonbeamAssetInfo, DemocracyStandardAccountVote, AcalaAssetMetadata} from './types';1314export class CrossAccountId implements ICrossAccountId {15 Substrate?: TSubstrateAccount;16 Ethereum?: TEthereumAccount;1718 constructor(account: ICrossAccountId) {19 if (account.Substrate) this.Substrate = account.Substrate;20 if (account.Ethereum) this.Ethereum = account.Ethereum;21 }2223 static fromKeyring(account: IKeyringPair, domain: 'Substrate' | 'Ethereum' = 'Substrate') {24 switch (domain) {25 case 'Substrate': return new CrossAccountId({Substrate: account.address});26 case 'Ethereum': return new CrossAccountId({Substrate: account.address}).toEthereum();27 }28 }2930 static fromLowerCaseKeys(address: ICrossAccountIdLower): CrossAccountId {31 return new CrossAccountId({Substrate: address.substrate, Ethereum: address.ethereum});32 }3334 static normalizeSubstrateAddress(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {35 return encodeAddress(decodeAddress(address), ss58Format);36 }3738 static withNormalizedSubstrate(address: TSubstrateAccount, ss58Format = 42): CrossAccountId {39 return new CrossAccountId({Substrate: CrossAccountId.normalizeSubstrateAddress(address, ss58Format)});40 }41 42 withNormalizedSubstrate(ss58Format = 42): CrossAccountId {43 if (this.Substrate) return CrossAccountId.withNormalizedSubstrate(this.Substrate, ss58Format);44 return this;45 }4647 static translateSubToEth(address: TSubstrateAccount): TEthereumAccount {48 return nesting.toChecksumAddress('0x' + Array.from(addressToEvm(address), i => i.toString(16).padStart(2, '0')).join(''));49 }5051 toEthereum(): CrossAccountId {52 if (this.Substrate) return new CrossAccountId({Ethereum: CrossAccountId.translateSubToEth(this.Substrate)});53 return this;54 }5556 static translateEthToSub(address: TEthereumAccount, ss58Format?: number): TSubstrateAccount {57 return evmToAddress(address, ss58Format);58 }5960 toSubstrate(ss58Format?: number): CrossAccountId {61 if (this.Ethereum) return new CrossAccountId({Substrate: CrossAccountId.translateEthToSub(this.Ethereum, ss58Format)});62 return this;63 }64 65 toLowerCase(): CrossAccountId {66 if (this.Substrate) this.Substrate = this.Substrate.toLowerCase();67 if (this.Ethereum) this.Ethereum = this.Ethereum.toLowerCase();68 return this;69 }70}7172const nesting = {73 toChecksumAddress(address: string): string {74 if (typeof address === 'undefined') return '';7576 if(!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error(`Given address "${address}" is not a valid Ethereum address.`);7778 address = address.toLowerCase().replace(/^0x/i,'');79 const addressHash = keccakAsHex(address).replace(/^0x/i,'');80 const checksumAddress = ['0x'];8182 for (let i = 0; i < address.length; i++) {83 // If ith character is 8 to f then make it uppercase84 if (parseInt(addressHash[i], 16) > 7) {85 checksumAddress.push(address[i].toUpperCase());86 } else {87 checksumAddress.push(address[i]);88 }89 }90 return checksumAddress.join('');91 },92 tokenIdToAddress(collectionId: number, tokenId: number) {93 return this.toChecksumAddress(`0xf8238ccfff8ed887463fd5e0${collectionId.toString(16).padStart(8,'0')}${tokenId.toString(16).padStart(8,'0')}`);94 },95};9697class UniqueUtil {98 static transactionStatus = {99 NOT_READY: 'NotReady',100 FAIL: 'Fail',101 SUCCESS: 'Success',102 };103104 static chainLogType = {105 EXTRINSIC: 'extrinsic',106 RPC: 'rpc',107 };108109 static getTokenAccount(token: IToken): CrossAccountId {110 return new CrossAccountId({Ethereum: this.getTokenAddress(token)});111 }112113 static getTokenAddress(token: IToken): string {114 return nesting.tokenIdToAddress(token.collectionId, token.tokenId);115 }116117 static getDefaultLogger(): ILogger {118 return {119 log(msg: any, level = 'INFO') {120 console[level.toLocaleLowerCase() === 'error' ? 'error' : 'log'](...(Array.isArray(msg) ? msg : [msg]));121 },122 level: {123 ERROR: 'ERROR',124 WARNING: 'WARNING',125 INFO: 'INFO',126 },127 };128 }129130 static vec2str(arr: string[] | number[]) {131 return arr.map(x => String.fromCharCode(parseInt(x.toString()))).join('');132 }133134 static str2vec(string: string) {135 if (typeof string !== 'string') return string;136 return Array.from(string).map(x => x.charCodeAt(0));137 }138139 static fromSeed(seed: string, ss58Format = 42) {140 const keyring = new Keyring({type: 'sr25519', ss58Format});141 return keyring.addFromUri(seed);142 }143144 static extractCollectionIdFromCreationResult(creationResult: ITransactionResult): number {145 if (creationResult.status !== this.transactionStatus.SUCCESS) {146 throw Error('Unable to create collection!');147 }148149 let collectionId = null;150 creationResult.result.events.forEach(({event: {data, method, section}}) => {151 if ((section === 'common') && (method === 'CollectionCreated')) {152 collectionId = parseInt(data[0].toString(), 10);153 }154 });155156 if (collectionId === null) {157 throw Error('No CollectionCreated event was found!');158 }159160 return collectionId;161 }162163 static extractTokensFromCreationResult(creationResult: ITransactionResult): {164 success: boolean, 165 tokens: {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[],166 } {167 if (creationResult.status !== this.transactionStatus.SUCCESS) {168 throw Error('Unable to create tokens!');169 }170 let success = false;171 const tokens = [] as {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[];172 creationResult.result.events.forEach(({event: {data, method, section}}) => {173 if (method === 'ExtrinsicSuccess') {174 success = true;175 } else if ((section === 'common') && (method === 'ItemCreated')) {176 tokens.push({177 collectionId: parseInt(data[0].toString(), 10),178 tokenId: parseInt(data[1].toString(), 10),179 owner: data[2].toHuman(),180 amount: data[3].toBigInt(),181 });182 }183 });184 return {success, tokens};185 }186187 static extractTokensFromBurnResult(burnResult: ITransactionResult): {188 success: boolean, 189 tokens: {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[],190 } {191 if (burnResult.status !== this.transactionStatus.SUCCESS) {192 throw Error('Unable to burn tokens!');193 }194 let success = false;195 const tokens = [] as {collectionId: number, tokenId: number, owner: CrossAccountId, amount: bigint}[];196 burnResult.result.events.forEach(({event: {data, method, section}}) => {197 if (method === 'ExtrinsicSuccess') {198 success = true;199 } else if ((section === 'common') && (method === 'ItemDestroyed')) {200 tokens.push({201 collectionId: parseInt(data[0].toString(), 10),202 tokenId: parseInt(data[1].toString(), 10),203 owner: data[2].toHuman(),204 amount: data[3].toBigInt(),205 });206 }207 });208 return {success, tokens};209 }210211 static findCollectionInEvents(events: {event: IEvent}[], collectionId: number, expectedSection: string, expectedMethod: string): boolean {212 let eventId = null;213 events.forEach(({event: {data, method, section}}) => {214 if ((section === expectedSection) && (method === expectedMethod)) {215 eventId = parseInt(data[0].toString(), 10);216 }217 });218219 if (eventId === null) {220 throw Error(`No ${expectedMethod} event was found!`);221 }222 return eventId === collectionId;223 }224225 static isTokenTransferSuccess(events: {event: IEvent}[], collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {226 const normalizeAddress = (address: string | ICrossAccountId) => {227 if(typeof address === 'string') return address;228 const obj = {} as any;229 Object.keys(address).forEach(k => {230 obj[k.toLocaleLowerCase()] = address[k as 'Substrate' | 'Ethereum'];231 });232 if(obj.substrate) return CrossAccountId.withNormalizedSubstrate(obj.substrate);233 if(obj.ethereum) return CrossAccountId.fromLowerCaseKeys(obj).toLowerCase();234 return address;235 };236 let transfer = {collectionId: null, tokenId: null, from: null, to: null, amount: 1} as any;237 events.forEach(({event: {data, method, section}}) => {238 if ((section === 'common') && (method === 'Transfer')) {239 const hData = (data as any).toJSON();240 transfer = {241 collectionId: hData[0],242 tokenId: hData[1],243 from: normalizeAddress(hData[2]),244 to: normalizeAddress(hData[3]),245 amount: BigInt(hData[4]),246 };247 }248 });249 let isSuccess = parseInt(collectionId.toString()) === transfer.collectionId && parseInt(tokenId.toString()) === transfer.tokenId;250 isSuccess = isSuccess && JSON.stringify(normalizeAddress(fromAddressObj)) === JSON.stringify(transfer.from);251 isSuccess = isSuccess && JSON.stringify(normalizeAddress(toAddressObj)) === JSON.stringify(transfer.to);252 isSuccess = isSuccess && amount === transfer.amount;253 return isSuccess;254 }255256 static bigIntToDecimals(number: bigint, decimals = 18) {257 const numberStr = number.toString();258 const dotPos = numberStr.length - decimals;259 260 if (dotPos <= 0) {261 return '0.' + '0'.repeat(Math.abs(dotPos)) + numberStr;262 } else {263 const intPart = numberStr.substring(0, dotPos);264 const fractPart = numberStr.substring(dotPos);265 return intPart + '.' + fractPart;266 }267 }268}269270class UniqueEventHelper {271 private static extractIndex(index: any): [number, number] | string {272 if(index.toRawType() === '[u8;2]') return [index[0], index[1]];273 return index.toJSON();274 }275276 private static extractSub(data: any, subTypes: any): {[key: string]: any} {277 let obj: any = {};278 let index = 0;279280 if (data.entries) {281 for(const [key, value] of data.entries()) {282 obj[key] = this.extractData(value, subTypes[index]);283 index++;284 }285 } else obj = data.toJSON();286287 return obj;288 }289 290 private static extractData(data: any, type: any): any {291 if(!type) return data.toHuman();292 if (['u16', 'u32'].indexOf(type.type) > -1) return data.toNumber();293 if (['u64', 'u128', 'u256'].indexOf(type.type) > -1) return data.toBigInt();294 if(type.hasOwnProperty('sub')) return this.extractSub(data, type.sub);295 return data.toHuman();296 }297298 public static extractEvents(events: {event: any, phase: any}[]): IEvent[] {299 const parsedEvents: IEvent[] = [];300301 events.forEach((record) => {302 const {event, phase} = record;303 const types = event.typeDef;304305 const eventData: IEvent = {306 section: event.section.toString(),307 method: event.method.toString(),308 index: this.extractIndex(event.index),309 data: [],310 phase: phase.toJSON(),311 };312313 event.data.forEach((val: any, index: number) => {314 eventData.data.push(this.extractData(val, types[index]));315 });316317 parsedEvents.push(eventData);318 });319320 return parsedEvents;321 }322}323324export class ChainHelperBase {325 helperBase: any;326327 transactionStatus = UniqueUtil.transactionStatus;328 chainLogType = UniqueUtil.chainLogType;329 util: typeof UniqueUtil;330 eventHelper: typeof UniqueEventHelper;331 logger: ILogger;332 api: ApiPromise | null;333 forcedNetwork: TNetworks | null;334 network: TNetworks | null;335 chainLog: IUniqueHelperLog[];336 children: ChainHelperBase[];337 address: AddressGroup;338 chain: ChainGroup;339340 constructor(logger?: ILogger, helperBase?: any) {341 this.helperBase = helperBase;342343 this.util = UniqueUtil;344 this.eventHelper = UniqueEventHelper;345 if (typeof logger == 'undefined') logger = this.util.getDefaultLogger();346 this.logger = logger;347 this.api = null;348 this.forcedNetwork = null;349 this.network = null;350 this.chainLog = [];351 this.children = [];352 this.address = new AddressGroup(this);353 this.chain = new ChainGroup(this);354 }355356 clone(helperCls: ChainHelperBaseConstructor, options: {[key: string]: any} = {}) {357 Object.setPrototypeOf(helperCls.prototype, this);358 const newHelper = new helperCls(this.logger, options);359360 newHelper.api = this.api;361 newHelper.network = this.network;362 newHelper.forceNetwork = this.forceNetwork;363364 this.children.push(newHelper);365366 return newHelper;367 }368369 getApi(): ApiPromise {370 if(this.api === null) throw Error('API not initialized');371 return this.api;372 }373374 clearChainLog(): void {375 this.chainLog = [];376 }377378 forceNetwork(value: TNetworks): void {379 this.forcedNetwork = value;380 }381382 async connect(wsEndpoint: string, listeners?: IApiListeners) {383 if (this.api !== null) throw Error('Already connected');384 const {api, network} = await ChainHelperBase.createConnection(wsEndpoint, listeners, this.forcedNetwork);385 this.api = api;386 this.network = network;387 }388389 async disconnect() {390 for (const child of this.children) {391 child.clearApi();392 }393394 if (this.api === null) return;395 await this.api.disconnect();396 this.clearApi();397 }398399 clearApi() {400 this.api = null;401 this.network = null;402 }403404 static async detectNetwork(api: ApiPromise): Promise<TNetworks> {405 const spec = (await api.query.system.lastRuntimeUpgrade()).toJSON() as any;406 const xcmChains = ['rococo', 'westend', 'westmint', 'acala', 'karura', 'moonbeam', 'moonriver'];407408 if(xcmChains.indexOf(spec.specName) > -1) return spec.specName;409410 if(['quartz', 'unique'].indexOf(spec.specName) > -1) return spec.specName;411 return 'opal';412 }413414 static async detectNetworkByWsEndpoint(wsEndpoint: string): Promise<TNetworks> {415 const api = new ApiPromise({provider: new WsProvider(wsEndpoint)});416 await api.isReady;417418 const network = await this.detectNetwork(api);419420 await api.disconnect();421422 return network;423 }424425 static async createConnection(wsEndpoint: string, listeners?: IApiListeners, network?: TNetworks | null): Promise<{426 api: ApiPromise;427 network: TNetworks;428 }> {429 if(typeof network === 'undefined' || network === null) network = 'opal';430 const supportedRPC = {431 opal: {432 unique: require('@unique-nft/opal-testnet-types/definitions').unique.rpc,433 },434 quartz: {435 unique: require('@unique-nft/quartz-mainnet-types/definitions').unique.rpc,436 },437 unique: {438 unique: require('@unique-nft/unique-mainnet-types/definitions').unique.rpc,439 },440 rococo: {},441 westend: {},442 moonbeam: {},443 moonriver: {},444 acala: {},445 karura: {},446 westmint: {},447 };448 if(!supportedRPC.hasOwnProperty(network)) network = await this.detectNetworkByWsEndpoint(wsEndpoint);449 const rpc = supportedRPC[network];450451 // TODO: investigate how to replace rpc in runtime452 // api._rpcCore.addUserInterfaces(rpc);453454 const api = new ApiPromise({provider: new WsProvider(wsEndpoint), rpc});455456 await api.isReadyOrError;457458 if (typeof listeners === 'undefined') listeners = {};459 for (const event of ['connected', 'disconnected', 'error', 'ready', 'decorated']) {460 if (!listeners.hasOwnProperty(event) || typeof listeners[event as TApiAllowedListeners] === 'undefined') continue;461 api.on(event as ApiInterfaceEvents, listeners[event as TApiAllowedListeners] as (...args: any[]) => any);462 }463464 return {api, network};465 }466467 getTransactionStatus(data: {events: {event: IEvent}[], status: any}) {468 const {events, status} = data;469 if (status.isReady) {470 return this.transactionStatus.NOT_READY;471 }472 if (status.isBroadcast) {473 return this.transactionStatus.NOT_READY;474 }475 if (status.isInBlock || status.isFinalized) {476 const errors = events.filter(e => e.event.method === 'ExtrinsicFailed');477 if (errors.length > 0) {478 return this.transactionStatus.FAIL;479 }480 if (events.filter(e => e.event.method === 'ExtrinsicSuccess').length > 0) {481 return this.transactionStatus.SUCCESS;482 }483 }484485 return this.transactionStatus.FAIL;486 }487488 signTransaction(sender: TSigner, transaction: any, options: Partial<SignerOptions> | null = null, label = 'transaction') {489 const sign = (callback: any) => {490 if(options !== null) return transaction.signAndSend(sender, options, callback);491 return transaction.signAndSend(sender, callback);492 };493 // eslint-disable-next-line no-async-promise-executor494 return new Promise(async (resolve, reject) => {495 try {496 const unsub = await sign((result: any) => {497 const status = this.getTransactionStatus(result);498499 if (status === this.transactionStatus.SUCCESS) {500 this.logger.log(`${label} successful`);501 unsub();502 resolve({result, status});503 } else if (status === this.transactionStatus.FAIL) {504 let moduleError = null;505506 if (result.hasOwnProperty('dispatchError')) {507 const dispatchError = result['dispatchError'];508509 if (dispatchError) {510 if (dispatchError.isModule) {511 const modErr = dispatchError.asModule;512 const errorMeta = dispatchError.registry.findMetaError(modErr);513514 moduleError = `${errorMeta.section}.${errorMeta.name}`;515 } else {516 moduleError = dispatchError.toHuman();517 }518 } else {519 this.logger.log(result, this.logger.level.ERROR);520 }521 }522523 this.logger.log(`Something went wrong with ${label}. Status: ${status}`, this.logger.level.ERROR);524 unsub();525 reject({status, moduleError, result});526 }527 });528 } catch (e) {529 this.logger.log(e, this.logger.level.ERROR);530 reject(e);531 }532 });533 }534535 constructApiCall(apiCall: string, params: any[]) {536 if(!apiCall.startsWith('api.')) throw Error(`Invalid api call: ${apiCall}`);537 let call = this.getApi() as any;538 for(const part of apiCall.slice(4).split('.')) {539 call = call[part];540 }541 return call(...params);542 }543544 async executeExtrinsic(sender: TSigner, extrinsic: string, params: any[], expectSuccess=true, options: Partial<SignerOptions>|null = null/*, failureMessage='expected success'*/) {545 if(this.api === null) throw Error('API not initialized');546 if(!extrinsic.startsWith('api.tx.')) throw Error(`${extrinsic} is not transaction`);547548 const startTime = (new Date()).getTime();549 let result: ITransactionResult;550 let events: IEvent[] = [];551 try {552 result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), options, extrinsic) as ITransactionResult;553 events = this.eventHelper.extractEvents(result.result.events);554 }555 catch(e) {556 if(!(e as object).hasOwnProperty('status')) throw e;557 result = e as ITransactionResult;558 }559560 const endTime = (new Date()).getTime();561562 const log = {563 executedAt: endTime,564 executionTime: endTime - startTime,565 type: this.chainLogType.EXTRINSIC,566 status: result.status,567 call: extrinsic,568 signer: this.getSignerAddress(sender),569 params,570 } as IUniqueHelperLog;571572 if(result.status !== this.transactionStatus.SUCCESS) {573 if (result.moduleError) log.moduleError = result.moduleError;574 else if (result.result.dispatchError) log.dispatchError = result.result.dispatchError;575 }576 if(events.length > 0) log.events = events;577578 this.chainLog.push(log);579580 if(expectSuccess && result.status !== this.transactionStatus.SUCCESS) {581 if (result.moduleError) throw Error(`${result.moduleError}`);582 else if (result.result.dispatchError) throw Error(JSON.stringify(result.result.dispatchError));583 }584 return result;585 }586587 async callRpc(rpc: string, params?: any[]) {588 if(typeof params === 'undefined') params = [];589 if(this.api === null) throw Error('API not initialized');590 if(!rpc.startsWith('api.rpc.') && !rpc.startsWith('api.query.')) throw Error(`${rpc} is not RPC call`);591592 const startTime = (new Date()).getTime();593 let result;594 let error = null;595 const log = {596 type: this.chainLogType.RPC,597 call: rpc,598 params,599 } as IUniqueHelperLog;600601 try {602 result = await this.constructApiCall(rpc, params);603 }604 catch(e) {605 error = e;606 }607608 const endTime = (new Date()).getTime();609610 log.executedAt = endTime;611 log.status = (error === null ? this.transactionStatus.SUCCESS : this.transactionStatus.FAIL) as 'Fail' | 'Success';612 log.executionTime = endTime - startTime;613614 this.chainLog.push(log);615616 if(error !== null) throw error;617618 return result;619 }620621 getSignerAddress(signer: IKeyringPair | string): string {622 if(typeof signer === 'string') return signer;623 return signer.address;624 }625626 fetchAllPalletNames(): string[] {627 if(this.api === null) throw Error('API not initialized');628 return this.api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());629 }630631 fetchMissingPalletNames(requiredPallets: string[]): string[] {632 const palletNames = this.fetchAllPalletNames();633 return requiredPallets.filter(p => !palletNames.includes(p));634 }635}636637638class HelperGroup<T extends ChainHelperBase> {639 helper: T;640641 constructor(uniqueHelper: T) {642 this.helper = uniqueHelper;643 }644}645646647class CollectionGroup extends HelperGroup<UniqueHelper> {648 /**649 * Get number of blocks when sponsored transaction is available.650 *651 * @param collectionId ID of collection652 * @param tokenId ID of token653 * @param addressObj address for which the sponsorship is checked654 * @example await getTokenNextSponsored(1, 2, {Substrate: '5DfhbVfww7ThF8q6f3...'});655 * @returns number of blocks or null if sponsorship hasn't been set656 */657 async getTokenNextSponsored(collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<number | null> {658 return (await this.helper.callRpc('api.rpc.unique.nextSponsored', [collectionId, addressObj, tokenId])).toJSON();659 }660661 /**662 * Get the number of created collections.663 *664 * @returns number of created collections665 */666 async getTotalCount(): Promise<number> {667 return (await this.helper.callRpc('api.rpc.unique.collectionStats')).created.toNumber();668 }669670 /**671 * Get information about the collection with additional data,672 * including the number of tokens it contains, its administrators,673 * the normalized address of the collection's owner, and decoded name and description.674 *675 * @param collectionId ID of collection676 * @example await getData(2)677 * @returns collection information object678 */679 async getData(collectionId: number): Promise<{680 id: number;681 name: string;682 description: string;683 tokensCount: number;684 admins: CrossAccountId[];685 normalizedOwner: TSubstrateAccount;686 raw: any687 } | null> {688 const collection = await this.helper.callRpc('api.rpc.unique.collectionById', [collectionId]);689 const humanCollection = collection.toHuman(), collectionData = {690 id: collectionId, name: null, description: null, tokensCount: 0, admins: [],691 raw: humanCollection,692 } as any, jsonCollection = collection.toJSON();693 if (humanCollection === null) return null;694 collectionData.raw.limits = jsonCollection.limits;695 collectionData.raw.permissions = jsonCollection.permissions;696 collectionData.normalizedOwner = this.helper.address.normalizeSubstrate(collectionData.raw.owner);697 for (const key of ['name', 'description']) {698 collectionData[key] = this.helper.util.vec2str(humanCollection[key]);699 }700701 collectionData.tokensCount = (['RFT', 'NFT'].includes(humanCollection.mode))702 ? await this.helper[humanCollection.mode.toLocaleLowerCase() as 'nft' | 'rft'].getLastTokenId(collectionId)703 : 0;704 collectionData.admins = await this.getAdmins(collectionId);705706 return collectionData;707 }708709 /**710 * Get the addresses of the collection's administrators, optionally normalized.711 *712 * @param collectionId ID of collection713 * @param normalize whether to normalize the addresses to the default ss58 format714 * @example await getAdmins(1)715 * @returns array of administrators716 */717 async getAdmins(collectionId: number, normalize = false): Promise<CrossAccountId[]> {718 const admins = (await this.helper.callRpc('api.rpc.unique.adminlist', [collectionId])).toHuman();719720 return normalize721 ? admins.map((address: CrossAccountId) => address.withNormalizedSubstrate())722 : admins;723 }724725 /**726 * Get the addresses added to the collection allow-list, optionally normalized.727 * @param collectionId ID of collection728 * @param normalize whether to normalize the addresses to the default ss58 format729 * @example await getAllowList(1)730 * @returns array of allow-listed addresses731 */732 async getAllowList(collectionId: number, normalize = false): Promise<CrossAccountId[]> {733 const allowListed = (await this.helper.callRpc('api.rpc.unique.allowlist', [collectionId])).toHuman();734 return normalize735 ? allowListed.map((address: CrossAccountId) => address.withNormalizedSubstrate())736 : allowListed;737 }738739 /**740 * Get the effective limits of the collection instead of null for default values741 *742 * @param collectionId ID of collection743 * @example await getEffectiveLimits(2)744 * @returns object of collection limits745 */746 async getEffectiveLimits(collectionId: number): Promise<ICollectionLimits> {747 return (await this.helper.callRpc('api.rpc.unique.effectiveCollectionLimits', [collectionId])).toJSON();748 }749750 /**751 * Burns the collection if the signer has sufficient permissions and collection is empty.752 *753 * @param signer keyring of signer754 * @param collectionId ID of collection755 * @example await helper.collection.burn(aliceKeyring, 3);756 * @returns ```true``` if extrinsic success, otherwise ```false```757 */758 async burn(signer: TSigner, collectionId: number): Promise<boolean> {759 const result = await this.helper.executeExtrinsic(760 signer,761 'api.tx.unique.destroyCollection', [collectionId],762 true,763 );764765 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionDestroyed');766 }767768 /**769 * Sets the sponsor for the collection (Requires the Substrate address). Needs confirmation by the sponsor.770 *771 * @param signer keyring of signer772 * @param collectionId ID of collection773 * @param sponsorAddress Sponsor substrate address774 * @example setSponsor(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...")775 * @returns ```true``` if extrinsic success, otherwise ```false```776 */777 async setSponsor(signer: TSigner, collectionId: number, sponsorAddress: TSubstrateAccount): Promise<boolean> {778 const result = await this.helper.executeExtrinsic(779 signer,780 'api.tx.unique.setCollectionSponsor', [collectionId, sponsorAddress],781 true,782 );783784 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionSponsorSet');785 }786787 /**788 * Confirms consent to sponsor the collection on behalf of the signer.789 *790 * @param signer keyring of signer791 * @param collectionId ID of collection792 * @example confirmSponsorship(aliceKeyring, 10)793 * @returns ```true``` if extrinsic success, otherwise ```false```794 */795 async confirmSponsorship(signer: TSigner, collectionId: number): Promise<boolean> {796 const result = await this.helper.executeExtrinsic(797 signer,798 'api.tx.unique.confirmSponsorship', [collectionId],799 true,800 );801802 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'SponsorshipConfirmed');803 }804805 /**806 * Removes the sponsor of a collection, regardless if it consented or not.807 *808 * @param signer keyring of signer809 * @param collectionId ID of collection810 * @example removeSponsor(aliceKeyring, 10)811 * @returns ```true``` if extrinsic success, otherwise ```false```812 */813 async removeSponsor(signer: TSigner, collectionId: number): Promise<boolean> {814 const result = await this.helper.executeExtrinsic(815 signer,816 'api.tx.unique.removeCollectionSponsor', [collectionId],817 true,818 );819820 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionSponsorRemoved');821 }822823 /**824 * Sets the limits of the collection. At least one limit must be specified for a correct call.825 *826 * @param signer keyring of signer827 * @param collectionId ID of collection828 * @param limits collection limits object829 * @example830 * await setLimits(831 * aliceKeyring,832 * 10,833 * {834 * sponsorTransferTimeout: 0,835 * ownerCanDestroy: false836 * }837 * )838 * @returns ```true``` if extrinsic success, otherwise ```false```839 */840 async setLimits(signer: TSigner, collectionId: number, limits: ICollectionLimits): Promise<boolean> {841 const result = await this.helper.executeExtrinsic(842 signer,843 'api.tx.unique.setCollectionLimits', [collectionId, limits],844 true,845 );846847 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionLimitSet');848 }849850 /**851 * Changes the owner of the collection to the new Substrate address.852 *853 * @param signer keyring of signer854 * @param collectionId ID of collection855 * @param ownerAddress substrate address of new owner856 * @example changeOwner(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...")857 * @returns ```true``` if extrinsic success, otherwise ```false```858 */859 async changeOwner(signer: TSigner, collectionId: number, ownerAddress: TSubstrateAccount): Promise<boolean> {860 const result = await this.helper.executeExtrinsic(861 signer,862 'api.tx.unique.changeCollectionOwner', [collectionId, ownerAddress],863 true,864 );865866 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionOwnedChanged');867 }868869 /**870 * Adds a collection administrator.871 *872 * @param signer keyring of signer873 * @param collectionId ID of collection874 * @param adminAddressObj Administrator address (substrate or ethereum)875 * @example addAdmin(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."})876 * @returns ```true``` if extrinsic success, otherwise ```false```877 */878 async addAdmin(signer: TSigner, collectionId: number, adminAddressObj: ICrossAccountId): Promise<boolean> {879 const result = await this.helper.executeExtrinsic(880 signer,881 'api.tx.unique.addCollectionAdmin', [collectionId, adminAddressObj],882 true,883 );884885 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminAdded');886 }887888 /**889 * Removes a collection administrator.890 *891 * @param signer keyring of signer892 * @param collectionId ID of collection893 * @param adminAddressObj Administrator address (substrate or ethereum)894 * @example removeAdmin(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."})895 * @returns ```true``` if extrinsic success, otherwise ```false```896 */897 async removeAdmin(signer: TSigner, collectionId: number, adminAddressObj: ICrossAccountId): Promise<boolean> {898 const result = await this.helper.executeExtrinsic(899 signer,900 'api.tx.unique.removeCollectionAdmin', [collectionId, adminAddressObj],901 true,902 );903904 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminRemoved');905 }906907 /**908 * Check if user is in allow list.909 * 910 * @param collectionId ID of collection911 * @param user Account to check912 * @example await getAdmins(1)913 * @returns is user in allow list914 */915 async allowed(collectionId: number, user: ICrossAccountId): Promise<boolean> {916 return (await this.helper.callRpc('api.rpc.unique.allowed', [collectionId, user])).toJSON();917 }918919 /**920 * Adds an address to allow list921 * @param signer keyring of signer922 * @param collectionId ID of collection923 * @param addressObj address to add to the allow list924 * @returns ```true``` if extrinsic success, otherwise ```false```925 */926 async addToAllowList(signer: TSigner, collectionId: number, addressObj: ICrossAccountId): Promise<boolean> {927 const result = await this.helper.executeExtrinsic(928 signer,929 'api.tx.unique.addToAllowList', [collectionId, addressObj],930 true,931 );932933 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'AllowListAddressAdded');934 }935936 /**937 * Removes an address from allow list938 *939 * @param signer keyring of signer940 * @param collectionId ID of collection941 * @param addressObj address to remove from the allow list942 * @returns ```true``` if extrinsic success, otherwise ```false```943 */944 async removeFromAllowList(signer: TSigner, collectionId: number, addressObj: ICrossAccountId): Promise<boolean> {945 const result = await this.helper.executeExtrinsic(946 signer,947 'api.tx.unique.removeFromAllowList', [collectionId, addressObj],948 true,949 );950951 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'AllowListAddressRemoved');952 }953954 /**955 * Sets onchain permissions for selected collection.956 *957 * @param signer keyring of signer958 * @param collectionId ID of collection959 * @param permissions collection permissions object960 * @example setPermissions(aliceKeyring, 10, {access:'AllowList', mintMode: true, nesting: {collectionAdmin: true, tokenOwner: true}});961 * @returns ```true``` if extrinsic success, otherwise ```false```962 */963 async setPermissions(signer: TSigner, collectionId: number, permissions: ICollectionPermissions): Promise<boolean> {964 const result = await this.helper.executeExtrinsic(965 signer,966 'api.tx.unique.setCollectionPermissions', [collectionId, permissions],967 true,968 );969970 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionPermissionSet');971 }972973 /**974 * Enables nesting for selected collection. If `restricted` set, you can nest only tokens from specified collections.975 *976 * @param signer keyring of signer977 * @param collectionId ID of collection978 * @param permissions nesting permissions object979 * @example enableNesting(aliceKeyring, 10, {collectionAdmin: true, tokenOwner: true});980 * @returns ```true``` if extrinsic success, otherwise ```false```981 */982 async enableNesting(signer: TSigner, collectionId: number, permissions: INestingPermissions): Promise<boolean> {983 return await this.setPermissions(signer, collectionId, {nesting: permissions});984 }985986 /**987 * Disables nesting for selected collection.988 *989 * @param signer keyring of signer990 * @param collectionId ID of collection991 * @example disableNesting(aliceKeyring, 10);992 * @returns ```true``` if extrinsic success, otherwise ```false```993 */994 async disableNesting(signer: TSigner, collectionId: number): Promise<boolean> {995 return await this.setPermissions(signer, collectionId, {nesting: {tokenOwner: false, collectionAdmin: false}});996 }997998 /**999 * Sets onchain properties to the collection.1000 *1001 * @param signer keyring of signer1002 * @param collectionId ID of collection1003 * @param properties array of property objects1004 * @example setProperties(aliceKeyring, 10, [{key: "gender", value: "male"}]);1005 * @returns ```true``` if extrinsic success, otherwise ```false```1006 */1007 async setProperties(signer: TSigner, collectionId: number, properties: IProperty[]): Promise<boolean> {1008 const result = await this.helper.executeExtrinsic(1009 signer,1010 'api.tx.unique.setCollectionProperties', [collectionId, properties],1011 true,1012 );10131014 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionPropertySet');1015 }10161017 /**1018 * Get collection properties.1019 * 1020 * @param collectionId ID of collection1021 * @param propertyKeys optionally filter the returned properties to only these keys1022 * @example getProperties(1219, ['location', 'date', 'time', 'isParadise']);1023 * @returns array of key-value pairs1024 */1025 async getProperties(collectionId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {1026 return (await this.helper.callRpc('api.rpc.unique.collectionProperties', [collectionId, propertyKeys])).toHuman();1027 }10281029 /**1030 * Deletes onchain properties from the collection.1031 *1032 * @param signer keyring of signer1033 * @param collectionId ID of collection1034 * @param propertyKeys array of property keys to delete1035 * @example deleteProperties(aliceKeyring, 10, ["gender", "age"]);1036 * @returns ```true``` if extrinsic success, otherwise ```false```1037 */1038 async deleteProperties(signer: TSigner, collectionId: number, propertyKeys: string[]): Promise<boolean> {1039 const result = await this.helper.executeExtrinsic(1040 signer,1041 'api.tx.unique.deleteCollectionProperties', [collectionId, propertyKeys],1042 true,1043 );10441045 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'CollectionPropertyDeleted');1046 }10471048 /**1049 * Changes the owner of the token.1050 *1051 * @param signer keyring of signer1052 * @param collectionId ID of collection1053 * @param tokenId ID of token1054 * @param addressObj address of a new owner1055 * @param amount amount of tokens to be transfered. For NFT must be set to 1n1056 * @example transferToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1057 * @returns true if the token success, otherwise false1058 */1059 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId, amount=1n): Promise<boolean> {1060 const result = await this.helper.executeExtrinsic(1061 signer,1062 'api.tx.unique.transfer', [addressObj, collectionId, tokenId, amount],1063 true, // `Unable to transfer token #${tokenId} from collection #${collectionId}`,1064 );10651066 return this.helper.util.isTokenTransferSuccess(result.result.events, collectionId, tokenId, {Substrate: typeof signer === 'string' ? signer : signer.address}, addressObj, amount);1067 }10681069 /**1070 *1071 * Change ownership of a token(s) on behalf of the owner.1072 *1073 * @param signer keyring of signer1074 * @param collectionId ID of collection1075 * @param tokenId ID of token1076 * @param fromAddressObj address on behalf of which the token will be sent1077 * @param toAddressObj new token owner1078 * @param amount amount of tokens to be transfered. For NFT must be set to 1n1079 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg"}, {Ethereum: "0x9F0583DbB85..."})1080 * @returns true if the token success, otherwise false1081 */1082 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1083 const result = await this.helper.executeExtrinsic(1084 signer,1085 'api.tx.unique.transferFrom', [fromAddressObj, toAddressObj, collectionId, tokenId, amount],1086 true, // `Unable to transfer token #${tokenId} from collection #${collectionId}`,1087 );1088 return this.helper.util.isTokenTransferSuccess(result.result.events, collectionId, tokenId, fromAddressObj, toAddressObj, amount);1089 }10901091 /**1092 *1093 * Destroys a concrete instance of NFT/RFT or burns a specified amount of fungible tokens.1094 *1095 * @param signer keyring of signer1096 * @param collectionId ID of collection1097 * @param tokenId ID of token1098 * @param amount amount of tokens to be burned. For NFT must be set to 1n1099 * @example burnToken(aliceKeyring, 10, 5);1100 * @returns ```true``` if the extrinsic is successful, otherwise ```false```1101 */1102 async burnToken(signer: TSigner, collectionId: number, tokenId: number, amount=1n): Promise<boolean> {1103 const burnResult = await this.helper.executeExtrinsic(1104 signer,1105 'api.tx.unique.burnItem', [collectionId, tokenId, amount],1106 true, // `Unable to burn token for ${label}`,1107 );1108 const burnedTokens = this.helper.util.extractTokensFromBurnResult(burnResult);1109 if (burnedTokens.tokens.length > 1) throw Error('Burned multiple tokens');1110 return burnedTokens.success;1111 }11121113 /**1114 * Destroys a concrete instance of NFT on behalf of the owner1115 *1116 * @param signer keyring of signer1117 * @param collectionId ID of collection1118 * @param tokenId ID of token1119 * @param fromAddressObj address on behalf of which the token will be burnt1120 * @param amount amount of tokens to be burned. For NFT must be set to 1n1121 * @example burnTokenFrom(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."}, 5, {Ethereum: "0x9F0583DbB85..."})1122 * @returns ```true``` if extrinsic success, otherwise ```false```1123 */1124 async burnTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1125 const burnResult = await this.helper.executeExtrinsic(1126 signer,1127 'api.tx.unique.burnFrom', [collectionId, fromAddressObj, tokenId, amount],1128 true, // `Unable to burn token from for ${label}`,1129 );1130 const burnedTokens = this.helper.util.extractTokensFromBurnResult(burnResult);1131 return burnedTokens.success && burnedTokens.tokens.length > 0;1132 }11331134 /**1135 * Set, change, or remove approved address to transfer the ownership of the NFT.1136 *1137 * @param signer keyring of signer1138 * @param collectionId ID of collection1139 * @param tokenId ID of token1140 * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens1141 * @param amount amount of token to be approved. For NFT must be set to 1n1142 * @returns ```true``` if extrinsic success, otherwise ```false```1143 */1144 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1145 const approveResult = await this.helper.executeExtrinsic(1146 signer,1147 'api.tx.unique.approve', [toAddressObj, collectionId, tokenId, amount],1148 true, // `Unable to approve token for ${label}`,1149 );11501151 return this.helper.util.findCollectionInEvents(approveResult.result.events, collectionId, 'common', 'Approved');1152 }11531154 /**1155 * Get the amount of token pieces approved to transfer or burn. Normally 0.1156 *1157 * @param collectionId ID of collection1158 * @param tokenId ID of token1159 * @param toAccountObj address which is approved to use token pieces1160 * @param fromAccountObj address which may have allowed the use of its owned tokens1161 * @example getTokenApprovedPieces(10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Substrate: "5ERZNF88Mm7UGfPP3mdG..."})1162 * @returns number of approved to transfer pieces1163 */1164 async getTokenApprovedPieces(collectionId: number, tokenId: number, toAccountObj: ICrossAccountId, fromAccountObj: ICrossAccountId): Promise<bigint> {1165 return (await this.helper.callRpc('api.rpc.unique.allowance', [collectionId, fromAccountObj, toAccountObj, tokenId])).toBigInt();1166 }11671168 /**1169 * Get the last created token ID in a collection1170 *1171 * @param collectionId ID of collection1172 * @example getLastTokenId(10);1173 * @returns id of the last created token1174 */1175 async getLastTokenId(collectionId: number): Promise<number> {1176 return (await this.helper.callRpc('api.rpc.unique.lastTokenId', [collectionId])).toNumber();1177 }11781179 /**1180 * Check if token exists1181 *1182 * @param collectionId ID of collection1183 * @param tokenId ID of token1184 * @example doesTokenExist(10, 20);1185 * @returns true if the token exists, otherwise false1186 */1187 async doesTokenExist(collectionId: number, tokenId: number): Promise<boolean> {1188 return (await this.helper.callRpc('api.rpc.unique.tokenExists', [collectionId, tokenId])).toJSON();1189 }1190}11911192class NFTnRFT extends CollectionGroup {1193 /**1194 * Get tokens owned by account1195 *1196 * @param collectionId ID of collection1197 * @param addressObj tokens owner1198 * @example getTokensByAddress(10, {Substrate: "5DyN4Y92vZCjv38fg..."})1199 * @returns array of token ids owned by account1200 */1201 async getTokensByAddress(collectionId: number, addressObj: ICrossAccountId): Promise<number[]> {1202 return (await this.helper.callRpc('api.rpc.unique.accountTokens', [collectionId, addressObj])).toJSON();1203 }12041205 /**1206 * Get token data1207 *1208 * @param collectionId ID of collection1209 * @param tokenId ID of token1210 * @param propertyKeys optionally filter the token properties to only these keys1211 * @param blockHashAt optionally query the data at some block with this hash1212 * @example getToken(10, 5);1213 * @returns human readable token data1214 */1215 async getToken(collectionId: number, tokenId: number, propertyKeys: string[] = [], blockHashAt?: string): Promise<{1216 properties: IProperty[];1217 owner: CrossAccountId;1218 normalizedOwner: CrossAccountId;1219 }| null> {1220 let tokenData;1221 if(typeof blockHashAt === 'undefined') {1222 tokenData = await this.helper.callRpc('api.rpc.unique.tokenData', [collectionId, tokenId]);1223 }1224 else {1225 if(propertyKeys.length == 0) {1226 const collection = (await this.helper.callRpc('api.rpc.unique.collectionById', [collectionId])).toHuman();1227 if(!collection) return null;1228 propertyKeys = collection.tokenPropertyPermissions.map((x: ITokenPropertyPermission) => x.key);1229 }1230 tokenData = await this.helper.callRpc('api.rpc.unique.tokenData', [collectionId, tokenId, propertyKeys, blockHashAt]);1231 }1232 tokenData = tokenData.toHuman();1233 if (tokenData === null || tokenData.owner === null) return null;1234 const owner = {} as any;1235 for (const key of Object.keys(tokenData.owner)) {1236 owner[key.toLocaleLowerCase()] = key.toLocaleLowerCase() == 'substrate' 1237 ? CrossAccountId.normalizeSubstrateAddress(tokenData.owner[key]) 1238 : tokenData.owner[key];1239 }1240 tokenData.normalizedOwner = CrossAccountId.fromLowerCaseKeys(owner);1241 return tokenData;1242 }12431244 /**1245 * Set permissions to change token properties1246 *1247 * @param signer keyring of signer1248 * @param collectionId ID of collection1249 * @param permissions permissions to change a property by the collection admin or token owner1250 * @example setTokenPropertyPermissions(1251 * aliceKeyring, 10, [{key: "gender", permission: {tokenOwner: true, mutable: true, collectionAdmin: true}}]1252 * )1253 * @returns true if extrinsic success otherwise false1254 */1255 async setTokenPropertyPermissions(signer: TSigner, collectionId: number, permissions: ITokenPropertyPermission[]): Promise<boolean> {1256 const result = await this.helper.executeExtrinsic(1257 signer,1258 'api.tx.unique.setTokenPropertyPermissions', [collectionId, permissions],1259 true,1260 );12611262 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'PropertyPermissionSet');1263 }12641265 /**1266 * Get token property permissions.1267 * 1268 * @param collectionId ID of collection1269 * @param propertyKeys optionally filter the returned property permissions to only these keys1270 * @example getPropertyPermissions(1219, ['location', 'date', 'time', 'isParadise']);1271 * @returns array of key-permission pairs1272 */1273 async getPropertyPermissions(collectionId: number, propertyKeys: string[] | null = null): Promise<ITokenPropertyPermission[]> {1274 return (await this.helper.callRpc('api.rpc.unique.propertyPermissions', [collectionId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();1275 }12761277 /**1278 * Set token properties1279 *1280 * @param signer keyring of signer1281 * @param collectionId ID of collection1282 * @param tokenId ID of token1283 * @param properties key-value pairs of metadata which to add to a token. Keys must be permitted in the collection1284 * @example setTokenProperties(aliceKeyring, 10, 5, [{key: "gender", value: "female"}, {key: "age", value: "23"}])1285 * @returns ```true``` if extrinsic success, otherwise ```false```1286 */1287 async setTokenProperties(signer: TSigner, collectionId: number, tokenId: number, properties: IProperty[]): Promise<boolean> {1288 const result = await this.helper.executeExtrinsic(1289 signer,1290 'api.tx.unique.setTokenProperties', [collectionId, tokenId, properties],1291 true,1292 );12931294 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'TokenPropertySet');1295 }12961297 /**1298 * Get properties, metadata assigned to a token.1299 * 1300 * @param collectionId ID of collection1301 * @param tokenId ID of token1302 * @param propertyKeys optionally filter the returned properties to only these keys1303 * @example getTokenProperties(1219, ['location', 'date', 'time', 'isParadise']);1304 * @returns array of key-value pairs1305 */1306 async getTokenProperties(collectionId: number, tokenId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {1307 return (await this.helper.callRpc('api.rpc.unique.tokenProperties', [collectionId, tokenId, propertyKeys])).toHuman();1308 }13091310 /**1311 * Delete the provided properties of a token1312 * @param signer keyring of signer1313 * @param collectionId ID of collection1314 * @param tokenId ID of token1315 * @param propertyKeys property keys to be deleted1316 * @example deleteTokenProperties(aliceKeyring, 10, 5, ["gender", "age"])1317 * @returns ```true``` if extrinsic success, otherwise ```false```1318 */1319 async deleteTokenProperties(signer: TSigner, collectionId: number, tokenId: number, propertyKeys: string[]): Promise<boolean> {1320 const result = await this.helper.executeExtrinsic(1321 signer,1322 'api.tx.unique.deleteTokenProperties', [collectionId, tokenId, propertyKeys],1323 true,1324 );13251326 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'common', 'TokenPropertyDeleted');1327 }13281329 /**1330 * Mint new collection1331 *1332 * @param signer keyring of signer1333 * @param collectionOptions basic collection options and properties1334 * @param mode NFT or RFT type of a collection1335 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")1336 * @returns object of the created collection1337 */1338 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueBaseCollection> {1339 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1340 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};1341 for (const key of ['name', 'description', 'tokenPrefix']) {1342 if (typeof collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] === 'string') collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] = this.helper.util.str2vec(collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] as string);1343 }1344 const creationResult = await this.helper.executeExtrinsic(1345 signer,1346 'api.tx.unique.createCollectionEx', [collectionOptions],1347 true, // errorLabel,1348 );1349 return this.getCollectionObject(this.helper.util.extractCollectionIdFromCreationResult(creationResult));1350 }13511352 getCollectionObject(_collectionId: number): any {1353 return null;1354 }13551356 getTokenObject(_collectionId: number, _tokenId: number): any {1357 return null;1358 }1359}136013611362class NFTGroup extends NFTnRFT {1363 /**1364 * Get collection object1365 * @param collectionId ID of collection1366 * @example getCollectionObject(2);1367 * @returns instance of UniqueNFTCollection1368 */1369 getCollectionObject(collectionId: number): UniqueNFTCollection {1370 return new UniqueNFTCollection(collectionId, this.helper);1371 }13721373 /**1374 * Get token object1375 * @param collectionId ID of collection1376 * @param tokenId ID of token1377 * @example getTokenObject(10, 5);1378 * @returns instance of UniqueNFTToken1379 */1380 getTokenObject(collectionId: number, tokenId: number): UniqueNFToken {1381 return new UniqueNFToken(tokenId, this.getCollectionObject(collectionId));1382 }13831384 /**1385 * Get token's owner1386 * @param collectionId ID of collection1387 * @param tokenId ID of token1388 * @param blockHashAt optionally query the data at the block with this hash1389 * @example getTokenOwner(10, 5);1390 * @returns Address in CrossAccountId format, e.g. {Substrate: "5DnSF6RRjwteE3BrCj..."}1391 */1392 async getTokenOwner(collectionId: number, tokenId: number, blockHashAt?: string): Promise<CrossAccountId> {1393 let owner;1394 if (typeof blockHashAt === 'undefined') {1395 owner = await this.helper.callRpc('api.rpc.unique.tokenOwner', [collectionId, tokenId]);1396 } else {1397 owner = await this.helper.callRpc('api.rpc.unique.tokenOwner', [collectionId, tokenId, blockHashAt]);1398 }1399 return CrossAccountId.fromLowerCaseKeys(owner.toJSON());1400 }14011402 /**1403 * Is token approved to transfer1404 * @param collectionId ID of collection1405 * @param tokenId ID of token1406 * @param toAccountObj address to be approved1407 * @returns ```true``` if extrinsic success, otherwise ```false```1408 */1409 async isTokenApproved(collectionId: number, tokenId: number, toAccountObj: ICrossAccountId): Promise<boolean> {1410 return (await this.getTokenApprovedPieces(collectionId, tokenId, toAccountObj, await this.getTokenOwner(collectionId, tokenId))) === 1n;1411 }14121413 /**1414 * Changes the owner of the token.1415 *1416 * @param signer keyring of signer1417 * @param collectionId ID of collection1418 * @param tokenId ID of token1419 * @param addressObj address of a new owner1420 * @example transferToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1421 * @returns ```true``` if extrinsic success, otherwise ```false```1422 */1423 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<boolean> {1424 return await super.transferToken(signer, collectionId, tokenId, addressObj, 1n);1425 }14261427 /**1428 *1429 * Change ownership of a NFT on behalf of the owner.1430 *1431 * @param signer keyring of signer1432 * @param collectionId ID of collection1433 * @param tokenId ID of token1434 * @param fromAddressObj address on behalf of which the token will be sent1435 * @param toAddressObj new token owner1436 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Ethereum: "0x9F0583DbB85..."})1437 * @returns ```true``` if extrinsic success, otherwise ```false```1438 */1439 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId): Promise<boolean> {1440 return await super.transferTokenFrom(signer, collectionId, tokenId, fromAddressObj, toAddressObj, 1n);1441 }14421443 /**1444 * Recursively find the address that owns the token1445 * @param collectionId ID of collection1446 * @param tokenId ID of token1447 * @param blockHashAt1448 * @example getTokenTopmostOwner(10, 5);1449 * @returns address in CrossAccountId format, e.g. {Substrate: "5DyN4Y92vZCjv38fg..."}1450 */1451 async getTokenTopmostOwner(collectionId: number, tokenId: number, blockHashAt?: string): Promise<CrossAccountId | null> {1452 let owner;1453 if (typeof blockHashAt === 'undefined') {1454 owner = await this.helper.callRpc('api.rpc.unique.topmostTokenOwner', [collectionId, tokenId]);1455 } else {1456 owner = await this.helper.callRpc('api.rpc.unique.topmostTokenOwner', [collectionId, tokenId, blockHashAt]);1457 }14581459 if (owner === null) return null;14601461 return owner.toHuman();1462 }14631464 /**1465 * Get tokens nested in the provided token1466 * @param collectionId ID of collection1467 * @param tokenId ID of token1468 * @param blockHashAt optionally query the data at the block with this hash1469 * @example getTokenChildren(10, 5);1470 * @returns tokens whose depth of nesting is <= 51471 */1472 async getTokenChildren(collectionId: number, tokenId: number, blockHashAt?: string): Promise<IToken[]> {1473 let children;1474 if(typeof blockHashAt === 'undefined') {1475 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId]);1476 } else {1477 children = await this.helper.callRpc('api.rpc.unique.tokenChildren', [collectionId, tokenId, blockHashAt]);1478 }14791480 return children.toJSON().map((x: any) => {1481 return {collectionId: x.collection, tokenId: x.token};1482 });1483 }14841485 /**1486 * Nest one token into another1487 * @param signer keyring of signer1488 * @param tokenObj token to be nested1489 * @param rootTokenObj token to be parent1490 * @example nestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4});1491 * @returns ```true``` if extrinsic success, otherwise ```false```1492 */1493 async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {1494 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1495 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);1496 if(!result) {1497 throw Error('Unable to nest token!');1498 }1499 return result;1500 }15011502 /**1503 * Remove token from nested state1504 * @param signer keyring of signer1505 * @param tokenObj token to unnest1506 * @param rootTokenObj parent of a token1507 * @param toAddressObj address of a new token owner1508 * @example unnestToken(aliceKeyring, {collectionId: 10, tokenId: 5}, {collectionId: 10, tokenId: 4}, {Substrate: "5DyN4Y92vZCjv38fg..."});1509 * @returns ```true``` if extrinsic success, otherwise ```false```1510 */1511 async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {1512 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);1513 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);1514 if(!result) {1515 throw Error('Unable to unnest token!');1516 }1517 return result;1518 }15191520 /**1521 * Mint new collection1522 * @param signer keyring of signer1523 * @param collectionOptions Collection options1524 * @example1525 * mintCollection(aliceKeyring, {1526 * name: 'New',1527 * description: 'New collection',1528 * tokenPrefix: 'NEW',1529 * })1530 * @returns object of the created collection1531 */1532 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueNFTCollection> {1533 return await super.mintCollection(signer, collectionOptions, 'NFT') as UniqueNFTCollection;1534 }15351536 /**1537 * Mint new token1538 * @param signer keyring of signer1539 * @param data token data1540 * @returns created token object1541 */1542 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFToken> {1543 const creationResult = await this.helper.executeExtrinsic(1544 signer,1545 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1546 nft: {1547 properties: data.properties,1548 },1549 }],1550 true,1551 );1552 const createdTokens = this.helper.util.extractTokensFromCreationResult(creationResult);1553 if (createdTokens.tokens.length > 1) throw Error('Minted multiple tokens');1554 if (createdTokens.tokens.length < 1) throw Error('No tokens minted');1555 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1556 }15571558 /**1559 * Mint multiple NFT tokens1560 * @param signer keyring of signer1561 * @param collectionId ID of collection1562 * @param tokens array of tokens with owner and properties1563 * @example1564 * mintMultipleTokens(aliceKeyring, 10, [{1565 * owner: {Substrate: "5DyN4Y92vZCjv38fg..."},1566 * properties: [{key: "gender", value: "male"},{key: "age", value: "45"}],1567 * },{1568 * owner: {Ethereum: "0x9F0583DbB855d..."},1569 * properties: [{key: "gender", value: "female"},{key: "age", value: "22"}],1570 * }]);1571 * @returns ```true``` if extrinsic success, otherwise ```false```1572 */1573 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1574 const creationResult = await this.helper.executeExtrinsic(1575 signer,1576 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],1577 true,1578 );1579 const collection = this.getCollectionObject(collectionId);1580 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1581 }15821583 /**1584 * Mint multiple NFT tokens with one owner1585 * @param signer keyring of signer1586 * @param collectionId ID of collection1587 * @param owner tokens owner1588 * @param tokens array of tokens with owner and properties1589 * @example1590 * mintMultipleTokensWithOneOwner(aliceKeyring, 10, "5DyN4Y92vZCjv38fg...", [{1591 * properties: [{1592 * key: "gender",1593 * value: "female",1594 * },{1595 * key: "age",1596 * value: "33",1597 * }],1598 * }]);1599 * @returns array of newly created tokens1600 */1601 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {1602 const rawTokens = [];1603 for (const token of tokens) {1604 const raw = {NFT: {properties: token.properties}};1605 rawTokens.push(raw);1606 }1607 const creationResult = await this.helper.executeExtrinsic(1608 signer,1609 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1610 true,1611 );1612 const collection = this.getCollectionObject(collectionId);1613 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1614 }16151616 /**1617 * Set, change, or remove approved address to transfer the ownership of the NFT.1618 *1619 * @param signer keyring of signer1620 * @param collectionId ID of collection1621 * @param tokenId ID of token1622 * @param toAddressObj address to approve1623 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1624 * @returns ```true``` if extrinsic success, otherwise ```false```1625 */1626 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {1627 return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);1628 }1629}163016311632class RFTGroup extends NFTnRFT {1633 /**1634 * Get collection object1635 * @param collectionId ID of collection1636 * @example getCollectionObject(2);1637 * @returns instance of UniqueRFTCollection1638 */1639 getCollectionObject(collectionId: number): UniqueRFTCollection {1640 return new UniqueRFTCollection(collectionId, this.helper);1641 }16421643 /**1644 * Get token object1645 * @param collectionId ID of collection1646 * @param tokenId ID of token1647 * @example getTokenObject(10, 5);1648 * @returns instance of UniqueNFTToken1649 */1650 getTokenObject(collectionId: number, tokenId: number): UniqueRFToken {1651 return new UniqueRFToken(tokenId, this.getCollectionObject(collectionId));1652 }16531654 /**1655 * Get top 10 token owners with the largest number of pieces1656 * @param collectionId ID of collection1657 * @param tokenId ID of token1658 * @example getTokenTop10Owners(10, 5);1659 * @returns array of top 10 owners1660 */1661 async getTokenTop10Owners(collectionId: number, tokenId: number): Promise<CrossAccountId[]> {1662 return (await this.helper.callRpc('api.rpc.unique.tokenOwners', [collectionId, tokenId])).toJSON().map(CrossAccountId.fromLowerCaseKeys);1663 }16641665 /**1666 * Get number of pieces owned by address1667 * @param collectionId ID of collection1668 * @param tokenId ID of token1669 * @param addressObj address token owner1670 * @example getTokenBalance(10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."});1671 * @returns number of pieces ownerd by address1672 */1673 async getTokenBalance(collectionId: number, tokenId: number, addressObj: ICrossAccountId): Promise<bigint> {1674 return (await this.helper.callRpc('api.rpc.unique.balance', [collectionId, addressObj, tokenId])).toBigInt();1675 }16761677 /**1678 * Transfer pieces of token to another address1679 * @param signer keyring of signer1680 * @param collectionId ID of collection1681 * @param tokenId ID of token1682 * @param addressObj address of a new owner1683 * @param amount number of pieces to be transfered1684 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, 2000n)1685 * @returns ```true``` if extrinsic success, otherwise ```false```1686 */1687 async transferToken(signer: TSigner, collectionId: number, tokenId: number, addressObj: ICrossAccountId, amount=1n): Promise<boolean> {1688 return await super.transferToken(signer, collectionId, tokenId, addressObj, amount);1689 }16901691 /**1692 * Change ownership of some pieces of RFT on behalf of the owner.1693 * @param signer keyring of signer1694 * @param collectionId ID of collection1695 * @param tokenId ID of token1696 * @param fromAddressObj address on behalf of which the token will be sent1697 * @param toAddressObj new token owner1698 * @param amount number of pieces to be transfered1699 * @example transferTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, {Substrate: "5DfhbVfww7ThF8q6f3i..."}, 2000n)1700 * @returns ```true``` if extrinsic success, otherwise ```false```1701 */1702 async transferTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1703 return await super.transferTokenFrom(signer, collectionId, tokenId, fromAddressObj, toAddressObj, amount);1704 }17051706 /**1707 * Mint new collection1708 * @param signer keyring of signer1709 * @param collectionOptions Collection options1710 * @example1711 * mintCollection(aliceKeyring, {1712 * name: 'New',1713 * description: 'New collection',1714 * tokenPrefix: 'NEW',1715 * })1716 * @returns object of the created collection1717 */1718 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueRFTCollection> {1719 return await super.mintCollection(signer, collectionOptions, 'RFT') as UniqueRFTCollection;1720 }17211722 /**1723 * Mint new token1724 * @param signer keyring of signer1725 * @param data token data1726 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});1727 * @returns created token object1728 */1729 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFToken> {1730 const creationResult = await this.helper.executeExtrinsic(1731 signer,1732 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1733 refungible: {1734 pieces: data.pieces,1735 properties: data.properties,1736 },1737 }],1738 true,1739 );1740 const createdTokens = this.helper.util.extractTokensFromCreationResult(creationResult);1741 if (createdTokens.tokens.length > 1) throw Error('Minted multiple tokens');1742 if (createdTokens.tokens.length < 1) throw Error('No tokens minted');1743 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1744 }17451746 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1747 throw Error('Not implemented');1748 const creationResult = await this.helper.executeExtrinsic(1749 signer,1750 'api.tx.unique.createMultipleItemsEx', [collectionId, {RefungibleMultipleOwners: tokens}],1751 true, // `Unable to mint RFT tokens for ${label}`,1752 );1753 const collection = this.getCollectionObject(collectionId);1754 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1755 }17561757 /**1758 * Mint multiple RFT tokens with one owner1759 * @param signer keyring of signer1760 * @param collectionId ID of collection1761 * @param owner tokens owner1762 * @param tokens array of tokens with properties and pieces1763 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);1764 * @returns array of newly created RFT tokens1765 */1766 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {1767 const rawTokens = [];1768 for (const token of tokens) {1769 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};1770 rawTokens.push(raw);1771 }1772 const creationResult = await this.helper.executeExtrinsic(1773 signer,1774 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1775 true,1776 );1777 const collection = this.getCollectionObject(collectionId);1778 return this.helper.util.extractTokensFromCreationResult(creationResult).tokens.map((x: IToken) => collection.getTokenObject(x.tokenId));1779 }17801781 /**1782 * Destroys a concrete instance of RFT.1783 * @param signer keyring of signer1784 * @param collectionId ID of collection1785 * @param tokenId ID of token1786 * @param amount number of pieces to be burnt1787 * @example burnToken(aliceKeyring, 10, 5);1788 * @returns ```true``` if the extrinsic is successful, otherwise ```false```1789 */1790 async burnToken(signer: IKeyringPair, collectionId: number, tokenId: number, amount=1n): Promise<boolean> {1791 return await super.burnToken(signer, collectionId, tokenId, amount);1792 }17931794 /**1795 * Destroys a concrete instance of RFT on behalf of the owner.1796 * @param signer keyring of signer1797 * @param collectionId ID of collection1798 * @param tokenId ID of token1799 * @param fromAddressObj address on behalf of which the token will be burnt1800 * @param amount number of pieces to be burnt1801 * @example burnTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, 2n)1802 * @returns ```true``` if extrinsic success, otherwise ```false```1803 */1804 async burnTokenFrom(signer: IKeyringPair, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1805 return await super.burnTokenFrom(signer, collectionId, tokenId, fromAddressObj, amount);1806 }18071808 /**1809 * Set, change, or remove approved address to transfer the ownership of the RFT.1810 *1811 * @param signer keyring of signer1812 * @param collectionId ID of collection1813 * @param tokenId ID of token1814 * @param toAddressObj address to approve1815 * @param amount number of pieces to be approved1816 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5GHoZe9c73RYbVzq..."}, "", 10000n);1817 * @returns true if the token success, otherwise false1818 */1819 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1820 return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);1821 }18221823 /**1824 * Get total number of pieces1825 * @param collectionId ID of collection1826 * @param tokenId ID of token1827 * @example getTokenTotalPieces(10, 5);1828 * @returns number of pieces1829 */1830 async getTokenTotalPieces(collectionId: number, tokenId: number): Promise<bigint> {1831 return (await this.helper.callRpc('api.rpc.unique.totalPieces', [collectionId, tokenId])).unwrap().toBigInt();1832 }18331834 /**1835 * Change number of token pieces. Signer must be the owner of all token pieces.1836 * @param signer keyring of signer1837 * @param collectionId ID of collection1838 * @param tokenId ID of token1839 * @param amount new number of pieces1840 * @example repartitionToken(aliceKeyring, 10, 5, 12345n);1841 * @returns true if the repartion was success, otherwise false1842 */1843 async repartitionToken(signer: TSigner, collectionId: number, tokenId: number, amount: bigint): Promise<boolean> {1844 const currentAmount = await this.getTokenTotalPieces(collectionId, tokenId);1845 const repartitionResult = await this.helper.executeExtrinsic(1846 signer,1847 'api.tx.unique.repartition', [collectionId, tokenId, amount],1848 true,1849 );1850 if(currentAmount < amount) return this.helper.util.findCollectionInEvents(repartitionResult.result.events, collectionId, 'common', 'ItemCreated');1851 return this.helper.util.findCollectionInEvents(repartitionResult.result.events, collectionId, 'common', 'ItemDestroyed');1852 }1853}185418551856class FTGroup extends CollectionGroup {1857 /**1858 * Get collection object1859 * @param collectionId ID of collection1860 * @example getCollectionObject(2);1861 * @returns instance of UniqueFTCollection1862 */1863 getCollectionObject(collectionId: number): UniqueFTCollection {1864 return new UniqueFTCollection(collectionId, this.helper);1865 }18661867 /**1868 * Mint new fungible collection1869 * @param signer keyring of signer1870 * @param collectionOptions Collection options1871 * @param decimalPoints number of token decimals1872 * @example1873 * mintCollection(aliceKeyring, {1874 * name: 'New',1875 * description: 'New collection',1876 * tokenPrefix: 'NEW',1877 * }, 18)1878 * @returns newly created fungible collection1879 */1880 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}, decimalPoints = 0): Promise<UniqueFTCollection> {1881 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1882 if(collectionOptions.tokenPropertyPermissions) throw Error('Fungible collections has no tokenPropertyPermissions');1883 collectionOptions.mode = {fungible: decimalPoints};1884 for (const key of ['name', 'description', 'tokenPrefix']) {1885 if (typeof collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] === 'string') collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] = this.helper.util.str2vec(collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] as string);1886 }1887 const creationResult = await this.helper.executeExtrinsic(1888 signer,1889 'api.tx.unique.createCollectionEx', [collectionOptions],1890 true,1891 );1892 return this.getCollectionObject(this.helper.util.extractCollectionIdFromCreationResult(creationResult));1893 }18941895 /**1896 * Mint tokens1897 * @param signer keyring of signer1898 * @param collectionId ID of collection1899 * @param owner address owner of new tokens1900 * @param amount amount of tokens to be meanted1901 * @example mintTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq"}, 1000n);1902 * @returns ```true``` if extrinsic success, otherwise ```false```1903 */1904 async mintTokens(signer: TSigner, collectionId: number, amount: bigint, owner: ICrossAccountId | string): Promise<boolean> {1905 const creationResult = await this.helper.executeExtrinsic(1906 signer,1907 'api.tx.unique.createItem', [collectionId, (typeof owner === 'string') ? {Substrate: owner} : owner, {1908 fungible: {1909 value: amount,1910 },1911 }],1912 true, // `Unable to mint fungible tokens for ${label}`,1913 );1914 return this.helper.util.findCollectionInEvents(creationResult.result.events, collectionId, 'common', 'ItemCreated');1915 }19161917 /**1918 * Mint multiple Fungible tokens with one owner1919 * @param signer keyring of signer1920 * @param collectionId ID of collection1921 * @param owner tokens owner1922 * @param tokens array of tokens with properties and pieces1923 * @returns ```true``` if extrinsic success, otherwise ```false```1924 */1925 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, tokens: {value: bigint}[], owner: ICrossAccountId): Promise<boolean> {1926 const rawTokens = [];1927 for (const token of tokens) {1928 const raw = {Fungible: {Value: token.value}};1929 rawTokens.push(raw);1930 }1931 const creationResult = await this.helper.executeExtrinsic(1932 signer,1933 'api.tx.unique.createMultipleItems', [collectionId, owner, rawTokens],1934 true,1935 );1936 return this.helper.util.findCollectionInEvents(creationResult.result.events, collectionId, 'common', 'ItemCreated');1937 }19381939 /**1940 * Get the top 10 owners with the largest balance for the Fungible collection1941 * @param collectionId ID of collection1942 * @example getTop10Owners(10);1943 * @returns array of ```ICrossAccountId```1944 */1945 async getTop10Owners(collectionId: number): Promise<CrossAccountId[]> {1946 return (await this.helper.callRpc('api.rpc.unique.tokenOwners', [collectionId, 0])).toJSON().map(CrossAccountId.fromLowerCaseKeys);1947 }19481949 /**1950 * Get account balance1951 * @param collectionId ID of collection1952 * @param addressObj address of owner1953 * @example getBalance(10, {Substrate: "5GHoZe9c73RYbVzq..."})1954 * @returns amount of fungible tokens owned by address1955 */1956 async getBalance(collectionId: number, addressObj: ICrossAccountId): Promise<bigint> {1957 return (await this.helper.callRpc('api.rpc.unique.balance', [collectionId, addressObj, 0])).toBigInt();1958 }19591960 /**1961 * Transfer tokens to address1962 * @param signer keyring of signer1963 * @param collectionId ID of collection1964 * @param toAddressObj address recipient1965 * @param amount amount of tokens to be sent1966 * @example transfer(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n);1967 * @returns ```true``` if extrinsic success, otherwise ```false```1968 */1969 async transfer(signer: TSigner, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {1970 return await super.transferToken(signer, collectionId, 0, toAddressObj, amount);1971 }19721973 /**1974 * Transfer some tokens on behalf of the owner.1975 * @param signer keyring of signer1976 * @param collectionId ID of collection1977 * @param fromAddressObj address on behalf of which tokens will be sent1978 * @param toAddressObj address where token to be sent1979 * @param amount number of tokens to be sent1980 * @example transferFrom(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, {Substrate: "5DfhbVfww7ThF8q6f3ij..."}, 10000n);1981 * @returns ```true``` if extrinsic success, otherwise ```false```1982 */1983 async transferFrom(signer: TSigner, collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {1984 return await super.transferTokenFrom(signer, collectionId, 0, fromAddressObj, toAddressObj, amount);1985 }19861987 /**1988 * Destroy some amount of tokens1989 * @param signer keyring of signer1990 * @param collectionId ID of collection1991 * @param amount amount of tokens to be destroyed1992 * @example burnTokens(aliceKeyring, 10, 1000n);1993 * @returns ```true``` if extrinsic success, otherwise ```false```1994 */1995 async burnTokens(signer: IKeyringPair, collectionId: number, amount=1n): Promise<boolean> {1996 return await super.burnToken(signer, collectionId, 0, amount);1997 }19981999 /**2000 * Burn some tokens on behalf of the owner.2001 * @param signer keyring of signer2002 * @param collectionId ID of collection2003 * @param fromAddressObj address on behalf of which tokens will be burnt2004 * @param amount amount of tokens to be burnt2005 * @example burnTokensFrom(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n);2006 * @returns ```true``` if extrinsic success, otherwise ```false```2007 */2008 async burnTokensFrom(signer: IKeyringPair, collectionId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {2009 return await super.burnTokenFrom(signer, collectionId, 0, fromAddressObj, amount);2010 }20112012 /**2013 * Get total collection supply2014 * @param collectionId2015 * @returns2016 */2017 async getTotalPieces(collectionId: number): Promise<bigint> {2018 return (await this.helper.callRpc('api.rpc.unique.totalPieces', [collectionId, 0])).unwrap().toBigInt();2019 }20202021 /**2022 * Set, change, or remove approved address to transfer tokens.2023 *2024 * @param signer keyring of signer2025 * @param collectionId ID of collection2026 * @param toAddressObj address to be approved2027 * @param amount amount of tokens to be approved2028 * @example approveTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n)2029 * @returns ```true``` if extrinsic success, otherwise ```false```2030 */2031 async approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {2032 return super.approveToken(signer, collectionId, 0, toAddressObj, amount);2033 }20342035 /**2036 * Get amount of fungible tokens approved to transfer2037 * @param collectionId ID of collection2038 * @param fromAddressObj owner of tokens2039 * @param toAddressObj the address approved for the transfer of tokens on behalf of the owner2040 * @returns number of tokens approved for the transfer2041 */2042 async getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2043 return super.getTokenApprovedPieces(collectionId, 0, toAddressObj, fromAddressObj);2044 }2045}204620472048class ChainGroup extends HelperGroup<ChainHelperBase> {2049 /**2050 * Get system properties of a chain2051 * @example getChainProperties();2052 * @returns ss58Format, token decimals, and token symbol2053 */2054 getChainProperties(): IChainProperties {2055 const properties = (this.helper.getApi() as any).registry.getChainProperties().toJSON();2056 return {2057 ss58Format: properties.ss58Format.toJSON(),2058 tokenDecimals: properties.tokenDecimals.toJSON(),2059 tokenSymbol: properties.tokenSymbol.toJSON(),2060 };2061 }20622063 /**2064 * Get chain header2065 * @example getLatestBlockNumber();2066 * @returns the number of the last block2067 */2068 async getLatestBlockNumber(): Promise<number> {2069 return (await this.helper.callRpc('api.rpc.chain.getHeader')).number.toNumber();2070 }20712072 /**2073 * Get block hash by block number2074 * @param blockNumber number of block2075 * @example getBlockHashByNumber(12345);2076 * @returns hash of a block2077 */2078 async getBlockHashByNumber(blockNumber: number): Promise<string | null> {2079 const blockHash = (await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])).toJSON();2080 if(blockHash === '0x0000000000000000000000000000000000000000000000000000000000000000') return null;2081 return blockHash;2082 }20832084 // TODO add docs2085 async getBlock(blockHashOrNumber: string | number): Promise<IBlock | null> {2086 const blockHash = typeof blockHashOrNumber === 'string' ? blockHashOrNumber : await this.getBlockHashByNumber(blockHashOrNumber);2087 if (!blockHash) return null;2088 return (await this.helper.callRpc('api.rpc.chain.getBlock', [blockHash])).toHuman().block;2089 }20902091 /**2092 * Get account nonce2093 * @param address substrate address2094 * @example getNonce("5GrwvaEF5zXb26Fz...");2095 * @returns number, account's nonce2096 */2097 async getNonce(address: TSubstrateAccount): Promise<number> {2098 return (await this.helper.callRpc('api.query.system.account', [address])).nonce.toNumber();2099 }2100}21012102class SubstrateBalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2103 /**2104 * Get substrate address balance2105 * @param address substrate address2106 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2107 * @returns amount of tokens on address2108 */2109 async getSubstrate(address: TSubstrateAccount): Promise<bigint> {2110 return (await this.helper.callRpc('api.query.system.account', [address])).data.free.toBigInt();2111 }21122113 /**2114 * Transfer tokens to substrate address2115 * @param signer keyring of signer2116 * @param address substrate address of a recipient2117 * @param amount amount of tokens to be transfered2118 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2119 * @returns ```true``` if extrinsic success, otherwise ```false```2120 */2121 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2122 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true/*, `Unable to transfer balance from ${this.helper.getSignerAddress(signer)} to ${address}`*/);21232124 let transfer = {from: null, to: null, amount: 0n} as any;2125 result.result.events.forEach(({event: {data, method, section}}) => {2126 if ((section === 'balances') && (method === 'Transfer')) {2127 transfer = {2128 from: this.helper.address.normalizeSubstrate(data[0]),2129 to: this.helper.address.normalizeSubstrate(data[1]),2130 amount: BigInt(data[2]),2131 };2132 }2133 });2134 const isSuccess = this.helper.address.normalizeSubstrate(typeof signer === 'string' ? signer : signer.address) === transfer.from 2135 && this.helper.address.normalizeSubstrate(address) === transfer.to 2136 && BigInt(amount) === transfer.amount;2137 return isSuccess;2138 }21392140 /**2141 * Get full substrate balance including free, miscFrozen, feeFrozen, and reserved2142 * @param address substrate address2143 * @returns2144 */2145 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2146 const accountInfo = (await this.helper.callRpc('api.query.system.account', [address])).data;2147 return {free: accountInfo.free.toBigInt(), miscFrozen: accountInfo.miscFrozen.toBigInt(), feeFrozen: accountInfo.feeFrozen.toBigInt(), reserved: accountInfo.reserved.toBigInt()};2148 }2149}21502151class EthereumBalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2152 /**2153 * Get ethereum address balance2154 * @param address ethereum address2155 * @example getEthereum("0x9F0583DbB855d...")2156 * @returns amount of tokens on address2157 */2158 async getEthereum(address: TEthereumAccount): Promise<bigint> {2159 return (await this.helper.callRpc('api.rpc.eth.getBalance', [address])).toBigInt();2160 }21612162 /**2163 * Transfer tokens to address2164 * @param signer keyring of signer2165 * @param address Ethereum address of a recipient2166 * @param amount amount of tokens to be transfered2167 * @example transferToEthereum(alithKeyring, "0x9F0583DbB855d...", 100_000_000_000n);2168 * @returns ```true``` if extrinsic success, otherwise ```false```2169 */2170 async transferToEthereum(signer: TSigner, address: TEthereumAccount, amount: bigint | string): Promise<boolean> {2171 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true);21722173 let transfer = {from: null, to: null, amount: 0n} as any;2174 result.result.events.forEach(({event: {data, method, section}}) => {2175 if ((section === 'balances') && (method === 'Transfer')) {2176 transfer = {2177 from: data[0].toString(),2178 to: data[1].toString(),2179 amount: BigInt(data[2]),2180 };2181 }2182 });2183 const isSuccess = (typeof signer === 'string' ? signer : signer.address) === transfer.from 2184 && address === transfer.to 2185 && BigInt(amount) === transfer.amount;2186 return isSuccess;2187 }2188}21892190class BalanceGroup<T extends ChainHelperBase> extends HelperGroup<T> {2191 subBalanceGroup: SubstrateBalanceGroup<T>;2192 ethBalanceGroup: EthereumBalanceGroup<T>;21932194 constructor(helper: T) {2195 super(helper);2196 this.subBalanceGroup = new SubstrateBalanceGroup(helper);2197 this.ethBalanceGroup = new EthereumBalanceGroup(helper);2198 }21992200 getCollectionCreationPrice(): bigint {2201 return 2n * this.getOneTokenNominal();2202 }2203 /**2204 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).2205 * @example getOneTokenNominal()2206 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.2207 */2208 getOneTokenNominal(): bigint {2209 const chainProperties = this.helper.chain.getChainProperties();2210 return 10n ** BigInt((chainProperties.tokenDecimals || [18])[0]);2211 }22122213 /**2214 * Get substrate address balance2215 * @param address substrate address2216 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2217 * @returns amount of tokens on address2218 */2219 async getSubstrate(address: TSubstrateAccount): Promise<bigint> {2220 return this.subBalanceGroup.getSubstrate(address);2221 }22222223 /**2224 * Get full substrate balance including free, miscFrozen, feeFrozen, and reserved2225 * @param address substrate address2226 * @returns2227 */2228 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2229 return this.subBalanceGroup.getSubstrateFull(address);2230 }22312232 /**2233 * Get ethereum address balance2234 * @param address ethereum address2235 * @example getEthereum("0x9F0583DbB855d...")2236 * @returns amount of tokens on address2237 */2238 async getEthereum(address: TEthereumAccount): Promise<bigint> {2239 return this.ethBalanceGroup.getEthereum(address);2240 }22412242 /**2243 * Transfer tokens to substrate address2244 * @param signer keyring of signer2245 * @param address substrate address of a recipient2246 * @param amount amount of tokens to be transfered2247 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2248 * @returns ```true``` if extrinsic success, otherwise ```false```2249 */2250 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2251 return this.subBalanceGroup.transferToSubstrate(signer, address, amount);2252 }2253}22542255class AddressGroup extends HelperGroup<ChainHelperBase> {2256 /**2257 * Normalizes the address to the specified ss58 format, by default ```42```.2258 * @param address substrate address2259 * @param ss58Format format for address conversion, by default ```42```2260 * @example normalizeSubstrate("unjKJQJrRd238pkUZZvzDQrfKuM39zBSnQ5zjAGAGcdRhaJTx") // returns 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY2261 * @returns substrate address converted to normalized (i.e., starting with 5) or specified explicitly representation2262 */2263 normalizeSubstrate(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {2264 return CrossAccountId.normalizeSubstrateAddress(address, ss58Format);2265 }22662267 /**2268 * Get address in the connected chain format2269 * @param address substrate address2270 * @example normalizeSubstrateToChainFormat("5GrwvaEF5zXb26Fz...") // returns unjKJQJrRd238pkUZZ... for Unique Network2271 * @returns address in chain format2272 */2273 normalizeSubstrateToChainFormat(address: TSubstrateAccount): TSubstrateAccount {2274 return this.normalizeSubstrate(address, this.helper.chain.getChainProperties().ss58Format);2275 }22762277 /**2278 * Get substrate mirror of an ethereum address2279 * @param ethAddress ethereum address2280 * @param toChainFormat false for normalized account2281 * @example ethToSubstrate('0x9F0583DbB855d...')2282 * @returns substrate mirror of a provided ethereum address2283 */2284 ethToSubstrate(ethAddress: TEthereumAccount, toChainFormat=false): TSubstrateAccount {2285 return CrossAccountId.translateEthToSub(ethAddress, toChainFormat ? this.helper.chain.getChainProperties().ss58Format : undefined);2286 }22872288 /**2289 * Get ethereum mirror of a substrate address2290 * @param subAddress substrate account2291 * @example substrateToEth("5DnSF6RRjwteE3BrC...")2292 * @returns ethereum mirror of a provided substrate address2293 */2294 substrateToEth(subAddress: TSubstrateAccount): TEthereumAccount {2295 return CrossAccountId.translateSubToEth(subAddress);2296 }22972298 paraSiblingSovereignAccount(paraid: number) {2299 // We are getting a *sibling* parachain sovereign account,2300 // so we need a sibling prefix: encoded(b"sibl") == 0x7369626c2301 const siblingPrefix = '0x7369626c';23022303 const encodedParaId = this.helper.getApi().createType('u32', paraid).toHex(true).substring(2);2304 const suffix = '000000000000000000000000000000000000000000000000';23052306 return siblingPrefix + encodedParaId + suffix;2307 }2308}23092310class StakingGroup extends HelperGroup<UniqueHelper> {2311 /**2312 * Stake tokens for App Promotion2313 * @param signer keyring of signer2314 * @param amountToStake amount of tokens to stake2315 * @param label extra label for log2316 * @returns2317 */2318 async stake(signer: TSigner, amountToStake: bigint, label?: string): Promise<boolean> {2319 if(typeof label === 'undefined') label = `${signer.address} amount: ${amountToStake}`;2320 const _stakeResult = await this.helper.executeExtrinsic(2321 signer, 'api.tx.appPromotion.stake',2322 [amountToStake], true,2323 );2324 // TODO extract info from stakeResult2325 return true;2326 }23272328 /**2329 * Unstake tokens for App Promotion2330 * @param signer keyring of signer2331 * @param amountToUnstake amount of tokens to unstake2332 * @param label extra label for log2333 * @returns block number where balances will be unlocked2334 */2335 async unstake(signer: TSigner, label?: string): Promise<number> {2336 if(typeof label === 'undefined') label = `${signer.address}`;2337 const _unstakeResult = await this.helper.executeExtrinsic(2338 signer, 'api.tx.appPromotion.unstake',2339 [], true,2340 );2341 // TODO extract block number fron events2342 return 1;2343 }23442345 /**2346 * Get total staked amount for address2347 * @param address substrate or ethereum address2348 * @returns total staked amount2349 */2350 async getTotalStaked(address?: ICrossAccountId): Promise<bigint> {2351 if (address) return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked', [address])).toBigInt();2352 return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked')).toBigInt();2353 }23542355 /**2356 * Get total staked per block2357 * @param address substrate or ethereum address2358 * @returns array of stakes. `block` – the number of the block in which the stake was made. `amount` - the number of tokens staked in the block2359 */2360 async getTotalStakedPerBlock(address: ICrossAccountId): Promise<IStakingInfo[]> {2361 const rawTotalStakerdPerBlock = await this.helper.callRpc('api.rpc.appPromotion.totalStakedPerBlock', [address]);2362 return rawTotalStakerdPerBlock.map(([block, amount]: any[]) => {2363 return { 2364 block: block.toBigInt(),2365 amount: amount.toBigInt(),2366 };2367 });2368 }23692370 /**2371 * Get total pending unstake amount for address2372 * @param address substrate or ethereum address2373 * @returns total pending unstake amount2374 */2375 async getPendingUnstake(address: ICrossAccountId): Promise<bigint> {2376 return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstake', [address])).toBigInt();2377 }23782379 /**2380 * Get pending unstake amount per block for address2381 * @param address substrate or ethereum address2382 * @returns array of pending stakes. `block` – the number of the block in which the unstake was made. `amount` - the number of tokens unstaked in the block2383 */2384 async getPendingUnstakePerBlock(address: ICrossAccountId): Promise<IStakingInfo[]> {2385 const rawUnstakedPerBlock = await this.helper.callRpc('api.rpc.appPromotion.pendingUnstakePerBlock', [address]);2386 const result = rawUnstakedPerBlock.map(([block, amount]: any[]) => {2387 return {2388 block: block.toBigInt(),2389 amount: amount.toBigInt(),2390 };2391 });2392 return result;2393 }2394}23952396class SchedulerGroup extends HelperGroup<UniqueHelper> {2397 constructor(helper: UniqueHelper) {2398 super(helper);2399 }24002401 async cancelScheduled(signer: TSigner, scheduledId: string) {2402 return this.helper.executeExtrinsic(2403 signer,2404 'api.tx.scheduler.cancelNamed',2405 [scheduledId],2406 true,2407 );2408 }24092410 async changePriority(signer: TSigner, scheduledId: string, priority: number) {2411 return this.helper.executeExtrinsic(2412 signer,2413 'api.tx.scheduler.changeNamedPriority',2414 [scheduledId, priority],2415 true,2416 );2417 }24182419 scheduleAt<T extends UniqueHelper>(2420 scheduledId: string,2421 executionBlockNumber: number,2422 options: ISchedulerOptions = {},2423 ) {2424 return this.schedule<T>('scheduleNamed', scheduledId, executionBlockNumber, options);2425 }24262427 scheduleAfter<T extends UniqueHelper>(2428 scheduledId: string,2429 blocksBeforeExecution: number,2430 options: ISchedulerOptions = {},2431 ) {2432 return this.schedule<T>('scheduleNamedAfter', scheduledId, blocksBeforeExecution, options);2433 }24342435 schedule<T extends UniqueHelper>(2436 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',2437 scheduledId: string,2438 blocksNum: number,2439 options: ISchedulerOptions = {},2440 ) {2441 // eslint-disable-next-line @typescript-eslint/naming-convention2442 const ScheduledHelperType = ScheduledUniqueHelper(this.helper.helperBase);2443 return this.helper.clone(ScheduledHelperType, {2444 scheduleFn,2445 scheduledId,2446 blocksNum,2447 options,2448 }) as T;2449 }2450}24512452class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {2453 async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {2454 await this.helper.executeExtrinsic(2455 signer,2456 'api.tx.foreignAssets.registerForeignAsset',2457 [ownerAddress, location, metadata],2458 true,2459 );2460 }24612462 async update(signer: TSigner, foreignAssetId: number, location: any, metadata: IForeignAssetMetadata) {2463 await this.helper.executeExtrinsic(2464 signer,2465 'api.tx.foreignAssets.updateForeignAsset',2466 [foreignAssetId, location, metadata],2467 true,2468 );2469 }2470}24712472class XcmGroup<T extends ChainHelperBase> extends HelperGroup<T> {2473 palletName: string;24742475 constructor(helper: T, palletName: string) {2476 super(helper);24772478 this.palletName = palletName;2479 }24802481 async limitedReserveTransferAssets(signer: TSigner, destination: any, beneficiary: any, assets: any, feeAssetItem: number, weightLimit: number) {2482 await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.limitedReserveTransferAssets`, [destination, beneficiary, assets, feeAssetItem, {Limited: weightLimit}], true);2483 }2484}24852486class XTokensGroup<T extends ChainHelperBase> extends HelperGroup<T> {2487 async transfer(signer: TSigner, currencyId: any, amount: bigint, destination: any, destWeight: number) {2488 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transfer', [currencyId, amount, destination, destWeight], true);2489 }24902491 async transferMultiasset(signer: TSigner, asset: any, destination: any, destWeight: number) {2492 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transferMultiasset', [asset, destination, destWeight], true);2493 }24942495 async transferMulticurrencies(signer: TSigner, currencies: any[], feeItem: number, destLocation: any, destWeight: number) {2496 await this.helper.executeExtrinsic(signer, 'api.tx.xTokens.transferMulticurrencies', [currencies, feeItem, destLocation, destWeight], true);2497 }2498}24992500class TokensGroup<T extends ChainHelperBase> extends HelperGroup<T> {2501 async accounts(address: string, currencyId: any) {2502 const {free} = (await this.helper.callRpc('api.query.tokens.accounts', [address, currencyId])).toJSON() as any;2503 return BigInt(free);2504 }2505}25062507class AssetsGroup<T extends ChainHelperBase> extends HelperGroup<T> {2508 async create(signer: TSigner, assetId: number, admin: string, minimalBalance: bigint) {2509 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);2510 }25112512 async setMetadata(signer: TSigner, assetId: number, name: string, symbol: string, decimals: number) {2513 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);2514 }25152516 async mint(signer: TSigner, assetId: number, beneficiary: string, amount: bigint) {2517 await this.helper.executeExtrinsic(signer, 'api.tx.assets.mint', [assetId, beneficiary, amount], true);2518 }25192520 async account(assetId: string | number, address: string) {2521 const accountAsset = (2522 await this.helper.callRpc('api.query.assets.account', [assetId, address])2523 ).toJSON()! as any;25242525 if (accountAsset !== null) {2526 return BigInt(accountAsset['balance']);2527 } else {2528 return null;2529 }2530 }2531}25322533class AcalaAssetRegistryGroup extends HelperGroup<AcalaHelper> {2534 async registerForeignAsset(signer: TSigner, destination: any, metadata: AcalaAssetMetadata) {2535 await this.helper.executeExtrinsic(signer, 'api.tx.assetRegistry.registerForeignAsset', [destination, metadata], true);2536 }2537}25382539class MoonbeamAssetManagerGroup extends HelperGroup<MoonbeamHelper> {2540 makeRegisterForeignAssetProposal(assetInfo: MoonbeamAssetInfo) {2541 const apiPrefix = 'api.tx.assetManager.';25422543 const registerTx = this.helper.constructApiCall(2544 apiPrefix + 'registerForeignAsset',2545 [assetInfo.location, assetInfo.metadata, assetInfo.existentialDeposit, assetInfo.isSufficient],2546 );25472548 const setUnitsTx = this.helper.constructApiCall(2549 apiPrefix + 'setAssetUnitsPerSecond',2550 [assetInfo.location, assetInfo.unitsPerSecond, assetInfo.numAssetsWeightHint],2551 );25522553 const batchCall = this.helper.getApi().tx.utility.batchAll([registerTx, setUnitsTx]);2554 const encodedProposal = batchCall?.method.toHex() || '';2555 return encodedProposal;2556 }25572558 async assetTypeId(location: any) {2559 return await this.helper.callRpc('api.query.assetManager.assetTypeId', [location]);2560 }2561}25622563class MoonbeamDemocracyGroup extends HelperGroup<MoonbeamHelper> {2564 async notePreimage(signer: TSigner, encodedProposal: string) {2565 await this.helper.executeExtrinsic(signer, 'api.tx.democracy.notePreimage', [encodedProposal], true);2566 }25672568 externalProposeMajority(proposalHash: string) {2569 return this.helper.constructApiCall('api.tx.democracy.externalProposeMajority', [proposalHash]);2570 }25712572 fastTrack(proposalHash: string, votingPeriod: number, delayPeriod: number) {2573 return this.helper.constructApiCall('api.tx.democracy.fastTrack', [proposalHash, votingPeriod, delayPeriod]);2574 }25752576 async referendumVote(signer: TSigner, referendumIndex: number, accountVote: DemocracyStandardAccountVote) {2577 await this.helper.executeExtrinsic(signer, 'api.tx.democracy.vote', [referendumIndex, {Standard: accountVote}], true);2578 }2579}25802581class MoonbeamCollectiveGroup extends HelperGroup<MoonbeamHelper> {2582 collective: string;25832584 constructor(helper: MoonbeamHelper, collective: string) {2585 super(helper);25862587 this.collective = collective;2588 }25892590 async propose(signer: TSigner, threshold: number, proposalHash: string, lengthBound: number) {2591 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.propose`, [threshold, proposalHash, lengthBound], true);2592 }25932594 async vote(signer: TSigner, proposalHash: string, proposalIndex: number, approve: boolean) {2595 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.vote`, [proposalHash, proposalIndex, approve], true);2596 }25972598 async close(signer: TSigner, proposalHash: string, proposalIndex: number, weightBound: number, lengthBound: number) {2599 await this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.close`, [proposalHash, proposalIndex, weightBound, lengthBound], true);2600 }26012602 async proposalCount() {2603 return Number(await this.helper.callRpc(`api.query.${this.collective}.proposalCount`, []));2604 }2605}26062607export type ChainHelperBaseConstructor = new(...args: any[]) => ChainHelperBase;2608export type UniqueHelperConstructor = new(...args: any[]) => UniqueHelper;26092610export class UniqueHelper extends ChainHelperBase {2611 balance: BalanceGroup<UniqueHelper>;2612 collection: CollectionGroup;2613 nft: NFTGroup;2614 rft: RFTGroup;2615 ft: FTGroup;2616 staking: StakingGroup;2617 scheduler: SchedulerGroup;2618 foreignAssets: ForeignAssetsGroup;2619 xcm: XcmGroup<UniqueHelper>;2620 xTokens: XTokensGroup<UniqueHelper>;2621 tokens: TokensGroup<UniqueHelper>;26222623 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2624 super(logger, options.helperBase ?? UniqueHelper);26252626 this.balance = new BalanceGroup(this);2627 this.collection = new CollectionGroup(this);2628 this.nft = new NFTGroup(this);2629 this.rft = new RFTGroup(this);2630 this.ft = new FTGroup(this);2631 this.staking = new StakingGroup(this);2632 this.scheduler = new SchedulerGroup(this);2633 this.foreignAssets = new ForeignAssetsGroup(this);2634 this.xcm = new XcmGroup(this, 'polkadotXcm');2635 this.xTokens = new XTokensGroup(this);2636 this.tokens = new TokensGroup(this);2637 }26382639 getSudo<T extends UniqueHelper>() {2640 // eslint-disable-next-line @typescript-eslint/naming-convention2641 const SudoHelperType = SudoHelper(this.helperBase);2642 return this.clone(SudoHelperType) as T;2643 }2644}26452646export class XcmChainHelper extends ChainHelperBase {2647 async connect(wsEndpoint: string, _listeners?: any): Promise<void> {2648 const wsProvider = new WsProvider(wsEndpoint);2649 this.api = new ApiPromise({2650 provider: wsProvider,2651 });2652 await this.api.isReadyOrError;2653 this.network = await UniqueHelper.detectNetwork(this.api);2654 }2655}26562657export class RelayHelper extends XcmChainHelper {2658 xcm: XcmGroup<RelayHelper>;26592660 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2661 super(logger, options.helperBase ?? RelayHelper);26622663 this.xcm = new XcmGroup(this, 'xcmPallet');2664 }2665}26662667export class WestmintHelper extends XcmChainHelper {2668 balance: SubstrateBalanceGroup<WestmintHelper>;2669 xcm: XcmGroup<WestmintHelper>;2670 assets: AssetsGroup<WestmintHelper>;2671 xTokens: XTokensGroup<WestmintHelper>;26722673 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2674 super(logger, options.helperBase ?? WestmintHelper);26752676 this.balance = new SubstrateBalanceGroup(this);2677 this.xcm = new XcmGroup(this, 'polkadotXcm');2678 this.assets = new AssetsGroup(this);2679 this.xTokens = new XTokensGroup(this);2680 }2681}26822683export class MoonbeamHelper extends XcmChainHelper {2684 balance: EthereumBalanceGroup<MoonbeamHelper>;2685 assetManager: MoonbeamAssetManagerGroup;2686 assets: AssetsGroup<MoonbeamHelper>;2687 xTokens: XTokensGroup<MoonbeamHelper>;2688 democracy: MoonbeamDemocracyGroup;2689 collective: {2690 council: MoonbeamCollectiveGroup,2691 techCommittee: MoonbeamCollectiveGroup,2692 };26932694 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2695 super(logger, options.helperBase ?? MoonbeamHelper);26962697 this.balance = new EthereumBalanceGroup(this);2698 this.assetManager = new MoonbeamAssetManagerGroup(this);2699 this.assets = new AssetsGroup(this);2700 this.xTokens = new XTokensGroup(this);2701 this.democracy = new MoonbeamDemocracyGroup(this);2702 this.collective = {2703 council: new MoonbeamCollectiveGroup(this, 'councilCollective'),2704 techCommittee: new MoonbeamCollectiveGroup(this, 'techCommitteeCollective'),2705 };2706 }2707}27082709export class AcalaHelper extends XcmChainHelper {2710 balance: SubstrateBalanceGroup<AcalaHelper>;2711 assetRegistry: AcalaAssetRegistryGroup;2712 xTokens: XTokensGroup<AcalaHelper>;2713 tokens: TokensGroup<AcalaHelper>;27142715 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2716 super(logger, options.helperBase ?? AcalaHelper);27172718 this.balance = new SubstrateBalanceGroup(this);2719 this.assetRegistry = new AcalaAssetRegistryGroup(this);2720 this.xTokens = new XTokensGroup(this);2721 this.tokens = new TokensGroup(this);2722 }27232724 getSudo<T extends AcalaHelper>() {2725 // eslint-disable-next-line @typescript-eslint/naming-convention2726 const SudoHelperType = SudoHelper(this.helperBase);2727 return this.clone(SudoHelperType) as T;2728 }2729}27302731// eslint-disable-next-line @typescript-eslint/naming-convention2732function ScheduledUniqueHelper<T extends UniqueHelperConstructor>(Base: T) {2733 return class extends Base {2734 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter';2735 scheduledId: string;2736 blocksNum: number;2737 options: ISchedulerOptions;27382739 constructor(...args: any[]) {2740 const logger = args[0] as ILogger;2741 const options = args[1] as {2742 scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',2743 scheduledId: string,2744 blocksNum: number,2745 options: ISchedulerOptions2746 };27472748 super(logger);27492750 this.scheduleFn = options.scheduleFn;2751 this.scheduledId = options.scheduledId;2752 this.blocksNum = options.blocksNum;2753 this.options = options.options;2754 }27552756 executeExtrinsic(sender: IKeyringPair, scheduledExtrinsic: string, scheduledParams: any[], expectSuccess?: boolean): Promise<ITransactionResult> {2757 const scheduledTx = this.constructApiCall(scheduledExtrinsic, scheduledParams);2758 const extrinsic = 'api.tx.scheduler.' + this.scheduleFn;27592760 return super.executeExtrinsic(2761 sender,2762 extrinsic,2763 [2764 this.scheduledId,2765 this.blocksNum,2766 this.options.periodic ? [this.options.periodic.period, this.options.periodic.repetitions] : null,2767 this.options.priority ?? null,2768 {Value: scheduledTx},2769 ],2770 expectSuccess,2771 );2772 }2773 };2774}27752776// eslint-disable-next-line @typescript-eslint/naming-convention2777function SudoHelper<T extends ChainHelperBaseConstructor>(Base: T) {2778 return class extends Base {2779 constructor(...args: any[]) {2780 super(...args);2781 }27822783 executeExtrinsic (2784 sender: IKeyringPair,2785 extrinsic: string,2786 params: any[],2787 expectSuccess?: boolean,2788 ): Promise<ITransactionResult> {2789 const call = this.constructApiCall(extrinsic, params);27902791 return super.executeExtrinsic(2792 sender,2793 'api.tx.sudo.sudo',2794 [call],2795 expectSuccess,2796 );2797 }2798 };2799}28002801export class UniqueBaseCollection {2802 helper: UniqueHelper;2803 collectionId: number;28042805 constructor(collectionId: number, uniqueHelper: UniqueHelper) {2806 this.collectionId = collectionId;2807 this.helper = uniqueHelper;2808 }28092810 async getData() {2811 return await this.helper.collection.getData(this.collectionId);2812 }28132814 async getLastTokenId() {2815 return await this.helper.collection.getLastTokenId(this.collectionId);2816 }28172818 async doesTokenExist(tokenId: number) {2819 return await this.helper.collection.doesTokenExist(this.collectionId, tokenId);2820 }28212822 async getAdmins() {2823 return await this.helper.collection.getAdmins(this.collectionId);2824 }28252826 async getAllowList() {2827 return await this.helper.collection.getAllowList(this.collectionId);2828 }28292830 async getEffectiveLimits() {2831 return await this.helper.collection.getEffectiveLimits(this.collectionId);2832 }28332834 async getProperties(propertyKeys?: string[] | null) {2835 return await this.helper.collection.getProperties(this.collectionId, propertyKeys);2836 }28372838 async getTokenNextSponsored(tokenId: number, addressObj: ICrossAccountId) {2839 return await this.helper.collection.getTokenNextSponsored(this.collectionId, tokenId, addressObj);2840 }28412842 async setSponsor(signer: TSigner, sponsorAddress: TSubstrateAccount) {2843 return await this.helper.collection.setSponsor(signer, this.collectionId, sponsorAddress);2844 }28452846 async confirmSponsorship(signer: TSigner) {2847 return await this.helper.collection.confirmSponsorship(signer, this.collectionId);2848 }28492850 async removeSponsor(signer: TSigner) {2851 return await this.helper.collection.removeSponsor(signer, this.collectionId);2852 }28532854 async setLimits(signer: TSigner, limits: ICollectionLimits) {2855 return await this.helper.collection.setLimits(signer, this.collectionId, limits);2856 }28572858 async changeOwner(signer: TSigner, ownerAddress: TSubstrateAccount) {2859 return await this.helper.collection.changeOwner(signer, this.collectionId, ownerAddress);2860 }28612862 async addAdmin(signer: TSigner, adminAddressObj: ICrossAccountId) {2863 return await this.helper.collection.addAdmin(signer, this.collectionId, adminAddressObj);2864 }28652866 async addToAllowList(signer: TSigner, addressObj: ICrossAccountId) {2867 return await this.helper.collection.addToAllowList(signer, this.collectionId, addressObj);2868 }28692870 async removeFromAllowList(signer: TSigner, addressObj: ICrossAccountId) {2871 return await this.helper.collection.removeFromAllowList(signer, this.collectionId, addressObj);2872 }28732874 async removeAdmin(signer: TSigner, adminAddressObj: ICrossAccountId) {2875 return await this.helper.collection.removeAdmin(signer, this.collectionId, adminAddressObj);2876 }28772878 async setProperties(signer: TSigner, properties: IProperty[]) {2879 return await this.helper.collection.setProperties(signer, this.collectionId, properties);2880 }28812882 async deleteProperties(signer: TSigner, propertyKeys: string[]) {2883 return await this.helper.collection.deleteProperties(signer, this.collectionId, propertyKeys);2884 }28852886 async setPermissions(signer: TSigner, permissions: ICollectionPermissions) {2887 return await this.helper.collection.setPermissions(signer, this.collectionId, permissions);2888 }28892890 async enableNesting(signer: TSigner, permissions: INestingPermissions) {2891 return await this.helper.collection.enableNesting(signer, this.collectionId, permissions);2892 }28932894 async disableNesting(signer: TSigner) {2895 return await this.helper.collection.disableNesting(signer, this.collectionId);2896 }28972898 async burn(signer: TSigner) {2899 return await this.helper.collection.burn(signer, this.collectionId);2900 }29012902 scheduleAt<T extends UniqueHelper>(2903 scheduledId: string,2904 executionBlockNumber: number,2905 options: ISchedulerOptions = {},2906 ) {2907 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);2908 return new UniqueBaseCollection(this.collectionId, scheduledHelper);2909 }29102911 scheduleAfter<T extends UniqueHelper>(2912 scheduledId: string,2913 blocksBeforeExecution: number,2914 options: ISchedulerOptions = {},2915 ) {2916 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);2917 return new UniqueBaseCollection(this.collectionId, scheduledHelper);2918 }29192920 getSudo<T extends UniqueHelper>() {2921 return new UniqueBaseCollection(this.collectionId, this.helper.getSudo<T>());2922 }2923}292429252926export class UniqueNFTCollection extends UniqueBaseCollection {2927 getTokenObject(tokenId: number) {2928 return new UniqueNFToken(tokenId, this);2929 }29302931 async getTokensByAddress(addressObj: ICrossAccountId) {2932 return await this.helper.nft.getTokensByAddress(this.collectionId, addressObj);2933 }29342935 async getToken(tokenId: number, blockHashAt?: string) {2936 return await this.helper.nft.getToken(this.collectionId, tokenId, [], blockHashAt);2937 }29382939 async getTokenOwner(tokenId: number, blockHashAt?: string) {2940 return await this.helper.nft.getTokenOwner(this.collectionId, tokenId, blockHashAt);2941 }29422943 async getTokenTopmostOwner(tokenId: number, blockHashAt?: string) {2944 return await this.helper.nft.getTokenTopmostOwner(this.collectionId, tokenId, blockHashAt);2945 }29462947 async getTokenChildren(tokenId: number, blockHashAt?: string) {2948 return await this.helper.nft.getTokenChildren(this.collectionId, tokenId, blockHashAt);2949 }29502951 async getPropertyPermissions(propertyKeys: string[] | null = null) {2952 return await this.helper.nft.getPropertyPermissions(this.collectionId, propertyKeys);2953 }29542955 async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {2956 return await this.helper.nft.getTokenProperties(this.collectionId, tokenId, propertyKeys);2957 }29582959 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {2960 return await this.helper.nft.transferToken(signer, this.collectionId, tokenId, addressObj);2961 }29622963 async transferTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2964 return await this.helper.nft.transferTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, toAddressObj);2965 }29662967 async approveToken(signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId) {2968 return await this.helper.nft.approveToken(signer, this.collectionId, tokenId, toAddressObj);2969 }29702971 async isTokenApproved(tokenId: number, toAddressObj: ICrossAccountId) {2972 return await this.helper.nft.isTokenApproved(this.collectionId, tokenId, toAddressObj);2973 }29742975 async mintToken(signer: TSigner, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {2976 return await this.helper.nft.mintToken(signer, {collectionId: this.collectionId, owner, properties});2977 }29782979 async mintMultipleTokens(signer: TSigner, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]) {2980 return await this.helper.nft.mintMultipleTokens(signer, this.collectionId, tokens);2981 }29822983 async burnToken(signer: TSigner, tokenId: number) {2984 return await this.helper.nft.burnToken(signer, this.collectionId, tokenId);2985 }29862987 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId) {2988 return await this.helper.nft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj);2989 }29902991 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {2992 return await this.helper.nft.setTokenProperties(signer, this.collectionId, tokenId, properties);2993 }29942995 async deleteTokenProperties(signer: TSigner, tokenId: number, propertyKeys: string[]) {2996 return await this.helper.nft.deleteTokenProperties(signer, this.collectionId, tokenId, propertyKeys);2997 }29982999 async setTokenPropertyPermissions(signer: TSigner, permissions: ITokenPropertyPermission[]) {3000 return await this.helper.nft.setTokenPropertyPermissions(signer, this.collectionId, permissions);3001 }30023003 async nestToken(signer: TSigner, tokenId: number, toTokenObj: IToken) {3004 return await this.helper.nft.nestToken(signer, {collectionId: this.collectionId, tokenId}, toTokenObj);3005 }30063007 async unnestToken(signer: TSigner, tokenId: number, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {3008 return await this.helper.nft.unnestToken(signer, {collectionId: this.collectionId, tokenId}, fromTokenObj, toAddressObj);3009 }30103011 scheduleAt<T extends UniqueHelper>(3012 scheduledId: string,3013 executionBlockNumber: number,3014 options: ISchedulerOptions = {},3015 ) {3016 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3017 return new UniqueNFTCollection(this.collectionId, scheduledHelper);3018 }30193020 scheduleAfter<T extends UniqueHelper>(3021 scheduledId: string,3022 blocksBeforeExecution: number,3023 options: ISchedulerOptions = {},3024 ) {3025 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3026 return new UniqueNFTCollection(this.collectionId, scheduledHelper);3027 }30283029 getSudo<T extends UniqueHelper>() {3030 return new UniqueNFTCollection(this.collectionId, this.helper.getSudo<T>());3031 }3032}303330343035export class UniqueRFTCollection extends UniqueBaseCollection {3036 getTokenObject(tokenId: number) {3037 return new UniqueRFToken(tokenId, this);3038 }30393040 async getToken(tokenId: number, blockHashAt?: string) {3041 return await this.helper.rft.getToken(this.collectionId, tokenId, [], blockHashAt);3042 }30433044 async getTokensByAddress(addressObj: ICrossAccountId) {3045 return await this.helper.rft.getTokensByAddress(this.collectionId, addressObj);3046 }30473048 async getTop10TokenOwners(tokenId: number) {3049 return await this.helper.rft.getTokenTop10Owners(this.collectionId, tokenId);3050 }30513052 async getTokenBalance(tokenId: number, addressObj: ICrossAccountId) {3053 return await this.helper.rft.getTokenBalance(this.collectionId, tokenId, addressObj);3054 }30553056 async getTokenTotalPieces(tokenId: number) {3057 return await this.helper.rft.getTokenTotalPieces(this.collectionId, tokenId);3058 }30593060 async getTokenApprovedPieces(tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3061 return await this.helper.rft.getTokenApprovedPieces(this.collectionId, tokenId, toAddressObj, fromAddressObj);3062 }30633064 async getPropertyPermissions(propertyKeys: string[] | null = null) {3065 return await this.helper.rft.getPropertyPermissions(this.collectionId, propertyKeys);3066 }30673068 async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {3069 return await this.helper.rft.getTokenProperties(this.collectionId, tokenId, propertyKeys);3070 }30713072 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount=1n) {3073 return await this.helper.rft.transferToken(signer, this.collectionId, tokenId, addressObj, amount);3074 }30753076 async transferTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3077 return await this.helper.rft.transferTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, toAddressObj, amount);3078 }30793080 async approveToken(signer: TSigner, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {3081 return await this.helper.rft.approveToken(signer, this.collectionId, tokenId, toAddressObj, amount);3082 }30833084 async repartitionToken(signer: TSigner, tokenId: number, amount: bigint) {3085 return await this.helper.rft.repartitionToken(signer, this.collectionId, tokenId, amount);3086 }30873088 async mintToken(signer: TSigner, pieces=1n, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {3089 return await this.helper.rft.mintToken(signer, {collectionId: this.collectionId, owner, pieces, properties});3090 }30913092 async mintMultipleTokens(signer: TSigner, tokens: {pieces: bigint, owner: ICrossAccountId, properties?: IProperty[]}[]) {3093 return await this.helper.rft.mintMultipleTokens(signer, this.collectionId, tokens);3094 }30953096 async burnToken(signer: TSigner, tokenId: number, amount=1n) {3097 return await this.helper.rft.burnToken(signer, this.collectionId, tokenId, amount);3098 }30993100 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n) {3101 return await this.helper.rft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, amount);3102 }31033104 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {3105 return await this.helper.rft.setTokenProperties(signer, this.collectionId, tokenId, properties);3106 }31073108 async deleteTokenProperties(signer: TSigner, tokenId: number, propertyKeys: string[]) {3109 return await this.helper.rft.deleteTokenProperties(signer, this.collectionId, tokenId, propertyKeys);3110 }31113112 async setTokenPropertyPermissions(signer: TSigner, permissions: ITokenPropertyPermission[]) {3113 return await this.helper.rft.setTokenPropertyPermissions(signer, this.collectionId, permissions);3114 }31153116 scheduleAt<T extends UniqueHelper>(3117 scheduledId: string,3118 executionBlockNumber: number,3119 options: ISchedulerOptions = {},3120 ) {3121 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3122 return new UniqueRFTCollection(this.collectionId, scheduledHelper);3123 }31243125 scheduleAfter<T extends UniqueHelper>(3126 scheduledId: string,3127 blocksBeforeExecution: number,3128 options: ISchedulerOptions = {},3129 ) {3130 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3131 return new UniqueRFTCollection(this.collectionId, scheduledHelper);3132 }31333134 getSudo<T extends UniqueHelper>() {3135 return new UniqueRFTCollection(this.collectionId, this.helper.getSudo<T>());3136 }3137}313831393140export class UniqueFTCollection extends UniqueBaseCollection {3141 async getBalance(addressObj: ICrossAccountId) {3142 return await this.helper.ft.getBalance(this.collectionId, addressObj);3143 }31443145 async getTotalPieces() {3146 return await this.helper.ft.getTotalPieces(this.collectionId);3147 }31483149 async getApprovedTokens(fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3150 return await this.helper.ft.getApprovedTokens(this.collectionId, fromAddressObj, toAddressObj);3151 }31523153 async getTop10Owners() {3154 return await this.helper.ft.getTop10Owners(this.collectionId);3155 }31563157 async mint(signer: TSigner, amount=1n, owner: ICrossAccountId = {Substrate: signer.address}) {3158 return await this.helper.ft.mintTokens(signer, this.collectionId, amount, owner);3159 }31603161 async mintWithOneOwner(signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId = {Substrate: signer.address}) {3162 return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, tokens, owner);3163 }31643165 async transfer(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3166 return await this.helper.ft.transfer(signer, this.collectionId, toAddressObj, amount);3167 }31683169 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3170 return await this.helper.ft.transferFrom(signer, this.collectionId, fromAddressObj, toAddressObj, amount);3171 }31723173 async burnTokens(signer: TSigner, amount=1n) {3174 return await this.helper.ft.burnTokens(signer, this.collectionId, amount);3175 }31763177 async burnTokensFrom(signer: TSigner, fromAddressObj: ICrossAccountId, amount=1n) {3178 return await this.helper.ft.burnTokensFrom(signer, this.collectionId, fromAddressObj, amount);3179 }31803181 async approveTokens(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3182 return await this.helper.ft.approveTokens(signer, this.collectionId, toAddressObj, amount);3183 }31843185 scheduleAt<T extends UniqueHelper>(3186 scheduledId: string,3187 executionBlockNumber: number,3188 options: ISchedulerOptions = {},3189 ) {3190 const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);3191 return new UniqueFTCollection(this.collectionId, scheduledHelper);3192 }31933194 scheduleAfter<T extends UniqueHelper>(3195 scheduledId: string,3196 blocksBeforeExecution: number,3197 options: ISchedulerOptions = {},3198 ) {3199 const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3200 return new UniqueFTCollection(this.collectionId, scheduledHelper);3201 }32023203 getSudo<T extends UniqueHelper>() {3204 return new UniqueFTCollection(this.collectionId, this.helper.getSudo<T>());3205 }3206}320732083209export class UniqueBaseToken {3210 collection: UniqueNFTCollection | UniqueRFTCollection;3211 collectionId: number;3212 tokenId: number;32133214 constructor(tokenId: number, collection: UniqueNFTCollection | UniqueRFTCollection) {3215 this.collection = collection;3216 this.collectionId = collection.collectionId;3217 this.tokenId = tokenId;3218 }32193220 async getNextSponsored(addressObj: ICrossAccountId) {3221 return await this.collection.getTokenNextSponsored(this.tokenId, addressObj);3222 }32233224 async getProperties(propertyKeys?: string[] | null) {3225 return await this.collection.getTokenProperties(this.tokenId, propertyKeys);3226 }32273228 async setProperties(signer: TSigner, properties: IProperty[]) {3229 return await this.collection.setTokenProperties(signer, this.tokenId, properties);3230 }32313232 async deleteProperties(signer: TSigner, propertyKeys: string[]) {3233 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);3234 }32353236 async doesExist() {3237 return await this.collection.doesTokenExist(this.tokenId);3238 }32393240 nestingAccount() {3241 return this.collection.helper.util.getTokenAccount(this);3242 }32433244 scheduleAt<T extends UniqueHelper>(3245 scheduledId: string,3246 executionBlockNumber: number,3247 options: ISchedulerOptions = {},3248 ) {3249 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3250 return new UniqueBaseToken(this.tokenId, scheduledCollection);3251 }32523253 scheduleAfter<T extends UniqueHelper>(3254 scheduledId: string,3255 blocksBeforeExecution: number,3256 options: ISchedulerOptions = {},3257 ) {3258 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3259 return new UniqueBaseToken(this.tokenId, scheduledCollection);3260 }32613262 getSudo<T extends UniqueHelper>() {3263 return new UniqueBaseToken(this.tokenId, this.collection.getSudo<T>());3264 }3265}326632673268export class UniqueNFToken extends UniqueBaseToken {3269 collection: UniqueNFTCollection;32703271 constructor(tokenId: number, collection: UniqueNFTCollection) {3272 super(tokenId, collection);3273 this.collection = collection;3274 }32753276 async getData(blockHashAt?: string) {3277 return await this.collection.getToken(this.tokenId, blockHashAt);3278 }32793280 async getOwner(blockHashAt?: string) {3281 return await this.collection.getTokenOwner(this.tokenId, blockHashAt);3282 }32833284 async getTopmostOwner(blockHashAt?: string) {3285 return await this.collection.getTokenTopmostOwner(this.tokenId, blockHashAt);3286 }32873288 async getChildren(blockHashAt?: string) {3289 return await this.collection.getTokenChildren(this.tokenId, blockHashAt);3290 }32913292 async nest(signer: TSigner, toTokenObj: IToken) {3293 return await this.collection.nestToken(signer, this.tokenId, toTokenObj);3294 }32953296 async unnest(signer: TSigner, fromTokenObj: IToken, toAddressObj: ICrossAccountId) {3297 return await this.collection.unnestToken(signer, this.tokenId, fromTokenObj, toAddressObj);3298 }32993300 async transfer(signer: TSigner, addressObj: ICrossAccountId) {3301 return await this.collection.transferToken(signer, this.tokenId, addressObj);3302 }33033304 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {3305 return await this.collection.transferTokenFrom(signer, this.tokenId, fromAddressObj, toAddressObj);3306 }33073308 async approve(signer: TSigner, toAddressObj: ICrossAccountId) {3309 return await this.collection.approveToken(signer, this.tokenId, toAddressObj);3310 }33113312 async isApproved(toAddressObj: ICrossAccountId) {3313 return await this.collection.isTokenApproved(this.tokenId, toAddressObj);3314 }33153316 async burn(signer: TSigner) {3317 return await this.collection.burnToken(signer, this.tokenId);3318 }33193320 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId) {3321 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj);3322 }33233324 scheduleAt<T extends UniqueHelper>(3325 scheduledId: string,3326 executionBlockNumber: number,3327 options: ISchedulerOptions = {},3328 ) {3329 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3330 return new UniqueNFToken(this.tokenId, scheduledCollection);3331 }33323333 scheduleAfter<T extends UniqueHelper>(3334 scheduledId: string,3335 blocksBeforeExecution: number,3336 options: ISchedulerOptions = {},3337 ) {3338 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3339 return new UniqueNFToken(this.tokenId, scheduledCollection);3340 }33413342 getSudo<T extends UniqueHelper>() {3343 return new UniqueNFToken(this.tokenId, this.collection.getSudo<T>());3344 }3345}33463347export class UniqueRFToken extends UniqueBaseToken {3348 collection: UniqueRFTCollection;33493350 constructor(tokenId: number, collection: UniqueRFTCollection) {3351 super(tokenId, collection);3352 this.collection = collection;3353 }33543355 async getData(blockHashAt?: string) {3356 return await this.collection.getToken(this.tokenId, blockHashAt);3357 }33583359 async getTop10Owners() {3360 return await this.collection.getTop10TokenOwners(this.tokenId);3361 }33623363 async getBalance(addressObj: ICrossAccountId) {3364 return await this.collection.getTokenBalance(this.tokenId, addressObj);3365 }33663367 async getTotalPieces() {3368 return await this.collection.getTokenTotalPieces(this.tokenId);3369 }33703371 async getApprovedPieces(fromAddressObj: ICrossAccountId, toAccountObj: ICrossAccountId) {3372 return await this.collection.getTokenApprovedPieces(this.tokenId, fromAddressObj, toAccountObj);3373 }33743375 async transfer(signer: TSigner, addressObj: ICrossAccountId, amount=1n) {3376 return await this.collection.transferToken(signer, this.tokenId, addressObj, amount);3377 }33783379 async transferFrom(signer: TSigner, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {3380 return await this.collection.transferTokenFrom(signer, this.tokenId, fromAddressObj, toAddressObj, amount);3381 }33823383 async approve(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {3384 return await this.collection.approveToken(signer, this.tokenId, toAddressObj, amount);3385 }33863387 async repartition(signer: TSigner, amount: bigint) {3388 return await this.collection.repartitionToken(signer, this.tokenId, amount);3389 }33903391 async burn(signer: TSigner, amount=1n) {3392 return await this.collection.burnToken(signer, this.tokenId, amount);3393 }33943395 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId, amount=1n) {3396 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj, amount);3397 }33983399 scheduleAt<T extends UniqueHelper>(3400 scheduledId: string,3401 executionBlockNumber: number,3402 options: ISchedulerOptions = {},3403 ) {3404 const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);3405 return new UniqueRFToken(this.tokenId, scheduledCollection);3406 }34073408 scheduleAfter<T extends UniqueHelper>(3409 scheduledId: string,3410 blocksBeforeExecution: number,3411 options: ISchedulerOptions = {},3412 ) {3413 const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);3414 return new UniqueRFToken(this.tokenId, scheduledCollection);3415 }34163417 getSudo<T extends UniqueHelper>() {3418 return new UniqueRFToken(this.tokenId, this.collection.getSudo<T>());3419 }3420}tests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmOpal.test.ts
+++ b/tests/src/xcm/xcmOpal.test.ts
@@ -16,7 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import config from '../config';
-import {itSub, expect, describeXcm, usingPlaygrounds, usingWestmintPlaygrounds, usingRelayPlaygrounds} from '../util/playgrounds';
+import {itSub, expect, describeXCM, usingPlaygrounds, usingWestmintPlaygrounds, usingRelayPlaygrounds} from '../util';
const STATEMINE_CHAIN = 1000;
const UNIQUE_CHAIN = 2095;
@@ -38,7 +38,7 @@
// 10,000.00 (ten thousands) USDT
const ASSET_AMOUNT = 1_000_000_000_000_000_000_000n;
-describeXcm('[XCM] Integration test: Exchanging USDT with Westmint', () => {
+describeXCM('[XCM] Integration test: Exchanging USDT with Westmint', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
@@ -59,8 +59,8 @@
before(async () => {
await usingPlaygrounds(async (_helper, privateKey) => {
- alice = privateKey('//Alice');
- bob = privateKey('//Bob'); // funds donor
+ alice = await privateKey('//Alice');
+ bob = await privateKey('//Bob'); // funds donor
});
await usingWestmintPlaygrounds(westmintUrl, async (helper) => {
tests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -18,7 +18,7 @@
import {blake2AsHex} from '@polkadot/util-crypto';
import config from '../config';
import {XcmV2TraitsOutcome, XcmV2TraitsError} from '../interfaces';
-import {itSub, expect, describeXcm, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds} from '../util/playgrounds';
+import {itSub, expect, describeXCM, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds} from '../util';
const QUARTZ_CHAIN = 2095;
const KARURA_CHAIN = 2000;
@@ -32,7 +32,7 @@
const TRANSFER_AMOUNT = 2000000000000000000000000n;
-describeXcm('[XCM] Integration test: Exchanging tokens with Karura', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Karura', () => {
let alice: IKeyringPair;
let randomAccount: IKeyringPair;
@@ -48,7 +48,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- alice = privateKey('//Alice');
+ alice = await privateKey('//Alice');
[randomAccount] = await helper.arrange.createAccounts([0n], alice);
});
@@ -207,12 +207,12 @@
});
// These tests are relevant only when the foreign asset pallet is disabled
-describeXcm('[XCM] Integration test: Quartz rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (_helper, privateKey) => {
- alice = privateKey('//Alice');
+ alice = await privateKey('//Alice');
});
});
@@ -331,9 +331,8 @@
).to.be.true;
});
});
-
-describeXcm('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
+describeXCM('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
// Quartz constants
let quartzDonor: IKeyringPair;
let quartzAssetLocation;
@@ -369,7 +368,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- quartzDonor = privateKey('//Alice');
+ quartzDonor = await privateKey('//Alice');
[randomAccountQuartz] = await helper.arrange.createAccounts([0n], quartzDonor);
balanceForeignQtzTokenInit = 0n;
tests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -18,7 +18,7 @@
import {blake2AsHex} from '@polkadot/util-crypto';
import config from '../config';
import {XcmV2TraitsError, XcmV2TraitsOutcome} from '../interfaces';
-import {itSub, expect, describeXcm, usingPlaygrounds, usingAcalaPlaygrounds, usingRelayPlaygrounds, usingMoonbeamPlaygrounds} from '../util/playgrounds';
+import {itSub, expect, describeXCM, usingPlaygrounds, usingAcalaPlaygrounds, usingRelayPlaygrounds, usingMoonbeamPlaygrounds} from '../util';
const UNIQUE_CHAIN = 2037;
const ACALA_CHAIN = 2000;
@@ -32,7 +32,7 @@
const TRANSFER_AMOUNT = 2000000000000000000000000n;
-describeXcm('[XCM] Integration test: Exchanging tokens with Acala', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Acala', () => {
let alice: IKeyringPair;
let randomAccount: IKeyringPair;
@@ -48,7 +48,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- alice = privateKey('//Alice');
+ alice = await privateKey('//Alice');
[randomAccount] = await helper.arrange.createAccounts([0n], alice);
});
@@ -211,12 +211,12 @@
});
// These tests are relevant only when the foreign asset pallet is disabled
-describeXcm('[XCM] Integration test: Unique rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
let alice: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (_helper, privateKey) => {
- alice = privateKey('//Alice');
+ alice = await privateKey('//Alice');
});
});
@@ -335,9 +335,8 @@
).to.be.true;
});
});
-
-describeXcm('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
+describeXCM('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
// Unique constants
let uniqueDonor: IKeyringPair;
let uniqueAssetLocation;
@@ -373,7 +372,7 @@
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
- uniqueDonor = privateKey('//Alice');
+ uniqueDonor = await privateKey('//Alice');
[randomAccountUnique] = await helper.arrange.createAccounts([0n], uniqueDonor);
balanceForeignUnqTokenInit = 0n;
tests/yarn.lockdiffbeforeafterboth--- a/tests/yarn.lock
+++ b/tests/yarn.lock
@@ -17,49 +17,49 @@
dependencies:
"@babel/highlight" "^7.18.6"
-"@babel/compat-data@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86"
- integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw==
+"@babel/compat-data@^7.19.3":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.4.tgz#95c86de137bf0317f3a570e1b6e996b427299747"
+ integrity sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==
-"@babel/core@^7.18.10":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.0.tgz#d2f5f4f2033c00de8096be3c9f45772563e150c3"
- integrity sha512-reM4+U7B9ss148rh2n1Qs9ASS+w94irYXga7c2jaQv9RVzpS7Mv1a9rnYYwuDa45G+DkORt9g6An2k/V4d9LbQ==
+"@babel/core@^7.19.3":
+ version "7.19.3"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.3.tgz#2519f62a51458f43b682d61583c3810e7dcee64c"
+ integrity sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==
dependencies:
"@ampproject/remapping" "^2.1.0"
"@babel/code-frame" "^7.18.6"
- "@babel/generator" "^7.19.0"
- "@babel/helper-compilation-targets" "^7.19.0"
+ "@babel/generator" "^7.19.3"
+ "@babel/helper-compilation-targets" "^7.19.3"
"@babel/helper-module-transforms" "^7.19.0"
"@babel/helpers" "^7.19.0"
- "@babel/parser" "^7.19.0"
+ "@babel/parser" "^7.19.3"
"@babel/template" "^7.18.10"
- "@babel/traverse" "^7.19.0"
- "@babel/types" "^7.19.0"
+ "@babel/traverse" "^7.19.3"
+ "@babel/types" "^7.19.3"
convert-source-map "^1.7.0"
debug "^4.1.0"
gensync "^1.0.0-beta.2"
json5 "^2.2.1"
semver "^6.3.0"
-"@babel/generator@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.0.tgz#785596c06425e59334df2ccee63ab166b738419a"
- integrity sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==
+"@babel/generator@^7.19.3", "@babel/generator@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.4.tgz#60050cf3f0a593d7b2471b4be4f62a56b949237f"
+ integrity sha512-5T2lY5vXqS+5UEit/5TwcIUeCnwgCljcF8IQRT6XRQPBrvLeq5V8W+URv+GvwoF3FP8tkhp++evVyDzkDGzNmA==
dependencies:
- "@babel/types" "^7.19.0"
+ "@babel/types" "^7.19.4"
"@jridgewell/gen-mapping" "^0.3.2"
jsesc "^2.5.1"
-"@babel/helper-compilation-targets@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz#537ec8339d53e806ed422f1e06c8f17d55b96bb0"
- integrity sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA==
+"@babel/helper-compilation-targets@^7.19.3":
+ version "7.19.3"
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz#a10a04588125675d7c7ae299af86fa1b2ee038ca"
+ integrity sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==
dependencies:
- "@babel/compat-data" "^7.19.0"
+ "@babel/compat-data" "^7.19.3"
"@babel/helper-validator-option" "^7.18.6"
- browserslist "^4.20.2"
+ browserslist "^4.21.3"
semver "^6.3.0"
"@babel/helper-environment-visitor@^7.18.9":
@@ -104,11 +104,11 @@
"@babel/types" "^7.19.0"
"@babel/helper-simple-access@^7.18.6":
- version "7.18.6"
- resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz#d6d8f51f4ac2978068df934b569f08f29788c7ea"
- integrity sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz#be553f4951ac6352df2567f7daa19a0ee15668e7"
+ integrity sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg==
dependencies:
- "@babel/types" "^7.18.6"
+ "@babel/types" "^7.19.4"
"@babel/helper-split-export-declaration@^7.18.6":
version "7.18.6"
@@ -117,15 +117,15 @@
dependencies:
"@babel/types" "^7.18.6"
-"@babel/helper-string-parser@^7.18.10":
- version "7.18.10"
- resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56"
- integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==
+"@babel/helper-string-parser@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
+ integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
-"@babel/helper-validator-identifier@^7.18.6":
- version "7.18.6"
- resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076"
- integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==
+"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1":
+ version "7.19.1"
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
+ integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
"@babel/helper-validator-option@^7.18.6":
version "7.18.6"
@@ -133,13 +133,13 @@
integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==
"@babel/helpers@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.0.tgz#f30534657faf246ae96551d88dd31e9d1fa1fc18"
- integrity sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg==
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.4.tgz#42154945f87b8148df7203a25c31ba9a73be46c5"
+ integrity sha512-G+z3aOx2nfDHwX/kyVii5fJq+bgscg89/dJNWpYeKeBv3v9xX8EIabmx1k6u9LS04H7nROFVRVK+e3k0VHp+sw==
dependencies:
"@babel/template" "^7.18.10"
- "@babel/traverse" "^7.19.0"
- "@babel/types" "^7.19.0"
+ "@babel/traverse" "^7.19.4"
+ "@babel/types" "^7.19.4"
"@babel/highlight@^7.18.6":
version "7.18.6"
@@ -150,10 +150,10 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
-"@babel/parser@^7.18.10", "@babel/parser@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c"
- integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw==
+"@babel/parser@^7.18.10", "@babel/parser@^7.19.3", "@babel/parser@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.4.tgz#03c4339d2b8971eb3beca5252bafd9b9f79db3dc"
+ integrity sha512-qpVT7gtuOLjWeDTKLkJ6sryqLliBaFpAtGeqw5cs5giLldvh+Ch0plqnUMKoVAUS6ZEueQQiZV+p5pxtPitEsA==
"@babel/register@^7.18.9":
version "7.18.9"
@@ -166,10 +166,10 @@
pirates "^4.0.5"
source-map-support "^0.5.16"
-"@babel/runtime@^7.18.9":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.19.0.tgz#22b11c037b094d27a8a2504ea4dcff00f50e2259"
- integrity sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==
+"@babel/runtime@^7.18.9", "@babel/runtime@^7.19.0":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.19.4.tgz#a42f814502ee467d55b38dd1c256f53a7b885c78"
+ integrity sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==
dependencies:
regenerator-runtime "^0.13.4"
@@ -182,29 +182,29 @@
"@babel/parser" "^7.18.10"
"@babel/types" "^7.18.10"
-"@babel/traverse@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.0.tgz#eb9c561c7360005c592cc645abafe0c3c4548eed"
- integrity sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA==
+"@babel/traverse@^7.19.0", "@babel/traverse@^7.19.3", "@babel/traverse@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.4.tgz#f117820e18b1e59448a6c1fa9d0ff08f7ac459a8"
+ integrity sha512-w3K1i+V5u2aJUOXBFFC5pveFLmtq1s3qcdDNC2qRI6WPBQIDaKFqXxDEqDO/h1dQ3HjsZoZMyIy6jGLq0xtw+g==
dependencies:
"@babel/code-frame" "^7.18.6"
- "@babel/generator" "^7.19.0"
+ "@babel/generator" "^7.19.4"
"@babel/helper-environment-visitor" "^7.18.9"
"@babel/helper-function-name" "^7.19.0"
"@babel/helper-hoist-variables" "^7.18.6"
"@babel/helper-split-export-declaration" "^7.18.6"
- "@babel/parser" "^7.19.0"
- "@babel/types" "^7.19.0"
+ "@babel/parser" "^7.19.4"
+ "@babel/types" "^7.19.4"
debug "^4.1.0"
globals "^11.1.0"
-"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0":
- version "7.19.0"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600"
- integrity sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==
+"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.19.3", "@babel/types@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.4.tgz#0dd5c91c573a202d600490a35b33246fed8a41c7"
+ integrity sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==
dependencies:
- "@babel/helper-string-parser" "^7.18.10"
- "@babel/helper-validator-identifier" "^7.18.6"
+ "@babel/helper-string-parser" "^7.19.4"
+ "@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@cspotcode/source-map-support@^0.8.0":
@@ -214,10 +214,10 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"
-"@eslint/eslintrc@^1.3.1":
- version "1.3.1"
- resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d"
- integrity sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==
+"@eslint/eslintrc@^1.3.3":
+ version "1.3.3"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95"
+ integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==
dependencies:
ajv "^6.12.4"
debug "^4.3.2"
@@ -354,9 +354,9 @@
integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==
"@ethersproject/networks@^5.7.0":
- version "5.7.0"
- resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.0.tgz#df72a392f1a63a57f87210515695a31a245845ad"
- integrity sha512-MG6oHSQHd4ebvJrleEQQ4HhVu8Ichr0RDYEfHzsVAVjHNM+w36x9wp9r+hf1JstMXtseXDtkiVoARAG6M959AA==
+ version "5.7.1"
+ resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6"
+ integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==
dependencies:
"@ethersproject/logger" "^5.7.0"
@@ -412,9 +412,9 @@
"@ethersproject/signing-key" "^5.7.0"
"@ethersproject/web@^5.7.0":
- version "5.7.0"
- resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.0.tgz#40850c05260edad8b54827923bbad23d96aac0bc"
- integrity sha512-ApHcbbj+muRASVDSCl/tgxaH2LBkRMEYfLOLVa0COipx0+nlu0QKet7U2lEg0vdkh8XRSLf2nd1f1Uk9SrVSGA==
+ version "5.7.1"
+ resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae"
+ integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==
dependencies:
"@ethersproject/base64" "^5.7.0"
"@ethersproject/bytes" "^5.7.0"
@@ -422,19 +422,14 @@
"@ethersproject/properties" "^5.7.0"
"@ethersproject/strings" "^5.7.0"
-"@humanwhocodes/config-array@^0.10.4":
- version "0.10.4"
- resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.4.tgz#01e7366e57d2ad104feea63e72248f22015c520c"
- integrity sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==
+"@humanwhocodes/config-array@^0.10.5":
+ version "0.10.7"
+ resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.7.tgz#6d53769fd0c222767e6452e8ebda825c22e9f0dc"
+ integrity sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==
dependencies:
"@humanwhocodes/object-schema" "^1.2.1"
debug "^4.1.1"
minimatch "^3.0.4"
-
-"@humanwhocodes/gitignore-to-minimatch@^1.0.2":
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz#316b0a63b91c10e53f242efb4ace5c3b34e8728d"
- integrity sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==
"@humanwhocodes/module-importer@^1.0.1":
version "1.0.1"
@@ -463,7 +458,7 @@
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping" "^0.3.9"
-"@jridgewell/resolve-uri@^3.0.3":
+"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
@@ -473,7 +468,7 @@
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
-"@jridgewell/sourcemap-codec@^1.4.10":
+"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10":
version "1.4.14"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
@@ -487,22 +482,22 @@
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping@^0.3.9":
- version "0.3.15"
- resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz#aba35c48a38d3fd84b37e66c9c0423f9744f9774"
- integrity sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==
+ version "0.3.16"
+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.16.tgz#a7982f16c18cae02be36274365433e5b49d7b23f"
+ integrity sha512-LCQ+NeThyJ4k1W2d+vIKdxuSt9R3pQSZ4P92m7EakaYuXcVWbHuT5bjNcqLd4Rdgi6xYWYDvBJZJLZSLanjDcA==
dependencies:
- "@jridgewell/resolve-uri" "^3.0.3"
- "@jridgewell/sourcemap-codec" "^1.4.10"
+ "@jridgewell/resolve-uri" "3.1.0"
+ "@jridgewell/sourcemap-codec" "1.4.14"
-"@noble/hashes@1.1.2":
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183"
- integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==
+"@noble/hashes@1.1.3":
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.3.tgz#360afc77610e0a61f3417e497dcf36862e4f8111"
+ integrity sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==
-"@noble/secp256k1@1.6.3":
- version "1.6.3"
- resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.3.tgz#7eed12d9f4404b416999d0c87686836c4c5c9b94"
- integrity sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==
+"@noble/secp256k1@1.7.0":
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.0.tgz#d15357f7c227e751d90aa06b05a0e5cf993ba8c1"
+ integrity sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==
"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
@@ -525,139 +520,139 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
-"@polkadot/api-augment@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.2.2.tgz#fab9dd96f9322ae658245cd8711fd2d8db5c2412"
- integrity sha512-yDtp1ecRWMCFXTjmKOvqXI6VHTYvHormRwJwE85VGQbMsZFDWFVbQXZOxsqkfx2rJye/25seVRWxQS+7oKzqkA==
+"@polkadot/api-augment@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.5.1.tgz#f4ae75837782dd09c2f7468f78c17626c359797d"
+ integrity sha512-9NQ2miIKVJvyhR2Zhk0XcHA+pgnWhQ0815lqcq0kz9ny5JHUFeGlNtxECw7AEnxoiC81EqpfWkOHpJpfiIcOmw==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/api-base" "9.2.2"
- "@polkadot/rpc-augment" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-augment" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/api-base" "9.5.1"
+ "@polkadot/rpc-augment" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-augment" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/api-base@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.2.2.tgz#f84cbf1eb1893e9c8eb538369c8b349f3d64d5fd"
- integrity sha512-Dqbh0MQo/ByAqOC56ga1VkVCpEjfWtxPHz3ni8oXJp0YvjA/4qKkZRM2ejoN07XKOMFNBZC4hnmNplyaCnVHfw==
+"@polkadot/api-base@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.5.1.tgz#f6084ebd21c4c43e3c11a7d638621d27162c5fcc"
+ integrity sha512-3qsMsIhYbU3zp+YnP5h6Hg98y3B+FrxgPW7r2Uk6Kp1uSPmIzhMCyGuxur/BAcDVbd3KME+zWLHJDYOdyhuUwQ==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/rpc-core" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/util" "^10.1.4"
- rxjs "^7.5.6"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/rpc-core" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ rxjs "^7.5.7"
-"@polkadot/api-contract@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-9.2.2.tgz#1b8c1c6a4fb2f5e21d0c9549062c8242453a15b5"
- integrity sha512-NE2QbBtX7e/lXdOG5wFqArjnbujcVWppoksvX1SrG2GKdhM2Y/shHLNV7uCYMq3tqmmCKOcp0RKE85Owu/7LQA==
+"@polkadot/api-contract@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-9.5.1.tgz#ba45c9150610477f5d05509414f7330b6175ecdd"
+ integrity sha512-BfI1Yi2R0eZ076F4v4UZklQ+8WS0g8QZ9g2716FoNTGGYogUeMQ/8gZWIJaAyylCypN/ucNLdpSmSTnhR59jCw==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/api" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/types-create" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
- rxjs "^7.5.6"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/api" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/types-create" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
+ rxjs "^7.5.7"
-"@polkadot/api-derive@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.2.2.tgz#70b510d8140f081ef145b9bdf4f8a03108183192"
- integrity sha512-8Du6Wxro5yhAgwJ7R8xWCrDFnAWGv6aDWVnpckUZWs9LRw5wGNN4GJD4WB/715H9ZZXzQ/sDW5lXo3ux19SE7w==
+"@polkadot/api-derive@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.5.1.tgz#8542b989c34249df5ec3b836ec10b910897620df"
+ integrity sha512-fKlKQe8WZ3jrm44w/zptMofljW5qj+jZxnryK08CAH/MINlZArPfCtn+EJla2ND9aTnRMUWlEBtytyCPImI/Hg==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/api" "9.2.2"
- "@polkadot/api-augment" "9.2.2"
- "@polkadot/api-base" "9.2.2"
- "@polkadot/rpc-core" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
- rxjs "^7.5.6"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/api" "9.5.1"
+ "@polkadot/api-augment" "9.5.1"
+ "@polkadot/api-base" "9.5.1"
+ "@polkadot/rpc-core" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
+ rxjs "^7.5.7"
-"@polkadot/api@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.2.2.tgz#3ecd80110acf5e479ce510d301e3a7ce2c1b8f17"
- integrity sha512-dRXfdGhV3XWRtsYt+OskAwSAimTRC1k/oh3yO1vYc7C9cmqssw0LMEib9mlVh7qHprD30db7NleTOSFU6Bt2ag==
+"@polkadot/api@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.5.1.tgz#3501dac23bf82986dfe0a8c22857eb86610eca61"
+ integrity sha512-A2i/+mCl6cbFJ84ExMcWosUDfq0gVvzyKftkbRMs0oDzvHVVucTm0nCCzBgi/ltvSsFq8oJQ4pVqNTfT/IXgeQ==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/api-augment" "9.2.2"
- "@polkadot/api-base" "9.2.2"
- "@polkadot/api-derive" "9.2.2"
- "@polkadot/keyring" "^10.1.4"
- "@polkadot/rpc-augment" "9.2.2"
- "@polkadot/rpc-core" "9.2.2"
- "@polkadot/rpc-provider" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-augment" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/types-create" "9.2.2"
- "@polkadot/types-known" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/api-augment" "9.5.1"
+ "@polkadot/api-base" "9.5.1"
+ "@polkadot/api-derive" "9.5.1"
+ "@polkadot/keyring" "^10.1.10"
+ "@polkadot/rpc-augment" "9.5.1"
+ "@polkadot/rpc-core" "9.5.1"
+ "@polkadot/rpc-provider" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-augment" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/types-create" "9.5.1"
+ "@polkadot/types-known" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
eventemitter3 "^4.0.7"
- rxjs "^7.5.6"
+ rxjs "^7.5.7"
-"@polkadot/keyring@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.1.7.tgz#d51be1dc5807c961889847d8f0e10e4bbdd19d3f"
- integrity sha512-lArwaAS3hDs+HHupDIC4r2mFaAfmNQV2YzwL2wM5zhOqB2RugN03BFrgwNll0y9/Bg8rYDqM3Y5BvVMzgMZ6XA==
+"@polkadot/keyring@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.1.10.tgz#f9d97ab528e612df4820e0df1837faae51c15904"
+ integrity sha512-crKYBbwmPcFoTP6mby2+o1QWsjAyi5QlKzU8tXuXOApP6SBuqmDujIuLOKNG2vZoftNdVldsVL0WmKVYtBeuQg==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/util" "10.1.7"
- "@polkadot/util-crypto" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/util" "10.1.10"
+ "@polkadot/util-crypto" "10.1.10"
-"@polkadot/networks@10.1.7", "@polkadot/networks@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.1.7.tgz#33b38d70409e2daf0990ef18ff150c6718ffb700"
- integrity sha512-ol864SZ/GwAF72GQOPRy+Y9r6NtgJJjMBlDLESvV5VK64eEB0MRSSyiOdd7y/4SumR9crrrNimx3ynACFgxZ8A==
+"@polkadot/networks@10.1.10", "@polkadot/networks@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.1.10.tgz#421ce200f8b26759edd1d9d9408d934527f5b455"
+ integrity sha512-Db78t2XnFIZbdSdu1aFuj3/1cNwcSzG/+wNrpCQ9dPhnGPy5S1GVbmU8pyxTftPKdTFc+8RdBr+5bc0d5ijGiA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/util" "10.1.7"
- "@substrate/ss58-registry" "^1.28.0"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/util" "10.1.10"
+ "@substrate/ss58-registry" "^1.31.0"
-"@polkadot/rpc-augment@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.2.2.tgz#7246e6a43536296ad19be8460a81e434d718ff4c"
- integrity sha512-LbluIgoFtFtN/PTLk0kPErPgMPwj1+ySLn1bNlWjshoE00NeYAIltin9j11iT9g4Zpb+ppSWpsrhO/5crGqERQ==
+"@polkadot/rpc-augment@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.5.1.tgz#a4d8d7c6132375c9f4d50c7cb4c6813ff700937f"
+ integrity sha512-7Qm6oIoVIqv6VOaIqDal45hUTb3TVZ58S3zkSr60p/dPMlGCaFMcojtfcQErHtCW0hgvzFNsDl9ShpXRcPWu7g==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/rpc-core" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/rpc-core" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/rpc-core@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.2.2.tgz#96b9fd033ecf0d4edf5f2f48c958a1991776b332"
- integrity sha512-D+rmC7etJVvlDb7debjF1HDvjqvRnx/b3j7zKpJ3IjjVKWiYyCgQvcyyLyX4lH1f3PHOfEJZP6Q8FNA8B2U7XA==
+"@polkadot/rpc-core@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.5.1.tgz#7c327d735b742aaaee856bce6288331d0b2b042f"
+ integrity sha512-8CXgBVTEUjeuN5VOwS6MjTeqpN+9qrNJAAwNEba36/72g6Wgg3flza11kx0luQ6OLPVgCM7OcAjZ17p16phXDA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/rpc-augment" "9.2.2"
- "@polkadot/rpc-provider" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/util" "^10.1.4"
- rxjs "^7.5.6"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/rpc-augment" "9.5.1"
+ "@polkadot/rpc-provider" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ rxjs "^7.5.7"
-"@polkadot/rpc-provider@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.2.2.tgz#14453b8e80d4f0826dbcbf4e749d5a9397cb6905"
- integrity sha512-QnUql17q9ByP+7IyouXJDUPjkvOB1ciCGTwzf98WlOQxr/OEwcaWx0axHSVtMQyhX06ciVIbyI9hIjV5cfT78A==
+"@polkadot/rpc-provider@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.5.1.tgz#1857b655a461820025b85cf3a7e7a58066ede137"
+ integrity sha512-CxyEo1SzwbcByUsrW5RUm5GTLNK7yjmVlTMseex8zQLO4+4erqUoQzr6TTIPSt4LWyk+TjbZdtGtlt7p6i2nJg==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/keyring" "^10.1.4"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-support" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
- "@polkadot/x-fetch" "^10.1.4"
- "@polkadot/x-global" "^10.1.4"
- "@polkadot/x-ws" "^10.1.4"
- "@substrate/connect" "0.7.10"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/keyring" "^10.1.10"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-support" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
+ "@polkadot/x-fetch" "^10.1.10"
+ "@polkadot/x-global" "^10.1.10"
+ "@polkadot/x-ws" "^10.1.10"
+ "@substrate/connect" "0.7.14"
eventemitter3 "^4.0.7"
mock-socket "^9.1.5"
nock "^13.2.9"
@@ -669,119 +664,119 @@
dependencies:
"@types/chrome" "^0.0.171"
-"@polkadot/typegen@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-9.2.2.tgz#e99ec0c8b6a73e302ab6015008c16a969908a794"
- integrity sha512-Bh7cvvT45Vw0A5yJDb4Pp+gIsMaqDg1x/p7QpBFf/RbPL6bORC3hBOxwa36m+RyWhYggNycoxfnKz5eAsdjCFQ==
+"@polkadot/typegen@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-9.5.1.tgz#deb74a4bbabd205d68f2b3d59793b3234cfc8c00"
+ integrity sha512-SKLiXHUpSCBop8dd1P/LCN2R5GpM41QSOmRyNVnhgOKPtmB/vxS2pVNvMDl7dOhQkANCO6E2CWZiIPeWlu/G7Q==
dependencies:
- "@babel/core" "^7.18.10"
+ "@babel/core" "^7.19.3"
"@babel/register" "^7.18.9"
- "@babel/runtime" "^7.18.9"
- "@polkadot/api" "9.2.2"
- "@polkadot/api-augment" "9.2.2"
- "@polkadot/rpc-augment" "9.2.2"
- "@polkadot/rpc-provider" "9.2.2"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-augment" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/types-create" "9.2.2"
- "@polkadot/types-support" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
- "@polkadot/x-ws" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/api" "9.5.1"
+ "@polkadot/api-augment" "9.5.1"
+ "@polkadot/rpc-augment" "9.5.1"
+ "@polkadot/rpc-provider" "9.5.1"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-augment" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/types-create" "9.5.1"
+ "@polkadot/types-support" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
+ "@polkadot/x-ws" "^10.1.10"
handlebars "^4.7.7"
websocket "^1.0.34"
- yargs "^17.5.1"
+ yargs "^17.6.0"
-"@polkadot/types-augment@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.2.2.tgz#3ec2aff0a86287f9f9f4ddb0aa5430450d4a684f"
- integrity sha512-OyAC/WxNYrJjVp8NXklAeg/380BnFCBo4YgEOT4EhXK8fWzKzanvFAFROKAg78JQBI4LRJKkRyAEWIEzMNGR1Q==
+"@polkadot/types-augment@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.5.1.tgz#907d05da7cf0891cdf6d59e2387a3394a978a5c9"
+ integrity sha512-1AzQpGe5bGttYbbjR1UhV19htsFjgqJ651eyT3YdRqo1hotZ2GwTCkGXuTJtcmQQH9G09xUUwS3nx8WsSyQ70A==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/types-codec@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.2.2.tgz#8ab24d6208cce7e6abf3c352742045062b7ff588"
- integrity sha512-p6E31UQ9Hq0KwKXz5wBXvzrus3v7fY3yHR9EkR8eZvG7rBIHST42JPlfXIxKmnkkXkMxIX1LNSHQy0A8EikVxQ==
+"@polkadot/types-codec@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.5.1.tgz#d0c04a9f7dd8337dce4fe806e634c4ef99f954cc"
+ integrity sha512-7Dy8TeApu4lN8DqdMZLuh34ocdHQh9jzAob6cQl1fl1ypOiCO/SwPjFkj0Xnhh7QQz9X9w63jZzbaFR3PPT+0g==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/util" "^10.1.4"
- "@polkadot/x-bigint" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/x-bigint" "^10.1.10"
-"@polkadot/types-create@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.2.2.tgz#d1e3cf945a0c95b31999673add738c4d585543d8"
- integrity sha512-byGoFbkwpMHuqRwZXoD3lrTRkgIB89GlZlXJIfBuNeGE84nWktPCuZw3hBm5LO/qIgp5RFjdfeOCmBvxQ0fzQg==
+"@polkadot/types-create@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.5.1.tgz#06f71f08b3c68fb3bbdabe838325c955384d59bd"
+ integrity sha512-pUQ1U0mho5aKRdi4iR9DP9ldIoj9U+ApHIeYyxkBY8RexMQOpkt8PZfpFhg4z2H5vZj/sgNIBXq65HjXuyu+9w==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/types-known@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-9.2.2.tgz#0d3d70eb37796aac06c874cd2b2bc97464f00e6a"
- integrity sha512-WHkgoMJg0ZzxOainMjvGhaIa8/m/zwmhH1P+0UqLoZf+oE9EUkjPJaG5oETz4YUa3Nb8uuHfdMl6c5xN3DMIaQ==
+"@polkadot/types-known@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-9.5.1.tgz#0eb596078733a96f2cff3d5b4258966f4a6e4a5a"
+ integrity sha512-SedfPDxJREYPATa7X2Fv26z6UVPYv6v9Z9P4nulnC6Yl8C2+Q4A/VIqTtgsJc0DU1YT3gM8ofVxircfHqqRVNA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/networks" "^10.1.4"
- "@polkadot/types" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/types-create" "9.2.2"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/networks" "^10.1.10"
+ "@polkadot/types" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/types-create" "9.5.1"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/types-support@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.2.2.tgz#d695b54b466bb47c0b376d07e9853d1ae3b17d5e"
- integrity sha512-JNcdTyMKGETV7pjE4eZ8eBs82c4ZSY7n1R1/xT/tNZNA6uNdukBxOOkyRHdu5ugEehwCMSpOgruMCNH9e77zLg==
+"@polkadot/types-support@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.5.1.tgz#5383cd84375aedd67bf0ccd2fa230d811f4b9dc9"
+ integrity sha512-mjenEGNT/ReY1xFexb37NDgV7QHHBBfWt31ZQMZKDkQL+R2P0rXFpmitcE3eOCV3oY4mf+GaU2N/ZfnsFl3tPQ==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/util" "^10.1.4"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/util" "^10.1.10"
-"@polkadot/types@9.2.2":
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.2.2.tgz#b74d098ed8c725f961c3d95b610c49bde1cf5334"
- integrity sha512-sDpS/m9oeihkYAYljZzp7xfMkJDLP5nLHSKkLdrh6H9XDVQnKgzJ19/kuAHsU8FCa9E37Al3aSQf/+NR+kCfZw==
+"@polkadot/types@9.5.1":
+ version "9.5.1"
+ resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.5.1.tgz#5f3891ce45d8d78aa0b5bc65d7517d98342699b0"
+ integrity sha512-xuhYq+O4JRl2iqLVEwKVHnfOA9AfwoNlHzrFx2DChDcIWdmgmUDASq9TkZhBP+jx81SieMH7iTf4zY6UwPKYQw==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/keyring" "^10.1.4"
- "@polkadot/types-augment" "9.2.2"
- "@polkadot/types-codec" "9.2.2"
- "@polkadot/types-create" "9.2.2"
- "@polkadot/util" "^10.1.4"
- "@polkadot/util-crypto" "^10.1.4"
- rxjs "^7.5.6"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/keyring" "^10.1.10"
+ "@polkadot/types-augment" "9.5.1"
+ "@polkadot/types-codec" "9.5.1"
+ "@polkadot/types-create" "9.5.1"
+ "@polkadot/util" "^10.1.10"
+ "@polkadot/util-crypto" "^10.1.10"
+ rxjs "^7.5.7"
-"@polkadot/util-crypto@10.1.7", "@polkadot/util-crypto@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.1.7.tgz#fe5ea006bf23ae19319f3ac9236905a984a65e2f"
- integrity sha512-zGmSU7a0wdWfpDtfc+Q7fUuW+extu9o1Uh4JpkuwwZ/dxmyW5xlfqVsIScM1pdPyjJsyamX8KwsKiVsW4slasg==
+"@polkadot/util-crypto@10.1.10", "@polkadot/util-crypto@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.1.10.tgz#ae00c794dda6a2f5e40cdaaa87987312461dc59f"
+ integrity sha512-w9h/wf4wZXeUkRnihhnfqlaKuoQtrjkjK3C5liCQkr9vx5zOsmg/nMSDP8UUFJX0msPPYpFeNvzn7oDIs6qSZA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@noble/hashes" "1.1.2"
- "@noble/secp256k1" "1.6.3"
- "@polkadot/networks" "10.1.7"
- "@polkadot/util" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@noble/hashes" "1.1.3"
+ "@noble/secp256k1" "1.7.0"
+ "@polkadot/networks" "10.1.10"
+ "@polkadot/util" "10.1.10"
"@polkadot/wasm-crypto" "^6.3.1"
- "@polkadot/x-bigint" "10.1.7"
- "@polkadot/x-randomvalues" "10.1.7"
+ "@polkadot/x-bigint" "10.1.10"
+ "@polkadot/x-randomvalues" "10.1.10"
"@scure/base" "1.1.1"
ed2curve "^0.3.0"
tweetnacl "^1.0.3"
-"@polkadot/util@10.1.7", "@polkadot/util@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.1.7.tgz#c54ca2a5b29cb834b40d8a876baefa3a0efb93af"
- integrity sha512-s7gDLdNb4HUpoe3faXwoO6HwiUp8pi66voYKiUYRh1kEtW1o9vGBgyZPHPGC/FBgILzTJKii/9XxnSex60zBTA==
+"@polkadot/util@10.1.10", "@polkadot/util@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.1.10.tgz#dc79c93d70e699e8cc1b09e636af7e4a64c5f0f0"
+ integrity sha512-BQoTfSxZ3BWAgWDjgKBVdyw1AJGaoOeAidCA+LZcHV6wlMu5643AZPUnoMrW413MbbpxsIhJXtNttqOwjo8MjA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-bigint" "10.1.7"
- "@polkadot/x-global" "10.1.7"
- "@polkadot/x-textdecoder" "10.1.7"
- "@polkadot/x-textencoder" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-bigint" "10.1.10"
+ "@polkadot/x-global" "10.1.10"
+ "@polkadot/x-textdecoder" "10.1.10"
+ "@polkadot/x-textencoder" "10.1.10"
"@types/bn.js" "^5.1.1"
bn.js "^5.2.1"
@@ -836,62 +831,62 @@
dependencies:
"@babel/runtime" "^7.18.9"
-"@polkadot/x-bigint@10.1.7", "@polkadot/x-bigint@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.1.7.tgz#1338689476ffdbb9f9cb243df1954ae8186134b9"
- integrity sha512-uaClHpI6cnDumIfejUKvNTkB43JleEb0V6OIufDKJ/e1aCLE3f/Ws9ggwL8ea05lQP5k5xqOzbPdizi/UvrgKQ==
+"@polkadot/x-bigint@10.1.10", "@polkadot/x-bigint@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.1.10.tgz#97dcccda2e24776aad3ae49f3268c03332138246"
+ integrity sha512-4Jt0BO0WTby6r9A2DgkDxf/LFaICQHvSl1VSFtBf0Z0GV2n4OxkBX5x/1bdEdGEvYT5rM7RbR3xI7EL+W1ixHA==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
-"@polkadot/x-fetch@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.1.7.tgz#1b76051a495563403a20ef235a8558c6d91b11a6"
- integrity sha512-NL+xrlqUoCLwCIAvQLwOA189gSUgeSGOFjCmZ9uMkBqf35KXeZoHWse6YaoseTSlnAal3dQOGbXnYWZ4Ck2OSA==
+"@polkadot/x-fetch@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.1.10.tgz#6551e44211cf21a1ca076eedc4676754345e1504"
+ integrity sha512-LvTxAN6GaJzfgZ74WFYPZrIkMEThpX5u7O4ILiExcJt87E19cSWlYSHDa5n+OLjUpq0lBV2ueF90iUblt6aHpg==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
"@types/node-fetch" "^2.6.2"
node-fetch "^3.2.10"
-"@polkadot/x-global@10.1.7", "@polkadot/x-global@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.1.7.tgz#91a472ac2f83fd0858dcd0df528844a5b650790e"
- integrity sha512-k2ZUZyBVgDnP/Ysxapa0mthn63j6gsN2V0kZejEQPyOfCHtQQkse3jFvAWdslpWoR8j2k8SN5O6reHc0F4f7mA==
+"@polkadot/x-global@10.1.10", "@polkadot/x-global@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.1.10.tgz#eedf63f1f3918c7f2bd8ef0907e051783f1a626e"
+ integrity sha512-WFfgaZSrzPlKLdnOus2mIFGzUbSDIQK6RMCfFfM9SmF3DkoxN40z5Nkni4PztfKr22stlkhmhnX/Lp/NxpuT6Q==
dependencies:
- "@babel/runtime" "^7.18.9"
+ "@babel/runtime" "^7.19.0"
-"@polkadot/x-randomvalues@10.1.7":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-10.1.7.tgz#d537f1f7bf3fb03e6c08ae6e6ac36e069c1f9844"
- integrity sha512-3er4UYOlozLGgFYWwcbmcFslmO8m82u4cAGR4AaEag0VdV7jLO/M5lTmivT/3rtLSww6sjkEfr522GM2Q5lmFg==
+"@polkadot/x-randomvalues@10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-10.1.10.tgz#a10f98f2c4d744612b68ee697e43f1e4d6e1f89a"
+ integrity sha512-KM4sCI/DNLIXlmnkeJIuYvh3pPuWvnkbR1a6TUB12J1izUJ+uGV+cAFRR4/EZk3oEsG/Tgivbs56meEOo3ws5A==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
-"@polkadot/x-textdecoder@10.1.7":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.1.7.tgz#1dd4e6141b1669acdd321a4da1fc6fdc271b7908"
- integrity sha512-iAFOHludmZFOyVL8sQFv4TDqbcqQU5gwwYv74duTA+WQBgbSITJrBahSCV/rXOjUqds9pzQO3qBFzziznNnkiQ==
+"@polkadot/x-textdecoder@10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.1.10.tgz#a6d0010b092bdefc69c70dcb34d76ec8993980b2"
+ integrity sha512-cAk37faYXx8IICeaq/tdl+aiIXwo3SLrx9XNoQqhX02g+SEs3ARM7zJcohj/p8ynWAI+ezNcsKn1wh174nquHw==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
-"@polkadot/x-textencoder@10.1.7":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.1.7.tgz#b208601f33b936c7a059f126dbb6b26a87f45864"
- integrity sha512-GzjaWZDbgzZ0IQT60xuZ7cZ0wnlNVYMqpfI9KvBc58X9dPI3TIMwzbXDVzZzpjY1SAqJGs4hJse9HMWZazfhew==
+"@polkadot/x-textencoder@10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.1.10.tgz#35b2e778b3dbb6816bb37f1848b772c4cd3c43d1"
+ integrity sha512-Auaql6BL5UHtWakZUQyj4y/BrM0tm4bYG5vXCMQCA1Gg0ky+46DhgpRrAQ9F7NNgWg1A6dA2I9KuAA4BTbNx0w==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
-"@polkadot/x-ws@^10.1.4":
- version "10.1.7"
- resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.1.7.tgz#b1fbfe3e16fa809f35f24ef47fde145b018d8cdc"
- integrity sha512-aNkotxHx3qPVjiItD9lbNONs4GNzqeeZ98wHtCjd9JWl/g+xNkOVF3xQ8++1qSHPBEYSwKh9URjQH2+CD2XlvQ==
+"@polkadot/x-ws@^10.1.10":
+ version "10.1.10"
+ resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.1.10.tgz#27b55a988a0f60db7f79fed8268802406f522813"
+ integrity sha512-JxDgfm0ox2XPAtdTeJXYl6qq7LY/KOPi69wRpFMczWaYUsZubO6EiRzgzjuFlHY4/oxfjS/D+YbzcjefTxHz6g==
dependencies:
- "@babel/runtime" "^7.18.9"
- "@polkadot/x-global" "10.1.7"
+ "@babel/runtime" "^7.19.0"
+ "@polkadot/x-global" "10.1.10"
"@types/websocket" "^1.0.5"
websocket "^1.0.34"
@@ -910,27 +905,27 @@
resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz#fa5738039586c648013caa6a0c95c43265dbe77d"
integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg==
-"@substrate/connect@0.7.10":
- version "0.7.10"
- resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.10.tgz#db49a62188cd830a8dc8848240e635da21f333ff"
- integrity sha512-WNdW18e0I696/AQjrAXdMD9W8YaKLTcPr2Cu8scSwiUT40in84KEzi+g+P367cE2etAc+Dvu8vNDEQTbUPNqEg==
+"@substrate/connect@0.7.14":
+ version "0.7.14"
+ resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.14.tgz#c090e952e9cdd93185a94d24fbc424ea20fe7bbe"
+ integrity sha512-uW5uBmihpivshmmmw+rsg7qOV0KqVSep4rWOXFMP8aFQinvmqw4JqxP21og4H/7JZxttYUBFQVsdtXHGKJ0aVQ==
dependencies:
"@substrate/connect-extension-protocol" "^1.0.1"
- "@substrate/smoldot-light" "0.6.27"
+ "@substrate/smoldot-light" "0.6.34"
eventemitter3 "^4.0.7"
-"@substrate/smoldot-light@0.6.27":
- version "0.6.27"
- resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.27.tgz#7e66ad4bfddce4168a6008f6be8c771c881ae585"
- integrity sha512-Wy3fbyfZqR3HLynuxeBkUunZsrbqpsmFN+D0/8cVIHZbO7WDwJsmCUc32yO5r+v6s/T97L7FOJHEyMWmRfnKAQ==
+"@substrate/smoldot-light@0.6.34":
+ version "0.6.34"
+ resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.34.tgz#273dba622102281fd0fdb0e375198bff2ec584c3"
+ integrity sha512-+HK9MaJ0HelJmpf4YYR+salJ7dhVBltmhGlyz5l8OXS9DW18fe0Z2wxEo8P5kX9CUxlCXEb8J9JBRQAYBPHbwQ==
dependencies:
pako "^2.0.4"
- websocket "^1.0.32"
+ ws "^8.8.1"
-"@substrate/ss58-registry@^1.28.0":
- version "1.29.0"
- resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.29.0.tgz#0dea078271b5318c5eff7176e1df1f9b2c27e43f"
- integrity sha512-KTqwZgTjtWPhCAUJJx9qswP/p9cRKUU9GOHYUDKNdISFDiFafWmpI54JHfYLkgjvkSKEUgRZnvLpe0LMF1fXvw==
+"@substrate/ss58-registry@^1.31.0":
+ version "1.31.0"
+ resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.31.0.tgz#489e3a496081dc3ee7ef5ef2eb513962d5d29351"
+ integrity sha512-OSOmdjaq9foXfHBy9aLVMwGheygvsiZlv4dggnLOYOuhSmNCsSB/PaW4DBz+/tSdK1Fo9+ZiFW6cF24RA+m0sw==
"@szmarczak/http-timer@^4.0.5":
version "4.0.6"
@@ -1023,9 +1018,9 @@
integrity sha512-BsPXH/irW0ht0Ji6iw/jJaK8Lj3FJemon2gvEqHKpCdDCeemHa+rI3WBGq5z7cDMZgoLjY40oninGxqk+8NzNQ==
"@types/har-format@*":
- version "1.2.8"
- resolved "https://registry.yarnpkg.com/@types/har-format/-/har-format-1.2.8.tgz#e6908b76d4c88be3db642846bb8b455f0bfb1c4e"
- integrity sha512-OP6L9VuZNdskgNN3zFQQ54ceYD8OLq5IbqO4VK91ORLfOm7WdT/CiT/pHEBSQEqCInJ2y3O6iCm/zGtPElpgJQ==
+ version "1.2.9"
+ resolved "https://registry.yarnpkg.com/@types/har-format/-/har-format-1.2.9.tgz#b9b3a9bfc33a078e7d898a00b09662910577f4a4"
+ integrity sha512-rffW6MhQ9yoa75bdNi+rjZBAvu2HhehWJXlhuWXnWdENeuKe82wUgAwxYOb7KRKKmxYN+D/iRKd2NDQMLqlUmg==
"@types/http-cache-semantics@*":
version "4.0.1"
@@ -1044,10 +1039,10 @@
dependencies:
"@types/node" "*"
-"@types/mocha@^9.1.1":
- version "9.1.1"
- resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4"
- integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==
+"@types/mocha@^10.0.0":
+ version "10.0.0"
+ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.0.tgz#3d9018c575f0e3f7386c1de80ee66cc21fbb7a52"
+ integrity sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==
"@types/node-fetch@^2.6.2":
version "2.6.2"
@@ -1058,9 +1053,9 @@
form-data "^3.0.0"
"@types/node@*":
- version "18.7.16"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.16.tgz#0eb3cce1e37c79619943d2fd903919fc30850601"
- integrity sha512-EQHhixfu+mkqHMZl1R2Ovuvn47PUw18azMJOTwSZr9/fhzHNGXAJ0ma0dayRVchprpCj0Kc1K1xKoWaATWF1qg==
+ version "18.8.3"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.3.tgz#ce750ab4017effa51aed6a7230651778d54e327c"
+ integrity sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==
"@types/node@^12.12.6":
version "12.20.55"
@@ -1101,84 +1096,83 @@
"@types/node" "*"
"@typescript-eslint/eslint-plugin@^5.26.0":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz#6df092a20e0f9ec748b27f293a12cb39d0c1fe4d"
- integrity sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz#778b2d9e7f293502c7feeea6c74dca8eb3e67511"
+ integrity sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==
dependencies:
- "@typescript-eslint/scope-manager" "5.36.2"
- "@typescript-eslint/type-utils" "5.36.2"
- "@typescript-eslint/utils" "5.36.2"
+ "@typescript-eslint/scope-manager" "5.39.0"
+ "@typescript-eslint/type-utils" "5.39.0"
+ "@typescript-eslint/utils" "5.39.0"
debug "^4.3.4"
- functional-red-black-tree "^1.0.1"
ignore "^5.2.0"
regexpp "^3.2.0"
semver "^7.3.7"
tsutils "^3.21.0"
"@typescript-eslint/parser@^5.26.0":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.36.2.tgz#3ddf323d3ac85a25295a55fcb9c7a49ab4680ddd"
- integrity sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.39.0.tgz#93fa0bc980a3a501e081824f6097f7ca30aaa22b"
+ integrity sha512-PhxLjrZnHShe431sBAGHaNe6BDdxAASDySgsBCGxcBecVCi8NQWxQZMcizNA4g0pN51bBAn/FUfkWG3SDVcGlA==
dependencies:
- "@typescript-eslint/scope-manager" "5.36.2"
- "@typescript-eslint/types" "5.36.2"
- "@typescript-eslint/typescript-estree" "5.36.2"
+ "@typescript-eslint/scope-manager" "5.39.0"
+ "@typescript-eslint/types" "5.39.0"
+ "@typescript-eslint/typescript-estree" "5.39.0"
debug "^4.3.4"
-"@typescript-eslint/scope-manager@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz#a75eb588a3879ae659514780831370642505d1cd"
- integrity sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==
+"@typescript-eslint/scope-manager@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz#873e1465afa3d6c78d8ed2da68aed266a08008d0"
+ integrity sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==
dependencies:
- "@typescript-eslint/types" "5.36.2"
- "@typescript-eslint/visitor-keys" "5.36.2"
+ "@typescript-eslint/types" "5.39.0"
+ "@typescript-eslint/visitor-keys" "5.39.0"
-"@typescript-eslint/type-utils@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz#752373f4babf05e993adf2cd543a763632826391"
- integrity sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==
+"@typescript-eslint/type-utils@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.39.0.tgz#0a8c00f95dce4335832ad2dc6bc431c14e32a0a6"
+ integrity sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==
dependencies:
- "@typescript-eslint/typescript-estree" "5.36.2"
- "@typescript-eslint/utils" "5.36.2"
+ "@typescript-eslint/typescript-estree" "5.39.0"
+ "@typescript-eslint/utils" "5.39.0"
debug "^4.3.4"
tsutils "^3.21.0"
-"@typescript-eslint/types@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.36.2.tgz#a5066e500ebcfcee36694186ccc57b955c05faf9"
- integrity sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==
+"@typescript-eslint/types@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.39.0.tgz#f4e9f207ebb4579fd854b25c0bf64433bb5ed78d"
+ integrity sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==
-"@typescript-eslint/typescript-estree@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz#0c93418b36c53ba0bc34c61fe9405c4d1d8fe560"
- integrity sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==
+"@typescript-eslint/typescript-estree@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz#c0316aa04a1a1f4f7f9498e3c13ef1d3dc4cf88b"
+ integrity sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==
dependencies:
- "@typescript-eslint/types" "5.36.2"
- "@typescript-eslint/visitor-keys" "5.36.2"
+ "@typescript-eslint/types" "5.39.0"
+ "@typescript-eslint/visitor-keys" "5.39.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"
-"@typescript-eslint/utils@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.36.2.tgz#b01a76f0ab244404c7aefc340c5015d5ce6da74c"
- integrity sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==
+"@typescript-eslint/utils@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.39.0.tgz#b7063cca1dcf08d1d21b0d91db491161ad0be110"
+ integrity sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==
dependencies:
"@types/json-schema" "^7.0.9"
- "@typescript-eslint/scope-manager" "5.36.2"
- "@typescript-eslint/types" "5.36.2"
- "@typescript-eslint/typescript-estree" "5.36.2"
+ "@typescript-eslint/scope-manager" "5.39.0"
+ "@typescript-eslint/types" "5.39.0"
+ "@typescript-eslint/typescript-estree" "5.39.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
-"@typescript-eslint/visitor-keys@5.36.2":
- version "5.36.2"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz#2f8f78da0a3bad3320d2ac24965791ac39dace5a"
- integrity sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==
+"@typescript-eslint/visitor-keys@5.39.0":
+ version "5.39.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz#8f41f7d241b47257b081ddba5d3ce80deaae61e2"
+ integrity sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==
dependencies:
- "@typescript-eslint/types" "5.36.2"
+ "@typescript-eslint/types" "5.39.0"
eslint-visitor-keys "^3.3.0"
"@ungap/promise-all-settled@1.1.2":
@@ -1187,9 +1181,9 @@
integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==
abortcontroller-polyfill@^1.7.3:
- version "1.7.3"
- resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz#1b5b487bd6436b5b764fd52a612509702c3144b5"
- integrity sha512-zetDJxd89y3X99Kvo4qFx8GKlt6GsvN3UcRZHwU6iFA/0KiOmhkTVhe8oRoTBiTVPZu09x3vCra47+w8Yz1+2Q==
+ version "1.7.5"
+ resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed"
+ integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==
accepts@~1.3.8:
version "1.3.8"
@@ -1352,7 +1346,7 @@
dependencies:
tweetnacl "^0.14.3"
-bignumber.js@^9.0.0, bignumber.js@^9.0.2:
+bignumber.js@^9.0.0, bignumber.js@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.0.tgz#8d340146107fe3a6cb8d40699643c302e8773b62"
integrity sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==
@@ -1387,10 +1381,10 @@
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
-body-parser@1.20.0, body-parser@^1.16.0:
- version "1.20.0"
- resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.0.tgz#3de69bd89011c11573d7bfee6a64f11b6bd27cc5"
- integrity sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==
+body-parser@1.20.1, body-parser@^1.16.0:
+ version "1.20.1"
+ resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668"
+ integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==
dependencies:
bytes "3.1.2"
content-type "~1.0.4"
@@ -1400,7 +1394,7 @@
http-errors "2.0.0"
iconv-lite "0.4.24"
on-finished "2.4.1"
- qs "6.10.3"
+ qs "6.11.0"
raw-body "2.5.1"
type-is "~1.6.18"
unpipe "1.0.0"
@@ -1491,15 +1485,15 @@
readable-stream "^3.6.0"
safe-buffer "^5.2.0"
-browserslist@^4.20.2:
- version "4.21.3"
- resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.3.tgz#5df277694eb3c48bc5c4b05af3e8b7e09c5a6d1a"
- integrity sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==
+browserslist@^4.21.3:
+ version "4.21.4"
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987"
+ integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==
dependencies:
- caniuse-lite "^1.0.30001370"
- electron-to-chromium "^1.4.202"
+ caniuse-lite "^1.0.30001400"
+ electron-to-chromium "^1.4.251"
node-releases "^2.0.6"
- update-browserslist-db "^1.0.5"
+ update-browserslist-db "^1.0.9"
bs58@^4.0.0:
version "4.0.1"
@@ -1593,10 +1587,10 @@
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
-caniuse-lite@^1.0.30001370:
- version "1.0.30001393"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001393.tgz#1aa161e24fe6af2e2ccda000fc2b94be0b0db356"
- integrity sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA==
+caniuse-lite@^1.0.30001400:
+ version "1.0.30001418"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz#5f459215192a024c99e3e3a53aac310fc7cf24e6"
+ integrity sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg==
caseless@~0.12.0:
version "0.12.0"
@@ -1703,6 +1697,15 @@
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
+cliui@^8.0.1:
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
+ integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
+ dependencies:
+ string-width "^4.2.0"
+ strip-ansi "^6.0.1"
+ wrap-ansi "^7.0.0"
+
clone-deep@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387"
@@ -2057,10 +2060,10 @@
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
-electron-to-chromium@^1.4.202:
- version "1.4.246"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.246.tgz#802132d1bbd3ff32ce82fcd6a6ed6ab59b4366dc"
- integrity sha512-/wFCHUE+Hocqr/LlVGsuKLIw4P2lBWwFIDcNMDpJGzyIysQV4aycpoOitAs32FT94EHKnNqDR/CVZJFbXEufJA==
+electron-to-chromium@^1.4.251:
+ version "1.4.276"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.276.tgz#17837b19dafcc43aba885c4689358b298c19b520"
+ integrity sha512-EpuHPqu8YhonqLBXHoU6hDJCD98FCe6KDoet3/gY1qsQ6usjJoHqBH2YIVs8FXaAtHwVL8Uqa/fsYao/vq9VWQ==
elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4:
version "6.5.4"
@@ -2093,21 +2096,21 @@
once "^1.4.0"
es-abstract@^1.19.0, es-abstract@^1.19.5, es-abstract@^1.20.0:
- version "1.20.2"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.2.tgz#8495a07bc56d342a3b8ea3ab01bd986700c2ccb3"
- integrity sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ==
+ version "1.20.4"
+ resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861"
+ integrity sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==
dependencies:
call-bind "^1.0.2"
es-to-primitive "^1.2.1"
function-bind "^1.1.1"
function.prototype.name "^1.1.5"
- get-intrinsic "^1.1.2"
+ get-intrinsic "^1.1.3"
get-symbol-description "^1.0.0"
has "^1.0.3"
has-property-descriptors "^1.0.0"
has-symbols "^1.0.3"
internal-slot "^1.0.3"
- is-callable "^1.2.4"
+ is-callable "^1.2.7"
is-negative-zero "^2.0.2"
is-regex "^1.1.4"
is-shared-array-buffer "^1.0.2"
@@ -2117,6 +2120,7 @@
object-keys "^1.1.1"
object.assign "^4.1.4"
regexp.prototype.flags "^1.4.3"
+ safe-regex-test "^1.0.0"
string.prototype.trimend "^1.0.5"
string.prototype.trimstart "^1.0.5"
unbox-primitive "^1.0.2"
@@ -2215,13 +2219,12 @@
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
eslint@^8.16.0:
- version "8.23.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.23.0.tgz#a184918d288820179c6041bb3ddcc99ce6eea040"
- integrity sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==
+ version "8.25.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.25.0.tgz#00eb962f50962165d0c4ee3327708315eaa8058b"
+ integrity sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==
dependencies:
- "@eslint/eslintrc" "^1.3.1"
- "@humanwhocodes/config-array" "^0.10.4"
- "@humanwhocodes/gitignore-to-minimatch" "^1.0.2"
+ "@eslint/eslintrc" "^1.3.3"
+ "@humanwhocodes/config-array" "^0.10.5"
"@humanwhocodes/module-importer" "^1.0.1"
ajv "^6.10.0"
chalk "^4.0.0"
@@ -2238,7 +2241,6 @@
fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
find-up "^5.0.0"
- functional-red-black-tree "^1.0.1"
glob-parent "^6.0.1"
globals "^13.15.0"
globby "^11.1.0"
@@ -2247,6 +2249,7 @@
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
is-glob "^4.0.0"
+ js-sdsl "^4.1.4"
js-yaml "^4.1.0"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
@@ -2397,13 +2400,13 @@
safe-buffer "^5.1.1"
express@^4.14.0:
- version "4.18.1"
- resolved "https://registry.yarnpkg.com/express/-/express-4.18.1.tgz#7797de8b9c72c857b9cd0e14a5eea80666267caf"
- integrity sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==
+ version "4.18.2"
+ resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"
+ integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==
dependencies:
accepts "~1.3.8"
array-flatten "1.1.1"
- body-parser "1.20.0"
+ body-parser "1.20.1"
content-disposition "0.5.4"
content-type "~1.0.4"
cookie "0.5.0"
@@ -2422,7 +2425,7 @@
parseurl "~1.3.3"
path-to-regexp "0.1.7"
proxy-addr "~2.0.7"
- qs "6.10.3"
+ qs "6.11.0"
range-parser "~1.2.1"
safe-buffer "5.2.1"
send "0.18.0"
@@ -2575,9 +2578,9 @@
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
follow-redirects@^1.12.1:
- version "1.15.1"
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5"
- integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==
+ version "1.15.2"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
+ integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
for-each@^0.3.3:
version "0.3.3"
@@ -2672,11 +2675,6 @@
es-abstract "^1.19.0"
functions-have-names "^1.2.2"
-functional-red-black-tree@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
- integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==
-
functions-have-names@^1.2.2:
version "1.2.3"
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
@@ -2697,10 +2695,10 @@
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==
-get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@^1.1.2:
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.2.tgz#336975123e05ad0b7ba41f152ee4aadbea6cf598"
- integrity sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==
+get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385"
+ integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==
dependencies:
function-bind "^1.1.1"
has "^1.0.3"
@@ -3086,10 +3084,10 @@
call-bind "^1.0.2"
has-tostringtag "^1.0.0"
-is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.4:
- version "1.2.4"
- resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945"
- integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==
+is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
+ version "1.2.7"
+ resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
+ integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==
is-date-object@^1.0.1:
version "1.0.5"
@@ -3233,6 +3231,11 @@
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==
+js-sdsl@^4.1.4:
+ version "4.1.5"
+ resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.5.tgz#1ff1645e6b4d1b028cd3f862db88c9d887f26e2a"
+ integrity sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==
+
js-sha3@0.8.0, js-sha3@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840"
@@ -4025,10 +4028,10 @@
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
-qs@6.10.3:
- version "6.10.3"
- resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e"
- integrity sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==
+qs@6.11.0:
+ version "6.11.0"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
+ integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==
dependencies:
side-channel "^1.0.4"
@@ -4203,10 +4206,10 @@
dependencies:
queue-microtask "^1.2.2"
-rxjs@^7.5.6:
- version "7.5.6"
- resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.6.tgz#0446577557862afd6903517ce7cae79ecb9662bc"
- integrity sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==
+rxjs@^7.5.7:
+ version "7.5.7"
+ resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39"
+ integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==
dependencies:
tslib "^2.1.0"
@@ -4220,6 +4223,15 @@
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
+safe-regex-test@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295"
+ integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==
+ dependencies:
+ call-bind "^1.0.2"
+ get-intrinsic "^1.1.3"
+ is-regex "^1.1.4"
+
"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
@@ -4250,9 +4262,9 @@
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.3.7:
- version "7.3.7"
- resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
- integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
+ version "7.3.8"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
+ integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
dependencies:
lru-cache "^6.0.0"
@@ -4368,10 +4380,10 @@
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
-solc@0.8.14-fixed:
- version "0.8.14-fixed"
- resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.14-fixed.tgz#a730a1e8259ac06313f6b7287df046ebe1dddc13"
- integrity sha512-jFYa2fKbk95olckuDbhs9kbtaUhLRllM7aC++mLinJBUcdHbaHVM8LxHaJpOIDdnHBV9TpIP4XBybVugqMDyhA==
+solc@0.8.17:
+ version "0.8.17"
+ resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.17.tgz#c748fec6a64bf029ec406aa9b37e75938d1115ae"
+ integrity sha512-Dtidk2XtTTmkB3IKdyeg6wLYopJnBVxdoykN8oP8VY3PQjN16BScYoUJTXFm2OP7P0hXNAqWiJNmmfuELtLf8g==
dependencies:
command-exists "^1.2.8"
commander "^8.1.0"
@@ -4666,14 +4678,14 @@
is-typedarray "^1.0.0"
typescript@^4.7.2:
- version "4.8.3"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88"
- integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==
+ version "4.8.4"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
+ integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
uglify-js@^3.1.4:
- version "3.17.0"
- resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.0.tgz#55bd6e9d19ce5eef0d5ad17cd1f587d85b180a85"
- integrity sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==
+ version "3.17.3"
+ resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.3.tgz#f0feedf019c4510f164099e8d7e72ff2d7304377"
+ integrity sha512-JmMFDME3iufZnBpyKL+uS78LRiC+mK55zWfM5f/pWBJfpOttXAqYfdDGRukYhJuyRinvPVAtUhvy7rlDybNtFg==
ultron@~1.1.0:
version "1.1.1"
@@ -4700,10 +4712,10 @@
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
-update-browserslist-db@^1.0.5:
- version "1.0.7"
- resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz#16279639cff1d0f800b14792de43d97df2d11b7d"
- integrity sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg==
+update-browserslist-db@^1.0.9:
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3"
+ integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==
dependencies:
escalade "^3.1.1"
picocolors "^1.0.0"
@@ -4793,85 +4805,85 @@
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
-web3-bzz@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.7.5.tgz#edeb262c3a6619109763077a94172513cf07cdde"
- integrity sha512-Z53sY0YK/losqjJncmL4vP0zZI9r6tiXg6o7R6e1JD2Iy7FH3serQvU+qXmPjqEBzsnhf8wTG+YcBPB3RHpr0Q==
+web3-bzz@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.8.0.tgz#2023676d7c17ea36512bf76eb310755a02a3d464"
+ integrity sha512-caDtdKeLi7+2Vb+y+cq2yyhkNjnxkFzVW0j1DtemarBg3dycG1iEl75CVQMLNO6Wkg+HH9tZtRnUyFIe5LIUeQ==
dependencies:
"@types/node" "^12.12.6"
got "12.1.0"
swarm-js "^0.1.40"
-web3-core-helpers@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.7.5.tgz#e97b3ecac787ade4b9390807a86aca78ed97872b"
- integrity sha512-lDDjTks6Q6aNUO87RYrY2xub3UWTKr/RIWxpHJODEqkLxZS1dWdyliJ6aIx3031VQwsNT5HE7NvABe/t0p3iDQ==
+web3-core-helpers@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.8.0.tgz#5dcfdda1a4ea277041d912003198f1334ca29d7c"
+ integrity sha512-nMAVwZB3rEp/khHI2BvFy0e/xCryf501p5NGjswmJtEM+Zrd3Biaw52JrB1qAZZIzCA8cmLKaOgdfamoDOpWdw==
dependencies:
- web3-eth-iban "1.7.5"
- web3-utils "1.7.5"
+ web3-eth-iban "1.8.0"
+ web3-utils "1.8.0"
-web3-core-method@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.7.5.tgz#ffe8883c169468f0e4d13509377f2d8876d9b7be"
- integrity sha512-ApTvq1Llzlbxmy0n4L7QaE6NodIsR80VJqk8qN4kLg30SGznt/pNJFebryLI2kpyDmxSgj1TjEWzmHJBp6FhYg==
+web3-core-method@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.8.0.tgz#9c2da8896808917d1679c319f19e2174ba17086c"
+ integrity sha512-c94RAzo3gpXwf2rf8rL8C77jOzNWF4mXUoUfZYYsiY35cJFd46jQDPI00CB5+ZbICTiA5mlVzMj4e7jAsTqiLA==
dependencies:
"@ethersproject/transactions" "^5.6.2"
- web3-core-helpers "1.7.5"
- web3-core-promievent "1.7.5"
- web3-core-subscriptions "1.7.5"
- web3-utils "1.7.5"
+ web3-core-helpers "1.8.0"
+ web3-core-promievent "1.8.0"
+ web3-core-subscriptions "1.8.0"
+ web3-utils "1.8.0"
-web3-core-promievent@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.7.5.tgz#56a9b06a20e20a0a89d2ab7f88d44c8ae01d5b62"
- integrity sha512-uZ1VRErVuhiLtHlyt3oEH/JSvAf6bWPndChHR9PG7i1Zfqm6ZVCeM91ICTPmiL8ddsGQOxASpnJk4vhApcTIww==
+web3-core-promievent@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.8.0.tgz#979765fd4d37ab0f158f0ee54037b279b737bd53"
+ integrity sha512-FGLyjAuOaAQ+ZhV6iuw9tg/9WvIkSZXKHQ4mdTyQ8MxVraOtFivOCbuLLsGgapfHYX+RPxsc1j1YzQjKoupagQ==
dependencies:
eventemitter3 "4.0.4"
-web3-core-requestmanager@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.7.5.tgz#be18fc99642689aeb2e016fa43fb47bb9e8c94ce"
- integrity sha512-3KpfxW/wVH4mgwWEsSJGHKrtRVoijWlDxtUrm17xgtqRNZ2mFolifKnHAUKa0fY48C9CrxmcCiMIi3W4G6WYRw==
+web3-core-requestmanager@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.8.0.tgz#06189df80cf52d24a195a7ef655031afe8192df3"
+ integrity sha512-2AoYCs3Owl5foWcf4uKPONyqFygSl9T54L8b581U16nsUirjhoTUGK/PBhMDVcLCmW4QQmcY5A8oPFpkQc1TTg==
dependencies:
util "^0.12.0"
- web3-core-helpers "1.7.5"
- web3-providers-http "1.7.5"
- web3-providers-ipc "1.7.5"
- web3-providers-ws "1.7.5"
+ web3-core-helpers "1.8.0"
+ web3-providers-http "1.8.0"
+ web3-providers-ipc "1.8.0"
+ web3-providers-ws "1.8.0"
-web3-core-subscriptions@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.7.5.tgz#c0e25610768ea9d9f9107b4ac74b6b6573125e00"
- integrity sha512-YK6utQ7Wwjbe4XZOIA8quWGBPi1lFDS1A+jQYwxKKrCvm6BloBNc3FhvrcSYlDhLe/kOy8+2Je8i9amndgT4ww==
+web3-core-subscriptions@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.8.0.tgz#ff66ae4467c8cb4716367248bcefb1845c0f8b83"
+ integrity sha512-7lHVRzDdg0+Gcog55lG6Q3D8JV+jN+4Ly6F8cSn9xFUAwOkdbgdWsjknQG7t7CDWy21DQkvdiY2BJF8S68AqOA==
dependencies:
eventemitter3 "4.0.4"
- web3-core-helpers "1.7.5"
+ web3-core-helpers "1.8.0"
-web3-core@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.7.5.tgz#8ee2ca490230a30ca970cb9f308eb65b76405e1d"
- integrity sha512-UgOWXZr1fR/3cUQJKWbfMwRxj1/N7o6RSd/dHqdXBlOD+62EjNZItFmLRg5veq5kp9YfXzrNw9bnDkXfsL+nKQ==
+web3-core@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.8.0.tgz#90afce527ac1b1dff8cbed2acbc0336530b8aacf"
+ integrity sha512-9sCA+Z02ci6zoY2bAquFiDjujRwmSKHiSGi4B8IstML8okSytnzXk1izHYSynE7ahIkguhjWAuXFvX76F5rAbA==
dependencies:
"@types/bn.js" "^5.1.0"
"@types/node" "^12.12.6"
bignumber.js "^9.0.0"
- web3-core-helpers "1.7.5"
- web3-core-method "1.7.5"
- web3-core-requestmanager "1.7.5"
- web3-utils "1.7.5"
+ web3-core-helpers "1.8.0"
+ web3-core-method "1.8.0"
+ web3-core-requestmanager "1.8.0"
+ web3-utils "1.8.0"
-web3-eth-abi@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.7.5.tgz#db9d6dbcc043a6e922252f3228686e9bbd50d7c9"
- integrity sha512-qWHvF7sayxql9BD1yqK9sZRLBQ66eJzGeaU53Y1PRq2iFPrhY6NUWxQ3c3ps0rg+dyObvRbloviWpKXcS4RE/A==
+web3-eth-abi@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.8.0.tgz#47fdff00bfdfa72064c9c612ff6369986598196d"
+ integrity sha512-xPeMb2hS9YLQK/Q5YZpkcmzoRGM+/R8bogSrYHhNC3hjZSSU0YRH+1ZKK0f9YF4qDZaPMI8tKWIMSCDIpjG6fg==
dependencies:
"@ethersproject/abi" "^5.6.3"
- web3-utils "1.7.5"
+ web3-utils "1.8.0"
-web3-eth-accounts@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.7.5.tgz#b37ee3aeebcc6bce3337636aeb272cbba0ece547"
- integrity sha512-AzMLoTj3RGwKpyp3x3TtHrEeU4VpR99iMOD6NKrWSDumS6QEi0lCo+y7QZhdTlINw3iIA3SFIdvbAOO4NCHSDg==
+web3-eth-accounts@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.8.0.tgz#960d947ee87a49d6c706dc6312334fbfbd6ff812"
+ integrity sha512-HQ/MDSv4bexwJLvnqsM6xpGE7c2NVOqyhzOZFyMUKXbIwIq85T3TaLnM9pCN7XqMpDcfxqiZ3q43JqQVkzHdmw==
dependencies:
"@ethereumjs/common" "^2.5.0"
"@ethereumjs/tx" "^3.3.2"
@@ -4880,127 +4892,127 @@
ethereumjs-util "^7.0.10"
scrypt-js "^3.0.1"
uuid "3.3.2"
- web3-core "1.7.5"
- web3-core-helpers "1.7.5"
- web3-core-method "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-helpers "1.8.0"
+ web3-core-method "1.8.0"
+ web3-utils "1.8.0"
-web3-eth-contract@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.7.5.tgz#a032419579bcec062513a3d089ad0e89ac63d731"
- integrity sha512-qab7NPJRKRlTs58ozsqK8YIEwWpxIm3vD/okSIKBGkFx5gIHWW+vGmMh5PDSfefLJM9rCd+T+Lc0LYvtME7uqg==
+web3-eth-contract@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.8.0.tgz#58f4ce0bde74e5ce87663502e409a92abad7b2c5"
+ integrity sha512-6xeXhW2YoCrz2Ayf2Vm4srWiMOB6LawkvxWJDnUWJ8SMATg4Pgu42C/j8rz/enXbYWt2IKuj0kk8+QszxQbK+Q==
dependencies:
"@types/bn.js" "^5.1.0"
- web3-core "1.7.5"
- web3-core-helpers "1.7.5"
- web3-core-method "1.7.5"
- web3-core-promievent "1.7.5"
- web3-core-subscriptions "1.7.5"
- web3-eth-abi "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-helpers "1.8.0"
+ web3-core-method "1.8.0"
+ web3-core-promievent "1.8.0"
+ web3-core-subscriptions "1.8.0"
+ web3-eth-abi "1.8.0"
+ web3-utils "1.8.0"
-web3-eth-ens@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.7.5.tgz#fa0e287f5e6fae20531117b7467e21b482d58cab"
- integrity sha512-k1Q0msdRv/wac2egpZBIwG3n/sa/KdrVmVJvFm471gLTL4xfUizV5qJjkDVf+ikf9JyDvWJTs5eWNUUbOFIw/A==
+web3-eth-ens@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.8.0.tgz#f1937371eac54b087ebe2e871780c2710d39998d"
+ integrity sha512-/eFbQEwvsMOEiOhw9/iuRXCsPkqAmHHWuFOrThQkozRgcnSTRnvxkkRC/b6koiT5/HaKeUs4yQDg+/ixsIxZxA==
dependencies:
content-hash "^2.5.2"
eth-ens-namehash "2.0.8"
- web3-core "1.7.5"
- web3-core-helpers "1.7.5"
- web3-core-promievent "1.7.5"
- web3-eth-abi "1.7.5"
- web3-eth-contract "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-helpers "1.8.0"
+ web3-core-promievent "1.8.0"
+ web3-eth-abi "1.8.0"
+ web3-eth-contract "1.8.0"
+ web3-utils "1.8.0"
-web3-eth-iban@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.7.5.tgz#1a50efa42cabf1b731396d38bef6a8bf92b5ee1f"
- integrity sha512-mn2W5t/1IpL8OZvzAabLKT4kvwRnZSJ9K0tctndl9sDNWkfITYQibEEhUaNNA50Q5fJKgVudHI/m0gwIVTyG8Q==
+web3-eth-iban@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.8.0.tgz#3af8a0c95b5f7b0b81ab0bcd2075c1e5dda31520"
+ integrity sha512-4RbvUxcMpo/e5811sE3a6inJ2H4+FFqUVmlRYs0RaXaxiHweahSRBNcpO0UWgmlePTolj0rXqPT2oEr0DuC8kg==
dependencies:
bn.js "^5.2.1"
- web3-utils "1.7.5"
+ web3-utils "1.8.0"
-web3-eth-personal@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.7.5.tgz#615a3ddcf97aeea93e2a4569753c033fd7a495c5"
- integrity sha512-txh2P/eN8I4AOUKFi9++KKddoD0tWfCuu9Y1Kc41jSRbk6smO88Fum0KWNmYFYhSCX2qiknS1DfqsONl3igoKQ==
+web3-eth-personal@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.8.0.tgz#433c35e2e042844402a12d543c4126ea1494b478"
+ integrity sha512-L7FT4nR3HmsfZyIAhFpEctKkYGOjRC2h6iFKs9gnFCHZga8yLcYcGaYOBIoYtaKom99MuGBoosayWt/Twh7F5A==
dependencies:
"@types/node" "^12.12.6"
- web3-core "1.7.5"
- web3-core-helpers "1.7.5"
- web3-core-method "1.7.5"
- web3-net "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-helpers "1.8.0"
+ web3-core-method "1.8.0"
+ web3-net "1.8.0"
+ web3-utils "1.8.0"
-web3-eth@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.7.5.tgz#36906f50a6c35570cbc08871a33caa83dc131c9c"
- integrity sha512-BucjvqZyDWYkGlsFX+OnOBub0YutlC1KZiNGibdmvtNX0NQK+8iw1uzAoL9yTTwCSszL7lnkFe8N+HCOl9B4Dw==
+web3-eth@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.8.0.tgz#006974a5d5e30644d05814111f9e162a72e4a09c"
+ integrity sha512-hist52os3OT4TQFB/GxPSMxTh3995sz6LPvQpPvj7ktSbpg9RNSFaSsPlCT63wUAHA3PZb1FemkAIeQM5t72Lw==
dependencies:
- web3-core "1.7.5"
- web3-core-helpers "1.7.5"
- web3-core-method "1.7.5"
- web3-core-subscriptions "1.7.5"
- web3-eth-abi "1.7.5"
- web3-eth-accounts "1.7.5"
- web3-eth-contract "1.7.5"
- web3-eth-ens "1.7.5"
- web3-eth-iban "1.7.5"
- web3-eth-personal "1.7.5"
- web3-net "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-helpers "1.8.0"
+ web3-core-method "1.8.0"
+ web3-core-subscriptions "1.8.0"
+ web3-eth-abi "1.8.0"
+ web3-eth-accounts "1.8.0"
+ web3-eth-contract "1.8.0"
+ web3-eth-ens "1.8.0"
+ web3-eth-iban "1.8.0"
+ web3-eth-personal "1.8.0"
+ web3-net "1.8.0"
+ web3-utils "1.8.0"
-web3-net@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.7.5.tgz#87fbc00a9ca40515bf60c847c0092498887cfdc8"
- integrity sha512-xwuCb2YWw49PmW81AJQ/G+Xi2ikRsYyZXSgyPt4LmZuKjiqg/6kSdK8lZvUi3Pi3wM+QDBXbpr73M/WEkW0KvA==
+web3-net@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.8.0.tgz#9acff92d7c647d801bc68df0ff4416f104dbe789"
+ integrity sha512-kX6EAacK7QrOe7DOh0t5yHS5q2kxZmTCxPVwSz9io9xBeE4n4UhmzGJ/VfhP2eM3OPKYeypcR3LEO6zZ8xn2vw==
dependencies:
- web3-core "1.7.5"
- web3-core-method "1.7.5"
- web3-utils "1.7.5"
+ web3-core "1.8.0"
+ web3-core-method "1.8.0"
+ web3-utils "1.8.0"
-web3-providers-http@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.7.5.tgz#144bb0c29007d1b766bafb0e20f80be050c7aa80"
- integrity sha512-vPgr4Kzy0M3CHtoP/Bh7qwK/D9h2fhjpoqctdMWVJseOfeTgfOphCKN0uwV8w2VpZgDPXA8aeTdBx5OjmDdStA==
+web3-providers-http@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.8.0.tgz#3fd1e569ead2095343fac17d53160a3bae674c23"
+ integrity sha512-/MqxwRzExohBWW97mqlCSW/+NHydGRyoEDUS1bAIF2YjfKFwyRtHgrEzOojzkC9JvB+8LofMvbXk9CcltpZapw==
dependencies:
abortcontroller-polyfill "^1.7.3"
cross-fetch "^3.1.4"
es6-promise "^4.2.8"
- web3-core-helpers "1.7.5"
+ web3-core-helpers "1.8.0"
-web3-providers-ipc@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.7.5.tgz#5b0f9b4f7340416953b8816d2e42e3f548d47372"
- integrity sha512-aNHx+RAROzO+apDEzy8Zncj78iqWBadIXtpmFDg7uiTn8i+oO+IcP1Yni7jyzkltsysVJHgHWG4kPx50ANCK3Q==
+web3-providers-ipc@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.8.0.tgz#d339a24c4d764e459e425d3ac868a551ac33e3ea"
+ integrity sha512-tAXHtVXNUOgehaBU8pzAlB3qhjn/PRpjdzEjzHNFqtRRTwzSEKOJxFeEhaUA4FzHnTlbnrs8ujHWUitcp1elfg==
dependencies:
oboe "2.1.5"
- web3-core-helpers "1.7.5"
+ web3-core-helpers "1.8.0"
-web3-providers-ws@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.7.5.tgz#196b9e56a4a48f9bee54def56875ea53dec7c711"
- integrity sha512-9uJNVVkIGC8PmM9kNbgPth56HDMSSsxZh3ZEENdwO3LNWemaADiQYUDCsD/dMVkn0xsGLHP5dgAy4Q5msqySLg==
+web3-providers-ws@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.8.0.tgz#a0a73e0606981ea32bed40d215000a64753899de"
+ integrity sha512-bcZtSifsqyJxwkfQYamfdIRp4nhj9eJd7cxHg1uUkfLJK125WP96wyJL1xbPt7qt0MpfnTFn8/UuIqIB6nFENg==
dependencies:
eventemitter3 "4.0.4"
- web3-core-helpers "1.7.5"
+ web3-core-helpers "1.8.0"
websocket "^1.0.32"
-web3-shh@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.7.5.tgz#742e27f5c44bea6d7adef3a49b085e0fcd6aa621"
- integrity sha512-aCIWJyLMH5H76OybU4ZpUCJ93yNOPATGhJ+KboRPU8QZDzS2CcVhtEzyl27bbvw+rSnVroMLqBgTXBB4mmKI7A==
+web3-shh@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.8.0.tgz#b4abbf4f59d097ce2f74360e61e2e5c0bd6507c7"
+ integrity sha512-DNRgSa9Jf9xYFUGKSMylrf+zt3MPjhI2qF+UWX07o0y3+uf8zalDGiJOWvIS4upAsdPiKKVJ7co+Neof47OMmg==
dependencies:
- web3-core "1.7.5"
- web3-core-method "1.7.5"
- web3-core-subscriptions "1.7.5"
- web3-net "1.7.5"
+ web3-core "1.8.0"
+ web3-core-method "1.8.0"
+ web3-core-subscriptions "1.8.0"
+ web3-net "1.8.0"
-web3-utils@1.7.5:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.7.5.tgz#081a952ac6e0322e25ac97b37358a43c7372ef6a"
- integrity sha512-9AqNOziQky4wNQadEwEfHiBdOZqopIHzQQVzmvvv6fJwDSMhP+khqmAZC7YTiGjs0MboyZ8tWNivqSO1699XQw==
+web3-utils@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.8.0.tgz#0a506f8c6af9a2ad6ba79689892662769534fc03"
+ integrity sha512-7nUIl7UWpLVka2f09CMbKOSEvorvHnaugIabU4mj7zfMvm0tSByLcEu3eyV9qgS11qxxLuOkzBIwCstTflhmpQ==
dependencies:
bn.js "^5.2.1"
ethereum-bloom-filters "^1.0.6"
@@ -5011,17 +5023,17 @@
utf8 "3.0.0"
web3@^1.7.3:
- version "1.7.5"
- resolved "https://registry.yarnpkg.com/web3/-/web3-1.7.5.tgz#4e185d2058195b5775109b3f27cdea65a34a036e"
- integrity sha512-3jHZTWyXt975AOXgnZKayiSWDLpoSKk9fZtLk1hURQtt7AdSbXPT8AK9ooBCm0Dt3GYaOeNcHGaiHC3gtyqhLg==
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/web3/-/web3-1.8.0.tgz#3ca5f0b32de6a1f626407740411219035b5fde64"
+ integrity sha512-sldr9stK/SALSJTgI/8qpnDuBJNMGjVR84hJ+AcdQ+MLBGLMGsCDNubCoyO6qgk1/Y9SQ7ignegOI/7BPLoiDA==
dependencies:
- web3-bzz "1.7.5"
- web3-core "1.7.5"
- web3-eth "1.7.5"
- web3-eth-personal "1.7.5"
- web3-net "1.7.5"
- web3-shh "1.7.5"
- web3-utils "1.7.5"
+ web3-bzz "1.8.0"
+ web3-core "1.8.0"
+ web3-eth "1.8.0"
+ web3-eth-personal "1.8.0"
+ web3-net "1.8.0"
+ web3-shh "1.8.0"
+ web3-utils "1.8.0"
webidl-conversions@^3.0.0:
version "3.0.1"
@@ -5116,6 +5128,11 @@
safe-buffer "~5.1.0"
ultron "~1.1.0"
+ws@^8.8.1:
+ version "8.9.0"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.9.0.tgz#2a994bb67144be1b53fe2d23c53c028adeb7f45e"
+ integrity sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==
+
xhr-request-promise@^0.1.2:
version "0.1.3"
resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c"
@@ -5209,12 +5226,12 @@
y18n "^5.0.5"
yargs-parser "^20.2.2"
-yargs@^17.5.1:
- version "17.5.1"
- resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e"
- integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==
+yargs@^17.6.0:
+ version "17.6.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c"
+ integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==
dependencies:
- cliui "^7.0.2"
+ cliui "^8.0.1"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"