serializeForWallet method
Serialize tx for a wallet, with sender set and its WAL and SUI
payments (CoinWithBalance intents) resolved against sender's coins
and address balance, the way @mysten/sui's dApp Kit does before it
calls sui:signAndExecuteTransaction. The wallet adds gas.
Implementation
Future<String> serializeForWallet(Transaction tx, String sender) async {
tx.setSender(sender);
final data = TransactionBlockDataBuilder.restore(
jsonDecode(tx.toJson()) as Map<String, dynamic>,
);
await resolveCoinBalanceIntents(
data,
GrpcBuilderAdapter(sui.core as GrpcCoreClient),
);
return jsonEncode(data.snapshot());
}