difftreelog
CORE-346 Skip some evm tests
in: master
3 files changed
tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -226,7 +226,8 @@
expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');
});
- itWeb3('Sponsoring evm address from substrate collection', async ({api, web3}) => {
+ //TODO: CORE-302 add eth methods
+ itWeb3.skip('Sponsoring evm address from substrate collection', async ({api, web3}) => {
const owner = await createEthAccountWithBalance(api, web3);
const collectionHelper = evmCollectionHelper(web3, owner);
let result = await collectionHelper.methods.create721Collection('Sponsor collection', '1', '1').send();
@@ -303,9 +304,9 @@
expect(await userContract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
}
});
-
- itWeb3('Check that transaction via EVM spend money from substrate address', async ({api, web3}) => {
+ //TODO: CORE-302 add eth methods
+ itWeb3.skip('Check that transaction via EVM spend money from substrate address', async ({api, web3}) => {
const owner = privateKey('//Alice');
const user = privateKey(`//User/${Date.now()}`);
const userEth = subToEth(user.address);
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -112,7 +112,9 @@
// const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
// expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
});
- itWeb3('Can perform mintBulk()', async ({web3, api}) => {
+
+ //TODO: CORE-302 add eth methods
+ itWeb3.skip('Can perform mintBulk()', async ({web3, api}) => {
const collection = await createCollectionExpectSuccess({
mode: {type: 'NFT'},
});
tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth1// 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 privateKey from '../../substrate/privateKey';18import {createCollectionExpectSuccess, createItemExpectSuccess} from '../../util/helpers';19import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents} from '../util/helpers';20import nonFungibleAbi from '../nonFungibleAbi.json';21import {expect} from 'chai';22import {submitTransactionAsync} from '../../substrate/substrate-api';23import Web3 from 'web3';24import {readFile} from 'fs/promises';25import {ApiPromise} from '@polkadot/api';2627async function proxyWrap(api: ApiPromise, web3: Web3, wrapped: any) {28 // Proxy owner has no special privilegies, we don't need to reuse them29 const owner = await createEthAccountWithBalance(api, web3);30 const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {31 from: owner,32 ...GAS_ARGS,33 });34 const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});35 return proxy;36}3738describe('NFT (Via EVM proxy): Information getting', () => {39 itWeb3('totalSupply', async ({api, web3}) => {40 const collection = await createCollectionExpectSuccess({41 mode: {type: 'NFT'},42 });43 const alice = privateKey('//Alice');44 const caller = await createEthAccountWithBalance(api, web3);4546 await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});4748 const address = collectionIdToAddress(collection);49 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));50 const totalSupply = await contract.methods.totalSupply().call();5152 expect(totalSupply).to.equal('1');53 });5455 itWeb3('balanceOf', async ({api, web3}) => {56 const collection = await createCollectionExpectSuccess({57 mode: {type: 'NFT'},58 });59 const alice = privateKey('//Alice');6061 const caller = await createEthAccountWithBalance(api, web3);62 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});63 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});64 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});6566 const address = collectionIdToAddress(collection);67 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));68 const balance = await contract.methods.balanceOf(caller).call();6970 expect(balance).to.equal('3');71 });7273 itWeb3('ownerOf', async ({api, web3}) => {74 const collection = await createCollectionExpectSuccess({75 mode: {type: 'NFT'},76 });77 const alice = privateKey('//Alice');7879 const caller = await createEthAccountWithBalance(api, web3);80 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});8182 const address = collectionIdToAddress(collection);83 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));84 const owner = await contract.methods.ownerOf(tokenId).call();8586 expect(owner).to.equal(caller);87 });88});8990describe('NFT (Via EVM proxy): Plain calls', () => {91 itWeb3('Can perform mint()', async ({web3, api}) => {92 const collection = await createCollectionExpectSuccess({93 mode: {type: 'NFT'},94 });95 const alice = privateKey('//Alice');96 const caller = await createEthAccountWithBalance(api, web3);97 const receiver = createEthAccount(web3);9899 const address = collectionIdToAddress(collection);100 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));101102 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});103 await submitTransactionAsync(alice, changeAdminTx);104105 {106 const nextTokenId = await contract.methods.nextTokenId().call();107 expect(nextTokenId).to.be.equal('1');108 const result = await contract.methods.mintWithTokenURI(109 receiver,110 nextTokenId,111 'Test URI',112 ).send({from: caller});113 const events = normalizeEvents(result.events);114115 expect(events).to.be.deep.equal([116 {117 address,118 event: 'Transfer',119 args: {120 from: '0x0000000000000000000000000000000000000000',121 to: receiver,122 tokenId: nextTokenId,123 },124 },125 ]);126127 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');128 }129 });130 131 itWeb3('Can perform mintBulk()', async ({web3, api}) => {132 const collection = await createCollectionExpectSuccess({133 mode: {type: 'NFT'},134 });135 const alice = privateKey('//Alice');136137 const caller = await createEthAccountWithBalance(api, web3);138 const receiver = createEthAccount(web3);139140 const address = collectionIdToAddress(collection);141 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));142 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});143 await submitTransactionAsync(alice, changeAdminTx);144145 {146 const nextTokenId = await contract.methods.nextTokenId().call();147 expect(nextTokenId).to.be.equal('1');148 const result = await contract.methods.mintBulkWithTokenURI(149 receiver,150 [151 [nextTokenId, 'Test URI 0'],152 [+nextTokenId + 1, 'Test URI 1'],153 [+nextTokenId + 2, 'Test URI 2'],154 ],155 ).send({from: caller});156 const events = normalizeEvents(result.events);157158 expect(events).to.be.deep.equal([159 {160 address,161 event: 'Transfer',162 args: {163 from: '0x0000000000000000000000000000000000000000',164 to: receiver,165 tokenId: nextTokenId,166 },167 },168 {169 address,170 event: 'Transfer',171 args: {172 from: '0x0000000000000000000000000000000000000000',173 to: receiver,174 tokenId: String(+nextTokenId + 1),175 },176 },177 {178 address,179 event: 'Transfer',180 args: {181 from: '0x0000000000000000000000000000000000000000',182 to: receiver,183 tokenId: String(+nextTokenId + 2),184 },185 },186 ]);187188 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');189 expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');190 expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');191 }192 });193194 itWeb3('Can perform burn()', async ({web3, api}) => {195 const collection = await createCollectionExpectSuccess({196 mode: {type: 'NFT'},197 });198 const alice = privateKey('//Alice');199 const caller = await createEthAccountWithBalance(api, web3);200201 const address = collectionIdToAddress(collection);202 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));203 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});204205 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});206 await submitTransactionAsync(alice, changeAdminTx);207208 {209 const result = await contract.methods.burn(tokenId).send({from: caller});210 const events = normalizeEvents(result.events);211212 expect(events).to.be.deep.equal([213 {214 address,215 event: 'Transfer',216 args: {217 from: contract.options.address,218 to: '0x0000000000000000000000000000000000000000',219 tokenId: tokenId.toString(),220 },221 },222 ]);223 }224 });225226 itWeb3('Can perform approve()', async ({web3, api}) => {227 const collection = await createCollectionExpectSuccess({228 mode: {type: 'NFT'},229 });230 const alice = privateKey('//Alice');231 const caller = await createEthAccountWithBalance(api, web3);232 const spender = createEthAccount(web3);233234 const address = collectionIdToAddress(collection);235 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address));236 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});237238 {239 const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});240 const events = normalizeEvents(result.events);241242 expect(events).to.be.deep.equal([243 {244 address,245 event: 'Approval',246 args: {247 owner: contract.options.address,248 approved: spender,249 tokenId: tokenId.toString(),250 },251 },252 ]);253 }254 });255256 itWeb3('Can perform transferFrom()', async ({web3, api}) => {257 const collection = await createCollectionExpectSuccess({258 mode: {type: 'NFT'},259 });260 const alice = privateKey('//Alice');261 const caller = await createEthAccountWithBalance(api, web3);262 const owner = await createEthAccountWithBalance(api, web3);263264 const receiver = createEthAccount(web3);265266 const address = collectionIdToAddress(collection);267 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});268 const contract = await proxyWrap(api, web3, evmCollection);269 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});270271 await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});272273 {274 const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});275 const events = normalizeEvents(result.events);276 expect(events).to.be.deep.equal([277 {278 address,279 event: 'Transfer',280 args: {281 from: owner,282 to: receiver,283 tokenId: tokenId.toString(),284 },285 },286 ]);287 }288289 {290 const balance = await contract.methods.balanceOf(receiver).call();291 expect(+balance).to.equal(1);292 }293294 {295 const balance = await contract.methods.balanceOf(contract.options.address).call();296 expect(+balance).to.equal(0);297 }298 });299300 itWeb3('Can perform transfer()', async ({web3, api}) => {301 const collection = await createCollectionExpectSuccess({302 mode: {type: 'NFT'},303 });304 const alice = privateKey('//Alice');305 const caller = await createEthAccountWithBalance(api, web3);306 const receiver = createEthAccount(web3);307308 const address = collectionIdToAddress(collection);309 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));310 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});311312 {313 const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});314 const events = normalizeEvents(result.events);315 expect(events).to.be.deep.equal([316 {317 address,318 event: 'Transfer',319 args: {320 from: contract.options.address,321 to: receiver,322 tokenId: tokenId.toString(),323 },324 },325 ]);326 }327328 {329 const balance = await contract.methods.balanceOf(contract.options.address).call();330 expect(+balance).to.equal(0);331 }332333 {334 const balance = await contract.methods.balanceOf(receiver).call();335 expect(+balance).to.equal(1);336 }337 });338});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 privateKey from '../../substrate/privateKey';18import {createCollectionExpectSuccess, createItemExpectSuccess} from '../../util/helpers';19import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents} from '../util/helpers';20import nonFungibleAbi from '../nonFungibleAbi.json';21import {expect} from 'chai';22import {submitTransactionAsync} from '../../substrate/substrate-api';23import Web3 from 'web3';24import {readFile} from 'fs/promises';25import {ApiPromise} from '@polkadot/api';2627async function proxyWrap(api: ApiPromise, web3: Web3, wrapped: any) {28 // Proxy owner has no special privilegies, we don't need to reuse them29 const owner = await createEthAccountWithBalance(api, web3);30 const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {31 from: owner,32 ...GAS_ARGS,33 });34 const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});35 return proxy;36}3738describe('NFT (Via EVM proxy): Information getting', () => {39 itWeb3('totalSupply', async ({api, web3}) => {40 const collection = await createCollectionExpectSuccess({41 mode: {type: 'NFT'},42 });43 const alice = privateKey('//Alice');44 const caller = await createEthAccountWithBalance(api, web3);4546 await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});4748 const address = collectionIdToAddress(collection);49 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));50 const totalSupply = await contract.methods.totalSupply().call();5152 expect(totalSupply).to.equal('1');53 });5455 itWeb3('balanceOf', async ({api, web3}) => {56 const collection = await createCollectionExpectSuccess({57 mode: {type: 'NFT'},58 });59 const alice = privateKey('//Alice');6061 const caller = await createEthAccountWithBalance(api, web3);62 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});63 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});64 await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});6566 const address = collectionIdToAddress(collection);67 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));68 const balance = await contract.methods.balanceOf(caller).call();6970 expect(balance).to.equal('3');71 });7273 itWeb3('ownerOf', async ({api, web3}) => {74 const collection = await createCollectionExpectSuccess({75 mode: {type: 'NFT'},76 });77 const alice = privateKey('//Alice');7879 const caller = await createEthAccountWithBalance(api, web3);80 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});8182 const address = collectionIdToAddress(collection);83 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));84 const owner = await contract.methods.ownerOf(tokenId).call();8586 expect(owner).to.equal(caller);87 });88});8990describe('NFT (Via EVM proxy): Plain calls', () => {91 //TODO: CORE-302 add eth methods92 itWeb3.skip('Can perform mint()', async ({web3, api}) => {93 const collection = await createCollectionExpectSuccess({94 mode: {type: 'NFT'},95 });96 const alice = privateKey('//Alice');97 const caller = await createEthAccountWithBalance(api, web3);98 const receiver = createEthAccount(web3);99100 const address = collectionIdToAddress(collection);101 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));102103 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});104 await submitTransactionAsync(alice, changeAdminTx);105106 {107 const nextTokenId = await contract.methods.nextTokenId().call();108 expect(nextTokenId).to.be.equal('1');109 const result = await contract.methods.mintWithTokenURI(110 receiver,111 nextTokenId,112 'Test URI',113 ).send({from: caller});114 const events = normalizeEvents(result.events);115116 expect(events).to.be.deep.equal([117 {118 address,119 event: 'Transfer',120 args: {121 from: '0x0000000000000000000000000000000000000000',122 to: receiver,123 tokenId: nextTokenId,124 },125 },126 ]);127128 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');129 }130 });131 132 //TODO: CORE-302 add eth methods133 itWeb3.skip('Can perform mintBulk()', async ({web3, api}) => {134 const collection = await createCollectionExpectSuccess({135 mode: {type: 'NFT'},136 });137 const alice = privateKey('//Alice');138139 const caller = await createEthAccountWithBalance(api, web3);140 const receiver = createEthAccount(web3);141142 const address = collectionIdToAddress(collection);143 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));144 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});145 await submitTransactionAsync(alice, changeAdminTx);146147 {148 const nextTokenId = await contract.methods.nextTokenId().call();149 expect(nextTokenId).to.be.equal('1');150 const result = await contract.methods.mintBulkWithTokenURI(151 receiver,152 [153 [nextTokenId, 'Test URI 0'],154 [+nextTokenId + 1, 'Test URI 1'],155 [+nextTokenId + 2, 'Test URI 2'],156 ],157 ).send({from: caller});158 const events = normalizeEvents(result.events);159160 expect(events).to.be.deep.equal([161 {162 address,163 event: 'Transfer',164 args: {165 from: '0x0000000000000000000000000000000000000000',166 to: receiver,167 tokenId: nextTokenId,168 },169 },170 {171 address,172 event: 'Transfer',173 args: {174 from: '0x0000000000000000000000000000000000000000',175 to: receiver,176 tokenId: String(+nextTokenId + 1),177 },178 },179 {180 address,181 event: 'Transfer',182 args: {183 from: '0x0000000000000000000000000000000000000000',184 to: receiver,185 tokenId: String(+nextTokenId + 2),186 },187 },188 ]);189190 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');191 expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');192 expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');193 }194 });195196 itWeb3('Can perform burn()', async ({web3, api}) => {197 const collection = await createCollectionExpectSuccess({198 mode: {type: 'NFT'},199 });200 const alice = privateKey('//Alice');201 const caller = await createEthAccountWithBalance(api, web3);202203 const address = collectionIdToAddress(collection);204 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));205 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});206207 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});208 await submitTransactionAsync(alice, changeAdminTx);209210 {211 const result = await contract.methods.burn(tokenId).send({from: caller});212 const events = normalizeEvents(result.events);213214 expect(events).to.be.deep.equal([215 {216 address,217 event: 'Transfer',218 args: {219 from: contract.options.address,220 to: '0x0000000000000000000000000000000000000000',221 tokenId: tokenId.toString(),222 },223 },224 ]);225 }226 });227228 itWeb3('Can perform approve()', async ({web3, api}) => {229 const collection = await createCollectionExpectSuccess({230 mode: {type: 'NFT'},231 });232 const alice = privateKey('//Alice');233 const caller = await createEthAccountWithBalance(api, web3);234 const spender = createEthAccount(web3);235236 const address = collectionIdToAddress(collection);237 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address));238 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});239240 {241 const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});242 const events = normalizeEvents(result.events);243244 expect(events).to.be.deep.equal([245 {246 address,247 event: 'Approval',248 args: {249 owner: contract.options.address,250 approved: spender,251 tokenId: tokenId.toString(),252 },253 },254 ]);255 }256 });257258 itWeb3('Can perform transferFrom()', async ({web3, api}) => {259 const collection = await createCollectionExpectSuccess({260 mode: {type: 'NFT'},261 });262 const alice = privateKey('//Alice');263 const caller = await createEthAccountWithBalance(api, web3);264 const owner = await createEthAccountWithBalance(api, web3);265266 const receiver = createEthAccount(web3);267268 const address = collectionIdToAddress(collection);269 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});270 const contract = await proxyWrap(api, web3, evmCollection);271 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});272273 await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});274275 {276 const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});277 const events = normalizeEvents(result.events);278 expect(events).to.be.deep.equal([279 {280 address,281 event: 'Transfer',282 args: {283 from: owner,284 to: receiver,285 tokenId: tokenId.toString(),286 },287 },288 ]);289 }290291 {292 const balance = await contract.methods.balanceOf(receiver).call();293 expect(+balance).to.equal(1);294 }295296 {297 const balance = await contract.methods.balanceOf(contract.options.address).call();298 expect(+balance).to.equal(0);299 }300 });301302 itWeb3('Can perform transfer()', async ({web3, api}) => {303 const collection = await createCollectionExpectSuccess({304 mode: {type: 'NFT'},305 });306 const alice = privateKey('//Alice');307 const caller = await createEthAccountWithBalance(api, web3);308 const receiver = createEthAccount(web3);309310 const address = collectionIdToAddress(collection);311 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));312 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});313314 {315 const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});316 const events = normalizeEvents(result.events);317 expect(events).to.be.deep.equal([318 {319 address,320 event: 'Transfer',321 args: {322 from: contract.options.address,323 to: receiver,324 tokenId: tokenId.toString(),325 },326 },327 ]);328 }329330 {331 const balance = await contract.methods.balanceOf(contract.options.address).call();332 expect(+balance).to.equal(0);333 }334335 {336 const balance = await contract.methods.balanceOf(receiver).call();337 expect(+balance).to.equal(1);338 }339 });340});