Skip to content

Commit

Permalink
Merge branch 'main' into feature/pro-layout-improvements
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/desktop/src/app/App.tsx
#	packages/uikit/package.json
#	packages/uikit/src/state/wallet.ts
#	yarn.lock
  • Loading branch information
siandreev committed Mar 25, 2024
2 parents c16295f + faf78ae commit 5f6858c
Show file tree
Hide file tree
Showing 292 changed files with 4,274 additions and 4,950 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_CN,ru,it,tr
with:
cmd: build:web
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_CN,ru,it,tr
with:
cmd: build:web
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.8.0",
"version": "3.8.1",
"description": "Your desktop wallet on The Open Network",
"main": ".webpack/main",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export const Loader: FC = () => {
standalone: true,
extension: false,
proFeatures: true,
experimental: true,
ios: false,
env: {
tgAuthBotId: REACT_APP_TG_BOT_ID
Expand Down
8 changes: 7 additions & 1 deletion apps/desktop/webpack.renderer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ export const rendererConfig: Configuration = {
'react-router-dom': path.resolve(__dirname, './node_modules/react-router-dom'),
'styled-components': path.resolve(__dirname, './node_modules/styled-components'),
'react-i18next': path.resolve(__dirname, './node_modules/react-i18next'),
'@tanstack/react-query': path.resolve(__dirname, './node_modules/@tanstack/react-query')
'@tanstack/react-query': path.resolve(
__dirname,
'./node_modules/@tanstack/react-query'
),
'@ton/core': path.resolve(__dirname, '../../packages/core/node_modules/@ton/core'),
'@ton/crypto': path.resolve(__dirname, '../../packages/core/node_modules/@ton/crypto'),
'@ton/ton': path.resolve(__dirname, '../../packages/core/node_modules/@ton/ton')
}
}
};
6 changes: 3 additions & 3 deletions apps/extension/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ module.exports = function override(config, env) {
config.resolve.alias = {
...config.resolve.alias,
react: path.resolve(__dirname, './node_modules/react'),
ton: path.resolve(__dirname, './node_modules/ton'),
'ton-core': path.resolve(__dirname, './node_modules/ton-core'),
'ton-crypto': path.resolve(__dirname, './node_modules/ton-crypto'),
'@ton/core': path.resolve(__dirname, '../../packages/core/node_modules/@ton/core'),
'@ton/crypto': path.resolve(__dirname, '../../packages/core/node_modules/@ton/crypto'),
'@ton/ton': path.resolve(__dirname, '../../packages/core/node_modules/@ton/ton'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
'react-router-dom': path.resolve(__dirname, './node_modules/react-router-dom'),
'styled-components': path.resolve(__dirname, './node_modules/styled-components'),
Expand Down
5 changes: 1 addition & 4 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/extension",
"version": "3.8.0",
"version": "3.8.1",
"author": "Nikita Kuznetsov <nkuz915@gmail.com>",
"description": "Your extension wallet on The Open Network",
"dependencies": {
Expand All @@ -19,9 +19,6 @@
"react-router-dom": "^6.4.5",
"stream-browserify": "^3.0.0",
"styled-components": "^6.1.1",
"ton": "^13.4.1",
"ton-core": "^0.49.0",
"ton-crypto": "^3.2.0",
"uuid": "^9.0.1",
"web-vitals": "^2.1.4",
"webextension-polyfill": "^0.10.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { useAccountState } from '@tonkeeper/uikit/dist/state/account';
import { useAuthState } from '@tonkeeper/uikit/dist/state/password';
import { useTonendpoint, useTonenpointConfig } from '@tonkeeper/uikit/dist/state/tonendpoint';
import { useActiveWallet } from '@tonkeeper/uikit/dist/state/wallet';
import {Container, GlobalStyle} from '@tonkeeper/uikit/dist/styles/globalStyle';
import { Container, GlobalStyle } from '@tonkeeper/uikit/dist/styles/globalStyle';
import React, { FC, PropsWithChildren, Suspense, useEffect, useMemo } from 'react';
import { MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
import styled, { css } from 'styled-components';
Expand Down Expand Up @@ -176,7 +176,7 @@ export const Loader: FC = React.memo(() => {
);
const { data: config } = useTonenpointConfig(tonendpoint);

const { data: tracker } = useAnalytics(sdk.storage, account, activeWallet);
const { data: tracker } = useAnalytics(sdk.storage, account, activeWallet, sdk.version);

if (!account || !auth || !config || lock === undefined) {
return (
Expand Down
9 changes: 8 additions & 1 deletion apps/extension/src/libs/hoolks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { WalletState } from '@tonkeeper/core/dist/entries/wallet';
import { throttle } from '@tonkeeper/core/dist/utils/common';
import { Analytics, AnalyticsGroup, toWalletType } from '@tonkeeper/uikit/dist/hooks/analytics';
import { Amplitude } from '@tonkeeper/uikit/dist/hooks/analytics/amplitude';
import { AptabaseExtension } from '@tonkeeper/uikit/dist/hooks/analytics/aptabase-extension';
import { QueryKey } from '@tonkeeper/uikit/dist/libs/queryKey';
import { useEffect } from 'react';
import { v4 as uuidv4 } from 'uuid';
Expand Down Expand Up @@ -34,7 +35,8 @@ export const useAppWidth = () => {
export const useAnalytics = (
storage: IStorage,
account?: AccountState,
wallet?: WalletState | null
wallet?: WalletState | null,
version?: string
) => {
return useQuery<Analytics>(
[QueryKey.analytics],
Expand All @@ -53,6 +55,11 @@ export const useAnalytics = (
}

const tracker = new AnalyticsGroup(
new AptabaseExtension(
process.env.REACT_APP_APTABASE_HOST!,
process.env.REACT_APP_APTABASE!,
version
),
new Amplitude(process.env.REACT_APP_AMPLITUDE!, userId)
);

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.8.0",
"version": "3.8.1",
"author": "Nikita Kuznetsov <nkuz915@gmail.com>",
"description": "Your web wallet on The Open Network",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { useAccountState } from '@tonkeeper/uikit/dist/state/account';
import { useAuthState } from '@tonkeeper/uikit/dist/state/password';
import { useTonendpoint, useTonenpointConfig } from '@tonkeeper/uikit/dist/state/tonendpoint';
import { useActiveWallet } from '@tonkeeper/uikit/dist/state/wallet';
import {Container, GlobalStyle} from '@tonkeeper/uikit/dist/styles/globalStyle';
import { Container, GlobalStyle } from '@tonkeeper/uikit/dist/styles/globalStyle';
import React, { FC, PropsWithChildren, Suspense, useEffect, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { BrowserRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -226,7 +226,7 @@ export const Loader: FC = () => {
>
<AppContext.Provider value={context}>
<Content activeWallet={activeWallet} lock={lock} standalone={standalone} />
<CopyNotification hideSimpleCopyNotifications />
<CopyNotification hideSimpleCopyNotifications={!standalone} />
<Suspense fallback={<></>}>
<QrScanner />
</Suspense>
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/libs/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const useAnalytics = (
[QueryKey.analytics],
async () => {
const tracker = new AnalyticsGroup(
new AptabaseWeb(import.meta.env.VITE_APP_APTABASE, `${version}-web`),
new AptabaseWeb(
import.meta.env.VITE_APP_APTABASE_HOST,
import.meta.env.VITE_APP_APTABASE,
version
),
new Gtag(import.meta.env.VITE_APP_MEASUREMENT_ID)
);

Expand Down
8 changes: 7 additions & 1 deletion apps/web/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ export default defineConfig({
'react-router-dom': path.resolve(__dirname, './node_modules/react-router-dom'),
'styled-components': path.resolve(__dirname, './node_modules/styled-components'),
'react-i18next': path.resolve(__dirname, './node_modules/react-i18next'),
'@tanstack/react-query': path.resolve(__dirname, './node_modules/@tanstack/react-query')
'@tanstack/react-query': path.resolve(
__dirname,
'./node_modules/@tanstack/react-query'
),
'@ton/core': path.resolve(__dirname, '../../packages/core/node_modules/@ton/core'),
'@ton/crypto': path.resolve(__dirname, '../../packages/core/node_modules/@ton/crypto'),
'@ton/ton': path.resolve(__dirname, '../../packages/core/node_modules/@ton/ton')
}
}
});
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"yarn-run-all": "^3.1.1"
},
"dependencies": {
"@ton/core": "0.54.0",
"@ton/crypto": "3.2.0",
"@ton/ton": "https://github.com/tonkeeper/tonkeeper-ton#build8",
"bignumber.js": "^9.1.1",
"ethers": "^6.6.5",
"query-string": "^8.1.0",
"ton": "^13.4.1",
"ton-core": "^0.49.0",
"ton-crypto": "^3.2.0",
"tweetnacl": "^1.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/core/src/entries/crypto/asset/basic-asset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from 'ton-core';
import { Address } from '@ton/core';
import { BLOCKCHAIN_NAME } from '../../crypto';

export interface BasicAsset {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/entries/crypto/asset/ton-asset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from 'ton-core';
import { Address } from '@ton/core';
import { JettonsBalances } from '../../../tonApiV2';
import { BLOCKCHAIN_NAME } from '../../crypto';
import { BasicAsset, packAssetId } from './basic-asset';
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/entries/send.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, MessageConsequences, WalletDNS } from '../tonApiV2';
import { Account, AccountEvent, WalletDNS } from '../tonApiV2';
import { EstimatePayload } from '../tronApi';
import { BLOCKCHAIN_NAME } from './crypto';
import { Asset } from './crypto/asset/asset';
Expand Down Expand Up @@ -54,8 +54,10 @@ export function isTronRecipientData(
export type TransferEstimation<T extends Asset = Asset> = {
fee: AssetAmount<T>;
payload: T extends TonAsset
? MessageConsequences
? TransferEstimationEvent
: T extends TronAsset
? EstimatePayload
: never;
};

export type TransferEstimationEvent = { event: AccountEvent };
7 changes: 6 additions & 1 deletion packages/core/src/entries/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export enum WalletVersion {
V3R1 = 0,
V3R2 = 1,
V4R1 = 2,
V4R2 = 3
V4R2 = 3,
W5 = 4
}

export const WalletVersions = [WalletVersion.V3R1, WalletVersion.V3R2, WalletVersion.V4R2];
Expand All @@ -20,6 +21,8 @@ export const walletVersionText = (version: WalletVersion) => {
return 'v3R2';
case WalletVersion.V4R2:
return 'v4R2';
case WalletVersion.W5:
return 'W5';
default:
return String(version);
}
Expand All @@ -33,6 +36,8 @@ export const walletVersionFromText = (value: string) => {
return WalletVersion.V3R2;
case 'v4R2':
return WalletVersion.V4R2;
case 'W5':
return WalletVersion.W5;
default:
throw new Error('Unsupported version');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/service/mnemonicService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mnemonicValidate } from 'ton-crypto';
import { mnemonicValidate } from '@ton/crypto';
import { AppKey } from '../Keys';
import { IStorage } from '../Storage';
import { decrypt } from './cryptoService';
Expand Down
22 changes: 11 additions & 11 deletions packages/core/src/service/proService.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { Address } from '@ton/core';
import BigNumber from 'bignumber.js';
import { Address } from 'ton-core';
import { AppKey } from '../Keys';
import { IStorage } from '../Storage';
import { APIConfig } from '../entries/apis';
import { BLOCKCHAIN_NAME } from '../entries/crypto';
import { AssetAmount } from '../entries/crypto/asset/asset-amount';
import { TON_ASSET } from '../entries/crypto/asset/constants';
import { DashboardCell, DashboardColumn } from '../entries/dashboard';
import { FiatCurrencies } from '../entries/fiat';
import { Language, localizationText } from '../entries/language';
import { ProState, ProSubscription, ProSubscriptionInvalid } from '../entries/pro';
import { RecipientData, TonRecipientData } from '../entries/send';
import { WalletState } from '../entries/wallet';
import { AccountsApi } from '../tonApiV2';
import {
InvoicesInvoice,
FiatCurrencies as FiatCurrenciesGenerated,
InvoiceStatus,
InvoicesInvoice,
Lang,
ProServiceService,
FiatCurrencies as FiatCurrenciesGenerated,
ProServiceDashboardColumnType,
ProServiceDashboardCellString,
ProServiceDashboardCellAddress,
ProServiceDashboardCellNumericCrypto,
ProServiceDashboardCellNumericFiat
ProServiceDashboardCellNumericFiat,
ProServiceDashboardCellString,
ProServiceDashboardColumnType,
ProServiceService
} from '../tonConsoleApi';
import { delay } from '../utils/common';
import { Flatten } from '../utils/types';
import { loginViaTG } from './telegramOauth';
import { createTonProofItem, tonConnectProofPayload } from './tonConnect/connectService';
import { walletStateInitFromState } from './wallet/contractService';
import { getWalletState } from './wallet/storeService';
import { loginViaTG } from './telegramOauth';
import { DashboardCell, DashboardColumn } from '../entries/dashboard';
import { FiatCurrencies } from '../entries/fiat';
import { Flatten } from '../utils/types';

export const setBackupState = async (storage: IStorage, state: ProSubscription) => {
await storage.set(AppKey.PRO_BACKUP, state);
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/service/tonConnect/connectService.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import queryString from 'query-string';
import { Address, beginCell, storeStateInit } from 'ton-core';
import { Address, beginCell, storeStateInit } from '@ton/core';
import {
getSecureRandomBytes,
keyPairFromSeed,
mnemonicToPrivateKey,
sha256_sync
} from 'ton-crypto';
} from '@ton/crypto';
import queryString from 'query-string';
import nacl from 'tweetnacl';
import { IStorage } from '../../Storage';
import { TonConnectError } from '../../entries/exception';
Expand Down
26 changes: 11 additions & 15 deletions packages/core/src/service/transfer/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BigNumber from 'bignumber.js';
import {
Address,
beginCell,
Expand All @@ -8,21 +7,18 @@ import {
internal,
storeMessage,
toNano
} from 'ton-core';
import { mnemonicToPrivateKey } from 'ton-crypto';
import { WalletContractV3R1 } from 'ton/dist/wallets/WalletContractV3R1';
import { WalletContractV3R2 } from 'ton/dist/wallets/WalletContractV3R2';
import { WalletContractV4 } from 'ton/dist/wallets/WalletContractV4';
} from '@ton/core';
import { mnemonicToPrivateKey } from '@ton/crypto';
import { WalletContractV3R1 } from '@ton/ton/dist/wallets/WalletContractV3R1';
import { WalletContractV3R2 } from '@ton/ton/dist/wallets/WalletContractV3R2';
import { WalletContractV4 } from '@ton/ton/dist/wallets/WalletContractV4';
import { WalletContractV5 } from '@ton/ton/dist/wallets/WalletContractV5';
import BigNumber from 'bignumber.js';
import nacl from 'tweetnacl';
import { APIConfig } from '../../entries/apis';
import { TransferEstimationEvent } from '../../entries/send';
import { WalletState } from '../../entries/wallet';
import {
Account,
AccountsApi,
LiteServerApi,
MessageConsequences,
WalletApi
} from '../../tonApiV2';
import { Account, AccountsApi, LiteServerApi, WalletApi } from '../../tonApiV2';
import { walletContractFromState } from '../wallet/contractService';

export enum SendMode {
Expand All @@ -35,7 +31,7 @@ export enum SendMode {
}

export const externalMessage = (
contract: WalletContractV3R1 | WalletContractV3R2 | WalletContractV4,
contract: WalletContractV3R1 | WalletContractV3R2 | WalletContractV4 | WalletContractV5,
seqno: number,
body: Cell
) => {
Expand Down Expand Up @@ -151,7 +147,7 @@ export const createTransferMessage = (
export async function getKeyPairAndSeqno(options: {
api: APIConfig;
walletState: WalletState;
fee: MessageConsequences;
fee: TransferEstimationEvent;
mnemonic: string[];
amount: BigNumber;
}) {
Expand Down
Loading

0 comments on commit 5f6858c

Please sign in to comment.