difftreelog
test(eth) fix linting errors and warnings
in: master
8 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -15,7 +15,7 @@
import {expect} from 'chai';
import privateKey from '../substrate/privateKey';
-import { UNIQUE } from '../util/helpers';
+import {UNIQUE} from '../util/helpers';
import {
createEthAccount,
createEthAccountWithBalance,
@@ -24,7 +24,6 @@
getCollectionAddressFromResult,
itWeb3,
recordEthFee,
- subToEth,
} from './util/helpers';
describe('Add collection admins', () => {
@@ -37,7 +36,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const newAdmin = await createEthAccount(web3);
+ const newAdmin = createEthAccount(web3);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
const adminList = await api.rpc.unique.adminlist(collectionId);
@@ -92,7 +91,7 @@
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(admin).send();
- const user = await createEthAccount(web3);
+ const user = createEthAccount(web3);
await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: admin}))
.to.be.rejectedWith('NoPermission');
@@ -114,7 +113,7 @@
const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
- const user = await createEthAccount(web3);
+ const user = createEthAccount(web3);
await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: notAdmin}))
.to.be.rejectedWith('NoPermission');
@@ -175,7 +174,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const newAdmin = await createEthAccount(web3);
+ const newAdmin = createEthAccount(web3);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
{
@@ -226,7 +225,7 @@
const admin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin0).send();
- const admin1 = await createEthAccount(web3);
+ const admin1 = createEthAccount(web3);
await collectionEvm.methods.addCollectionAdmin(admin1).send();
await expect(collectionEvm.methods.removeCollectionAdmin(admin1).call({from: admin0}))
@@ -253,7 +252,7 @@
const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin).send();
- const notAdmin = await createEthAccount(web3);
+ const notAdmin = createEthAccount(web3);
await expect(collectionEvm.methods.removeCollectionAdmin(admin).call({from: notAdmin}))
.to.be.rejectedWith('NoPermission');
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.tsdiffbeforeafterboth1import {IKeyringPair} from '@polkadot/types/types';2import {Contract} from 'web3-eth-contract';34import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util/playgrounds'56const createNestingCollection = async (7 helper: EthUniqueHelper,8 owner: string,9): Promise<{ collectionId: number, collectionAddress: string, contract: Contract }> => {10 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');1112 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);13 await contract.methods.setCollectionNesting(true).send({from: owner});1415 return {collectionId, collectionAddress, contract};16};171819describe('EVM nesting tests group', () => {20 let donor: IKeyringPair;2122 before(async function() {23 await usingEthPlaygrounds(async (helper, privateKey) => {24 donor = privateKey('//Alice');25 });26 });2728 describe('Integration Test: EVM Nesting', () => {29 itEth('NFT: allows an Owner to nest/unnest their token', async ({helper}) => {30 const owner = await helper.eth.createAccountWithBalance(donor);31 const {collectionId, contract} = await createNestingCollection(helper, owner);32 33 // Create a token to be nested34 const targetNFTTokenId = await contract.methods.nextTokenId().call();35 await contract.methods.mint(36 owner,37 targetNFTTokenId,38 ).send({from: owner});39 40 const targetNftTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetNFTTokenId);41 42 // Create a nested token43 const firstTokenId = await contract.methods.nextTokenId().call();44 await contract.methods.mint(45 targetNftTokenAddress,46 firstTokenId,47 ).send({from: owner});48 49 expect(await contract.methods.ownerOf(firstTokenId).call()).to.be.equal(targetNftTokenAddress);50 51 // Create a token to be nested and nest52 const secondTokenId = await contract.methods.nextTokenId().call();53 await contract.methods.mint(54 owner,55 secondTokenId,56 ).send({from: owner});57 58 await contract.methods.transfer(targetNftTokenAddress, secondTokenId).send({from: owner});59 60 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(targetNftTokenAddress);61 62 // Unnest token back63 await contract.methods.transferFrom(targetNftTokenAddress, owner, secondTokenId).send({from: owner});64 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(owner);65 });66 67 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {68 const owner = await helper.eth.createAccountWithBalance(donor);69 70 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);71 const {collectionAddress: collectionAddressB, contract: contractB} = await createNestingCollection(helper, owner);72 await contractA.methods.setCollectionNesting(true, [collectionAddressA, collectionAddressB]).send({from: owner});73 74 // Create a token to nest into75 const targetNftTokenId = await contractA.methods.nextTokenId().call();76 await contractA.methods.mint(77 owner,78 targetNftTokenId,79 ).send({from: owner});80 const nftTokenAddressA1 = helper.ethAddress.fromTokenId(collectionIdA, targetNftTokenId);81 82 // Create a token for nesting in the same collection as the target83 const nftTokenIdA = await contractA.methods.nextTokenId().call();84 await contractA.methods.mint(85 owner,86 nftTokenIdA,87 ).send({from: owner});88 89 // Create a token for nesting in a different collection90 const nftTokenIdB = await contractB.methods.nextTokenId().call();91 await contractB.methods.mint(92 owner,93 nftTokenIdB,94 ).send({from: owner});95 96 // Nest97 await contractA.methods.transfer(nftTokenAddressA1, nftTokenIdA).send({from: owner});98 expect(await contractA.methods.ownerOf(nftTokenIdA).call()).to.be.equal(nftTokenAddressA1);99 100 await contractB.methods.transfer(nftTokenAddressA1, nftTokenIdB).send({from: owner});101 expect(await contractB.methods.ownerOf(nftTokenIdB).call()).to.be.equal(nftTokenAddressA1);102 });103 });104105 describe('Negative Test: EVM Nesting', async() => {106 itEth('NFT: disallows to nest token if nesting is disabled', async ({helper}) => {107 const owner = await helper.eth.createAccountWithBalance(donor);108 109 const {collectionId, contract} = await createNestingCollection(helper, owner);110 await contract.methods.setCollectionNesting(false).send({from: owner});111 112 // Create a token to nest into113 const targetNftTokenId = await contract.methods.nextTokenId().call();114 await contract.methods.mint(115 owner,116 targetNftTokenId,117 ).send({from: owner});118 119 const targetNftTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetNftTokenId);120 121 // Create a token to nest122 const nftTokenId = await contract.methods.nextTokenId().call();123 await contract.methods.mint(124 owner,125 nftTokenId,126 ).send({from: owner});127 128 // Try to nest129 await expect(contract.methods130 .transfer(targetNftTokenAddress, nftTokenId)131 .call({from: owner})).to.be.rejectedWith('UserIsNotAllowedToNest');132 });133 134 itEth('NFT: disallows a non-Owner to nest someone else\'s token', async ({helper}) => {135 const owner = await helper.eth.createAccountWithBalance(donor);136 const malignant = await helper.eth.createAccountWithBalance(donor);137 138 const {collectionId, contract} = await createNestingCollection(helper, owner);139 140 // Mint a token141 const targetTokenId = await contract.methods.nextTokenId().call();142 await contract.methods.mint(143 owner,144 targetTokenId,145 ).send({from: owner});146 const targetTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetTokenId);147 148 // Mint a token belonging to a different account149 const tokenId = await contract.methods.nextTokenId().call();150 await contract.methods.mint(151 malignant,152 tokenId,153 ).send({from: owner});154 155 // Try to nest one token in another as a non-owner account156 await expect(contract.methods157 .transfer(targetTokenAddress, tokenId)158 .call({from: malignant})).to.be.rejectedWith('UserIsNotAllowedToNest');159 });160 161 itEth('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async ({helper}) => {162 const owner = await helper.eth.createAccountWithBalance(donor);163 const malignant = await helper.eth.createAccountWithBalance(donor);164 165 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);166 const {collectionAddress: collectionAddressB, contract: contractB} = await createNestingCollection(helper, owner);167 168 await contractA.methods.setCollectionNesting(true, [collectionAddressA, collectionAddressB]).send({from: owner});169 170 // Create a token in one collection171 const nftTokenIdA = await contractA.methods.nextTokenId().call();172 await contractA.methods.mint(173 owner,174 nftTokenIdA,175 ).send({from: owner});176 const nftTokenAddressA = helper.ethAddress.fromTokenId(collectionIdA, nftTokenIdA);177 178 // Create a token in another collection belonging to someone else179 const nftTokenIdB = await contractB.methods.nextTokenId().call();180 await contractB.methods.mint(181 malignant,182 nftTokenIdB,183 ).send({from: owner});184 185 // Try to drag someone else's token into the other collection and nest186 await expect(contractB.methods187 .transfer(nftTokenAddressA, nftTokenIdB)188 .call({from: malignant})).to.be.rejectedWith('UserIsNotAllowedToNest');189 });190 191 itEth('NFT: disallows to nest token in an unlisted collection', async ({helper}) => {192 const owner = await helper.eth.createAccountWithBalance(donor);193 194 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);195 const {contract: contractB} = await createNestingCollection(helper, owner);196 197 await contractA.methods.setCollectionNesting(true, [collectionAddressA]).send({from: owner});198 199 // Create a token in one collection200 const nftTokenIdA = await contractA.methods.nextTokenId().call();201 await contractA.methods.mint(202 owner,203 nftTokenIdA,204 ).send({from: owner});205 const nftTokenAddressA = helper.ethAddress.fromTokenId(collectionIdA, nftTokenIdA);206 207 // Create a token in another collection208 const nftTokenIdB = await contractB.methods.nextTokenId().call();209 await contractB.methods.mint(210 owner,211 nftTokenIdB,212 ).send({from: owner});213 214 // Try to nest into a token in the other collection, disallowed in the first215 await expect(contractB.methods216 .transfer(nftTokenAddressA, nftTokenIdB)217 .call()).to.be.rejectedWith('SourceCollectionIsNotAllowedToNest');218 });219 });220});1import {IKeyringPair} from '@polkadot/types/types';2import {Contract} from 'web3-eth-contract';34import {itEth, EthUniqueHelper, usingEthPlaygrounds, expect} from '../util/playgrounds';56const createNestingCollection = async (7 helper: EthUniqueHelper,8 owner: string,9): Promise<{ collectionId: number, collectionAddress: string, contract: Contract }> => {10 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');1112 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);13 await contract.methods.setCollectionNesting(true).send({from: owner});1415 return {collectionId, collectionAddress, contract};16};171819describe('EVM nesting tests group', () => {20 let donor: IKeyringPair;2122 before(async function() {23 await usingEthPlaygrounds(async (helper, privateKey) => {24 donor = privateKey('//Alice');25 });26 });2728 describe('Integration Test: EVM Nesting', () => {29 itEth('NFT: allows an Owner to nest/unnest their token', async ({helper}) => {30 const owner = await helper.eth.createAccountWithBalance(donor);31 const {collectionId, contract} = await createNestingCollection(helper, owner);32 33 // Create a token to be nested34 const targetNFTTokenId = await contract.methods.nextTokenId().call();35 await contract.methods.mint(36 owner,37 targetNFTTokenId,38 ).send({from: owner});39 40 const targetNftTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetNFTTokenId);41 42 // Create a nested token43 const firstTokenId = await contract.methods.nextTokenId().call();44 await contract.methods.mint(45 targetNftTokenAddress,46 firstTokenId,47 ).send({from: owner});48 49 expect(await contract.methods.ownerOf(firstTokenId).call()).to.be.equal(targetNftTokenAddress);50 51 // Create a token to be nested and nest52 const secondTokenId = await contract.methods.nextTokenId().call();53 await contract.methods.mint(54 owner,55 secondTokenId,56 ).send({from: owner});57 58 await contract.methods.transfer(targetNftTokenAddress, secondTokenId).send({from: owner});59 60 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(targetNftTokenAddress);61 62 // Unnest token back63 await contract.methods.transferFrom(targetNftTokenAddress, owner, secondTokenId).send({from: owner});64 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(owner);65 });66 67 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {68 const owner = await helper.eth.createAccountWithBalance(donor);69 70 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);71 const {collectionAddress: collectionAddressB, contract: contractB} = await createNestingCollection(helper, owner);72 await contractA.methods.setCollectionNesting(true, [collectionAddressA, collectionAddressB]).send({from: owner});73 74 // Create a token to nest into75 const targetNftTokenId = await contractA.methods.nextTokenId().call();76 await contractA.methods.mint(77 owner,78 targetNftTokenId,79 ).send({from: owner});80 const nftTokenAddressA1 = helper.ethAddress.fromTokenId(collectionIdA, targetNftTokenId);81 82 // Create a token for nesting in the same collection as the target83 const nftTokenIdA = await contractA.methods.nextTokenId().call();84 await contractA.methods.mint(85 owner,86 nftTokenIdA,87 ).send({from: owner});88 89 // Create a token for nesting in a different collection90 const nftTokenIdB = await contractB.methods.nextTokenId().call();91 await contractB.methods.mint(92 owner,93 nftTokenIdB,94 ).send({from: owner});95 96 // Nest97 await contractA.methods.transfer(nftTokenAddressA1, nftTokenIdA).send({from: owner});98 expect(await contractA.methods.ownerOf(nftTokenIdA).call()).to.be.equal(nftTokenAddressA1);99 100 await contractB.methods.transfer(nftTokenAddressA1, nftTokenIdB).send({from: owner});101 expect(await contractB.methods.ownerOf(nftTokenIdB).call()).to.be.equal(nftTokenAddressA1);102 });103 });104105 describe('Negative Test: EVM Nesting', async() => {106 itEth('NFT: disallows to nest token if nesting is disabled', async ({helper}) => {107 const owner = await helper.eth.createAccountWithBalance(donor);108 109 const {collectionId, contract} = await createNestingCollection(helper, owner);110 await contract.methods.setCollectionNesting(false).send({from: owner});111 112 // Create a token to nest into113 const targetNftTokenId = await contract.methods.nextTokenId().call();114 await contract.methods.mint(115 owner,116 targetNftTokenId,117 ).send({from: owner});118 119 const targetNftTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetNftTokenId);120 121 // Create a token to nest122 const nftTokenId = await contract.methods.nextTokenId().call();123 await contract.methods.mint(124 owner,125 nftTokenId,126 ).send({from: owner});127 128 // Try to nest129 await expect(contract.methods130 .transfer(targetNftTokenAddress, nftTokenId)131 .call({from: owner})).to.be.rejectedWith('UserIsNotAllowedToNest');132 });133 134 itEth('NFT: disallows a non-Owner to nest someone else\'s token', async ({helper}) => {135 const owner = await helper.eth.createAccountWithBalance(donor);136 const malignant = await helper.eth.createAccountWithBalance(donor);137 138 const {collectionId, contract} = await createNestingCollection(helper, owner);139 140 // Mint a token141 const targetTokenId = await contract.methods.nextTokenId().call();142 await contract.methods.mint(143 owner,144 targetTokenId,145 ).send({from: owner});146 const targetTokenAddress = helper.ethAddress.fromTokenId(collectionId, targetTokenId);147 148 // Mint a token belonging to a different account149 const tokenId = await contract.methods.nextTokenId().call();150 await contract.methods.mint(151 malignant,152 tokenId,153 ).send({from: owner});154 155 // Try to nest one token in another as a non-owner account156 await expect(contract.methods157 .transfer(targetTokenAddress, tokenId)158 .call({from: malignant})).to.be.rejectedWith('UserIsNotAllowedToNest');159 });160 161 itEth('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async ({helper}) => {162 const owner = await helper.eth.createAccountWithBalance(donor);163 const malignant = await helper.eth.createAccountWithBalance(donor);164 165 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);166 const {collectionAddress: collectionAddressB, contract: contractB} = await createNestingCollection(helper, owner);167 168 await contractA.methods.setCollectionNesting(true, [collectionAddressA, collectionAddressB]).send({from: owner});169 170 // Create a token in one collection171 const nftTokenIdA = await contractA.methods.nextTokenId().call();172 await contractA.methods.mint(173 owner,174 nftTokenIdA,175 ).send({from: owner});176 const nftTokenAddressA = helper.ethAddress.fromTokenId(collectionIdA, nftTokenIdA);177 178 // Create a token in another collection belonging to someone else179 const nftTokenIdB = await contractB.methods.nextTokenId().call();180 await contractB.methods.mint(181 malignant,182 nftTokenIdB,183 ).send({from: owner});184 185 // Try to drag someone else's token into the other collection and nest186 await expect(contractB.methods187 .transfer(nftTokenAddressA, nftTokenIdB)188 .call({from: malignant})).to.be.rejectedWith('UserIsNotAllowedToNest');189 });190 191 itEth('NFT: disallows to nest token in an unlisted collection', async ({helper}) => {192 const owner = await helper.eth.createAccountWithBalance(donor);193 194 const {collectionId: collectionIdA, collectionAddress: collectionAddressA, contract: contractA} = await createNestingCollection(helper, owner);195 const {contract: contractB} = await createNestingCollection(helper, owner);196 197 await contractA.methods.setCollectionNesting(true, [collectionAddressA]).send({from: owner});198 199 // Create a token in one collection200 const nftTokenIdA = await contractA.methods.nextTokenId().call();201 await contractA.methods.mint(202 owner,203 nftTokenIdA,204 ).send({from: owner});205 const nftTokenAddressA = helper.ethAddress.fromTokenId(collectionIdA, nftTokenIdA);206 207 // Create a token in another collection208 const nftTokenIdB = await contractB.methods.nextTokenId().call();209 await contractB.methods.mint(210 owner,211 nftTokenIdB,212 ).send({from: owner});213 214 // Try to nest into a token in the other collection, disallowed in the first215 await expect(contractB.methods216 .transfer(nftTokenAddressA, nftTokenIdB)217 .call()).to.be.rejectedWith('SourceCollectionIsNotAllowedToNest');218 });219 });220});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',
);
}