difftreelog
test(eth) fix linting errors and warnings
in: master
8 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.3// Unique Network is free software: you can redistribute it and/or modify4// it under the terms of the GNU General Public License as published by5// the Free Software Foundation, either version 3 of the License, or6// (at your option) any later version.7//8// Unique Network is distributed in the hope that it will be useful,9// but WITHOUT ANY WARRANTY; without even the implied warranty of10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11// GNU General Public License for more details.1213// You should have received a copy of the GNU General Public License14// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1516import {expect} from 'chai';17import privateKey from '../substrate/privateKey';18import { UNIQUE } from '../util/helpers';19import {20 createEthAccount,21 createEthAccountWithBalance, 22 evmCollection, 23 evmCollectionHelpers, 24 getCollectionAddressFromResult, 25 itWeb3,26 recordEthFee,27 subToEth,28} from './util/helpers';2930describe('Add collection admins', () => {31 itWeb3('Add admin by owner', async ({api, web3, privateKeyWrapper}) => {32 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);33 const collectionHelper = evmCollectionHelpers(web3, owner);34 35 const result = await collectionHelper.methods36 .createNonfungibleCollection('A', 'B', 'C')37 .send();38 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);3940 const newAdmin = await createEthAccount(web3);41 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);42 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();43 const adminList = await api.rpc.unique.adminlist(collectionId);44 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())45 .to.be.eq(newAdmin.toLocaleLowerCase());46 });4748 itWeb3('Add substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {49 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);50 const collectionHelper = evmCollectionHelpers(web3, owner);51 52 const result = await collectionHelper.methods53 .createNonfungibleCollection('A', 'B', 'C')54 .send();55 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);5657 const newAdmin = privateKeyWrapper('//Alice');58 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);59 await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();6061 const adminList = await api.rpc.unique.adminlist(collectionId);62 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())63 .to.be.eq(newAdmin.address.toLocaleLowerCase());64 });65 66 itWeb3('Verify owner or admin', async ({api, web3, privateKeyWrapper}) => {67 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);68 const collectionHelper = evmCollectionHelpers(web3, owner);69 70 const result = await collectionHelper.methods71 .createNonfungibleCollection('A', 'B', 'C')72 .send();73 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);7475 const newAdmin = createEthAccount(web3);76 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);77 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;78 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();79 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;80 });8182 itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {83 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);84 const collectionHelper = evmCollectionHelpers(web3, owner);85 86 const result = await collectionHelper.methods87 .createNonfungibleCollection('A', 'B', 'C')88 .send();89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);9091 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);92 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);93 await collectionEvm.methods.addCollectionAdmin(admin).send();94 95 const user = await createEthAccount(web3);96 await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: admin}))97 .to.be.rejectedWith('NoPermission');9899 const adminList = await api.rpc.unique.adminlist(collectionId);100 expect(adminList.length).to.be.eq(1);101 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())102 .to.be.eq(admin.toLocaleLowerCase());103 });104105 itWeb3('(!negative tests!) Add admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {106 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);107 const collectionHelper = evmCollectionHelpers(web3, owner);108 109 const result = await collectionHelper.methods110 .createNonfungibleCollection('A', 'B', 'C')111 .send();112 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);113114 const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);115 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);116 117 const user = await createEthAccount(web3);118 await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: notAdmin}))119 .to.be.rejectedWith('NoPermission');120121 const adminList = await api.rpc.unique.adminlist(collectionId);122 expect(adminList.length).to.be.eq(0);123 });124125 itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {126 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);127 const collectionHelper = evmCollectionHelpers(web3, owner);128 129 const result = await collectionHelper.methods130 .createNonfungibleCollection('A', 'B', 'C')131 .send();132 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);133134 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);135 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);136 await collectionEvm.methods.addCollectionAdmin(admin).send();137138 const notAdmin = privateKey('//Alice');139 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin.addressRaw).call({from: admin}))140 .to.be.rejectedWith('NoPermission');141142 const adminList = await api.rpc.unique.adminlist(collectionId);143 expect(adminList.length).to.be.eq(1);144 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())145 .to.be.eq(admin.toLocaleLowerCase());146 });147 148 itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {149 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);150 const collectionHelper = evmCollectionHelpers(web3, owner);151 152 const result = await collectionHelper.methods153 .createNonfungibleCollection('A', 'B', 'C')154 .send();155 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);156157 const notAdmin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);158 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);159 const notAdmin1 = privateKey('//Alice');160 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))161 .to.be.rejectedWith('NoPermission');162163 const adminList = await api.rpc.unique.adminlist(collectionId);164 expect(adminList.length).to.be.eq(0);165 });166});167168describe('Remove collection admins', () => {169 itWeb3('Remove admin by owner', async ({api, web3, privateKeyWrapper}) => {170 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);171 const collectionHelper = evmCollectionHelpers(web3, owner);172 173 const result = await collectionHelper.methods174 .createNonfungibleCollection('A', 'B', 'C')175 .send();176 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);177178 const newAdmin = await createEthAccount(web3);179 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);180 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();181 {182 const adminList = await api.rpc.unique.adminlist(collectionId);183 expect(adminList.length).to.be.eq(1);184 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())185 .to.be.eq(newAdmin.toLocaleLowerCase());186 }187188 await collectionEvm.methods.removeCollectionAdmin(newAdmin).send();189 const adminList = await api.rpc.unique.adminlist(collectionId);190 expect(adminList.length).to.be.eq(0);191 });192193 itWeb3('Remove substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {194 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);195 const collectionHelper = evmCollectionHelpers(web3, owner);196 197 const result = await collectionHelper.methods198 .createNonfungibleCollection('A', 'B', 'C')199 .send();200 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);201202 const newAdmin = privateKeyWrapper('//Alice');203 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);204 await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();205 {206 const adminList = await api.rpc.unique.adminlist(collectionId);207 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())208 .to.be.eq(newAdmin.address.toLocaleLowerCase());209 }210 211 await collectionEvm.methods.removeCollectionAdminSubstrate(newAdmin.addressRaw).send();212 const adminList = await api.rpc.unique.adminlist(collectionId);213 expect(adminList.length).to.be.eq(0);214 });215216 itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {217 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);218 const collectionHelper = evmCollectionHelpers(web3, owner);219 220 const result = await collectionHelper.methods221 .createNonfungibleCollection('A', 'B', 'C')222 .send();223 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);224225 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);226227 const admin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);228 await collectionEvm.methods.addCollectionAdmin(admin0).send();229 const admin1 = await createEthAccount(web3);230 await collectionEvm.methods.addCollectionAdmin(admin1).send();231232 await expect(collectionEvm.methods.removeCollectionAdmin(admin1).call({from: admin0}))233 .to.be.rejectedWith('NoPermission');234 {235 const adminList = await api.rpc.unique.adminlist(collectionId);236 expect(adminList.length).to.be.eq(2);237 expect(adminList.toString().toLocaleLowerCase())238 .to.be.deep.contains(admin0.toLocaleLowerCase())239 .to.be.deep.contains(admin1.toLocaleLowerCase());240 }241 });242243 itWeb3('(!negative tests!) Remove admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {244 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);245 const collectionHelper = evmCollectionHelpers(web3, owner);246 247 const result = await collectionHelper.methods248 .createNonfungibleCollection('A', 'B', 'C')249 .send();250 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);251252 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);253254 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);255 await collectionEvm.methods.addCollectionAdmin(admin).send();256 const notAdmin = await createEthAccount(web3);257258 await expect(collectionEvm.methods.removeCollectionAdmin(admin).call({from: notAdmin}))259 .to.be.rejectedWith('NoPermission');260 {261 const adminList = await api.rpc.unique.adminlist(collectionId);262 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())263 .to.be.eq(admin.toLocaleLowerCase());264 expect(adminList.length).to.be.eq(1);265 }266 });267268 itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {269 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);270 const collectionHelper = evmCollectionHelpers(web3, owner);271 272 const result = await collectionHelper.methods273 .createNonfungibleCollection('A', 'B', 'C')274 .send();275 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);276277 const adminSub = privateKeyWrapper('//Alice');278 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);279 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();280 const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);281 await collectionEvm.methods.addCollectionAdmin(adminEth).send();282283 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))284 .to.be.rejectedWith('NoPermission');285286 const adminList = await api.rpc.unique.adminlist(collectionId);287 expect(adminList.length).to.be.eq(2);288 expect(adminList.toString().toLocaleLowerCase())289 .to.be.deep.contains(adminSub.address.toLocaleLowerCase())290 .to.be.deep.contains(adminEth.toLocaleLowerCase());291 });292293 itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {294 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);295 const collectionHelper = evmCollectionHelpers(web3, owner);296 297 const result = await collectionHelper.methods298 .createNonfungibleCollection('A', 'B', 'C')299 .send();300 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);301302 const adminSub = privateKeyWrapper('//Alice');303 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);304 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();305 const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);306307 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))308 .to.be.rejectedWith('NoPermission');309310 const adminList = await api.rpc.unique.adminlist(collectionId);311 expect(adminList.length).to.be.eq(1);312 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())313 .to.be.eq(adminSub.address.toLocaleLowerCase());314 });315});316317describe('Change owner tests', () => {318 itWeb3('Change owner', async ({api, web3, privateKeyWrapper}) => {319 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);320 const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);321 const collectionHelper = evmCollectionHelpers(web3, owner);322 const result = await collectionHelper.methods323 .createNonfungibleCollection('A', 'B', 'C')324 .send();325 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);326 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);327 328 await collectionEvm.methods.setOwner(newOwner).send();329 330 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;331 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.true;332 });333334 itWeb3('change owner call fee', async ({web3, api, privateKeyWrapper}) => {335 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);336 const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);337 const collectionHelper = evmCollectionHelpers(web3, owner);338 const result = await collectionHelper.methods339 .createNonfungibleCollection('A', 'B', 'C')340 .send();341 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);342 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);343344 const cost = await recordEthFee(api, owner, () => collectionEvm.methods.setOwner(newOwner).send());345 expect(cost < BigInt(0.2 * Number(UNIQUE)));346 expect(cost > 0);347 });348349 itWeb3('(!negative tests!) call setOwner by non owner', async ({api, web3, privateKeyWrapper}) => {350 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);351 const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);352 const collectionHelper = evmCollectionHelpers(web3, owner);353 const result = await collectionHelper.methods354 .createNonfungibleCollection('A', 'B', 'C')355 .send();356 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);357 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);358 359 await expect(collectionEvm.methods.setOwner(newOwner).send({from: newOwner})).to.be.rejected;360 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;361 });362});363364describe('Change substrate owner tests', () => {365 itWeb3('Change owner', async ({api, web3, privateKeyWrapper}) => {366 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);367 const newOwner = privateKeyWrapper('//Alice');368 const collectionHelper = evmCollectionHelpers(web3, owner);369 const result = await collectionHelper.methods370 .createNonfungibleCollection('A', 'B', 'C')371 .send();372 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);373 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);374 375 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;376 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;377 378 await collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send();379 380 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;381 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.true;382 });383384 itWeb3('change owner call fee', async ({web3, api, privateKeyWrapper}) => {385 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);386 const newOwner = privateKeyWrapper('//Alice');387 const collectionHelper = evmCollectionHelpers(web3, owner);388 const result = await collectionHelper.methods389 .createNonfungibleCollection('A', 'B', 'C')390 .send();391 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);392 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);393394 const cost = await recordEthFee(api, owner, () => collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send());395 expect(cost < BigInt(0.2 * Number(UNIQUE)));396 expect(cost > 0);397 });398399 itWeb3('(!negative tests!) call setOwner by non owner', async ({api, web3, privateKeyWrapper}) => {400 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);401 const otherReceiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);402 const newOwner = privateKeyWrapper('//Alice');403 const collectionHelper = evmCollectionHelpers(web3, owner);404 const result = await collectionHelper.methods405 .createNonfungibleCollection('A', 'B', 'C')406 .send();407 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);408 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);409 410 await expect(collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send({from: otherReceiver})).to.be.rejected;411 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;412 });413});tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -1,5 +1,5 @@
import {addToAllowListExpectSuccess, bigIntToSub, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess} from '../util/helpers';
-import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub, subToEth} from './util/helpers';
+import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub} from './util/helpers';
import nonFungibleAbi from './nonFungibleAbi.json';
import {expect} from 'chai';
import {evmToAddress} from '@polkadot/util-crypto';
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -181,7 +181,7 @@
});
itWeb3('(!negative test!) Create collection (no funds)', async ({web3}) => {
- const owner = await createEthAccount(web3);
+ const owner = createEthAccount(web3);
const helper = evmCollectionHelpers(web3, owner);
const collectionName = 'A';
const description = 'A';
@@ -194,7 +194,7 @@
itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const notOwner = await createEthAccount(web3);
+ const notOwner = createEthAccount(web3);
const collectionHelpers = evmCollectionHelpers(web3, owner);
const result = await collectionHelpers.methods.createNonfungibleCollection('A', 'A', 'A').send();
const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -189,7 +189,7 @@
});
itWeb3('(!negative test!) Create collection (no funds)', async ({web3}) => {
- const owner = await createEthAccount(web3);
+ const owner = createEthAccount(web3);
const helper = evmCollectionHelpers(web3, owner);
const collectionName = 'A';
const description = 'A';
@@ -202,7 +202,7 @@
itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const notOwner = await createEthAccount(web3);
+ const notOwner = createEthAccount(web3);
const collectionHelpers = evmCollectionHelpers(web3, owner);
const result = await collectionHelpers.methods.createRefungibleCollection('A', 'A', 'A').send();
const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
tests/src/eth/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/eth/nesting/nest.test.ts
+++ b/tests/src/eth/nesting/nest.test.ts
@@ -1,7 +1,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {Contract} from 'web3-eth-contract';
-import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util/playgrounds'
+import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util/playgrounds';
const createNestingCollection = async (
helper: EthUniqueHelper,
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';
-import {collectionIdFromAddress, collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
+import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createRefungibleCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
tests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/index.ts
+++ b/tests/src/eth/util/playgrounds/index.ts
@@ -33,7 +33,7 @@
await helper.disconnectWeb3();
silentConsole.disable();
}
-}
+};
export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {
let i: any = it;
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -38,18 +38,18 @@
class ContractGroup extends EthGroupBase {
async findImports(imports?: ContractImports[]){
if(!imports) return function(path: string) {
- return {error: 'File not found'};
+ return {error: `File not found: ${path}`};
};
const knownImports = {} as any;
- for(let imp of imports) {
+ for(const imp of imports) {
knownImports[imp.solPath] = (await readFile(imp.fsPath)).toString();
}
return function(path: string) {
- if(knownImports.hasOwnProperty(path)) return {contents: knownImports[path]};
- return {error: 'File not found'};
- }
+ if(knownImports.hasOwnPropertyDescriptor(path)) return {contents: knownImports[path]};
+ return {error: `File not found: ${path}`};
+ };
}
async compile(name: string, src: string, imports?: ContractImports[]): Promise<CompiledContract> {
@@ -85,7 +85,7 @@
const contract = new web3.eth.Contract(abi, undefined, {
data: object,
from: signer,
- gas: this.helper.eth.DEFAULT_GAS
+ gas: this.helper.eth.DEFAULT_GAS,
});
return await contract.deploy({data: object}).send({from: signer});
}
@@ -108,7 +108,7 @@
const abi = {
'nft': nonFungibleAbi,
'rft': refungibleAbi,
- 'ft': fungibleAbi
+ 'ft': fungibleAbi,
}[mode];
const web3 = this.helper.getWeb3();
return new web3.eth.Contract(abi as any, address, {gas: this.helper.eth.DEFAULT_GAS, ...(caller ? {from: caller} : {})});
@@ -154,7 +154,7 @@
await this.helper.executeExtrinsic(
signer,
'api.tx.evm.call', [this.helper.address.substrateToEth(signer.address), contractAddress, abi, value, gasLimit, gasPrice, null, null, []],
- true, `Unable to perform evm.call`
+ true, 'Unable to perform evm.call',
);
}