Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/swap-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovNikita committed Dec 19, 2024
2 parents 8a575c5 + cd5f30c commit 399181c
Show file tree
Hide file tree
Showing 17 changed files with 274 additions and 87 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Tonkeeper CD
name: CD
on:
push:
tags:
- v*
permissions:
contents: write

env:
node-version: 20.11.1

Expand Down Expand Up @@ -38,7 +41,7 @@ jobs:
REACT_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
REACT_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
REACT_APP_STONFI_REFERRAL_ADDRESS: ${{ secrets.REACT_APP_STONFI_REFERRAL_ADDRESS }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: electron*

steps:
Expand Down Expand Up @@ -147,7 +150,6 @@ jobs:
name: 'Tonkeeper ${{ github.ref_name }}'
draft: true
generate_release_notes: true
token: ${{ secrets.GH_TOKEN }}
files: |
${{ github.workspace }}/apps/extension/dist/tonkeeper_chrome_${{
github.ref_name }}.zip
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tonkeeper/desktop",
"license": "Apache-2.0",
"version": "3.26.1",
"version": "3.26.2",
"description": "Your desktop wallet on The Open Network",
"main": ".webpack/main",
"repository": {
Expand Down
13 changes: 11 additions & 2 deletions apps/desktop/src/app/components/DeepLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
import { useEffect, useState } from 'react';
import { sendBackground } from '../../libs/backgroudService';
import { TonConnectMessage } from '../../libs/message';
import { Account } from '@tonkeeper/core/dist/entries/account';
import { WalletId } from '@tonkeeper/core/dist/entries/wallet';

export const DeepLinkSubscription = () => {
const [params, setParams] = useState<TonConnectParams | null>(null);
Expand All @@ -16,11 +18,18 @@ export const DeepLinkSubscription = () => {
const { mutateAsync: responseConnectionAsync, reset: responseReset } =
useResponseConnectionMutation();

const handlerClose = async (replyItems?: ConnectItemReply[], manifest?: DAppManifest) => {
const handlerClose = async (
result: {
replyItems: ConnectItemReply[];
manifest: DAppManifest;
account: Account;
walletId: WalletId;
} | null
) => {
if (!params) return;
responseReset();
try {
await responseConnectionAsync({ params, replyItems, manifest });
await responseConnectionAsync({ params, result });
} finally {
setParams(null);
sendBackground({ king: 'reconnect' } as TonConnectMessage);
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/extension",
"version": "3.26.1",
"version": "3.26.2",
"author": "Ton APPS UK Limited <support@tonkeeper.com>",
"description": "Your extension wallet on The Open Network",
"dependencies": {
Expand Down
15 changes: 11 additions & 4 deletions apps/extension/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ConnectItemReply } from '@tonkeeper/core/dist/entries/tonConnect';
import { ConnectItemReply, DAppManifest } from "@tonkeeper/core/dist/entries/tonConnect";
import { delay } from '@tonkeeper/core/dist/utils/common';
import { TonConnectNotification } from '@tonkeeper/uikit/dist/components/connect/TonConnectNotification';
import { TonTransactionNotification } from '@tonkeeper/uikit/dist/components/connect/TonTransactionNotification';
import { useNotificationAnalytics } from '@tonkeeper/uikit/dist/hooks/amplitude';
import { useCallback, useEffect, useState } from 'react';
import { askBackground, sendBackground } from '../event';
import { NotificationData } from '../libs/event';
import { Account } from "@tonkeeper/core/dist/entries/account";
import { WalletId } from "@tonkeeper/core/dist/entries/wallet";

export const Notifications = () => {
const [data, setData] = useState<NotificationData | undefined>(undefined);
Expand Down Expand Up @@ -42,10 +44,15 @@ export const Notifications = () => {
<TonConnectNotification
origin={data?.origin}
params={data?.kind === 'tonConnectRequest' ? data.data : null}
handleClose={(payload?: ConnectItemReply[]) => {
handleClose={(result: {
replyItems: ConnectItemReply[];
manifest: DAppManifest;
account: Account;
walletId: WalletId;
} | null) => {
if (!data) return;
if (payload) {
sendBackground.message('approveRequest', { id: data.id, payload });
if (result) {
sendBackground.message('approveRequest', { id: data.id, payload: result });
} else {
sendBackground.message('rejectRequest', data.id);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/tablet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/tablet",
"version": "3.0.0",
"version": "3.1.0",
"license": "Apache-2.0",
"description": "Your tablet wallet on The Open Network",
"type": "module",
Expand Down
13 changes: 11 additions & 2 deletions apps/tablet/src/app/components/DeepLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from '@tonkeeper/uikit/dist/components/connect/connectHook';
import { useEffect, useState } from 'react';
import { subscribeToTonOrTonConnectUrlOpened, tonConnectSSE } from "../../libs/tonConnect";
import { Account } from "@tonkeeper/core/dist/entries/account";
import { WalletId } from "@tonkeeper/core/dist/entries/wallet";

export const DeepLinkSubscription = () => {
const [params, setParams] = useState<TonConnectParams | null>(null);
Expand All @@ -15,11 +17,18 @@ export const DeepLinkSubscription = () => {
const { mutateAsync: responseConnectionAsync, reset: responseReset } =
useResponseConnectionMutation();

const handlerClose = async (replyItems?: ConnectItemReply[], manifest?: DAppManifest) => {
const handlerClose = async (
result: {
replyItems: ConnectItemReply[];
manifest: DAppManifest;
account: Account;
walletId: WalletId;
} | null
) => {
if (!params) return;
responseReset();
try {
await responseConnectionAsync({ params, replyItems, manifest });
await responseConnectionAsync({ params, result });
} finally {
setParams(null);
await tonConnectSSE.reconnect();
Expand Down
2 changes: 1 addition & 1 deletion apps/twa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/twa",
"version": "3.26.1",
"version": "3.26.2",
"author": "Ton APPS UK Limited <support@tonkeeper.com>",
"description": "Your telegram mini app wallet on The Open Network",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/web",
"version": "3.26.1",
"version": "3.26.2",
"author": "Ton APPS UK Limited <support@tonkeeper.com>",
"description": "Your web wallet on The Open Network",
"dependencies": {
Expand Down
13 changes: 11 additions & 2 deletions apps/web/src/components/UrlTonConnectSubscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from "react-router-dom";
import { AppRoute } from "@tonkeeper/uikit/dist/libs/routes";
import { Account } from "@tonkeeper/core/dist/entries/account";
import { WalletId } from "@tonkeeper/core/dist/entries/wallet";

const TON_CONNECT_TRIGGER_PATH = '/ton-connect';

Expand All @@ -19,11 +21,18 @@ export const UrlTonConnectSubscription = () => {
useResponseConnectionMutation();


const handlerClose = async (replyItems?: ConnectItemReply[], manifest?: DAppManifest) => {
const handlerClose = async (
result: {
replyItems: ConnectItemReply[];
manifest: DAppManifest;
account: Account;
walletId: WalletId;
} | null
) => {
if (!params) return;
responseReset();
try {
await responseConnectionAsync({ params, replyItems, manifest });
await responseConnectionAsync({ params, result });
} finally {
setParams(null);
}
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/service/deeplinkingService.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
14 changes: 11 additions & 3 deletions packages/core/src/service/tonConnect/connectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import {
TonConnectAccount,
TonProofItemReplySuccess
} from '../../entries/tonConnect';
import { isStandardTonWallet, TonContract } from '../../entries/wallet';
import { isStandardTonWallet, TonContract, WalletId } from '../../entries/wallet';
import { TonWalletStandard, WalletVersion } from '../../entries/wallet';
import { accountsStorage } from '../accountsStorage';
import { getDevSettings } from '../devStorage';
import { walletContractFromState } from '../wallet/contractService';
import {
AccountConnection,
Expand Down Expand Up @@ -403,8 +402,17 @@ export const saveWalletTonConnect = async (options: {
replyItems: ConnectItemReply[];
appVersion: string;
webViewUrl?: string;
walletId?: WalletId;
}): Promise<ConnectEvent> => {
const wallet = options.account.activeTonWallet;
const wallet =
options.walletId !== undefined
? options.account.getTonWallet(options.walletId)
: options.account.activeTonWallet;

if (!wallet) {
throw new Error('Missing wallet');
}

await saveAccountConnection({
storage: options.storage,
wallet,
Expand Down
13 changes: 11 additions & 2 deletions packages/uikit/src/components/connect/ScanButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { useAppSdk } from '../../hooks/appSdk';
import { ScanIcon } from '../Icon';
import { TonConnectNotification } from './TonConnectNotification';
import { useResponseConnectionMutation, useGetConnectInfo } from './connectHook';
import { Account } from '@tonkeeper/core/dist/entries/account';
import { WalletId } from '@tonkeeper/core/dist/entries/wallet';

const ScanBlock = styled.div`
position: absolute;
Expand All @@ -32,11 +34,18 @@ export const ScanButton = () => {
[setParams, mutateAsync]
);

const handlerClose = async (replyItems?: ConnectItemReply[], manifest?: DAppManifest) => {
const handlerClose = async (
result: {
replyItems: ConnectItemReply[];
manifest: DAppManifest;
account: Account;
walletId: WalletId;
} | null
) => {
if (!params) return;
responseReset();
try {
await responseConnectionAsync({ params, replyItems, manifest });
await responseConnectionAsync({ params, result });
} finally {
setParams(null);
}
Expand Down
Loading

0 comments on commit 399181c

Please sign in to comment.