git.delta.rocks / unique-network / refs/commits / 38e6a9238999

difftreelog

test upgrade dependencies

Yaroslav Bolyukin2022-07-21parent: #d9258db.patch.diff
in: master
Old polkadot.js is no longer able to generate types for upgraded node

5 files changed

modifiedtests/README.mddiffbeforeafterboth
--- a/tests/README.md
+++ b/tests/README.md
@@ -5,7 +5,7 @@
 1. Checkout polkadot in sibling folder with this project
 ```bash
 git clone https://github.com/paritytech/polkadot.git && cd polkadot
-git checkout release-v0.9.24
+git checkout release-v0.9.25
 ```
 
 2. Build with nightly-2022-05-11
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -5,7 +5,7 @@
   "main": "",
   "devDependencies": {
     "@polkadot/ts": "0.4.22",
-    "@polkadot/typegen": "8.7.2-15",
+    "@polkadot/typegen": "8.12.2",
     "@types/chai": "^4.3.1",
     "@types/chai-as-promised": "^7.1.5",
     "@types/chai-like": "^1.1.1",
@@ -92,9 +92,9 @@
   "license": "SEE LICENSE IN ../LICENSE",
   "homepage": "",
   "dependencies": {
-    "@polkadot/api": "8.7.2-15",
-    "@polkadot/api-contract": "8.7.2-15",
-    "@polkadot/util-crypto": "9.4.1",
+    "@polkadot/api": "8.12.2",
+    "@polkadot/api-contract": "8.12.2",
+    "@polkadot/util-crypto": "10.0.2",
     "bignumber.js": "^9.0.2",
     "chai-as-promised": "^7.1.1",
     "chai-like": "^1.1.1",
modifiedtests/src/rmrk/util/tx.tsdiffbeforeafterboth
--- a/tests/src/rmrk/util/tx.ts
+++ b/tests/src/rmrk/util/tx.ts
@@ -230,7 +230,7 @@
     royaltyOptional,
     metadata,
     transferable,
-    resources,
+    resources as any,
   );
 
   const events = await executeTransaction(api, issuer, tx);
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
before · tests/src/util/helpers.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import '../interfaces/augment-api-rpc';18import '../interfaces/augment-api-query';19import {ApiPromise} from '@polkadot/api';20import type {AccountId, EventRecord, Event} from '@polkadot/types/interfaces';21import type {GenericEventData} from '@polkadot/types';22import {AnyTuple, IEvent, IKeyringPair} from '@polkadot/types/types';23import {evmToAddress} from '@polkadot/util-crypto';24import BN from 'bn.js';25import chai from 'chai';26import chaiAsPromised from 'chai-as-promised';27import {default as usingApi, executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from '../substrate/substrate-api';28import {hexToStr, strToUTF16, utf16ToStr} from './util';29import {UpDataStructsRpcCollection, UpDataStructsCreateItemData, UpDataStructsProperty} from '@polkadot/types/lookup';30import {UpDataStructsTokenChild} from '../interfaces';31import {Context} from 'mocha';3233chai.use(chaiAsPromised);34const expect = chai.expect;3536export type CrossAccountId = {37  Substrate: string,38} | {39  Ethereum: string,40};414243export enum Pallets {44  Inflation = 'inflation',45  RmrkCore = 'rmrkcore',46  RmrkEquip = 'rmrkequip',47  ReFungible = 'refungible',48  Fungible = 'fungible',49  NFT = 'nonfungible',50  Scheduler = 'scheduler',51}5253export async function isUnique(): Promise<boolean> {54  return usingApi(async api => {55    const chain = await api.rpc.system.chain();5657    return chain.eq('UNIQUE');58  });59}6061export async function isQuartz(): Promise<boolean> {62  return usingApi(async api => {63    const chain = await api.rpc.system.chain();64    65    return chain.eq('QUARTZ');66  });67}6869let modulesNames: any;70export function getModuleNames(api: ApiPromise): string[] {71  if (typeof modulesNames === 'undefined') 72    modulesNames = api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());73  return modulesNames;74}7576export async function missingRequiredPallets(requiredPallets: string[]): Promise<string[]> {77  return await usingApi(async api => {78    const pallets = getModuleNames(api);7980    return requiredPallets.filter(p => !pallets.includes(p));81  });82}8384export async function checkPalletsPresence(requiredPallets: string[]): Promise<boolean> {85  return (await missingRequiredPallets(requiredPallets)).length == 0;86}8788export async function requirePallets(mocha: Context, requiredPallets: string[]) {89  const missingPallets = await missingRequiredPallets(requiredPallets);9091  if (missingPallets.length > 0) {92    const skippingTestMsg = `\tSkipping test "${mocha.test?.title}".`;93    const missingPalletsMsg = `\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;94    const skipMsg = `${skippingTestMsg}\n${missingPalletsMsg}`;9596    console.error('\x1b[38:5:208m%s\x1b[0m', skipMsg);9798    mocha.skip();99  }100}101102export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {103  if (typeof input === 'string') {104    if (input.length >= 47) {105      return {Substrate: input};106    } else if (input.length === 42 && input.startsWith('0x')) {107      return {Ethereum: input.toLowerCase()};108    } else if (input.length === 40 && !input.startsWith('0x')) {109      return {Ethereum: '0x' + input.toLowerCase()};110    } else {111      throw new Error(`Unknown address format: "${input}"`);112    }113  }114  if ('address' in input) {115    return {Substrate: input.address};116  }117  if ('Ethereum' in input) {118    return {119      Ethereum: input.Ethereum.toLowerCase(),120    };121  } else if ('ethereum' in input) {122    return {123      Ethereum: (input as any).ethereum.toLowerCase(),124    };125  } else if ('Substrate' in input) {126    return input;127  } else if ('substrate' in input) {128    return {129      Substrate: (input as any).substrate,130    };131  }132133  // AccountId134  return {Substrate: input.toString()};135}136export function toSubstrateAddress(input: string | CrossAccountId | IKeyringPair): string {137  input = normalizeAccountId(input);138  if ('Substrate' in input) {139    return input.Substrate;140  } else {141    return evmToAddress(input.Ethereum);142  }143}144145export const U128_MAX = (1n << 128n) - 1n;146147const MICROUNIQUE = 1_000_000_000_000n;148const MILLIUNIQUE = 1_000n * MICROUNIQUE;149const CENTIUNIQUE = 10n * MILLIUNIQUE;150export const UNIQUE = 100n * CENTIUNIQUE;151152interface GenericResult<T> {153  success: boolean;154  data: T | null;155}156157interface CreateCollectionResult {158  success: boolean;159  collectionId: number;160}161162interface CreateItemResult {163  success: boolean;164  collectionId: number;165  itemId: number;166  recipient?: CrossAccountId;167  amount?: number;168}169170interface DestroyItemResult {171  success: boolean;172  collectionId: number;173  itemId: number;174  owner: CrossAccountId;175  amount: number;176}177178interface TransferResult {179  collectionId: number;180  itemId: number;181  sender?: CrossAccountId;182  recipient?: CrossAccountId;183  value: bigint;184}185186interface IReFungibleOwner {187  fraction: BN;188  owner: number[];189}190191interface IGetMessage {192  checkMsgUnqMethod: string;193  checkMsgTrsMethod: string;194  checkMsgSysMethod: string;195}196197export interface IFungibleTokenDataType {198  value: number;199}200201export interface IChainLimits {202  collectionNumbersLimit: number;203  accountTokenOwnershipLimit: number;204  collectionsAdminsLimit: number;205  customDataLimit: number;206  nftSponsorTransferTimeout: number;207  fungibleSponsorTransferTimeout: number;208  refungibleSponsorTransferTimeout: number;209  //offchainSchemaLimit: number;210  //constOnChainSchemaLimit: number;211}212213export interface IReFungibleTokenDataType {214  owner: IReFungibleOwner[];215}216217export function uniqueEventMessage(events: EventRecord[]): IGetMessage {218  let checkMsgUnqMethod = '';219  let checkMsgTrsMethod = '';220  let checkMsgSysMethod = '';221  events.forEach(({event: {method, section}}) => {222    if (section === 'common') {223      checkMsgUnqMethod = method;224    } else if (section === 'treasury') {225      checkMsgTrsMethod = method;226    } else if (section === 'system') {227      checkMsgSysMethod = method;228    } else { return null; }229  });230  const result: IGetMessage = {231    checkMsgUnqMethod,232    checkMsgTrsMethod,233    checkMsgSysMethod,234  };235  return result;236}237238export function getEvent<T extends Event>(events: EventRecord[], check: (event: IEvent<AnyTuple>) => event is T): T | undefined {239  const event = events.find(r => check(r.event));240  if (!event) return;241  return event.event as T;242}243244export function getGenericResult<T>(events: EventRecord[]): GenericResult<T>;245export function getGenericResult<T>(246  events: EventRecord[],247  expectSection: string,248  expectMethod: string,249  extractAction: (data: GenericEventData) => T250): GenericResult<T>;251252export function getGenericResult<T>(253  events: EventRecord[],254  expectSection?: string,255  expectMethod?: string,256  extractAction?: (data: GenericEventData) => T,257): GenericResult<T> {258  let success = false;259  let successData = null;260261  events.forEach(({event: {data, method, section}}) => {262    // console.log(`    ${phase}: ${section}.${method}:: ${data}`);263    if (method === 'ExtrinsicSuccess') {264      success = true;265    } else if ((expectSection == section) && (expectMethod == method)) {266      successData = extractAction!(data as any);267    }268  });269270  const result: GenericResult<T> = {271    success,272    data: successData,273  };274  return result;275}276277export function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {278  const genericResult = getGenericResult(events, 'common', 'CollectionCreated', (data) => parseInt(data[0].toString(), 10));279  const result: CreateCollectionResult = {280    success: genericResult.success,281    collectionId: genericResult.data ?? 0,282  };283  return result;284}285286export function getCreateItemsResult(events: EventRecord[]): CreateItemResult[] {287  const results: CreateItemResult[] = [];288  289  const genericResult = getGenericResult<CreateItemResult[]>(events, 'common', 'ItemCreated', (data) => {290    const collectionId = parseInt(data[0].toString(), 10);291    const itemId = parseInt(data[1].toString(), 10);292    const recipient = normalizeAccountId(data[2].toJSON() as any);293    const amount = parseInt(data[3].toString(), 10);294295    const itemRes: CreateItemResult = {296      success: true,297      collectionId,298      itemId,299      recipient,300      amount,301    };302303    results.push(itemRes);304    return results;305  });306307  if (!genericResult.success) return [];308  return results;309}310311export function getCreateItemResult(events: EventRecord[]): CreateItemResult {312  const genericResult = getGenericResult(events, 'common', 'ItemCreated', (data) => data.map(function(value) { return value.toJSON(); }));313  314  if (genericResult.data == null) 315    return {316      success: genericResult.success,317      collectionId: 0,318      itemId: 0,319      amount: 0,320    };321  else 322    return {323      success: genericResult.success,324      collectionId: genericResult.data[0] as number,325      itemId: genericResult.data[1] as number,326      recipient: normalizeAccountId(genericResult.data![2] as any),327      amount: genericResult.data[3] as number,328    };329}330331export function getDestroyItemsResult(events: EventRecord[]): DestroyItemResult[] {332  const results: DestroyItemResult[] = [];333  334  const genericResult = getGenericResult<DestroyItemResult[]>(events, 'common', 'ItemDestroyed', (data) => {335    const collectionId = parseInt(data[0].toString(), 10);336    const itemId = parseInt(data[1].toString(), 10);337    const owner = normalizeAccountId(data[2].toJSON() as any);338    const amount = parseInt(data[3].toString(), 10);339340    const itemRes: DestroyItemResult = {341      success: true,342      collectionId,343      itemId,344      owner,345      amount,346    };347348    results.push(itemRes);349    return results;350  });351352  if (!genericResult.success) return [];353  return results;354}355356export function getTransferResult(api: ApiPromise, events: EventRecord[]): TransferResult {357  for (const {event} of events) {358    if (api.events.common.Transfer.is(event)) {359      const [collection, token, sender, recipient, value] = event.data;360      return {361        collectionId: collection.toNumber(),362        itemId: token.toNumber(),363        sender: normalizeAccountId(sender.toJSON() as any),364        recipient: normalizeAccountId(recipient.toJSON() as any),365        value: value.toBigInt(),366      };367    }368  }369  throw new Error('no transfer event');370}371372interface Nft {373  type: 'NFT';374}375376interface Fungible {377  type: 'Fungible';378  decimalPoints: number;379}380381interface ReFungible {382  type: 'ReFungible';383}384385export type CollectionMode = Nft | Fungible | ReFungible;386387export type Property = {388  key: any,389  value: any,390};391392type Permission = {393  mutable: boolean;394  collectionAdmin: boolean;395  tokenOwner: boolean;396}397398type PropertyPermission = {399  key: any;400  permission: Permission;401}402403export type CreateCollectionParams = {404  mode: CollectionMode,405  name: string,406  description: string,407  tokenPrefix: string,408  properties?: Array<Property>,409  propPerm?: Array<PropertyPermission>410};411412const defaultCreateCollectionParams: CreateCollectionParams = {413  description: 'description',414  mode: {type: 'NFT'},415  name: 'name',416  tokenPrefix: 'prefix',417};418419export async function420createCollection(421  api: ApiPromise,422  sender: IKeyringPair,423  params: Partial<CreateCollectionParams> = {},424): Promise<CreateCollectionResult> {425  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};426427  let modeprm = {};428  if (mode.type === 'NFT') {429    modeprm = {nft: null};430  } else if (mode.type === 'Fungible') {431    modeprm = {fungible: mode.decimalPoints};432  } else if (mode.type === 'ReFungible') {433    modeprm = {refungible: null};434  }435436  const tx = api.tx.unique.createCollectionEx({437    name: strToUTF16(name),438    description: strToUTF16(description),439    tokenPrefix: strToUTF16(tokenPrefix),440    mode: modeprm as any,441  });442  const events = await submitTransactionAsync(sender, tx);443  return getCreateCollectionResult(events);444}445446export async function createCollectionExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {447  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};448449  let collectionId = 0;450  await usingApi(async (api, privateKeyWrapper) => {451    // Get number of collections before the transaction452    const collectionCountBefore = await getCreatedCollectionCount(api);453454    // Run the CreateCollection transaction455    const alicePrivateKey = privateKeyWrapper('//Alice');456457    const result = await createCollection(api, alicePrivateKey, params);458459    // Get number of collections after the transaction460    const collectionCountAfter = await getCreatedCollectionCount(api);461462    // Get the collection463    const collection = await queryCollectionExpectSuccess(api, result.collectionId);464465    // What to expect466    // tslint:disable-next-line:no-unused-expression467    expect(result.success).to.be.true;468    expect(result.collectionId).to.be.equal(collectionCountAfter);469    // tslint:disable-next-line:no-unused-expression470    expect(collection).to.be.not.null;471    expect(collectionCountAfter).to.be.equal(collectionCountBefore + 1, 'Error: NFT collection NOT created.');472    expect(collection.owner.toString()).to.be.equal(toSubstrateAddress(alicePrivateKey));473    expect(utf16ToStr(collection.name.toJSON() as any)).to.be.equal(name);474    expect(utf16ToStr(collection.description.toJSON() as any)).to.be.equal(description);475    expect(hexToStr(collection.tokenPrefix.toJSON())).to.be.equal(tokenPrefix);476477    collectionId = result.collectionId;478  });479480  return collectionId;481}482483export async function createCollectionWithPropsExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {484  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};485486  let collectionId = 0;487  await usingApi(async (api, privateKeyWrapper) => {488    // Get number of collections before the transaction489    const collectionCountBefore = await getCreatedCollectionCount(api);490491    // Run the CreateCollection transaction492    const alicePrivateKey = privateKeyWrapper('//Alice');493494    let modeprm = {};495    if (mode.type === 'NFT') {496      modeprm = {nft: null};497    } else if (mode.type === 'Fungible') {498      modeprm = {fungible: mode.decimalPoints};499    } else if (mode.type === 'ReFungible') {500      modeprm = {refungible: null};501    }502503    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any, properties: params.properties, tokenPropertyPermissions: params.propPerm});504    const events = await submitTransactionAsync(alicePrivateKey, tx);505    const result = getCreateCollectionResult(events);506507    // Get number of collections after the transaction508    const collectionCountAfter = await getCreatedCollectionCount(api);509510    // Get the collection511    const collection = await queryCollectionExpectSuccess(api, result.collectionId);512513    // What to expect514    // tslint:disable-next-line:no-unused-expression515    expect(result.success).to.be.true;516    expect(result.collectionId).to.be.equal(collectionCountAfter);517    // tslint:disable-next-line:no-unused-expression518    expect(collection).to.be.not.null;519    expect(collectionCountAfter).to.be.equal(collectionCountBefore + 1, 'Error: NFT collection NOT created.');520    expect(collection.owner.toString()).to.be.equal(toSubstrateAddress(alicePrivateKey));521    expect(utf16ToStr(collection.name.toJSON() as any)).to.be.equal(name);522    expect(utf16ToStr(collection.description.toJSON() as any)).to.be.equal(description);523    expect(hexToStr(collection.tokenPrefix.toJSON())).to.be.equal(tokenPrefix);524525526    collectionId = result.collectionId;527  });528529  return collectionId;530}531532export async function createCollectionWithPropsExpectFailure(params: Partial<CreateCollectionParams> = {}) {533  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};534535  await usingApi(async (api, privateKeyWrapper) => {536    // Get number of collections before the transaction537    const collectionCountBefore = await getCreatedCollectionCount(api);538539    // Run the CreateCollection transaction540    const alicePrivateKey = privateKeyWrapper('//Alice');541542    let modeprm = {};543    if (mode.type === 'NFT') {544      modeprm = {nft: null};545    } else if (mode.type === 'Fungible') {546      modeprm = {fungible: mode.decimalPoints};547    } else if (mode.type === 'ReFungible') {548      modeprm = {refungible: null};549    }550551    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any, properties: params.properties, tokenPropertyPermissions: params.propPerm});552    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;553554555    // Get number of collections after the transaction556    const collectionCountAfter = await getCreatedCollectionCount(api);557558    expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');559  });560}561562export async function createCollectionExpectFailure(params: Partial<CreateCollectionParams> = {}) {563  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};564565  let modeprm = {};566  if (mode.type === 'NFT') {567    modeprm = {nft: null};568  } else if (mode.type === 'Fungible') {569    modeprm = {fungible: mode.decimalPoints};570  } else if (mode.type === 'ReFungible') {571    modeprm = {refungible: null};572  }573574  await usingApi(async (api, privateKeyWrapper) => {575    // Get number of collections before the transaction576    const collectionCountBefore = await getCreatedCollectionCount(api);577578    // Run the CreateCollection transaction579    const alicePrivateKey = privateKeyWrapper('//Alice');580    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});581    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;582583    // Get number of collections after the transaction584    const collectionCountAfter = await getCreatedCollectionCount(api);585586    // What to expect587    expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');588  });589}590591export async function findUnusedAddress(api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair, seedAddition = ''): Promise<IKeyringPair> {592  let bal = 0n;593  let unused;594  do {595    const randomSeed = 'seed' + Math.floor(Math.random() * Math.floor(10000)) + seedAddition;596    unused = privateKeyWrapper(`//${randomSeed}`);597    bal = (await api.query.system.account(unused.address)).data.free.toBigInt();598  } while (bal !== 0n);599  return unused;600}601602export async function getAllowance(api: ApiPromise, collectionId: number, owner: CrossAccountId | string | IKeyringPair, approved: CrossAccountId | string | IKeyringPair, tokenId: number) {603  return (await api.rpc.unique.allowance(collectionId, normalizeAccountId(owner), normalizeAccountId(approved), tokenId)).toBigInt();604}605606export function findUnusedAddresses(api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair, amount: number): Promise<IKeyringPair[]> {607  return Promise.all(new Array(amount).fill(null).map(() => findUnusedAddress(api, privateKeyWrapper, '_' + Date.now())));608}609610export async function findNotExistingCollection(api: ApiPromise): Promise<number> {611  const totalNumber = await getCreatedCollectionCount(api);612  const newCollection: number = totalNumber + 1;613  return newCollection;614}615616function getDestroyResult(events: EventRecord[]): boolean {617  let success = false;618  events.forEach(({event: {method}}) => {619    if (method == 'ExtrinsicSuccess') {620      success = true;621    }622  });623  return success;624}625626export async function destroyCollectionExpectFailure(collectionId: number, senderSeed = '//Alice') {627  await usingApi(async (api, privateKeyWrapper) => {628    // Run the DestroyCollection transaction629    const alicePrivateKey = privateKeyWrapper(senderSeed);630    const tx = api.tx.unique.destroyCollection(collectionId);631    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;632  });633}634635export async function destroyCollectionExpectSuccess(collectionId: number, senderSeed = '//Alice') {636  await usingApi(async (api, privateKeyWrapper) => {637    // Run the DestroyCollection transaction638    const alicePrivateKey = privateKeyWrapper(senderSeed);639    const tx = api.tx.unique.destroyCollection(collectionId);640    const events = await submitTransactionAsync(alicePrivateKey, tx);641    const result = getDestroyResult(events);642    expect(result).to.be.true;643644    // What to expect645    expect(await getDetailedCollectionInfo(api, collectionId)).to.be.null;646  });647}648649export async function setCollectionLimitsExpectSuccess(sender: IKeyringPair, collectionId: number, limits: any) {650  await usingApi(async (api) => {651    const tx = api.tx.unique.setCollectionLimits(collectionId, limits);652    const events = await submitTransactionAsync(sender, tx);653    const result = getGenericResult(events);654655    expect(result.success).to.be.true;656  });657}658659export const setCollectionPermissionsExpectSuccess = async (sender: IKeyringPair, collectionId: number, permissions: any) => {660  await usingApi(async(api) => {661    const tx = api.tx.unique.setCollectionPermissions(collectionId, permissions);662    const events = await submitTransactionAsync(sender, tx);663    const result = getGenericResult(events);664665    expect(result.success).to.be.true;666  });667};668669export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {670  await usingApi(async (api) => {671    const tx = api.tx.unique.setCollectionLimits(collectionId, limits);672    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;673    const result = getGenericResult(events);674675    expect(result.success).to.be.false;676  });677}678679export async function setCollectionSponsorExpectSuccess(collectionId: number, sponsor: string, sender = '//Alice') {680  await usingApi(async (api, privateKeyWrapper) => {681682    // Run the transaction683    const senderPrivateKey = privateKeyWrapper(sender);684    const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);685    const events = await submitTransactionAsync(senderPrivateKey, tx);686    const result = getGenericResult(events);687688    // Get the collection689    const collection = await queryCollectionExpectSuccess(api, collectionId);690691    // What to expect692    expect(result.success).to.be.true;693    expect(collection.sponsorship.toJSON()).to.deep.equal({694      unconfirmed: sponsor,695    });696  });697}698699export async function removeCollectionSponsorExpectSuccess(collectionId: number, sender = '//Alice') {700  await usingApi(async (api, privateKeyWrapper) => {701702    // Run the transaction703    const alicePrivateKey = privateKeyWrapper(sender);704    const tx = api.tx.unique.removeCollectionSponsor(collectionId);705    const events = await submitTransactionAsync(alicePrivateKey, tx);706    const result = getGenericResult(events);707708    // Get the collection709    const collection = await queryCollectionExpectSuccess(api, collectionId);710711    // What to expect712    expect(result.success).to.be.true;713    expect(collection.sponsorship.toJSON()).to.be.deep.equal({disabled: null});714  });715}716717export async function removeCollectionSponsorExpectFailure(collectionId: number, senderSeed = '//Alice') {718  await usingApi(async (api, privateKeyWrapper) => {719720    // Run the transaction721    const alicePrivateKey = privateKeyWrapper(senderSeed);722    const tx = api.tx.unique.removeCollectionSponsor(collectionId);723    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;724  });725}726727export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed = '//Alice') {728  await usingApi(async (api, privateKeyWrapper) => {729730    // Run the transaction731    const alicePrivateKey = privateKeyWrapper(senderSeed);732    const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);733    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;734  });735}736737export async function confirmSponsorshipExpectSuccess(collectionId: number, senderSeed = '//Alice') {738  await usingApi(async (api, privateKeyWrapper) => {739740    // Run the transaction741    const sender = privateKeyWrapper(senderSeed);742    await confirmSponsorshipByKeyExpectSuccess(collectionId, sender);743  });744}745746export async function confirmSponsorshipByKeyExpectSuccess(collectionId: number, sender: IKeyringPair) {747  await usingApi(async (api, privateKeyWrapper) => {748749    // Run the transaction750    const tx = api.tx.unique.confirmSponsorship(collectionId);751    const events = await submitTransactionAsync(sender, tx);752    const result = getGenericResult(events);753754    // Get the collection755    const collection = await queryCollectionExpectSuccess(api, collectionId);756757    // What to expect758    expect(result.success).to.be.true;759    expect(collection.sponsorship.toJSON()).to.be.deep.equal({760      confirmed: sender.address,761    });762  });763}764765766export async function confirmSponsorshipExpectFailure(collectionId: number, senderSeed = '//Alice') {767  await usingApi(async (api, privateKeyWrapper) => {768769    // Run the transaction770    const sender = privateKeyWrapper(senderSeed);771    const tx = api.tx.unique.confirmSponsorship(collectionId);772    await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;773  });774}775776export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {777  await usingApi(async (api) => {778    const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);779    const events = await submitTransactionAsync(sender, tx);780    const result = getGenericResult(events);781782    expect(result.success).to.be.true;783  });784}785786export async function enableContractSponsoringExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {787  await usingApi(async (api) => {788    const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);789    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;790    const result = getGenericResult(events);791792    expect(result.success).to.be.false;793  });794}795796export async function setTransferFlagExpectSuccess(sender: IKeyringPair, collectionId: number, enabled: boolean) {797798  await usingApi(async (api) => {799800    const tx = api.tx.unique.setTransfersEnabledFlag(collectionId, enabled);801    const events = await submitTransactionAsync(sender, tx);802    const result = getGenericResult(events);803804    expect(result.success).to.be.true;805  });806}807808export async function setTransferFlagExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {809810  await usingApi(async (api) => {811812    const tx = api.tx.unique.setTransfersEnabledFlag(collectionId, enabled);813    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;814    const result = getGenericResult(events);815816    expect(result.success).to.be.false;817  });818}819820export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {821  await usingApi(async (api) => {822    const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);823    const events = await submitTransactionAsync(sender, tx);824    const result = getGenericResult(events);825826    expect(result.success).to.be.true;827  });828}829830export async function setContractSponsoringRateLimitExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {831  await usingApi(async (api) => {832    const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);833    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;834    const result = getGenericResult(events);835836    expect(result.success).to.be.false;837  });838}839840export async function getNextSponsored(841  api: ApiPromise,842  collectionId: number,843  account: string | CrossAccountId,844  tokenId: number,845): Promise<number> {846  return Number((await api.rpc.unique.nextSponsored(collectionId, account, tokenId)).unwrapOr(-1));847}848849export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {850  await usingApi(async (api) => {851    const tx = api.tx.unique.toggleContractAllowList(contractAddress, value);852    const events = await submitTransactionAsync(sender, tx);853    const result = getGenericResult(events);854855    expect(result.success).to.be.true;856  });857}858859export async function isAllowlistedInContract(contractAddress: AccountId | string, user: string) {860  let allowlisted = false;861  await usingApi(async (api) => {862    allowlisted = (await api.query.unique.contractAllowList(contractAddress, user)).toJSON() as boolean;863  });864  return allowlisted;865}866867export async function addToContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {868  await usingApi(async (api) => {869    const tx = api.tx.unique.addToContractAllowList(contractAddress.toString(), user.toString());870    const events = await submitTransactionAsync(sender, tx);871    const result = getGenericResult(events);872873    expect(result.success).to.be.true;874  });875}876877export async function removeFromContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {878  await usingApi(async (api) => {879    const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());880    const events = await submitTransactionAsync(sender, tx);881    const result = getGenericResult(events);882883    expect(result.success).to.be.true;884  });885}886887export async function removeFromContractAllowListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {888  await usingApi(async (api) => {889    const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());890    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;891    const result = getGenericResult(events);892893    expect(result.success).to.be.false;894  });895}896897export interface CreateFungibleData {898  readonly Value: bigint;899}900901export interface CreateReFungibleData { }902export interface CreateNftData { }903904export type CreateItemData = {905  NFT: CreateNftData;906} | {907  Fungible: CreateFungibleData;908} | {909  ReFungible: CreateReFungibleData;910};911912export async function burnItem(api: ApiPromise, sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint) : Promise<boolean> {913  const tx = api.tx.unique.burnItem(collectionId, tokenId, value);914  const events = await submitTransactionAsync(sender, tx);915  return getGenericResult(events).success;916}917918export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint = 1) {919  await usingApi(async (api) => {920    const balanceBefore = await getBalance(api, collectionId, normalizeAccountId(sender), tokenId);921    // if burning token by admin - use adminButnItemExpectSuccess922    expect(balanceBefore >= BigInt(value)).to.be.true;923924    expect(await burnItem(api, sender, collectionId, tokenId, value)).to.be.true;925926    const balanceAfter = await getBalance(api, collectionId, normalizeAccountId(sender), tokenId);927    expect(balanceAfter + BigInt(value)).to.be.equal(balanceBefore);928  });929}930931export async function burnItemExpectFailure(sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint = 1) {932  await usingApi(async (api) => {933    const tx = api.tx.unique.burnItem(collectionId, tokenId, value);934935    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;936    const result = getCreateCollectionResult(events);937    // tslint:disable-next-line:no-unused-expression938    expect(result.success).to.be.false;939  });940}941942export async function burnFromExpectSuccess(sender: IKeyringPair, from: IKeyringPair | CrossAccountId, collectionId: number, tokenId: number, value: number | bigint = 1) {943  await usingApi(async (api) => {944    const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(from), tokenId, value);945    const events = await submitTransactionAsync(sender, tx);946    return getGenericResult(events).success;947  });948}949950export async function951approve(952  api: ApiPromise,953  collectionId: number,954  tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string | IKeyringPair, amount: number | bigint,955) {956  const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);957  const events = await submitTransactionAsync(owner, approveUniqueTx);958  return getGenericResult(events).success;959}960961export async function962approveExpectSuccess(963  collectionId: number,964  tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,965) {966  await usingApi(async (api: ApiPromise) => {967    const result = await approve(api, collectionId, tokenId, owner, approved, amount);968    expect(result).to.be.true;969970    expect(await getAllowance(api, collectionId, owner, approved, tokenId)).to.be.equal(BigInt(amount));971  });972}973974export async function adminApproveFromExpectSuccess(975  collectionId: number,976  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,977) {978  await usingApi(async (api: ApiPromise) => {979    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);980    const events = await submitTransactionAsync(admin, approveUniqueTx);981    const result = getGenericResult(events);982    expect(result.success).to.be.true;983984    expect(await getAllowance(api, collectionId, owner, approved, tokenId)).to.be.equal(BigInt(amount));985  });986}987988export async function989transferFrom(990  api: ApiPromise,991  collectionId: number,992  tokenId: number,993  accountApproved: IKeyringPair,994  accountFrom: IKeyringPair | CrossAccountId,995  accountTo: IKeyringPair | CrossAccountId,996  value: number | bigint,997) {998  const from = normalizeAccountId(accountFrom);999  const to = normalizeAccountId(accountTo);1000  const transferFromTx = api.tx.unique.transferFrom(from, to, collectionId, tokenId, value);1001  const events = await submitTransactionAsync(accountApproved, transferFromTx);1002  return getGenericResult(events).success;1003}10041005export async function1006transferFromExpectSuccess(1007  collectionId: number,1008  tokenId: number,1009  accountApproved: IKeyringPair,1010  accountFrom: IKeyringPair | CrossAccountId,1011  accountTo: IKeyringPair | CrossAccountId,1012  value: number | bigint = 1,1013  type = 'NFT',1014) {1015  await usingApi(async (api: ApiPromise) => {1016    const from = normalizeAccountId(accountFrom);1017    const to = normalizeAccountId(accountTo);1018    let balanceBefore = 0n;1019    if (type === 'Fungible' || type === 'ReFungible') {1020      balanceBefore = await getBalance(api, collectionId, to, tokenId);1021    }1022    expect(await transferFrom(api, collectionId, tokenId, accountApproved, accountFrom, accountTo, value)).to.be.true;1023    if (type === 'NFT') {1024      expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);1025    }1026    if (type === 'Fungible') {1027      const balanceAfter = await getBalance(api, collectionId, to, tokenId);1028      if (JSON.stringify(to) !== JSON.stringify(from)) {1029        expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));1030      } else {1031        expect(balanceAfter).to.be.equal(balanceBefore);1032      }1033    }1034    if (type === 'ReFungible') {1035      expect(await getBalance(api, collectionId, to, tokenId)).to.be.equal(balanceBefore + BigInt(value));1036    }1037  });1038}10391040export async function1041transferFromExpectFail(1042  collectionId: number,1043  tokenId: number,1044  accountApproved: IKeyringPair,1045  accountFrom: IKeyringPair,1046  accountTo: IKeyringPair,1047  value: number | bigint = 1,1048) {1049  await usingApi(async (api: ApiPromise) => {1050    const transferFromTx = api.tx.unique.transferFrom(normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);1051    const events = await expect(submitTransactionExpectFailAsync(accountApproved, transferFromTx)).to.be.rejected;1052    const result = getCreateCollectionResult(events);1053    // tslint:disable-next-line:no-unused-expression1054    expect(result.success).to.be.false;1055  });1056}10571058/* eslint no-async-promise-executor: "off" */1059export async function getBlockNumber(api: ApiPromise): Promise<number> {1060  return new Promise<number>(async (resolve) => {1061    const unsubscribe = await api.rpc.chain.subscribeNewHeads((head) => {1062      unsubscribe();1063      resolve(head.number.toNumber());1064    });1065  });1066}10671068export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | CrossAccountId) {1069  await usingApi(async (api) => {1070    const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(address));1071    const events = await submitTransactionAsync(sender, changeAdminTx);1072    const result = getCreateCollectionResult(events);1073    expect(result.success).to.be.true;1074  });1075}10761077export async function adminApproveFromExpectFail(1078  collectionId: number,1079  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,1080) {1081  await usingApi(async (api: ApiPromise) => {1082    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);1083    const events = await expect(submitTransactionAsync(admin, approveUniqueTx)).to.be.rejected;1084    const result = getGenericResult(events);1085    expect(result.success).to.be.false;1086  });1087}10881089export async function1090getFreeBalance(account: IKeyringPair): Promise<bigint> {1091  let balance = 0n;1092  await usingApi(async (api) => {1093    balance = BigInt((await api.query.system.account(account.address)).data.free.toString());1094  });10951096  return balance;1097}10981099export async function transferBalanceTo(api: ApiPromise, source: IKeyringPair, target: string, amount = 1000n * UNIQUE) {1100  const tx = api.tx.balances.transfer(target, amount);1101  const events = await submitTransactionAsync(source, tx);1102  const result = getGenericResult(events);1103  expect(result.success).to.be.true;1104}11051106export async function1107scheduleExpectSuccess(1108  operationTx: any,1109  sender: IKeyringPair,1110  blockSchedule: number,1111  scheduledId: string,1112  period = 1,1113  repetitions = 1,1114) {1115  await usingApi(async (api: ApiPromise) => {1116    const blockNumber: number | undefined = await getBlockNumber(api);1117    const expectedBlockNumber = blockNumber + blockSchedule;11181119    expect(blockNumber).to.be.greaterThan(0);1120    const scheduleTx = api.tx.scheduler.scheduleNamed( // schedule1121      scheduledId,1122      expectedBlockNumber, 1123      repetitions > 1 ? [period, repetitions] : null, 1124      0, 1125      {Value: operationTx as any},1126    );11271128    const events = await submitTransactionAsync(sender, scheduleTx);1129    expect(getGenericResult(events).success).to.be.true;1130  });1131}11321133export async function1134scheduleExpectFailure(1135  operationTx: any,1136  sender: IKeyringPair,1137  blockSchedule: number,1138  scheduledId: string,1139  period = 1,1140  repetitions = 1,1141) {1142  await usingApi(async (api: ApiPromise) => {1143    const blockNumber: number | undefined = await getBlockNumber(api);1144    const expectedBlockNumber = blockNumber + blockSchedule;11451146    expect(blockNumber).to.be.greaterThan(0);1147    const scheduleTx = api.tx.scheduler.scheduleNamed( // schedule1148      scheduledId,1149      expectedBlockNumber, 1150      repetitions <= 1 ? null : [period, repetitions], 1151      0, 1152      {Value: operationTx as any},1153    );11541155    //const events = 1156    await expect(submitTransactionExpectFailAsync(sender, scheduleTx)).to.be.rejected;1157    //expect(getGenericResult(events).success).to.be.false;1158  });1159}11601161export async function1162scheduleTransferAndWaitExpectSuccess(1163  collectionId: number,1164  tokenId: number,1165  sender: IKeyringPair,1166  recipient: IKeyringPair,1167  value: number | bigint = 1,1168  blockSchedule: number,1169  scheduledId: string,1170) {1171  await usingApi(async (api: ApiPromise) => {1172    await scheduleTransferExpectSuccess(collectionId, tokenId, sender, recipient, value, blockSchedule, scheduledId);11731174    const recipientBalanceBefore = (await api.query.system.account(recipient.address)).data.free.toBigInt();11751176    // sleep for n + 1 blocks1177    await waitNewBlocks(blockSchedule + 1);11781179    const recipientBalanceAfter = (await api.query.system.account(recipient.address)).data.free.toBigInt();11801181    expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(recipient.address));1182    expect(recipientBalanceAfter).to.be.equal(recipientBalanceBefore);1183  });1184}11851186export async function1187scheduleTransferExpectSuccess(1188  collectionId: number,1189  tokenId: number,1190  sender: IKeyringPair,1191  recipient: IKeyringPair,1192  value: number | bigint = 1,1193  blockSchedule: number,1194  scheduledId: string,1195) {1196  await usingApi(async (api: ApiPromise) => {1197    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);11981199    await scheduleExpectSuccess(transferTx, sender, blockSchedule, scheduledId);12001201    expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(sender.address));1202  });1203}12041205export async function1206scheduleTransferFundsPeriodicExpectSuccess(1207  amount: bigint,1208  sender: IKeyringPair,1209  recipient: IKeyringPair,1210  blockSchedule: number,1211  scheduledId: string,1212  period: number,1213  repetitions: number,1214) {1215  await usingApi(async (api: ApiPromise) => {1216    const transferTx = api.tx.balances.transfer(recipient.address, amount);12171218    const balanceBefore = await getFreeBalance(recipient);1219    1220    await scheduleExpectSuccess(transferTx, sender, blockSchedule, scheduledId, period, repetitions);12211222    expect(await getFreeBalance(recipient)).to.be.equal(balanceBefore);1223  });1224}12251226export async function1227transfer(1228  api: ApiPromise,1229  collectionId: number,1230  tokenId: number,1231  sender: IKeyringPair,1232  recipient: IKeyringPair | CrossAccountId,1233  value: number | bigint,1234) : Promise<boolean> {1235  const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1236  const events = await executeTransaction(api, sender, transferTx);1237  return getGenericResult(events).success;1238}12391240export async function1241transferExpectSuccess(1242  collectionId: number,1243  tokenId: number,1244  sender: IKeyringPair,1245  recipient: IKeyringPair | CrossAccountId,1246  value: number | bigint = 1,1247  type = 'NFT',1248) {1249  await usingApi(async (api: ApiPromise) => {1250    const from = normalizeAccountId(sender);1251    const to = normalizeAccountId(recipient);12521253    let balanceBefore = 0n;1254    if (type === 'Fungible' || type === 'ReFungible') {1255      balanceBefore = await getBalance(api, collectionId, to, tokenId);1256    }12571258    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1259    const events = await executeTransaction(api, sender, transferTx);1260    const result = getTransferResult(api, events);12611262    expect(result.collectionId).to.be.equal(collectionId);1263    expect(result.itemId).to.be.equal(tokenId);1264    expect(result.sender).to.be.deep.equal(normalizeAccountId(sender.address));1265    expect(result.recipient).to.be.deep.equal(to);1266    expect(result.value).to.be.equal(BigInt(value));12671268    if (type === 'NFT') {1269      expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);1270    }1271    if (type === 'Fungible' || type === 'ReFungible') {1272      const balanceAfter = await getBalance(api, collectionId, to, tokenId);1273      if (JSON.stringify(to) !== JSON.stringify(from)) {1274        expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));1275      } else {1276        expect(balanceAfter).to.be.equal(balanceBefore);1277      }1278    }1279  });1280}12811282export async function1283transferExpectFailure(1284  collectionId: number,1285  tokenId: number,1286  sender: IKeyringPair,1287  recipient: IKeyringPair | CrossAccountId,1288  value: number | bigint = 1,1289) {1290  await usingApi(async (api: ApiPromise) => {1291    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1292    const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;1293    const result = getGenericResult(events);1294    // if (events && Array.isArray(events)) {1295    //   const result = getCreateCollectionResult(events);1296    // tslint:disable-next-line:no-unused-expression1297    expect(result.success).to.be.false;1298    //}1299  });1300}13011302export async function1303approveExpectFail(1304  collectionId: number,1305  tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1,1306) {1307  await usingApi(async (api: ApiPromise) => {1308    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved.address), collectionId, tokenId, amount);1309    const events = await expect(submitTransactionExpectFailAsync(owner, approveUniqueTx)).to.be.rejected;1310    const result = getCreateCollectionResult(events);1311    // tslint:disable-next-line:no-unused-expression1312    expect(result.success).to.be.false;1313  });1314}13151316export async function getBalance(1317  api: ApiPromise,1318  collectionId: number,1319  owner: string | CrossAccountId | IKeyringPair,1320  token: number,1321): Promise<bigint> {1322  return (await api.rpc.unique.balance(collectionId, normalizeAccountId(owner), token)).toBigInt();1323}1324export async function getTokenOwner(1325  api: ApiPromise,1326  collectionId: number,1327  token: number,1328): Promise<CrossAccountId> {1329  const owner = (await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any;1330  if (owner == null) throw new Error('owner == null');1331  return normalizeAccountId(owner);1332}1333export async function getTopmostTokenOwner(1334  api: ApiPromise,1335  collectionId: number,1336  token: number,1337): Promise<CrossAccountId> {1338  const owner = (await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any;1339  if (owner == null) throw new Error('owner == null');1340  return normalizeAccountId(owner);1341}1342export async function getTokenChildren(1343  api: ApiPromise,1344  collectionId: number,1345  tokenId: number,1346): Promise<UpDataStructsTokenChild[]> {1347  return (await api.rpc.unique.tokenChildren(collectionId, tokenId)).toJSON() as any;1348}1349export async function isTokenExists(1350  api: ApiPromise,1351  collectionId: number,1352  token: number,1353): Promise<boolean> {1354  return (await api.rpc.unique.tokenExists(collectionId, token)).toJSON();1355}1356export async function getLastTokenId(1357  api: ApiPromise,1358  collectionId: number,1359): Promise<number> {1360  return (await api.rpc.unique.lastTokenId(collectionId)).toJSON();1361}1362export async function getAdminList(1363  api: ApiPromise,1364  collectionId: number,1365): Promise<string[]> {1366  return (await api.rpc.unique.adminlist(collectionId)).toHuman() as any;1367}1368export async function getTokenProperties(1369  api: ApiPromise,1370  collectionId: number,1371  tokenId: number,1372  propertyKeys: string[],1373): Promise<UpDataStructsProperty[]> {1374  return (await api.rpc.unique.tokenProperties(collectionId, tokenId, propertyKeys)).toHuman() as any;1375}13761377export async function createFungibleItemExpectSuccess(1378  sender: IKeyringPair,1379  collectionId: number,1380  data: CreateFungibleData,1381  owner: CrossAccountId | string = sender.address,1382) {1383  return await usingApi(async (api) => {1384    const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), {Fungible: data});13851386    const events = await submitTransactionAsync(sender, tx);1387    const result = getCreateItemResult(events);13881389    expect(result.success).to.be.true;1390    return result.itemId;1391  });1392}13931394export async function createMultipleItemsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any, owner: CrossAccountId | string = sender.address) {1395  await usingApi(async (api) => {1396    const to = normalizeAccountId(owner);1397    const tx = api.tx.unique.createMultipleItems(collectionId, to, itemsData);13981399    const events = await submitTransactionAsync(sender, tx);1400    expect(getGenericResult(events).success).to.be.true;1401  });1402}14031404export async function createMultipleItemsWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any, owner: CrossAccountId | string = sender.address) {1405  await usingApi(async (api) => {1406    const to = normalizeAccountId(owner);1407    const tx = api.tx.unique.createMultipleItems(collectionId, to, itemsData);14081409    const events = await submitTransactionAsync(sender, tx);1410    const result = getCreateItemsResult(events);14111412    for (const res of result) {1413      expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;1414    }1415  });1416}14171418export async function createMultipleItemsExWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any) {1419  await usingApi(async (api) => {1420    const tx = api.tx.unique.createMultipleItemsEx(collectionId, itemsData);14211422    const events = await submitTransactionAsync(sender, tx);1423    const result = getCreateItemsResult(events);14241425    for (const res of result) {1426      expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;1427    }1428  });1429}14301431export async function createItemWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, props:  Array<Property>, owner: CrossAccountId | string = sender.address) {1432  let newItemId = 0;1433  await usingApi(async (api) => {1434    const to = normalizeAccountId(owner);1435    const itemCountBefore = await getLastTokenId(api, collectionId);1436    const itemBalanceBefore = await getBalance(api, collectionId, to, newItemId);14371438    let tx;1439    if (createMode === 'Fungible') {1440      const createData = {fungible: {value: 10}};1441      tx = api.tx.unique.createItem(collectionId, to, createData as any);1442    } else if (createMode === 'ReFungible') {1443      const createData = {refungible: {pieces: 100}};1444      tx = api.tx.unique.createItem(collectionId, to, createData as any);1445    } else {1446      const data = api.createType('UpDataStructsCreateItemData', {NFT: {properties: props}});1447      tx = api.tx.unique.createItem(collectionId, to, data as UpDataStructsCreateItemData);1448    }14491450    const events = await submitTransactionAsync(sender, tx);1451    const result = getCreateItemResult(events);14521453    const itemCountAfter = await getLastTokenId(api, collectionId);1454    const itemBalanceAfter = await getBalance(api, collectionId, to, newItemId);14551456    if (createMode === 'NFT') {1457      expect(await api.rpc.unique.tokenProperties(collectionId, result.itemId)).not.to.be.empty;1458    }14591460    // What to expect1461    // tslint:disable-next-line:no-unused-expression1462    expect(result.success).to.be.true;1463    if (createMode === 'Fungible') {1464      expect(itemBalanceAfter - itemBalanceBefore).to.be.equal(10n);1465    } else {1466      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);1467    }1468    expect(collectionId).to.be.equal(result.collectionId);1469    expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());1470    expect(to).to.be.deep.equal(result.recipient);1471    newItemId = result.itemId;1472  });1473  return newItemId;1474}14751476export async function createItemWithPropsExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, props: Array<Property>, owner: CrossAccountId | string = sender.address) {1477  await usingApi(async (api) => {14781479    let tx;1480    if (createMode === 'NFT') {1481      const data = api.createType('UpDataStructsCreateItemData', {NFT: {properties: props}}) as UpDataStructsCreateItemData;1482      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), data);1483    } else {1484      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);1485    }148614871488    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1489    if(events.message && events.message.toString().indexOf('1002: Verification Error') > -1) return;1490    const result = getCreateItemResult(events);14911492    expect(result.success).to.be.false;1493  });1494}14951496export async function createItemExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {1497  let newItemId = 0;1498  await usingApi(async (api) => {1499    const to = normalizeAccountId(owner);1500    const itemCountBefore = await getLastTokenId(api, collectionId);1501    const itemBalanceBefore = await getBalance(api, collectionId, to, newItemId);15021503    let tx;1504    if (createMode === 'Fungible') {1505      const createData = {fungible: {value: 10}};1506      tx = api.tx.unique.createItem(collectionId, to, createData as any);1507    } else if (createMode === 'ReFungible') {1508      const createData = {refungible: {pieces: 100}};1509      tx = api.tx.unique.createItem(collectionId, to, createData as any);1510    } else {1511      const createData = {nft: {}};1512      tx = api.tx.unique.createItem(collectionId, to, createData as any);1513    }15141515    const events = await executeTransaction(api, sender, tx);1516    const result = getCreateItemResult(events);15171518    const itemCountAfter = await getLastTokenId(api, collectionId);1519    const itemBalanceAfter = await getBalance(api, collectionId, to, newItemId);15201521    // What to expect1522    // tslint:disable-next-line:no-unused-expression1523    expect(result.success).to.be.true;1524    if (createMode === 'Fungible') {1525      expect(itemBalanceAfter - itemBalanceBefore).to.be.equal(10n);1526    } else {1527      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);1528    }1529    expect(collectionId).to.be.equal(result.collectionId);1530    expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());1531    expect(to).to.be.deep.equal(result.recipient);1532    newItemId = result.itemId;1533  });1534  return newItemId;1535}15361537export async function createRefungibleToken(api: ApiPromise, sender: IKeyringPair, collectionId: number, amount: bigint, owner: CrossAccountId | IKeyringPair | string = sender.address) : Promise<CreateItemResult> {1538  const createData = {refungible: {pieces: amount}};1539  const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createData as any);15401541  const events = await submitTransactionAsync(sender, tx);1542  return  getCreateItemResult(events);1543}15441545export async function createItemExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {1546  await usingApi(async (api) => {1547    const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);15481549    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1550    const result = getCreateItemResult(events);15511552    expect(result.success).to.be.false;1553  });1554}15551556export async function setPublicAccessModeExpectSuccess(1557  sender: IKeyringPair, collectionId: number,1558  accessMode: 'Normal' | 'AllowList',1559) {1560  await usingApi(async (api) => {15611562    // Run the transaction1563    const tx = api.tx.unique.setCollectionPermissions(collectionId, {access: accessMode});1564    const events = await submitTransactionAsync(sender, tx);1565    const result = getGenericResult(events);15661567    // Get the collection1568    const collection = await queryCollectionExpectSuccess(api, collectionId);15691570    // What to expect1571    // tslint:disable-next-line:no-unused-expression1572    expect(result.success).to.be.true;1573    expect(collection.permissions.access.toHuman()).to.be.equal(accessMode);1574  });1575}15761577export async function setPublicAccessModeExpectFail(1578  sender: IKeyringPair, collectionId: number,1579  accessMode: 'Normal' | 'AllowList',1580) {1581  await usingApi(async (api) => {15821583    // Run the transaction1584    const tx = api.tx.unique.setCollectionPermissions(collectionId, {access: accessMode});1585    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1586    const result = getGenericResult(events);15871588    // What to expect1589    // tslint:disable-next-line:no-unused-expression1590    expect(result.success).to.be.false;1591  });1592}15931594export async function enableAllowListExpectSuccess(sender: IKeyringPair, collectionId: number) {1595  await setPublicAccessModeExpectSuccess(sender, collectionId, 'AllowList');1596}15971598export async function enableAllowListExpectFail(sender: IKeyringPair, collectionId: number) {1599  await setPublicAccessModeExpectFail(sender, collectionId, 'AllowList');1600}16011602export async function disableAllowListExpectSuccess(sender: IKeyringPair, collectionId: number) {1603  await setPublicAccessModeExpectSuccess(sender, collectionId, 'Normal');1604}16051606export async function setMintPermissionExpectSuccess(sender: IKeyringPair, collectionId: number, enabled: boolean) {1607  await usingApi(async (api) => {16081609    // Run the transaction1610    const tx = api.tx.unique.setCollectionPermissions(collectionId, {mintMode: enabled});1611    const events = await submitTransactionAsync(sender, tx);1612    const result = getGenericResult(events);1613    expect(result.success).to.be.true;16141615    // Get the collection1616    const collection = await queryCollectionExpectSuccess(api, collectionId);16171618    expect(collection.permissions.mintMode.toHuman()).to.be.equal(enabled);1619  });1620}16211622export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {1623  await setMintPermissionExpectSuccess(sender, collectionId, true);1624}16251626export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {1627  await usingApi(async (api) => {1628    // Run the transaction1629    const tx = api.tx.unique.setCollectionPermissions(collectionId, {mintMode: enabled});1630    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1631    const result = getCreateCollectionResult(events);1632    // tslint:disable-next-line:no-unused-expression1633    expect(result.success).to.be.false;1634  });1635}16361637export async function setChainLimitsExpectFailure(sender: IKeyringPair, limits: IChainLimits) {1638  await usingApi(async (api) => {1639    // Run the transaction1640    const tx = api.tx.unique.setChainLimits(limits);1641    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1642    const result = getCreateCollectionResult(events);1643    // tslint:disable-next-line:no-unused-expression1644    expect(result.success).to.be.false;1645  });1646}16471648export async function isAllowlisted(api: ApiPromise, collectionId: number, address: string | CrossAccountId) {1649  return (await api.rpc.unique.allowed(collectionId, normalizeAccountId(address))).toJSON();1650}16511652export async function addToAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId | CrossAccountId) {1653  await usingApi(async (api) => {1654    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.false;16551656    // Run the transaction1657    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1658    const events = await submitTransactionAsync(sender, tx);1659    const result = getGenericResult(events);1660    expect(result.success).to.be.true;16611662    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;1663  });1664}16651666export async function addToAllowListAgainExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId) {1667  await usingApi(async (api) => {16681669    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;16701671    // Run the transaction1672    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1673    const events = await submitTransactionAsync(sender, tx);1674    const result = getGenericResult(events);1675    expect(result.success).to.be.true;16761677    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;1678  });1679}16801681export async function addToAllowListExpectFail(sender: IKeyringPair, collectionId: number, address: string | AccountId) {1682  await usingApi(async (api) => {16831684    // Run the transaction1685    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1686    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1687    const result = getGenericResult(events);16881689    // What to expect1690    // tslint:disable-next-line:no-unused-expression1691    expect(result.success).to.be.false;1692  });1693}16941695export async function removeFromAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1696  await usingApi(async (api) => {1697    // Run the transaction1698    const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));1699    const events = await submitTransactionAsync(sender, tx);1700    const result = getGenericResult(events);17011702    // What to expect1703    // tslint:disable-next-line:no-unused-expression1704    expect(result.success).to.be.true;1705  });1706}17071708export async function removeFromAllowListExpectFailure(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1709  await usingApi(async (api) => {1710    // Run the transaction1711    const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));1712    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1713    const result = getGenericResult(events);17141715    // What to expect1716    // tslint:disable-next-line:no-unused-expression1717    expect(result.success).to.be.false;1718  });1719}17201721export const getDetailedCollectionInfo = async (api: ApiPromise, collectionId: number)1722  : Promise<UpDataStructsRpcCollection | null> => {1723  return (await api.rpc.unique.collectionById(collectionId)).unwrapOr(null);1724};17251726export const getCreatedCollectionCount = async (api: ApiPromise): Promise<number> => {1727  // set global object - collectionsCount1728  return (await api.rpc.unique.collectionStats()).created.toNumber();1729};17301731export async function queryCollectionExpectSuccess(api: ApiPromise, collectionId: number): Promise<UpDataStructsRpcCollection> {1732  return (await api.rpc.unique.collectionById(collectionId)).unwrap();1733}17341735export async function waitNewBlocks(blocksCount = 1): Promise<void> {1736  await usingApi(async (api) => {1737    const promise = new Promise<void>(async (resolve) => {1738      const unsubscribe = await api.rpc.chain.subscribeNewHeads(() => {1739        if (blocksCount > 0) {1740          blocksCount--;1741        } else {1742          unsubscribe();1743          resolve();1744        }1745      });1746    });1747    return promise;1748  });1749}17501751export async function repartitionRFT(1752  api: ApiPromise,1753  collectionId: number,1754  sender: IKeyringPair,1755  tokenId: number,1756  amount: bigint,1757): Promise<boolean> {1758  const tx = api.tx.unique.repartition(collectionId, tokenId, amount);1759  const events = await submitTransactionAsync(sender, tx);1760  const result = getGenericResult(events);17611762  return result.success;1763}17641765export async function itApi(name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {1766  let i: any = it;1767  if (opts.only) i = i.only;1768  else if (opts.skip) i = i.skip;1769  i(name, async () => {1770    await usingApi(async (api, privateKeyWrapper) => {1771      await cb({api, privateKeyWrapper});1772    });1773  });1774}17751776itApi.only = (name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any) => itApi(name, cb, {only: true});1777itApi.skip = (name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any) => itApi(name, cb, {skip: true});
after · tests/src/util/helpers.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import '../interfaces/augment-api-rpc';18import '../interfaces/augment-api-query';19import {ApiPromise} from '@polkadot/api';20import type {AccountId, EventRecord, Event} from '@polkadot/types/interfaces';21import type {GenericEventData} from '@polkadot/types';22import {AnyTuple, IEvent, IKeyringPair} from '@polkadot/types/types';23import {evmToAddress} from '@polkadot/util-crypto';24import BN from 'bn.js';25import chai from 'chai';26import chaiAsPromised from 'chai-as-promised';27import {default as usingApi, executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from '../substrate/substrate-api';28import {hexToStr, strToUTF16, utf16ToStr} from './util';29import {UpDataStructsRpcCollection, UpDataStructsCreateItemData, UpDataStructsProperty} from '@polkadot/types/lookup';30import {UpDataStructsTokenChild} from '../interfaces';31import {Context} from 'mocha';3233chai.use(chaiAsPromised);34const expect = chai.expect;3536export type CrossAccountId = {37  Substrate: string,38} | {39  Ethereum: string,40};414243export enum Pallets {44  Inflation = 'inflation',45  RmrkCore = 'rmrkcore',46  RmrkEquip = 'rmrkequip',47  ReFungible = 'refungible',48  Fungible = 'fungible',49  NFT = 'nonfungible',50  Scheduler = 'scheduler',51}5253export async function isUnique(): Promise<boolean> {54  return usingApi(async api => {55    const chain = await api.rpc.system.chain();5657    return chain.eq('UNIQUE');58  });59}6061export async function isQuartz(): Promise<boolean> {62  return usingApi(async api => {63    const chain = await api.rpc.system.chain();64    65    return chain.eq('QUARTZ');66  });67}6869let modulesNames: any;70export function getModuleNames(api: ApiPromise): string[] {71  if (typeof modulesNames === 'undefined') 72    modulesNames = api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());73  return modulesNames;74}7576export async function missingRequiredPallets(requiredPallets: string[]): Promise<string[]> {77  return await usingApi(async api => {78    const pallets = getModuleNames(api);7980    return requiredPallets.filter(p => !pallets.includes(p));81  });82}8384export async function checkPalletsPresence(requiredPallets: string[]): Promise<boolean> {85  return (await missingRequiredPallets(requiredPallets)).length == 0;86}8788export async function requirePallets(mocha: Context, requiredPallets: string[]) {89  const missingPallets = await missingRequiredPallets(requiredPallets);9091  if (missingPallets.length > 0) {92    const skippingTestMsg = `\tSkipping test "${mocha.test?.title}".`;93    const missingPalletsMsg = `\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;94    const skipMsg = `${skippingTestMsg}\n${missingPalletsMsg}`;9596    console.error('\x1b[38:5:208m%s\x1b[0m', skipMsg);9798    mocha.skip();99  }100}101102export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {103  if (typeof input === 'string') {104    if (input.length >= 47) {105      return {Substrate: input};106    } else if (input.length === 42 && input.startsWith('0x')) {107      return {Ethereum: input.toLowerCase()};108    } else if (input.length === 40 && !input.startsWith('0x')) {109      return {Ethereum: '0x' + input.toLowerCase()};110    } else {111      throw new Error(`Unknown address format: "${input}"`);112    }113  }114  if ('address' in input) {115    return {Substrate: input.address};116  }117  if ('Ethereum' in input) {118    return {119      Ethereum: input.Ethereum.toLowerCase(),120    };121  } else if ('ethereum' in input) {122    return {123      Ethereum: (input as any).ethereum.toLowerCase(),124    };125  } else if ('Substrate' in input) {126    return input;127  } else if ('substrate' in input) {128    return {129      Substrate: (input as any).substrate,130    };131  }132133  // AccountId134  return {Substrate: input.toString()};135}136export function toSubstrateAddress(input: string | CrossAccountId | IKeyringPair): string {137  input = normalizeAccountId(input);138  if ('Substrate' in input) {139    return input.Substrate;140  } else {141    return evmToAddress(input.Ethereum);142  }143}144145export const U128_MAX = (1n << 128n) - 1n;146147const MICROUNIQUE = 1_000_000_000_000n;148const MILLIUNIQUE = 1_000n * MICROUNIQUE;149const CENTIUNIQUE = 10n * MILLIUNIQUE;150export const UNIQUE = 100n * CENTIUNIQUE;151152interface GenericResult<T> {153  success: boolean;154  data: T | null;155}156157interface CreateCollectionResult {158  success: boolean;159  collectionId: number;160}161162interface CreateItemResult {163  success: boolean;164  collectionId: number;165  itemId: number;166  recipient?: CrossAccountId;167  amount?: number;168}169170interface DestroyItemResult {171  success: boolean;172  collectionId: number;173  itemId: number;174  owner: CrossAccountId;175  amount: number;176}177178interface TransferResult {179  collectionId: number;180  itemId: number;181  sender?: CrossAccountId;182  recipient?: CrossAccountId;183  value: bigint;184}185186interface IReFungibleOwner {187  fraction: BN;188  owner: number[];189}190191interface IGetMessage {192  checkMsgUnqMethod: string;193  checkMsgTrsMethod: string;194  checkMsgSysMethod: string;195}196197export interface IFungibleTokenDataType {198  value: number;199}200201export interface IChainLimits {202  collectionNumbersLimit: number;203  accountTokenOwnershipLimit: number;204  collectionsAdminsLimit: number;205  customDataLimit: number;206  nftSponsorTransferTimeout: number;207  fungibleSponsorTransferTimeout: number;208  refungibleSponsorTransferTimeout: number;209  //offchainSchemaLimit: number;210  //constOnChainSchemaLimit: number;211}212213export interface IReFungibleTokenDataType {214  owner: IReFungibleOwner[];215}216217export function uniqueEventMessage(events: EventRecord[]): IGetMessage {218  let checkMsgUnqMethod = '';219  let checkMsgTrsMethod = '';220  let checkMsgSysMethod = '';221  events.forEach(({event: {method, section}}) => {222    if (section === 'common') {223      checkMsgUnqMethod = method;224    } else if (section === 'treasury') {225      checkMsgTrsMethod = method;226    } else if (section === 'system') {227      checkMsgSysMethod = method;228    } else { return null; }229  });230  const result: IGetMessage = {231    checkMsgUnqMethod,232    checkMsgTrsMethod,233    checkMsgSysMethod,234  };235  return result;236}237238export function getEvent<T extends Event>(events: EventRecord[], check: (event: IEvent<AnyTuple>) => event is T): T | undefined {239  const event = events.find(r => check(r.event));240  if (!event) return;241  return event.event as T;242}243244export function getGenericResult<T>(events: EventRecord[]): GenericResult<T>;245export function getGenericResult<T>(246  events: EventRecord[],247  expectSection: string,248  expectMethod: string,249  extractAction: (data: GenericEventData) => T250): GenericResult<T>;251252export function getGenericResult<T>(253  events: EventRecord[],254  expectSection?: string,255  expectMethod?: string,256  extractAction?: (data: GenericEventData) => T,257): GenericResult<T> {258  let success = false;259  let successData = null;260261  events.forEach(({event: {data, method, section}}) => {262    // console.log(`    ${phase}: ${section}.${method}:: ${data}`);263    if (method === 'ExtrinsicSuccess') {264      success = true;265    } else if ((expectSection == section) && (expectMethod == method)) {266      successData = extractAction!(data as any);267    }268  });269270  const result: GenericResult<T> = {271    success,272    data: successData,273  };274  return result;275}276277export function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {278  const genericResult = getGenericResult(events, 'common', 'CollectionCreated', (data) => parseInt(data[0].toString(), 10));279  const result: CreateCollectionResult = {280    success: genericResult.success,281    collectionId: genericResult.data ?? 0,282  };283  return result;284}285286export function getCreateItemsResult(events: EventRecord[]): CreateItemResult[] {287  const results: CreateItemResult[] = [];288  289  const genericResult = getGenericResult<CreateItemResult[]>(events, 'common', 'ItemCreated', (data) => {290    const collectionId = parseInt(data[0].toString(), 10);291    const itemId = parseInt(data[1].toString(), 10);292    const recipient = normalizeAccountId(data[2].toJSON() as any);293    const amount = parseInt(data[3].toString(), 10);294295    const itemRes: CreateItemResult = {296      success: true,297      collectionId,298      itemId,299      recipient,300      amount,301    };302303    results.push(itemRes);304    return results;305  });306307  if (!genericResult.success) return [];308  return results;309}310311export function getCreateItemResult(events: EventRecord[]): CreateItemResult {312  const genericResult = getGenericResult(events, 'common', 'ItemCreated', (data) => data.map(function(value) { return value.toJSON(); }));313  314  if (genericResult.data == null) 315    return {316      success: genericResult.success,317      collectionId: 0,318      itemId: 0,319      amount: 0,320    };321  else 322    return {323      success: genericResult.success,324      collectionId: genericResult.data[0] as number,325      itemId: genericResult.data[1] as number,326      recipient: normalizeAccountId(genericResult.data![2] as any),327      amount: genericResult.data[3] as number,328    };329}330331export function getDestroyItemsResult(events: EventRecord[]): DestroyItemResult[] {332  const results: DestroyItemResult[] = [];333  334  const genericResult = getGenericResult<DestroyItemResult[]>(events, 'common', 'ItemDestroyed', (data) => {335    const collectionId = parseInt(data[0].toString(), 10);336    const itemId = parseInt(data[1].toString(), 10);337    const owner = normalizeAccountId(data[2].toJSON() as any);338    const amount = parseInt(data[3].toString(), 10);339340    const itemRes: DestroyItemResult = {341      success: true,342      collectionId,343      itemId,344      owner,345      amount,346    };347348    results.push(itemRes);349    return results;350  });351352  if (!genericResult.success) return [];353  return results;354}355356export function getTransferResult(api: ApiPromise, events: EventRecord[]): TransferResult {357  for (const {event} of events) {358    if (api.events.common.Transfer.is(event)) {359      const [collection, token, sender, recipient, value] = event.data;360      return {361        collectionId: collection.toNumber(),362        itemId: token.toNumber(),363        sender: normalizeAccountId(sender.toJSON() as any),364        recipient: normalizeAccountId(recipient.toJSON() as any),365        value: value.toBigInt(),366      };367    }368  }369  throw new Error('no transfer event');370}371372interface Nft {373  type: 'NFT';374}375376interface Fungible {377  type: 'Fungible';378  decimalPoints: number;379}380381interface ReFungible {382  type: 'ReFungible';383}384385export type CollectionMode = Nft | Fungible | ReFungible;386387export type Property = {388  key: any,389  value: any,390};391392type Permission = {393  mutable: boolean;394  collectionAdmin: boolean;395  tokenOwner: boolean;396}397398type PropertyPermission = {399  key: any;400  permission: Permission;401}402403export type CreateCollectionParams = {404  mode: CollectionMode,405  name: string,406  description: string,407  tokenPrefix: string,408  properties?: Array<Property>,409  propPerm?: Array<PropertyPermission>410};411412const defaultCreateCollectionParams: CreateCollectionParams = {413  description: 'description',414  mode: {type: 'NFT'},415  name: 'name',416  tokenPrefix: 'prefix',417};418419export async function420createCollection(421  api: ApiPromise,422  sender: IKeyringPair,423  params: Partial<CreateCollectionParams> = {},424): Promise<CreateCollectionResult> {425  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};426427  let modeprm = {};428  if (mode.type === 'NFT') {429    modeprm = {nft: null};430  } else if (mode.type === 'Fungible') {431    modeprm = {fungible: mode.decimalPoints};432  } else if (mode.type === 'ReFungible') {433    modeprm = {refungible: null};434  }435436  const tx = api.tx.unique.createCollectionEx({437    name: strToUTF16(name),438    description: strToUTF16(description),439    tokenPrefix: strToUTF16(tokenPrefix),440    mode: modeprm as any,441  });442  const events = await executeTransaction(api, sender, tx);443  return getCreateCollectionResult(events);444}445446export async function createCollectionExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {447  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};448449  let collectionId = 0;450  await usingApi(async (api, privateKeyWrapper) => {451    // Get number of collections before the transaction452    const collectionCountBefore = await getCreatedCollectionCount(api);453454    // Run the CreateCollection transaction455    const alicePrivateKey = privateKeyWrapper('//Alice');456457    const result = await createCollection(api, alicePrivateKey, params);458459    // Get number of collections after the transaction460    const collectionCountAfter = await getCreatedCollectionCount(api);461462    // Get the collection463    const collection = await queryCollectionExpectSuccess(api, result.collectionId);464465    // What to expect466    // tslint:disable-next-line:no-unused-expression467    expect(result.success).to.be.true;468    expect(result.collectionId).to.be.equal(collectionCountAfter);469    // tslint:disable-next-line:no-unused-expression470    expect(collection).to.be.not.null;471    expect(collectionCountAfter).to.be.equal(collectionCountBefore + 1, 'Error: NFT collection NOT created.');472    expect(collection.owner.toString()).to.be.equal(toSubstrateAddress(alicePrivateKey));473    expect(utf16ToStr(collection.name.toJSON() as any)).to.be.equal(name);474    expect(utf16ToStr(collection.description.toJSON() as any)).to.be.equal(description);475    expect(hexToStr(collection.tokenPrefix.toJSON())).to.be.equal(tokenPrefix);476477    collectionId = result.collectionId;478  });479480  return collectionId;481}482483export async function createCollectionWithPropsExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {484  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};485486  let collectionId = 0;487  await usingApi(async (api, privateKeyWrapper) => {488    // Get number of collections before the transaction489    const collectionCountBefore = await getCreatedCollectionCount(api);490491    // Run the CreateCollection transaction492    const alicePrivateKey = privateKeyWrapper('//Alice');493494    let modeprm = {};495    if (mode.type === 'NFT') {496      modeprm = {nft: null};497    } else if (mode.type === 'Fungible') {498      modeprm = {fungible: mode.decimalPoints};499    } else if (mode.type === 'ReFungible') {500      modeprm = {refungible: null};501    }502503    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any, properties: params.properties, tokenPropertyPermissions: params.propPerm});504    const events = await submitTransactionAsync(alicePrivateKey, tx);505    const result = getCreateCollectionResult(events);506507    // Get number of collections after the transaction508    const collectionCountAfter = await getCreatedCollectionCount(api);509510    // Get the collection511    const collection = await queryCollectionExpectSuccess(api, result.collectionId);512513    // What to expect514    // tslint:disable-next-line:no-unused-expression515    expect(result.success).to.be.true;516    expect(result.collectionId).to.be.equal(collectionCountAfter);517    // tslint:disable-next-line:no-unused-expression518    expect(collection).to.be.not.null;519    expect(collectionCountAfter).to.be.equal(collectionCountBefore + 1, 'Error: NFT collection NOT created.');520    expect(collection.owner.toString()).to.be.equal(toSubstrateAddress(alicePrivateKey));521    expect(utf16ToStr(collection.name.toJSON() as any)).to.be.equal(name);522    expect(utf16ToStr(collection.description.toJSON() as any)).to.be.equal(description);523    expect(hexToStr(collection.tokenPrefix.toJSON())).to.be.equal(tokenPrefix);524525526    collectionId = result.collectionId;527  });528529  return collectionId;530}531532export async function createCollectionWithPropsExpectFailure(params: Partial<CreateCollectionParams> = {}) {533  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};534535  await usingApi(async (api, privateKeyWrapper) => {536    // Get number of collections before the transaction537    const collectionCountBefore = await getCreatedCollectionCount(api);538539    // Run the CreateCollection transaction540    const alicePrivateKey = privateKeyWrapper('//Alice');541542    let modeprm = {};543    if (mode.type === 'NFT') {544      modeprm = {nft: null};545    } else if (mode.type === 'Fungible') {546      modeprm = {fungible: mode.decimalPoints};547    } else if (mode.type === 'ReFungible') {548      modeprm = {refungible: null};549    }550551    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any, properties: params.properties, tokenPropertyPermissions: params.propPerm});552    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;553554555    // Get number of collections after the transaction556    const collectionCountAfter = await getCreatedCollectionCount(api);557558    expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');559  });560}561562export async function createCollectionExpectFailure(params: Partial<CreateCollectionParams> = {}) {563  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};564565  let modeprm = {};566  if (mode.type === 'NFT') {567    modeprm = {nft: null};568  } else if (mode.type === 'Fungible') {569    modeprm = {fungible: mode.decimalPoints};570  } else if (mode.type === 'ReFungible') {571    modeprm = {refungible: null};572  }573574  await usingApi(async (api, privateKeyWrapper) => {575    // Get number of collections before the transaction576    const collectionCountBefore = await getCreatedCollectionCount(api);577578    // Run the CreateCollection transaction579    const alicePrivateKey = privateKeyWrapper('//Alice');580    const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});581    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;582583    // Get number of collections after the transaction584    const collectionCountAfter = await getCreatedCollectionCount(api);585586    // What to expect587    expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');588  });589}590591export async function findUnusedAddress(api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair, seedAddition = ''): Promise<IKeyringPair> {592  let bal = 0n;593  let unused;594  do {595    const randomSeed = 'seed' + Math.floor(Math.random() * Math.floor(10000)) + seedAddition;596    unused = privateKeyWrapper(`//${randomSeed}`);597    bal = (await api.query.system.account(unused.address)).data.free.toBigInt();598  } while (bal !== 0n);599  return unused;600}601602export async function getAllowance(api: ApiPromise, collectionId: number, owner: CrossAccountId | string | IKeyringPair, approved: CrossAccountId | string | IKeyringPair, tokenId: number) {603  return (await api.rpc.unique.allowance(collectionId, normalizeAccountId(owner), normalizeAccountId(approved), tokenId)).toBigInt();604}605606export function findUnusedAddresses(api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair, amount: number): Promise<IKeyringPair[]> {607  return Promise.all(new Array(amount).fill(null).map(() => findUnusedAddress(api, privateKeyWrapper, '_' + Date.now())));608}609610export async function findNotExistingCollection(api: ApiPromise): Promise<number> {611  const totalNumber = await getCreatedCollectionCount(api);612  const newCollection: number = totalNumber + 1;613  return newCollection;614}615616function getDestroyResult(events: EventRecord[]): boolean {617  let success = false;618  events.forEach(({event: {method}}) => {619    if (method == 'ExtrinsicSuccess') {620      success = true;621    }622  });623  return success;624}625626export async function destroyCollectionExpectFailure(collectionId: number, senderSeed = '//Alice') {627  await usingApi(async (api, privateKeyWrapper) => {628    // Run the DestroyCollection transaction629    const alicePrivateKey = privateKeyWrapper(senderSeed);630    const tx = api.tx.unique.destroyCollection(collectionId);631    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;632  });633}634635export async function destroyCollectionExpectSuccess(collectionId: number, senderSeed = '//Alice') {636  await usingApi(async (api, privateKeyWrapper) => {637    // Run the DestroyCollection transaction638    const alicePrivateKey = privateKeyWrapper(senderSeed);639    const tx = api.tx.unique.destroyCollection(collectionId);640    const events = await submitTransactionAsync(alicePrivateKey, tx);641    const result = getDestroyResult(events);642    expect(result).to.be.true;643644    // What to expect645    expect(await getDetailedCollectionInfo(api, collectionId)).to.be.null;646  });647}648649export async function setCollectionLimitsExpectSuccess(sender: IKeyringPair, collectionId: number, limits: any) {650  await usingApi(async (api) => {651    const tx = api.tx.unique.setCollectionLimits(collectionId, limits);652    const events = await submitTransactionAsync(sender, tx);653    const result = getGenericResult(events);654655    expect(result.success).to.be.true;656  });657}658659export const setCollectionPermissionsExpectSuccess = async (sender: IKeyringPair, collectionId: number, permissions: any) => {660  await usingApi(async(api) => {661    const tx = api.tx.unique.setCollectionPermissions(collectionId, permissions);662    const events = await submitTransactionAsync(sender, tx);663    const result = getGenericResult(events);664665    expect(result.success).to.be.true;666  });667};668669export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {670  await usingApi(async (api) => {671    const tx = api.tx.unique.setCollectionLimits(collectionId, limits);672    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;673    const result = getGenericResult(events);674675    expect(result.success).to.be.false;676  });677}678679export async function setCollectionSponsorExpectSuccess(collectionId: number, sponsor: string, sender = '//Alice') {680  await usingApi(async (api, privateKeyWrapper) => {681682    // Run the transaction683    const senderPrivateKey = privateKeyWrapper(sender);684    const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);685    const events = await submitTransactionAsync(senderPrivateKey, tx);686    const result = getGenericResult(events);687688    // Get the collection689    const collection = await queryCollectionExpectSuccess(api, collectionId);690691    // What to expect692    expect(result.success).to.be.true;693    expect(collection.sponsorship.toJSON()).to.deep.equal({694      unconfirmed: sponsor,695    });696  });697}698699export async function removeCollectionSponsorExpectSuccess(collectionId: number, sender = '//Alice') {700  await usingApi(async (api, privateKeyWrapper) => {701702    // Run the transaction703    const alicePrivateKey = privateKeyWrapper(sender);704    const tx = api.tx.unique.removeCollectionSponsor(collectionId);705    const events = await submitTransactionAsync(alicePrivateKey, tx);706    const result = getGenericResult(events);707708    // Get the collection709    const collection = await queryCollectionExpectSuccess(api, collectionId);710711    // What to expect712    expect(result.success).to.be.true;713    expect(collection.sponsorship.toJSON()).to.be.deep.equal({disabled: null});714  });715}716717export async function removeCollectionSponsorExpectFailure(collectionId: number, senderSeed = '//Alice') {718  await usingApi(async (api, privateKeyWrapper) => {719720    // Run the transaction721    const alicePrivateKey = privateKeyWrapper(senderSeed);722    const tx = api.tx.unique.removeCollectionSponsor(collectionId);723    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;724  });725}726727export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed = '//Alice') {728  await usingApi(async (api, privateKeyWrapper) => {729730    // Run the transaction731    const alicePrivateKey = privateKeyWrapper(senderSeed);732    const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);733    await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;734  });735}736737export async function confirmSponsorshipExpectSuccess(collectionId: number, senderSeed = '//Alice') {738  await usingApi(async (api, privateKeyWrapper) => {739740    // Run the transaction741    const sender = privateKeyWrapper(senderSeed);742    await confirmSponsorshipByKeyExpectSuccess(collectionId, sender);743  });744}745746export async function confirmSponsorshipByKeyExpectSuccess(collectionId: number, sender: IKeyringPair) {747  await usingApi(async (api, privateKeyWrapper) => {748749    // Run the transaction750    const tx = api.tx.unique.confirmSponsorship(collectionId);751    const events = await submitTransactionAsync(sender, tx);752    const result = getGenericResult(events);753754    // Get the collection755    const collection = await queryCollectionExpectSuccess(api, collectionId);756757    // What to expect758    expect(result.success).to.be.true;759    expect(collection.sponsorship.toJSON()).to.be.deep.equal({760      confirmed: sender.address,761    });762  });763}764765766export async function confirmSponsorshipExpectFailure(collectionId: number, senderSeed = '//Alice') {767  await usingApi(async (api, privateKeyWrapper) => {768769    // Run the transaction770    const sender = privateKeyWrapper(senderSeed);771    const tx = api.tx.unique.confirmSponsorship(collectionId);772    await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;773  });774}775776export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {777  await usingApi(async (api) => {778    const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);779    const events = await submitTransactionAsync(sender, tx);780    const result = getGenericResult(events);781782    expect(result.success).to.be.true;783  });784}785786export async function enableContractSponsoringExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {787  await usingApi(async (api) => {788    const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);789    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;790    const result = getGenericResult(events);791792    expect(result.success).to.be.false;793  });794}795796export async function setTransferFlagExpectSuccess(sender: IKeyringPair, collectionId: number, enabled: boolean) {797798  await usingApi(async (api) => {799800    const tx = api.tx.unique.setTransfersEnabledFlag(collectionId, enabled);801    const events = await submitTransactionAsync(sender, tx);802    const result = getGenericResult(events);803804    expect(result.success).to.be.true;805  });806}807808export async function setTransferFlagExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {809810  await usingApi(async (api) => {811812    const tx = api.tx.unique.setTransfersEnabledFlag(collectionId, enabled);813    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;814    const result = getGenericResult(events);815816    expect(result.success).to.be.false;817  });818}819820export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {821  await usingApi(async (api) => {822    const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);823    const events = await submitTransactionAsync(sender, tx);824    const result = getGenericResult(events);825826    expect(result.success).to.be.true;827  });828}829830export async function setContractSponsoringRateLimitExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {831  await usingApi(async (api) => {832    const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);833    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;834    const result = getGenericResult(events);835836    expect(result.success).to.be.false;837  });838}839840export async function getNextSponsored(841  api: ApiPromise,842  collectionId: number,843  account: string | CrossAccountId,844  tokenId: number,845): Promise<number> {846  return Number((await api.rpc.unique.nextSponsored(collectionId, account, tokenId)).unwrapOr(-1));847}848849export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {850  await usingApi(async (api) => {851    const tx = api.tx.unique.toggleContractAllowList(contractAddress, value);852    const events = await submitTransactionAsync(sender, tx);853    const result = getGenericResult(events);854855    expect(result.success).to.be.true;856  });857}858859export async function isAllowlistedInContract(contractAddress: AccountId | string, user: string) {860  let allowlisted = false;861  await usingApi(async (api) => {862    allowlisted = (await api.query.unique.contractAllowList(contractAddress, user)).toJSON() as boolean;863  });864  return allowlisted;865}866867export async function addToContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {868  await usingApi(async (api) => {869    const tx = api.tx.unique.addToContractAllowList(contractAddress.toString(), user.toString());870    const events = await submitTransactionAsync(sender, tx);871    const result = getGenericResult(events);872873    expect(result.success).to.be.true;874  });875}876877export async function removeFromContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {878  await usingApi(async (api) => {879    const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());880    const events = await submitTransactionAsync(sender, tx);881    const result = getGenericResult(events);882883    expect(result.success).to.be.true;884  });885}886887export async function removeFromContractAllowListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {888  await usingApi(async (api) => {889    const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());890    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;891    const result = getGenericResult(events);892893    expect(result.success).to.be.false;894  });895}896897export interface CreateFungibleData {898  readonly Value: bigint;899}900901export interface CreateReFungibleData { }902export interface CreateNftData { }903904export type CreateItemData = {905  NFT: CreateNftData;906} | {907  Fungible: CreateFungibleData;908} | {909  ReFungible: CreateReFungibleData;910};911912export async function burnItem(api: ApiPromise, sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint) : Promise<boolean> {913  const tx = api.tx.unique.burnItem(collectionId, tokenId, value);914  const events = await submitTransactionAsync(sender, tx);915  return getGenericResult(events).success;916}917918export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint = 1) {919  await usingApi(async (api) => {920    const balanceBefore = await getBalance(api, collectionId, normalizeAccountId(sender), tokenId);921    // if burning token by admin - use adminButnItemExpectSuccess922    expect(balanceBefore >= BigInt(value)).to.be.true;923924    expect(await burnItem(api, sender, collectionId, tokenId, value)).to.be.true;925926    const balanceAfter = await getBalance(api, collectionId, normalizeAccountId(sender), tokenId);927    expect(balanceAfter + BigInt(value)).to.be.equal(balanceBefore);928  });929}930931export async function burnItemExpectFailure(sender: IKeyringPair, collectionId: number, tokenId: number, value: number | bigint = 1) {932  await usingApi(async (api) => {933    const tx = api.tx.unique.burnItem(collectionId, tokenId, value);934935    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;936    const result = getCreateCollectionResult(events);937    // tslint:disable-next-line:no-unused-expression938    expect(result.success).to.be.false;939  });940}941942export async function burnFromExpectSuccess(sender: IKeyringPair, from: IKeyringPair | CrossAccountId, collectionId: number, tokenId: number, value: number | bigint = 1) {943  await usingApi(async (api) => {944    const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(from), tokenId, value);945    const events = await submitTransactionAsync(sender, tx);946    return getGenericResult(events).success;947  });948}949950export async function951approve(952  api: ApiPromise,953  collectionId: number,954  tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string | IKeyringPair, amount: number | bigint,955) {956  const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);957  const events = await submitTransactionAsync(owner, approveUniqueTx);958  return getGenericResult(events).success;959}960961export async function962approveExpectSuccess(963  collectionId: number,964  tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,965) {966  await usingApi(async (api: ApiPromise) => {967    const result = await approve(api, collectionId, tokenId, owner, approved, amount);968    expect(result).to.be.true;969970    expect(await getAllowance(api, collectionId, owner, approved, tokenId)).to.be.equal(BigInt(amount));971  });972}973974export async function adminApproveFromExpectSuccess(975  collectionId: number,976  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,977) {978  await usingApi(async (api: ApiPromise) => {979    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);980    const events = await submitTransactionAsync(admin, approveUniqueTx);981    const result = getGenericResult(events);982    expect(result.success).to.be.true;983984    expect(await getAllowance(api, collectionId, owner, approved, tokenId)).to.be.equal(BigInt(amount));985  });986}987988export async function989transferFrom(990  api: ApiPromise,991  collectionId: number,992  tokenId: number,993  accountApproved: IKeyringPair,994  accountFrom: IKeyringPair | CrossAccountId,995  accountTo: IKeyringPair | CrossAccountId,996  value: number | bigint,997) {998  const from = normalizeAccountId(accountFrom);999  const to = normalizeAccountId(accountTo);1000  const transferFromTx = api.tx.unique.transferFrom(from, to, collectionId, tokenId, value);1001  const events = await submitTransactionAsync(accountApproved, transferFromTx);1002  return getGenericResult(events).success;1003}10041005export async function1006transferFromExpectSuccess(1007  collectionId: number,1008  tokenId: number,1009  accountApproved: IKeyringPair,1010  accountFrom: IKeyringPair | CrossAccountId,1011  accountTo: IKeyringPair | CrossAccountId,1012  value: number | bigint = 1,1013  type = 'NFT',1014) {1015  await usingApi(async (api: ApiPromise) => {1016    const from = normalizeAccountId(accountFrom);1017    const to = normalizeAccountId(accountTo);1018    let balanceBefore = 0n;1019    if (type === 'Fungible' || type === 'ReFungible') {1020      balanceBefore = await getBalance(api, collectionId, to, tokenId);1021    }1022    expect(await transferFrom(api, collectionId, tokenId, accountApproved, accountFrom, accountTo, value)).to.be.true;1023    if (type === 'NFT') {1024      expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);1025    }1026    if (type === 'Fungible') {1027      const balanceAfter = await getBalance(api, collectionId, to, tokenId);1028      if (JSON.stringify(to) !== JSON.stringify(from)) {1029        expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));1030      } else {1031        expect(balanceAfter).to.be.equal(balanceBefore);1032      }1033    }1034    if (type === 'ReFungible') {1035      expect(await getBalance(api, collectionId, to, tokenId)).to.be.equal(balanceBefore + BigInt(value));1036    }1037  });1038}10391040export async function1041transferFromExpectFail(1042  collectionId: number,1043  tokenId: number,1044  accountApproved: IKeyringPair,1045  accountFrom: IKeyringPair,1046  accountTo: IKeyringPair,1047  value: number | bigint = 1,1048) {1049  await usingApi(async (api: ApiPromise) => {1050    const transferFromTx = api.tx.unique.transferFrom(normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);1051    const events = await expect(submitTransactionExpectFailAsync(accountApproved, transferFromTx)).to.be.rejected;1052    const result = getCreateCollectionResult(events);1053    // tslint:disable-next-line:no-unused-expression1054    expect(result.success).to.be.false;1055  });1056}10571058/* eslint no-async-promise-executor: "off" */1059export async function getBlockNumber(api: ApiPromise): Promise<number> {1060  return new Promise<number>(async (resolve) => {1061    const unsubscribe = await api.rpc.chain.subscribeNewHeads((head) => {1062      unsubscribe();1063      resolve(head.number.toNumber());1064    });1065  });1066}10671068export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | CrossAccountId) {1069  await usingApi(async (api) => {1070    const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(address));1071    const events = await submitTransactionAsync(sender, changeAdminTx);1072    const result = getCreateCollectionResult(events);1073    expect(result.success).to.be.true;1074  });1075}10761077export async function adminApproveFromExpectFail(1078  collectionId: number,1079  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,1080) {1081  await usingApi(async (api: ApiPromise) => {1082    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);1083    const events = await expect(submitTransactionAsync(admin, approveUniqueTx)).to.be.rejected;1084    const result = getGenericResult(events);1085    expect(result.success).to.be.false;1086  });1087}10881089export async function1090getFreeBalance(account: IKeyringPair): Promise<bigint> {1091  let balance = 0n;1092  await usingApi(async (api) => {1093    balance = BigInt((await api.query.system.account(account.address)).data.free.toString());1094  });10951096  return balance;1097}10981099export async function transferBalanceTo(api: ApiPromise, source: IKeyringPair, target: string, amount = 1000n * UNIQUE) {1100  const tx = api.tx.balances.transfer(target, amount);1101  const events = await submitTransactionAsync(source, tx);1102  const result = getGenericResult(events);1103  expect(result.success).to.be.true;1104}11051106export async function1107scheduleExpectSuccess(1108  operationTx: any,1109  sender: IKeyringPair,1110  blockSchedule: number,1111  scheduledId: string,1112  period = 1,1113  repetitions = 1,1114) {1115  await usingApi(async (api: ApiPromise) => {1116    const blockNumber: number | undefined = await getBlockNumber(api);1117    const expectedBlockNumber = blockNumber + blockSchedule;11181119    expect(blockNumber).to.be.greaterThan(0);1120    const scheduleTx = api.tx.scheduler.scheduleNamed( // schedule1121      scheduledId,1122      expectedBlockNumber, 1123      repetitions > 1 ? [period, repetitions] : null, 1124      0, 1125      {Value: operationTx as any},1126    );11271128    const events = await submitTransactionAsync(sender, scheduleTx);1129    expect(getGenericResult(events).success).to.be.true;1130  });1131}11321133export async function1134scheduleExpectFailure(1135  operationTx: any,1136  sender: IKeyringPair,1137  blockSchedule: number,1138  scheduledId: string,1139  period = 1,1140  repetitions = 1,1141) {1142  await usingApi(async (api: ApiPromise) => {1143    const blockNumber: number | undefined = await getBlockNumber(api);1144    const expectedBlockNumber = blockNumber + blockSchedule;11451146    expect(blockNumber).to.be.greaterThan(0);1147    const scheduleTx = api.tx.scheduler.scheduleNamed( // schedule1148      scheduledId,1149      expectedBlockNumber, 1150      repetitions <= 1 ? null : [period, repetitions], 1151      0, 1152      {Value: operationTx as any},1153    );11541155    //const events = 1156    await expect(submitTransactionExpectFailAsync(sender, scheduleTx)).to.be.rejected;1157    //expect(getGenericResult(events).success).to.be.false;1158  });1159}11601161export async function1162scheduleTransferAndWaitExpectSuccess(1163  collectionId: number,1164  tokenId: number,1165  sender: IKeyringPair,1166  recipient: IKeyringPair,1167  value: number | bigint = 1,1168  blockSchedule: number,1169  scheduledId: string,1170) {1171  await usingApi(async (api: ApiPromise) => {1172    await scheduleTransferExpectSuccess(collectionId, tokenId, sender, recipient, value, blockSchedule, scheduledId);11731174    const recipientBalanceBefore = (await api.query.system.account(recipient.address)).data.free.toBigInt();11751176    // sleep for n + 1 blocks1177    await waitNewBlocks(blockSchedule + 1);11781179    const recipientBalanceAfter = (await api.query.system.account(recipient.address)).data.free.toBigInt();11801181    expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(recipient.address));1182    expect(recipientBalanceAfter).to.be.equal(recipientBalanceBefore);1183  });1184}11851186export async function1187scheduleTransferExpectSuccess(1188  collectionId: number,1189  tokenId: number,1190  sender: IKeyringPair,1191  recipient: IKeyringPair,1192  value: number | bigint = 1,1193  blockSchedule: number,1194  scheduledId: string,1195) {1196  await usingApi(async (api: ApiPromise) => {1197    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);11981199    await scheduleExpectSuccess(transferTx, sender, blockSchedule, scheduledId);12001201    expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(sender.address));1202  });1203}12041205export async function1206scheduleTransferFundsPeriodicExpectSuccess(1207  amount: bigint,1208  sender: IKeyringPair,1209  recipient: IKeyringPair,1210  blockSchedule: number,1211  scheduledId: string,1212  period: number,1213  repetitions: number,1214) {1215  await usingApi(async (api: ApiPromise) => {1216    const transferTx = api.tx.balances.transfer(recipient.address, amount);12171218    const balanceBefore = await getFreeBalance(recipient);1219    1220    await scheduleExpectSuccess(transferTx, sender, blockSchedule, scheduledId, period, repetitions);12211222    expect(await getFreeBalance(recipient)).to.be.equal(balanceBefore);1223  });1224}12251226export async function1227transfer(1228  api: ApiPromise,1229  collectionId: number,1230  tokenId: number,1231  sender: IKeyringPair,1232  recipient: IKeyringPair | CrossAccountId,1233  value: number | bigint,1234) : Promise<boolean> {1235  const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1236  const events = await executeTransaction(api, sender, transferTx);1237  return getGenericResult(events).success;1238}12391240export async function1241transferExpectSuccess(1242  collectionId: number,1243  tokenId: number,1244  sender: IKeyringPair,1245  recipient: IKeyringPair | CrossAccountId,1246  value: number | bigint = 1,1247  type = 'NFT',1248) {1249  await usingApi(async (api: ApiPromise) => {1250    const from = normalizeAccountId(sender);1251    const to = normalizeAccountId(recipient);12521253    let balanceBefore = 0n;1254    if (type === 'Fungible' || type === 'ReFungible') {1255      balanceBefore = await getBalance(api, collectionId, to, tokenId);1256    }12571258    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1259    const events = await executeTransaction(api, sender, transferTx);1260    const result = getTransferResult(api, events);12611262    expect(result.collectionId).to.be.equal(collectionId);1263    expect(result.itemId).to.be.equal(tokenId);1264    expect(result.sender).to.be.deep.equal(normalizeAccountId(sender.address));1265    expect(result.recipient).to.be.deep.equal(to);1266    expect(result.value).to.be.equal(BigInt(value));12671268    if (type === 'NFT') {1269      expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);1270    }1271    if (type === 'Fungible' || type === 'ReFungible') {1272      const balanceAfter = await getBalance(api, collectionId, to, tokenId);1273      if (JSON.stringify(to) !== JSON.stringify(from)) {1274        expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));1275      } else {1276        expect(balanceAfter).to.be.equal(balanceBefore);1277      }1278    }1279  });1280}12811282export async function1283transferExpectFailure(1284  collectionId: number,1285  tokenId: number,1286  sender: IKeyringPair,1287  recipient: IKeyringPair | CrossAccountId,1288  value: number | bigint = 1,1289) {1290  await usingApi(async (api: ApiPromise) => {1291    const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient), collectionId, tokenId, value);1292    const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;1293    const result = getGenericResult(events);1294    // if (events && Array.isArray(events)) {1295    //   const result = getCreateCollectionResult(events);1296    // tslint:disable-next-line:no-unused-expression1297    expect(result.success).to.be.false;1298    //}1299  });1300}13011302export async function1303approveExpectFail(1304  collectionId: number,1305  tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1,1306) {1307  await usingApi(async (api: ApiPromise) => {1308    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved.address), collectionId, tokenId, amount);1309    const events = await expect(submitTransactionExpectFailAsync(owner, approveUniqueTx)).to.be.rejected;1310    const result = getCreateCollectionResult(events);1311    // tslint:disable-next-line:no-unused-expression1312    expect(result.success).to.be.false;1313  });1314}13151316export async function getBalance(1317  api: ApiPromise,1318  collectionId: number,1319  owner: string | CrossAccountId | IKeyringPair,1320  token: number,1321): Promise<bigint> {1322  return (await api.rpc.unique.balance(collectionId, normalizeAccountId(owner), token)).toBigInt();1323}1324export async function getTokenOwner(1325  api: ApiPromise,1326  collectionId: number,1327  token: number,1328): Promise<CrossAccountId> {1329  const owner = (await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any;1330  if (owner == null) throw new Error('owner == null');1331  return normalizeAccountId(owner);1332}1333export async function getTopmostTokenOwner(1334  api: ApiPromise,1335  collectionId: number,1336  token: number,1337): Promise<CrossAccountId> {1338  const owner = (await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any;1339  if (owner == null) throw new Error('owner == null');1340  return normalizeAccountId(owner);1341}1342export async function getTokenChildren(1343  api: ApiPromise,1344  collectionId: number,1345  tokenId: number,1346): Promise<UpDataStructsTokenChild[]> {1347  return (await api.rpc.unique.tokenChildren(collectionId, tokenId)).toJSON() as any;1348}1349export async function isTokenExists(1350  api: ApiPromise,1351  collectionId: number,1352  token: number,1353): Promise<boolean> {1354  return (await api.rpc.unique.tokenExists(collectionId, token)).toJSON();1355}1356export async function getLastTokenId(1357  api: ApiPromise,1358  collectionId: number,1359): Promise<number> {1360  return (await api.rpc.unique.lastTokenId(collectionId)).toJSON();1361}1362export async function getAdminList(1363  api: ApiPromise,1364  collectionId: number,1365): Promise<string[]> {1366  return (await api.rpc.unique.adminlist(collectionId)).toHuman() as any;1367}1368export async function getTokenProperties(1369  api: ApiPromise,1370  collectionId: number,1371  tokenId: number,1372  propertyKeys: string[],1373): Promise<UpDataStructsProperty[]> {1374  return (await api.rpc.unique.tokenProperties(collectionId, tokenId, propertyKeys)).toHuman() as any;1375}13761377export async function createFungibleItemExpectSuccess(1378  sender: IKeyringPair,1379  collectionId: number,1380  data: CreateFungibleData,1381  owner: CrossAccountId | string = sender.address,1382) {1383  return await usingApi(async (api) => {1384    const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), {Fungible: data});13851386    const events = await submitTransactionAsync(sender, tx);1387    const result = getCreateItemResult(events);13881389    expect(result.success).to.be.true;1390    return result.itemId;1391  });1392}13931394export async function createMultipleItemsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any, owner: CrossAccountId | string = sender.address) {1395  await usingApi(async (api) => {1396    const to = normalizeAccountId(owner);1397    const tx = api.tx.unique.createMultipleItems(collectionId, to, itemsData);13981399    const events = await submitTransactionAsync(sender, tx);1400    expect(getGenericResult(events).success).to.be.true;1401  });1402}14031404export async function createMultipleItemsWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any, owner: CrossAccountId | string = sender.address) {1405  await usingApi(async (api) => {1406    const to = normalizeAccountId(owner);1407    const tx = api.tx.unique.createMultipleItems(collectionId, to, itemsData);14081409    const events = await submitTransactionAsync(sender, tx);1410    const result = getCreateItemsResult(events);14111412    for (const res of result) {1413      expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;1414    }1415  });1416}14171418export async function createMultipleItemsExWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any) {1419  await usingApi(async (api) => {1420    const tx = api.tx.unique.createMultipleItemsEx(collectionId, itemsData);14211422    const events = await submitTransactionAsync(sender, tx);1423    const result = getCreateItemsResult(events);14241425    for (const res of result) {1426      expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;1427    }1428  });1429}14301431export async function createItemWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, props:  Array<Property>, owner: CrossAccountId | string = sender.address) {1432  let newItemId = 0;1433  await usingApi(async (api) => {1434    const to = normalizeAccountId(owner);1435    const itemCountBefore = await getLastTokenId(api, collectionId);1436    const itemBalanceBefore = await getBalance(api, collectionId, to, newItemId);14371438    let tx;1439    if (createMode === 'Fungible') {1440      const createData = {fungible: {value: 10}};1441      tx = api.tx.unique.createItem(collectionId, to, createData as any);1442    } else if (createMode === 'ReFungible') {1443      const createData = {refungible: {pieces: 100}};1444      tx = api.tx.unique.createItem(collectionId, to, createData as any);1445    } else {1446      const data = api.createType('UpDataStructsCreateItemData', {NFT: {properties: props}});1447      tx = api.tx.unique.createItem(collectionId, to, data as UpDataStructsCreateItemData);1448    }14491450    const events = await submitTransactionAsync(sender, tx);1451    const result = getCreateItemResult(events);14521453    const itemCountAfter = await getLastTokenId(api, collectionId);1454    const itemBalanceAfter = await getBalance(api, collectionId, to, newItemId);14551456    if (createMode === 'NFT') {1457      expect(await api.rpc.unique.tokenProperties(collectionId, result.itemId)).not.to.be.empty;1458    }14591460    // What to expect1461    // tslint:disable-next-line:no-unused-expression1462    expect(result.success).to.be.true;1463    if (createMode === 'Fungible') {1464      expect(itemBalanceAfter - itemBalanceBefore).to.be.equal(10n);1465    } else {1466      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);1467    }1468    expect(collectionId).to.be.equal(result.collectionId);1469    expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());1470    expect(to).to.be.deep.equal(result.recipient);1471    newItemId = result.itemId;1472  });1473  return newItemId;1474}14751476export async function createItemWithPropsExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, props: Array<Property>, owner: CrossAccountId | string = sender.address) {1477  await usingApi(async (api) => {14781479    let tx;1480    if (createMode === 'NFT') {1481      const data = api.createType('UpDataStructsCreateItemData', {NFT: {properties: props}}) as UpDataStructsCreateItemData;1482      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), data);1483    } else {1484      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);1485    }148614871488    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1489    if(events.message && events.message.toString().indexOf('1002: Verification Error') > -1) return;1490    const result = getCreateItemResult(events);14911492    expect(result.success).to.be.false;1493  });1494}14951496export async function createItemExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {1497  let newItemId = 0;1498  await usingApi(async (api) => {1499    const to = normalizeAccountId(owner);1500    const itemCountBefore = await getLastTokenId(api, collectionId);1501    const itemBalanceBefore = await getBalance(api, collectionId, to, newItemId);15021503    let tx;1504    if (createMode === 'Fungible') {1505      const createData = {fungible: {value: 10}};1506      tx = api.tx.unique.createItem(collectionId, to, createData as any);1507    } else if (createMode === 'ReFungible') {1508      const createData = {refungible: {pieces: 100}};1509      tx = api.tx.unique.createItem(collectionId, to, createData as any);1510    } else {1511      const createData = {nft: {}};1512      tx = api.tx.unique.createItem(collectionId, to, createData as any);1513    }15141515    const events = await executeTransaction(api, sender, tx);1516    const result = getCreateItemResult(events);15171518    const itemCountAfter = await getLastTokenId(api, collectionId);1519    const itemBalanceAfter = await getBalance(api, collectionId, to, newItemId);15201521    // What to expect1522    // tslint:disable-next-line:no-unused-expression1523    expect(result.success).to.be.true;1524    if (createMode === 'Fungible') {1525      expect(itemBalanceAfter - itemBalanceBefore).to.be.equal(10n);1526    } else {1527      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);1528    }1529    expect(collectionId).to.be.equal(result.collectionId);1530    expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());1531    expect(to).to.be.deep.equal(result.recipient);1532    newItemId = result.itemId;1533  });1534  return newItemId;1535}15361537export async function createRefungibleToken(api: ApiPromise, sender: IKeyringPair, collectionId: number, amount: bigint, owner: CrossAccountId | IKeyringPair | string = sender.address) : Promise<CreateItemResult> {1538  const createData = {refungible: {pieces: amount}};1539  const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createData as any);15401541  const events = await submitTransactionAsync(sender, tx);1542  return  getCreateItemResult(events);1543}15441545export async function createItemExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {1546  await usingApi(async (api) => {1547    const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);15481549    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1550    const result = getCreateItemResult(events);15511552    expect(result.success).to.be.false;1553  });1554}15551556export async function setPublicAccessModeExpectSuccess(1557  sender: IKeyringPair, collectionId: number,1558  accessMode: 'Normal' | 'AllowList',1559) {1560  await usingApi(async (api) => {15611562    // Run the transaction1563    const tx = api.tx.unique.setCollectionPermissions(collectionId, {access: accessMode});1564    const events = await submitTransactionAsync(sender, tx);1565    const result = getGenericResult(events);15661567    // Get the collection1568    const collection = await queryCollectionExpectSuccess(api, collectionId);15691570    // What to expect1571    // tslint:disable-next-line:no-unused-expression1572    expect(result.success).to.be.true;1573    expect(collection.permissions.access.toHuman()).to.be.equal(accessMode);1574  });1575}15761577export async function setPublicAccessModeExpectFail(1578  sender: IKeyringPair, collectionId: number,1579  accessMode: 'Normal' | 'AllowList',1580) {1581  await usingApi(async (api) => {15821583    // Run the transaction1584    const tx = api.tx.unique.setCollectionPermissions(collectionId, {access: accessMode});1585    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1586    const result = getGenericResult(events);15871588    // What to expect1589    // tslint:disable-next-line:no-unused-expression1590    expect(result.success).to.be.false;1591  });1592}15931594export async function enableAllowListExpectSuccess(sender: IKeyringPair, collectionId: number) {1595  await setPublicAccessModeExpectSuccess(sender, collectionId, 'AllowList');1596}15971598export async function enableAllowListExpectFail(sender: IKeyringPair, collectionId: number) {1599  await setPublicAccessModeExpectFail(sender, collectionId, 'AllowList');1600}16011602export async function disableAllowListExpectSuccess(sender: IKeyringPair, collectionId: number) {1603  await setPublicAccessModeExpectSuccess(sender, collectionId, 'Normal');1604}16051606export async function setMintPermissionExpectSuccess(sender: IKeyringPair, collectionId: number, enabled: boolean) {1607  await usingApi(async (api) => {16081609    // Run the transaction1610    const tx = api.tx.unique.setCollectionPermissions(collectionId, {mintMode: enabled});1611    const events = await submitTransactionAsync(sender, tx);1612    const result = getGenericResult(events);1613    expect(result.success).to.be.true;16141615    // Get the collection1616    const collection = await queryCollectionExpectSuccess(api, collectionId);16171618    expect(collection.permissions.mintMode.toHuman()).to.be.equal(enabled);1619  });1620}16211622export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {1623  await setMintPermissionExpectSuccess(sender, collectionId, true);1624}16251626export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {1627  await usingApi(async (api) => {1628    // Run the transaction1629    const tx = api.tx.unique.setCollectionPermissions(collectionId, {mintMode: enabled});1630    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1631    const result = getCreateCollectionResult(events);1632    // tslint:disable-next-line:no-unused-expression1633    expect(result.success).to.be.false;1634  });1635}16361637export async function setChainLimitsExpectFailure(sender: IKeyringPair, limits: IChainLimits) {1638  await usingApi(async (api) => {1639    // Run the transaction1640    const tx = api.tx.unique.setChainLimits(limits);1641    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1642    const result = getCreateCollectionResult(events);1643    // tslint:disable-next-line:no-unused-expression1644    expect(result.success).to.be.false;1645  });1646}16471648export async function isAllowlisted(api: ApiPromise, collectionId: number, address: string | CrossAccountId) {1649  return (await api.rpc.unique.allowed(collectionId, normalizeAccountId(address))).toJSON();1650}16511652export async function addToAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId | CrossAccountId) {1653  await usingApi(async (api) => {1654    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.false;16551656    // Run the transaction1657    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1658    const events = await submitTransactionAsync(sender, tx);1659    const result = getGenericResult(events);1660    expect(result.success).to.be.true;16611662    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;1663  });1664}16651666export async function addToAllowListAgainExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId) {1667  await usingApi(async (api) => {16681669    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;16701671    // Run the transaction1672    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1673    const events = await submitTransactionAsync(sender, tx);1674    const result = getGenericResult(events);1675    expect(result.success).to.be.true;16761677    expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;1678  });1679}16801681export async function addToAllowListExpectFail(sender: IKeyringPair, collectionId: number, address: string | AccountId) {1682  await usingApi(async (api) => {16831684    // Run the transaction1685    const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));1686    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1687    const result = getGenericResult(events);16881689    // What to expect1690    // tslint:disable-next-line:no-unused-expression1691    expect(result.success).to.be.false;1692  });1693}16941695export async function removeFromAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1696  await usingApi(async (api) => {1697    // Run the transaction1698    const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));1699    const events = await submitTransactionAsync(sender, tx);1700    const result = getGenericResult(events);17011702    // What to expect1703    // tslint:disable-next-line:no-unused-expression1704    expect(result.success).to.be.true;1705  });1706}17071708export async function removeFromAllowListExpectFailure(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1709  await usingApi(async (api) => {1710    // Run the transaction1711    const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));1712    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1713    const result = getGenericResult(events);17141715    // What to expect1716    // tslint:disable-next-line:no-unused-expression1717    expect(result.success).to.be.false;1718  });1719}17201721export const getDetailedCollectionInfo = async (api: ApiPromise, collectionId: number)1722  : Promise<UpDataStructsRpcCollection | null> => {1723  return (await api.rpc.unique.collectionById(collectionId)).unwrapOr(null);1724};17251726export const getCreatedCollectionCount = async (api: ApiPromise): Promise<number> => {1727  // set global object - collectionsCount1728  return (await api.rpc.unique.collectionStats()).created.toNumber();1729};17301731export async function queryCollectionExpectSuccess(api: ApiPromise, collectionId: number): Promise<UpDataStructsRpcCollection> {1732  return (await api.rpc.unique.collectionById(collectionId)).unwrap();1733}17341735export async function waitNewBlocks(blocksCount = 1): Promise<void> {1736  await usingApi(async (api) => {1737    const promise = new Promise<void>(async (resolve) => {1738      const unsubscribe = await api.rpc.chain.subscribeNewHeads(() => {1739        if (blocksCount > 0) {1740          blocksCount--;1741        } else {1742          unsubscribe();1743          resolve();1744        }1745      });1746    });1747    return promise;1748  });1749}17501751export async function repartitionRFT(1752  api: ApiPromise,1753  collectionId: number,1754  sender: IKeyringPair,1755  tokenId: number,1756  amount: bigint,1757): Promise<boolean> {1758  const tx = api.tx.unique.repartition(collectionId, tokenId, amount);1759  const events = await submitTransactionAsync(sender, tx);1760  const result = getGenericResult(events);17611762  return result.success;1763}17641765export async function itApi(name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {1766  let i: any = it;1767  if (opts.only) i = i.only;1768  else if (opts.skip) i = i.skip;1769  i(name, async () => {1770    await usingApi(async (api, privateKeyWrapper) => {1771      await cb({api, privateKeyWrapper});1772    });1773  });1774}17751776itApi.only = (name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any) => itApi(name, cb, {only: true});1777itApi.skip = (name: string, cb: (apis: { api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any) => itApi(name, cb, {skip: true});
modifiedtests/yarn.lockdiffbeforeafterboth
--- a/tests/yarn.lock
+++ b/tests/yarn.lock
@@ -10,150 +10,150 @@
     "@jridgewell/gen-mapping" "^0.1.0"
     "@jridgewell/trace-mapping" "^0.3.9"
 
-"@babel/code-frame@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"
-  integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==
+"@babel/code-frame@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a"
+  integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==
   dependencies:
-    "@babel/highlight" "^7.16.7"
+    "@babel/highlight" "^7.18.6"
 
-"@babel/compat-data@^7.17.10":
-  version "7.17.10"
-  resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.10.tgz#711dc726a492dfc8be8220028b1b92482362baab"
-  integrity sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==
+"@babel/compat-data@^7.18.6":
+  version "7.18.8"
+  resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.8.tgz#2483f565faca607b8535590e84e7de323f27764d"
+  integrity sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==
 
-"@babel/core@^7.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.2.tgz#87b2fcd7cce9becaa7f5acebdc4f09f3dd19d876"
-  integrity sha512-A8pri1YJiC5UnkdrWcmfZTJTV85b4UXTAfImGmCfYmax4TR9Cw8sDS0MOk++Gp2mE/BefVJ5nwy5yzqNJbP/DQ==
+"@babel/core@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.6.tgz#54a107a3c298aee3fe5e1947a6464b9b6faca03d"
+  integrity sha512-cQbWBpxcbbs/IUredIPkHiAGULLV8iwgNRMFzvbhEXISp4f3rUUXE5+TIw6KwUWUR3DwyI6gmBRnmAtYaWehwQ==
   dependencies:
     "@ampproject/remapping" "^2.1.0"
-    "@babel/code-frame" "^7.16.7"
-    "@babel/generator" "^7.18.2"
-    "@babel/helper-compilation-targets" "^7.18.2"
-    "@babel/helper-module-transforms" "^7.18.0"
-    "@babel/helpers" "^7.18.2"
-    "@babel/parser" "^7.18.0"
-    "@babel/template" "^7.16.7"
-    "@babel/traverse" "^7.18.2"
-    "@babel/types" "^7.18.2"
+    "@babel/code-frame" "^7.18.6"
+    "@babel/generator" "^7.18.6"
+    "@babel/helper-compilation-targets" "^7.18.6"
+    "@babel/helper-module-transforms" "^7.18.6"
+    "@babel/helpers" "^7.18.6"
+    "@babel/parser" "^7.18.6"
+    "@babel/template" "^7.18.6"
+    "@babel/traverse" "^7.18.6"
+    "@babel/types" "^7.18.6"
     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.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.2.tgz#33873d6f89b21efe2da63fe554460f3df1c5880d"
-  integrity sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw==
+"@babel/generator@^7.18.6", "@babel/generator@^7.18.7":
+  version "7.18.7"
+  resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.7.tgz#2aa78da3c05aadfc82dbac16c99552fc802284bd"
+  integrity sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A==
   dependencies:
-    "@babel/types" "^7.18.2"
-    "@jridgewell/gen-mapping" "^0.3.0"
+    "@babel/types" "^7.18.7"
+    "@jridgewell/gen-mapping" "^0.3.2"
     jsesc "^2.5.1"
 
-"@babel/helper-compilation-targets@^7.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.2.tgz#67a85a10cbd5fc7f1457fec2e7f45441dc6c754b"
-  integrity sha512-s1jnPotJS9uQnzFtiZVBUxe67CuBa679oWFHpxYYnTpRL/1ffhyX44R9uYiXoa/pLXcY9H2moJta0iaanlk/rQ==
+"@babel/helper-compilation-targets@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.6.tgz#18d35bfb9f83b1293c22c55b3d576c1315b6ed96"
+  integrity sha512-vFjbfhNCzqdeAtZflUFrG5YIFqGTqsctrtkZ1D/NB0mDW9TwW3GmmUepYY4G9wCET5rY5ugz4OGTcLd614IzQg==
   dependencies:
-    "@babel/compat-data" "^7.17.10"
-    "@babel/helper-validator-option" "^7.16.7"
+    "@babel/compat-data" "^7.18.6"
+    "@babel/helper-validator-option" "^7.18.6"
     browserslist "^4.20.2"
     semver "^6.3.0"
 
-"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz#8a6d2dedb53f6bf248e31b4baf38739ee4a637bd"
-  integrity sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ==
+"@babel/helper-environment-visitor@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.6.tgz#b7eee2b5b9d70602e59d1a6cad7dd24de7ca6cd7"
+  integrity sha512-8n6gSfn2baOY+qlp+VSzsosjCVGFqWKmDF0cCWOybh52Dw3SEyoWR1KrhMJASjLwIEkkAufZ0xvr+SxLHSpy2Q==
 
-"@babel/helper-function-name@^7.17.9":
-  version "7.17.9"
-  resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12"
-  integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==
+"@babel/helper-function-name@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.18.6.tgz#8334fecb0afba66e6d87a7e8c6bb7fed79926b83"
+  integrity sha512-0mWMxV1aC97dhjCah5U5Ua7668r5ZmSC2DLfH2EZnf9c3/dHZKiFa5pRLMH5tjSl471tY6496ZWk/kjNONBxhw==
   dependencies:
-    "@babel/template" "^7.16.7"
-    "@babel/types" "^7.17.0"
+    "@babel/template" "^7.18.6"
+    "@babel/types" "^7.18.6"
 
-"@babel/helper-hoist-variables@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246"
-  integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==
+"@babel/helper-hoist-variables@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678"
+  integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==
   dependencies:
-    "@babel/types" "^7.16.7"
+    "@babel/types" "^7.18.6"
 
-"@babel/helper-module-imports@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437"
-  integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==
+"@babel/helper-module-imports@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e"
+  integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==
   dependencies:
-    "@babel/types" "^7.16.7"
+    "@babel/types" "^7.18.6"
 
-"@babel/helper-module-transforms@^7.18.0":
-  version "7.18.0"
-  resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz#baf05dec7a5875fb9235bd34ca18bad4e21221cd"
-  integrity sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA==
+"@babel/helper-module-transforms@^7.18.6":
+  version "7.18.8"
+  resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.8.tgz#4f8408afead0188cfa48672f9d0e5787b61778c8"
+  integrity sha512-che3jvZwIcZxrwh63VfnFTUzcAM9v/lznYkkRxIBGMPt1SudOKHAEec0SIRCfiuIzTcF7VGj/CaTT6gY4eWxvA==
   dependencies:
-    "@babel/helper-environment-visitor" "^7.16.7"
-    "@babel/helper-module-imports" "^7.16.7"
-    "@babel/helper-simple-access" "^7.17.7"
-    "@babel/helper-split-export-declaration" "^7.16.7"
-    "@babel/helper-validator-identifier" "^7.16.7"
-    "@babel/template" "^7.16.7"
-    "@babel/traverse" "^7.18.0"
-    "@babel/types" "^7.18.0"
+    "@babel/helper-environment-visitor" "^7.18.6"
+    "@babel/helper-module-imports" "^7.18.6"
+    "@babel/helper-simple-access" "^7.18.6"
+    "@babel/helper-split-export-declaration" "^7.18.6"
+    "@babel/helper-validator-identifier" "^7.18.6"
+    "@babel/template" "^7.18.6"
+    "@babel/traverse" "^7.18.8"
+    "@babel/types" "^7.18.8"
 
-"@babel/helper-simple-access@^7.17.7":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.2.tgz#4dc473c2169ac3a1c9f4a51cfcd091d1c36fcff9"
-  integrity sha512-7LIrjYzndorDY88MycupkpQLKS1AFfsVRm2k/9PtKScSy5tZq0McZTj+DiMRynboZfIqOKvo03pmhTaUgiD6fQ==
+"@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==
   dependencies:
-    "@babel/types" "^7.18.2"
+    "@babel/types" "^7.18.6"
 
-"@babel/helper-split-export-declaration@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b"
-  integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==
+"@babel/helper-split-export-declaration@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075"
+  integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==
   dependencies:
-    "@babel/types" "^7.16.7"
+    "@babel/types" "^7.18.6"
 
-"@babel/helper-validator-identifier@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad"
-  integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==
+"@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-option@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23"
-  integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==
+"@babel/helper-validator-option@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8"
+  integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==
 
-"@babel/helpers@^7.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.2.tgz#970d74f0deadc3f5a938bfa250738eb4ac889384"
-  integrity sha512-j+d+u5xT5utcQSzrh9p+PaJX94h++KN+ng9b9WEJq7pkUPAd61FGqhjuUEdfknb3E/uDBb7ruwEeKkIxNJPIrg==
+"@babel/helpers@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.6.tgz#4c966140eaa1fcaa3d5a8c09d7db61077d4debfd"
+  integrity sha512-vzSiiqbQOghPngUYt/zWGvK3LAsPhz55vc9XNN0xAl2gV4ieShI2OQli5duxWHD+72PZPTKAcfcZDE1Cwc5zsQ==
   dependencies:
-    "@babel/template" "^7.16.7"
-    "@babel/traverse" "^7.18.2"
-    "@babel/types" "^7.18.2"
+    "@babel/template" "^7.18.6"
+    "@babel/traverse" "^7.18.6"
+    "@babel/types" "^7.18.6"
 
-"@babel/highlight@^7.16.7":
-  version "7.17.12"
-  resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.17.12.tgz#257de56ee5afbd20451ac0a75686b6b404257351"
-  integrity sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==
+"@babel/highlight@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf"
+  integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==
   dependencies:
-    "@babel/helper-validator-identifier" "^7.16.7"
+    "@babel/helper-validator-identifier" "^7.18.6"
     chalk "^2.0.0"
     js-tokens "^4.0.0"
 
-"@babel/parser@^7.16.7", "@babel/parser@^7.18.0":
-  version "7.18.4"
-  resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.4.tgz#6774231779dd700e0af29f6ad8d479582d7ce5ef"
-  integrity sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==
+"@babel/parser@^7.18.6", "@babel/parser@^7.18.8":
+  version "7.18.8"
+  resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.8.tgz#822146080ac9c62dac0823bb3489622e0bc1cbdf"
+  integrity sha512-RSKRfYX20dyH+elbJK2uqAkVyucL+xXzhqlMD5/ZXx+dAAwpyB7HsvnHe/ZUGOF+xLr5Wx9/JoXVTj6BQE2/oA==
 
-"@babel/register@^7.17.7":
-  version "7.17.7"
-  resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.17.7.tgz#5eef3e0f4afc07e25e847720e7b987ae33f08d0b"
-  integrity sha512-fg56SwvXRifootQEDQAu1mKdjh5uthPzdO0N6t358FktfL4XjAVXuH58ULoiW8mesxiOgNIrxiImqEwv0+hRRA==
+"@babel/register@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.18.6.tgz#48a4520f1b2a7d7ac861e8148caeb0cefe6c59db"
+  integrity sha512-tkYtONzaO8rQubZzpBnvZPFcHgh8D9F55IjOsYton4X2IBoyRn2ZSWQqySTZnUn2guZbxbQiAB27hJEbvXamhQ==
   dependencies:
     clone-deep "^4.0.1"
     find-cache-dir "^2.0.0"
@@ -161,44 +161,44 @@
     pirates "^4.0.5"
     source-map-support "^0.5.16"
 
-"@babel/runtime@^7.17.9", "@babel/runtime@^7.18.3":
-  version "7.18.3"
-  resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.3.tgz#c7b654b57f6f63cf7f8b418ac9ca04408c4579f4"
-  integrity sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==
+"@babel/runtime@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.6.tgz#6a1ef59f838debd670421f8c7f2cbb8da9751580"
+  integrity sha512-t9wi7/AW6XtKahAe20Yw0/mMljKq0B1r2fPdvaAdV/KPDZewFXdaaa6K7lxmZBZ8FBNpCiAT6iHPmd6QO9bKfQ==
   dependencies:
     regenerator-runtime "^0.13.4"
 
-"@babel/template@^7.16.7":
-  version "7.16.7"
-  resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155"
-  integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==
+"@babel/template@^7.18.6":
+  version "7.18.6"
+  resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.6.tgz#1283f4993e00b929d6e2d3c72fdc9168a2977a31"
+  integrity sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw==
   dependencies:
-    "@babel/code-frame" "^7.16.7"
-    "@babel/parser" "^7.16.7"
-    "@babel/types" "^7.16.7"
+    "@babel/code-frame" "^7.18.6"
+    "@babel/parser" "^7.18.6"
+    "@babel/types" "^7.18.6"
 
-"@babel/traverse@^7.18.0", "@babel/traverse@^7.18.2":
-  version "7.18.2"
-  resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.2.tgz#b77a52604b5cc836a9e1e08dca01cba67a12d2e8"
-  integrity sha512-9eNwoeovJ6KH9zcCNnENY7DMFwTU9JdGCFtqNLfUAqtUHRCOsTOqWoffosP8vKmNYeSBUv3yVJXjfd8ucwOjUA==
+"@babel/traverse@^7.18.6", "@babel/traverse@^7.18.8":
+  version "7.18.8"
+  resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.8.tgz#f095e62ab46abf1da35e5a2011f43aee72d8d5b0"
+  integrity sha512-UNg/AcSySJYR/+mIcJQDCv00T+AqRO7j/ZEJLzpaYtgM48rMg5MnkJgyNqkzo88+p4tfRvZJCEiwwfG6h4jkRg==
   dependencies:
-    "@babel/code-frame" "^7.16.7"
-    "@babel/generator" "^7.18.2"
-    "@babel/helper-environment-visitor" "^7.18.2"
-    "@babel/helper-function-name" "^7.17.9"
-    "@babel/helper-hoist-variables" "^7.16.7"
-    "@babel/helper-split-export-declaration" "^7.16.7"
-    "@babel/parser" "^7.18.0"
-    "@babel/types" "^7.18.2"
+    "@babel/code-frame" "^7.18.6"
+    "@babel/generator" "^7.18.7"
+    "@babel/helper-environment-visitor" "^7.18.6"
+    "@babel/helper-function-name" "^7.18.6"
+    "@babel/helper-hoist-variables" "^7.18.6"
+    "@babel/helper-split-export-declaration" "^7.18.6"
+    "@babel/parser" "^7.18.8"
+    "@babel/types" "^7.18.8"
     debug "^4.1.0"
     globals "^11.1.0"
 
-"@babel/types@^7.16.7", "@babel/types@^7.17.0", "@babel/types@^7.18.0", "@babel/types@^7.18.2":
-  version "7.18.4"
-  resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354"
-  integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw==
+"@babel/types@^7.18.6", "@babel/types@^7.18.7", "@babel/types@^7.18.8":
+  version "7.18.8"
+  resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.8.tgz#c5af199951bf41ba4a6a9a6d0d8ad722b30cd42f"
+  integrity sha512-qwpdsmraq0aJ3osLJRApsc2ouSJCdnMeZwB0DhbtHAtRpZNZCdlbRnHIgcRKzdE1g0iOGg644fzjOBcdOz9cPw==
   dependencies:
-    "@babel/helper-validator-identifier" "^7.16.7"
+    "@babel/helper-validator-identifier" "^7.18.6"
     to-fast-properties "^2.0.0"
 
 "@cspotcode/source-map-support@^0.8.0":
@@ -437,12 +437,12 @@
     "@jridgewell/set-array" "^1.0.0"
     "@jridgewell/sourcemap-codec" "^1.4.10"
 
-"@jridgewell/gen-mapping@^0.3.0":
-  version "0.3.1"
-  resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9"
-  integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==
+"@jridgewell/gen-mapping@^0.3.2":
+  version "0.3.2"
+  resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9"
+  integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==
   dependencies:
-    "@jridgewell/set-array" "^1.0.0"
+    "@jridgewell/set-array" "^1.0.1"
     "@jridgewell/sourcemap-codec" "^1.4.10"
     "@jridgewell/trace-mapping" "^0.3.9"
 
@@ -456,6 +456,11 @@
   resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea"
   integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==
 
+"@jridgewell/set-array@^1.0.1":
+  version "1.1.2"
+  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":
   version "1.4.13"
   resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c"
@@ -477,15 +482,15 @@
     "@jridgewell/resolve-uri" "^3.0.3"
     "@jridgewell/sourcemap-codec" "^1.4.10"
 
-"@noble/hashes@1.0.0":
-  version "1.0.0"
-  resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.0.0.tgz#d5e38bfbdaba174805a4e649f13be9a9ed3351ae"
-  integrity sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg==
+"@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/secp256k1@1.5.5":
-  version "1.5.5"
-  resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.5.5.tgz#315ab5745509d1a8c8e90d0bdf59823ccf9bcfc3"
-  integrity sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ==
+"@noble/secp256k1@1.6.0":
+  version "1.6.0"
+  resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.0.tgz#602afbbfcfb7e169210469b697365ef740d7e930"
+  integrity sha512-DWSsg8zMHOYMYBqIQi96BQuthZrp98LCeMNcUOaffCIVYQ5yxDbNikLF+H7jEnmNNmXbtVic46iCuVWzar+MgA==
 
 "@nodelib/fs.scandir@2.1.5":
   version "2.1.5"
@@ -508,142 +513,142 @@
     "@nodelib/fs.scandir" "2.1.5"
     fastq "^1.6.0"
 
-"@polkadot/api-augment@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-8.7.2-15.tgz#a141d3cd595a39e7e2965330268b5eb92bdd5849"
-  integrity sha512-QGXosX6p0RFYNhWepZCIaRiyCvHnVt5Pb6U7/77UxIszgGRHfHFDsYr4v5bGiaRTOj/E8moc2Ufi/+VgOiG9sw==
+"@polkadot/api-augment@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-8.12.2.tgz#413ae9c99df0a4fb2135fee3f7b9e0caa913fcfd"
+  integrity sha512-HbvNOu6ntago8nYqLkq/HZ+gsMhbKe/sD4hPIFPruhP6OAnW6TWNIlqc2ruFx2KrT0rfzXUZ4Gmk4WgyRFuz4Q==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/api-base" "8.7.2-15"
-    "@polkadot/rpc-augment" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-augment" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/api-base" "8.12.2"
+    "@polkadot/rpc-augment" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-augment" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/api-base@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-8.7.2-15.tgz#c909d3bf0fbfb3cc46ca7067199e36e72b959bdb"
-  integrity sha512-HXdtaqbpnfFbOazjI9CPSYM37S4mzhxUs8hLMKrWqpHL//at4tiMa5dRyev9VSKeE6gqeqCT9JTBvEAZ9eNR6Q==
+"@polkadot/api-base@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-8.12.2.tgz#15fbf89b14d6918027b7bf7f87b218a675ae82d6"
+  integrity sha512-5rLOCulXNU/g0rUVoW6ArQjOBq/07S6oKR9nOJls6W4PUhYcBIClCTlXx2uoDszMdwhEhYyHQ67bnoTcRrYcLA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/rpc-core" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/rpc-core" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/util" "^10.0.2"
     rxjs "^7.5.5"
 
-"@polkadot/api-contract@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-8.7.2-15.tgz#687706fb4bd33c4a88187db3a269292f6e559892"
-  integrity sha512-Pr1Nm5zBpW9foCKm/Q6hIT5KHCeFVE8EFSfHBgjbitYpFOGnz19kduEpa0vxIcfq2WVXcVPTQ2eqjGtHoThNqA==
+"@polkadot/api-contract@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-8.12.2.tgz#9dddd83eb0ae40fce806fe2e32d319134a28ae4c"
+  integrity sha512-YuyVamnp9q5VAWN9WOYsaWKnH1/MERtCzsG5/saopgGrEjfYRqyuLA+VVFaAoxEAdPfJew0AQDHjbR2H2+C9nQ==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/api" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/types-create" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/util-crypto" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/api" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/types-create" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
     rxjs "^7.5.5"
 
-"@polkadot/api-derive@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-8.7.2-15.tgz#b29f24d435c036c9bf5624d18a9d93196cf2c4f4"
-  integrity sha512-0R3M9LFKoQ0d7elIDQjPKuV5EAHTtkU/72Lgxw2GYStsOqcnfFNomfLoLMuk8Xy4ETUAp/Kq1eMJpvsY6hSTtA==
+"@polkadot/api-derive@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-8.12.2.tgz#eec954f6421356caf52584fe5c15e7d96c6c3d29"
+  integrity sha512-F7HCAVNXLQphv7OYVcq7GM5CP6RzGvYfTqutmc5GZFCDVMDY9RQA+a/3T5BIjJXrtepPa0pcYvt9fcovsazhZw==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/api" "8.7.2-15"
-    "@polkadot/api-augment" "8.7.2-15"
-    "@polkadot/api-base" "8.7.2-15"
-    "@polkadot/rpc-core" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/util-crypto" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/api" "8.12.2"
+    "@polkadot/api-augment" "8.12.2"
+    "@polkadot/api-base" "8.12.2"
+    "@polkadot/rpc-core" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
     rxjs "^7.5.5"
 
-"@polkadot/api@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-8.7.2-15.tgz#c7ede416e4d277c227fc93fdfdc4d27634935d08"
-  integrity sha512-tzEUWsXIPzPbnpn/3LTGtJ7SXzMgCJ/da5d9q0UH3vsx1gDEjuZEWXOeSYLHgbqQSgwPukvMVuGtRjcC+A/WZQ==
+"@polkadot/api@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-8.12.2.tgz#5ade99fd595b712f647cf4d63ce5a6daa6d0fff7"
+  integrity sha512-bK3bhCFqCYTx/K/89QF88jYqE3Dc1LmCwMnwpof6adlAj5DoEjRfSmKarqrZqox516Xph1+84ACNkyem0KnIWA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/api-augment" "8.7.2-15"
-    "@polkadot/api-base" "8.7.2-15"
-    "@polkadot/api-derive" "8.7.2-15"
-    "@polkadot/keyring" "^9.4.1"
-    "@polkadot/rpc-augment" "8.7.2-15"
-    "@polkadot/rpc-core" "8.7.2-15"
-    "@polkadot/rpc-provider" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-augment" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/types-create" "8.7.2-15"
-    "@polkadot/types-known" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/util-crypto" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/api-augment" "8.12.2"
+    "@polkadot/api-base" "8.12.2"
+    "@polkadot/api-derive" "8.12.2"
+    "@polkadot/keyring" "^10.0.2"
+    "@polkadot/rpc-augment" "8.12.2"
+    "@polkadot/rpc-core" "8.12.2"
+    "@polkadot/rpc-provider" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-augment" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/types-create" "8.12.2"
+    "@polkadot/types-known" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
     eventemitter3 "^4.0.7"
     rxjs "^7.5.5"
 
-"@polkadot/keyring@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-9.4.1.tgz#4bc8d1c1962756841742abac0d7e4ef233d9c2a9"
-  integrity sha512-op6Tj8E9GHeZYvEss38FRUrX+GlBj6qiwF4BlFrAvPqjPnRn8TT9NhRLroiCwvxeNg3uMtEF/5xB+vvdI0I6qw==
+"@polkadot/keyring@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.0.2.tgz#4e6cc008a16cf7bb1b95694857c16295ca2135ae"
+  integrity sha512-N/lx/e9alR/lUREap4hQ/YKa+CKCFIa4QOKLz8eFhpqhbA5M5nQcjrppitO+sX/XlpmbOBpbnO168cU2dA09Iw==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/util" "9.4.1"
-    "@polkadot/util-crypto" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/util" "10.0.2"
+    "@polkadot/util-crypto" "10.0.2"
 
-"@polkadot/networks@9.4.1", "@polkadot/networks@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-9.4.1.tgz#acdf3d64421ce0e3d3ba68797fc29a28ee40c185"
-  integrity sha512-ibH8bZ2/XMXv0XEsP1fGOqNnm2mg1rHo5kHXSJ3QBcZJFh1+xkI4Ovl2xrFfZ+SYATA3Wsl5R6knqimk2EqyJQ==
+"@polkadot/networks@10.0.2", "@polkadot/networks@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.0.2.tgz#864f08cdbd4cf7c65a82721f3008169222a53148"
+  integrity sha512-K7hUFmErTrBtkobhvFwT/oPEQrI1oVr7WfngquM+zN0oHiHzRspecxifGKsQ1kw78F7zrZKOBScW/hoJbdI8fA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/util" "9.4.1"
-    "@substrate/ss58-registry" "^1.22.0"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/util" "10.0.2"
+    "@substrate/ss58-registry" "^1.23.0"
 
-"@polkadot/rpc-augment@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-8.7.2-15.tgz#6175126968dfb79ba5549b03cac8c3860666e72b"
-  integrity sha512-IgfkR9CHT8jDuGYkb75DBFu+yJNW32+vOt3oS0sf57VqkHketSq9rD3mtZD37V/21Q4a17yrqKQOte7mMl9kcg==
+"@polkadot/rpc-augment@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-8.12.2.tgz#7afe41a6230a117485991ce108f6ffe341e72bb3"
+  integrity sha512-FKVMmkYhWJNcuXpRN9t7xTX5agSgcgniP8gNPMhL6GV8lV3Xoxs8gLgVy32xeAh7gxArN/my6LnYPtXVkdFALQ==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/rpc-core" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/rpc-core" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/rpc-core@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-8.7.2-15.tgz#827a31adf833fb866cb5f39dbd86c5f0b44d63a4"
-  integrity sha512-yGmpESOmGyzY7+D3yUxbKToz/eP/q8vDyOGajLnHn12TcnjgbAfMdc4xdU6cQex+mSsPwS0YQFuPrPXGloCOHA==
+"@polkadot/rpc-core@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-8.12.2.tgz#d8d53240276f0e2df3f4e6540acbb35949a2c56e"
+  integrity sha512-RLhzNYJonfsQXYhZuyVBSsOwSgCf+8ijS3aUcv06yrFf26k7nXw2Uc4P0Io3jY/wq5LnvkKzL+HSj6j7XZ+/Sg==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/rpc-augment" "8.7.2-15"
-    "@polkadot/rpc-provider" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/rpc-augment" "8.12.2"
+    "@polkadot/rpc-provider" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/util" "^10.0.2"
     rxjs "^7.5.5"
 
-"@polkadot/rpc-provider@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-8.7.2-15.tgz#99dd30085284442265225e0f12aef3849b7bfe44"
-  integrity sha512-EwgBnUIpGhEfSanDXVviQQ784HYD3DWUPdv9pIvn9qnCZPk7o+MGPvKW73A+XbQpPV9j8tAGnVsSnbDuoSVp1g==
+"@polkadot/rpc-provider@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-8.12.2.tgz#e3f6ddf98955bb4a8431342f5f9d39dc01c3555b"
+  integrity sha512-fgXKAYDmc1kGmOPa2Nuh+LsUBFvUzgzP/tOEbS5UJpoc0+azZfTLWh2AXpo/gVHblR6zZBDWrB3wmGzu6wF17A==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/keyring" "^9.4.1"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-support" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/util-crypto" "^9.4.1"
-    "@polkadot/x-fetch" "^9.4.1"
-    "@polkadot/x-global" "^9.4.1"
-    "@polkadot/x-ws" "^9.4.1"
-    "@substrate/connect" "0.7.5"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/keyring" "^10.0.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-support" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
+    "@polkadot/x-fetch" "^10.0.2"
+    "@polkadot/x-global" "^10.0.2"
+    "@polkadot/x-ws" "^10.0.2"
+    "@substrate/connect" "0.7.7"
     eventemitter3 "^4.0.7"
     mock-socket "^9.1.5"
-    nock "^13.2.6"
+    nock "^13.2.8"
 
 "@polkadot/ts@0.4.22":
   version "0.4.22"
@@ -652,235 +657,236 @@
   dependencies:
     "@types/chrome" "^0.0.171"
 
-"@polkadot/typegen@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-8.7.2-15.tgz#06e9d054db1c63d9862186429a8017b2b80bce2a"
-  integrity sha512-NC8Ticirh20k1Co17D8cqQawIJ8W9HWDuq6oDyEMT4XkeBbZ1hQRO9JBO14neWDJmYJBhlUotP65jgjs8D5bMw==
+"@polkadot/typegen@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-8.12.2.tgz#b8d4fa567b187a2987804d51c85d66e2c899748a"
+  integrity sha512-hI33NtlsrMbF22iwT/i3kZ8ZsgScR8GnYztafKVau+8lVbSiA0BCKSHtKhUA8j/G2NsI62pWezsk7pbGJCcwTQ==
   dependencies:
-    "@babel/core" "^7.18.2"
-    "@babel/register" "^7.17.7"
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/api" "8.7.2-15"
-    "@polkadot/api-augment" "8.7.2-15"
-    "@polkadot/rpc-augment" "8.7.2-15"
-    "@polkadot/rpc-provider" "8.7.2-15"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-augment" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/types-create" "8.7.2-15"
-    "@polkadot/types-support" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/x-ws" "^9.4.1"
+    "@babel/core" "^7.18.6"
+    "@babel/register" "^7.18.6"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/api" "8.12.2"
+    "@polkadot/api-augment" "8.12.2"
+    "@polkadot/rpc-augment" "8.12.2"
+    "@polkadot/rpc-provider" "8.12.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-augment" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/types-create" "8.12.2"
+    "@polkadot/types-support" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
+    "@polkadot/x-ws" "^10.0.2"
     handlebars "^4.7.7"
     websocket "^1.0.34"
     yargs "^17.5.1"
 
-"@polkadot/types-augment@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-8.7.2-15.tgz#7ab077a1a31190ad17183196efb1da065c0d0bcd"
-  integrity sha512-th1jVBDqpyQVB2gCNzo/HV0dIeNinjyPla01BFdhQ5mDKYXJ8fugsLCk5oKUPpItBrj+5NWCgynVvCwm0YJw3g==
+"@polkadot/types-augment@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-8.12.2.tgz#b43d21a993d7cf8c7cd4721a2327e19dd924d255"
+  integrity sha512-47+T12u7HV+g22KryirG7fik5lU1tHgu39wLv8YZ/6jD1hVvgE632fvaCp4qje1F3M82aXobfekO+WOPLCZVsg==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/types-codec@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-8.7.2-15.tgz#6afa4ff45dc7afb9250f283f70a40be641367941"
-  integrity sha512-k8t7/Ern7sY4ZKQc5cYY3h1bg7/GAEaTPmKz094DhPJmEhi3NNgeJ4uyeB/JYCo5GbxXQG6W2M021s582urjMw==
+"@polkadot/types-codec@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-8.12.2.tgz#7bec61d0ba751bb2cd72f93b5b81d058fa4affc5"
+  integrity sha512-NDa2ZJpJMWC9Un3PtvkyJF86M80gLqSmPyjIR8xxp0DzcD5EsCL8EV79xcOWUGm2lws1C66a4t4He/8ZwPNUqg==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/x-bigint" "^10.0.2"
 
-"@polkadot/types-create@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-8.7.2-15.tgz#106a11eb71dc2743b140d8640a3b3e7fc5ccf10e"
-  integrity sha512-xB9jAJ3XQh/U05b+X77m5TPh4N9oBwwpePkAmLhovTSOSeobj7qeUKrZqccs0BSxJnJPlLwrwuusjeTtTfZCHw==
+"@polkadot/types-create@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-8.12.2.tgz#f5fa6e1b1eb2b60372cd61950b1ab1c4482bcfd6"
+  integrity sha512-D+Sfj+TwvipO+wl4XbsVkw5AgFdpy5O2JY88CV6L26EGU2OqCcTuenwSGdrsiLWW65m97q9lP7SUphUh39vBhA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/types-known@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-8.7.2-15.tgz#171b8d3963a5c38d46f98a7c14be59033f9a4da8"
-  integrity sha512-c5YuuauPCu70chDnV7Fphh7SbAQl8JWj+PoY37I5BACCNFxtUx5KnP93BChiD0QxcHs2QqD6RdjW6O7cVRUKfA==
+"@polkadot/types-known@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-8.12.2.tgz#1b8a18be24b4ee624b90831870d9db227f3cb769"
+  integrity sha512-8HCZ3AkczBrCl+TUZD0+2ubLr0BQx+0f/Nnl9yuz1pWygmSEpHrYspmFtDdpMJnNTGZo8vHNOa7smdlijJqlhw==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/networks" "^9.4.1"
-    "@polkadot/types" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/types-create" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/networks" "^10.0.2"
+    "@polkadot/types" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/types-create" "8.12.2"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/types-support@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-8.7.2-15.tgz#2d726e3d5615383ca97db3f32ee21e2aad077fcb"
-  integrity sha512-Tl6xm9r/uqrKQK1OUdi5X9MaTgplBYPj3tY9677ZPV7QGYWt0Uz912u9fC2v0PGNReDXtzvrlgvk0aoErwzF5Q==
+"@polkadot/types-support@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-8.12.2.tgz#b4f999cc63da21d8b73de621035c9d3e75386d8b"
+  integrity sha512-tTksJ4COcVonu/beWQKkF/6fKaArmTwM6iCuxn2PuJziS2Cm1+7D8Rh3ODwwZOseFvHPEco6jnb4DWNclXbZiA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/util" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/util" "^10.0.2"
 
-"@polkadot/types@8.7.2-15":
-  version "8.7.2-15"
-  resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-8.7.2-15.tgz#5b25b6b76c916637a1d15133b5880a73079e65bc"
-  integrity sha512-KfJKzk6/Ta8vZVJH8+xYYPvd9SD+4fdl4coGgKuPGYZFsjDGnYvAX4ls6/WKby51JK5s24sqaUP3vZisIgh4wA==
+"@polkadot/types@8.12.2":
+  version "8.12.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-8.12.2.tgz#c5fd35e1d5cfc52b64b6968b16950d7ab19bb8f7"
+  integrity sha512-hOqLunz4YH51B6AvuemX1cXKf+O8pehEoP3lH+FRKfJ7wyVhqa3WA+aUXhoTQBIuSiOjjC/FEJrRO5AoNO2iCg==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/keyring" "^9.4.1"
-    "@polkadot/types-augment" "8.7.2-15"
-    "@polkadot/types-codec" "8.7.2-15"
-    "@polkadot/types-create" "8.7.2-15"
-    "@polkadot/util" "^9.4.1"
-    "@polkadot/util-crypto" "^9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/keyring" "^10.0.2"
+    "@polkadot/types-augment" "8.12.2"
+    "@polkadot/types-codec" "8.12.2"
+    "@polkadot/types-create" "8.12.2"
+    "@polkadot/util" "^10.0.2"
+    "@polkadot/util-crypto" "^10.0.2"
     rxjs "^7.5.5"
 
-"@polkadot/util-crypto@9.4.1", "@polkadot/util-crypto@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-9.4.1.tgz#af50d9b3e3fcf9760ee8eb262b1cc61614c21d98"
-  integrity sha512-V6xMOjdd8Kt/QmXlcDYM4WJDAmKuH4vWSlIcMmkFHnwH/NtYVdYIDZswLQHKL8gjLijPfVTHpWaJqNFhGpZJEg==
+"@polkadot/util-crypto@10.0.2", "@polkadot/util-crypto@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.0.2.tgz#4fd78ebe8d8d95089c8bbff1e4e416fd03f9df4f"
+  integrity sha512-0uJFvu5cpRBep0/AcpA8vnXH3gnoe+ADiMKD93AekjxrOVqlrjVHKIf+FbiGv1paRKISxoO5Q2j7nCvDsi1q5w==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@noble/hashes" "1.0.0"
-    "@noble/secp256k1" "1.5.5"
-    "@polkadot/networks" "9.4.1"
-    "@polkadot/util" "9.4.1"
-    "@polkadot/wasm-crypto" "^6.1.1"
-    "@polkadot/x-bigint" "9.4.1"
-    "@polkadot/x-randomvalues" "9.4.1"
-    "@scure/base" "1.0.0"
+    "@babel/runtime" "^7.18.6"
+    "@noble/hashes" "1.1.2"
+    "@noble/secp256k1" "1.6.0"
+    "@polkadot/networks" "10.0.2"
+    "@polkadot/util" "10.0.2"
+    "@polkadot/wasm-crypto" "^6.2.3"
+    "@polkadot/x-bigint" "10.0.2"
+    "@polkadot/x-randomvalues" "10.0.2"
+    "@scure/base" "1.1.1"
     ed2curve "^0.3.0"
     tweetnacl "^1.0.3"
 
-"@polkadot/util@9.4.1", "@polkadot/util@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-9.4.1.tgz#49446e88b1231b0716bf6b4eb4818145f08a1294"
-  integrity sha512-z0HcnIe3zMWyK1s09wQIwc1M8gDKygSF9tDAbC8H9KDeIRZB2ldhwWEFx/1DJGOgFFrmRfkxeC6dcDpfzQhFow==
+"@polkadot/util@10.0.2", "@polkadot/util@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.0.2.tgz#0ef2b7f5c4e884147c2fd58c4d55f2ee0c437a9a"
+  integrity sha512-jE1b6Zzltsb/GJV5sFmTSQOlYLd3fipY+DeLS9J+BbsWZW6uUc5x+FNm4pLrYxF1IqiZxwBv1Vi89L14uWZ1rw==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-bigint" "9.4.1"
-    "@polkadot/x-global" "9.4.1"
-    "@polkadot/x-textdecoder" "9.4.1"
-    "@polkadot/x-textencoder" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-bigint" "10.0.2"
+    "@polkadot/x-global" "10.0.2"
+    "@polkadot/x-textdecoder" "10.0.2"
+    "@polkadot/x-textencoder" "10.0.2"
     "@types/bn.js" "^5.1.0"
     bn.js "^5.2.1"
-    ip-regex "^4.3.0"
 
-"@polkadot/wasm-bridge@6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-6.1.1.tgz#9342f2b3c139df72fa45c8491b348f8ebbfa57fa"
-  integrity sha512-Cy0k00VCu+HWxie+nn9GWPlSPdiZl8Id8ulSGA2FKET0jIbffmOo4e1E2FXNucfR1UPEpqov5BCF9T5YxEXZDg==
+"@polkadot/wasm-bridge@6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-6.2.3.tgz#44430710b6f0e7393a69b15decc9123ef5f7ff45"
+  integrity sha512-kDPcUF5uCZJeJUlWtjk6u4KRy+RTObZbIMgZKiuCcQn9n3EYWadONvStfIyKaiFCc3VFVivzH1cUwTFxxTNHHQ==
   dependencies:
-    "@babel/runtime" "^7.17.9"
+    "@babel/runtime" "^7.18.6"
 
-"@polkadot/wasm-crypto-asmjs@6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.1.1.tgz#6d09045679120b43fbfa435b29c3690d1f788ebb"
-  integrity sha512-gG4FStVumkyRNH7WcTB+hn3EEwCssJhQyi4B1BOUt+eYYmw9xJdzIhqjzSd9b/yF2e5sRaAzfnMj2srGufsE6A==
+"@polkadot/wasm-crypto-asmjs@6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.2.3.tgz#f2e3076bb6013431045d48a56b5ae107cb210e20"
+  integrity sha512-d/eH02d/XB/vIGIQwyoFB4zNRb3h5PlWoXolGeVSuoa8476ouEdaWhy64mFwXBmjfluaeCOFXRs+QbxetwrDZg==
   dependencies:
-    "@babel/runtime" "^7.17.9"
+    "@babel/runtime" "^7.18.6"
 
-"@polkadot/wasm-crypto-init@6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.1.1.tgz#73731071bea9b4e22b380d75099da9dc683fadf5"
-  integrity sha512-rbBm/9FOOUjISL4gGNokjcKy2X+Af6Chaet4zlabatpImtPIAK26B2UUBGoaRUnvl/w6K3+GwBL4LuBC+CvzFw==
+"@polkadot/wasm-crypto-init@6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.2.3.tgz#0cf3b59e6492cc63bb8dfb0e238fc599697af5a7"
+  integrity sha512-jDFD4ITWbvFgsGiRI61lrzI/eobG8VrI9nVCiDBqQZK7mNnGkyIdnFD1prW36uiv6/tkqSiGGvdb7dEKtmsB+Q==
   dependencies:
-    "@babel/runtime" "^7.17.9"
-    "@polkadot/wasm-bridge" "6.1.1"
-    "@polkadot/wasm-crypto-asmjs" "6.1.1"
-    "@polkadot/wasm-crypto-wasm" "6.1.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/wasm-bridge" "6.2.3"
+    "@polkadot/wasm-crypto-asmjs" "6.2.3"
+    "@polkadot/wasm-crypto-wasm" "6.2.3"
 
-"@polkadot/wasm-crypto-wasm@6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.1.1.tgz#3fdc8f1280710e4d68112544b2473e811c389a2a"
-  integrity sha512-zkz5Ct4KfTBT+YNEA5qbsHhTV58/FAxDave8wYIOaW4TrBnFPPs+J0WBWlGFertgIhPkvjFnQC/xzRyhet9prg==
+"@polkadot/wasm-crypto-wasm@6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.2.3.tgz#3b47346779881c714e1130374b2f325db9c4fdbf"
+  integrity sha512-bYRhYPcR4MBLAZz8liozr8E11r7j6RLkNHu80z65lZ5AWgjDu2MgYfKxZFWZxg8rB6+V1uYFmb7czUiSWOn4Rg==
   dependencies:
-    "@babel/runtime" "^7.17.9"
-    "@polkadot/wasm-util" "6.1.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/wasm-util" "6.2.3"
 
-"@polkadot/wasm-crypto@^6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-6.1.1.tgz#8e2c2d64d24eeaa78eb0b74ea1c438b7bc704176"
-  integrity sha512-hv9RCbMYtgjCy7+FKZFnO2Afu/whax9sk6udnZqGRBRiwaNagtyliWZGrKNGvaXMIO0VyaY4jWUwSzUgPrLu1A==
+"@polkadot/wasm-crypto@^6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-6.2.3.tgz#1b52c834a1f609d6820035d61cdfda962990ec57"
+  integrity sha512-Jq08uX16YYySanwN/37n/ZzOFv8T2H4NzLaQNjSGNbFdmKzkrlpw369XRNIVhrKGtK4v09O5ZaF5P9qc0EHgsg==
   dependencies:
-    "@babel/runtime" "^7.17.9"
-    "@polkadot/wasm-bridge" "6.1.1"
-    "@polkadot/wasm-crypto-asmjs" "6.1.1"
-    "@polkadot/wasm-crypto-init" "6.1.1"
-    "@polkadot/wasm-crypto-wasm" "6.1.1"
-    "@polkadot/wasm-util" "6.1.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/wasm-bridge" "6.2.3"
+    "@polkadot/wasm-crypto-asmjs" "6.2.3"
+    "@polkadot/wasm-crypto-init" "6.2.3"
+    "@polkadot/wasm-crypto-wasm" "6.2.3"
+    "@polkadot/wasm-util" "6.2.3"
 
-"@polkadot/wasm-util@6.1.1":
-  version "6.1.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-6.1.1.tgz#58a566aba68f90d2a701c78ad49a1a9521b17f5b"
-  integrity sha512-DgpLoFXMT53UKcfZ8eT2GkJlJAOh89AWO+TP6a6qeZQpvXVe5f1yR45WQpkZlgZyUP+/19+kY56GK0pQxfslqg==
+"@polkadot/wasm-util@6.2.3":
+  version "6.2.3"
+  resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-6.2.3.tgz#ffccbda4023810ac0e19327830c9bc0d4a5023bc"
+  integrity sha512-8BQ9gVSrjdc0MPWN9qtNWlMiK+J8dICu1gZJ+cy/hqKjer2MzwX4SeW2wyL5MkYYHjih3ajMRSoSA+/eY2iEwg==
   dependencies:
-    "@babel/runtime" "^7.17.9"
+    "@babel/runtime" "^7.18.6"
 
-"@polkadot/x-bigint@9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-9.4.1.tgz#0a7c6b5743a6fb81ab6a1c3a48a584e774c37910"
-  integrity sha512-KlbXboegENoyrpjj+eXfY13vsqrXgk4620zCAUhKNH622ogdvAepHbY/DpV6w0FLEC6MwN9zd5cRuDBEXVeWiw==
+"@polkadot/x-bigint@10.0.2", "@polkadot/x-bigint@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.0.2.tgz#8b69e1adf59444a6fb4397f9869ec1a9a0de1b1a"
+  integrity sha512-LtfPi+AyZDNe8jQGVmyDfxGyQDdM6ISZEwJD1ieGd4eUbOkfPmn+1t+0rjtxjISZcyP40fSFcLxtL191jDV8Bw==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
 
-"@polkadot/x-fetch@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-9.4.1.tgz#92802d3880db826a90bf1be90174a9fc73fc044a"
-  integrity sha512-CZFPZKgy09TOF5pOFRVVhGrAaAPdSMyrUSKwdO2I8DzdIE1tmjnol50dlnZja5t8zTD0n1uIY1H4CEWwc5NF/g==
+"@polkadot/x-fetch@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.0.2.tgz#d9e2f2115a3c684fdaa8b9496540f0f421ee3719"
+  integrity sha512-vsizrcBNeRWWJhE4ZoCUJ0c68wvy3PiR9jH//B1PTV6OaqpdalpwXG6Xtpli8yc0hOOUH/87u8b/x2f/2vhZcQ==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
-    "@types/node-fetch" "^2.6.1"
-    node-fetch "^2.6.7"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
+    "@types/node-fetch" "^2.6.2"
+    node-fetch "^3.2.6"
 
-"@polkadot/x-global@9.4.1", "@polkadot/x-global@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-9.4.1.tgz#3bd44862ea2b7e0fb2de766dfa4d56bb46d19e17"
-  integrity sha512-eN4oZeRdIKQeUPNN7OtH5XeYp349d8V9+gW6W0BmCfB2lTg8TDlG1Nj+Cyxpjl9DNF5CiKudTq72zr0dDSRbwA==
+"@polkadot/x-global@10.0.2", "@polkadot/x-global@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.0.2.tgz#c60b279a34f8a589d076a03978331e9e6a26d283"
+  integrity sha512-IlxSH36RjcQTImufaJCtvommMmkNWbwOy+/Z7FEOKUOcoiPaUhHU3CzWser+EtClckx7qPLY5lZ59Pxf7HWupQ==
   dependencies:
-    "@babel/runtime" "^7.18.3"
+    "@babel/runtime" "^7.18.6"
 
-"@polkadot/x-randomvalues@9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-9.4.1.tgz#ab995b3a22aee6bffc18490e636e1a7409f36a15"
-  integrity sha512-TLOQw3JNPgCrcq9WO2ipdeG8scsSreu3m9hwj3n7nX/QKlVzSf4G5bxJo5TW1dwcUdHwBuVox+3zgCmo+NPh+Q==
+"@polkadot/x-randomvalues@10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-10.0.2.tgz#b51d58d235e4fae5201f4ef633ee71d8bf23c125"
+  integrity sha512-kYbNeeOaDEnNqVhIgh8ds9YC79Tji5/HDqQymx7Xb3YmTagdOAe2klrTRJzVfsUKljzhlVOuF3Zcf/PRNbt/2w==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
 
-"@polkadot/x-textdecoder@9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-9.4.1.tgz#1d891b82f4192d92dd373d14ea4b5654d0130484"
-  integrity sha512-yLulcgVASFUBJqrvS6Ssy0ko9teAfbu1ajH0r3Jjnqkpmmz2DJ1CS7tAktVa7THd4GHPGeKAVfxl+BbV/LZl+w==
+"@polkadot/x-textdecoder@10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.0.2.tgz#082ee7d5c2e71985e584a858c7b6069dd59475bd"
+  integrity sha512-EI1+Osrfadtm4XFfdcjYgV/1yYoPoFaIJfZiPphPSy/4Ceeblmz9T2hWPdJ3uWtPpk6FkhxudB44Y1JuCwXBjg==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
 
-"@polkadot/x-textencoder@9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-9.4.1.tgz#09c47727d7713884cf82fd773e478487fe39d479"
-  integrity sha512-/47wa31jBa43ULqMO60vzcJigTG+ZAGNcyT5r6hFLrQzRzc8nIBjIOD8YWtnKM92r9NvlNv2wJhdamqyU0mntg==
+"@polkadot/x-textencoder@10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.0.2.tgz#f3e632ca6d852d3284e6aeef3806bf4450490bf0"
+  integrity sha512-iTLC700ExtRFsP+fE+dA5CO0xjQ46XeQqbJxa7wJK3aKrzpogyTLZXc0O5ISE1xltOmsQSA9QOELMP113kZkvA==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
 
-"@polkadot/x-ws@^9.4.1":
-  version "9.4.1"
-  resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-9.4.1.tgz#c48f2ef3e80532f4b366b57b6661429b46a16155"
-  integrity sha512-zQjVxXgHsBVn27u4bjY01cFO6XWxgv2b3MMOpNHTKTAs8SLEmFf0LcT7fBShimyyudyTeJld5pHApJ4qp1OXxA==
+"@polkadot/x-ws@^10.0.2":
+  version "10.0.2"
+  resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.0.2.tgz#505f33911e301fb1aa07cf0807de738ef52414a5"
+  integrity sha512-eH8WJ6jKobfUGLRAGj65wKUB2pwbT7RflebQbbcG8Khx9INRjuwLGc+jAiuf0StOZiqVVJsMUayVgsddO8hIvQ==
   dependencies:
-    "@babel/runtime" "^7.18.3"
-    "@polkadot/x-global" "9.4.1"
+    "@babel/runtime" "^7.18.6"
+    "@polkadot/x-global" "10.0.2"
     "@types/websocket" "^1.0.5"
     websocket "^1.0.34"
 
-"@scure/base@1.0.0":
-  version "1.0.0"
-  resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.0.0.tgz#109fb595021de285f05a7db6806f2f48296fcee7"
-  integrity sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA==
+"@scure/base@1.1.1":
+  version "1.1.1"
+  resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938"
+  integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==
 
 "@sindresorhus/is@^0.14.0":
   version "0.14.0"
@@ -892,28 +898,28 @@
   resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.0.tgz#d452beda84b3ebfcf0e88592a4695e729a91e858"
   integrity sha512-nFVuKdp71hMd/MGlllAOh+a2hAqt8m6J2G0aSsS/RcALZexxF9jodbFc62ni8RDtJboeOfXAHhenYOANvJKPIg==
 
-"@substrate/connect@0.7.5":
-  version "0.7.5"
-  resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.5.tgz#8d868ed905df25c87ff9bad9fa8db6d4137012c9"
-  integrity sha512-sdAZ6IGuTNxRGlH/O+6IaXvkYzZFwMK03VbQMgxUzry9dz1+JzyaNf8iOTVHxhMIUZc0h0E90JQz/hNiUYPlUw==
+"@substrate/connect@0.7.7":
+  version "0.7.7"
+  resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.7.tgz#6d162fcec2f5cfb78c137a82dbb35692655fbe2c"
+  integrity sha512-uFRF06lC42ZZixxwkzRB61K1uYvR1cTZ7rI98RW7T+eWbCFrafyVk0pk6J+4oN05gZkhou+VK3hrRCU6Doy2xQ==
   dependencies:
     "@substrate/connect-extension-protocol" "^1.0.0"
-    "@substrate/smoldot-light" "0.6.16"
+    "@substrate/smoldot-light" "0.6.19"
     eventemitter3 "^4.0.7"
 
-"@substrate/smoldot-light@0.6.16":
-  version "0.6.16"
-  resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.16.tgz#04ec70cf1df285431309fe5704d3b2dd701faa0b"
-  integrity sha512-Ej0ZdNPTW0EXbp45gv/5Kt/JV+c9cmRZRYAXg+EALxXPm0hW9h2QdVLm61A2PAskOGptW4wnJ1WzzruaenwAXQ==
+"@substrate/smoldot-light@0.6.19":
+  version "0.6.19"
+  resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.19.tgz#13e897ca9839aecb0dac4ce079ff1cca1dc54cc0"
+  integrity sha512-Xi+v1cdURhTwx7NH+9fa1U9m7VGP61GvB6qwev9HrZXlGbQiUIvySxPlH/LMsq3mwgiRYkokPhcaZEHufY7Urg==
   dependencies:
     buffer "^6.0.1"
     pako "^2.0.4"
     websocket "^1.0.32"
 
-"@substrate/ss58-registry@^1.22.0":
-  version "1.22.0"
-  resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.22.0.tgz#d115bc5dcab8c0f5800e05e4ef265949042b13ec"
-  integrity sha512-IKqrPY0B3AeIXEc5/JGgEhPZLy+SmVyQf+k0SIGcNSTqt1GLI3gQFEOFwSScJdem+iYZQUrn6YPPxC3TpdSC3A==
+"@substrate/ss58-registry@^1.23.0":
+  version "1.23.0"
+  resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.23.0.tgz#6212bf871a882da98799f8dc51de0944d4152b88"
+  integrity sha512-LuQje7n48GXSsp1aGI6UEmNVtlh7OzQ6CN1Hd9VGUrshADwMB0lRZ5bxnffmqDR4vVugI7h0NN0AONhIW1eHGg==
 
 "@szmarczak/http-timer@^1.1.2":
   version "1.1.2"
@@ -1010,10 +1016,10 @@
   resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4"
   integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==
 
-"@types/node-fetch@^2.6.1":
-  version "2.6.1"
-  resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975"
-  integrity sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==
+"@types/node-fetch@^2.6.2":
+  version "2.6.2"
+  resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da"
+  integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==
   dependencies:
     "@types/node" "*"
     form-data "^3.0.0"
@@ -1855,6 +1861,11 @@
   dependencies:
     assert-plus "^1.0.0"
 
+data-uri-to-buffer@^4.0.0:
+  version "4.0.0"
+  resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
+  integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
+
 debug@2.6.9, debug@^2.2.0:
   version "2.6.9"
   resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -2426,6 +2437,14 @@
   dependencies:
     reusify "^1.0.4"
 
+fetch-blob@^3.1.2, fetch-blob@^3.1.4:
+  version "3.2.0"
+  resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
+  integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
+  dependencies:
+    node-domexception "^1.0.0"
+    web-streams-polyfill "^3.0.3"
+
 file-entry-cache@^6.0.1:
   version "6.0.1"
   resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
@@ -2539,6 +2558,13 @@
     combined-stream "^1.0.6"
     mime-types "^2.1.12"
 
+formdata-polyfill@^4.0.10:
+  version "4.0.10"
+  resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
+  integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
+  dependencies:
+    fetch-blob "^3.1.2"
+
 forwarded@0.2.0:
   version "0.2.0"
   resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
@@ -2968,11 +2994,6 @@
     has "^1.0.3"
     side-channel "^1.0.4"
 
-ip-regex@^4.3.0:
-  version "4.3.0"
-  resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5"
-  integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==
-
 ipaddr.js@1.9.1:
   version "1.9.1"
   resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
@@ -3631,10 +3652,10 @@
   resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"
   integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==
 
-nock@^13.2.6:
-  version "13.2.6"
-  resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.6.tgz#35e419cd9d385ffa67e59523d9699e41b29e1a03"
-  integrity sha512-GbyeSwSEP0FYouzETZ0l/XNm5tNcDNcXJKw3LCAb+mx8bZSwg1wEEvdL0FAyg5TkBJYiWSCtw6ag4XfmBy60FA==
+nock@^13.2.8:
+  version "13.2.8"
+  resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.8.tgz#e2043ccaa8e285508274575e090a7fe1e46b90f1"
+  integrity sha512-JT42FrXfQRpfyL4cnbBEJdf4nmBpVP0yoCcSBr+xkT8Q1y3pgtaCKHGAAOIFcEJ3O3t0QbVAmid0S0f2bj3Wpg==
   dependencies:
     debug "^4.1.0"
     json-stringify-safe "^5.0.1"
@@ -3646,12 +3667,19 @@
   resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32"
   integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==
 
-node-fetch@^2.6.7:
-  version "2.6.7"
-  resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
-  integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
+node-domexception@^1.0.0:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
+  integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
+
+node-fetch@^3.2.6:
+  version "3.2.6"
+  resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.2.6.tgz#6d4627181697a9d9674aae0d61548e0d629b31b9"
+  integrity sha512-LAy/HZnLADOVkVPubaxHDft29booGglPFDr2Hw0J1AercRh01UiVFm++KMDnJeH9sHgNB4hsXPii7Sgym/sTbw==
   dependencies:
-    whatwg-url "^5.0.0"
+    data-uri-to-buffer "^4.0.0"
+    fetch-blob "^3.1.4"
+    formdata-polyfill "^4.0.10"
 
 node-gyp-build@^4.2.0, node-gyp-build@^4.3.0:
   version "4.4.0"
@@ -4518,11 +4546,6 @@
     psl "^1.1.28"
     punycode "^2.1.1"
 
-tr46@~0.0.3:
-  version "0.0.3"
-  resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
-  integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
-
 ts-node@^10.8.0:
   version "10.8.1"
   resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.1.tgz#ea2bd3459011b52699d7e88daa55a45a1af4f066"
@@ -4757,6 +4780,11 @@
     core-util-is "1.0.2"
     extsprintf "^1.2.0"
 
+web-streams-polyfill@^3.0.3:
+  version "3.2.1"
+  resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
+  integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
+
 web3-bzz@1.7.3:
   version "1.7.3"
   resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.7.3.tgz#6860a584f748838af5e3932b6798e024ab8ae951"
@@ -4984,11 +5012,6 @@
     web3-net "1.7.3"
     web3-shh "1.7.3"
     web3-utils "1.7.3"
-
-webidl-conversions@^3.0.0:
-  version "3.0.1"
-  resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
-  integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=
 
 websocket@^1.0.32, websocket@^1.0.34:
   version "1.0.34"
@@ -5001,14 +5024,6 @@
     typedarray-to-buffer "^3.1.5"
     utf-8-validate "^5.0.2"
     yaeti "^0.0.6"
-
-whatwg-url@^5.0.0:
-  version "5.0.0"
-  resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
-  integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
-  dependencies:
-    tr46 "~0.0.3"
-    webidl-conversions "^3.0.0"
 
 which-boxed-primitive@^1.0.2:
   version "1.0.2"