@tonconnect/sdk 3.0.7 → 3.1.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 +96 -50
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +94 -51
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +81 -2
- package/package.json +1 -1
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?: RequiredFeatures): 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,30 @@ export declare type RequestVersionEvent = {
|
|
|
575
588
|
type: 'request-version';
|
|
576
589
|
};
|
|
577
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Required features for wallets.
|
|
593
|
+
*/
|
|
594
|
+
export declare type RequiredFeatures = {
|
|
595
|
+
/**
|
|
596
|
+
* Required features for the send transaction feature.
|
|
597
|
+
*/
|
|
598
|
+
sendTransaction?: RequiredSendTransactionFeature;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Required features for the send transaction feature.
|
|
603
|
+
*/
|
|
604
|
+
export declare type RequiredSendTransactionFeature = {
|
|
605
|
+
/**
|
|
606
|
+
* Minimum number of messages to send.
|
|
607
|
+
*/
|
|
608
|
+
minMessages?: number;
|
|
609
|
+
/**
|
|
610
|
+
* Whether extra currency is required.
|
|
611
|
+
*/
|
|
612
|
+
extraCurrencyRequired?: boolean;
|
|
613
|
+
};
|
|
614
|
+
|
|
578
615
|
/**
|
|
579
616
|
* Response TON Connect UI version.
|
|
580
617
|
*/
|
|
@@ -667,6 +704,14 @@ export declare interface TonAddressItem {
|
|
|
667
704
|
name: 'ton_addr';
|
|
668
705
|
}
|
|
669
706
|
|
|
707
|
+
export declare interface TonAddressItemReply {
|
|
708
|
+
name: 'ton_addr';
|
|
709
|
+
address: string;
|
|
710
|
+
network: CHAIN;
|
|
711
|
+
walletStateInit: string;
|
|
712
|
+
publicKey: string;
|
|
713
|
+
}
|
|
714
|
+
|
|
670
715
|
declare class TonConnect implements ITonConnect {
|
|
671
716
|
private static readonly walletsList;
|
|
672
717
|
/**
|
|
@@ -695,6 +740,7 @@ declare class TonConnect implements ITonConnect {
|
|
|
695
740
|
private provider;
|
|
696
741
|
private statusChangeSubscriptions;
|
|
697
742
|
private statusChangeErrorSubscriptions;
|
|
743
|
+
private readonly walletsRequiredFeatures;
|
|
698
744
|
private abortController?;
|
|
699
745
|
/**
|
|
700
746
|
* Shows if the wallet is connected right now.
|
|
@@ -788,11 +834,11 @@ export default TonConnect;
|
|
|
788
834
|
/**
|
|
789
835
|
* Base class for TonConnect errors. You can check if the error was triggered by the @tonconnect/sdk using `err instanceof TonConnectError`.
|
|
790
836
|
*/
|
|
791
|
-
export declare class TonConnectError extends Error {
|
|
837
|
+
export declare class TonConnectError<T = unknown> extends Error {
|
|
792
838
|
private static prefix;
|
|
793
839
|
protected get info(): string;
|
|
794
840
|
constructor(message?: string, options?: {
|
|
795
|
-
cause?:
|
|
841
|
+
cause?: T;
|
|
796
842
|
});
|
|
797
843
|
}
|
|
798
844
|
|
|
@@ -824,6 +870,10 @@ export declare interface TonConnectOptions {
|
|
|
824
870
|
* @default Infinity
|
|
825
871
|
*/
|
|
826
872
|
walletsListCacheTTLMs?: number;
|
|
873
|
+
/**
|
|
874
|
+
* Required features for wallets. If wallet doesn't support required features, it will be disabled.
|
|
875
|
+
*/
|
|
876
|
+
walletsRequiredFeatures?: RequiredFeatures;
|
|
827
877
|
/**
|
|
828
878
|
* Allows to disable auto pause/unpause SSE connection on 'document.visibilitychange' event. It is not recommended to change default behaviour.
|
|
829
879
|
*/
|
|
@@ -1063,6 +1113,10 @@ export declare interface WalletInfoBase {
|
|
|
1063
1113
|
* Info or landing page of your wallet. May be useful for TON newcomers.
|
|
1064
1114
|
*/
|
|
1065
1115
|
aboutUrl: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* List of features supported by the wallet.
|
|
1118
|
+
*/
|
|
1119
|
+
features?: Feature[];
|
|
1066
1120
|
/**
|
|
1067
1121
|
* OS and browsers where the wallet could be installed
|
|
1068
1122
|
*/
|
|
@@ -1129,6 +1183,23 @@ export declare interface WalletInfoRemote extends WalletInfoBase {
|
|
|
1129
1183
|
bridgeUrl: string;
|
|
1130
1184
|
}
|
|
1131
1185
|
|
|
1186
|
+
/**
|
|
1187
|
+
* Thrown when wallet can't get manifest by passed manifestUrl.
|
|
1188
|
+
*/
|
|
1189
|
+
export declare class WalletMissingRequiredFeaturesError extends TonConnectError<{
|
|
1190
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1191
|
+
}> {
|
|
1192
|
+
cause: {
|
|
1193
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1194
|
+
};
|
|
1195
|
+
protected get info(): string;
|
|
1196
|
+
constructor(message: string, options: {
|
|
1197
|
+
cause: {
|
|
1198
|
+
connectEvent: ConnectEventSuccess['payload'];
|
|
1199
|
+
};
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1132
1203
|
/**
|
|
1133
1204
|
* Thrown when send transaction or other protocol methods called while wallet is not connected.
|
|
1134
1205
|
*/
|
|
@@ -1145,6 +1216,14 @@ export declare class WalletNotInjectedError extends TonConnectError {
|
|
|
1145
1216
|
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
1146
1217
|
}
|
|
1147
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* Thrown when wallet doesn't support requested feature method.
|
|
1221
|
+
*/
|
|
1222
|
+
export declare class WalletNotSupportFeatureError extends TonConnectError {
|
|
1223
|
+
protected get info(): string;
|
|
1224
|
+
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1148
1227
|
export declare class WalletsListManager {
|
|
1149
1228
|
private walletsListCache;
|
|
1150
1229
|
private walletsListCacheCreationTimestamp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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"
|