Error with account type in aptos.transaction.sign #369
Replies: 1 comment 1 reply
-
Hi @MartinYeung5 ! To sign a transaction, you must provide the signer/wallet private key so it can be used to sign the transaction with. When you try to do it with the info the wallet adapter provides, you wont succeed as the wallet adapter NEVER exposes the wallet private key (for obvious security reasons), so
only returns the public wallet info such as the account address, public key, etc. Because of that, when you provide that argument to the SDK On the other hand, when you generate a new account with Not sure what the exact flow you are trying to achieve,
|
Beta Was this translation helpful? Give feedback.
-
Hi team, i tried to use aptos.transaction.sign,
The following is my code:
import { useWallet } from "@aptos-labs/wallet-adapter-react";
const { account, signAndSubmitTransaction } = useWallet();
const owner1 = account;
const bobSenderAuthenticator = aptos.transaction.sign({
signer: owner1 ,
transaction,
});
version:
"@aptos-labs/ts-sdk": "^1.26.0",
"@aptos-labs/wallet-adapter-react": "^3.4.3",
When i get the account data from wallet, i can't use in aptos.transaction.sign.
The console showed the error msg:
TypeError: a.signTransactionWithAuthenticator is not a function
if i use:
let owner2 = Account.generate();
const bobSenderAuthenticator = aptos.transaction.sign({
signer: owner2 ,
transaction,
});
results:
no error
Therefore, how can i change the account type to Ed25519Account ?
Beta Was this translation helpful? Give feedback.
All reactions