git.delta.rocks / unique-network / refs/commits / 6b56d6d67475

difftreelog

CORE-215

str-mv2021-11-29parent: #30c3834.patch.diff
in: master

1 file changed

modifiedtests/src/transfer.test.tsdiffbeforeafterboth
24 getTokenOwner,24 getTokenOwner,
25 normalizeAccountId,25 normalizeAccountId,
26 getBalance as getTokenBalance,26 getBalance as getTokenBalance,
27 transferFromExpectSuccess,
27} from './util/helpers';28} from './util/helpers';
29import {
30 createEthAccountWithBalance,
31 subToEth,
32 itWeb3,
33} from './eth/util/helpers';
2834
29let alice: IKeyringPair;35let alice: IKeyringPair;
30let bob: IKeyringPair;36let bob: IKeyringPair;
294 });300 });
295});301});
302
303describe('Transfers to self (potentially over substrate-evm boundary)', () => {
304 itWeb3('Transfers to self. In case of same frontend', async ({api}) => {
305 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
306 const alice = privateKey('//Alice');
307 const aliceProxy = subToEth(alice.address);
308 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});
309 const balanceAliceBefore = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);
310 await transferExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy} , 10, 'ReFungible');
311 await transferFromExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy}, alice, 10, 'ReFungible');
312 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);
313 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);
314 });
315
316 itWeb3('Transfers to self. In case of substrate-evm boundary', async ({api, web3}) => {
317 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
318 const alice = privateKey('//Alice');
319 const aliceProxy = await createEthAccountWithBalance(api, web3);
320 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});
321 const balanceAliceBefore = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);
322 await transferExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy} , 10, 'ReFungible');
323 await transferFromExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy}, alice, 10, 'ReFungible');
324 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);
325 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);
326 });
327});
328