Reputation: 21
Need to make a scheduled transfer from one account to another and then serialise it to base 64. which reads it in the serialised format and provides the required signature and submit it.
I've made a scheduled transfer but not knowing how to make it to a serialised base64 format
Upvotes: 2
Views: 193
Reputation: 1
//Get the scheduled transaction ID
const scheduledTxId = receipt.scheduledTransactionId;
console.info("The scheduled transaction ID is " + scheduledTxId);
// converting the scheduleTransactionId into bytes
const scheduledTxBytes = Buffer.from(scheduledTxId.toString(), 'utf8');
console.info('The serialized scheduled transaction is:' + scheduledTxBytes);
// converting scheduledTxBytes into base64
const scheduledTxBase64 = scheduledTxBytes.toString('base64');
console.info("The scheduled transaction in base64 is: " + scheduledTxBase64);
Upvotes: 0
Reputation: 471
Using the SDKs, you can create a transaction object (e.g. a CryptoTransferTransaction) and convert it to bytes which you can then turn to base64 or any encoding of your choice using available libraries.
The receiver of the base64 payload can then convert back to bytes and deserialize (e.g. const transaction = Transaction.fromBytes(transactionBytes);) the transaction back to an object.
You may find these examples useful: https://github.com/hashgraph/hedera-sdk-js/blob/develop/examples/schedule-example.js
and
https://github.com/hashgraph/hedera-sdk-js/blob/develop/examples/multi-sig-offline.js
Also note that ScheduleGetInfoQuery
will return the body of the transaction that's been scheduled, so you can technically share the scheduleId
alone, the other party can pull the transaction and sign it after verifying it does correspond to their expectations.
Upvotes: 1