dryRunTransaction<T> method
Implementation
Future<DryRunTransactionBlockResponse> dryRunTransaction<T>(T tx, {String? signerAddress}) async {
final address = signerAddress ?? getAddress();
Uint8List dryRunTxBytes;
if (tx is Uint8List) {
dryRunTxBytes = tx;
} else if (tx is MoveCallTransaction) {
dryRunTxBytes = await serializer.newMoveCall(address, tx);
} else if (tx is PayTransaction) {
dryRunTxBytes = await serializer.newPay(address, tx);
} else if (tx is PayAllSuiTransaction) {
dryRunTxBytes = await serializer.newPayAllSui(address, tx);
} else if (tx is PaySuiTransaction) {
dryRunTxBytes = await serializer.newPaySui(address, tx);
} else if (tx is PublishTransaction) {
dryRunTxBytes = await serializer.newPublish(address, tx);
} else if (tx is TransferObjectTransaction) {
dryRunTxBytes = await serializer.newTransferObject(address, tx);
} else if (tx is TransferSuiTransaction) {
dryRunTxBytes = await serializer.newTransferSui(address, tx);
} else if (tx is AddStakeTransaction) {
dryRunTxBytes = await serializer.newAddStake(address, tx);
} else if (tx is WithdrawStakeTransaction) {
dryRunTxBytes = await serializer.newWithdrawStake(address, tx);
} else if (tx is SplitCoinTransaction) {
dryRunTxBytes = await serializer.newSplitCoin(address, tx);
} else if (tx is SplitCoinEqualTransaction) {
dryRunTxBytes = await serializer.newSplitCoinEqual(address, tx);
} else {
throw ArgumentError("Error, unknown transaction kind ${tx.runtimeType}. Can't dry run transaction.");
}
return dryRunTransactionBlock(base64Encode(dryRunTxBytes));
}