-
Notifications
You must be signed in to change notification settings - Fork 318
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
PrepareTransaction returns an error: TypeError: expected a 'Transaction', got: [object Object] #1132
Comments
Note. The issue is only reproducible with the newest version of sdk package. |
Any chance you can share a repo with this issue so i can reproduce it? I am using stellar-sdk 13 on next js 15 but i've used it also on 14.I see your example contract but can you show me the example page and route from your nextjs app I'd love to try to figure out why it works in 12 not 13. Are you sure you imported sorobanrpc properly because the way it imports is different iirc |
@silence48 You are right, managed to solve the issue by splitting the code into server (prepare and send) and client (sign) actions. |
Glad to hear it worked! |
@silence48 and @jsmaxi i am having similar issues but mine is related to the fact that I am interacting on the server nestjs. |
@KoxyG Would it be possible for you to share your code repository example? |
Yes, this is it https://github.com/fastbuka/api.fastbuka.com/blob/koxy/src/payment/payment.service.ts |
Describe the bug
Installed and integrated @stellar/stellar-sdk package to my Nextjs project to test calling of contract's functions from the UI. However, calling prepareTransaction returns an error "TypeError: expected a 'Transaction', got: [object Object]". Please investigate what is wrong here.
Link to the example contract used: https://github.com/stellar/soroban-examples/blob/main/events/src/lib.rs
Nextjs:
What version are you on?
"@stellar/stellar-sdk": "^13.1.0"
"@stellar/freighter-api": "^4.0.0"
To Reproduce
Steps to reproduce the behavior:
Build and deploy the example contract (https://github.com/stellar/soroban-examples/blob/main/events/src/lib.rs).
Create or use any Nextjs project.
Install stellar sdk and freighter api dependencies mentioned above (the newest versions).
Create a new functional react component and paste the code snipped to call function "prepareTransaction".
Run the local server (npm run dev), open https://localhost:3000 and trigger "prepareTransaction".
Catch and observe the error in browser's console: "TypeError: expected a 'Transaction', got: [object Object]".
Also, make sure that simulateTransaction, signTransaction, sendTransaction functions work!
Expected behavior
Functions prepareTransaction, simulateTransaction, signTransaction, sendTransaction should work fine, unless something is wrong here. The code is similar to your example, so the transaction type and object should be accepted here. Besides, the error message could be more descriptive and help trace the issue.
Additional context
The text was updated successfully, but these errors were encountered: