How to catch exception or receive the result of transaction #14
Answered
by
barinbritva
nhannh-senspark
asked this question in
Q&A
-
Hi, I'm having some trouble and would love to get some help. My question is after calling GameFi.buy() or buyWithTon(), how do I know what the status and result are so I can proceed? I tried Cancel transaction and got the following error:
Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
barinbritva
Aug 16, 2024
Replies: 2 comments 2 replies
-
@nhannh-senspark hi, We can modify the try {
await this.gameFi.buyWithJetton({
amount: BigInt(price),
forwardAmount: BigInt(1),
forwardPayload: (window as any).Telegram.WebApp.initDataUnsafe.user.id + ':' + itemId
});
// Here we know transaction was sent. But it doesn't mean it received
// Receiving mechanism is implemented on the backend side, in `processTxsForever` function
} catch (error) {
console.error('Failed to buy an item.', error);
}
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
nhannh-senspark
-
Hi,I met the same question. How did you resolve this problem. Could you give me some help. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nhannh-senspark hi,
We can modify the
buy
method written at:https://github.com/ton-community/flappy-bird/blob/ff2287d668e1d41c76c02201f80c7aa7f1181789/workspaces/client/src/ui.ts#L96
await
tobuyWithJetton
call. In the next line we …