git.delta.rocks / unique-network / refs/commits / 7f81f6c5a2ab

difftreelog

test balances.transfer => balances.transferKeepAlive

Yaroslav Bolyukin2023-11-17parent: #e2ee5ff.patch.diff
in: master

4 files changed

modifiedjs-packages/playgrounds/unique.dev.tsdiffbeforeafterboth
696 const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);696 const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);
697 accounts.push(recipient);697 accounts.push(recipient);
698 if(balance !== 0n) {698 if(balance !== 0n) {
699 const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, balance * tokenNominal]);699 const tx = this.helper.constructApiCall('api.tx.balances.transferKeepAlive', [{Id: recipient.address}, balance * tokenNominal]);
700 transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));700 transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));
701 nonce++;701 nonce++;
702 }702 }
749 const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);749 const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);
750 accounts.push(recipient);750 accounts.push(recipient);
751 if(withBalance !== 0n) {751 if(withBalance !== 0n) {
752 const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, withBalance * tokenNominal]);752 const tx = this.helper.constructApiCall('api.tx.balances.transferKeepAlive', [{Id: recipient.address}, withBalance * tokenNominal]);
753 transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));753 transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));
754 nonce++;754 nonce++;
755 }755 }
modifiedjs-packages/playgrounds/unique.tsdiffbeforeafterboth
2391 * @returns ```true``` if extrinsic success, otherwise ```false```2391 * @returns ```true``` if extrinsic success, otherwise ```false```
2392 */2392 */
2393 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2393 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {
2394 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true/*, `Unable to transfer balance from ${this.helper.getSignerAddress(signer)} to ${address}`*/);2394 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transferKeepAlive', [address, amount], true/*, `Unable to transfer balance from ${this.helper.getSignerAddress(signer)} to ${address}`*/);
23952395
2396 let transfer = {from: null, to: null, amount: 0n} as any;2396 let transfer = {from: null, to: null, amount: 0n} as any;
2397 result.result.events.forEach(({event: {data, method, section}}: any) => {2397 result.result.events.forEach(({event: {data, method, section}}: any) => {
2458 * @returns ```true``` if extrinsic success, otherwise ```false```2458 * @returns ```true``` if extrinsic success, otherwise ```false```
2459 */2459 */
2460 async transferToEthereum(signer: TSigner, address: TEthereumAccount, amount: bigint | string): Promise<boolean> {2460 async transferToEthereum(signer: TSigner, address: TEthereumAccount, amount: bigint | string): Promise<boolean> {
2461 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transfer', [address, amount], true);2461 const result = await this.helper.executeExtrinsic(signer, 'api.tx.balances.transferKeepAlive', [address, amount], true);
24622462
2463 let transfer = {from: null, to: null, amount: 0n} as any;2463 let transfer = {from: null, to: null, amount: 0n} as any;
2464 result.result.events.forEach(({event: {data, method, section}}: any) => {2464 result.result.events.forEach(({event: {data, method, section}}: any) => {
modifiedjs-packages/tests/scheduler.seqtest.tsdiffbeforeafterboth
507 for(let offset = 0; offset < numFilledBlocks; offset ++) {507 for(let offset = 0; offset < numFilledBlocks; offset ++) {
508 for(let i = 0; i < maxScheduledPerBlock; i++) {508 for(let i = 0; i < maxScheduledPerBlock; i++) {
509509
510 const scheduledTx = helper.constructApiCall('api.tx.balances.transfer', [bob.address, 1n]);510 const scheduledTx = helper.constructApiCall('api.tx.balances.transferKeepAlive', [bob.address, 1n]);
511511
512 const when = firstExecutionBlockNumber + period + offset;512 const when = firstExecutionBlockNumber + period + offset;
513 const mandatoryArgs = [when, null, null, scheduledTx];513 const mandatoryArgs = [when, null, null, scheduledTx];
710 // await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);710 // await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
711711
712 // // Grace zeroBalance with money, enough to cover future transactions712 // // Grace zeroBalance with money, enough to cover future transactions
713 // const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);713 // const balanceTx = api.tx.balances.transferKeepAlive(zeroBalance.address, 1n * UNIQUE);
714 // await submitTransactionAsync(alice, balanceTx);714 // await submitTransactionAsync(alice, balanceTx);
715715
716 // // Mint a fresh NFT716 // // Mint a fresh NFT
722 // await scheduleTransferExpectSuccess(api, collectionId, tokenId, zeroBalance, alice, 1, waitForBlocks, scheduledId);722 // await scheduleTransferExpectSuccess(api, collectionId, tokenId, zeroBalance, alice, 1, waitForBlocks, scheduledId);
723723
724 // // Get rid of the account's funds before the scheduled transaction takes place724 // // Get rid of the account's funds before the scheduled transaction takes place
725 // const balanceTx2 = api.tx.balances.transfer(alice.address, UNIQUE * 68n / 100n);725 // const balanceTx2 = api.tx.balances.transferKeepAlive(alice.address, UNIQUE * 68n / 100n);
726 // const events = await submitTransactionAsync(zeroBalance, balanceTx2);726 // const events = await submitTransactionAsync(zeroBalance, balanceTx2);
727 // expect(getGenericResult(events).success).to.be.true;727 // expect(getGenericResult(events).success).to.be.true;
728 // /*const emptyBalanceTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0); // do not null reserved?728 // /*const emptyBalanceTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0); // do not null reserved?
742742
743 // await usingApi(async (api, privateKey) => {743 // await usingApi(async (api, privateKey) => {
744 // const zeroBalance = await findUnusedAddress(api, privateKey);744 // const zeroBalance = await findUnusedAddress(api, privateKey);
745 // const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);745 // const balanceTx = api.tx.balances.transferKeepAlive(zeroBalance.address, 1n * UNIQUE);
746 // await submitTransactionAsync(alice, balanceTx);746 // await submitTransactionAsync(alice, balanceTx);
747747
748 // await setCollectionSponsorExpectSuccess(collectionId, zeroBalance.address);748 // await setCollectionSponsorExpectSuccess(collectionId, zeroBalance.address);
modifiedjs-packages/tests/util/globalSetup.tsdiffbeforeafterboth
81 if(aliceBalance < MINIMUM_DONOR_FUND * oneToken) {81 if(aliceBalance < MINIMUM_DONOR_FUND * oneToken) {
82 tx.push(helper.executeExtrinsic(82 tx.push(helper.executeExtrinsic(
83 alice,83 alice,
84 'api.tx.balances.transfer',84 'api.tx.balances.transferKeepAlive',
85 [account.address, DONOR_FUNDING * oneToken],85 [account.address, DONOR_FUNDING * oneToken],
86 true,86 true,
87 {nonce: nonce + balanceGrantedCounter++},87 {nonce: nonce + balanceGrantedCounter++},