@stellar/typescript-wallet-sdk 3.0.0-beta.1779920488639 → 3.0.1

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/CHANGELOG.MD CHANGED
@@ -1,3 +1,10 @@
1
+ # Release notes - Typescript Wallet SDK - 3.0.1
2
+
3
+ ### Fixed
4
+ * SEP-10: verify the auth server returns the same challenge body after `client_domain` re-signing, instead of trusting a server-supplied transaction (#237)
5
+ * `submitWithFeeIncrease`: forward `maxFee` across recursive retries so the cap is enforced on every retry, not just the first (#238)
6
+ * `submitTransaction`: replace the unbounded recursive 504 retry with a bounded equal-jitter exponential backoff loop, avoiding stack overflow during sustained Horizon outages (#238)
7
+
1
8
  # Release notes - Typescript Wallet SDK - 3.0.0
2
9
 
3
10
  ### BREAKING CHANGES
package/lib/bundle.js CHANGED
@@ -3107,16 +3107,27 @@ var Stellar = /** @class */ (function () {
3107
3107
  return stellar_sdk_1.TransactionBuilder.buildFeeBumpTransaction(feeAddress.keypair, (baseFee || this.cfg.stellar.baseFee).toString(), transaction, transaction.networkPassphrase);
3108
3108
  };
3109
3109
  /**
3110
- * Submits a signed transaction to the server. If the submission fails with status
3111
- * 504 indicating a timeout error, it will automatically retry.
3110
+ * Submits a signed transaction to Horizon.
3111
+ *
3112
+ * On HTTP 504 (timeout), retries with exponential backoff up to
3113
+ * {@link SUBMIT_504_MAX_RETRIES} times. Any non-504 error is rethrown
3114
+ * immediately without retrying.
3115
+ *
3112
3116
  * @param {Transaction|FeeBumpTransaction} signedTransaction - The signed transaction to submit.
3113
- * @returns {boolean} `true` if the transaction was successfully submitted.
3114
- * @throws {TransactionSubmitFailedError} If the transaction submission fails.
3117
+ * @returns {boolean} `true` if Horizon confirmed the submission as successful.
3118
+ * @throws {TransactionSubmitFailedError} If Horizon responded with a non-successful
3119
+ * submission result (the transaction reached Horizon but was rejected).
3120
+ * @throws The underlying 504 error if every retry attempt timed out. In this
3121
+ * case the transaction's on-chain status is **indeterminate** — Horizon may
3122
+ * have ingested it on the final attempt without responding in time. Callers
3123
+ * should poll the transaction hash to determine the actual outcome rather
3124
+ * than resubmit blindly; resubmitting a signed transaction with the same
3125
+ * sequence number will fail with `tx_bad_seq` once the original lands.
3115
3126
  */
3116
3127
  Stellar.prototype.submitTransaction = function (signedTransaction) {
3117
3128
  var _a;
3118
3129
  return __awaiter(this, void 0, void 0, function () {
3119
- var lastError, attempt, response, e_2, cappedDelay, jitter;
3130
+ var lastError, attempt, response, e_2, cappedDelay, half;
3120
3131
  return __generator(this, function (_b) {
3121
3132
  switch (_b.label) {
3122
3133
  case 0:
@@ -3144,8 +3155,8 @@ var Stellar = /** @class */ (function () {
3144
3155
  return [3 /*break*/, 7];
3145
3156
  }
3146
3157
  cappedDelay = Math.min(SUBMIT_504_BASE_DELAY_MS * Math.pow(2, attempt), SUBMIT_504_MAX_DELAY_MS);
3147
- jitter = Math.random() * (cappedDelay / 2);
3148
- return [4 /*yield*/, sleep(cappedDelay + jitter)];
3158
+ half = cappedDelay / 2;
3159
+ return [4 /*yield*/, sleep(half + Math.random() * half)];
3149
3160
  case 5:
3150
3161
  _b.sent();
3151
3162
  return [3 /*break*/, 6];
@@ -3213,7 +3224,7 @@ var Stellar = /** @class */ (function () {
3213
3224
  resultCode = (0, getResultCode_1.getResultCode)(e_3);
3214
3225
  if (resultCode === "tx_too_late") {
3215
3226
  newFee = parseInt(transaction.fee) + baseFeeIncrease;
3216
- if (maxFee !== undefined && newFee > maxFee) {
3227
+ if (maxFee && newFee > maxFee) {
3217
3228
  throw new Exceptions_1.TransactionSubmitWithFeeIncreaseFailedError(maxFee, e_3);
3218
3229
  }
3219
3230
  return [2 /*return*/, this.submitWithFeeIncrease({
@@ -82461,7 +82472,7 @@ function decode(arr) {
82461
82472
  /***/ ((module) => {
82462
82473
 
82463
82474
  "use strict";
82464
- module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"3.0.0","engines":{"node":">=20"},"browser":"./lib/bundle_browser.js","main":"./lib/bundle.js","types":"./lib/index.d.ts","license":"Apache-2.0","private":false,"devDependencies":{"@babel/preset-env":"^7.20.2","@babel/preset-typescript":"^7.23.3","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.2","@types/jest":"^29.4.0","@types/lodash":"^4.14.194","@types/sinon":"^10.0.15","@typescript-eslint/eslint-plugin":"^6.7.5","@typescript-eslint/parser":"^6.7.5","babel-jest":"^29.4.1","crypto-browserify":"^3.12.0","dotenv":"^16.3.1","eslint":"^8.51.0","eslint-config-prettier":"^9.0.0","eslint-plugin-jsdoc":"^46.8.2","express":"^4.19.2","husky":"^8.0.0","jest":"^29.4.1","lint-staged":"^14.0.1","npm-run-all":"^4.1.5","playwright":"^1.43.1","prettier":"^2.0.5","pretty-quick":"^2.0.1","process":"^0.11.10","sinon":"^15.1.0","stream-browserify":"^3.0.0","ts-jest":"^29.0.5","ts-loader":"^9.4.2","ts-node":"^10.9.1","tslib":"^2.5.0","typescript":"^5.0.4","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"@stablelib/base64":"^2.0.0","@stablelib/utf8":"^2.0.0","@stellar/stellar-sdk":"15.0.1","axios":"^1.4.0","base64url":"^3.0.1","https-browserify":"^1.0.0","jws":"^4.0.0","lodash":"^4.17.21","query-string":"^7.1.3","stream-http":"^3.2.0","tweetnacl":"^1.0.3","url":"^0.11.0","util":"^0.12.5","utility-types":"^3.10.0","vm-browserify":"^1.1.2"},"scripts":{"test":"jest --watchAll","test:ci":"jest --ci","test:e2e:ci":"jest --config jest.e2e.config.js --ci","test:recovery:ci":"jest --config jest.integration.config.js recovery.test.ts --ci","test:anchorplatform:ci":"yarn jest --config jest.integration.config.js anchorplatform.test.ts --ci","build:web":"webpack --config webpack.config.js","build:node":"webpack --env NODE=true --config webpack.config.js","build":"run-p build:web build:node","example:sep10Server":"ts-node examples/sep10/sep10Server.ts","example:sep10Wallet":"ts-node examples/sep10/sep10Wallet.ts","example:sep24":"ts-node examples/sep24/sep24.ts","example:sep12":"ts-node examples/sep12/sep12.ts"}}');
82475
+ module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"3.0.1","engines":{"node":">=20"},"browser":"./lib/bundle_browser.js","main":"./lib/bundle.js","types":"./lib/index.d.ts","license":"Apache-2.0","private":false,"devDependencies":{"@babel/preset-env":"^7.20.2","@babel/preset-typescript":"^7.23.3","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.2","@types/jest":"^29.4.0","@types/lodash":"^4.14.194","@types/sinon":"^10.0.15","@typescript-eslint/eslint-plugin":"^6.7.5","@typescript-eslint/parser":"^6.7.5","babel-jest":"^29.4.1","crypto-browserify":"^3.12.0","dotenv":"^16.3.1","eslint":"^8.51.0","eslint-config-prettier":"^9.0.0","eslint-plugin-jsdoc":"^46.8.2","express":"^4.19.2","husky":"^8.0.0","jest":"^29.4.1","lint-staged":"^14.0.1","npm-run-all":"^4.1.5","playwright":"^1.43.1","prettier":"^2.0.5","pretty-quick":"^2.0.1","process":"^0.11.10","sinon":"^15.1.0","stream-browserify":"^3.0.0","ts-jest":"^29.0.5","ts-loader":"^9.4.2","ts-node":"^10.9.1","tslib":"^2.5.0","typescript":"^5.0.4","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"@stablelib/base64":"^2.0.0","@stablelib/utf8":"^2.0.0","@stellar/stellar-sdk":"15.0.1","axios":"^1.4.0","base64url":"^3.0.1","https-browserify":"^1.0.0","jws":"^4.0.0","lodash":"^4.17.21","query-string":"^7.1.3","stream-http":"^3.2.0","tweetnacl":"^1.0.3","url":"^0.11.0","util":"^0.12.5","utility-types":"^3.10.0","vm-browserify":"^1.1.2"},"scripts":{"test":"jest --watchAll","test:ci":"jest --ci","test:e2e:ci":"jest --config jest.e2e.config.js --ci","test:recovery:ci":"jest --config jest.integration.config.js recovery.test.ts --ci","test:anchorplatform:ci":"yarn jest --config jest.integration.config.js anchorplatform.test.ts --ci","build:web":"webpack --config webpack.config.js","build:node":"webpack --env NODE=true --config webpack.config.js","build":"run-p build:web build:node","example:sep10Server":"ts-node examples/sep10/sep10Server.ts","example:sep10Wallet":"ts-node examples/sep10/sep10Wallet.ts","example:sep24":"ts-node examples/sep24/sep24.ts","example:sep12":"ts-node examples/sep12/sep12.ts"}}');
82465
82476
 
82466
82477
  /***/ }),
82467
82478