@tonconnect/sdk 3.0.7-alpha.1 → 3.0.8-beta.0
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 +119 -70
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +117 -71
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +67 -2
- package/package.json +2 -2
package/lib/types/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export declare enum CHAIN {
|
|
|
70
70
|
TESTNET = "-3"
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export declare function checkRequiredWalletFeatures(features: Feature[], walletsRequiredFeatures: RequireFeature[] | ((features: Feature[]) => boolean)): boolean;
|
|
74
|
+
|
|
73
75
|
export declare enum CONNECT_EVENT_ERROR_CODES {
|
|
74
76
|
UNKNOWN_ERROR = 0,
|
|
75
77
|
BAD_REQUEST_ERROR = 1,
|
|
@@ -92,6 +94,15 @@ export declare interface ConnectAdditionalRequest {
|
|
|
92
94
|
tonProof?: string;
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
export declare interface ConnectEventSuccess {
|
|
98
|
+
event: 'connect';
|
|
99
|
+
id: number;
|
|
100
|
+
payload: {
|
|
101
|
+
items: ConnectItemReply[];
|
|
102
|
+
device: DeviceInfo;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
95
106
|
/**
|
|
96
107
|
* Successful connection event when a user successfully connected a wallet.
|
|
97
108
|
*/
|
|
@@ -243,6 +254,8 @@ export declare type ConnectionStartedEvent = {
|
|
|
243
254
|
|
|
244
255
|
export declare type ConnectItem = TonAddressItem | TonProofItem;
|
|
245
256
|
|
|
257
|
+
export declare type ConnectItemReply = TonAddressItemReply | TonProofItemReply;
|
|
258
|
+
|
|
246
259
|
export declare type ConnectItemReplyError<T> = {
|
|
247
260
|
name: T;
|
|
248
261
|
error: {
|
|
@@ -575,6 +588,14 @@ export declare type RequestVersionEvent = {
|
|
|
575
588
|
type: 'request-version';
|
|
576
589
|
};
|
|
577
590
|
|
|
591
|
+
export declare type RequireFeature = RequireSendTransactionFeature;
|
|
592
|
+
|
|
593
|
+
export declare type RequireSendTransactionFeature = {
|
|
594
|
+
name: 'SendTransaction';
|
|
595
|
+
minMessages?: number;
|
|
596
|
+
extraCurrencyRequired?: boolean;
|
|
597
|
+
};
|
|
598
|
+
|
|
578
599
|
/**
|
|
579
600
|
* Response TON Connect UI version.
|
|
580
601
|
*/
|
|
@@ -667,6 +688,14 @@ export declare interface TonAddressItem {
|
|
|
667
688
|
name: 'ton_addr';
|
|
668
689
|
}
|
|
669
690
|
|
|
691
|
+
export declare interface TonAddressItemReply {
|
|
692
|
+
name: 'ton_addr';
|
|
693
|
+
address: string;
|
|
694
|
+
network: CHAIN;
|
|
695
|
+
walletStateInit: string;
|
|
696
|
+
publicKey: string;
|
|
697
|
+
}
|
|
698
|
+
|
|
670
699
|
declare class TonConnect implements ITonConnect {
|
|
671
700
|
private static readonly walletsList;
|
|
672
701
|
/**
|
|
@@ -695,6 +724,7 @@ declare class TonConnect implements ITonConnect {
|
|
|
695
724
|
private provider;
|
|
696
725
|
private statusChangeSubscriptions;
|
|
697
726
|
private statusChangeErrorSubscriptions;
|
|
727
|
+
private readonly walletsRequiredFeatures;
|
|
698
728
|
private abortController?;
|
|
699
729
|
/**
|
|
700
730
|
* Shows if the wallet is connected right now.
|
|
@@ -788,11 +818,11 @@ export default TonConnect;
|
|
|
788
818
|
/**
|
|
789
819
|
* Base class for TonConnect errors. You can check if the error was triggered by the @tonconnect/sdk using `err instanceof TonConnectError`.
|
|
790
820
|
*/
|
|
791
|
-
export declare class TonConnectError extends Error {
|
|
821
|
+
export declare class TonConnectError<T = unknown> extends Error {
|
|
792
822
|
private static prefix;
|
|
793
823
|
protected get info(): string;
|
|
794
824
|
constructor(message?: string, options?: {
|
|
795
|
-
cause?:
|
|
825
|
+
cause?: T;
|
|
796
826
|
});
|
|
797
827
|
}
|
|
798
828
|
|
|
@@ -824,6 +854,10 @@ export declare interface TonConnectOptions {
|
|
|
824
854
|
* @default Infinity
|
|
825
855
|
*/
|
|
826
856
|
walletsListCacheTTLMs?: number;
|
|
857
|
+
/**
|
|
858
|
+
* Required features for wallets. If wallet doesn't support required features, it will be disabled.
|
|
859
|
+
*/
|
|
860
|
+
walletsRequiredFeatures?: RequireFeature[] | ((features: Feature[]) => boolean);
|
|
827
861
|
/**
|
|
828
862
|
* Allows to disable auto pause/unpause SSE connection on 'document.visibilitychange' event. It is not recommended to change default behaviour.
|
|
829
863
|
*/
|
|
@@ -1063,6 +1097,10 @@ export declare interface WalletInfoBase {
|
|
|
1063
1097
|
* Info or landing page of your wallet. May be useful for TON newcomers.
|
|
1064
1098
|
*/
|
|
1065
1099
|
aboutUrl: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* List of features supported by the wallet.
|
|
1102
|
+
*/
|
|
1103
|
+
features?: Feature[];
|
|
1066
1104
|
/**
|
|
1067
1105
|
* OS and browsers where the wallet could be installed
|
|
1068
1106
|
*/
|
|
@@ -1129,6 +1167,23 @@ export declare interface WalletInfoRemote extends WalletInfoBase {
|
|
|
1129
1167
|
bridgeUrl: string;
|
|
1130
1168
|
}
|
|
1131
1169
|
|
|
1170
|
+
/**
|
|
1171
|
+
* Thrown when wallet can't get manifest by passed manifestUrl.
|
|
1172
|
+
*/
|
|
1173
|
+
export declare class WalletMissingRequiredFeaturesError extends TonConnectError<{
|
|
1174
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1175
|
+
}> {
|
|
1176
|
+
cause: {
|
|
1177
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1178
|
+
};
|
|
1179
|
+
protected get info(): string;
|
|
1180
|
+
constructor(message: string, options: {
|
|
1181
|
+
cause: {
|
|
1182
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1183
|
+
};
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1132
1187
|
/**
|
|
1133
1188
|
* Thrown when send transaction or other protocol methods called while wallet is not connected.
|
|
1134
1189
|
*/
|
|
@@ -1145,14 +1200,24 @@ export declare class WalletNotInjectedError extends TonConnectError {
|
|
|
1145
1200
|
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
1146
1201
|
}
|
|
1147
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* Thrown when wallet doesn't support requested feature method.
|
|
1205
|
+
*/
|
|
1206
|
+
export declare class WalletNotSupportFeatureError extends TonConnectError {
|
|
1207
|
+
protected get info(): string;
|
|
1208
|
+
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1148
1211
|
export declare class WalletsListManager {
|
|
1149
1212
|
private walletsListCache;
|
|
1150
1213
|
private walletsListCacheCreationTimestamp;
|
|
1151
1214
|
private readonly cacheTTLMs;
|
|
1152
1215
|
private readonly walletsListSource;
|
|
1216
|
+
private readonly checkRequiredFeatures;
|
|
1153
1217
|
constructor(options?: {
|
|
1154
1218
|
walletsListSource?: string;
|
|
1155
1219
|
cacheTTLMs?: number;
|
|
1220
|
+
walletsRequiredFeatures?: RequireFeature[] | ((features: Feature[]) => boolean);
|
|
1156
1221
|
});
|
|
1157
1222
|
getWallets(): Promise<WalletInfo[]>;
|
|
1158
1223
|
getEmbeddedWallet(): Promise<WalletInfoCurrentlyEmbedded | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8-beta.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx rimraf types-dist && npx rimraf lib && npx rollup -c rollup.config.mjs && ttsc --project tsconfig.declarations.json && api-extractor run && npx rimraf types-dist && npx rimraf dist && npx webpack --config webpack.config.js",
|
|
6
6
|
"test": "vitest run"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@tonconnect/isomorphic-eventsource": "^0.0.2",
|
|
28
28
|
"@tonconnect/isomorphic-fetch": "^0.0.3",
|
|
29
|
-
"@tonconnect/protocol": "^2.2.7
|
|
29
|
+
"@tonconnect/protocol": "^2.2.7"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"lib",
|