Replies: 6 comments 1 reply
-
when i do this: `const txn = await aptos.transaction.build.simple({ const bytes = txn.rawTransaction.bcsToBytes();` console.log(Buffer.from(bytes).toString("base64")); getting this:
|
Beta Was this translation helpful? Give feedback.
-
Hi, here are some examples that might help you with what you are trying to achieve Shows how one can do Shows how can |
Beta Was this translation helpful? Give feedback.
-
Hi @0xmaayan I am looking for something like this: |
Beta Was this translation helpful? Give feedback.
-
Right now i am getting this
as i am using type sdk for the raw tx prepare and js sdk for signing |
Beta Was this translation helpful? Give feedback.
-
Any reason of using both TS and JS SDKs? To generate a transaction and get the signing message you can easily do it with only the TS SDK. Check out https://github.com/aptos-labs/aptos-ts-sdk/blob/main/tests/unit/signingMessage.test.ts#L11 Generate a transaction https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/api/transactionSubmission/build.ts#L31
Get the signing message https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/api/transaction.ts#L200
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer @0xmaayan , we already have js sdk so for backwards compatibility as ts sdk does not produce a single bcs signed raw transaction, transaction and signature are separate. |
Beta Was this translation helpful? Give feedback.
-
Discord user ID
sumibisht
Describe your question in detail.
just a quick question, now how can i send this transaction
const txn = await aptos.transaction.build.simple({
sender: "0xbe5cd08d8fe346b9b55dba64fc09e50dda92a8bd16743652ec8b156821123310",
data: {
function: "0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa::router::swap_exact_input",
typeArguments: [parseTypeTag(APTOS_COIN), parseTypeTag(DEVNET_BNB)],
functionArguments: [new U64(APTOS_COIN_AMOUNT), new U64(5)],
},
});
console.log(txn);
// Now i want to encode this tx and send it over the internet so that anyone else can sign it
const signedTx = aptos.transaction.sign({
signer:signer,
transaction: txn
});
// Now i want to send this signed tx so that any one else can send this
console.log(signedTx.deserialize(), txn); // this does'nt work
please let me know as i can't find any functions for it on the sdk
What error, if any, are you getting?
No response
What have you tried or looked at? Or how can we reproduce the error?
No response
Which operating system are you using?
macOS
Which SDK or tool are you using? (if any)
TypeScript SDK
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions