dryRunTransaction method
Implementation
@override
Future<DryRunTransactionBlockResponse> dryRunTransaction(
Uint8List bytes, {
String? signerAddress,
}) async {
// No bytes dry-run in gRPC: rebuild the tx and simulate (the node picks gas,
// since the builder dry-runs with empty payment to estimate a budget).
final tx = Transaction.fromBytes(bytes);
final response = await client.simulateTransaction(tx, doGasSelection: true);
final effects = response.effects;
final success = effects?.status?.success ?? response.status.success;
final gas = effects?.gasUsed;
return DryRunTransactionBlockResponse.fromJson({
'effects': {
'status': success
? {'status': 'success'}
: {
'status': 'failure',
'error':
effects?.status?.error?.message ??
response.status.error?.message,
},
'gasUsed': {
'computationCost': gas?.computationCost ?? '0',
'storageCost': gas?.storageCost ?? '0',
'storageRebate': gas?.storageRebate ?? '0',
'nonRefundableStorageFee': gas?.nonRefundableStorageFee ?? '0',
},
'transactionDigest': effects?.transactionDigest ?? response.digest,
// A placeholder gas object; the builder only reads status + gasUsed.
'gasObject': {
'owner': {'AddressOwner': '0x0'},
'reference': {
'objectId': '0x0',
'version': '0',
'digest': '11111111111111111111111111111111',
},
},
},
});
}