dryRunTransaction<T> method
Future<DryRunTransactionBlockResponse>
dryRunTransaction<T>(
- T tx, {
- String? signerAddress,
override
Implementation
@override
Future<DryRunTransactionBlockResponse> dryRunTransaction<T>(
T tx, {
String? signerAddress,
}) async {
// The builder passes already-built TransactionData bytes here to estimate a
// gas budget; simulate them and surface the gas cost + status.
final sim = await core.simulateTransaction(tx as Uint8List);
final effects = sim.transaction.effects;
final st = effects.status;
final g = effects.gasUsed;
const zero =
'0x0000000000000000000000000000000000000000000000000000000000000000';
return DryRunTransactionBlockResponse.fromJson({
'effects': {
'messageVersion': 'v1',
'status': {
'status': st.success ? 'success' : 'failure',
if (!st.success) 'error': st.error.description,
},
'gasUsed': {
'computationCost': g.computationCost.toInt().toString(),
'storageCost': g.storageCost.toInt().toString(),
'storageRebate': g.storageRebate.toInt().toString(),
'nonRefundableStorageFee': '0',
},
'transactionDigest': '',
'gasObject': {
'owner': {'AddressOwner': zero},
'reference': {
'objectId': zero,
'version': 0,
'digest': '11111111111111111111111111111111',
}
},
},
});
}