sendTrx method
Send transaction with specified data.
Implementation
void sendTrx(
{required String address,
required int amount,
String? comment,
int? validUntill}) async {
validUntill ??= DateTime.now().millisecondsSinceEpoch ~/ 1000 + 10000;
if (!connector.connected) {
broadcastMessage(TonPaymentStatus.Disconnected);
} else {
Map<String, Object> message = {
"address": address,
"amount": amount.toString(),
};
if (comment != null) {
var payload = ScString(comment);
var cell = beginCell()
.storeUint(BigInt.zero, 32)
.storeStringTail(payload.value)
.endCell();
final base64Str = base64.encode(cell.toBoc());
message['payload'] = base64Str;
}
var transaction = {
"validUntil": validUntill,
"messages": [message]
};
sendTrxRaw(transaction: transaction);
}
}