@tonconnect/sdk 3.2.0-beta.0 → 3.3.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 +128 -0
- package/dist/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/index.cjs +46 -7
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +47 -8
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +4 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -760,7 +760,7 @@ class BridgeGateway {
|
|
|
760
760
|
try {
|
|
761
761
|
bridgeIncomingMessage = JSON.parse(e.data);
|
|
762
762
|
}
|
|
763
|
-
catch (
|
|
763
|
+
catch (_) {
|
|
764
764
|
throw new TonConnectError(`Bridge message parse failed, message ${e.data}`);
|
|
765
765
|
}
|
|
766
766
|
this.listener(bridgeIncomingMessage);
|
|
@@ -2794,7 +2794,7 @@ class TonConnectTracker {
|
|
|
2794
2794
|
}
|
|
2795
2795
|
}
|
|
2796
2796
|
|
|
2797
|
-
const tonConnectSdkVersion = "3.
|
|
2797
|
+
const tonConnectSdkVersion = "3.3.0-beta.0";
|
|
2798
2798
|
|
|
2799
2799
|
class TonConnect {
|
|
2800
2800
|
constructor(options) {
|
|
@@ -3052,7 +3052,10 @@ class TonConnect {
|
|
|
3052
3052
|
this.checkConnection();
|
|
3053
3053
|
checkSignDataSupport(this.wallet.device.features, { requiredTypes: [data.type] });
|
|
3054
3054
|
this.tracker.trackDataSentForSignature(this.wallet, data);
|
|
3055
|
-
const
|
|
3055
|
+
const from = data.from || this.account.address;
|
|
3056
|
+
const network = data.network || this.account.chain;
|
|
3057
|
+
const response = yield this.provider.sendRequest(signDataParser.convertToRpcRequest(Object.assign(Object.assign({}, data), { from,
|
|
3058
|
+
network })), { onRequestSent: options === null || options === void 0 ? void 0 : options.onRequestSent, signal: abortController.signal });
|
|
3056
3059
|
if (signDataParser.isError(response)) {
|
|
3057
3060
|
this.tracker.trackDataSigningFailed(this.wallet, data, response.error.message, response.error.code);
|
|
3058
3061
|
return signDataParser.parseAndThrowError(response);
|
|
@@ -3116,7 +3119,7 @@ class TonConnect {
|
|
|
3116
3119
|
this.pauseConnection();
|
|
3117
3120
|
}
|
|
3118
3121
|
else {
|
|
3119
|
-
this.unPauseConnection().catch();
|
|
3122
|
+
this.unPauseConnection().catch(() => { });
|
|
3120
3123
|
}
|
|
3121
3124
|
});
|
|
3122
3125
|
}
|
|
@@ -3173,9 +3176,45 @@ class TonConnect {
|
|
|
3173
3176
|
}
|
|
3174
3177
|
};
|
|
3175
3178
|
if (tonProofItem) {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
+
let tonProof = undefined;
|
|
3180
|
+
try {
|
|
3181
|
+
if ('proof' in tonProofItem) { // success
|
|
3182
|
+
tonProof = {
|
|
3183
|
+
name: 'ton_proof',
|
|
3184
|
+
proof: {
|
|
3185
|
+
timestamp: tonProofItem.proof.timestamp,
|
|
3186
|
+
domain: {
|
|
3187
|
+
lengthBytes: tonProofItem.proof.domain.lengthBytes,
|
|
3188
|
+
value: tonProofItem.proof.domain.value,
|
|
3189
|
+
},
|
|
3190
|
+
payload: tonProofItem.proof.payload,
|
|
3191
|
+
signature: tonProofItem.proof.signature,
|
|
3192
|
+
}
|
|
3193
|
+
};
|
|
3194
|
+
}
|
|
3195
|
+
else if ('error' in tonProofItem) { // error
|
|
3196
|
+
tonProof = {
|
|
3197
|
+
name: 'ton_proof',
|
|
3198
|
+
error: {
|
|
3199
|
+
code: tonProofItem.error.code,
|
|
3200
|
+
message: tonProofItem.error.message,
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
}
|
|
3204
|
+
else {
|
|
3205
|
+
throw new TonConnectError('Invalid data format');
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
catch (e) {
|
|
3209
|
+
tonProof = {
|
|
3210
|
+
name: 'ton_proof',
|
|
3211
|
+
error: {
|
|
3212
|
+
code: protocol.CONNECT_ITEM_ERROR_CODES.UNKNOWN_ERROR,
|
|
3213
|
+
message: 'Invalid data format'
|
|
3214
|
+
}
|
|
3215
|
+
};
|
|
3216
|
+
}
|
|
3217
|
+
wallet.connectItems = { tonProof };
|
|
3179
3218
|
}
|
|
3180
3219
|
this.wallet = wallet;
|
|
3181
3220
|
this.tracker.trackConnectionCompleted(wallet);
|