polkawallet-io / sdk

polkawallet SDK for integrating substrate-based blockchain as a plugin.
Apache License 2.0
18 stars 24 forks source link

How to use extrinsics utility.batch and utility.batchAll ? #30

Closed poka-IT closed 1 year ago

poka-IT commented 1 year ago

I try to use utility.batchAll() with polkawallet_sdk.

This what i'm trying:

final txInfo = TxInfoData(
  'utility',
  'batchAll',
  sender,
);

final txOptions = [
  'universalDividend.claimUds()',
  'balances.transferKeepAlive($destAddress, $amountUnit)'
];

await sdk.api.tx
          .signAndSend(
            txInfo,
            txOptions,
            password,
          ).timeout(
            const Duration(seconds: 12),
            onTimeout: () => {},
          );

This this throw a timeout after 12s. This 2 calls works fine one by one. Do you have an example how to use batchAll here ?

RomeroYang commented 1 year ago

https://github.com/polkawallet-io/polkawallet_plugin_kusama/blob/master/lib/pages/staking/actions/stakePage.dart It use rawParams as batch call content.