diff --git a/packages/core/src/service/tonConnect/connectService.ts b/packages/core/src/service/tonConnect/connectService.ts index 6852fa763..efa587648 100644 --- a/packages/core/src/service/tonConnect/connectService.ts +++ b/packages/core/src/service/tonConnect/connectService.ts @@ -385,21 +385,36 @@ export const tonDisconnectRequest = async (options: { storage: IStorage; webView await disconnectAccountConnection({ ...options, wallet: connection.wallet }); }; +const getMaxMessages = (account: Account) => { + if (account.type === 'ledger') { + return 1; + } + + const wallet = account.activeTonWallet; + + return isStandardTonWallet(wallet) && wallet.version === WalletVersion.V5R1 ? 255 : 4; +}; + export const saveWalletTonConnect = async (options: { storage: IStorage; - wallet: TonContract; + account: Account; manifest: DAppManifest; params: TonConnectParams; replyItems: ConnectItemReply[]; appVersion: string; webViewUrl?: string; }): Promise => { - await saveAccountConnection(options); + const wallet = options.account.activeTonWallet; + await saveAccountConnection({ + storage: options.storage, + wallet, + manifest: options.manifest, + params: options.params, + webViewUrl: options.webViewUrl + }); + + const maxMessages = getMaxMessages(options.account); - const maxMessages = - isStandardTonWallet(options.wallet) && options.wallet.version === WalletVersion.V5R1 - ? 255 - : 4; return { id: Date.now(), event: 'connect', diff --git a/packages/uikit/src/components/connect/connectHook.ts b/packages/uikit/src/components/connect/connectHook.ts index bdc13b271..fe96149a5 100644 --- a/packages/uikit/src/components/connect/connectHook.ts +++ b/packages/uikit/src/components/connect/connectHook.ts @@ -87,7 +87,7 @@ export const useResponseConnectionMutation = () => { if (replyItems && manifest && data) { const response = await saveWalletTonConnect({ storage: sdk.storage, - wallet: data.activeTonWallet, + account: data, manifest, params, replyItems,