diff --git a/packages/core/src/service/deeplinkingService.ts b/packages/core/src/service/deeplinkingService.ts index 6f6850332..030e8071a 100644 --- a/packages/core/src/service/deeplinkingService.ts +++ b/packages/core/src/service/deeplinkingService.ts @@ -1,6 +1,16 @@ import queryString from 'query-string'; import { seeIfValidTonAddress } from '../utils/common'; +export function seeIfBringToFrontLink(options: { url: string }) { + const { query } = queryString.parseUrl(options.url); + + if (typeof query.ret === 'string' && query.v == null) { + return { ret: query.ret }; + } else { + return null; + } +} + export interface TonTransferParams { address?: string; amount?: string; diff --git a/packages/uikit/src/components/connect/connectHook.ts b/packages/uikit/src/components/connect/connectHook.ts index 055806497..dd9e87ade 100644 --- a/packages/uikit/src/components/connect/connectHook.ts +++ b/packages/uikit/src/components/connect/connectHook.ts @@ -4,7 +4,10 @@ import { DAppManifest, SendTransactionAppRequest } from '@tonkeeper/core/dist/entries/tonConnect'; -import { parseTonTransferWithAddress } from '@tonkeeper/core/dist/service/deeplinkingService'; +import { + parseTonTransferWithAddress, + seeIfBringToFrontLink +} from '@tonkeeper/core/dist/service/deeplinkingService'; import { connectRejectResponse, parseTonConnect, @@ -28,6 +31,12 @@ export const useGetConnectInfo = () => { return useMutation(async url => { try { + const bring = seeIfBringToFrontLink({ url }); + if (bring != null) { + // TODO: save ret parameter and user after confirm transaction + return null; + } + const transfer = parseTonTransferWithAddress({ url }); if (transfer) {