inspectReturns function
Future<List<List<Uint8List> > >
inspectReturns(
- ReadClient client,
- Transaction tx, {
- String? sender,
Simulate a read-only PTB and return each command's BCS return values,
indexed [commandIndex][returnValueIndex]. A sender is required to
simulate; callers rarely have one for a pure read, so the zero address is
the default.
Implementation
Future<List<List<Uint8List>>> inspectReturns(
ReadClient client,
Transaction tx, {
String? sender,
}) async {
tx.setSender(sender ?? normalizeSuiAddress('0x0'));
final res = await _simulate(
client, tx, const ['transaction.effects.status', 'command_outputs']);
final commands = res.commandOutputs;
if (commands.isEmpty) {
throw PredictInputError('simulateTransaction returned no commandResults');
}
return [
for (final c in commands)
[for (final rv in c.returnValues) Uint8List.fromList(rv.value.value)]
];
}