--- a/tests/src/util/playgrounds/unique.dev.ts +++ b/tests/src/util/playgrounds/unique.dev.ts @@ -132,7 +132,7 @@ accounts.push(recipient); if (balance !== 0n) { const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, balance * tokenNominal]); - transactions.push(this.helper.signTransaction(donor, tx, 'account generation', {nonce})); + transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation')); nonce++; } } @@ -183,7 +183,7 @@ accounts.push(recepient); if (withBalance !== 0n) { const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recepient.address}, withBalance * tokenNominal]); - transactions.push(this.helper.signTransaction(donor, tx, 'account generation', {nonce})); + transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation')); nonce++; } } --- a/tests/src/util/playgrounds/unique.ts +++ b/tests/src/util/playgrounds/unique.ts @@ -6,7 +6,7 @@ /* eslint-disable no-prototype-builtins */ import {ApiPromise, WsProvider, Keyring} from '@polkadot/api'; -import {ApiInterfaceEvents} from '@polkadot/api/types'; +import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types'; import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto'; import {IKeyringPair} from '@polkadot/types/types'; import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, TUniqueNetworks} from './types'; @@ -205,12 +205,12 @@ let obj: any = {}; let index = 0; - if (data.entries) + if (data.entries) { for(const [key, value] of data.entries()) { obj[key] = this.extractData(value, subTypes[index]); index++; } - else obj = data.toJSON(); + } else obj = data.toJSON(); return obj; } @@ -365,7 +365,7 @@ return this.transactionStatus.FAIL; } - signTransaction(sender: TSigner, transaction: any, label = 'transaction', options: any = null) { + signTransaction(sender: TSigner, transaction: any, options: Partial | null = null, label = 'transaction') { const sign = (callback: any) => { if(options !== null) return transaction.signAndSend(sender, options, callback); return transaction.signAndSend(sender, callback); @@ -421,7 +421,7 @@ return call(...params); } - async executeExtrinsic(sender: TSigner, extrinsic: string, params: any[], expectSuccess=true/*, failureMessage='expected success'*/) { + async executeExtrinsic(sender: TSigner, extrinsic: string, params: any[], expectSuccess=true, options: Partial|null = null/*, failureMessage='expected success'*/) { if(this.api === null) throw Error('API not initialized'); if(!extrinsic.startsWith('api.tx.')) throw Error(`${extrinsic} is not transaction`); @@ -429,7 +429,7 @@ let result: ITransactionResult; let events: IEvent[] = []; try { - result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), extrinsic) as ITransactionResult; + result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), options, extrinsic) as ITransactionResult; events = this.eventHelper.extractEvents(result); } catch(e) {