Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signing Transactions with Different Payer Address: Handling Dual Signature Requirements in OntAssetTxBuilder #236

Open
sinanouri opened this issue Feb 19, 2024 · 1 comment

Comments

@sinanouri
Copy link

How should I sign the transaction if I specify a different payer address than the sender address in the following code snippet?

const tx = OntAssetTxBuilder.makeTransferTx(assetType, from, to, amount, gasPrice, gasLimit, payer);
TransactionBuilder.signTransaction(tx, from_privateKey)

Do I need to sign the transaction twice, first with the sender's private key and then with the fee payer's private key?

const tx = OntAssetTxBuilder.makeTransferTx(assetType, from, to, amount, gasPrice, gasLimit, payer);
TransactionBuilder.signTransaction(tx, from_privateKey)
TransactionBuilder.signTransaction(tx, payer_privateKey)
@sinanouri
Copy link
Author

Actually, I found the solution while I was playing with the library. The code should be like this:

const tx = OntAssetTxBuilder.makeTransferTx(assetType, from, to, amount, gasPrice, gasLimit, payer);
TransactionBuilder.signTransaction(tx, from_privateKey);
TransactionBuilder.addSign(tx, payer_privateKey);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant