Skip to content

Commit

Permalink
fix: log error; handle old android versions
Browse files Browse the repository at this point in the history
  • Loading branch information
siandreev committed Dec 16, 2024
1 parent d566cf0 commit 3f9bfab
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/web-swap-widget/src/components/SwapWidgetPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ export const SwapWidgetPage = () => {
const ctx = getTonkeeperInjectionContext()!;

try {
await ctx.sendTransaction({
const result = await ctx.sendTransaction({
source: ctx.address,
// legacy tonkeeper api, timestamp in ms
/**
* legacy tonkeeper api, timestamp in ms
*/
valid_until: params.valid_until * 1000,
messages: params.messages.map(m => ({
address: m.address,
Expand All @@ -95,8 +97,16 @@ export const SwapWidgetPage = () => {
: undefined
});

/**
old tonkeeper android versions return empty result instead of throwing
*/
if (!result) {
throw new Error('Operation failed');
}

onOpen();
} catch (e) {
console.error(e);
notifyError(toErrorMessage(e));
}
};
Expand Down

0 comments on commit 3f9bfab

Please sign in to comment.