Closed
Description
Using nodejs to call @ polkadot/API version "^ 10.11.1"
There were some occasional issues during use, please refer to the following code snippet
import { ApiPromise, WsProvider, Keyring } from '@polkadot/api';
import { cryptoWaitReady } from '@polkadot/util-crypto';
const api = await ApiPromise.create();
await api.tx.utility
.batch(Array)
.signAndSend( accountFromKeyring, async ( { events = [], status , dispatchError } ) => {
if (status.isInBlock) {
console.log('number1');
events.forEach( async ({ event: { method, data: [error] } }) => {
if (method == 'BatchInterrupted') {
console.log('number2');
} else if(method == 'BatchCompleted'){
console.log('number3');
}
});
}
})
In the above code execution, I can obtain the print log of number1, but sometimes I cannot obtain the print log of number2 or number3. Is there a problem with my writing style?
Metadata
Metadata
Assignees
Labels
No labels