difftreelog
fix await require pallets
in: master
9 files changed
tests/src/app-promotion.test.tsdiffbeforeafterboth--- a/tests/src/app-promotion.test.ts
+++ b/tests/src/app-promotion.test.ts
@@ -36,7 +36,7 @@
describe('App promotion', () => {
before(async function () {
await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.AppPromotion]);
+ await requirePalletsOrSkip(this, helper, [Pallets.AppPromotion]);
alice = privateKey('//Alice');
palletAdmin = privateKey('//Charlie'); // TODO use custom address
const api = helper.getApi();
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -25,7 +25,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
});
@@ -152,7 +152,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
nominal = helper.balance.getOneTokenNominal();
});
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -84,7 +84,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
});
@@ -224,7 +224,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
});
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -23,7 +23,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
@@ -115,7 +115,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
@@ -327,7 +327,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
@@ -368,7 +368,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([20n], donor);
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -26,7 +26,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([20n], donor);
@@ -70,7 +70,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
@@ -134,7 +134,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([50n], donor);
@@ -325,7 +325,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([50n], donor);
@@ -380,7 +380,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([50n], donor);
@@ -470,7 +470,7 @@
before(async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
donor = privateKey('//Alice');
});
tests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {IKeyringPair} from '@polkadot/types/types';56import config from '../../../config';78import {EthUniqueHelper} from './unique.dev';9import {SilentLogger, SilentConsole} from '../../../util/playgrounds/unique.dev';1011export {EthUniqueHelper} from './unique.dev';1213import chai from 'chai';14import chaiAsPromised from 'chai-as-promised';15import chaiLike from 'chai-like';16import {requirePalletsOrSkip} from '../../../util/playgrounds';17chai.use(chaiAsPromised);18chai.use(chaiLike);19export const expect = chai.expect;2021export enum SponsoringMode {22 Disabled = 0,23 Allowlisted = 1,24 Generous = 2,25}2627export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {28 const silentConsole = new SilentConsole();29 silentConsole.enable();3031 const helper = new EthUniqueHelper(new SilentLogger());3233 try {34 await helper.connect(config.substrateUrl);35 await helper.connectWeb3(config.substrateUrl);36 const ss58Format = helper.chain.getChainProperties().ss58Format;37 const privateKey = (seed: string) => helper.util.fromSeed(seed, ss58Format);38 await code(helper, privateKey);39 }40 finally {41 await helper.disconnect();42 silentConsole.disable();43 }44};45 46export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {47 (opts.only ? it.only : 48 opts.skip ? it.skip : it)(name, async function() {49 await usingEthPlaygrounds(async (helper, privateKey) => {50 if (opts.requiredPallets) {51 requirePalletsOrSkip(this, helper, opts.requiredPallets);52 }5354 await cb({helper, privateKey});55 });56 });57}5859export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {60 return itEth(name, cb, {requiredPallets: required, ...opts});61}6263itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {only: true});64itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {skip: true});6566itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {only: true});67itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});68itEth.ifWithPallets = itEthIfWithPallet;1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {IKeyringPair} from '@polkadot/types/types';56import config from '../../../config';78import {EthUniqueHelper} from './unique.dev';9import {SilentLogger, SilentConsole} from '../../../util/playgrounds/unique.dev';1011export {EthUniqueHelper} from './unique.dev';1213import chai from 'chai';14import chaiAsPromised from 'chai-as-promised';15import chaiLike from 'chai-like';16import {requirePalletsOrSkip} from '../../../util/playgrounds';17chai.use(chaiAsPromised);18chai.use(chaiLike);19export const expect = chai.expect;2021export enum SponsoringMode {22 Disabled = 0,23 Allowlisted = 1,24 Generous = 2,25}2627export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {28 const silentConsole = new SilentConsole();29 silentConsole.enable();3031 const helper = new EthUniqueHelper(new SilentLogger());3233 try {34 await helper.connect(config.substrateUrl);35 await helper.connectWeb3(config.substrateUrl);36 const ss58Format = helper.chain.getChainProperties().ss58Format;37 const privateKey = (seed: string) => helper.util.fromSeed(seed, ss58Format);38 await code(helper, privateKey);39 }40 finally {41 await helper.disconnect();42 silentConsole.disable();43 }44};45 46export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {47 (opts.only ? it.only : 48 opts.skip ? it.skip : it)(name, async function() {49 await usingEthPlaygrounds(async (helper, privateKey) => {50 if (opts.requiredPallets) {51 await requirePalletsOrSkip(this, helper, opts.requiredPallets);52 }5354 await cb({helper, privateKey});55 });56 });57}5859export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {60 return itEth(name, cb, {requiredPallets: required, ...opts});61}6263itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {only: true});64itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {skip: true});6566itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {only: true});67itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});68itEth.ifWithPallets = itEthIfWithPallet;tests/src/limits.test.tsdiffbeforeafterboth--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -58,7 +58,7 @@
before(async function() {
await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
const donor = privateKey('//Alice');
[alice] = await helper.arrange.createAccounts([10n], donor);
@@ -364,7 +364,7 @@
before(async function() {
await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
const donor = privateKey('//Alice');
[alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
tests/src/nesting/properties.test.tsdiffbeforeafterboth--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -975,7 +975,7 @@
before(async function() {
await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
const donor = privateKey('//Alice');
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
tests/src/refungible.test.tsdiffbeforeafterboth--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -25,7 +25,7 @@
before(async function() {
await usingPlaygrounds(async (helper, privateKey) => {
- requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
+ await requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
const donor = privateKey('//Alice');
[alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);