transaction.sign is not a function
See original GitHub issueDescribe the bug I just upgraded to stellar javascript sdk 2.3.0. The old source code used to sign transactions using an instance of the TransactionBuilder’s sign() method. But now it doesn;t work, I get an error:
TypeError: transaction.sign is not a function
What version are you on? 2.3.0
To Reproduce Steps to reproduce the behavior:
- Create a transaction using the following
const transaction = await new StellarSdk.TransactionBuilder(sourceAccount,{
timebounds: await StellarSdk.Server.fetchTimebounds(100),
networkPassphrase: this.network,
fee: (BASE_FEE == null ? 100 : BASE_FEE) * 1
}).addOperation(this.stellar.StellarSdk.Operation.payment({
destination: recKeys.publicKey(),
asset: SOME_ASSET,
amount: '' + amount.toFixed(7),
}))
transaction.sign(senderKeys)
- The error happens on the last line
transaction.sign(senderKeys)
Expected behavior For the transaction to be signed so i can submit to the stellar network
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Solana React TypeError: this.wallet.signTransaction is not a ...
signTransaction is not a function So I've logged about wallet and signTransaction is null. enter image description here.
Read more >signTransaction is not a function? - Ethereum Stack Exchange
I want to test web3.js functionality, then I connect to Ganache, when I run the program web3.eth.getAccounts works properly, but web3.eth.
Read more >typeerror: wallet.signtransaction is not a function - You.com
If you are getting a typeError that wallet.signTransaction is not a function, then it is likely that you have not imported the wallet...
Read more >Using JavaScript API to interact with NEAR
To sign a transaction you'll need a KeyStore to create a connection. TestNet; MainNet; BetaNet; LocalNet. const { connect } ...
Read more >web3.eth.accounts — web3.js 1.0.0 documentation
eth.accounts contains functions to generate Ethereum accounts and sign transactions and data. Note. This package has NOT been audited and might potentially be ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figured out something which is to assign the transaction.build() to an other variable and use the new one since it is a Transaction object.
let newTransaction = transaction.build()
the way you mentioned doesn’t work for me.@gate3 there are a couple of issues in your code:
await
innew StellarSdk.TransactionBuilder(sourceAccount,{
.build()
at the end of transaction builder - otherwise you end up callingsign
on the wrong class.fetchTimebounds
is not a static method on method, you should call it on aServer
instance.The following works: