Repository navigation
Frontend guide: use pollTransaction and returnValue in the counter example - #2975
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
🤖 Automated message from the Stellar Triage Bot. Reviewing my own PR for #2960, which @oceans404 called me in on. Verified against SDK v17.4.0 source: |
ElliotFriend
left a comment
There was a problem hiding this comment.
Thanks! The switch to pollTransaction and returnValue is right for v17. One small change before merge:
frontend-guide.mdx:638: whenpollTransactionruns out of attempts it returnsNOT_FOUND, which means the result is unknown, not that the transaction failed. Right now that case throws "Transaction did not succeed: NOT_FOUND". Please giveNOT_FOUNDits own message (something like "not confirmed yet, check again before resending") and link Submit a transaction and wait for the full handling. That keeps this page consistent with the warning in #2977.
|
/triage |
oceans404
left a comment
There was a problem hiding this comment.
Ran the counter example on SDK 17.4.0 against a local network: increment returns 1 then 2 as numbers, and the events lookup reads back 2. The current page throws on .v4() and .u32(), so this fixes a real break.
Generated by Claude Code
|
🤖 Automated message from the Stellar Triage Bot. Back on this because @ElliotFriend asked with /triage and requested changes. Done in 1e8a128:
I also merged main (bd98545). It brings in the |
🤖 Automated message from the Stellar Triage Bot.
Closes #2960
Working this because @oceans404 added bot:take. The counter example in "Interacting with smart contracts" breaks on
@stellar/stellar-sdkv17. This PR takes the issue's minimal option: use the SDK's polling and the parsed return value.Changes in
docs/build/guides/dapps/frontend-guide.mdx:whileloop withserver.pollTransaction(hash, { attempts: 30 }).sendTransactionstatus.TRY_AGAIN_LATERandERRORstop with a readable error.PENDINGandDUPLICATEgo on to polling.getResponse.returnValuewithscValToNative. This removes.v4(),.sorobanMeta()and.u32(), which throw in v17.Errorwith the status, not rawresultXdr.e.value.u32()in the events snippet on the same page. It throws in v17 too.Verified against v17.4.0 source:
TransactionMetaV4Arm.v4andScValu32are properties now (transaction-meta.tsL228,sc-val.tsL561).pollTransactionexists (rpc/server.tsL1240).returnValueis on the success response (rpc/api.tsL139).scValToNativeandrpc.Apiare exported. The same calls also work on v16.Not in this PR:
stellar contract bindings typescriptline (separate issue, per Frontend guide: replace the hand-written send and poll code in "Interacting with smart contracts" #2960).Checks:
pnpm installis not available in this environment, sopnpm format:mdx,pnpm checkandpnpm check:linksdid not run. I kept every added line within prettier's 80 columns and each paragraph on one line. Please rely on the CIchecksjob. I did not run the example against testnet.