feat: implement simulateContractCall in frontend/src/lib/stellar.ts (closes #127) - #293
Open
Obiajulu-gif wants to merge 3 commits into
Open
Conversation
Trigger the Freighter authorization popup via the real freighter-api v3
surface (isConnected + requestAccess + getNetwork), normalizing the
{ error } result objects into descriptive thrown Errors for the
not-installed, locked, and user-rejected cases.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…stellar.ts Add a reusable simulateContractCall(contractId, method, args, source) that builds a TransactionBuilder against a loadable (non-signing) source account, runs server.simulateTransaction, and returns scValToNative(retval), throwing via SorobanRpc.Api.isSimulationError on failure. Update the useListings queryFn for the new getActiveListings signature. Add Jest coverage for connectFreighter and simulateContractCall success/error paths. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@Obiajulu-gif is attempting to deploy a commit to the Ada's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Obiajulu-gif Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added
simulateContractCall(contractId, method, args: xdr.ScVal[], sourceAddress)— a reusable read-only simulation helper: builds aTransactionBuilderagainst a loadable (non-signing) source account, runsserver.simulateTransaction, guards withSorobanRpc.Api.isSimulationError, and returnsscValToNative(result.result.retval). UpdateduseMarketplace.ts'suseListingsqueryFn for the newgetActiveListingssignature. Addedfrontend/src/lib/__tests__/stellar.test.tscoveringconnectFreighter(success/locked/rejected/not-installed) andsimulateContractCall(success + simulation-error paths).Builds on top of #125 (this branch includes that commit) — merge #125 first, or merge this one after it.
Verification:
npx jest src/lib/__tests__/stellar.test.tspasses;tsc --noEmitclean.Depends on #125 (branched from it). Target:
testnet-implementation. Closes #127.Test plan
tsc --noEmitclean (verified locally, re-confirm in CI)