@tonconnect/sdk 3.1.0 → 3.2.0-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/README.md +3 -0
- package/dist/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/index.cjs +166 -9
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +162 -12
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +101 -2
- package/package.json +2 -2
package/lib/types/index.d.ts
CHANGED
|
@@ -303,6 +303,12 @@ export declare function createConnectionRestoringStartedEvent(version: Version):
|
|
|
303
303
|
*/
|
|
304
304
|
export declare function createConnectionStartedEvent(version: Version): ConnectionStartedEvent;
|
|
305
305
|
|
|
306
|
+
export declare function createDataSentForSignatureEvent(version: Version, wallet: Wallet | null, data: SignDataPayload): DataSentForSignatureEvent;
|
|
307
|
+
|
|
308
|
+
export declare function createDataSignedEvent(version: Version, wallet: Wallet | null, data: SignDataPayload, signedData: SignDataResponse): DataSignedEvent;
|
|
309
|
+
|
|
310
|
+
export declare function createDataSigningFailedEvent(version: Version, wallet: Wallet | null, data: SignDataPayload, errorMessage: string, errorCode: SIGN_DATA_ERROR_CODES | void): DataSigningFailedEvent;
|
|
311
|
+
|
|
306
312
|
/**
|
|
307
313
|
* Create a disconnect event.
|
|
308
314
|
* @param version
|
|
@@ -375,6 +381,28 @@ export declare interface DappMetadata {
|
|
|
375
381
|
url: string;
|
|
376
382
|
}
|
|
377
383
|
|
|
384
|
+
export declare type DataSentForSignatureEvent = {
|
|
385
|
+
type: 'sign-data-request-initiated';
|
|
386
|
+
data: SignDataPayload;
|
|
387
|
+
} & ConnectionInfo;
|
|
388
|
+
|
|
389
|
+
export declare type DataSignedEvent = {
|
|
390
|
+
type: 'sign-data-request-completed';
|
|
391
|
+
is_success: true;
|
|
392
|
+
data: SignDataPayload;
|
|
393
|
+
signed_data: SignDataResponse;
|
|
394
|
+
} & ConnectionInfo;
|
|
395
|
+
|
|
396
|
+
export declare type DataSigningEvent = DataSentForSignatureEvent | DataSignedEvent | DataSigningFailedEvent;
|
|
397
|
+
|
|
398
|
+
export declare type DataSigningFailedEvent = {
|
|
399
|
+
type: 'sign-data-request-failed';
|
|
400
|
+
is_success: false;
|
|
401
|
+
error_message: string;
|
|
402
|
+
error_code: SIGN_DATA_ERROR_CODES | null;
|
|
403
|
+
data: SignDataPayload;
|
|
404
|
+
} & ConnectionInfo;
|
|
405
|
+
|
|
378
406
|
export declare interface DeviceInfo {
|
|
379
407
|
platform: 'iphone' | 'ipad' | 'android' | 'windows' | 'mac' | 'linux' | 'browser';
|
|
380
408
|
appName: string;
|
|
@@ -427,6 +455,8 @@ export declare interface EventDispatcher<T extends {
|
|
|
427
455
|
|
|
428
456
|
export declare type Feature = SendTransactionFeatureDeprecated | SendTransactionFeature | SignDataFeature;
|
|
429
457
|
|
|
458
|
+
export declare type FeatureName = Exclude<Feature, 'SendTransaction'>['name'];
|
|
459
|
+
|
|
430
460
|
/**
|
|
431
461
|
* Thrown when an error occurred while fetching the wallets list.
|
|
432
462
|
*/
|
|
@@ -555,6 +585,10 @@ export declare interface ITonConnect {
|
|
|
555
585
|
}): Promise<SendTransactionResponse>;
|
|
556
586
|
/** @deprecated use sendTransaction(transaction, options) instead */
|
|
557
587
|
sendTransaction(transaction: SendTransactionRequest, onRequestSent?: () => void): Promise<SendTransactionResponse>;
|
|
588
|
+
signData(data: SignDataPayload, options?: {
|
|
589
|
+
onRequestSent?: () => void;
|
|
590
|
+
signal?: AbortSignal;
|
|
591
|
+
}): Promise<SignDataResponse>;
|
|
558
592
|
}
|
|
559
593
|
|
|
560
594
|
/**
|
|
@@ -596,6 +630,7 @@ export declare type RequiredFeatures = {
|
|
|
596
630
|
* Required features for the send transaction feature.
|
|
597
631
|
*/
|
|
598
632
|
sendTransaction?: RequiredSendTransactionFeature;
|
|
633
|
+
signData?: RequiredSignDataFeature;
|
|
599
634
|
};
|
|
600
635
|
|
|
601
636
|
/**
|
|
@@ -612,6 +647,16 @@ export declare type RequiredSendTransactionFeature = {
|
|
|
612
647
|
extraCurrencyRequired?: boolean;
|
|
613
648
|
};
|
|
614
649
|
|
|
650
|
+
/**
|
|
651
|
+
* Required features for the sign data feature.
|
|
652
|
+
*/
|
|
653
|
+
export declare type RequiredSignDataFeature = {
|
|
654
|
+
/**
|
|
655
|
+
* Supported sign data types.
|
|
656
|
+
*/
|
|
657
|
+
types: SignDataType[];
|
|
658
|
+
};
|
|
659
|
+
|
|
615
660
|
/**
|
|
616
661
|
* Response TON Connect UI version.
|
|
617
662
|
*/
|
|
@@ -629,7 +674,7 @@ export declare type ResponseVersionEvent = {
|
|
|
629
674
|
/**
|
|
630
675
|
* User action events.
|
|
631
676
|
*/
|
|
632
|
-
export declare type SdkActionEvent = VersionEvent | ConnectionEvent | ConnectionRestoringEvent | DisconnectionEvent | TransactionSigningEvent;
|
|
677
|
+
export declare type SdkActionEvent = VersionEvent | ConnectionEvent | ConnectionRestoringEvent | DisconnectionEvent | TransactionSigningEvent | DataSigningEvent;
|
|
633
678
|
|
|
634
679
|
export declare enum SEND_TRANSACTION_ERROR_CODES {
|
|
635
680
|
UNKNOWN_ERROR = 0,
|
|
@@ -696,10 +741,47 @@ export declare interface SendTransactionResponse {
|
|
|
696
741
|
boc: string;
|
|
697
742
|
}
|
|
698
743
|
|
|
744
|
+
export declare enum SIGN_DATA_ERROR_CODES {
|
|
745
|
+
UNKNOWN_ERROR = 0,
|
|
746
|
+
BAD_REQUEST_ERROR = 1,
|
|
747
|
+
UNKNOWN_APP_ERROR = 100,
|
|
748
|
+
USER_REJECTS_ERROR = 300,
|
|
749
|
+
METHOD_NOT_SUPPORTED = 400
|
|
750
|
+
}
|
|
751
|
+
|
|
699
752
|
export declare type SignDataFeature = {
|
|
700
753
|
name: 'SignData';
|
|
754
|
+
types: SignDataType[];
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
export declare type SignDataPayload = SignDataPayloadText | SignDataPayloadBinary | SignDataPayloadCell;
|
|
758
|
+
|
|
759
|
+
export declare type SignDataPayloadBinary = {
|
|
760
|
+
type: 'binary';
|
|
761
|
+
bytes: string;
|
|
701
762
|
};
|
|
702
763
|
|
|
764
|
+
export declare type SignDataPayloadCell = {
|
|
765
|
+
type: 'cell';
|
|
766
|
+
schema: string;
|
|
767
|
+
cell: string;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
export declare type SignDataPayloadText = {
|
|
771
|
+
type: 'text';
|
|
772
|
+
text: string;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
export declare type SignDataResponse = {
|
|
776
|
+
signature: string;
|
|
777
|
+
address: string;
|
|
778
|
+
timestamp: number;
|
|
779
|
+
domain: string;
|
|
780
|
+
payload: SignDataPayload;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
export declare type SignDataType = 'text' | 'binary' | 'cell';
|
|
784
|
+
|
|
703
785
|
export declare interface TonAddressItem {
|
|
704
786
|
name: 'ton_addr';
|
|
705
787
|
}
|
|
@@ -804,6 +886,10 @@ declare class TonConnect implements ITonConnect {
|
|
|
804
886
|
}): Promise<SendTransactionResponse>;
|
|
805
887
|
/** @deprecated use sendTransaction(transaction, options) instead */
|
|
806
888
|
sendTransaction(transaction: SendTransactionRequest, onRequestSent?: () => void): Promise<SendTransactionResponse>;
|
|
889
|
+
signData(data: SignDataPayload, options?: {
|
|
890
|
+
onRequestSent?: () => void;
|
|
891
|
+
signal?: AbortSignal;
|
|
892
|
+
}): Promise<SignDataResponse>;
|
|
807
893
|
/**
|
|
808
894
|
* Disconnect form thw connected wallet and drop current session.
|
|
809
895
|
*/
|
|
@@ -1220,8 +1306,21 @@ export declare class WalletNotInjectedError extends TonConnectError {
|
|
|
1220
1306
|
* Thrown when wallet doesn't support requested feature method.
|
|
1221
1307
|
*/
|
|
1222
1308
|
export declare class WalletNotSupportFeatureError extends TonConnectError {
|
|
1309
|
+
cause: {
|
|
1310
|
+
requiredFeature: {
|
|
1311
|
+
featureName: FeatureName;
|
|
1312
|
+
value?: RequiredFeatures['sendTransaction'] | RequiredFeatures['signData'];
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1223
1315
|
protected get info(): string;
|
|
1224
|
-
constructor(
|
|
1316
|
+
constructor(message: string, options: {
|
|
1317
|
+
cause: {
|
|
1318
|
+
requiredFeature: {
|
|
1319
|
+
featureName: FeatureName;
|
|
1320
|
+
value?: RequiredFeatures['sendTransaction'] | RequiredFeatures['signData'];
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
});
|
|
1225
1324
|
}
|
|
1226
1325
|
|
|
1227
1326
|
export declare class WalletsListManager {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-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.
|
|
29
|
+
"@tonconnect/protocol": "^2.3.0-beta.0"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"lib",
|