@tonconnect/sdk 3.4.0-beta.1 → 3.4.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/index.cjs +574 -23
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +574 -25
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +79 -5
- package/package.json +3 -3
package/lib/types/index.d.ts
CHANGED
|
@@ -364,7 +364,9 @@ export declare function createRequestVersionEvent(): RequestVersionEvent;
|
|
|
364
364
|
*/
|
|
365
365
|
export declare function createResponseVersionEvent(version: string): ResponseVersionEvent;
|
|
366
366
|
|
|
367
|
-
export declare function createSelectedWalletEvent(version: Version, visibleWallets: string[], lastSelectedWallet:
|
|
367
|
+
export declare function createSelectedWalletEvent(version: Version, visibleWallets: string[], lastSelectedWallet: {
|
|
368
|
+
appName?: string;
|
|
369
|
+
} | null, walletsMenu: 'explicit_wallet' | 'main_screen' | 'other_wallets', redirectLink: string, redirectLinkType?: 'tg_link' | 'external_link', clientId?: string | null, traceId?: string | null): SelectedWalletEvent;
|
|
368
370
|
|
|
369
371
|
/**
|
|
370
372
|
* Create a transaction init event.
|
|
@@ -558,6 +560,31 @@ export declare interface IEnvironment {
|
|
|
558
560
|
getClientEnvironment(): 'web' | 'miniapp' | (string & {});
|
|
559
561
|
}
|
|
560
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Initializes the WalletConnect integration.
|
|
565
|
+
*
|
|
566
|
+
* This function must be called once before using WalletConnect features.
|
|
567
|
+
* A second call will throw an error to prevent accidental re-initialization.
|
|
568
|
+
*
|
|
569
|
+
* @param UniversalConnectorCls - A UniversalConnector class imported from '@reown/appkit-universal-connector'
|
|
570
|
+
* @param {WalletConnectOptions} walletConnectOptions - Configuration options used for initializing WalletConnect.
|
|
571
|
+
* @example
|
|
572
|
+
* import { UniversalConnector } from '@reown/appkit-universal-connector';
|
|
573
|
+
*
|
|
574
|
+
* initializeWalletConnect(UniversalConnector, {
|
|
575
|
+
* projectId: 'abcd1234abcd1234abcd1234abcd1234',
|
|
576
|
+
* metadata: {
|
|
577
|
+
* name: 'Demo DApp',
|
|
578
|
+
* icons: [
|
|
579
|
+
* 'https://example.com/my-icon.png'
|
|
580
|
+
* ],
|
|
581
|
+
* url: window.location.origin,
|
|
582
|
+
* description: 'Demo DApp'
|
|
583
|
+
* }
|
|
584
|
+
* });
|
|
585
|
+
*/
|
|
586
|
+
export declare function initializeWalletConnect(UniversalConnectorCls: Function, walletConnectOptions: WalletConnectOptions): void;
|
|
587
|
+
|
|
561
588
|
export declare function isConnectUrl(link: string | undefined): link is string;
|
|
562
589
|
|
|
563
590
|
export declare function isQaModeEnabled(): boolean;
|
|
@@ -586,6 +613,8 @@ export declare interface IStorage {
|
|
|
586
613
|
removeItem(key: string): Promise<void>;
|
|
587
614
|
}
|
|
588
615
|
|
|
616
|
+
export declare function isWalletConnectInitialized(): boolean;
|
|
617
|
+
|
|
589
618
|
/**
|
|
590
619
|
* Checks if `WalletInfo` is `WalletInfoInjectable` and dApp is opened inside this wallet's browser.
|
|
591
620
|
* @param value WalletInfo to check.
|
|
@@ -650,7 +679,7 @@ export declare interface ITonConnect {
|
|
|
650
679
|
connect<T extends WalletConnectionSource | Pick<WalletConnectionSourceHTTP, 'bridgeUrl'>[]>(wallet: T, request?: ConnectAdditionalRequest, options?: OptionalTraceable<{
|
|
651
680
|
openingDeadlineMS?: number;
|
|
652
681
|
signal?: AbortSignal;
|
|
653
|
-
}>): T extends WalletConnectionSourceJS ? void : string;
|
|
682
|
+
}>): T extends WalletConnectionSourceJS ? void : T extends WalletConnectionSourceWalletConnect ? void : string;
|
|
654
683
|
/**
|
|
655
684
|
* Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded.
|
|
656
685
|
*/
|
|
@@ -1058,12 +1087,12 @@ declare class TonConnect implements ITonConnect {
|
|
|
1058
1087
|
request?: ConnectAdditionalRequest;
|
|
1059
1088
|
openingDeadlineMS?: number;
|
|
1060
1089
|
signal?: AbortSignal;
|
|
1061
|
-
}>): T extends WalletConnectionSourceJS ? void : string;
|
|
1090
|
+
}>): T extends WalletConnectionSourceJS ? void : T extends WalletConnectionSourceWalletConnect ? void : string;
|
|
1062
1091
|
/** @deprecated use connect(wallet, options) instead */
|
|
1063
1092
|
connect<T extends WalletConnectionSource | Pick<WalletConnectionSourceHTTP, 'bridgeUrl'>[]>(wallet: T, request?: ConnectAdditionalRequest, options?: OptionalTraceable<{
|
|
1064
1093
|
openingDeadlineMS?: number;
|
|
1065
1094
|
signal?: AbortSignal;
|
|
1066
|
-
}>): T extends WalletConnectionSourceJS ? void : string;
|
|
1095
|
+
}>): T extends WalletConnectionSourceJS ? void : T extends WalletConnectionSourceWalletConnect ? void : string;
|
|
1067
1096
|
/**
|
|
1068
1097
|
* Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded.
|
|
1069
1098
|
*/
|
|
@@ -1436,7 +1465,7 @@ export declare class WalletAlreadyConnectedError extends TonConnectError {
|
|
|
1436
1465
|
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
1437
1466
|
}
|
|
1438
1467
|
|
|
1439
|
-
export declare type WalletConnectionSource = WalletConnectionSourceHTTP | WalletConnectionSourceJS;
|
|
1468
|
+
export declare type WalletConnectionSource = WalletConnectionSourceHTTP | WalletConnectionSourceJS | WalletConnectionSourceWalletConnect;
|
|
1440
1469
|
|
|
1441
1470
|
export declare interface WalletConnectionSourceHTTP {
|
|
1442
1471
|
/**
|
|
@@ -1456,6 +1485,51 @@ export declare interface WalletConnectionSourceJS {
|
|
|
1456
1485
|
jsBridgeKey: string;
|
|
1457
1486
|
}
|
|
1458
1487
|
|
|
1488
|
+
export declare interface WalletConnectionSourceWalletConnect {
|
|
1489
|
+
type: 'wallet-connect';
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* Metadata information about your application that will be displayed to users during WalletConnect pairing.
|
|
1494
|
+
*/
|
|
1495
|
+
export declare type WalletConnectMetadata = {
|
|
1496
|
+
/**
|
|
1497
|
+
* The name of your application.
|
|
1498
|
+
* @example 'My DApp'
|
|
1499
|
+
*/
|
|
1500
|
+
name: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* A brief description of your application.
|
|
1503
|
+
* @example 'My awesome TON DApp'
|
|
1504
|
+
*/
|
|
1505
|
+
description: string;
|
|
1506
|
+
/**
|
|
1507
|
+
* The URL of your application. This is used as the domain for ton_proof authentication.
|
|
1508
|
+
* @example 'https://mydapp.com'
|
|
1509
|
+
*/
|
|
1510
|
+
url: string;
|
|
1511
|
+
/**
|
|
1512
|
+
* An array of icon URLs representing your application. These icons are shown in wallet interfaces.
|
|
1513
|
+
* @example ['https://mydapp.com/icon-192.png', 'https://mydapp.com/icon-512.png']
|
|
1514
|
+
*/
|
|
1515
|
+
icons: string[];
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Configuration options for initializing WalletConnect integration.
|
|
1520
|
+
*/
|
|
1521
|
+
export declare type WalletConnectOptions = {
|
|
1522
|
+
/**
|
|
1523
|
+
* Your WalletConnect project ID. Get one at https://dashboard.reown.com/
|
|
1524
|
+
* @example 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6'
|
|
1525
|
+
*/
|
|
1526
|
+
projectId: string;
|
|
1527
|
+
/**
|
|
1528
|
+
* Metadata about your application that will be displayed to users.
|
|
1529
|
+
*/
|
|
1530
|
+
metadata: WalletConnectMetadata;
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1459
1533
|
export declare type WalletInfo = WalletInfoRemote | WalletInfoInjectable | (WalletInfoRemote & WalletInfoInjectable);
|
|
1460
1534
|
|
|
1461
1535
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ton-connect/sdk.git"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@tonconnect/isomorphic-eventsource": "0.0.2",
|
|
24
|
-
"@tonconnect/
|
|
25
|
-
"@tonconnect/
|
|
24
|
+
"@tonconnect/protocol": "2.4.0-beta.0",
|
|
25
|
+
"@tonconnect/isomorphic-fetch": "0.0.3"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"lib",
|