@tonconnect/sdk 3.3.0-beta.1 → 3.3.0-beta.2

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/lib/esm/index.mjs CHANGED
@@ -412,12 +412,12 @@ function delay(timeout, options) {
412
412
  return __awaiter(this, void 0, void 0, function* () {
413
413
  return new Promise((resolve, reject) => {
414
414
  var _a, _b;
415
- if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
415
+ if ((_a = void 0 ) === null || _a === void 0 ? void 0 : _a.aborted) {
416
416
  reject(new TonConnectError('Delay aborted'));
417
417
  return;
418
418
  }
419
419
  const timeoutId = setTimeout(() => resolve(), timeout);
420
- (_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', () => {
420
+ (_b = void 0 ) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', () => {
421
421
  clearTimeout(timeoutId);
422
422
  reject(new TonConnectError('Delay aborted'));
423
423
  });
@@ -448,6 +448,7 @@ function createAbortController(signal) {
448
448
  * @param {T} fn - function to call
449
449
  * @param {CallForSuccessOptions} [options] - optional configuration options
450
450
  */
451
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
451
452
  function callForSuccess(fn, options) {
452
453
  return __awaiter(this, void 0, void 0, function* () {
453
454
  var _a, _b;
@@ -512,6 +513,7 @@ function logWarning(...args) {
512
513
  * @param {(...args: Args) => Promise<T>} createFn - A function that creates the resource.
513
514
  * @param {(resource: T) => Promise<void>} [disposeFn] - An optional function that disposes the resource.
514
515
  */
516
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
515
517
  function createResource(createFn, disposeFn) {
516
518
  let currentResource = null;
517
519
  let currentArgs = null;
@@ -2173,10 +2175,10 @@ function addQaModeStyles() {
2173
2175
  function startBannerObserver() {
2174
2176
  if (typeof window === 'undefined' || bannerObserver)
2175
2177
  return;
2176
- bannerObserver = new MutationObserver((mutations) => {
2177
- mutations.forEach((mutation) => {
2178
+ bannerObserver = new MutationObserver(mutations => {
2179
+ mutations.forEach(mutation => {
2178
2180
  if (mutation.type === 'childList') {
2179
- mutation.removedNodes.forEach((node) => {
2181
+ mutation.removedNodes.forEach(node => {
2180
2182
  if (node.nodeType === Node.ELEMENT_NODE) {
2181
2183
  const element = node;
2182
2184
  if (element.id === 'ton-connect-qa-banner' && qaModeEnabled) {
@@ -2208,7 +2210,8 @@ class WalletsListManager {
2208
2210
  this.walletsListCache = null;
2209
2211
  this.walletsListCacheCreationTimestamp = null;
2210
2212
  if (isQaModeEnabled()) {
2211
- this.walletsListSource = 'https://raw.githubusercontent.com/ton-connect/wallets-list-staging/refs/heads/main/wallets-v2.json';
2213
+ this.walletsListSource =
2214
+ 'https://raw.githubusercontent.com/ton-connect/wallets-list-staging/refs/heads/main/wallets-v2.json';
2212
2215
  }
2213
2216
  else {
2214
2217
  this.walletsListSource =
@@ -2917,7 +2920,7 @@ class TonConnectTracker {
2917
2920
  }
2918
2921
  }
2919
2922
 
2920
- const tonConnectSdkVersion = "3.3.0-beta.1";
2923
+ const tonConnectSdkVersion = "3.3.0-beta.2";
2921
2924
 
2922
2925
  const noBounceableTag = 0x51;
2923
2926
  const testOnlyTag = 0x80;
@@ -3003,7 +3006,9 @@ function parseUserFriendlyAddress(address) {
3003
3006
  const isBounceable = (tag & 0x40) !== 0;
3004
3007
  return {
3005
3008
  wc,
3006
- hex: Array.from(hex).map(b => b.toString(16).padStart(2, '0')).join(''),
3009
+ hex: Array.from(hex)
3010
+ .map(b => b.toString(16).padStart(2, '0'))
3011
+ .join(''),
3007
3012
  testOnly,
3008
3013
  isBounceable
3009
3014
  };
@@ -3100,18 +3105,21 @@ function hasExtraProperties(obj, allowedKeys) {
3100
3105
  return Object.keys(obj).some(key => !allowedKeys.includes(key));
3101
3106
  }
3102
3107
  function validateSendTransactionRequest(data) {
3108
+ // eslint-disable-next-line no-console
3103
3109
  console.log('[Validation Debug] validateSendTransactionRequest called');
3110
+ // eslint-disable-next-line no-console
3104
3111
  console.log('[Validation Debug] isQaModeEnabled():', isQaModeEnabled());
3105
3112
  if (!isValidObject(data)) {
3106
- const error = "Request must be an object";
3113
+ const error = 'Request must be an object';
3107
3114
  logValidationError(error);
3108
3115
  const shouldReturnNull = isQaModeEnabled();
3116
+ // eslint-disable-next-line no-console
3109
3117
  console.log('[Validation Debug] Should return null:', shouldReturnNull);
3110
3118
  return shouldReturnNull ? null : error;
3111
3119
  }
3112
3120
  const allowedKeys = ['validUntil', 'network', 'from', 'messages'];
3113
3121
  if (hasExtraProperties(data, allowedKeys)) {
3114
- const error = "Request contains extra properties";
3122
+ const error = 'Request contains extra properties';
3115
3123
  logValidationError(error);
3116
3124
  return isQaModeEnabled() ? null : error;
3117
3125
  }
@@ -3188,7 +3196,9 @@ function validateTransactionMessage(message, index) {
3188
3196
  return `Invalid 'extraCurrency' in message at index ${index}`;
3189
3197
  }
3190
3198
  for (const [key, value] of Object.entries(message.extraCurrency)) {
3191
- if (!INTEGER_REGEX.test(key) || typeof value !== 'string' || !POSITIVE_INTEGER_REGEX.test(value)) {
3199
+ if (!INTEGER_REGEX.test(key) ||
3200
+ typeof value !== 'string' ||
3201
+ !POSITIVE_INTEGER_REGEX.test(value)) {
3192
3202
  return `Invalid 'extraCurrency' format in message at index ${index}`;
3193
3203
  }
3194
3204
  }
@@ -3197,11 +3207,11 @@ function validateTransactionMessage(message, index) {
3197
3207
  }
3198
3208
  function validateConnectAdditionalRequest(data) {
3199
3209
  if (!isValidObject(data)) {
3200
- return "Request must be an object";
3210
+ return 'Request must be an object';
3201
3211
  }
3202
3212
  const allowedKeys = ['tonProof'];
3203
3213
  if (hasExtraProperties(data, allowedKeys)) {
3204
- return "Request contains extra properties";
3214
+ return 'Request contains extra properties';
3205
3215
  }
3206
3216
  if (data.tonProof !== undefined && !isValidString(data.tonProof)) {
3207
3217
  return "Invalid 'tonProof'";
@@ -3210,7 +3220,7 @@ function validateConnectAdditionalRequest(data) {
3210
3220
  }
3211
3221
  function validateSignDataPayload(data) {
3212
3222
  if (!isValidObject(data)) {
3213
- return "Payload must be an object";
3223
+ return 'Payload must be an object';
3214
3224
  }
3215
3225
  if (!isValidString(data.type)) {
3216
3226
  return "'type' is required";
@@ -3229,7 +3239,7 @@ function validateSignDataPayload(data) {
3229
3239
  function validateSignDataPayloadText(data) {
3230
3240
  const allowedKeys = ['type', 'text', 'network', 'from'];
3231
3241
  if (hasExtraProperties(data, allowedKeys)) {
3232
- return "Text payload contains extra properties";
3242
+ return 'Text payload contains extra properties';
3233
3243
  }
3234
3244
  if (!isValidString(data.text)) {
3235
3245
  return "'text' is required";
@@ -3247,7 +3257,7 @@ function validateSignDataPayloadText(data) {
3247
3257
  function validateSignDataPayloadBinary(data) {
3248
3258
  const allowedKeys = ['type', 'bytes', 'network', 'from'];
3249
3259
  if (hasExtraProperties(data, allowedKeys)) {
3250
- return "Binary payload contains extra properties";
3260
+ return 'Binary payload contains extra properties';
3251
3261
  }
3252
3262
  if (!isValidString(data.bytes)) {
3253
3263
  return "'bytes' is required";
@@ -3265,7 +3275,7 @@ function validateSignDataPayloadBinary(data) {
3265
3275
  function validateSignDataPayloadCell(data) {
3266
3276
  const allowedKeys = ['type', 'schema', 'cell', 'network', 'from'];
3267
3277
  if (hasExtraProperties(data, allowedKeys)) {
3268
- return "Cell payload contains extra properties";
3278
+ return 'Cell payload contains extra properties';
3269
3279
  }
3270
3280
  if (!isValidString(data.schema)) {
3271
3281
  return "'schema' is required";
@@ -3700,26 +3710,28 @@ class TonConnect {
3700
3710
  if (tonProofItem) {
3701
3711
  let tonProof = undefined;
3702
3712
  try {
3703
- if ('proof' in tonProofItem) { // success
3713
+ if ('proof' in tonProofItem) {
3714
+ // success
3704
3715
  tonProof = {
3705
3716
  name: 'ton_proof',
3706
3717
  proof: {
3707
3718
  timestamp: tonProofItem.proof.timestamp,
3708
3719
  domain: {
3709
3720
  lengthBytes: tonProofItem.proof.domain.lengthBytes,
3710
- value: tonProofItem.proof.domain.value,
3721
+ value: tonProofItem.proof.domain.value
3711
3722
  },
3712
3723
  payload: tonProofItem.proof.payload,
3713
- signature: tonProofItem.proof.signature,
3724
+ signature: tonProofItem.proof.signature
3714
3725
  }
3715
3726
  };
3716
3727
  }
3717
- else if ('error' in tonProofItem) { // error
3728
+ else if ('error' in tonProofItem) {
3729
+ // error
3718
3730
  tonProof = {
3719
3731
  name: 'ton_proof',
3720
3732
  error: {
3721
3733
  code: tonProofItem.error.code,
3722
- message: tonProofItem.error.message,
3734
+ message: tonProofItem.error.message
3723
3735
  }
3724
3736
  };
3725
3737
  }