@stellar/typescript-wallet-sdk 5.1.0 → 6.0.0-beta.1793996806758

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/bundle.js CHANGED
@@ -2246,7 +2246,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2246
2246
  };
2247
2247
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2248
2248
  exports.DefaultSignerDomainAccountError = exports.SigningKeypairMissingSecretError = exports.InvalidJsonError = exports.UnknownAnchorTransactionError = exports.AllowHttpOnNonTestnetError = exports.ChallengeTxnClientAccountMismatchError = exports.ChallengeTxnInvalidSignatureError = exports.ChallengeTxnIncorrectSequenceError = exports.NetworkPassphraseMismatchError = exports.ChallengeValidationFailedError = exports.MissingSigningKeyError = exports.Sep38PriceOnlyOneAmountError = exports.NoAccountAndNoSponsorError = exports.SignerKeyEqualsMasterKeyError = exports.DuplicateAccountSignerError = exports.RecoverySignerEqualsDeviceKeyError = exports.DuplicateRecoverySignerError = exports.DeviceKeyEqualsMasterKeyError = exports.NoAccountSignersError = exports.UnableToDeduceKeyError = exports.NoDeviceKeyForAccountError = exports.LostSignerKeyNotFound = exports.NotAllSignaturesFetchedError = exports.RecoveryIdentityNotFoundError = exports.RecoveryServerNotFoundError = exports.KYCServerNotFoundError = exports.CustomerNotFoundError = exports.Sep9InfoRequiredError = exports.WithdrawalTxMemoError = exports.PathPayBoundRequiredError = exports.PathPayOnlyOneAmountError = exports.WithdrawalTxMissingMemoError = exports.WithdrawalTxMissingDestinationError = exports.WithdrawalTxNotPendingUserTransferStartError = exports.OperationsLimitExceededError = exports.SignerRequiredError = exports.TransactionSubmitWithFeeIncreaseFailedError = exports.ExpiredTokenError = exports.InvalidTokenError = exports.MissingTokenError = exports.InsufficientStartingBalanceError = exports.TransactionSubmitFailedError = exports.AccountDoesNotExistError = exports.InvalidTransactionsResponseError = exports.InvalidTransactionResponseError = exports.MissingTransactionIdError = exports.ClientDomainWithMemoError = exports.InvalidMemoError = exports.AssetNotSupportedError = exports.ServerRequestFailedError = void 0;
2249
- exports.Sep7UriTypeNotSupportedError = exports.Sep7LongMsgError = exports.Sep7InvalidUriError = exports.AuthHeaderClientDomainRequiredError = exports.AuthHeaderSigningKeypairRequiredError = exports.DomainSigningModifiedError = void 0;
2249
+ exports.Sep7UriTypeNotSupportedError = exports.Sep7ContractMemoError = exports.Sep7LongMsgError = exports.Sep7InvalidUriError = exports.AuthHeaderClientDomainRequiredError = exports.AuthHeaderSigningKeypairRequiredError = exports.DomainSigningModifiedError = void 0;
2250
2250
  var axios_1 = __importDefault(__webpack_require__(/*! axios */ "../../node_modules/axios/dist/node/axios.cjs"));
2251
2251
  var Utils_1 = __webpack_require__(/*! ../Utils */ "./src/walletSdk/Utils/index.ts");
2252
2252
  var ServerRequestFailedError = /** @class */ (function (_super) {
@@ -2832,6 +2832,16 @@ var Sep7LongMsgError = /** @class */ (function (_super) {
2832
2832
  return Sep7LongMsgError;
2833
2833
  }(Error));
2834
2834
  exports.Sep7LongMsgError = Sep7LongMsgError;
2835
+ var Sep7ContractMemoError = /** @class */ (function (_super) {
2836
+ __extends(Sep7ContractMemoError, _super);
2837
+ function Sep7ContractMemoError() {
2838
+ var _this = _super.call(this, "the 'memo' parameter is not supported for a contract ('C') or muxed contract ('W') 'destination'") || this;
2839
+ Object.setPrototypeOf(_this, Sep7ContractMemoError.prototype);
2840
+ return _this;
2841
+ }
2842
+ return Sep7ContractMemoError;
2843
+ }(Error));
2844
+ exports.Sep7ContractMemoError = Sep7ContractMemoError;
2835
2845
  var Sep7UriTypeNotSupportedError = /** @class */ (function (_super) {
2836
2846
  __extends(Sep7UriTypeNotSupportedError, _super);
2837
2847
  function Sep7UriTypeNotSupportedError(type) {
@@ -5554,8 +5564,28 @@ var __extends = (this && this.__extends) || (function () {
5554
5564
  })();
5555
5565
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5556
5566
  exports.Sep7Pay = void 0;
5567
+ var stellar_sdk_1 = __webpack_require__(/*! @stellar/stellar-sdk */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/index.js");
5557
5568
  var Uri_1 = __webpack_require__(/*! ../Uri */ "./src/walletSdk/Uri/index.ts");
5558
5569
  var Types_1 = __webpack_require__(/*! ../Types */ "./src/walletSdk/Types/index.ts");
5570
+ var Exceptions_1 = __webpack_require__(/*! ../Exceptions */ "./src/walletSdk/Exceptions/index.ts");
5571
+ /**
5572
+ * Throws if a uri would have a memo with a contract ("C...") or muxed
5573
+ * contract ("W...") destination, which 'parseSep7Uri' rejects. Paying either
5574
+ * takes a Soroban transaction, which can't have a memo.
5575
+ *
5576
+ * @param {string | undefined} destination the uri 'destination' param.
5577
+ * @param {string | undefined} memo the uri 'memo' param.
5578
+ * @throws {Sep7ContractMemoError} if both are set and 'destination' is a
5579
+ * contract or muxed contract address.
5580
+ */
5581
+ var assertNoContractMemo = function (destination, memo) {
5582
+ if (memo &&
5583
+ destination &&
5584
+ (stellar_sdk_1.StrKey.isValidContract(destination) ||
5585
+ stellar_sdk_1.StrKey.isValidMuxedContract(destination))) {
5586
+ throw new Exceptions_1.Sep7ContractMemoError();
5587
+ }
5588
+ };
5559
5589
  /**
5560
5590
  * The Sep-7 'pay' operation represents a request to pay a specific address
5561
5591
  * with a specific asset, regardless of the source asset used by the payer.
@@ -5569,9 +5599,13 @@ var Sep7Pay = /** @class */ (function (_super) {
5569
5599
  *
5570
5600
  * @constructor
5571
5601
  * @param {URL | string} [uri] - uri to initialize the Sep7 instance.
5602
+ * @throws {Sep7ContractMemoError} if 'uri' has a memo and a contract ("C...")
5603
+ * or muxed contract ("W...") destination.
5572
5604
  */
5573
5605
  function Sep7Pay(uri) {
5574
- return _super.call(this, uri !== null && uri !== void 0 ? uri : new URL("".concat(Types_1.WEB_STELLAR_SCHEME).concat(Types_1.Sep7OperationType.pay))) || this;
5606
+ var _this = _super.call(this, uri !== null && uri !== void 0 ? uri : new URL("".concat(Types_1.WEB_STELLAR_SCHEME).concat(Types_1.Sep7OperationType.pay))) || this;
5607
+ assertNoContractMemo(_this.destination, _this.memo);
5608
+ return _this;
5575
5609
  }
5576
5610
  /**
5577
5611
  * Creates a Sep7Pay instance with given destination.
@@ -5598,6 +5632,10 @@ var Sep7Pay = /** @class */ (function (_super) {
5598
5632
  * Gets the destination of the payment request, which should be a valid
5599
5633
  * Stellar address.
5600
5634
  *
5635
+ * A contract ("C...") or muxed contract ("W...") destination can only be
5636
+ * paid with a Stellar Asset Contract transfer, not a classic payment, and a
5637
+ * uri with one can't have a memo.
5638
+ *
5601
5639
  * @returns {string | undefined} the 'destination' uri param if present.
5602
5640
  */
5603
5641
  get: function () {
@@ -5610,8 +5648,11 @@ var Sep7Pay = /** @class */ (function (_super) {
5610
5648
  * Deletes the uri 'destination' param if set as 'undefined'.
5611
5649
  *
5612
5650
  * @param {string | undefined} destination the uri 'destination' param to be set.
5651
+ * @throws {Sep7ContractMemoError} if 'destination' is a contract ("C...") or
5652
+ * muxed contract ("W...") address and the uri has a memo.
5613
5653
  */
5614
5654
  set: function (destination) {
5655
+ assertNoContractMemo(destination, this.memo);
5615
5656
  this.setParam("destination", destination);
5616
5657
  },
5617
5658
  enumerable: false,
@@ -5702,8 +5743,11 @@ var Sep7Pay = /** @class */ (function (_super) {
5702
5743
  * Deletes the uri 'memo' param if set as 'undefined'.
5703
5744
  *
5704
5745
  * @param {string | undefined} memo the uri 'memo' param to be set.
5746
+ * @throws {Sep7ContractMemoError} if 'memo' is set and the uri's destination
5747
+ * is a contract ("C...") or muxed contract ("W...") address.
5705
5748
  */
5706
5749
  set: function (memo) {
5750
+ assertNoContractMemo(this.destination, memo);
5707
5751
  this.setParam("memo", memo);
5708
5752
  },
5709
5753
  enumerable: false,
@@ -6048,16 +6092,28 @@ var isValidSep7Uri = function (uri) {
6048
6092
  };
6049
6093
  }
6050
6094
  if (type === Types_1.Sep7OperationType.pay && destination) {
6051
- // Checks if it's a valid "G", "M" or "C" Stellar address
6095
+ var isContract = stellar_sdk_1.StrKey.isValidContract(destination) ||
6096
+ stellar_sdk_1.StrKey.isValidMuxedContract(destination);
6097
+ // Checks if it's a valid "G", "M", "C" or "W" Stellar address
6052
6098
  var isValidStellarAddress = stellar_sdk_1.StrKey.isValidEd25519PublicKey(destination) ||
6053
6099
  stellar_sdk_1.StrKey.isValidMed25519PublicKey(destination) ||
6054
- stellar_sdk_1.StrKey.isValidContract(destination);
6100
+ isContract;
6055
6101
  if (!isValidStellarAddress) {
6056
6102
  return {
6057
6103
  result: false,
6058
6104
  reason: "the provided 'destination' parameter is not a valid Stellar address",
6059
6105
  };
6060
6106
  }
6107
+ // A "C" (contract) or "W" (muxed contract) address can only be paid with
6108
+ // a Stellar Asset Contract transfer. That's a Soroban transaction, which
6109
+ // can't have a memo, so a wallet could only drop it. A "W" address's mux
6110
+ // ID already identifies the payee.
6111
+ if (isContract && url.searchParams.get("memo")) {
6112
+ return {
6113
+ result: false,
6114
+ reason: "the 'memo' parameter is not supported for a contract ('C') or muxed contract ('W') 'destination'",
6115
+ };
6116
+ }
6061
6117
  }
6062
6118
  if ((msg === null || msg === void 0 ? void 0 : msg.length) > Types_1.URI_MSG_MAX_LENGTH) {
6063
6119
  return {
@@ -18118,9 +18174,10 @@ var claimableBalanceIdType = __webpack_require__(/*! ../xdr/generated/claimable-
18118
18174
  var muxedEd25519Account = __webpack_require__(/*! ../xdr/generated/muxed-ed25519-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-ed25519-account.js");
18119
18175
  var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
18120
18176
  var scAddress = __webpack_require__(/*! ../xdr/generated/sc-address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-address.js");
18177
+ var muxedContract = __webpack_require__(/*! ../xdr/generated/muxed-contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-contract.js");
18178
+ var contractId = __webpack_require__(/*! ../xdr/generated/contract-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/contract-id.js");
18121
18179
  var claimableBalanceId = __webpack_require__(/*! ../xdr/generated/claimable-balance-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/claimable-balance-id.js");
18122
18180
  var hash = __webpack_require__(/*! ../xdr/generated/hash.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash.js");
18123
- var contractId = __webpack_require__(/*! ../xdr/generated/contract-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/contract-id.js");
18124
18181
  var poolId = __webpack_require__(/*! ../xdr/generated/pool-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/pool-id.js");
18125
18182
  var publicKey = __webpack_require__(/*! ../xdr/generated/public-key.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/public-key.js");
18126
18183
 
@@ -18140,6 +18197,9 @@ class Address {
18140
18197
  } else if (strkey.StrKey.isValidMed25519PublicKey(address)) {
18141
18198
  this._type = "muxedAccount";
18142
18199
  this._key = strkey.StrKey.decodeMed25519PublicKey(address);
18200
+ } else if (strkey.StrKey.isValidMuxedContract(address)) {
18201
+ this._type = "muxedContract";
18202
+ this._key = strkey.StrKey.decodeMuxedContract(address);
18143
18203
  } else if (strkey.StrKey.isValidClaimableBalance(address)) {
18144
18204
  this._type = "claimableBalance";
18145
18205
  this._key = strkey.StrKey.decodeClaimableBalance(address);
@@ -18198,6 +18258,15 @@ class Address {
18198
18258
  static muxedAccount(buffer) {
18199
18259
  return new Address(strkey.StrKey.encodeMed25519PublicKey(buffer));
18200
18260
  }
18261
+ /**
18262
+ * Creates a new muxed contract Address object from raw bytes: the 32-byte
18263
+ * contract ID followed by the 8-byte big-endian mux ID.
18264
+ *
18265
+ * @param buffer - The bytes of an address to parse.
18266
+ */
18267
+ static muxedContract(buffer) {
18268
+ return new Address(strkey.StrKey.encodeMuxedContract(buffer));
18269
+ }
18201
18270
  /**
18202
18271
  * Convert this from an xdr.ScVal type.
18203
18272
  *
@@ -18241,6 +18310,12 @@ class Address {
18241
18310
  }
18242
18311
  case "scAddressTypeLiquidityPool":
18243
18312
  return Address.liquidityPool(scAddress.value.toBytes());
18313
+ case "scAddressTypeMuxedContract": {
18314
+ const muxed = scAddress.value;
18315
+ return Address.muxedContract(
18316
+ strkey.packMuxedContract(muxed.contractId.value, muxed.id)
18317
+ );
18318
+ }
18244
18319
  default:
18245
18320
  throw new Error("Unsupported address type");
18246
18321
  }
@@ -18260,6 +18335,8 @@ class Address {
18260
18335
  return strkey.StrKey.encodeLiquidityPool(this._key);
18261
18336
  case "muxedAccount":
18262
18337
  return strkey.StrKey.encodeMed25519PublicKey(this._key);
18338
+ case "muxedContract":
18339
+ return strkey.StrKey.encodeMuxedContract(this._key);
18263
18340
  default:
18264
18341
  throw new Error("Unsupported address type");
18265
18342
  }
@@ -18294,6 +18371,12 @@ class Address {
18294
18371
  id: index.Uint64.fromXdr(this._key.subarray(32, 40), "raw")
18295
18372
  })
18296
18373
  );
18374
+ case "muxedContract": {
18375
+ const { contractId: contractId$1, id } = strkey.unpackMuxedContract(this._key);
18376
+ return scAddress.ScAddress.scAddressTypeMuxedContract(
18377
+ new muxedContract.MuxedContract({ id, contractId: new contractId.ContractId(contractId$1) })
18378
+ );
18379
+ }
18297
18380
  default:
18298
18381
  throw new Error("Unsupported address type");
18299
18382
  }
@@ -18311,8 +18394,15 @@ class Address {
18311
18394
  return this._type;
18312
18395
  }
18313
18396
  }
18397
+ function assertNotMuxed(address, reason) {
18398
+ const muxed = typeof address === "string" ? strkey.StrKey.isValidMed25519PublicKey(address) || strkey.StrKey.isValidMuxedContract(address) : address.type === "muxedAccount" || address.type === "muxedContract";
18399
+ if (muxed) {
18400
+ throw new TypeError(`muxed address ${address.toString()} ${reason}`);
18401
+ }
18402
+ }
18314
18403
 
18315
18404
  exports.Address = Address;
18405
+ exports.assertNotMuxed = assertNotMuxed;
18316
18406
  //# sourceMappingURL=address.js.map
18317
18407
 
18318
18408
 
@@ -18333,6 +18423,7 @@ __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-
18333
18423
  var keypair = __webpack_require__(/*! ./keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
18334
18424
  var strkey = __webpack_require__(/*! ./strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
18335
18425
  var hashing = __webpack_require__(/*! ./hashing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/hashing.js");
18426
+ var assetType = __webpack_require__(/*! ../xdr/generated/asset-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/asset-type.js");
18336
18427
  var asset = __webpack_require__(/*! ../xdr/generated/asset.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/asset.js");
18337
18428
  var changeTrustAsset = __webpack_require__(/*! ../xdr/generated/change-trust-asset.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/change-trust-asset.js");
18338
18429
  var trustLineAsset = __webpack_require__(/*! ../xdr/generated/trust-line-asset.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/trust-line-asset.js");
@@ -18341,7 +18432,6 @@ var hashIdPreimageContractId = __webpack_require__(/*! ../xdr/generated/hash-id-
18341
18432
  var contractIdPreimage = __webpack_require__(/*! ../xdr/generated/contract-id-preimage.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/contract-id-preimage.js");
18342
18433
  var alphaNum4 = __webpack_require__(/*! ../xdr/generated/alpha-num4.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/alpha-num4.js");
18343
18434
  var alphaNum12 = __webpack_require__(/*! ../xdr/generated/alpha-num12.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/alpha-num12.js");
18344
- var assetType = __webpack_require__(/*! ../xdr/generated/asset-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/asset-type.js");
18345
18435
 
18346
18436
  const AssetType = {
18347
18437
  native: "native",
@@ -18357,6 +18447,11 @@ class Asset {
18357
18447
  code;
18358
18448
  /** The account ID of the issuer. Undefined for the native asset. */
18359
18449
  issuer;
18450
+ /**
18451
+ * The XDR union arm this asset encodes to. A private field so the object's
18452
+ * JSON/spread shape keeps only the code and issuer.
18453
+ */
18454
+ #rawAssetType;
18360
18455
  /**
18361
18456
  * @param code - The asset code.
18362
18457
  * @param issuer - The account ID of the issuer.
@@ -18373,12 +18468,19 @@ class Asset {
18373
18468
  if (issuer && !strkey.StrKey.isValidEd25519PublicKey(issuer)) {
18374
18469
  throw new Error("Issuer is invalid");
18375
18470
  }
18376
- if (String(code).toLowerCase() === "xlm") {
18471
+ if (!issuer && String(code).toLowerCase() === "xlm") {
18377
18472
  this.code = "XLM";
18378
18473
  } else {
18379
18474
  this.code = code;
18380
18475
  }
18381
18476
  this.issuer = issuer;
18477
+ this.#rawAssetType = Asset.#deriveRawAssetType(this.code, issuer);
18478
+ }
18479
+ static #deriveRawAssetType(code, issuer) {
18480
+ if (!issuer) {
18481
+ return assetType.AssetType.assetTypeNative;
18482
+ }
18483
+ return code.length <= 4 ? assetType.AssetType.assetTypeCreditAlphanum4 : assetType.AssetType.assetTypeCreditAlphanum12;
18382
18484
  }
18383
18485
  /**
18384
18486
  * Returns an asset object for the native asset.
@@ -18405,14 +18507,17 @@ class Asset {
18405
18507
  "\0"
18406
18508
  );
18407
18509
  return new this(code, issuer);
18408
- case "assetTypeCreditAlphanum12":
18510
+ case "assetTypeCreditAlphanum12": {
18409
18511
  anum = assetXdr.alphaNum12;
18410
18512
  issuer = strkey.StrKey.encodeEd25519PublicKey(anum.issuer.ed25519.toBytes());
18411
18513
  code = util.trimEnd(
18412
18514
  uint8arrayExtras.uint8ArrayToString(anum.assetCode.toBytes()),
18413
18515
  "\0"
18414
18516
  );
18415
- return new this(code, issuer);
18517
+ const asset = new this(code, issuer);
18518
+ asset.#rawAssetType = assetType.AssetType.assetTypeCreditAlphanum12;
18519
+ return asset;
18520
+ }
18416
18521
  default:
18417
18522
  throw new Error("Invalid asset type received: " + assetXdr.type);
18418
18523
  }
@@ -18490,18 +18595,18 @@ class Asset {
18490
18595
  if (!this.issuer) {
18491
18596
  throw new Error("Issuer cannot be null for non-native asset");
18492
18597
  }
18493
- if (this.code.length <= 4) {
18598
+ if (this.getRawAssetType().value === assetType.AssetType.assetTypeCreditAlphanum4.value) {
18494
18599
  const assetType2 = new alphaNum4.AlphaNum4({
18495
18600
  assetCode: uint8arrayExtras.stringToUint8Array(this.code.padEnd(4, "\0")),
18496
18601
  issuer: keypair.Keypair.fromPublicKey(this.issuer).xdrAccountId()
18497
18602
  });
18498
18603
  return xdrAsset.assetTypeCreditAlphanum4(assetType2);
18499
18604
  }
18500
- const assetType = new alphaNum12.AlphaNum12({
18605
+ const assetType$1 = new alphaNum12.AlphaNum12({
18501
18606
  assetCode: uint8arrayExtras.stringToUint8Array(this.code.padEnd(12, "\0")),
18502
18607
  issuer: keypair.Keypair.fromPublicKey(this.issuer).xdrAccountId()
18503
18608
  });
18504
- return xdrAsset.assetTypeCreditAlphanum12(assetType);
18609
+ return xdrAsset.assetTypeCreditAlphanum12(assetType$1);
18505
18610
  }
18506
18611
  /**
18507
18612
  * Returns the asset code
@@ -18545,13 +18650,11 @@ class Asset {
18545
18650
  * Returns the raw XDR representation of the asset type
18546
18651
  */
18547
18652
  getRawAssetType() {
18548
- if (this.isNative()) {
18549
- return assetType.AssetType.assetTypeNative;
18653
+ const { code, issuer } = this;
18654
+ if (#rawAssetType in this) {
18655
+ return this.#rawAssetType;
18550
18656
  }
18551
- if (this.code.length <= 4) {
18552
- return assetType.AssetType.assetTypeCreditAlphanum4;
18553
- }
18554
- return assetType.AssetType.assetTypeCreditAlphanum12;
18657
+ return Asset.#deriveRawAssetType(code, issuer);
18555
18658
  }
18556
18659
  /**
18557
18660
  * Returns true if this asset object is the native asset.
@@ -18565,7 +18668,7 @@ class Asset {
18565
18668
  * @param asset - Asset to compare
18566
18669
  */
18567
18670
  equals(asset) {
18568
- return this.code === asset.getCode() && this.issuer === asset.getIssuer();
18671
+ return this.code === asset.getCode() && this.issuer === asset.getIssuer() && this.getRawAssetType().value === asset.getRawAssetType().value;
18569
18672
  }
18570
18673
  /**
18571
18674
  * Returns a string representation of this asset.
@@ -18612,7 +18715,10 @@ class Asset {
18612
18715
  if (issuerA === void 0 || issuerB === void 0) {
18613
18716
  throw new Error("Issuer is undefined for non-native asset");
18614
18717
  }
18615
- return asciiCompare(issuerA, issuerB);
18718
+ return uint8arrayExtras.compareUint8Arrays(
18719
+ strkey.StrKey.decodeEd25519PublicKey(issuerA),
18720
+ strkey.StrKey.decodeEd25519PublicKey(issuerB)
18721
+ );
18616
18722
  }
18617
18723
  }
18618
18724
 
@@ -18649,6 +18755,7 @@ var sorobanAuthorizationEntry = __webpack_require__(/*! ../xdr/generated/soroban
18649
18755
  var sorobanCredentials = __webpack_require__(/*! ../xdr/generated/soroban-credentials.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/soroban-credentials.js");
18650
18756
  var hashIdPreimage = __webpack_require__(/*! ../xdr/generated/hash-id-preimage.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash-id-preimage.js");
18651
18757
 
18758
+ const MUXED_CREDENTIAL_REASON = "cannot sign authorization entries; use its base address";
18652
18759
  function toScVal(value) {
18653
18760
  if (scVal.ScVal.is(value)) return value;
18654
18761
  if (typeof value !== "object" || value === null) return null;
@@ -18671,6 +18778,17 @@ async function authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphr
18671
18778
  if (addrAuth === null) {
18672
18779
  throw new Error(`unsupported credential type ${credentials.type}`);
18673
18780
  }
18781
+ const addresses = collectSignatureNodes(credentials).map(
18782
+ (node) => address.Address.fromScAddress(node.address)
18783
+ );
18784
+ addresses.forEach(
18785
+ (address$1) => address.assertNotMuxed(address$1, MUXED_CREDENTIAL_REASON)
18786
+ );
18787
+ if (forAddress !== void 0 && !addresses.some((address) => address.toString() === forAddress)) {
18788
+ throw new Error(
18789
+ `the authorization entry has no credential node for address ${forAddress}`
18790
+ );
18791
+ }
18674
18792
  const preimage = buildAuthorizationEntryPreimage(
18675
18793
  entry,
18676
18794
  validUntilLedgerSeq,
@@ -18702,7 +18820,7 @@ async function authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphr
18702
18820
  publicKey = sigResult.publicKey;
18703
18821
  } else if (uint8arrayExtras.isUint8Array(sigResult)) {
18704
18822
  signature = sigResult;
18705
- publicKey = address.Address.fromScAddress(addrAuth.address).toString();
18823
+ publicKey = targetAddress ?? address.Address.fromScAddress(addrAuth.address).toString();
18706
18824
  } else {
18707
18825
  throw new TypeError(
18708
18826
  `SigningCallback must resolve to a Uint8Array, { signature, publicKey }, or { signatureScVal }; got ${sigResult === null ? "null" : typeof sigResult}`
@@ -18722,6 +18840,11 @@ async function authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphr
18722
18840
  `expected a Uint8Array signature from the signer, got ${signature === null ? "null" : typeof signature}`
18723
18841
  );
18724
18842
  }
18843
+ if (!strkey.StrKey.isValidEd25519PublicKey(publicKey)) {
18844
+ throw new TypeError(
18845
+ strkey.StrKey.isValidContract(publicKey) || strkey.StrKey.isValidMuxedContract(publicKey) ? `cannot verify an Ed25519 signature against contract ${publicKey}; sign for a contract address with a callback returning { signatureScVal }, or with a custom \`authorizeEntry\` when signing through signAuthEntries` : `expected an Ed25519 public key (G...) to verify the signature against, got ${JSON.stringify(publicKey)}`
18846
+ );
18847
+ }
18725
18848
  if (!keypair.Keypair.fromPublicKey(publicKey).verify(payload, signature)) {
18726
18849
  throw new Error(`signature doesn't match payload`);
18727
18850
  }
@@ -18743,6 +18866,7 @@ async function authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphr
18743
18866
  credentials,
18744
18867
  validUntilLedgerSeq,
18745
18868
  signatureScVal,
18869
+ payload,
18746
18870
  targetAddress
18747
18871
  );
18748
18872
  if (matched === 0) {
@@ -18771,7 +18895,7 @@ function authorizeInvocation(params) {
18771
18895
  throw new Error(`authorizeInvocation requires publicKey parameter`);
18772
18896
  }
18773
18897
  const addressCredentials = new sorobanAddressCredentials.SorobanAddressCredentials({
18774
- address: new address.Address(pk).toScAddress(),
18898
+ address: credentialAddress(pk),
18775
18899
  nonce,
18776
18900
  signatureExpirationLedger: 0,
18777
18901
  // replaced
@@ -18830,6 +18954,10 @@ function buildWithDelegatesEntry(params) {
18830
18954
  `buildWithDelegatesEntry expects ADDRESS or ADDRESS_V2 credentials, got ${credentials.type}`
18831
18955
  );
18832
18956
  }
18957
+ address.assertNotMuxed(
18958
+ address.Address.fromScAddress(addrAuth.address),
18959
+ MUXED_CREDENTIAL_REASON
18960
+ );
18833
18961
  return new sorobanAuthorizationEntry.SorobanAuthorizationEntry({
18834
18962
  rootInvocation: entry.rootInvocation,
18835
18963
  credentials: sorobanCredentials.SorobanCredentials.sorobanCredentialsAddressWithDelegates(
@@ -18845,10 +18973,15 @@ function buildWithDelegatesEntry(params) {
18845
18973
  )
18846
18974
  });
18847
18975
  }
18976
+ function credentialAddress(address$1) {
18977
+ const addr = new address.Address(address$1);
18978
+ address.assertNotMuxed(addr, MUXED_CREDENTIAL_REASON);
18979
+ return addr.toScAddress();
18980
+ }
18848
18981
  function buildDelegateNodes(delegates) {
18849
18982
  const nodes = delegates.map(
18850
18983
  (delegate) => new sorobanDelegateSignature.SorobanDelegateSignature({
18851
- address: new address.Address(delegate.address).toScAddress(),
18984
+ address: credentialAddress(delegate.address),
18852
18985
  signature: delegate.signature ?? scVal.ScVal.scvVoid(),
18853
18986
  nestedDelegates: buildDelegateNodes(delegate.nestedDelegates ?? [])
18854
18987
  })
@@ -18882,7 +19015,7 @@ function getAddressCredentials(credentials) {
18882
19015
  return null;
18883
19016
  }
18884
19017
  }
18885
- function applyExpirationAndSignature(credentials, validUntilLedgerSeq, signature, forAddress) {
19018
+ function applyExpirationAndSignature(credentials, validUntilLedgerSeq, signature, payload, forAddress) {
18886
19019
  const topAddr = getAddressCredentials(credentials);
18887
19020
  if (topAddr === null) {
18888
19021
  return { credentials, matched: 0 };
@@ -18892,11 +19025,24 @@ function applyExpirationAndSignature(credentials, validUntilLedgerSeq, signature
18892
19025
  if (topIsTarget) {
18893
19026
  matched++;
18894
19027
  }
19028
+ const stored = topAddr.signatureExpirationLedger;
19029
+ const keepOther = (other) => {
19030
+ if (stored === validUntilLedgerSeq || !signaturePresent(other)) {
19031
+ return true;
19032
+ }
19033
+ if (stored !== 0) {
19034
+ return false;
19035
+ }
19036
+ const pairs = parseEd25519Signatures(other);
19037
+ return pairs === null || pairs.every(
19038
+ (pair) => keypair.Keypair.fromPublicKey(pair.publicKey).verify(payload, pair.signature)
19039
+ );
19040
+ };
18895
19041
  const newTopAddr = new sorobanAddressCredentials.SorobanAddressCredentials({
18896
19042
  address: topAddr.address,
18897
19043
  nonce: topAddr.nonce,
18898
19044
  signatureExpirationLedger: validUntilLedgerSeq,
18899
- signature: topIsTarget ? signature : topAddr.signature
19045
+ signature: topIsTarget ? signature : carryOver(topAddr.signature, keepOther)
18900
19046
  });
18901
19047
  switch (credentials.type) {
18902
19048
  case "sorobanCredentialsAddress":
@@ -18911,10 +19057,11 @@ function applyExpirationAndSignature(credentials, validUntilLedgerSeq, signature
18911
19057
  };
18912
19058
  case "sorobanCredentialsAddressWithDelegates": {
18913
19059
  const withDelegates = credentials.addressWithDelegates;
18914
- const newDelegates = forAddress === void 0 ? withDelegates.delegates : rebuildDelegatesWithSignature(
19060
+ const newDelegates = forAddress === void 0 && stored === validUntilLedgerSeq ? withDelegates.delegates : rebuildDelegatesWithSignature(
18915
19061
  withDelegates.delegates,
18916
19062
  forAddress,
18917
19063
  signature,
19064
+ keepOther,
18918
19065
  () => {
18919
19066
  matched++;
18920
19067
  }
@@ -18933,19 +19080,23 @@ function applyExpirationAndSignature(credentials, validUntilLedgerSeq, signature
18933
19080
  return { credentials, matched };
18934
19081
  }
18935
19082
  }
18936
- function rebuildDelegatesWithSignature(delegates, forAddress, signature, onMatch) {
19083
+ function carryOver(signature, keep) {
19084
+ return keep(signature) ? signature : scVal.ScVal.scvVoid();
19085
+ }
19086
+ function rebuildDelegatesWithSignature(delegates, forAddress, signature, keepOther, onMatch) {
18937
19087
  return delegates.map((delegate) => {
18938
- const isMatch = address.Address.fromScAddress(delegate.address).toString() === forAddress;
19088
+ const isMatch = forAddress !== void 0 && address.Address.fromScAddress(delegate.address).toString() === forAddress;
18939
19089
  if (isMatch) {
18940
19090
  onMatch();
18941
19091
  }
18942
19092
  return new sorobanDelegateSignature.SorobanDelegateSignature({
18943
19093
  address: delegate.address,
18944
- signature: isMatch ? signature : delegate.signature,
19094
+ signature: isMatch ? signature : carryOver(delegate.signature, keepOther),
18945
19095
  nestedDelegates: rebuildDelegatesWithSignature(
18946
19096
  delegate.nestedDelegates,
18947
19097
  forAddress,
18948
19098
  signature,
19099
+ keepOther,
18949
19100
  onMatch
18950
19101
  )
18951
19102
  });
@@ -19093,6 +19244,7 @@ exports.buildWithDelegatesEntry = buildWithDelegatesEntry;
19093
19244
  exports.checkAuthEntryReadiness = checkAuthEntryReadiness;
19094
19245
  exports.getAddressCredentials = getAddressCredentials;
19095
19246
  exports.inspectAuthEntry = inspectAuthEntry;
19247
+ exports.signaturePresent = signaturePresent;
19096
19248
  //# sourceMappingURL=auth.js.map
19097
19249
 
19098
19250
 
@@ -19181,9 +19333,9 @@ class Claimant {
19181
19333
  /**
19182
19334
  * Returns a `BeforeAbsoluteTime` claim predicate
19183
19335
  *
19184
- * This predicate will be fulfilled if the closing time of the ledger that
19185
- * includes the CreateClaimableBalance operation is less than this (absolute)
19186
- * Unix timestamp (expressed in seconds).
19336
+ * This predicate will be fulfilled if the closing time of the ledger in
19337
+ * which the balance is claimed is less than this (absolute) Unix timestamp
19338
+ * (expressed in seconds).
19187
19339
  *
19188
19340
  * @param absBefore - Unix epoch (in seconds) as a string
19189
19341
  */
@@ -19195,9 +19347,11 @@ class Claimant {
19195
19347
  /**
19196
19348
  * Returns a `BeforeRelativeTime` claim predicate
19197
19349
  *
19198
- * This predicate will be fulfilled if the closing time of the ledger that
19199
- * includes the CreateClaimableBalance operation plus this relative time delta
19200
- * (in seconds) is less than the current time.
19350
+ * When the balance is created, this is converted to a `BeforeAbsoluteTime`
19351
+ * predicate by adding this relative time delta (in seconds) to the closing
19352
+ * time of the ledger that includes the CreateClaimableBalance operation. The
19353
+ * predicate is then fulfilled while the closing time of the ledger in which
19354
+ * the balance is claimed is less than that sum.
19201
19355
  *
19202
19356
  * @param seconds - seconds since closeTime of the ledger in which the ClaimableBalanceEntry was created (as string)
19203
19357
  */
@@ -19301,6 +19455,11 @@ class Contract {
19301
19455
  try {
19302
19456
  this._id = strkey.StrKey.decodeContract(contractId);
19303
19457
  } catch {
19458
+ if (strkey.StrKey.isValidMuxedContract(contractId)) {
19459
+ throw new Error(
19460
+ `Invalid contract ID: ${contractId} is a muxed contract address; use its base address (C...)`
19461
+ );
19462
+ }
19304
19463
  throw new Error(`Invalid contract ID: ${contractId}`);
19305
19464
  }
19306
19465
  }
@@ -19408,11 +19567,11 @@ exports.humanizeEvents = humanizeEvents;
19408
19567
  "use strict";
19409
19568
 
19410
19569
 
19411
- var base64 = __webpack_require__(/*! ./util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
19412
19570
  __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
19413
19571
  var hashing = __webpack_require__(/*! ./hashing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/hashing.js");
19414
19572
  var transaction = __webpack_require__(/*! ./transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction.js");
19415
19573
  var transaction_base = __webpack_require__(/*! ./transaction_base.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_base.js");
19574
+ var util = __webpack_require__(/*! ../xdr/util.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/util.js");
19416
19575
  var decode_encode_muxed_account = __webpack_require__(/*! ./util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
19417
19576
  var feeBumpTransactionEnvelope = __webpack_require__(/*! ../xdr/generated/fee-bump-transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/fee-bump-transaction-envelope.js");
19418
19577
  var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
@@ -19430,17 +19589,12 @@ class FeeBumpTransaction extends transaction_base.TransactionBase {
19430
19589
  * (e.g. "Public Global Stellar Network ; September 2015").
19431
19590
  */
19432
19591
  constructor(envelope, networkPassphrase) {
19433
- if (typeof envelope === "string") {
19434
- const bytes = base64.base64ToUint8Array(envelope);
19435
- envelope = transactionEnvelope.TransactionEnvelope.fromXdr(bytes);
19436
- }
19437
- const envelopeType = envelope.type;
19438
- if (envelopeType !== "envelopeTypeTxFeeBump") {
19439
- throw new Error(
19440
- `Invalid TransactionEnvelope: expected an envelopeTypeTxFeeBump but received an ${envelopeType}.`
19441
- );
19442
- }
19443
- const txEnvelope = envelope.value;
19592
+ const own = transaction_base.ownEnvelope(
19593
+ envelope,
19594
+ (value) => util.isUnionVariant(value, "envelopeTypeTxFeeBump"),
19595
+ "envelopeTypeTxFeeBump"
19596
+ );
19597
+ const txEnvelope = own.value;
19444
19598
  const tx = txEnvelope.tx;
19445
19599
  const fee = tx.fee.toString();
19446
19600
  const signatures = (txEnvelope.signatures || []).slice();
@@ -19450,7 +19604,7 @@ class FeeBumpTransaction extends transaction_base.TransactionBase {
19450
19604
  );
19451
19605
  this._feeSource = decode_encode_muxed_account.encodeMuxedAccountToAddress(this.tx.feeSource);
19452
19606
  this._innerTransaction = new transaction.Transaction(
19453
- innerTxEnvelope,
19607
+ transaction_base.markSdkOwned(innerTxEnvelope),
19454
19608
  networkPassphrase
19455
19609
  );
19456
19610
  }
@@ -19508,6 +19662,88 @@ exports.FeeBumpTransaction = FeeBumpTransaction;
19508
19662
  //# sourceMappingURL=fee_bump_transaction.js.map
19509
19663
 
19510
19664
 
19665
+ /***/ }),
19666
+
19667
+ /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/get_claimable_balance_id.js":
19668
+ /*!****************************************************************************************!*\
19669
+ !*** ../../node_modules/@stellar/stellar-sdk/lib/cjs/base/get_claimable_balance_id.js ***!
19670
+ \****************************************************************************************/
19671
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19672
+
19673
+ "use strict";
19674
+
19675
+
19676
+ __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
19677
+ var transactionResult = __webpack_require__(/*! ../xdr/generated/transaction-result.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-result.js");
19678
+
19679
+ function isTransactionResult(value) {
19680
+ if (value instanceof transactionResult.TransactionResult) return true;
19681
+ if (typeof value !== "object" || value === null) return false;
19682
+ const ctor = value.constructor;
19683
+ return ctor?.schema?.name === transactionResult.TransactionResult.schema.name;
19684
+ }
19685
+ function successfulOperationResults(result) {
19686
+ const txResult = result.result;
19687
+ switch (txResult.type) {
19688
+ case "txSuccess":
19689
+ return txResult.results;
19690
+ case "txFeeBumpInnerSuccess": {
19691
+ const innerResult = txResult.innerResultPair.result.result;
19692
+ if (innerResult.type !== "txSuccess") {
19693
+ throw new TypeError(
19694
+ `expected a successful inner transaction result, got ${innerResult.type}`
19695
+ );
19696
+ }
19697
+ return innerResult.results;
19698
+ }
19699
+ default:
19700
+ throw new TypeError(
19701
+ `expected a successful transaction result, got ${txResult.type}`
19702
+ );
19703
+ }
19704
+ }
19705
+ function getClaimableBalanceIdFromResult(result, opIndex) {
19706
+ if (!isTransactionResult(result)) {
19707
+ throw new TypeError(
19708
+ 'expected an xdr.TransactionResult; decode a base64 `result_xdr` with xdr.TransactionResult.fromXdr(result_xdr, "base64") first'
19709
+ );
19710
+ }
19711
+ const opResults = successfulOperationResults(result);
19712
+ if (!Array.isArray(opResults)) {
19713
+ throw new TypeError(
19714
+ "expected an xdr.TransactionResult; its operation results are missing"
19715
+ );
19716
+ }
19717
+ if (!Number.isInteger(opIndex) || opIndex < 0 || opIndex >= opResults.length) {
19718
+ throw new RangeError(
19719
+ `invalid operation index ${opIndex}; the transaction has ${opResults.length} operation result(s)`
19720
+ );
19721
+ }
19722
+ const opResult = opResults[opIndex];
19723
+ if (opResult.type !== "opInner") {
19724
+ throw new TypeError(
19725
+ `expected opInner at index ${opIndex}, got ${opResult.type}`
19726
+ );
19727
+ }
19728
+ const opTypeResult = opResult.tr;
19729
+ if (opTypeResult.type !== "createClaimableBalance") {
19730
+ throw new TypeError(
19731
+ `expected createClaimableBalance at index ${opIndex}, got ${opTypeResult.type}`
19732
+ );
19733
+ }
19734
+ const balanceResult = opTypeResult.createClaimableBalanceResult;
19735
+ if (balanceResult.type !== "createClaimableBalanceSuccess") {
19736
+ throw new TypeError(
19737
+ `expected createClaimableBalanceSuccess at index ${opIndex}, got ${balanceResult.type}`
19738
+ );
19739
+ }
19740
+ return balanceResult.balanceId.toXdr("hex");
19741
+ }
19742
+
19743
+ exports.getClaimableBalanceIdFromResult = getClaimableBalanceIdFromResult;
19744
+ //# sourceMappingURL=get_claimable_balance_id.js.map
19745
+
19746
+
19511
19747
  /***/ }),
19512
19748
 
19513
19749
  /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/get_liquidity_pool_id.js":
@@ -19693,12 +19929,13 @@ var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_
19693
19929
  var signing = __webpack_require__(/*! ./signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
19694
19930
  var strkey = __webpack_require__(/*! ./strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
19695
19931
  var hashing = __webpack_require__(/*! ./hashing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/hashing.js");
19932
+ var decode_encode_muxed_account = __webpack_require__(/*! ./util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
19696
19933
  var index = __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
19697
19934
  var publicKey = __webpack_require__(/*! ../xdr/generated/public-key.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/public-key.js");
19698
- var muxedAccount = __webpack_require__(/*! ../xdr/generated/muxed-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account.js");
19699
- var muxedAccountMed25519 = __webpack_require__(/*! ../xdr/generated/muxed-account-med25519.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account-med25519.js");
19700
19935
  var decoratedSignature = __webpack_require__(/*! ../xdr/generated/decorated-signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/decorated-signature.js");
19701
19936
  var signature = __webpack_require__(/*! ../xdr/generated/signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/signature.js");
19937
+ var muxedAccount = __webpack_require__(/*! ../xdr/generated/muxed-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account.js");
19938
+ var muxedAccountMed25519 = __webpack_require__(/*! ../xdr/generated/muxed-account-med25519.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account-med25519.js");
19702
19939
 
19703
19940
  function _interopNamespace(e) {
19704
19941
  if (e && e.__esModule) return e;
@@ -19831,8 +20068,8 @@ class Keypair {
19831
20068
  * You will get a different type of muxed account depending on whether or not
19832
20069
  * you pass an ID.
19833
20070
  *
19834
- * @param id - stringified integer indicating the underlying muxed
19835
- * ID of the new account object
20071
+ * @param id - the underlying muxed ID of the new account object, as a
20072
+ * uint64 in decimal digits. Leading zeros are removed. At most 22 digits.
19836
20073
  */
19837
20074
  xdrMuxedAccount(id) {
19838
20075
  if (typeof id !== "undefined") {
@@ -19841,7 +20078,7 @@ class Keypair {
19841
20078
  }
19842
20079
  return muxedAccount.MuxedAccount.keyTypeMuxedEd25519(
19843
20080
  new muxedAccountMed25519.MuxedAccountMed25519({
19844
- id: index.Uint64.fromString(id),
20081
+ id: index.Uint64.fromString(decode_encode_muxed_account.canonicalUint64Id(id)),
19845
20082
  ed25519: this._publicKey
19846
20083
  })
19847
20084
  );
@@ -20415,8 +20652,9 @@ class Memo {
20415
20652
  /**
20416
20653
  * Creates and returns a `MemoText` memo.
20417
20654
  *
20418
- * @param text - memo text. A JS string is UTF-8 encoded on the wire;
20419
- * pass a `Uint8Array` for byte-exact content. A plain `number[]` is not
20655
+ * @param text - memo text. A JS string is UTF-8 encoded on the wire, and
20656
+ * a lone surrogate becomes U+FFFD with no error; pass a `Uint8Array`
20657
+ * for byte-exact content. A plain `number[]` is not
20420
20658
  * accepted (16.2.0 and earlier took one); wrap it: `new Uint8Array(arr)`.
20421
20659
  */
20422
20660
  static text(text) {
@@ -20525,20 +20763,6 @@ var account = __webpack_require__(/*! ./account.js */ "../../node_modules/@stell
20525
20763
  var strkey = __webpack_require__(/*! ./strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
20526
20764
  var decode_encode_muxed_account = __webpack_require__(/*! ./util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
20527
20765
 
20528
- const MAX_UINT64 = BigInt("18446744073709551615");
20529
- function validateUint64Id(id) {
20530
- let value;
20531
- try {
20532
- value = BigInt(id);
20533
- } catch {
20534
- throw new Error(`id is not a valid uint64 string: ${id}`);
20535
- }
20536
- if (value < BigInt(0) || value > MAX_UINT64) {
20537
- throw new Error(
20538
- `id value out of range for uint64 [0, ${MAX_UINT64}]: ${id}`
20539
- );
20540
- }
20541
- }
20542
20766
  class MuxedAccount {
20543
20767
  account;
20544
20768
  _muxedXdr;
@@ -20547,19 +20771,19 @@ class MuxedAccount {
20547
20771
  /**
20548
20772
  * @param baseAccount - the {@link Account} instance representing the
20549
20773
  * underlying G... address
20550
- * @param id - a stringified uint64 value that represents the ID of the
20551
- * muxed account
20774
+ * @param id - the ID of the muxed account, as a uint64 in decimal digits.
20775
+ * Leading zeros are removed. At most 22 digits.
20552
20776
  */
20553
20777
  constructor(baseAccount, id) {
20554
20778
  const accountId = baseAccount.accountId();
20555
20779
  if (!strkey.StrKey.isValidEd25519PublicKey(accountId)) {
20556
20780
  throw new Error("accountId is invalid");
20557
20781
  }
20558
- validateUint64Id(id);
20782
+ const canonicalId = decode_encode_muxed_account.canonicalUint64Id(id);
20559
20783
  this.account = baseAccount;
20560
- this._muxedXdr = decode_encode_muxed_account.encodeMuxedAccount(accountId, id);
20784
+ this._muxedXdr = decode_encode_muxed_account.encodeMuxedAccount(accountId, canonicalId);
20561
20785
  this._mAddress = decode_encode_muxed_account.encodeMuxedAccountToAddress(this._muxedXdr);
20562
- this._id = id;
20786
+ this._id = canonicalId;
20563
20787
  }
20564
20788
  /**
20565
20789
  * Parses an M-address into a MuxedAccount object.
@@ -20601,16 +20825,14 @@ class MuxedAccount {
20601
20825
  /**
20602
20826
  * Updates the muxed account's ID, regenerating the M-address accordingly.
20603
20827
  *
20604
- * @param id - a stringified uint64 value to set as the new muxed account ID
20828
+ * @param id - the new muxed account ID, as a uint64 in decimal digits.
20829
+ * Leading zeros are removed. At most 22 digits.
20605
20830
  */
20606
20831
  setId(id) {
20607
- if (typeof id !== "string") {
20608
- throw new Error("id should be a string representing a number (uint64)");
20609
- }
20610
- validateUint64Id(id);
20611
- this._muxedXdr = decode_encode_muxed_account.encodeMuxedAccount(this.account.accountId(), id);
20832
+ const canonicalId = decode_encode_muxed_account.canonicalUint64Id(id);
20833
+ this._muxedXdr = decode_encode_muxed_account.encodeMuxedAccount(this.account.accountId(), canonicalId);
20612
20834
  this._mAddress = decode_encode_muxed_account.encodeMuxedAccountToAddress(this._muxedXdr);
20613
- this._id = id;
20835
+ this._id = canonicalId;
20614
20836
  return this;
20615
20837
  }
20616
20838
  /**
@@ -22500,7 +22722,7 @@ exports.liquidityPoolWithdraw = liquidityPoolWithdraw;
22500
22722
 
22501
22723
 
22502
22724
  var operations = __webpack_require__(/*! ../util/operations.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/operations.js");
22503
- var index = __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
22725
+ __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
22504
22726
  var manageBuyOfferOp = __webpack_require__(/*! ../../xdr/generated/manage-buy-offer-op.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/manage-buy-offer-op.js");
22505
22727
  var operationBody = __webpack_require__(/*! ../../xdr/generated/operation-body.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/operation-body.js");
22506
22728
  var operation = __webpack_require__(/*! ../../xdr/generated/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/operation.js");
@@ -22516,8 +22738,7 @@ function manageBuyOffer(opts) {
22516
22738
  throw new TypeError("price argument is required");
22517
22739
  }
22518
22740
  const price = operations.toXdrPrice(opts.price);
22519
- const offerIdStr = opts.offerId !== void 0 ? opts.offerId.toString() : "0";
22520
- const offerId = index.Int64.fromString(offerIdStr);
22741
+ const offerId = operations.toXdrOfferId(opts.offerId);
22521
22742
  const manageBuyOfferOp$1 = new manageBuyOfferOp.ManageBuyOfferOp({
22522
22743
  selling,
22523
22744
  buying,
@@ -22602,7 +22823,7 @@ exports.manageData = manageData;
22602
22823
 
22603
22824
 
22604
22825
  var operations = __webpack_require__(/*! ../util/operations.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/operations.js");
22605
- var index = __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
22826
+ __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
22606
22827
  var manageSellOfferOp = __webpack_require__(/*! ../../xdr/generated/manage-sell-offer-op.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/manage-sell-offer-op.js");
22607
22828
  var operationBody = __webpack_require__(/*! ../../xdr/generated/operation-body.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/operation-body.js");
22608
22829
  var operation = __webpack_require__(/*! ../../xdr/generated/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/operation.js");
@@ -22618,8 +22839,7 @@ function manageSellOffer(opts) {
22618
22839
  throw new TypeError("price argument is required");
22619
22840
  }
22620
22841
  const price = operations.toXdrPrice(opts.price);
22621
- const offerIdStr = opts.offerId !== void 0 ? opts.offerId.toString() : "0";
22622
- const offerId = index.Int64.fromString(offerIdStr);
22842
+ const offerId = operations.toXdrOfferId(opts.offerId);
22623
22843
  const manageSellOfferOp$1 = new manageSellOfferOp.ManageSellOfferOp({
22624
22844
  selling,
22625
22845
  buying,
@@ -22852,7 +23072,7 @@ exports.restoreFootprint = restoreFootprint;
22852
23072
  "use strict";
22853
23073
 
22854
23074
 
22855
- var index = __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
23075
+ __webpack_require__(/*! ../../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
22856
23076
  var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extras/index.js");
22857
23077
  var strkey = __webpack_require__(/*! ../strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
22858
23078
  var keypair = __webpack_require__(/*! ../keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
@@ -22922,13 +23142,13 @@ function revokeOfferSponsorship(opts = {}) {
22922
23142
  if (!strkey.StrKey.isValidEd25519PublicKey(opts.seller)) {
22923
23143
  throw new Error("seller is invalid");
22924
23144
  }
22925
- if (typeof opts.offerId !== "string") {
23145
+ if (opts.offerId === void 0) {
22926
23146
  throw new Error("offerId is invalid");
22927
23147
  }
22928
23148
  const ledgerKey$1 = ledgerKey.LedgerKey.offer(
22929
23149
  new ledgerKeyOffer.LedgerKeyOffer({
22930
23150
  sellerId: keypair.Keypair.fromPublicKey(opts.seller).xdrAccountId(),
22931
- offerId: index.Int64.fromString(opts.offerId)
23151
+ offerId: operations.toXdrOfferId(opts.offerId)
22932
23152
  })
22933
23153
  );
22934
23154
  const op = revokeSponsorshipOp.RevokeSponsorshipOp.revokeSponsorshipLedgerEntry(ledgerKey$1);
@@ -23299,6 +23519,7 @@ exports.setTrustLineFlags = setTrustLineFlags;
23299
23519
  "use strict";
23300
23520
 
23301
23521
 
23522
+ var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extras/index.js");
23302
23523
  var index = __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
23303
23524
  var keypair = __webpack_require__(/*! ./keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
23304
23525
  var address = __webpack_require__(/*! ./address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
@@ -23308,6 +23529,7 @@ var xdr_large_int = __webpack_require__(/*! ./numbers/xdr_large_int.js */ "../..
23308
23529
  var sc_int = __webpack_require__(/*! ./numbers/sc_int.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/numbers/sc_int.js");
23309
23530
  var scBytes = __webpack_require__(/*! ../xdr/generated/sc-bytes.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-bytes.js");
23310
23531
  var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
23532
+ var scValType = __webpack_require__(/*! ../xdr/generated/sc-val-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val-type.js");
23311
23533
 
23312
23534
  function nativeToScVal(val, opts = {}) {
23313
23535
  switch (typeof val) {
@@ -23404,8 +23626,8 @@ function nativeToScVal(val, opts = {}) {
23404
23626
  );
23405
23627
  }
23406
23628
  const mapTypeSpec = opts?.type ?? {};
23407
- return scVal.ScVal.scvMap(
23408
- Object.entries(val).sort(([key1], [key2]) => key1 < key2 ? -1 : key1 > key2 ? 1 : 0).map(([k, v]) => {
23629
+ return scvSortedMap(
23630
+ Object.entries(val).map(([k, v]) => {
23409
23631
  const [keyType, valType] = Object.hasOwn(mapTypeSpec, k) ? mapTypeSpec[k] ?? [null, null] : [null, null];
23410
23632
  const keyOpts = keyType ? { type: keyType } : {};
23411
23633
  const valOpts = valType ? { type: valType } : {};
@@ -23469,8 +23691,6 @@ function nativeToScVal(val, opts = {}) {
23469
23691
  return scVal.ScVal.scvBool(val);
23470
23692
  case "undefined":
23471
23693
  return scVal.ScVal.scvVoid();
23472
- case "function":
23473
- return nativeToScVal(val());
23474
23694
  default:
23475
23695
  throw new TypeError(
23476
23696
  `failed to convert typeof ${typeof val} (${JSON.stringify(val)})`
@@ -23497,13 +23717,23 @@ function scValToNative(scv) {
23497
23717
  return (scv.value ?? []).map(scValToNative);
23498
23718
  case "scvAddress":
23499
23719
  return address.Address.fromScVal(scv).toString();
23500
- case "scvMap":
23501
- return Object.fromEntries(
23502
- (scv.value ?? []).map((entry) => [
23503
- scValToNative(entry.key),
23504
- scValToNative(entry.val)
23505
- ])
23506
- );
23720
+ case "scvMap": {
23721
+ const pairs = (scv.value ?? []).map((entry) => [
23722
+ scValToNative(entry.key),
23723
+ scValToNative(entry.val)
23724
+ ]);
23725
+ const seen = /* @__PURE__ */ new Set();
23726
+ for (const [key] of pairs) {
23727
+ const prop = String(key);
23728
+ if (seen.has(prop)) {
23729
+ throw new TypeError(
23730
+ `scvMap has more than one key that converts to "${prop}"; read the raw map entries instead`
23731
+ );
23732
+ }
23733
+ seen.add(prop);
23734
+ }
23735
+ return Object.fromEntries(pairs);
23736
+ }
23507
23737
  // these return the primitive type directly
23508
23738
  case "scvBool":
23509
23739
  case "scvU32":
@@ -23552,23 +23782,71 @@ function scValToNative(scv) {
23552
23782
  }
23553
23783
  }
23554
23784
  function scvSortedMap(items) {
23555
- const sorted = Array.from(items).sort((a, b) => {
23556
- const nativeA = scValToNative(a.key);
23557
- const nativeB = scValToNative(b.key);
23558
- switch (typeof nativeA) {
23559
- case "number":
23560
- case "bigint":
23561
- if (nativeA === nativeB) return 0;
23562
- return nativeA < nativeB ? -1 : 1;
23563
- default: {
23564
- const strA = nativeA.toString();
23565
- const strB = nativeB.toString();
23566
- return strA < strB ? -1 : strA > strB ? 1 : 0;
23567
- }
23568
- }
23569
- });
23785
+ const sorted = Array.from(items).sort((a, b) => compareScVal(a.key, b.key));
23570
23786
  return scVal.ScVal.scvMap(sorted);
23571
23787
  }
23788
+ function compareScVal(a, b) {
23789
+ if (a.type !== b.type) {
23790
+ return scValType.ScValType[a.type].value - scValType.ScValType[b.type].value;
23791
+ }
23792
+ switch (a.type) {
23793
+ case "scvBool":
23794
+ return Number(a.b) - Number(b.b);
23795
+ case "scvVoid":
23796
+ case "scvLedgerKeyContractInstance":
23797
+ return 0;
23798
+ case "scvU32":
23799
+ case "scvI32":
23800
+ case "scvU64":
23801
+ case "scvI64":
23802
+ case "scvTimepoint":
23803
+ case "scvDuration":
23804
+ case "scvU128":
23805
+ case "scvI128":
23806
+ case "scvU256":
23807
+ case "scvI256":
23808
+ return compareBigInts(index$1.scValToBigInt(a), index$1.scValToBigInt(b));
23809
+ case "scvBytes":
23810
+ return uint8arrayExtras.compareUint8Arrays(a.bytes.value, b.bytes.value);
23811
+ case "scvString":
23812
+ return uint8arrayExtras.compareUint8Arrays(a.str.bytes, b.str.bytes);
23813
+ case "scvSymbol":
23814
+ return uint8arrayExtras.compareUint8Arrays(a.sym.bytes, b.sym.bytes);
23815
+ case "scvExecutableTag":
23816
+ return uint8arrayExtras.compareUint8Arrays(
23817
+ a.executableTag.bytes,
23818
+ b.executableTag.bytes
23819
+ );
23820
+ case "scvVec":
23821
+ return compareOptionalLists(a.vec, b.vec, compareScVal);
23822
+ case "scvMap":
23823
+ return compareOptionalLists(
23824
+ a.map,
23825
+ b.map,
23826
+ (x, y) => compareScVal(x.key, y.key) || compareScVal(x.val, y.val)
23827
+ );
23828
+ case "scvLedgerKeyNonce":
23829
+ return compareBigInts(a.nonceKey.nonce, b.nonceKey.nonce);
23830
+ // Errors and addresses hold only fixed-size unsigned fields, so their XDR
23831
+ // bytes sort the same as their values. Contract instances are never
23832
+ // sensible map keys, so best-effort byte order is enough there.
23833
+ default:
23834
+ return uint8arrayExtras.compareUint8Arrays(a.toXdr(), b.toXdr());
23835
+ }
23836
+ }
23837
+ function compareBigInts(a, b) {
23838
+ return a < b ? -1 : a > b ? 1 : 0;
23839
+ }
23840
+ function compareOptionalLists(a, b, compare) {
23841
+ if (a === null || b === null) {
23842
+ return Number(a !== null) - Number(b !== null);
23843
+ }
23844
+ for (let i = 0; i < Math.min(a.length, b.length); i++) {
23845
+ const result = compare(a[i], b[i]);
23846
+ if (result !== 0) return result;
23847
+ }
23848
+ return a.length - b.length;
23849
+ }
23572
23850
 
23573
23851
  exports.nativeToScVal = nativeToScVal;
23574
23852
  exports.scValToNative = scValToNative;
@@ -24035,6 +24313,7 @@ exports.SorobanDataBuilder = SorobanDataBuilder;
24035
24313
  var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extras/index.js");
24036
24314
  var base32_js = __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
24037
24315
  var checksum = __webpack_require__(/*! ./util/checksum.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/checksum.js");
24316
+ var bigintParts = __webpack_require__(/*! ../xdr/values/bigint-parts.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/values/bigint-parts.js");
24038
24317
 
24039
24318
  const versionBytes = {
24040
24319
  ed25519PublicKey: 6 << 3,
@@ -24053,8 +24332,10 @@ const versionBytes = {
24053
24332
  // C
24054
24333
  liquidityPool: 11 << 3,
24055
24334
  // L
24056
- claimableBalance: 1 << 3
24335
+ claimableBalance: 1 << 3,
24057
24336
  // B
24337
+ muxedContract: 22 << 3
24338
+ // W
24058
24339
  };
24059
24340
  const strkeyTypes = {
24060
24341
  G: "ed25519PublicKey",
@@ -24065,7 +24346,8 @@ const strkeyTypes = {
24065
24346
  P: "signedPayload",
24066
24347
  C: "contract",
24067
24348
  L: "liquidityPool",
24068
- B: "claimableBalance"
24349
+ B: "claimableBalance",
24350
+ W: "muxedContract"
24069
24351
  };
24070
24352
  function hasVersionByteName(versionByteName) {
24071
24353
  return Object.prototype.hasOwnProperty.call(versionBytes, versionByteName);
@@ -24082,6 +24364,7 @@ function encodedLengthRange(name) {
24082
24364
  case "claimableBalance":
24083
24365
  return [58, 58];
24084
24366
  case "med25519PublicKey":
24367
+ case "muxedContract":
24085
24368
  return [69, 69];
24086
24369
  case "signedPayload":
24087
24370
  return [56, 165];
@@ -24317,6 +24600,31 @@ class StrKey {
24317
24600
  static isValidClaimableBalance(address) {
24318
24601
  return isValid("claimableBalance", address);
24319
24602
  }
24603
+ /**
24604
+ * Encodes raw data to strkey muxed contract (W...): the 32-byte contract ID
24605
+ * followed by the 8-byte big-endian mux ID.
24606
+ *
24607
+ * @param data - data to encode
24608
+ */
24609
+ static encodeMuxedContract(data) {
24610
+ return encodeCheck("muxedContract", data);
24611
+ }
24612
+ /**
24613
+ * Decodes strkey muxed contract (W...) to raw data.
24614
+ *
24615
+ * @param address - address to decode
24616
+ */
24617
+ static decodeMuxedContract(address) {
24618
+ return decodeCheck("muxedContract", address);
24619
+ }
24620
+ /**
24621
+ * Checks validity of alleged muxed contract (W...) strkey address.
24622
+ *
24623
+ * @param address - address to check
24624
+ */
24625
+ static isValidMuxedContract(address) {
24626
+ return isValid("muxedContract", address);
24627
+ }
24320
24628
  /**
24321
24629
  * Encodes raw data to strkey liquidity pool (L...).
24322
24630
  *
@@ -24387,6 +24695,7 @@ function isValid(versionByteName, encoded) {
24387
24695
  return decoded.length === 32 + 1;
24388
24696
  // +1 byte for discriminant
24389
24697
  case "med25519PublicKey":
24698
+ case "muxedContract":
24390
24699
  return decoded.length === 40;
24391
24700
  // +8 bytes for the ID
24392
24701
  case "signedPayload":
@@ -24716,10 +25025,27 @@ function calculateChecksum(payload) {
24716
25025
  checksum[1] = crc16 >> 8 & 255;
24717
25026
  return checksum;
24718
25027
  }
25028
+ function packMuxedContract(contractId, id) {
25029
+ bigintParts.assertBigIntFits(id, false, 64, "MuxedContract.id");
25030
+ const raw = new Uint8Array(40);
25031
+ raw.set(contractId, 0);
25032
+ new DataView(raw.buffer).setBigUint64(32, id);
25033
+ return raw;
25034
+ }
25035
+ function unpackMuxedContract(raw) {
25036
+ return {
25037
+ contractId: raw.subarray(0, 32),
25038
+ id: new DataView(raw.buffer, raw.byteOffset, raw.byteLength).getBigUint64(
25039
+ 32
25040
+ )
25041
+ };
25042
+ }
24719
25043
 
24720
25044
  exports.StrKey = StrKey;
24721
25045
  exports.decodeCheck = decodeCheck;
24722
25046
  exports.encodeCheck = encodeCheck;
25047
+ exports.packMuxedContract = packMuxedContract;
25048
+ exports.unpackMuxedContract = unpackMuxedContract;
24723
25049
  //# sourceMappingURL=strkey.js.map
24724
25050
 
24725
25051
 
@@ -24735,15 +25061,14 @@ exports.encodeCheck = encodeCheck;
24735
25061
 
24736
25062
 
24737
25063
  var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extras/index.js");
24738
- var base64 = __webpack_require__(/*! ./util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
24739
25064
  var index = __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
24740
25065
  var hashing = __webpack_require__(/*! ./hashing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/hashing.js");
24741
25066
  var strkey = __webpack_require__(/*! ./strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
24742
25067
  var operation = __webpack_require__(/*! ./operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/operation.js");
24743
25068
  var memo = __webpack_require__(/*! ./memo.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/memo.js");
24744
25069
  var transaction_base = __webpack_require__(/*! ./transaction_base.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_base.js");
25070
+ var util = __webpack_require__(/*! ../xdr/util.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/util.js");
24745
25071
  var decode_encode_muxed_account = __webpack_require__(/*! ./util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
24746
- var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
24747
25072
  var transactionSignaturePayloadTaggedTransaction = __webpack_require__(/*! ../xdr/generated/transaction-signature-payload-tagged-transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-signature-payload-tagged-transaction.js");
24748
25073
  var transactionSignaturePayload = __webpack_require__(/*! ../xdr/generated/transaction-signature-payload.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-signature-payload.js");
24749
25074
  var transactionV1Envelope = __webpack_require__(/*! ../xdr/generated/transaction-v1-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-v1-envelope.js");
@@ -24751,6 +25076,7 @@ var transactionV0Envelope = __webpack_require__(/*! ../xdr/generated/transaction
24751
25076
  var hashIdPreimageOperationId = __webpack_require__(/*! ../xdr/generated/hash-id-preimage-operation-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash-id-preimage-operation-id.js");
24752
25077
  var transaction = __webpack_require__(/*! ../xdr/generated/transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction.js");
24753
25078
  var hash = __webpack_require__(/*! ../xdr/generated/hash.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash.js");
25079
+ var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
24754
25080
  var transactionV0 = __webpack_require__(/*! ../xdr/generated/transaction-v0.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-v0.js");
24755
25081
  var hashIdPreimage = __webpack_require__(/*! ../xdr/generated/hash-id-preimage.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash-id-preimage.js");
24756
25082
  var publicKey = __webpack_require__(/*! ../xdr/generated/public-key.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/public-key.js");
@@ -24774,17 +25100,13 @@ class Transaction extends transaction_base.TransactionBase {
24774
25100
  * (e.g. "Public Global Stellar Network ; September 2015")
24775
25101
  */
24776
25102
  constructor(envelope, networkPassphrase) {
24777
- if (typeof envelope === "string") {
24778
- const bytes = base64.base64ToUint8Array(envelope);
24779
- envelope = transactionEnvelope.TransactionEnvelope.fromXdr(bytes);
24780
- }
24781
- const envelopeType = envelope.type;
24782
- if (envelopeType !== "envelopeTypeTxV0" && envelopeType !== "envelopeTypeTx") {
24783
- throw new Error(
24784
- `Invalid TransactionEnvelope: expected an envelopeTypeTxV0 or envelopeTypeTx but received an ${envelopeType}.`
24785
- );
24786
- }
24787
- const txEnvelope = envelope.value;
25103
+ const own = transaction_base.ownEnvelope(
25104
+ envelope,
25105
+ (value) => util.isUnionVariant(value, "envelopeTypeTxV0") || util.isUnionVariant(value, "envelopeTypeTx"),
25106
+ "envelopeTypeTxV0 or envelopeTypeTx"
25107
+ );
25108
+ const envelopeType = own.type;
25109
+ const txEnvelope = own.value;
24788
25110
  const tx = txEnvelope.tx;
24789
25111
  const fee = tx.fee.toString();
24790
25112
  const signatures = (txEnvelope.signatures || []).slice();
@@ -25063,8 +25385,40 @@ var keypair = __webpack_require__(/*! ./keypair.js */ "../../node_modules/@stell
25063
25385
  var transaction = __webpack_require__(/*! ../xdr/generated/transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction.js");
25064
25386
  var transactionV0 = __webpack_require__(/*! ../xdr/generated/transaction-v0.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-v0.js");
25065
25387
  var feeBumpTransaction = __webpack_require__(/*! ../xdr/generated/fee-bump-transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/fee-bump-transaction.js");
25388
+ var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
25066
25389
  var decoratedSignature = __webpack_require__(/*! ../xdr/generated/decorated-signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/decorated-signature.js");
25067
25390
 
25391
+ const sdkOwned = /* @__PURE__ */ new WeakSet();
25392
+ function markSdkOwned(envelope) {
25393
+ sdkOwned.add(envelope);
25394
+ return envelope;
25395
+ }
25396
+ function ownEnvelope(envelope, isExpected, expected) {
25397
+ const isString = typeof envelope === "string";
25398
+ const input = isString ? transactionEnvelope.TransactionEnvelope.fromXdr(base64.base64ToUint8Array(envelope)) : envelope;
25399
+ if (!isExpected(input)) {
25400
+ throw new Error(
25401
+ `Invalid TransactionEnvelope: expected an ${expected} but received an ${input.type}.`
25402
+ );
25403
+ }
25404
+ if (isString || sdkOwned.has(input)) {
25405
+ return input;
25406
+ }
25407
+ let own;
25408
+ try {
25409
+ own = transactionEnvelope.TransactionEnvelope.fromXdr(input.toXdr());
25410
+ } catch (error) {
25411
+ throw new Error(
25412
+ `Invalid TransactionEnvelope: ${error instanceof Error ? error.message : String(error)}`
25413
+ );
25414
+ }
25415
+ if (!isExpected(own)) {
25416
+ throw new Error(
25417
+ `TransactionEnvelope changed type in the copy: ${input.type} became ${own.type}.`
25418
+ );
25419
+ }
25420
+ return own;
25421
+ }
25068
25422
  class TransactionBase {
25069
25423
  _tx;
25070
25424
  _signatures;
@@ -25269,6 +25623,8 @@ class TransactionBase {
25269
25623
  }
25270
25624
 
25271
25625
  exports.TransactionBase = TransactionBase;
25626
+ exports.markSdkOwned = markSdkOwned;
25627
+ exports.ownEnvelope = ownEnvelope;
25272
25628
  //# sourceMappingURL=transaction_base.js.map
25273
25629
 
25274
25630
 
@@ -25290,6 +25646,7 @@ var muxed_account = __webpack_require__(/*! ./muxed_account.js */ "../../node_mo
25290
25646
  var decode_encode_muxed_account = __webpack_require__(/*! ./util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
25291
25647
  var transaction = __webpack_require__(/*! ./transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction.js");
25292
25648
  var fee_bump_transaction = __webpack_require__(/*! ./fee_bump_transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/fee_bump_transaction.js");
25649
+ var transaction_base = __webpack_require__(/*! ./transaction_base.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_base.js");
25293
25650
  var sorobandata_builder = __webpack_require__(/*! ./sorobandata_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/sorobandata_builder.js");
25294
25651
  var strkey = __webpack_require__(/*! ./strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
25295
25652
  var signerkey = __webpack_require__(/*! ./signerkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signerkey.js");
@@ -25328,6 +25685,19 @@ var feeBumpTransaction = __webpack_require__(/*! ../xdr/generated/fee-bump-trans
25328
25685
  var feeBumpTransactionEnvelope = __webpack_require__(/*! ../xdr/generated/fee-bump-transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/fee-bump-transaction-envelope.js");
25329
25686
 
25330
25687
  const UINT32_MAX = 4294967295;
25688
+ const MAX_RESOURCE_FEE = 2n ** 50n;
25689
+ function checkResourceFee(resourceFee) {
25690
+ if (resourceFee < 0n || resourceFee > MAX_RESOURCE_FEE) {
25691
+ throw new Error(
25692
+ `Invalid resourceFee ${resourceFee}: must be between 0 and ${MAX_RESOURCE_FEE}`
25693
+ );
25694
+ }
25695
+ }
25696
+ const SOROBAN_OPERATION_TYPES = /* @__PURE__ */ new Set([
25697
+ "invokeHostFunction",
25698
+ "extendFootprintTtl",
25699
+ "restoreFootprint"
25700
+ ]);
25331
25701
  const BASE_FEE = "100";
25332
25702
  const TimeoutInfinite = 0;
25333
25703
  class TransactionBuilder {
@@ -25419,6 +25789,8 @@ class TransactionBuilder {
25419
25789
  * as needed, instead..
25420
25790
  *
25421
25791
  * **TODO:** This cannot clone {@link FeeBumpTransaction}s, yet.
25792
+ *
25793
+ * @throws If the transaction's `resourceFee` is below 0 or above 2^50.
25422
25794
  */
25423
25795
  static cloneFrom(tx, opts = {}) {
25424
25796
  if (!(tx instanceof transaction.Transaction)) {
@@ -25445,15 +25817,18 @@ class TransactionBuilder {
25445
25817
  sorobanData = ext.type === "sorobanData" ? ext.value : void 0;
25446
25818
  }
25447
25819
  let totalFee = parseInt(tx.fee, 10);
25820
+ let zeroInclusionFee = false;
25448
25821
  if (sorobanData) {
25449
- const resourceFee = Number(sorobanData.resourceFee.toString());
25822
+ checkResourceFee(sorobanData.resourceFee);
25823
+ const resourceFee = Number(sorobanData.resourceFee);
25824
+ zeroInclusionFee = totalFee === resourceFee;
25450
25825
  if (totalFee - resourceFee > 0) {
25451
25826
  totalFee -= resourceFee;
25452
25827
  }
25453
25828
  }
25454
25829
  const unscaledFee = Math.floor(totalFee / tx.operations.length);
25455
25830
  const builderOpts = {
25456
- fee: (unscaledFee || BASE_FEE).toString(),
25831
+ fee: (zeroInclusionFee ? 0 : unscaledFee || BASE_FEE).toString(),
25457
25832
  memo: tx.memo,
25458
25833
  networkPassphrase: tx.networkPassphrase
25459
25834
  };
@@ -25550,7 +25925,8 @@ class TransactionBuilder {
25550
25925
  *
25551
25926
  * @param timeoutSeconds - Number of seconds the transaction is good.
25552
25927
  * Can't be negative. If the value is {@link TimeoutInfinite}, the
25553
- * transaction is good indefinitely.
25928
+ * transaction is good indefinitely. An existing `minTime` is kept in
25929
+ * both cases, and a timeout that ends before it throws.
25554
25930
  *
25555
25931
  * @see {@link TimeoutInfinite}
25556
25932
  * @see https://developers.stellar.org/docs/tutorials/handling-errors/
@@ -25564,21 +25940,18 @@ class TransactionBuilder {
25564
25940
  if (timeoutSeconds < 0) {
25565
25941
  throw new Error("timeout cannot be negative");
25566
25942
  }
25943
+ const minTime = this.timebounds?.minTime ?? 0;
25567
25944
  if (timeoutSeconds > 0) {
25568
25945
  const timeoutTimestamp = Math.floor(Date.now() / 1e3) + timeoutSeconds;
25569
- if (this.timebounds === null) {
25570
- this.timebounds = { minTime: 0, maxTime: timeoutTimestamp };
25571
- } else {
25572
- this.timebounds = {
25573
- minTime: this.timebounds.minTime ?? 0,
25574
- maxTime: timeoutTimestamp
25575
- };
25946
+ const minSeconds = toEpochSeconds(minTime) ?? 0;
25947
+ if (minSeconds > timeoutTimestamp) {
25948
+ throw new Error(
25949
+ `timeout ends before min_time (${timeoutTimestamp} < ${minSeconds})`
25950
+ );
25576
25951
  }
25952
+ this.timebounds = { minTime, maxTime: timeoutTimestamp };
25577
25953
  } else {
25578
- this.timebounds = {
25579
- minTime: 0,
25580
- maxTime: 0
25581
- };
25954
+ this.timebounds = { minTime, maxTime: 0 };
25582
25955
  }
25583
25956
  return this;
25584
25957
  }
@@ -25786,12 +26159,15 @@ class TransactionBuilder {
25786
26159
  * This method removes the need for simulation by handling the creation of the
25787
26160
  * appropriate authorization entries and ledger footprint for the transfer operation.
25788
26161
  *
25789
- * @param destination - the address of the recipient of the SAC transfer (should be a valid Stellar address or contract ID)
26162
+ * @param destination - the address of the recipient of the SAC transfer (a G, M, C or W address)
25790
26163
  * @param asset - the SAC asset to be transferred
25791
26164
  * @param amount - the amount of tokens to be transferred in 7 decimals. IE 1 token with 7 decimals of precision would be represented as "1_0000000"
25792
26165
  * @param sorobanFees - optional Soroban fees for the transaction to override the default fees used
26166
+ *
26167
+ * @throws If the builder's source is a muxed (`M...`) account.
25793
26168
  */
25794
26169
  addSacTransferOperation(destination, asset, amount, sorobanFees) {
26170
+ this.assertSorobanSourceNotMuxed();
25795
26171
  if (BigInt(amount) <= 0n) {
25796
26172
  throw new Error("Amount must be a positive integer");
25797
26173
  } else if (BigInt(amount) > index.Int64.MAX_VALUE) {
@@ -25821,7 +26197,7 @@ class TransactionBuilder {
25821
26197
  );
25822
26198
  }
25823
26199
  }
25824
- const isDestinationContract = strkey.StrKey.isValidContract(destination);
26200
+ const isDestinationContract = strkey.StrKey.isValidContract(destination) || strkey.StrKey.isValidMuxedContract(destination);
25825
26201
  if (!isDestinationContract) {
25826
26202
  if (!strkey.StrKey.isValidEd25519PublicKey(destination) && !strkey.StrKey.isValidMed25519PublicKey(destination)) {
25827
26203
  throw new Error(
@@ -25829,8 +26205,9 @@ class TransactionBuilder {
25829
26205
  );
25830
26206
  }
25831
26207
  }
25832
- const destinationBaseAddress = isDestinationContract ? destination : decode_encode_muxed_account.extractBaseAddress(destination);
25833
- if (destinationBaseAddress === decode_encode_muxed_account.extractBaseAddress(this.source.accountId())) {
26208
+ const destinationBaseAddress = decode_encode_muxed_account.extractBaseAddress(destination);
26209
+ const source = this.source.accountId();
26210
+ if (destinationBaseAddress === source) {
25834
26211
  throw new Error("Destination cannot be the same as the source account.");
25835
26212
  }
25836
26213
  if (this.networkPassphrase === null) {
@@ -25840,8 +26217,6 @@ class TransactionBuilder {
25840
26217
  }
25841
26218
  const contractId = asset.contractId(this.networkPassphrase);
25842
26219
  const functionName = "transfer";
25843
- const source = this.source.accountId();
25844
- const sourceBaseAddress = decode_encode_muxed_account.extractBaseAddress(source);
25845
26220
  const args = [
25846
26221
  scval.nativeToScVal(source, { type: "address" }),
25847
26222
  scval.nativeToScVal(destination, { type: "address" }),
@@ -25880,7 +26255,7 @@ class TransactionBuilder {
25880
26255
  contract: address.Address.fromString(contractId).toScAddress(),
25881
26256
  key: scVal.ScVal.scvVec([
25882
26257
  scval.nativeToScVal("Balance", { type: "symbol" }),
25883
- scval.nativeToScVal(destination, { type: "address" })
26258
+ scval.nativeToScVal(destinationBaseAddress, { type: "address" })
25884
26259
  ]),
25885
26260
  durability: contractDataDurability.ContractDataDurability.persistent
25886
26261
  })
@@ -25925,15 +26300,15 @@ class TransactionBuilder {
25925
26300
  footprint.readWrite.push(
25926
26301
  ledgerKey.LedgerKey.account(
25927
26302
  new ledgerKeyAccount.LedgerKeyAccount({
25928
- accountId: keypair.Keypair.fromPublicKey(sourceBaseAddress).xdrPublicKey()
26303
+ accountId: keypair.Keypair.fromPublicKey(source).xdrPublicKey()
25929
26304
  })
25930
26305
  )
25931
26306
  );
25932
- } else if (asset.getIssuer() !== sourceBaseAddress) {
26307
+ } else if (asset.getIssuer() !== source) {
25933
26308
  footprint.readWrite.push(
25934
26309
  ledgerKey.LedgerKey.trustline(
25935
26310
  new ledgerKeyTrustLine.LedgerKeyTrustLine({
25936
- accountId: keypair.Keypair.fromPublicKey(sourceBaseAddress).xdrPublicKey(),
26311
+ accountId: keypair.Keypair.fromPublicKey(source).xdrPublicKey(),
25937
26312
  asset: asset.toTrustLineXdrObject()
25938
26313
  })
25939
26314
  )
@@ -25966,11 +26341,42 @@ class TransactionBuilder {
25966
26341
  this.setSorobanData(sorobanData);
25967
26342
  return this.addOperation(operation$1);
25968
26343
  }
26344
+ // Core rejects any Soroban transaction with a muxed source account.
26345
+ assertSorobanSourceNotMuxed() {
26346
+ if (strkey.StrKey.isValidMed25519PublicKey(this.source.accountId())) {
26347
+ throw new Error(
26348
+ "Soroban transactions cannot use a muxed source account; use the base account"
26349
+ );
26350
+ }
26351
+ }
26352
+ // Core also rejects a muxed operation source and a memo.
26353
+ assertValidSoroban() {
26354
+ this.assertSorobanSourceNotMuxed();
26355
+ if (this.operations.some(
26356
+ (op) => op.sourceAccount?.type === "keyTypeMuxedEd25519"
26357
+ )) {
26358
+ throw new Error(
26359
+ "Soroban operations cannot use a muxed source account; use the base account"
26360
+ );
26361
+ }
26362
+ if (this.memo.type !== "none") {
26363
+ throw new Error("Soroban transactions cannot have a memo");
26364
+ }
26365
+ }
25969
26366
  /**
25970
26367
  * Builds the transaction and increments the source account's sequence
25971
26368
  * number by 1.
26369
+ *
26370
+ * @throws If a Soroban transaction has a muxed (`M...`) source account,
26371
+ * on the transaction or an operation, or has a memo. Also if the Soroban
26372
+ * data's `resourceFee` is below 0, or if the total fee is above the uint32
26373
+ * maximum.
25972
26374
  */
25973
26375
  build() {
26376
+ const isSoroban = this.sorobanData !== null || this.operations.some((op) => SOROBAN_OPERATION_TYPES.has(op.body.type));
26377
+ if (isSoroban) {
26378
+ this.assertValidSoroban();
26379
+ }
25974
26380
  const sequenceNumber = new bignumber.default(this.source.sequenceNumber()).plus(1);
25975
26381
  const fee = new bignumber.default(this.baseFee).times(this.operations.length).toNumber();
25976
26382
  if (fee > UINT32_MAX) {
@@ -26037,6 +26443,7 @@ class TransactionBuilder {
26037
26443
  `Total fee (baseFee * operations + resourceFee) exceeds the maximum uint32 value (${UINT32_MAX}). Got ${attrs.fee}.`
26038
26444
  );
26039
26445
  }
26446
+ checkResourceFee(this.sorobanData.resourceFee);
26040
26447
  } else {
26041
26448
  attrs.ext = transactionExt.TransactionExt.v0();
26042
26449
  }
@@ -26082,6 +26489,8 @@ class TransactionBuilder {
26082
26489
  *
26083
26490
  * Your fee-bump amount should be `>= 10x` the original fee.
26084
26491
  * @see https://developers.stellar.org/docs/glossary/fee-bumps/#replace-by-fee
26492
+ *
26493
+ * @throws If the inner transaction's `resourceFee` is below 0 or above 2^50.
26085
26494
  */
26086
26495
  static buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase) {
26087
26496
  const innerOps = innerTx.operations.length;
@@ -26092,7 +26501,10 @@ class TransactionBuilder {
26092
26501
  case "envelopeTypeTx": {
26093
26502
  const ext = env.value.tx.ext;
26094
26503
  const sorobanData = ext.type === "sorobanData" ? ext.value : void 0;
26095
- resourceFee = new bignumber.default(sorobanData?.resourceFee.toString() ?? 0);
26504
+ if (sorobanData) {
26505
+ checkResourceFee(sorobanData.resourceFee);
26506
+ resourceFee = new bignumber.default(sorobanData.resourceFee.toString());
26507
+ }
26096
26508
  break;
26097
26509
  }
26098
26510
  }
@@ -26169,7 +26581,7 @@ class TransactionBuilder {
26169
26581
  */
26170
26582
  static fromXdr(envelope, networkPassphrase) {
26171
26583
  if (typeof envelope === "string") {
26172
- envelope = transactionEnvelope.TransactionEnvelope.fromXdr(envelope, "base64");
26584
+ envelope = transaction_base.markSdkOwned(transactionEnvelope.TransactionEnvelope.fromXdr(envelope, "base64"));
26173
26585
  }
26174
26586
  if (envelope.type === "envelopeTypeTxFeeBump") {
26175
26587
  return new fee_bump_transaction.FeeBumpTransaction(envelope, networkPassphrase);
@@ -26414,6 +26826,28 @@ var strkey = __webpack_require__(/*! ../strkey.js */ "../../node_modules/@stella
26414
26826
  var muxedAccount = __webpack_require__(/*! ../../xdr/generated/muxed-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account.js");
26415
26827
  var muxedAccountMed25519 = __webpack_require__(/*! ../../xdr/generated/muxed-account-med25519.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account-med25519.js");
26416
26828
 
26829
+ const MAX_UINT64 = BigInt("18446744073709551615");
26830
+ function canonicalUint64Id(id) {
26831
+ return parseUint64Id(id).toString();
26832
+ }
26833
+ function parseUint64Id(id) {
26834
+ if (typeof id !== "string") {
26835
+ throw new Error("id should be a string representing a number (uint64)");
26836
+ }
26837
+ if (id.length > 22) {
26838
+ throw new Error("id must have at most 22 digits");
26839
+ }
26840
+ if (!/^\d+$/.test(id)) {
26841
+ throw new Error(`id is not a valid uint64 string: ${id}`);
26842
+ }
26843
+ const value = BigInt(id);
26844
+ if (value > MAX_UINT64) {
26845
+ throw new Error(
26846
+ `id value out of range for uint64 [0, ${MAX_UINT64}]: ${id}`
26847
+ );
26848
+ }
26849
+ return value;
26850
+ }
26417
26851
  function decodeAddressToMuxedAccount(address) {
26418
26852
  if (strkey.StrKey.isValidMed25519PublicKey(address)) {
26419
26853
  return _decodeAddressFullyToMuxedAccount(address);
@@ -26430,22 +26864,34 @@ function encodeMuxedAccount(address, id) {
26430
26864
  if (!strkey.StrKey.isValidEd25519PublicKey(address)) {
26431
26865
  throw new Error("address should be a Stellar account ID (G...)");
26432
26866
  }
26433
- if (typeof id !== "string") {
26434
- throw new Error("id should be a string representing a number (uint64)");
26435
- }
26436
26867
  return muxedAccount.MuxedAccount.keyTypeMuxedEd25519(
26437
26868
  new muxedAccountMed25519.MuxedAccountMed25519({
26438
- id: index.Uint64.fromString(id),
26869
+ id: index.Uint64.fromString(canonicalUint64Id(id)),
26439
26870
  ed25519: strkey.StrKey.decodeEd25519PublicKey(address)
26440
26871
  })
26441
26872
  );
26442
26873
  }
26874
+ function encodeMuxedContractAddress(contractId, id) {
26875
+ if (!strkey.StrKey.isValidContract(contractId)) {
26876
+ throw new Error("contractId should be a contract address (C...)");
26877
+ }
26878
+ return strkey.StrKey.encodeMuxedContract(
26879
+ strkey.packMuxedContract(strkey.StrKey.decodeContract(contractId), parseUint64Id(id))
26880
+ );
26881
+ }
26443
26882
  function extractBaseAddress(address) {
26444
- if (strkey.StrKey.isValidEd25519PublicKey(address)) {
26883
+ if (strkey.StrKey.isValidEd25519PublicKey(address) || strkey.StrKey.isValidContract(address)) {
26445
26884
  return address;
26446
26885
  }
26886
+ if (strkey.StrKey.isValidMuxedContract(address)) {
26887
+ return strkey.StrKey.encodeContract(
26888
+ strkey.StrKey.decodeMuxedContract(address).subarray(0, 32)
26889
+ );
26890
+ }
26447
26891
  if (!strkey.StrKey.isValidMed25519PublicKey(address)) {
26448
- throw new TypeError(`expected muxed account (M...), got ${address}`);
26892
+ throw new TypeError(
26893
+ `expected an account or contract address (G..., M..., C... or W...), got ${address}`
26894
+ );
26449
26895
  }
26450
26896
  const muxedAccount = decodeAddressToMuxedAccount(address);
26451
26897
  if (muxedAccount.type !== "keyTypeMuxedEd25519") {
@@ -26475,9 +26921,11 @@ function _encodeMuxedAccountFullyToAddress(muxedAccount) {
26475
26921
  );
26476
26922
  }
26477
26923
 
26924
+ exports.canonicalUint64Id = canonicalUint64Id;
26478
26925
  exports.decodeAddressToMuxedAccount = decodeAddressToMuxedAccount;
26479
26926
  exports.encodeMuxedAccount = encodeMuxedAccount;
26480
26927
  exports.encodeMuxedAccountToAddress = encodeMuxedAccountToAddress;
26928
+ exports.encodeMuxedContractAddress = encodeMuxedContractAddress;
26481
26929
  exports.extractBaseAddress = extractBaseAddress;
26482
26930
  //# sourceMappingURL=decode_encode_muxed_account.js.map
26483
26931
 
@@ -26530,6 +26978,41 @@ function toXdrAmount(value) {
26530
26978
  const amount = new bignumber.default(value).times(ONE);
26531
26979
  return index.Int64.fromString(amount.toString());
26532
26980
  }
26981
+ function toXdrOfferId(offerId) {
26982
+ if (offerId === void 0) {
26983
+ return index.Int64.fromString("0");
26984
+ }
26985
+ let value;
26986
+ if (typeof offerId === "number") {
26987
+ if (!Number.isSafeInteger(offerId) || offerId < 0) {
26988
+ throw new Error(
26989
+ "offerId must be a non-negative safe integer; pass a larger ID as a bigint or a decimal string"
26990
+ );
26991
+ }
26992
+ value = BigInt(offerId);
26993
+ } else if (typeof offerId === "bigint") {
26994
+ if (offerId < 0n) {
26995
+ throw new Error("offerId must not be negative");
26996
+ }
26997
+ value = offerId;
26998
+ } else if (typeof offerId === "string") {
26999
+ if (offerId.length > 22) {
27000
+ throw new Error("offerId must have at most 22 digits");
27001
+ }
27002
+ if (!/^\d+$/.test(offerId)) {
27003
+ throw new Error("offerId must be a string of decimal digits");
27004
+ }
27005
+ value = BigInt(offerId);
27006
+ } else {
27007
+ throw new Error(
27008
+ "offerId must be a number, a bigint, or a string of decimal digits"
27009
+ );
27010
+ }
27011
+ if (value > index.Int64.MAX_VALUE) {
27012
+ throw new Error(`offerId must not exceed ${index.Int64.MAX_VALUE}`);
27013
+ }
27014
+ return index.Int64.fromString(value.toString());
27015
+ }
26533
27016
  function fromXdrAmount(value) {
26534
27017
  return new bignumber.default(value.toString()).div(ONE).toFixed(7);
26535
27018
  }
@@ -26552,7 +27035,7 @@ function toXdrPrice(price$1) {
26552
27035
  d: parseInt(String(approx[1]), 10)
26553
27036
  });
26554
27037
  }
26555
- if (xdrObject.n < 0 || xdrObject.d <= 0) {
27038
+ if (xdrObject.n <= 0 || xdrObject.d <= 0) {
26556
27039
  throw new Error("price must be positive");
26557
27040
  }
26558
27041
  return xdrObject;
@@ -26591,6 +27074,7 @@ exports.fromXdrPrice = fromXdrPrice;
26591
27074
  exports.isValidAmount = isValidAmount;
26592
27075
  exports.setSourceAccount = setSourceAccount;
26593
27076
  exports.toXdrAmount = toXdrAmount;
27077
+ exports.toXdrOfferId = toXdrOfferId;
26594
27078
  exports.toXdrPrice = toXdrPrice;
26595
27079
  //# sourceMappingURL=operations.js.map
26596
27080
 
@@ -26830,8 +27314,7 @@ ${eventMethods}
26830
27314
  (param) => param.location.value === scSpecEventParamLocationV0.ScSpecEventParamLocationV0.scSpecEventParamLocationTopicList.value
26831
27315
  );
26832
27316
  const fields = topicParams.map((param) => {
26833
- const rawParamName = param.name.toString();
26834
- const fieldName = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(rawParamName) ? rawParamName : `"${utils.escapeStringLiteral(rawParamName)}"`;
27317
+ const fieldName = utils.propertyKey(param.name.toString());
26835
27318
  const fieldType = utils.parseTypeFromTypeDef(param.type, true);
26836
27319
  return `${fieldName}?: ${fieldType}`;
26837
27320
  }).join("; ");
@@ -26855,13 +27338,10 @@ ${eventMethods}
26855
27338
  */
26856
27339
  generateInterfaceMethod(func) {
26857
27340
  const name = utils.sanitizeIdentifier(func.name.toString());
26858
- const inputs = func.inputs.map((input) => ({
26859
- name: utils.sanitizeIdentifier(input.name.toString()),
26860
- type: utils.parseTypeFromTypeDef(input.type, true)
26861
- }));
27341
+ const inputs = func.inputs.map(ClientGenerator.methodInput);
26862
27342
  const outputType = func.outputs.length > 0 ? utils.parseTypeFromTypeDef(func.outputs[0]) : "void";
26863
27343
  const docs = utils.formatJSDocComment(func.doc.toString(), 2);
26864
- const params = this.formatMethodParameters(inputs);
27344
+ const params = ClientGenerator.formatParameters(inputs);
26865
27345
  return `${docs} ${name}(${params}): Promise<AssembledTransaction<${outputType}>>;`;
26866
27346
  }
26867
27347
  generateFromJsonMethod(func) {
@@ -26873,50 +27353,44 @@ ${eventMethods}
26873
27353
  * Generate deploy method
26874
27354
  */
26875
27355
  generateDeployMethod(constructorFunc) {
26876
- if (!constructorFunc) {
26877
- const params2 = this.formatConstructorParameters([]);
26878
- return ` static deploy<T = Client>(${params2}): Promise<AssembledTransaction<T>> {
26879
- return ContractClient.deploy(null, options);
26880
- }`;
26881
- }
26882
- const inputs = constructorFunc.inputs.map((input) => ({
26883
- name: utils.sanitizeIdentifier(input.name.toString()),
26884
- type: utils.parseTypeFromTypeDef(input.type, true)
26885
- }));
26886
- const params = this.formatConstructorParameters(inputs);
26887
- const inputsDestructure = inputs.length > 0 ? `{ ${inputs.map((i) => i.name).join(", ")} }, ` : "";
27356
+ const inputs = constructorFunc?.inputs.map(ClientGenerator.methodInput) ?? [];
27357
+ const params = ClientGenerator.formatParameters(
27358
+ inputs,
27359
+ ClientGenerator.DEPLOY_OPTIONS_PARAM
27360
+ );
27361
+ const inputsArg = inputs.length > 0 ? "args" : "null";
26888
27362
  return ` static deploy<T = Client>(${params}): Promise<AssembledTransaction<T>> {
26889
- return ContractClient.deploy(${inputsDestructure}options);
27363
+ return ContractClient.deploy(${inputsArg}, options);
26890
27364
  }`;
26891
27365
  }
26892
27366
  /**
26893
- * Format method parameters
27367
+ * Describe one function input for the generated signature. `key` is the
27368
+ * raw spec name as a property key, since the runtime reads arguments by
27369
+ * that name.
26894
27370
  */
26895
- formatMethodParameters(inputs) {
26896
- const params = [];
26897
- if (inputs.length > 0) {
26898
- const inputsParam = `{ ${inputs.map((i) => `${i.name}: ${i.type}`).join("; ")} }`;
26899
- params.push(
26900
- `{ ${inputs.map((i) => i.name).join(", ")} }: ${inputsParam}`
26901
- );
26902
- }
26903
- params.push("options?: MethodOptions");
26904
- return params.join(", ");
27371
+ static methodInput(input) {
27372
+ return {
27373
+ key: utils.propertyKey(input.name.toString()),
27374
+ type: utils.parseTypeFromTypeDef(input.type, true)
27375
+ };
26905
27376
  }
27377
+ static inputsType(inputs) {
27378
+ return `{ ${inputs.map((i) => `${i.key}: ${i.type}`).join("; ")} }`;
27379
+ }
27380
+ static DEPLOY_OPTIONS_PARAM = `options: MethodOptions & Omit<ContractClientOptions, 'contractId'> & { salt?: Uint8Array; address?: string; } & ({ wasmHash: Uint8Array | string; format?: "hex" | "base64"; externalRef?: never; } | { externalRef: ExternalExecutableRef; wasmHash?: never; format?: never; })`;
26906
27381
  /**
26907
- * Format constructor parameters
27382
+ * Format the parameter list for a generated method or `deploy`. The inputs
27383
+ * are always a single `args` object, never destructured: a reserved word,
27384
+ * a strict-mode restricted name or a quoted key can't be a binding, and an
27385
+ * alias in a bodiless interface method is an error (TS2842), so one shape
27386
+ * for every method keeps the output uniform.
26908
27387
  */
26909
- formatConstructorParameters(inputs) {
27388
+ static formatParameters(inputs, optionsParam = "options?: MethodOptions") {
26910
27389
  const params = [];
26911
27390
  if (inputs.length > 0) {
26912
- const inputsParam = `{ ${inputs.map((i) => `${i.name}: ${i.type}`).join("; ")} }`;
26913
- params.push(
26914
- `{ ${inputs.map((i) => i.name).join(", ")} }: ${inputsParam}`
26915
- );
27391
+ params.push(`args: ${ClientGenerator.inputsType(inputs)}`);
26916
27392
  }
26917
- params.push(
26918
- `options: MethodOptions & Omit<ContractClientOptions, 'contractId'> & { salt?: Uint8Array; address?: string; } & ({ wasmHash: Uint8Array | string; format?: "hex" | "base64"; externalRef?: never; } | { externalRef: ExternalExecutableRef; wasmHash?: never; format?: never; })`
26919
- );
27393
+ params.push(optionsParam);
26920
27394
  return params.join(", ");
26921
27395
  }
26922
27396
  }
@@ -26964,7 +27438,7 @@ class ConfigGenerator {
26964
27438
  build: "tsc"
26965
27439
  },
26966
27440
  dependencies: {
26967
- "@stellar/stellar-sdk": `^${"17.0.1"}`,
27441
+ "@stellar/stellar-sdk": `^${"17.4.0"}`,
26968
27442
  buffer: "6.0.3"
26969
27443
  },
26970
27444
  devDependencies: {
@@ -27092,10 +27566,10 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
27092
27566
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
27093
27567
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
27094
27568
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
27569
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
27570
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
27095
27571
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
27096
27572
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
27097
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
27098
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
27099
27573
  __webpack_require__(/*! ../rpc/api.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/api.js");
27100
27574
  __webpack_require__(/*! ../http-client/fetch-client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/http-client/fetch-client.js");
27101
27575
  var spec = __webpack_require__(/*! ../contract/spec.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/spec.js");
@@ -27144,6 +27618,7 @@ class BindingGenerator {
27144
27618
  * @param wasmBytes - The raw WASM binary as a Uint8Array
27145
27619
  * @returns A Promise resolving to a new BindingGenerator instance
27146
27620
  * @throws If the WASM file doesn't contain a valid contract spec
27621
+ * @throws If the WASM file has more than one `contractspecv0` section
27147
27622
  *
27148
27623
  * @example
27149
27624
  * ```ts
@@ -27448,7 +27923,7 @@ class TypeGenerator {
27448
27923
  0
27449
27924
  );
27450
27925
  const fields = struct.fields.map((field) => {
27451
- const fieldName = utils.sanitizeIdentifier(field.name.toString());
27926
+ const fieldName = utils.propertyKey(field.name.toString());
27452
27927
  const fieldType = utils.parseTypeFromTypeDef(field.type);
27453
27928
  const fieldDoc = utils.formatJSDocComment(field.doc.toString(), 2);
27454
27929
  return `${fieldDoc} ${fieldName}: ${fieldType};`;
@@ -27643,10 +28118,9 @@ Note: renamed from "${preferred}" to avoid a collision with another generated na
27643
28118
  (event.doc.toString() || `Event: ${rawName}`) + renameNote,
27644
28119
  0
27645
28120
  );
27646
- const fieldKey = (rawParamName) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(rawParamName) ? rawParamName : `"${utils.escapeStringLiteral(rawParamName)}"`;
27647
28121
  const dataIsMapFormat = event.dataFormat.value === scSpecEventDataFormat.ScSpecEventDataFormat.scSpecEventDataFormatMap.value;
27648
28122
  const dataFields = event.params.map((param) => {
27649
- const fieldName = fieldKey(param.name.toString());
28123
+ const fieldName = utils.propertyKey(param.name.toString());
27650
28124
  const fieldType = utils.parseTypeFromTypeDef(param.type);
27651
28125
  const fieldDoc = utils.formatJSDocComment(param.doc.toString(), 4);
27652
28126
  const optional = dataIsMapFormat && param.location.value === scSpecEventParamLocationV0.ScSpecEventParamLocationV0.scSpecEventParamLocationData.value;
@@ -27774,6 +28248,12 @@ function sanitizeIdentifier(identifier) {
27774
28248
  function escapeStringLiteral(str) {
27775
28249
  return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
27776
28250
  }
28251
+ function propertyKey(rawName) {
28252
+ return isIdentifier(rawName) ? rawName : `"${escapeStringLiteral(rawName)}"`;
28253
+ }
28254
+ function isIdentifier(name) {
28255
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
28256
+ }
27777
28257
  function parseTypeFromTypeDef(typeDef, isFunctionInput = false) {
27778
28258
  switch (typeDef.type) {
27779
28259
  case "scSpecTypeVal":
@@ -28000,6 +28480,7 @@ exports.generateTypeImports = generateTypeImports;
28000
28480
  exports.isNameReserved = isNameReserved;
28001
28481
  exports.isTupleStruct = isTupleStruct;
28002
28482
  exports.parseTypeFromTypeDef = parseTypeFromTypeDef;
28483
+ exports.propertyKey = propertyKey;
28003
28484
  exports.sanitizeIdentifier = sanitizeIdentifier;
28004
28485
  exports.toCamelCase = toCamelCase;
28005
28486
  exports.toPascalCase = toPascalCase;
@@ -28023,10 +28504,10 @@ __webpack_require__(/*! @noble/hashes/sha2.js */ "../../node_modules/@noble/hash
28023
28504
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
28024
28505
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
28025
28506
  var strkey = __webpack_require__(/*! ../base/strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
28507
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
28026
28508
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
28027
28509
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
28028
28510
  var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
28029
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
28030
28511
  var contract = __webpack_require__(/*! ../base/contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/contract.js");
28031
28512
  __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
28032
28513
  var ledgerKey = __webpack_require__(/*! ../xdr/generated/ledger-key.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-key.js");
@@ -28224,14 +28705,14 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
28224
28705
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
28225
28706
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
28226
28707
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
28708
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
28227
28709
  var base64 = __webpack_require__(/*! ../base/util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
28228
28710
  var operation = __webpack_require__(/*! ../base/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/operation.js");
28229
28711
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
28712
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
28230
28713
  var transaction_builder = __webpack_require__(/*! ../base/transaction_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_builder.js");
28231
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
28232
28714
  var contract = __webpack_require__(/*! ../base/contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/contract.js");
28233
28715
  var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
28234
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
28235
28716
  var sorobandata_builder = __webpack_require__(/*! ../base/sorobandata_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/sorobandata_builder.js");
28236
28717
  var auth = __webpack_require__(/*! ../base/auth.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/auth.js");
28237
28718
  var signer = __webpack_require__(/*! ./signer.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/signer.js");
@@ -28246,7 +28727,6 @@ var errors = __webpack_require__(/*! ./errors.js */ "../../node_modules/@stellar
28246
28727
  var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
28247
28728
  var sorobanAuthorizationEntry = __webpack_require__(/*! ../xdr/generated/soroban-authorization-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/soroban-authorization-entry.js");
28248
28729
  var sorobanTransactionData = __webpack_require__(/*! ../xdr/generated/soroban-transaction-data.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/soroban-transaction-data.js");
28249
- var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
28250
28730
  var sorobanCredentials = __webpack_require__(/*! ../xdr/generated/soroban-credentials.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/soroban-credentials.js");
28251
28731
 
28252
28732
  class AssembledTransaction {
@@ -28267,7 +28747,7 @@ class AssembledTransaction {
28267
28747
  * { args: 'for', my: 'method', ... },
28268
28748
  * { simulate: false }
28269
28749
  * );
28270
- * tx.raw.addMemo(Memo.text('Nice memo, friend!'))
28750
+ * tx.raw.setLedgerbounds(0, latestLedger + 100)
28271
28751
  * await tx.simulate();
28272
28752
  * ```
28273
28753
  */
@@ -28463,9 +28943,8 @@ class AssembledTransaction {
28463
28943
  * Deserialize the AssembledTransaction from a base64-encoded XDR string.
28464
28944
  */
28465
28945
  static fromXdr(options, encodedXDR, spec) {
28466
- const envelope = transactionEnvelope.TransactionEnvelope.fromXdr(encodedXDR, "base64");
28467
28946
  const built = transaction_builder.TransactionBuilder.fromXdr(
28468
- envelope,
28947
+ encodedXDR,
28469
28948
  options.networkPassphrase
28470
28949
  );
28471
28950
  const invokeContractArgs = AssembledTransaction.validateInvokeContractOp(
@@ -28573,10 +29052,10 @@ class AssembledTransaction {
28573
29052
  if (options.simulate) await tx.simulate();
28574
29053
  return tx;
28575
29054
  }
28576
- static async buildFootprintRestoreTransaction(options, sorobanData, account, fee) {
29055
+ static async buildFootprintRestoreTransaction(options, sorobanData, account) {
28577
29056
  const tx = new AssembledTransaction(options);
28578
29057
  tx.raw = new transaction_builder.TransactionBuilder(account, {
28579
- fee,
29058
+ fee: options.fee ?? transaction_builder.BASE_FEE,
28580
29059
  networkPassphrase: options.networkPassphrase
28581
29060
  }).setSorobanData(
28582
29061
  sorobanData instanceof sorobandata_builder.SorobanDataBuilder ? sorobanData.build() : sorobanData
@@ -28697,7 +29176,8 @@ You can set \`restore\` to true in the method options in order to automatically
28697
29176
  */
28698
29177
  sign = async ({
28699
29178
  force = false,
28700
- signTransaction = this.options.signTransaction
29179
+ signTransaction = this.options.signTransaction,
29180
+ ignoreContractDelegates = false
28701
29181
  } = {}) => {
28702
29182
  if (!this.built) {
28703
29183
  throw new Error("Transaction has not yet been simulated");
@@ -28721,9 +29201,9 @@ You can set \`restore\` to true in the method options in order to automatically
28721
29201
  "This transaction was constructed using a default account. Provide a valid publicKey in the AssembledTransactionOptions."
28722
29202
  );
28723
29203
  }
28724
- const sigsNeeded = this.needsNonInvokerSigningBy().filter(
28725
- (id) => !id.startsWith("C")
28726
- );
29204
+ const sigsNeeded = this.unsignedAddresses({
29205
+ includeDelegates: !ignoreContractDelegates
29206
+ }).filter((id) => !id.startsWith("C"));
28727
29207
  if (sigsNeeded.length) {
28728
29208
  throw new AssembledTransaction.Errors.NeedsMoreSignatures(
28729
29209
  `Transaction requires signatures from ${sigsNeeded}. See \`needsNonInvokerSigningBy\` for details.`
@@ -28731,7 +29211,6 @@ You can set \`restore\` to true in the method options in order to automatically
28731
29211
  }
28732
29212
  const timeoutInSeconds = this.options.timeoutInSeconds ?? types.DEFAULT_TIMEOUT;
28733
29213
  this.built = transaction_builder.TransactionBuilder.cloneFrom(this.built, {
28734
- fee: this.built.fee,
28735
29214
  timebounds: void 0,
28736
29215
  sorobanData: this.simulationData.transactionData
28737
29216
  }).setTimeout(timeoutInSeconds).build();
@@ -28778,6 +29257,7 @@ You can set \`restore\` to true in the method options in order to automatically
28778
29257
  signAndSend = async ({
28779
29258
  force = false,
28780
29259
  signTransaction = this.options.signTransaction,
29260
+ ignoreContractDelegates = false,
28781
29261
  watcher
28782
29262
  } = {}) => {
28783
29263
  if (!this.signed) {
@@ -28786,32 +29266,38 @@ You can set \`restore\` to true in the method options in order to automatically
28786
29266
  this.options.networkPassphrase
28787
29267
  );
28788
29268
  const wrappedSignTransaction = this.options.submit && signer$1 ? (tx, opts) => signer$1(tx, { ...opts, submit: false }) : signTransaction;
28789
- await this.sign({ force, signTransaction: wrappedSignTransaction });
29269
+ await this.sign({
29270
+ force,
29271
+ signTransaction: wrappedSignTransaction,
29272
+ ignoreContractDelegates
29273
+ });
28790
29274
  }
28791
29275
  return this.send(watcher);
28792
29276
  };
28793
29277
  /**
28794
- * Get a list of accounts, other than the invoker of the simulation, that
28795
- * need to sign auth entries in this transaction.
28796
- *
28797
- * Soroban allows multiple people to sign a transaction. Someone needs to
28798
- * sign the final transaction envelope; this person/account is called the
28799
- * _invoker_, or _source_. Other accounts might need to sign individual auth
28800
- * entries in the transaction, if they're not also the invoker.
28801
- *
28802
- * This function returns a list of accounts that need to sign auth entries,
28803
- * assuming that the same invoker/source account will sign the final
28804
- * transaction envelope as signed the initial simulation.
29278
+ * Lists each address in the address-credential auth entries that still
29279
+ * lacks a signature (or every such address, with `includeAlreadySigned`):
29280
+ * the top-level address, plus the CAP-71 delegates under a `C…` account,
29281
+ * signed or not. On p27 a `G…` account's delegates are never listed. Source
29282
+ * account credentials are skipped, since the envelope signature covers them;
29283
+ * address credentials are listed even when their address is the transaction
29284
+ * source.
28805
29285
  *
28806
- * One at a time, for each public key in this array, you will need to
28807
- * serialize this transaction with `toJson`, send to the owner of that key,
28808
- * deserialize the transaction with `txFromJson`, and call
28809
- * {@link AssembledTransaction.signAuthEntries}. Then re-serialize and send to
28810
- * the next account in this list.
29286
+ * An unsigned `C…` account stays listed even once its delegates have signed;
29287
+ * filter it out if it authorizes only through delegates. `signAuthEntries`
29288
+ * signs top-level addresses only; sign delegates with `authorizeEntry` and
29289
+ * `forAddress`.
29290
+ * This is a signature-presence heuristic, not an authorization check: it
29291
+ * does not see custom account policy or requirements raised inside
29292
+ * `__check_auth`. The contract auth guide covers the caveats.
28811
29293
  */
28812
29294
  needsNonInvokerSigningBy = ({
28813
29295
  includeAlreadySigned = false
28814
- } = {}) => {
29296
+ } = {}) => this.unsignedAddresses({ includeAlreadySigned, includeDelegates: true });
29297
+ unsignedAddresses({
29298
+ includeAlreadySigned = false,
29299
+ includeDelegates
29300
+ }) {
28815
29301
  if (!this.built) {
28816
29302
  throw new Error("Transaction has not yet been simulated");
28817
29303
  }
@@ -28825,19 +29311,15 @@ You can set \`restore\` to true in the method options in order to automatically
28825
29311
  const rawInvokeHostFunctionOp = this.built.operations[0];
28826
29312
  return [
28827
29313
  ...new Set(
28828
- (rawInvokeHostFunctionOp.auth ?? []).map((entry) => auth.inspectAuthEntry(entry)).filter(
28829
- (info) => (
28830
- // skip source-account credentials (no address payload), which
28831
- // are covered by the envelope signature on the source account.
28832
- // Only the top-level credentials (signers[0]) matter here — this
28833
- // method reports (and signAuthEntries signs) the top-level
28834
- // address, so unsigned delegate nodes must not keep it listed.
28835
- info.address !== null && (includeAlreadySigned || !info.signers[0].signed)
28836
- )
28837
- ).map((info) => info.address)
29314
+ (rawInvokeHostFunctionOp.auth ?? []).flatMap(
29315
+ (entry) => utils.pendingSigners(entry.credentials, {
29316
+ includeSigned: includeAlreadySigned,
29317
+ includeDelegates
29318
+ })
29319
+ )
28838
29320
  )
28839
29321
  ];
28840
- };
29322
+ }
28841
29323
  /**
28842
29324
  * If {@link AssembledTransaction#needsNonInvokerSigningBy} returns a
28843
29325
  * non-empty list, you can serialize the transaction with `toJson`, send it to
@@ -28853,30 +29335,52 @@ You can set \`restore\` to true in the method options in order to automatically
28853
29335
  *
28854
29336
  * Sending to all `needsNonInvokerSigningBy` owners in parallel is not
28855
29337
  * currently supported!
29338
+ *
29339
+ * Only top-level address credentials are selected; delegate nodes and
29340
+ * requirements raised inside a custom account's `__check_auth` are not.
29341
+ * `needsNonInvokerSigningBy` also lists `C…` delegates, which this method
29342
+ * rejects, and keeps a `C…` account listed after its delegates sign, so a
29343
+ * loop until that list is empty may never finish. Sign delegates with
29344
+ * `authorizeEntry` and `forAddress` instead.
29345
+ *
29346
+ * With the default authorizer, the wallet's returned `signerAddress` names
29347
+ * the key the signature is verified against, which may differ from `address`.
28856
29348
  */
28857
29349
  signAuthEntries = async ({
28858
- expiration = (async () => (await this.server.getLatestLedger()).sequence + 100)(),
29350
+ expiration,
28859
29351
  signAuthEntry = this.options.signAuthEntry,
28860
- address: address$1 = signer.signerAddress(signAuthEntry) ?? this.options.publicKey,
29352
+ address: addressArg,
28861
29353
  authorizeEntry = auth.authorizeEntry
28862
29354
  } = {}) => {
28863
29355
  if (!this.built)
28864
29356
  throw new Error("Transaction has not yet been assembled or simulated");
29357
+ const derivedAddress = signer.signerAddress(signAuthEntry);
29358
+ const address$1 = addressArg ?? derivedAddress ?? this.options.publicKey;
29359
+ const noEntriesFor = () => {
29360
+ const base = `No auth entries for public key "${address$1}"`;
29361
+ if (addressArg != null || derivedAddress !== void 0) return base;
29362
+ const unnamed = "`address` was not given and `signAuthEntry` does not name one";
29363
+ const fix = "Pass `address` to say who is signing.";
29364
+ return address$1 === void 0 ? `No account to sign for: ${unnamed}. ${fix}` : `${base}; ${unnamed}, so it defaulted to the account that built this transaction. ${fix}`;
29365
+ };
28865
29366
  const signAuth = signer.toSignAuthEntry(
28866
29367
  signAuthEntry,
28867
29368
  this.options.networkPassphrase
28868
29369
  );
28869
29370
  if (authorizeEntry === auth.authorizeEntry) {
28870
- const needsNonInvokerSigningBy = this.needsNonInvokerSigningBy();
28871
- if (needsNonInvokerSigningBy.length === 0) {
29371
+ const unsigned = this.unsignedAddresses({ includeDelegates: false });
29372
+ if (address$1 !== void 0 && !unsigned.includes(address$1) && this.needsNonInvokerSigningBy().includes(address$1)) {
29373
+ throw new AssembledTransaction.Errors.NoSignatureNeeded(
29374
+ `"${address$1}" is an unsigned delegate, and \`signAuthEntries\` signs top-level addresses only. Sign it with \`authorizeEntry\` and \`forAddress\`.`
29375
+ );
29376
+ }
29377
+ if (unsigned.length === 0) {
28872
29378
  throw new AssembledTransaction.Errors.NoUnsignedNonInvokerAuthEntries(
28873
29379
  "No unsigned non-invoker auth entries; maybe you already signed?"
28874
29380
  );
28875
29381
  }
28876
- if (needsNonInvokerSigningBy.indexOf(address$1 ?? "") === -1) {
28877
- throw new AssembledTransaction.Errors.NoSignatureNeeded(
28878
- `No auth entries for public key "${address$1}"`
28879
- );
29382
+ if (unsigned.indexOf(address$1 ?? "") === -1) {
29383
+ throw new AssembledTransaction.Errors.NoSignatureNeeded(noEntriesFor());
28880
29384
  }
28881
29385
  if (!signAuth) {
28882
29386
  throw new AssembledTransaction.Errors.NoSigner(
@@ -28886,6 +29390,13 @@ You can set \`restore\` to true in the method options in order to automatically
28886
29390
  }
28887
29391
  const rawInvokeHostFunctionOp = this.built.operations[0];
28888
29392
  const authEntries = rawInvokeHostFunctionOp.auth ?? [];
29393
+ let signedAny = false;
29394
+ let latestLedger;
29395
+ const defaultExpiration = async (credentials, stored) => {
29396
+ latestLedger ??= this.server.getLatestLedger().then((ledger) => ledger.sequence);
29397
+ const latest = await latestLedger;
29398
+ return credentials.type === "sorobanCredentialsAddressWithDelegates" && stored > latest && stored <= latest + 100 ? stored : latest + 100;
29399
+ };
28889
29400
  for (const [i, entry] of authEntries.entries()) {
28890
29401
  const credentials = sorobanCredentials.SorobanCredentials.fromXdr(entry.credentials.toXdr());
28891
29402
  const addrAuth = auth.getAddressCredentials(credentials);
@@ -28900,18 +29411,25 @@ You can set \`restore\` to true in the method options in order to automatically
28900
29411
  authEntries[i] = await authorizeEntry(
28901
29412
  entry,
28902
29413
  async (preimage) => {
28903
- const { signedAuthEntry, error } = await sign(
28904
- preimage.toXdr("base64"),
28905
- {
28906
- address: address$1
28907
- }
28908
- );
29414
+ const {
29415
+ signedAuthEntry,
29416
+ signerAddress: resultAddress,
29417
+ error
29418
+ } = await sign(preimage.toXdr("base64"), {
29419
+ address: address$1
29420
+ });
28909
29421
  this.handleWalletError(error);
28910
- return base64.base64ToUint8Array(signedAuthEntry);
29422
+ const signature = base64.base64ToUint8Array(signedAuthEntry);
29423
+ const signingKey = authorizeEntry === auth.authorizeEntry ? signer.walletSigningKey(resultAddress) : void 0;
29424
+ return signingKey === void 0 ? signature : { signature, publicKey: signingKey };
28911
29425
  },
28912
- await expiration,
29426
+ await (expiration ?? defaultExpiration(credentials, addrAuth.signatureExpirationLedger)),
28913
29427
  this.options.networkPassphrase
28914
29428
  );
29429
+ signedAny = true;
29430
+ }
29431
+ if (!signedAny) {
29432
+ throw new AssembledTransaction.Errors.NoSignatureNeeded(noEntriesFor());
28915
29433
  }
28916
29434
  };
28917
29435
  /**
@@ -28935,10 +29453,13 @@ You can set \`restore\` to true in the method options in order to automatically
28935
29453
  * 3. Send the signed transaction to the network.
28936
29454
  * 4. Await and return the response from the network.
28937
29455
  *
29456
+ * The restore transaction uses the `fee` option (default: {@link BASE_FEE}) as
29457
+ * its inclusion fee, and takes its resource fee from its own simulation.
29458
+ * `restorePreamble.minResourceFee` is not used.
29459
+ *
28938
29460
  * Preconditions:
28939
29461
  * - A `signTransaction` function must be provided during the Client initialization.
28940
- * - The provided `restorePreamble` should include a minimum resource fee and valid
28941
- * transaction data.
29462
+ * - The provided `restorePreamble` should include valid transaction data.
28942
29463
  *
28943
29464
  * @throws - Throws an error if no `signTransaction` function is provided during
28944
29465
  * Client initialization.
@@ -28955,8 +29476,7 @@ You can set \`restore\` to true in the method options in order to automatically
28955
29476
  const restoreTx = await AssembledTransaction.buildFootprintRestoreTransaction(
28956
29477
  { ...this.options },
28957
29478
  restorePreamble.transactionData,
28958
- account,
28959
- restorePreamble.minResourceFee
29479
+ account
28960
29480
  );
28961
29481
  const sentTransaction = await restoreTx.signAndSend();
28962
29482
  if (!sentTransaction.getTransactionResponse) {
@@ -29015,12 +29535,12 @@ var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_
29015
29535
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
29016
29536
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
29017
29537
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
29538
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
29018
29539
  var base64 = __webpack_require__(/*! ../base/util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
29019
29540
  var operation = __webpack_require__(/*! ../base/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/operation.js");
29020
29541
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
29021
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
29542
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
29022
29543
  var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
29023
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
29024
29544
  var spec = __webpack_require__(/*! ./spec.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/spec.js");
29025
29545
  __webpack_require__(/*! ../rpc/api.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/api.js");
29026
29546
  var server = __webpack_require__(/*! ../rpc/server.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/server.js");
@@ -29163,6 +29683,7 @@ class Client {
29163
29683
  * @param options - The ClientOptions object containing the necessary configuration.
29164
29684
  * @returns A Promise that resolves to a Client instance.
29165
29685
  * @throws If the contract spec cannot be obtained from the provided wasm binary.
29686
+ * @throws If the wasm binary has more than one `contractspecv0` section.
29166
29687
  *
29167
29688
  * @example
29168
29689
  * ```ts
@@ -29323,7 +29844,6 @@ exports.UserRejectedError = UserRejectedError;
29323
29844
 
29324
29845
 
29325
29846
  __webpack_require__(/*! ../xdr/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/index.js");
29326
- var scSpecEventDataFormat = __webpack_require__(/*! ../xdr/generated/sc-spec-event-data-format.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-spec-event-data-format.js");
29327
29847
  var scSpecEventParamLocationV0 = __webpack_require__(/*! ../xdr/generated/sc-spec-event-param-location-v0.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-spec-event-param-location-v0.js");
29328
29848
  var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
29329
29849
 
@@ -29389,46 +29909,60 @@ function parseEvent(spec, entries, topics, data) {
29389
29909
  if (!tlParams) {
29390
29910
  continue;
29391
29911
  }
29392
- try {
29393
- const prefixLen = event.prefixTopics.length;
29394
- const dataOut = /* @__PURE__ */ Object.create(null);
29395
- tlParams.forEach((param, i) => {
29396
- const val = topicVals[prefixLen + i];
29397
- dataOut[param.name.toString()] = spec.scValToNative(val, param.type);
29398
- });
29399
- const dParams = dataParams(event);
29400
- const format = event.dataFormat.value;
29401
- if (format === scSpecEventDataFormat.ScSpecEventDataFormat.scSpecEventDataFormatSingleValue.value) {
29912
+ const dParams = dataParams(event);
29913
+ const dataPairs = [];
29914
+ switch (event.dataFormat.name) {
29915
+ case "scSpecEventDataFormatSingleValue": {
29402
29916
  const param = dParams[0];
29403
29917
  if (param) {
29404
- dataOut[param.name.toString()] = spec.scValToNative(
29405
- dataVal,
29406
- param.type
29407
- );
29918
+ dataPairs.push([param, dataVal]);
29408
29919
  }
29409
- } else if (format === scSpecEventDataFormat.ScSpecEventDataFormat.scSpecEventDataFormatVec.value) {
29410
- const vec = (dataVal.type === "scvVec" ? dataVal.value : null) ?? [];
29920
+ break;
29921
+ }
29922
+ case "scSpecEventDataFormatVec": {
29923
+ if (dataVal.type !== "scvVec") {
29924
+ continue;
29925
+ }
29926
+ const vec = dataVal.value ?? [];
29411
29927
  if (vec.length < dParams.length) {
29412
29928
  continue;
29413
29929
  }
29414
29930
  dParams.forEach((param, i) => {
29415
- dataOut[param.name.toString()] = spec.scValToNative(
29416
- vec[i],
29417
- param.type
29418
- );
29931
+ dataPairs.push([param, vec[i]]);
29419
29932
  });
29420
- } else if (format === scSpecEventDataFormat.ScSpecEventDataFormat.scSpecEventDataFormatMap.value) {
29421
- const map = (dataVal.type === "scvMap" ? dataVal.value : null) ?? [];
29933
+ break;
29934
+ }
29935
+ case "scSpecEventDataFormatMap": {
29936
+ if (dataVal.type !== "scvMap") {
29937
+ continue;
29938
+ }
29939
+ const map = dataVal.value ?? [];
29422
29940
  dParams.forEach((param) => {
29423
29941
  const name = param.name.toString();
29424
29942
  const entry = map.find(
29425
29943
  (e) => e.key.type === "scvSymbol" && e.key.value.toString() === name
29426
29944
  );
29427
29945
  if (entry) {
29428
- dataOut[name] = spec.scValToNative(entry.val, param.type);
29946
+ dataPairs.push([param, entry.val]);
29429
29947
  }
29430
29948
  });
29949
+ break;
29431
29950
  }
29951
+ default: {
29952
+ const unhandled = event.dataFormat.name;
29953
+ throw new Error(`unknown event data format: ${unhandled}`);
29954
+ }
29955
+ }
29956
+ try {
29957
+ const prefixLen = event.prefixTopics.length;
29958
+ const dataOut = /* @__PURE__ */ Object.create(null);
29959
+ tlParams.forEach((param, i) => {
29960
+ const val = topicVals[prefixLen + i];
29961
+ dataOut[param.name.toString()] = spec.scValToNative(val, param.type);
29962
+ });
29963
+ dataPairs.forEach(([param, val]) => {
29964
+ dataOut[param.name.toString()] = spec.scValToNative(val, param.type);
29965
+ });
29432
29966
  return {
29433
29967
  name: event.name.toString(),
29434
29968
  data: dataOut
@@ -29576,10 +30110,10 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
29576
30110
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
29577
30111
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
29578
30112
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
30113
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
30114
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
29579
30115
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
29580
30116
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
29581
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
29582
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
29583
30117
  var utils = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/utils.js");
29584
30118
  var types = __webpack_require__(/*! ./types.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/types.js");
29585
30119
  var errors = __webpack_require__(/*! ./errors.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/errors.js");
@@ -29717,11 +30251,11 @@ var hashing = __webpack_require__(/*! ../base/hashing.js */ "../../node_modules/
29717
30251
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
29718
30252
  __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extras/index.js");
29719
30253
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
29720
- __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
30254
+ var strkey = __webpack_require__(/*! ../base/strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
30255
+ var decode_encode_muxed_account = __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
29721
30256
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
29722
30257
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
29723
30258
  var transaction_builder = __webpack_require__(/*! ../base/transaction_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_builder.js");
29724
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
29725
30259
  __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
29726
30260
 
29727
30261
  class KeypairSigner {
@@ -29784,6 +30318,20 @@ function signerAddress(value) {
29784
30318
  }
29785
30319
  return isKeypairLike(value) ? value.publicKey() : void 0;
29786
30320
  }
30321
+ function walletSigningKey(signerAddress2) {
30322
+ if (signerAddress2 == null || signerAddress2 === "") return void 0;
30323
+ if (typeof signerAddress2 !== "string") {
30324
+ throw new TypeError(
30325
+ `expected the wallet's signerAddress to be a string, got ${typeof signerAddress2}`
30326
+ );
30327
+ }
30328
+ if (strkey.StrKey.isValidEd25519PublicKey(signerAddress2) || strkey.StrKey.isValidMed25519PublicKey(signerAddress2)) {
30329
+ return decode_encode_muxed_account.extractBaseAddress(signerAddress2);
30330
+ }
30331
+ throw new TypeError(
30332
+ strkey.StrKey.isValidContract(signerAddress2) || strkey.StrKey.isValidMuxedContract(signerAddress2) ? `the wallet's signerAddress names contract ${signerAddress2}, but the default authorizer verifies Ed25519 signatures only; sign for a contract account with a custom \`authorizeEntry\`` : `expected the wallet's signerAddress to be an account address (G... or M...), got ${JSON.stringify(signerAddress2)}`
30333
+ );
30334
+ }
29787
30335
  function toSignTransaction(value, networkPassphrase) {
29788
30336
  if (value == null) return void 0;
29789
30337
  if (typeof value === "function") return value;
@@ -29815,6 +30363,7 @@ exports.KeypairSigner = KeypairSigner;
29815
30363
  exports.signerAddress = signerAddress;
29816
30364
  exports.toSignAuthEntry = toSignAuthEntry;
29817
30365
  exports.toSignTransaction = toSignTransaction;
30366
+ exports.walletSigningKey = walletSigningKey;
29818
30367
  //# sourceMappingURL=signer.js.map
29819
30368
 
29820
30369
 
@@ -29836,10 +30385,11 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
29836
30385
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
29837
30386
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
29838
30387
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
30388
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
30389
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
29839
30390
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
29840
30391
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
29841
30392
  var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
29842
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
29843
30393
  var scval = __webpack_require__(/*! ../base/scval.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/scval.js");
29844
30394
  var contract = __webpack_require__(/*! ../base/contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/contract.js");
29845
30395
  var index$1 = __webpack_require__(/*! ../base/numbers/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/numbers/index.js");
@@ -29900,6 +30450,13 @@ function findCase(name) {
29900
30450
  }
29901
30451
  };
29902
30452
  }
30453
+ function plainAddress(address$1) {
30454
+ address.assertNotMuxed(
30455
+ address$1,
30456
+ "is not allowed for an Address parameter; the parameter must be MuxedAddress"
30457
+ );
30458
+ return address$1;
30459
+ }
29903
30460
  function stringToScVal(str, ty) {
29904
30461
  switch (ty) {
29905
30462
  case "scSpecTypeString":
@@ -29907,6 +30464,7 @@ function stringToScVal(str, ty) {
29907
30464
  case "scSpecTypeSymbol":
29908
30465
  return scVal.ScVal.scvSymbol(str);
29909
30466
  case "scSpecTypeAddress":
30467
+ return plainAddress(address.Address.fromString(str)).toScVal();
29910
30468
  case "scSpecTypeMuxedAddress":
29911
30469
  return address.Address.fromString(str).toScVal();
29912
30470
  case "scSpecTypeU64":
@@ -30009,7 +30567,7 @@ const PRIMITIVE_DEFINITONS = {
30009
30567
  MuxedAddress: {
30010
30568
  type: "string",
30011
30569
  format: "address",
30012
- description: "Stellar public key with M prefix combining a G address and unique ID"
30570
+ description: "Account or contract address, optionally muxed: an M address (G address plus ID) or W address (C address plus ID)"
30013
30571
  },
30014
30572
  ScString: {
30015
30573
  type: "string",
@@ -30284,6 +30842,7 @@ class Spec {
30284
30842
  * @param wasm - The contract's wasm binary as a Uint8Array.
30285
30843
  * @returns A Promise that resolves to a Spec instance.
30286
30844
  * @throws If the contract spec cannot be obtained from the provided wasm binary.
30845
+ * @throws If the wasm binary has more than one `contractspecv0` section.
30287
30846
  */
30288
30847
  static fromWasm(wasm) {
30289
30848
  const spec = wasm_spec_parser.specFromWasm(wasm);
@@ -30434,6 +30993,9 @@ class Spec {
30434
30993
  * @throws if value cannot be converted to the given type
30435
30994
  */
30436
30995
  nativeToScVal(val, ty) {
30996
+ if (typeof val === "function") {
30997
+ throw new TypeError(`failed to convert typeof function (${val})`);
30998
+ }
30437
30999
  const tyType = ty.type;
30438
31000
  if (tyType === "scSpecTypeUdt") {
30439
31001
  const udt = ty.value;
@@ -30464,21 +31026,18 @@ class Spec {
30464
31026
  if (scVal.ScVal.is(val)) {
30465
31027
  return val;
30466
31028
  }
30467
- if (val instanceof address.Address) {
30468
- if (ty.type !== "scSpecTypeAddress") {
30469
- throw new TypeError(
30470
- `Type ${ty} was not address, but value was Address`
30471
- );
30472
- }
30473
- return val.toScVal();
30474
- }
30475
- if (val instanceof contract.Contract) {
30476
- if (ty.type !== "scSpecTypeAddress") {
30477
- throw new TypeError(
30478
- `Type ${ty} was not address, but value was Address`
30479
- );
31029
+ if (val instanceof address.Address || val instanceof contract.Contract) {
31030
+ const address = val instanceof contract.Contract ? val.address() : val;
31031
+ switch (ty.type) {
31032
+ case "scSpecTypeAddress":
31033
+ return plainAddress(address).toScVal();
31034
+ case "scSpecTypeMuxedAddress":
31035
+ return address.toScVal();
31036
+ default:
31037
+ throw new TypeError(
31038
+ `Type ${ty} was not address, but value was Address`
31039
+ );
30480
31040
  }
30481
- return val.address().toScVal();
30482
31041
  }
30483
31042
  if (val instanceof Uint8Array) {
30484
31043
  const copy = Uint8Array.from(val);
@@ -30616,8 +31175,6 @@ class Spec {
30616
31175
  );
30617
31176
  }
30618
31177
  }
30619
- case "function":
30620
- return this.nativeToScVal(val(), ty);
30621
31178
  default:
30622
31179
  throw new TypeError(`failed to convert typeof ${typeof val} (${val})`);
30623
31180
  }
@@ -30690,9 +31247,14 @@ class Spec {
30690
31247
  return scVal.ScVal.scvMap(
30691
31248
  fields.map((field) => {
30692
31249
  const name = field.name.toString();
31250
+ const fieldVal = val[name];
31251
+ const isInherited = typeof fieldVal === "function" && fieldVal === Reflect.get(Object.prototype, name) && !Object.hasOwn(val, name);
30693
31252
  return new scVal.ScMapEntry({
30694
31253
  key: this.nativeToScVal(name, scSpecTypeDef.ScSpecTypeDef.scSpecTypeSymbol()),
30695
- val: this.nativeToScVal(val[name], field.type)
31254
+ val: this.nativeToScVal(
31255
+ isInherited ? void 0 : fieldVal,
31256
+ field.type
31257
+ )
30696
31258
  });
30697
31259
  })
30698
31260
  );
@@ -30957,10 +31519,11 @@ class Spec {
30957
31519
  * no event spec matches (e.g. when filtering a mixed stream of
30958
31520
  * events from multiple contracts/specs)
30959
31521
  *
30960
- * Note that matching compares only the prefix topics and the topic count;
30961
- * if two event specs share both (in particular, events with no prefix
30962
- * topics match on arity alone), the first declared spec whose values
30963
- * decode successfully wins.
31522
+ * Note that matching compares only the prefix topics and a minimum topic
31523
+ * count; if more than one event spec matches (in particular, events with
31524
+ * no prefix topics match on arity alone), the first declared spec whose
31525
+ * values decode successfully wins. A `vec` or `map` spec decodes only data
31526
+ * of that container type.
30964
31527
  *
30965
31528
  * @example
30966
31529
  * ```ts
@@ -31093,11 +31656,13 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
31093
31656
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
31094
31657
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
31095
31658
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
31659
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31660
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
31096
31661
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
31097
31662
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
31663
+ var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
31098
31664
  var account = __webpack_require__(/*! ../base/account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/account.js");
31099
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
31100
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31665
+ var auth = __webpack_require__(/*! ../base/auth.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/auth.js");
31101
31666
  var types = __webpack_require__(/*! ./types.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/contract/types.js");
31102
31667
  var xdrValue = __webpack_require__(/*! ../xdr/values/xdr-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/values/xdr-value.js");
31103
31668
  var scSpecEntry = __webpack_require__(/*! ../xdr/generated/sc-spec-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-spec-entry.js");
@@ -31168,6 +31733,10 @@ function parseWasmCustomSections(buffer) {
31168
31733
  throw new Error("Invalid WASM magic");
31169
31734
  if ([...read(4)].join() !== "1,0,0,0")
31170
31735
  throw new Error("Invalid WASM version");
31736
+ const nameDecoder = new TextDecoder("utf-8", {
31737
+ fatal: true,
31738
+ ignoreBOM: true
31739
+ });
31171
31740
  while (offset < buffer.byteLength) {
31172
31741
  const sectionId = read(1)[0];
31173
31742
  const sectionLength = readVarUint32();
@@ -31178,12 +31747,8 @@ function parseWasmCustomSections(buffer) {
31178
31747
  const nameBytes = read(nameLen);
31179
31748
  const payload = read(sectionLength - (offset - start));
31180
31749
  try {
31181
- const name = new TextDecoder("utf-8", { fatal: true }).decode(
31182
- nameBytes
31183
- );
31184
- if (payload.length > 0) {
31185
- sections.set(name, (sections.get(name) || []).concat(payload));
31186
- }
31750
+ const name = nameDecoder.decode(nameBytes);
31751
+ sections.set(name, (sections.get(name) || []).concat(payload));
31187
31752
  } catch {
31188
31753
  }
31189
31754
  }
@@ -31198,11 +31763,33 @@ function processSpecEntryStream(buffer) {
31198
31763
  async function getAccount(options, server) {
31199
31764
  return options.publicKey ? server.getAccount(options.publicKey) : new account.Account(types.NULL_ACCOUNT, "0");
31200
31765
  }
31766
+ const pendingAt = (address$1, signature, delegates, includeSigned) => {
31767
+ const self = includeSigned || !auth.signaturePresent(signature) ? [address.Address.fromScAddress(address$1).toString()] : [];
31768
+ if (address$1.type !== "scAddressTypeContract") return self;
31769
+ return [
31770
+ ...self,
31771
+ ...delegates.flatMap(
31772
+ (d) => pendingAt(d.address, d.signature, d.nestedDelegates, includeSigned)
31773
+ )
31774
+ ];
31775
+ };
31776
+ function pendingSigners(credentials, { includeSigned = false, includeDelegates = true } = {}) {
31777
+ const addrAuth = auth.getAddressCredentials(credentials);
31778
+ if (addrAuth === null) return [];
31779
+ const delegates = includeDelegates && credentials.type === "sorobanCredentialsAddressWithDelegates" ? credentials.addressWithDelegates.delegates : [];
31780
+ return pendingAt(
31781
+ addrAuth.address,
31782
+ addrAuth.signature,
31783
+ delegates,
31784
+ includeSigned
31785
+ );
31786
+ }
31201
31787
 
31202
31788
  exports.contractErrorPattern = contractErrorPattern;
31203
31789
  exports.getAccount = getAccount;
31204
31790
  exports.implementsToString = implementsToString;
31205
31791
  exports.parseWasmCustomSections = parseWasmCustomSections;
31792
+ exports.pendingSigners = pendingSigners;
31206
31793
  exports.processSpecEntryStream = processSpecEntryStream;
31207
31794
  exports.withExponentialBackoff = withExponentialBackoff;
31208
31795
  //# sourceMappingURL=utils.js.map
@@ -31224,7 +31811,12 @@ var utils = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/s
31224
31811
  function specFromWasm(wasm) {
31225
31812
  const customData = utils.parseWasmCustomSections(wasm);
31226
31813
  const xdrSections = customData.get("contractspecv0");
31227
- if (!xdrSections || xdrSections.length === 0) {
31814
+ if (xdrSections && xdrSections.length > 1) {
31815
+ throw new Error(
31816
+ `Expected at most one 'contractspecv0' section in wasm, found ${xdrSections.length}`
31817
+ );
31818
+ }
31819
+ if (!xdrSections || xdrSections[0].length === 0) {
31228
31820
  throw new Error("Could not obtain contract spec from wasm");
31229
31821
  }
31230
31822
  return Uint8Array.from(xdrSections[0]);
@@ -31367,10 +31959,10 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
31367
31959
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
31368
31960
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
31369
31961
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
31962
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31963
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
31370
31964
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
31371
31965
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
31372
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
31373
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31374
31966
  var bad_response = __webpack_require__(/*! ./bad_response.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/errors/bad_response.js");
31375
31967
  var transactionResult = __webpack_require__(/*! ../xdr/generated/transaction-result.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-result.js");
31376
31968
 
@@ -31482,16 +32074,17 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
31482
32074
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
31483
32075
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
31484
32076
  var strkey = __webpack_require__(/*! ../base/strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
32077
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
31485
32078
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
31486
32079
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
31487
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
31488
32080
  __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31489
32081
  var config = __webpack_require__(/*! ../config.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/config.js");
31490
32082
  var bad_response = __webpack_require__(/*! ../errors/bad_response.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/errors/bad_response.js");
31491
32083
  var wrap_http_error = __webpack_require__(/*! ../errors/wrap_http_error.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/errors/wrap_http_error.js");
31492
32084
  var index = __webpack_require__(/*! ../stellartoml/index.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/stellartoml/index.js");
32085
+ var utils = __webpack_require__(/*! ../stellartoml/utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/stellartoml/utils.js");
31493
32086
  var fetchClient = __webpack_require__(/*! ../http-client/fetch-client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/http-client/fetch-client.js");
31494
- var utils = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/federation/utils.js");
32087
+ var utils$1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/federation/utils.js");
31495
32088
 
31496
32089
  const FEDERATION_RESPONSE_MAX_SIZE = 100 * 1024;
31497
32090
  class FederationServer {
@@ -31510,6 +32103,10 @@ class FederationServer {
31510
32103
  */
31511
32104
  timeout;
31512
32105
  // TODO: public or private? readonly?
32106
+ /**
32107
+ * The number of redirects to follow, default: 0.
32108
+ */
32109
+ allowedRedirects;
31513
32110
  /**
31514
32111
  * A helper method for handling user inputs that contain `destination` value.
31515
32112
  * It accepts two types of values:
@@ -31521,6 +32118,8 @@ class FederationServer {
31521
32118
  * resolves if Account ID is valid and rejects in all other cases. Please note that this method does not check
31522
32119
  * if the account actually exists in a ledger.
31523
32120
  *
32121
+ * The `FEDERATION_SERVER` URL is checked as described in {@link FederationServer.createForDomain}.
32122
+ *
31524
32123
  * @example
31525
32124
  * ```ts
31526
32125
  * StellarSdk.FederationServer.resolve('bob*stellar.org')
@@ -31542,6 +32141,7 @@ class FederationServer {
31542
32141
  */
31543
32142
  static async resolve(value, opts = {}) {
31544
32143
  if (value.indexOf("*") < 0) {
32144
+ utils.validateAllowedRedirects(opts.allowedRedirects);
31545
32145
  if (!strkey.StrKey.isValidEd25519PublicKey(value)) {
31546
32146
  return Promise.reject(new Error("Invalid Account ID"));
31547
32147
  }
@@ -31566,6 +32166,15 @@ class FederationServer {
31566
32166
  * If `stellar.toml` file does not exist for a given domain or it does not
31567
32167
  * contain information about a federation server Promise will reject.
31568
32168
  *
32169
+ * The `FEDERATION_SERVER` URL comes from a remote file, so it is checked
32170
+ * before use. The Promise rejects if the URL uses a scheme other than
32171
+ * `http:` or `https:`, or contains a user name or password. The SDK does
32172
+ * not check the host, so the URL can point to a private or local address.
32173
+ * When `allowedRedirects` is set, redirect targets are not checked. A
32174
+ * server-side application that resolves untrusted addresses must filter
32175
+ * the hosts it connects to, for example with DNS filtering or an egress
32176
+ * proxy.
32177
+ *
31569
32178
  * @example
31570
32179
  * ```ts
31571
32180
  * StellarSdk.FederationServer.createForDomain('acme.com')
@@ -31584,21 +32193,29 @@ class FederationServer {
31584
32193
  * @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.
31585
32194
  */
31586
32195
  static async createForDomain(domain, opts = {}) {
31587
- utils.validateDomain(domain);
32196
+ utils$1.validateDomain(domain);
31588
32197
  const tomlObject = await index.Resolver.resolve(domain, opts);
31589
32198
  if (!tomlObject.FEDERATION_SERVER) {
31590
32199
  return Promise.reject(
31591
32200
  new Error("stellar.toml does not contain FEDERATION_SERVER field")
31592
32201
  );
31593
32202
  }
31594
- return new FederationServer(tomlObject.FEDERATION_SERVER, domain, opts);
32203
+ const federationServer = new FederationServer(
32204
+ tomlObject.FEDERATION_SERVER,
32205
+ domain,
32206
+ opts
32207
+ );
32208
+ utils$1.validateFederationServer(federationServer.serverURL);
32209
+ return federationServer;
31595
32210
  }
31596
32211
  constructor(serverURL, domain, opts = {}) {
31597
32212
  this.serverURL = new URL(serverURL);
31598
32213
  this.domain = domain;
31599
- utils.validateDomain(domain);
32214
+ utils$1.validateDomain(domain);
31600
32215
  const allowHttp = typeof opts.allowHttp === "undefined" ? config.Config.isAllowHttp() : opts.allowHttp;
31601
32216
  this.timeout = typeof opts.timeout === "undefined" ? config.Config.getTimeout() : opts.timeout;
32217
+ utils.validateAllowedRedirects(opts.allowedRedirects);
32218
+ this.allowedRedirects = opts.allowedRedirects ?? 0;
31602
32219
  if (this.serverURL.protocol !== "https:" && !allowHttp) {
31603
32220
  throw new Error("Cannot connect to insecure federation server");
31604
32221
  }
@@ -31664,6 +32281,7 @@ class FederationServer {
31664
32281
  const timeout = this.timeout;
31665
32282
  return fetchClient.fetchClient.get(url.toString(), {
31666
32283
  maxContentLength: FEDERATION_RESPONSE_MAX_SIZE,
32284
+ maxRedirects: this.allowedRedirects,
31667
32285
  timeout
31668
32286
  }).then((response) => {
31669
32287
  if (typeof response.data.memo !== "undefined" && typeof response.data.memo !== "string") {
@@ -31714,8 +32332,22 @@ function validateDomain(domain) {
31714
32332
  );
31715
32333
  }
31716
32334
  }
32335
+ function validateFederationServer(url) {
32336
+ let reason;
32337
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
32338
+ reason = `Unsupported protocol ${url.protocol}`;
32339
+ } else if (url.username || url.password) {
32340
+ reason = "The URL must not contain a user name or password.";
32341
+ }
32342
+ if (reason) {
32343
+ throw new Error(
32344
+ `Invalid FEDERATION_SERVER: ${JSON.stringify(url.href)}. ${reason}`
32345
+ );
32346
+ }
32347
+ }
31717
32348
 
31718
32349
  exports.validateDomain = validateDomain;
32350
+ exports.validateFederationServer = validateFederationServer;
31719
32351
  //# sourceMappingURL=utils.js.map
31720
32352
 
31721
32353
 
@@ -31831,11 +32463,11 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
31831
32463
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
31832
32464
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
31833
32465
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
32466
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
32467
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
31834
32468
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
31835
32469
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
31836
32470
  var account = __webpack_require__(/*! ../base/account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/account.js");
31837
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
31838
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31839
32471
 
31840
32472
  class AccountResponse {
31841
32473
  id;
@@ -31984,14 +32616,21 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
31984
32616
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
31985
32617
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
31986
32618
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
32619
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
32620
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
31987
32621
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
31988
32622
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
31989
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
31990
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
31991
32623
  var horizon_axios_client = __webpack_require__(/*! ./horizon_axios_client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/horizon/horizon_axios_client.js");
31992
32624
  var url = __webpack_require__(/*! ../utils/url.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/utils/url.js");
31993
32625
 
31994
32626
  const JOINABLE = ["transaction"];
32627
+ const SKIPPED_LINK_KEYS = /* @__PURE__ */ new Set([
32628
+ "then",
32629
+ "toJSON",
32630
+ "paging_token",
32631
+ "_links",
32632
+ ...Object.getOwnPropertyNames(Object.prototype)
32633
+ ]);
31995
32634
  class CallBuilder {
31996
32635
  url;
31997
32636
  filter;
@@ -32044,7 +32683,7 @@ class CallBuilder {
32044
32683
  * @see [MDN EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)
32045
32684
  * @param options - (optional) EventSource options.
32046
32685
  * - `onmessage` (optional): Callback function to handle incoming messages.
32047
- * - `onerror` (optional): Callback function to handle errors.
32686
+ * - `onerror` (optional): Callback function to handle errors. For an event that the SDK cannot parse, it gets a `MessageEvent` of type `"error"` whose `data` is the error. Without `onerror`, the SDK skips such an event silently.
32048
32687
  * - `reconnectTimeout` (optional): Custom stream connection timeout in ms, default is 15 seconds.
32049
32688
  * @returns Close function. Run to close the connection and stop listening for new events.
32050
32689
  */
@@ -32109,12 +32748,21 @@ class CallBuilder {
32109
32748
  onClose();
32110
32749
  return;
32111
32750
  }
32112
- const result = message.data ? this._parseRecord(JSON.parse(message.data)) : message;
32751
+ clearTimeout(timeout);
32752
+ createTimeout();
32753
+ let result;
32754
+ try {
32755
+ result = message.data ? this._parseRecord(JSON.parse(message.data)) : message;
32756
+ } catch (err) {
32757
+ if (message.lastEventId) {
32758
+ streamUrl.searchParams.set("cursor", message.lastEventId);
32759
+ }
32760
+ onError(new MessageEvent("error", { data: err }));
32761
+ return;
32762
+ }
32113
32763
  if (result.paging_token) {
32114
32764
  streamUrl.searchParams.set("cursor", result.paging_token);
32115
32765
  }
32116
- clearTimeout(timeout);
32117
- createTimeout();
32118
32766
  if (typeof options.onmessage !== "undefined") {
32119
32767
  options.onmessage(result);
32120
32768
  }
@@ -32214,7 +32862,9 @@ class CallBuilder {
32214
32862
  throw new bad_request.BadRequestError("Too many filters specified", this.filter);
32215
32863
  }
32216
32864
  if (this.filter.length === 1) {
32217
- const newSegment = this.originalSegments.concat(this.filter[0]);
32865
+ const newSegment = this.originalSegments.concat(
32866
+ this.filter[0].map(url.encodeSegment)
32867
+ );
32218
32868
  this.url.pathname = newSegment.join("/");
32219
32869
  }
32220
32870
  }
@@ -32230,7 +32880,7 @@ class CallBuilder {
32230
32880
  return async (opts = {}) => {
32231
32881
  let uri;
32232
32882
  if (link.templated) {
32233
- uri = new URL(url.expandUriTemplate(link.href, opts), this.url);
32883
+ uri = new URL(url.expandUriTemplate(link.href, opts, this.url));
32234
32884
  } else {
32235
32885
  uri = new URL(link.href, this.url);
32236
32886
  }
@@ -32249,8 +32899,12 @@ class CallBuilder {
32249
32899
  if (!json._links) {
32250
32900
  return json;
32251
32901
  }
32252
- Object.keys(json._links).forEach((key) => {
32253
- const n = json._links[key];
32902
+ const links = json._links;
32903
+ Object.keys(links).forEach((key) => {
32904
+ if (SKIPPED_LINK_KEYS.has(key)) {
32905
+ return;
32906
+ }
32907
+ const n = links[key];
32254
32908
  let included = false;
32255
32909
  if (typeof json[key] !== "undefined") {
32256
32910
  json[`${key}_attr`] = json[key];
@@ -32621,7 +33275,7 @@ exports.HorizonApi = void 0;
32621
33275
 
32622
33276
  var fetchClient = __webpack_require__(/*! ../http-client/fetch-client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/http-client/fetch-client.js");
32623
33277
 
32624
- const version = "17.0.1";
33278
+ const version = "17.4.0";
32625
33279
  const SERVER_TIME_MAP = {};
32626
33280
  function toSeconds(ms) {
32627
33281
  return Math.floor(ms / 1e3);
@@ -33137,9 +33791,10 @@ __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stell
33137
33791
  var asset = __webpack_require__(/*! ../base/asset.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/asset.js");
33138
33792
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
33139
33793
  var strkey = __webpack_require__(/*! ../base/strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
33794
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
33140
33795
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
33796
+ var util = __webpack_require__(/*! ../xdr/util.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/util.js");
33141
33797
  var fee_bump_transaction = __webpack_require__(/*! ../base/fee_bump_transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/fee_bump_transaction.js");
33142
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
33143
33798
  __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
33144
33799
  var call_builder = __webpack_require__(/*! ./call_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/horizon/call_builder.js");
33145
33800
  var config = __webpack_require__(/*! ../config.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/config.js");
@@ -33166,7 +33821,6 @@ var trade_aggregation_call_builder = __webpack_require__(/*! ./trade_aggregation
33166
33821
  var trades_call_builder = __webpack_require__(/*! ./trades_call_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/horizon/trades_call_builder.js");
33167
33822
  var transaction_call_builder = __webpack_require__(/*! ./transaction_call_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/horizon/transaction_call_builder.js");
33168
33823
  var horizon_axios_client = __webpack_require__(/*! ./horizon_axios_client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/horizon/horizon_axios_client.js");
33169
- var util = __webpack_require__(/*! ../xdr/util.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/util.js");
33170
33824
  var transactionResult = __webpack_require__(/*! ../xdr/generated/transaction-result.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-result.js");
33171
33825
 
33172
33826
  const SUBMIT_TRANSACTION_TIMEOUT = 60 * 1e3;
@@ -34003,10 +34657,10 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
34003
34657
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
34004
34658
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
34005
34659
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
34660
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
34661
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
34006
34662
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
34007
34663
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
34008
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
34009
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
34010
34664
 
34011
34665
  const allowedResolutions = [
34012
34666
  6e4,
@@ -34394,10 +35048,15 @@ function buildBoundedUrl(config) {
34394
35048
  const qs = new URLSearchParams(
34395
35049
  config.params
34396
35050
  ).toString();
35051
+ url = stripFragment(url);
34397
35052
  url += (url.includes("?") ? "&" : "?") + qs;
34398
35053
  }
34399
35054
  return url;
34400
35055
  }
35056
+ function stripFragment(url) {
35057
+ const hashIndex = url.indexOf("#");
35058
+ return hashIndex === -1 ? url : url.slice(0, hashIndex);
35059
+ }
34401
35060
  function encodeRequestBody(data, headers) {
34402
35061
  if (data === void 0 || data === null) return void 0;
34403
35062
  if (typeof data === "string") return data;
@@ -34494,21 +35153,44 @@ function applyRedirectSemantics(init, status) {
34494
35153
  headers.delete("content-type");
34495
35154
  headers.delete("content-length");
34496
35155
  headers.delete("transfer-encoding");
35156
+ headers.delete("content-encoding");
35157
+ headers.delete("content-language");
35158
+ headers.delete("content-location");
35159
+ headers.delete("content-range");
34497
35160
  next.headers = headers;
34498
35161
  return next;
34499
35162
  }
34500
- function stripCrossOriginAuth(init, fromUrl, toUrl) {
34501
- let sameOrigin;
34502
- try {
34503
- sameOrigin = new URL(fromUrl).origin === new URL(toUrl).origin;
34504
- } catch {
34505
- sameOrigin = false;
34506
- }
34507
- if (sameOrigin) return init;
34508
- const headers = new Headers(init.headers || {});
34509
- headers.delete("authorization");
34510
- headers.delete("proxy-authorization");
34511
- headers.delete("cookie");
35163
+ const SAFE_CROSS_ORIGIN_HEADERS = /* @__PURE__ */ new Set([
35164
+ "accept",
35165
+ "accept-encoding",
35166
+ "accept-language",
35167
+ "content-type",
35168
+ "content-length",
35169
+ "content-encoding",
35170
+ "content-language",
35171
+ "content-location",
35172
+ "content-range",
35173
+ "user-agent",
35174
+ "range",
35175
+ "if-range",
35176
+ "if-match",
35177
+ "if-none-match",
35178
+ "if-modified-since",
35179
+ "if-unmodified-since",
35180
+ "cache-control",
35181
+ "pragma",
35182
+ "x-client-name",
35183
+ "x-client-version",
35184
+ "x-app-name",
35185
+ "x-app-version"
35186
+ ]);
35187
+ function stripCrossOriginHeaders(init, fromUrl, toUrl) {
35188
+ if (fromUrl.origin === toUrl.origin) return init;
35189
+ const source = init.headers instanceof Headers ? init.headers : new Headers(init.headers || {});
35190
+ const headers = new Headers();
35191
+ source.forEach((value, name) => {
35192
+ if (SAFE_CROSS_ORIGIN_HEADERS.has(name)) headers.set(name, value);
35193
+ });
34512
35194
  return { ...init, headers };
34513
35195
  }
34514
35196
  function buildHttpError(response, config, data) {
@@ -34524,6 +35206,7 @@ function buildHttpError(response, config, data) {
34524
35206
  };
34525
35207
  return err;
34526
35208
  }
35209
+ let strictUtf8Decoder;
34527
35210
  async function boundedFetchAdapter(config) {
34528
35211
  const { maxRedirects, maxContentLength, timeout } = config;
34529
35212
  const signals = [];
@@ -34553,12 +35236,13 @@ async function boundedFetchAdapter(config) {
34553
35236
  redirect,
34554
35237
  ...signal ? { signal } : {}
34555
35238
  };
34556
- let currentUrl = buildBoundedUrl(config);
35239
+ const startUrl = buildBoundedUrl(config);
35240
+ let current;
34557
35241
  let redirectsRemaining = maxRedirects ?? 0;
34558
35242
  let response;
34559
35243
  while (true) {
34560
35244
  try {
34561
- response = await fetch(currentUrl, currentInit);
35245
+ response = await fetch(current?.href ?? startUrl, currentInit);
34562
35246
  } catch (err) {
34563
35247
  if (err?.name === "TimeoutError") {
34564
35248
  throw new Error(`timeout of ${config.timeout}ms exceeded`);
@@ -34573,10 +35257,17 @@ async function boundedFetchAdapter(config) {
34573
35257
  }
34574
35258
  const location = response.headers.get("location");
34575
35259
  if (!location) break;
34576
- const nextUrl = new URL(location, currentUrl).toString();
35260
+ const from = current ?? new URL(startUrl);
35261
+ const target = new URL(location, from);
35262
+ if (target.protocol !== "http:" && target.protocol !== "https:") {
35263
+ throw new Error(`Unsupported protocol ${target.protocol}`);
35264
+ }
35265
+ if (from.protocol === "https:" && target.protocol === "http:") {
35266
+ throw new Error("Redirect from https: to http: is not allowed");
35267
+ }
34577
35268
  currentInit = applyRedirectSemantics(currentInit, response.status);
34578
- currentInit = stripCrossOriginAuth(currentInit, currentUrl, nextUrl);
34579
- currentUrl = nextUrl;
35269
+ currentInit = stripCrossOriginHeaders(currentInit, from, target);
35270
+ current = target;
34580
35271
  redirectsRemaining -= 1;
34581
35272
  }
34582
35273
  if (!response.ok) {
@@ -34595,7 +35286,13 @@ async function boundedFetchAdapter(config) {
34595
35286
  throw buildHttpError(response, config, errBody);
34596
35287
  }
34597
35288
  const bytes = await readBodyBounded(response, maxContentLength);
34598
- const text = new TextDecoder().decode(bytes);
35289
+ strictUtf8Decoder ??= new TextDecoder("utf-8", { fatal: true });
35290
+ let text;
35291
+ try {
35292
+ text = strictUtf8Decoder.decode(bytes);
35293
+ } catch (err) {
35294
+ throw new Error("Response body is not valid UTF-8", { cause: err });
35295
+ }
34599
35296
  let data = text;
34600
35297
  try {
34601
35298
  data = JSON.parse(text);
@@ -34629,6 +35326,12 @@ function createFetchClient(fetchConfig = {}) {
34629
35326
  if (config.maxRedirects !== void 0 || config.maxContentLength !== void 0) {
34630
35327
  return boundedFetchAdapter(config);
34631
35328
  }
35329
+ if (config.url?.includes("#") && config.params && Object.keys(config.params).length > 0) {
35330
+ return instance.request({
35331
+ ...config,
35332
+ url: stripFragment(config.url)
35333
+ });
35334
+ }
34632
35335
  return instance.request(config);
34633
35336
  }
34634
35337
  },
@@ -34870,6 +35573,7 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
34870
35573
  var hashing = __webpack_require__(/*! ./base/hashing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/hashing.js");
34871
35574
  var signing = __webpack_require__(/*! ./base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
34872
35575
  var get_liquidity_pool_id = __webpack_require__(/*! ./base/get_liquidity_pool_id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/get_liquidity_pool_id.js");
35576
+ var get_claimable_balance_id = __webpack_require__(/*! ./base/get_claimable_balance_id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/get_claimable_balance_id.js");
34873
35577
  var keypair = __webpack_require__(/*! ./base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
34874
35578
  var transaction_base = __webpack_require__(/*! ./base/transaction_base.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_base.js");
34875
35579
  var transaction = __webpack_require__(/*! ./base/transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction.js");
@@ -34927,6 +35631,7 @@ exports.sign = signing.sign;
34927
35631
  exports.verify = signing.verify;
34928
35632
  exports.LiquidityPoolFeeV18 = get_liquidity_pool_id.LiquidityPoolFeeV18;
34929
35633
  exports.getLiquidityPoolId = get_liquidity_pool_id.getLiquidityPoolId;
35634
+ exports.getClaimableBalanceIdFromResult = get_claimable_balance_id.getClaimableBalanceIdFromResult;
34930
35635
  exports.Keypair = keypair.Keypair;
34931
35636
  exports.TransactionBase = transaction_base.TransactionBase;
34932
35637
  exports.Transaction = transaction.Transaction;
@@ -34959,6 +35664,7 @@ exports.Soroban = soroban.Soroban;
34959
35664
  exports.decodeAddressToMuxedAccount = decode_encode_muxed_account.decodeAddressToMuxedAccount;
34960
35665
  exports.encodeMuxedAccount = decode_encode_muxed_account.encodeMuxedAccount;
34961
35666
  exports.encodeMuxedAccountToAddress = decode_encode_muxed_account.encodeMuxedAccountToAddress;
35667
+ exports.encodeMuxedContractAddress = decode_encode_muxed_account.encodeMuxedContractAddress;
34962
35668
  exports.extractBaseAddress = decode_encode_muxed_account.extractBaseAddress;
34963
35669
  exports.Contract = contract.Contract;
34964
35670
  exports.Address = address.Address;
@@ -35003,6 +35709,30 @@ exports.Api = void 0;
35003
35709
  GetTransactionStatus2["NOT_FOUND"] = "NOT_FOUND";
35004
35710
  GetTransactionStatus2["FAILED"] = "FAILED";
35005
35711
  })(Api2.GetTransactionStatus || (Api2.GetTransactionStatus = {}));
35712
+ ((QueryEventsScanStatus2) => {
35713
+ QueryEventsScanStatus2["HAS_MORE"] = "HAS_MORE";
35714
+ QueryEventsScanStatus2["WAITING_FOR_LEDGERS"] = "WAITING_FOR_LEDGERS";
35715
+ QueryEventsScanStatus2["OLDEST_REACHED"] = "OLDEST_REACHED";
35716
+ QueryEventsScanStatus2["COMPLETE"] = "COMPLETE";
35717
+ })(Api2.QueryEventsScanStatus || (Api2.QueryEventsScanStatus = {}));
35718
+ Api2.QUERY_EVENTS_INVALID_PARAMS = -32602;
35719
+ const QUERY_EVENTS_ERROR_REASONS = /* @__PURE__ */ new Set([
35720
+ "invalid_params",
35721
+ "ledger_out_of_range",
35722
+ "cursor_malformed"
35723
+ ]);
35724
+ function isQueryEventsError(err) {
35725
+ if (typeof err !== "object" || err === null) {
35726
+ return false;
35727
+ }
35728
+ const { code, data } = err;
35729
+ if (code !== Api2.QUERY_EVENTS_INVALID_PARAMS || typeof data !== "object" || data === null) {
35730
+ return false;
35731
+ }
35732
+ const { reason } = data;
35733
+ return typeof reason === "string" && QUERY_EVENTS_ERROR_REASONS.has(reason);
35734
+ }
35735
+ Api2.isQueryEventsError = isQueryEventsError;
35006
35736
  function isSimulationError(sim) {
35007
35737
  return "error" in sim;
35008
35738
  }
@@ -35036,14 +35766,15 @@ exports.Api = void 0;
35036
35766
 
35037
35767
  var fetchClient = __webpack_require__(/*! ../http-client/fetch-client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/http-client/fetch-client.js");
35038
35768
 
35039
- const version = "17.0.1";
35040
- function createHttpClient(headers) {
35769
+ const version = "17.4.0";
35770
+ function createHttpClient(headers, timeout) {
35041
35771
  return fetchClient.create({
35042
35772
  headers: {
35043
35773
  ...headers,
35044
35774
  "X-Client-Name": "js-stellar-sdk",
35045
35775
  "X-Client-Version": version
35046
- }
35776
+ },
35777
+ timeout
35047
35778
  });
35048
35779
  }
35049
35780
 
@@ -35079,6 +35810,7 @@ exports.Durability = server.Durability;
35079
35810
  exports.LinearSleepStrategy = server.LinearSleepStrategy;
35080
35811
  exports.Server = server.RpcServer;
35081
35812
  exports.parseRawEvents = parsers.parseRawEvents;
35813
+ exports.parseRawQueryEvents = parsers.parseRawQueryEvents;
35082
35814
  exports.parseRawSimulation = parsers.parseRawSimulation;
35083
35815
  exports.assembleTransaction = transaction.assembleTransaction;
35084
35816
  //# sourceMappingURL=index.js.map
@@ -35134,26 +35866,26 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
35134
35866
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
35135
35867
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
35136
35868
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
35869
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
35870
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
35137
35871
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
35138
35872
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
35139
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
35140
35873
  var sorobandata_builder = __webpack_require__(/*! ../base/sorobandata_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/sorobandata_builder.js");
35141
35874
  var contract = __webpack_require__(/*! ../base/contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/contract.js");
35142
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
35143
35875
  var api = __webpack_require__(/*! ./api.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/api.js");
35144
35876
  var diagnosticEvent = __webpack_require__(/*! ../xdr/generated/diagnostic-event.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/diagnostic-event.js");
35145
35877
  var ledgerEntryData = __webpack_require__(/*! ../xdr/generated/ledger-entry-data.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-entry-data.js");
35146
35878
  var transactionMeta = __webpack_require__(/*! ../xdr/generated/transaction-meta.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-meta.js");
35147
35879
  var transactionEvent = __webpack_require__(/*! ../xdr/generated/transaction-event.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-event.js");
35148
35880
  var contractEvent = __webpack_require__(/*! ../xdr/generated/contract-event.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/contract-event.js");
35149
- var transactionResult = __webpack_require__(/*! ../xdr/generated/transaction-result.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-result.js");
35150
35881
  var ledgerHeader = __webpack_require__(/*! ../xdr/generated/ledger-header.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-header.js");
35151
35882
  var ledgerCloseMeta = __webpack_require__(/*! ../xdr/generated/ledger-close-meta.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-close-meta.js");
35152
35883
  var ledgerHeaderHistoryEntry = __webpack_require__(/*! ../xdr/generated/ledger-header-history-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-header-history-entry.js");
35153
35884
  var ledgerEntry = __webpack_require__(/*! ../xdr/generated/ledger-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-entry.js");
35154
- var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
35155
35885
  var ledgerKey = __webpack_require__(/*! ../xdr/generated/ledger-key.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-key.js");
35886
+ var transactionResult = __webpack_require__(/*! ../xdr/generated/transaction-result.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-result.js");
35156
35887
  var transactionEnvelope = __webpack_require__(/*! ../xdr/generated/transaction-envelope.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/transaction-envelope.js");
35888
+ var scVal = __webpack_require__(/*! ../xdr/generated/sc-val.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/sc-val.js");
35157
35889
  var sorobanAuthorizationEntry = __webpack_require__(/*! ../xdr/generated/soroban-authorization-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/soroban-authorization-entry.js");
35158
35890
 
35159
35891
  function parseRawSendTransaction(raw) {
@@ -35222,18 +35954,37 @@ function parseRawEvents(raw) {
35222
35954
  latestLedgerCloseTime: raw.latestLedgerCloseTime,
35223
35955
  oldestLedgerCloseTime: raw.oldestLedgerCloseTime,
35224
35956
  cursor: raw.cursor,
35957
+ events: (raw.events ?? []).map(parseRawEvent)
35958
+ };
35959
+ }
35960
+ function parseRawEvent(evt) {
35961
+ const clone = { ...evt };
35962
+ delete clone.contractId;
35963
+ return {
35964
+ ...clone,
35965
+ ...evt.contractId !== "" && {
35966
+ contractId: new contract.Contract(evt.contractId)
35967
+ },
35968
+ topic: (evt.topic ?? []).map((topic) => scVal.ScVal.fromXdr(topic, "base64")),
35969
+ value: scVal.ScVal.fromXdr(evt.value, "base64")
35970
+ };
35971
+ }
35972
+ function parseRawQueryEvents(raw) {
35973
+ return {
35225
35974
  events: (raw.events ?? []).map((evt) => {
35226
- const clone = { ...evt };
35227
- delete clone.contractId;
35228
- return {
35229
- ...clone,
35230
- ...evt.contractId !== "" && {
35231
- contractId: new contract.Contract(evt.contractId)
35232
- },
35233
- topic: (evt.topic ?? []).map((topic) => scVal.ScVal.fromXdr(topic, "base64")),
35234
- value: scVal.ScVal.fromXdr(evt.value, "base64")
35235
- };
35236
- })
35975
+ const { value } = evt;
35976
+ if (typeof value !== "string") {
35977
+ throw new Error(
35978
+ 'queryEvents event has no base64 value; was xdrFormat "json"?'
35979
+ );
35980
+ }
35981
+ return parseRawEvent({ ...evt, value });
35982
+ }),
35983
+ ...raw.cursor !== void 0 && { cursor: raw.cursor },
35984
+ scanStatus: raw.scanStatus,
35985
+ scannedLedger: raw.scannedLedger,
35986
+ oldestLedger: raw.oldestLedger,
35987
+ latestLedger: raw.latestLedger
35237
35988
  };
35238
35989
  }
35239
35990
  function parseRawLedgerEntries(raw) {
@@ -35365,6 +36116,7 @@ exports.parseRawEvents = parseRawEvents;
35365
36116
  exports.parseRawLatestLedger = parseRawLatestLedger;
35366
36117
  exports.parseRawLedger = parseRawLedger;
35367
36118
  exports.parseRawLedgerEntries = parseRawLedgerEntries;
36119
+ exports.parseRawQueryEvents = parseRawQueryEvents;
35368
36120
  exports.parseRawSendTransaction = parseRawSendTransaction;
35369
36121
  exports.parseRawSimulation = parseRawSimulation;
35370
36122
  exports.parseRawTransactions = parseRawTransactions;
@@ -35390,11 +36142,11 @@ __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stell
35390
36142
  var keypair = __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
35391
36143
  var strkey = __webpack_require__(/*! ../base/strkey.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/strkey.js");
35392
36144
  var base64 = __webpack_require__(/*! ../base/util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
36145
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
35393
36146
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
35394
36147
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
35395
36148
  var address = __webpack_require__(/*! ../base/address.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/address.js");
35396
36149
  var account = __webpack_require__(/*! ../base/account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/account.js");
35397
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
35398
36150
  var scval = __webpack_require__(/*! ../base/scval.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/scval.js");
35399
36151
  var contract = __webpack_require__(/*! ../base/contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/contract.js");
35400
36152
  __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
@@ -35422,6 +36174,87 @@ var Durability = /* @__PURE__ */ ((Durability2) => {
35422
36174
  return Durability2;
35423
36175
  })(Durability || {});
35424
36176
  const DEFAULT_GET_TRANSACTION_TIMEOUT = 30;
36177
+ const MAX_TIMEOUT_MS = 2 ** 31 - 1;
36178
+ function isSet(value) {
36179
+ return value !== void 0 && value !== null;
36180
+ }
36181
+ function encodeQueryEventsNumber(name, value, max = Number.MAX_SAFE_INTEGER) {
36182
+ if (!Number.isInteger(value) || value < 0 || value > max) {
36183
+ throw new TypeError(
36184
+ `queryEvents ${name} must be an integer from 0 to ${max}`
36185
+ );
36186
+ }
36187
+ return value;
36188
+ }
36189
+ function encodeQueryEventsTopic(name, topic) {
36190
+ if (topic === "*") {
36191
+ throw new TypeError(
36192
+ `queryEvents filter ${name} cannot be "*"; omit it to match any value`
36193
+ );
36194
+ }
36195
+ if (typeof topic === "string") {
36196
+ return topic;
36197
+ }
36198
+ if (typeof topic === "object" && topic !== null && typeof topic.toXdr === "function") {
36199
+ return topic.toXdr("base64");
36200
+ }
36201
+ throw new TypeError(
36202
+ `queryEvents filter ${name} must be a base64 string or an ScVal`
36203
+ );
36204
+ }
36205
+ function encodeQueryEventsFilter(filter) {
36206
+ if (typeof filter !== "object" || filter === null) {
36207
+ throw new TypeError("queryEvents filter must be an object");
36208
+ }
36209
+ const f = filter;
36210
+ const out = {};
36211
+ if (isSet(f.type) && f.type !== "") {
36212
+ out.type = f.type;
36213
+ }
36214
+ if (isSet(f.contractId) && f.contractId !== "") {
36215
+ out.contractId = f.contractId;
36216
+ }
36217
+ for (const key of ["topic0", "topic1", "topic2", "topic3"]) {
36218
+ if (isSet(f[key]) && f[key] !== "") {
36219
+ out[key] = encodeQueryEventsTopic(key, f[key]);
36220
+ }
36221
+ }
36222
+ return out;
36223
+ }
36224
+ function encodeQueryEventsRequest(request) {
36225
+ const r = request;
36226
+ const rangeKeySet = ["minLedger", "maxLedger", "order", "filters"].some(
36227
+ (key) => isSet(r[key])
36228
+ );
36229
+ if ("cursor" in r && (isSet(r.cursor) || !rangeKeySet) && (typeof r.cursor !== "string" || r.cursor === "")) {
36230
+ throw new TypeError("queryEvents cursor must be a non-empty string");
36231
+ }
36232
+ const out = {};
36233
+ for (const key of ["minLedger", "maxLedger"]) {
36234
+ if (isSet(r[key])) {
36235
+ const value = encodeQueryEventsNumber(key, r[key], 2 ** 32 - 1);
36236
+ if (value !== 0) {
36237
+ out[key] = value;
36238
+ }
36239
+ }
36240
+ }
36241
+ if (isSet(r.order) && r.order !== "") {
36242
+ out.order = r.order;
36243
+ }
36244
+ if (isSet(r.filters)) {
36245
+ if (!Array.isArray(r.filters)) {
36246
+ throw new TypeError("queryEvents filters must be an array");
36247
+ }
36248
+ out.filters = r.filters.map(encodeQueryEventsFilter);
36249
+ }
36250
+ if (isSet(r.cursor)) {
36251
+ out.cursor = r.cursor;
36252
+ }
36253
+ if (isSet(r.limit)) {
36254
+ out.limit = encodeQueryEventsNumber("limit", r.limit);
36255
+ }
36256
+ return out;
36257
+ }
35425
36258
  const BasicSleepStrategy = (_iter) => 1e3;
35426
36259
  const LinearSleepStrategy = (iter) => 1e3 * iter;
35427
36260
  function findCreatedAccountSequenceInTransactionMeta(meta) {
@@ -35453,6 +36286,20 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
35453
36286
  }
35454
36287
  throw new Error("No account created in transaction");
35455
36288
  }
36289
+ function containsMuxedAddress(val) {
36290
+ switch (val.type) {
36291
+ case "scvAddress":
36292
+ return val.value.type === "scAddressTypeMuxedAccount" || val.value.type === "scAddressTypeMuxedContract";
36293
+ case "scvVec":
36294
+ return (val.value ?? []).some(containsMuxedAddress);
36295
+ case "scvMap":
36296
+ return (val.value ?? []).some(
36297
+ (e) => containsMuxedAddress(e.key) || containsMuxedAddress(e.val)
36298
+ );
36299
+ default:
36300
+ return false;
36301
+ }
36302
+ }
35456
36303
  function contractSpecTypeName(td) {
35457
36304
  if (td.type === "scSpecTypeUdt") {
35458
36305
  return td.value.name.toString();
@@ -35480,7 +36327,13 @@ class RpcServer {
35480
36327
  httpClient;
35481
36328
  constructor(serverURL, opts = {}) {
35482
36329
  this.serverURL = new URL(serverURL);
35483
- this.httpClient = axios.createHttpClient(opts.headers);
36330
+ const { timeout } = opts;
36331
+ if (timeout !== void 0 && !(Number.isInteger(timeout) && timeout >= 0 && timeout <= MAX_TIMEOUT_MS)) {
36332
+ throw new Error(
36333
+ `timeout must be 0 or a whole number of milliseconds up to ${MAX_TIMEOUT_MS}, got ${String(timeout)}`
36334
+ );
36335
+ }
36336
+ this.httpClient = axios.createHttpClient(opts.headers, timeout);
35484
36337
  if (this.serverURL.protocol !== "https:" && !opts.allowHttp) {
35485
36338
  throw new Error(
35486
36339
  "Cannot connect to insecure Soroban RPC server if `allowHttp` isn't set"
@@ -35662,8 +36515,8 @@ class RpcServer {
35662
36515
  * @returns Resolves with balance entry details
35663
36516
  * when available.
35664
36517
  *
35665
- * @throws If the supplied `address` is not a valid account or
35666
- * contract strkey.
36518
+ * @throws If the supplied `address` is not a valid account or contract
36519
+ * strkey, or is a muxed address (`M...` or `W...`).
35667
36520
  *
35668
36521
  * @example
35669
36522
  * ```ts
@@ -35709,6 +36562,7 @@ class RpcServer {
35709
36562
  } else if (strkey.StrKey.isValidContract(addr)) {
35710
36563
  return this.getSACBalance(addr, asset, networkPassphrase);
35711
36564
  }
36565
+ address.assertNotMuxed(addr, "has no balance of its own; use its base address");
35712
36566
  throw new Error(`invalid address: ${address$1}`);
35713
36567
  }
35714
36568
  /**
@@ -35750,6 +36604,9 @@ class RpcServer {
35750
36604
  * or 'persistent' (the default), see {@link rpc.Durability}.
35751
36605
  * @returns The current data value
35752
36606
  *
36607
+ * @throws If `contract` is a muxed address, or `key` contains a muxed
36608
+ * address (`M...` or `W...`).
36609
+ *
35753
36610
  * **Warning:** If the data entry in question is a 'temporary' entry, it's
35754
36611
  * entirely possible that it has expired out of existence.
35755
36612
  *
@@ -35769,6 +36626,12 @@ class RpcServer {
35769
36626
  */
35770
36627
  async getContractData(contract$1, key, durability = "persistent" /* Persistent */) {
35771
36628
  let scAddress;
36629
+ if (typeof contract$1 === "string" || contract$1 instanceof address.Address) {
36630
+ address.assertNotMuxed(
36631
+ contract$1,
36632
+ "cannot own contract data; use its base address"
36633
+ );
36634
+ }
35772
36635
  if (typeof contract$1 === "string") {
35773
36636
  scAddress = new contract.Contract(contract$1).address().toScAddress();
35774
36637
  } else if (contract$1 instanceof address.Address) {
@@ -35778,6 +36641,11 @@ class RpcServer {
35778
36641
  } else {
35779
36642
  throw new TypeError(`unknown contract type: ${contract$1}`);
35780
36643
  }
36644
+ if (containsMuxedAddress(key)) {
36645
+ throw new TypeError(
36646
+ "contract data keys cannot contain muxed addresses (M... or W...)"
36647
+ );
36648
+ }
35781
36649
  let xdrDurability;
35782
36650
  switch (durability) {
35783
36651
  case "temporary" /* Temporary */:
@@ -35796,9 +36664,8 @@ class RpcServer {
35796
36664
  durability: xdrDurability
35797
36665
  })
35798
36666
  );
35799
- try {
35800
- return await this.getLedgerEntry(contractKey);
35801
- } catch {
36667
+ const { entries } = await this.getLedgerEntries(contractKey);
36668
+ if (entries.length !== 1) {
35802
36669
  throw {
35803
36670
  code: 404,
35804
36671
  message: `Contract data not found for ${address.Address.fromScAddress(
@@ -35806,6 +36673,7 @@ class RpcServer {
35806
36673
  ).toString()} with key ${key.toXdr("base64")} and durability: ${durability}`
35807
36674
  };
35808
36675
  }
36676
+ return entries[0];
35809
36677
  }
35810
36678
  /**
35811
36679
  * Retrieves the deployed contract instance for a given contract ID.
@@ -36388,6 +37256,43 @@ class RpcServer {
36388
37256
  }
36389
37257
  );
36390
37258
  }
37259
+ /**
37260
+ * Fetch one page of contract and system events with the `queryEvents`
37261
+ * method, which only the archival RPC node serves (in beta). To page, send
37262
+ * `{ cursor, limit }` from the response while `scanStatus` is `HAS_MORE`,
37263
+ * wait and retry on `WAITING_FOR_LEDGERS`, and stop on `OLDEST_REACHED` or
37264
+ * `COMPLETE`.
37265
+ *
37266
+ * @param request - a ledger range query or a cursor continuation
37267
+ * @returns one page of parsed events and the scan status
37268
+ *
37269
+ * @example
37270
+ * ```ts
37271
+ * let res = await server.queryEvents({ minLedger: 1000, limit: 50 });
37272
+ * for (;;) {
37273
+ * handle(res.events);
37274
+ * if (res.scanStatus === rpc.Api.QueryEventsScanStatus.WAITING_FOR_LEDGERS) {
37275
+ * await new Promise((resolve) => setTimeout(resolve, 5000));
37276
+ * } else if (res.scanStatus !== rpc.Api.QueryEventsScanStatus.HAS_MORE) {
37277
+ * break;
37278
+ * }
37279
+ * res = await server.queryEvents({ cursor: res.cursor!, limit: 50 });
37280
+ * }
37281
+ * ```
37282
+ */
37283
+ async queryEvents(request) {
37284
+ return this._queryEvents(encodeQueryEventsRequest(request)).then(
37285
+ parsers.parseRawQueryEvents
37286
+ );
37287
+ }
37288
+ async _queryEvents(request) {
37289
+ return jsonrpc.postObject(
37290
+ this.httpClient,
37291
+ this.serverURL.toString(),
37292
+ "queryEvents",
37293
+ request
37294
+ );
37295
+ }
36391
37296
  /**
36392
37297
  * Fetch metadata about the network this Soroban RPC server is connected to.
36393
37298
  *
@@ -36849,7 +37754,7 @@ class RpcServer {
36849
37754
  * entry details if and only if the request returned a valid balance ledger
36850
37755
  * entry. If it doesn't, the `balanceEntry` field will not exist.
36851
37756
  *
36852
- * @throws If `address` is not a valid contract ID (C...).
37757
+ * @throws If `address` is not a valid contract ID (`C...`).
36853
37758
  *
36854
37759
  * @see getLedgerEntries
36855
37760
  * @see https://developers.stellar.org/docs/tokens/stellar-asset-contract
@@ -36875,6 +37780,10 @@ class RpcServer {
36875
37780
  async getSACBalance(address$1, sac, networkPassphrase) {
36876
37781
  const addressString = address$1 instanceof address.Address ? address$1.toString() : address$1;
36877
37782
  if (!strkey.StrKey.isValidContract(addressString)) {
37783
+ address.assertNotMuxed(
37784
+ addressString,
37785
+ "has no balance of its own; use its base address"
37786
+ );
36878
37787
  throw new TypeError(`expected contract ID, got ${addressString}`);
36879
37788
  }
36880
37789
  const passphrase = networkPassphrase ?? await this.getNetwork().then((n) => n.passphrase);
@@ -36983,6 +37892,7 @@ class RpcServer {
36983
37892
  exports.BasicSleepStrategy = BasicSleepStrategy;
36984
37893
  exports.Durability = Durability;
36985
37894
  exports.LinearSleepStrategy = LinearSleepStrategy;
37895
+ exports.MAX_TIMEOUT_MS = MAX_TIMEOUT_MS;
36986
37896
  exports.RpcServer = RpcServer;
36987
37897
  //# sourceMappingURL=server.js.map
36988
37898
 
@@ -37004,11 +37914,11 @@ __webpack_require__(/*! uint8array-extras */ "../../node_modules/uint8array-extr
37004
37914
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
37005
37915
  __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
37006
37916
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
37917
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
37007
37918
  var operation = __webpack_require__(/*! ../base/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/operation.js");
37008
37919
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
37920
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
37009
37921
  var transaction_builder = __webpack_require__(/*! ../base/transaction_builder.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction_builder.js");
37010
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
37011
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
37012
37922
  var api = __webpack_require__(/*! ./api.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/api.js");
37013
37923
  var parsers = __webpack_require__(/*! ./parsers.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/rpc/parsers.js");
37014
37924
 
@@ -37053,7 +37963,7 @@ function assembleTransaction(raw, simulation) {
37053
37963
  }
37054
37964
  }
37055
37965
  if (rawSorobanData) {
37056
- if (classicFeeNum - rawSorobanData.resourceFee > BigInt(0)) {
37966
+ if (classicFeeNum >= rawSorobanData.resourceFee) {
37057
37967
  classicFeeNum -= rawSorobanData.resourceFee;
37058
37968
  }
37059
37969
  }
@@ -37109,18 +38019,24 @@ exports.assembleTransaction = assembleTransaction;
37109
38019
  var smolToml = __webpack_require__(/*! smol-toml */ "../../node_modules/smol-toml/dist/index.cjs");
37110
38020
  var fetchClient = __webpack_require__(/*! ../http-client/fetch-client.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/http-client/fetch-client.js");
37111
38021
  var config = __webpack_require__(/*! ../config.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/config.js");
38022
+ var utils = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/stellartoml/utils.js");
37112
38023
 
37113
38024
  const STELLAR_TOML_MAX_SIZE = 100 * 1024;
38025
+ const STELLAR_TOML_PATH = "/.well-known/stellar.toml";
38026
+ const INVALID_DOMAIN_CHARS = /[\s@/?#\\]/;
38027
+ const TRAILING_SEPARATORS = /[/\\]+$/;
37114
38028
  class Resolver {
37115
38029
  /**
37116
38030
  * Returns a parsed `stellar.toml` file for a given domain.
37117
38031
  * @see {@link https://developers.stellar.org/docs/tokens/publishing-asset-info | Stellar.toml doc}
37118
38032
  *
37119
- * @param domain - Domain to get stellar.toml file for
38033
+ * @param domain - Domain to get stellar.toml file for. Must be a host name with an optional port; surrounding whitespace and a trailing `/` are ignored.
37120
38034
  * @param opts - (optional) Options object
37121
38035
  * - `allowHttp` (optional): Allow connecting to http servers. This must be set to false in production deployments!
37122
38036
  * - `timeout` (optional): Allow a timeout. Allows user to avoid nasty lag due to TOML resolve issue.
38037
+ * - `allowedRedirects` (optional): The number of redirects to follow, as 0 or a whole number up to `Number.MAX_SAFE_INTEGER`, default: 0. Outside Node, the SDK relies on the runtime to refuse redirects. In a browser, the Fetch build cannot count redirects, so a value above 0 follows up to the browser's own limit. The Axios build in a browser, and both builds in React Native, follow redirects whatever this value is.
37123
38038
  * @returns A `Promise` that resolves to the parsed stellar.toml object
38039
+ * @throws `Error` if `domain` is not a plain host name, or `allowedRedirects` is not valid, before any request is made
37124
38040
  *
37125
38041
  * @example
37126
38042
  * ```ts
@@ -37129,7 +38045,7 @@ class Resolver {
37129
38045
  * // stellarToml in an object representing domain stellar.toml file.
37130
38046
  * })
37131
38047
  * .catch(error => {
37132
- * // stellar.toml does not exist or is invalid
38048
+ * // domain is invalid, or stellar.toml does not exist or is invalid
37133
38049
  * });
37134
38050
  * ```
37135
38051
  */
@@ -37138,7 +38054,19 @@ class Resolver {
37138
38054
  const allowHttp = typeof opts.allowHttp === "undefined" ? config.Config.isAllowHttp() : opts.allowHttp;
37139
38055
  const timeout = typeof opts.timeout === "undefined" ? config.Config.getTimeout() : opts.timeout;
37140
38056
  const protocol = allowHttp ? "http" : "https";
37141
- return fetchClient.fetchClient.get(`${protocol}://${domain}/.well-known/stellar.toml`, {
38057
+ const name = String(domain).trim().replace(TRAILING_SEPARATORS, "");
38058
+ let url;
38059
+ try {
38060
+ url = new URL(`${protocol}://${name}${STELLAR_TOML_PATH}`);
38061
+ } catch {
38062
+ }
38063
+ if (!url || INVALID_DOMAIN_CHARS.test(name) || url.host.includes("%") || url.href !== `${protocol}://${url.host}${STELLAR_TOML_PATH}`) {
38064
+ throw new Error(
38065
+ `Invalid domain: ${JSON.stringify(domain)}. A domain must be a host name with an optional port.`
38066
+ );
38067
+ }
38068
+ utils.validateAllowedRedirects(opts.allowedRedirects);
38069
+ return fetchClient.fetchClient.get(url.href, {
37142
38070
  maxRedirects: opts.allowedRedirects ?? 0,
37143
38071
  maxContentLength: STELLAR_TOML_MAX_SIZE,
37144
38072
  cancelToken: timeout ? new CancelToken(
@@ -37176,6 +38104,32 @@ exports.STELLAR_TOML_MAX_SIZE = STELLAR_TOML_MAX_SIZE;
37176
38104
  //# sourceMappingURL=index.js.map
37177
38105
 
37178
38106
 
38107
+ /***/ }),
38108
+
38109
+ /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/stellartoml/utils.js":
38110
+ /*!****************************************************************************!*\
38111
+ !*** ../../node_modules/@stellar/stellar-sdk/lib/cjs/stellartoml/utils.js ***!
38112
+ \****************************************************************************/
38113
+ /***/ ((__unused_webpack_module, exports) => {
38114
+
38115
+ "use strict";
38116
+
38117
+
38118
+ function validateAllowedRedirects(allowedRedirects) {
38119
+ if (allowedRedirects === void 0 || allowedRedirects === null) {
38120
+ return;
38121
+ }
38122
+ if (typeof allowedRedirects !== "number" || !Number.isSafeInteger(allowedRedirects) || allowedRedirects < 0) {
38123
+ throw new Error(
38124
+ `allowedRedirects must be 0 or a whole number up to ${Number.MAX_SAFE_INTEGER}, got ${String(allowedRedirects)}`
38125
+ );
38126
+ }
38127
+ }
38128
+
38129
+ exports.validateAllowedRedirects = validateAllowedRedirects;
38130
+ //# sourceMappingURL=utils.js.map
38131
+
38132
+
37179
38133
  /***/ }),
37180
38134
 
37181
38135
  /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/utils.js":
@@ -37225,9 +38179,35 @@ exports.Utils = Utils;
37225
38179
  "use strict";
37226
38180
 
37227
38181
 
38182
+ function encodeSegment(segment) {
38183
+ const value = typeof segment === "number" || typeof segment === "bigint" ? String(segment) : segment;
38184
+ if (typeof value !== "string") {
38185
+ throw new TypeError(
38186
+ `expected a string, number or bigint path segment, not ${typeof value}`
38187
+ );
38188
+ }
38189
+ if (value === "" || value === "." || value === "..") {
38190
+ throw new TypeError(
38191
+ `expected a single non-empty path segment, not ${JSON.stringify(value)}`
38192
+ );
38193
+ }
38194
+ try {
38195
+ return encodeURIComponent(value);
38196
+ } catch {
38197
+ throw new TypeError(
38198
+ `expected a well-formed path segment, not ${JSON.stringify(value)}`
38199
+ );
38200
+ }
38201
+ }
37228
38202
  function stringifyTemplateValue(value) {
37229
38203
  return Array.isArray(value) ? value.join(",") : value.toString();
37230
38204
  }
38205
+ function expandPlaceholders(template, variables, encode) {
38206
+ return template.replace(/\{([^?][^}]*)\}/g, (_match, name) => {
38207
+ const value = variables[name];
38208
+ return typeof value === "undefined" ? "" : encode(value);
38209
+ });
38210
+ }
37231
38211
  function expandUriTemplate(template, variables, baseUrl) {
37232
38212
  const queryNames = [];
37233
38213
  const withoutQueryTemplate = template.replace(
@@ -37237,12 +38217,13 @@ function expandUriTemplate(template, variables, baseUrl) {
37237
38217
  return "";
37238
38218
  }
37239
38219
  );
37240
- const expanded = withoutQueryTemplate.replace(
37241
- /\{([^?][^}]*)\}/g,
37242
- (_match, name) => {
37243
- const value = variables[name];
37244
- return typeof value === "undefined" ? "" : encodeURIComponent(stringifyTemplateValue(value));
37245
- }
38220
+ const queryStart = withoutQueryTemplate.indexOf("?");
38221
+ const pathTemplate = queryStart === -1 ? withoutQueryTemplate : withoutQueryTemplate.slice(0, queryStart);
38222
+ const queryTemplate = queryStart === -1 ? "" : withoutQueryTemplate.slice(queryStart);
38223
+ const expanded = expandPlaceholders(pathTemplate, variables, encodeSegment) + expandPlaceholders(
38224
+ queryTemplate,
38225
+ variables,
38226
+ (value) => encodeURIComponent(stringifyTemplateValue(value))
37246
38227
  );
37247
38228
  const url = new URL(expanded, baseUrl);
37248
38229
  queryNames.forEach((name) => {
@@ -37254,6 +38235,7 @@ function expandUriTemplate(template, variables, baseUrl) {
37254
38235
  return url.toString();
37255
38236
  }
37256
38237
 
38238
+ exports.encodeSegment = encodeSegment;
37257
38239
  exports.expandUriTemplate = expandUriTemplate;
37258
38240
  //# sourceMappingURL=url.js.map
37259
38241
 
@@ -37275,6 +38257,7 @@ var uint8arrayExtras = __webpack_require__(/*! uint8array-extras */ "../../node_
37275
38257
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
37276
38258
  var keypair = __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
37277
38259
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
38260
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
37278
38261
  var base64 = __webpack_require__(/*! ../base/util/base64.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/base64.js");
37279
38262
  var transaction = __webpack_require__(/*! ../base/transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/transaction.js");
37280
38263
  var fee_bump_transaction = __webpack_require__(/*! ../base/fee_bump_transaction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/fee_bump_transaction.js");
@@ -37282,8 +38265,7 @@ var transaction_builder = __webpack_require__(/*! ../base/transaction_builder.js
37282
38265
  var operation = __webpack_require__(/*! ../base/operation.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/operation.js");
37283
38266
  var memo = __webpack_require__(/*! ../base/memo.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/memo.js");
37284
38267
  var account = __webpack_require__(/*! ../base/account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/account.js");
37285
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
37286
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
38268
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
37287
38269
  var errors = __webpack_require__(/*! ./errors.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/webauth/errors.js");
37288
38270
  var utils$1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/webauth/utils.js");
37289
38271
  var utils = __webpack_require__(/*! ../utils.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/utils.js");
@@ -37319,6 +38301,9 @@ function buildChallengeTx(serverKeypair, clientAccountID, homeDomain, timeout =
37319
38301
  if (!clientSigningKey) {
37320
38302
  throw Error("clientSigningKey is required if clientDomain is provided");
37321
38303
  }
38304
+ if (clientSigningKey === serverKeypair.publicKey()) {
38305
+ throw Error("clientSigningKey cannot be the server's public key");
38306
+ }
37322
38307
  builder.addOperation(
37323
38308
  operation.Operation.manageData({
37324
38309
  name: `client_domain`,
@@ -37457,6 +38442,16 @@ function readChallengeTx(challengeTx, serverAccountID, networkPassphrase, homeDo
37457
38442
  "The transaction has operations that are not of type 'manageData'"
37458
38443
  );
37459
38444
  }
38445
+ if (op.name === "client_domain" && !op.source) {
38446
+ throw new errors.InvalidChallengeError(
38447
+ "The transaction's 'client_domain' operation should contain a source account"
38448
+ );
38449
+ }
38450
+ if (op.name === "client_domain" && op.source === serverAccountID) {
38451
+ throw new errors.InvalidChallengeError(
38452
+ "The transaction's 'client_domain' operation source account should not be the server account"
38453
+ );
38454
+ }
37460
38455
  if (op.source !== serverAccountID && op.name !== "client_domain") {
37461
38456
  throw new errors.InvalidChallengeError(
37462
38457
  "The transaction has operations that are unrecognized"
@@ -37560,16 +38555,15 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
37560
38555
  if (signersFound.length !== tx.signatures.length) {
37561
38556
  throw new errors.InvalidChallengeError("Transaction has unrecognized signatures");
37562
38557
  }
37563
- signersFound.splice(signersFound.indexOf(serverKP.publicKey()), 1);
37564
- if (clientSigningKey) {
37565
- signersFound.splice(signersFound.indexOf(clientSigningKey), 1);
37566
- }
37567
- if (signersFound.length === 0) {
38558
+ const clientSignersFound = signersFound.filter(
38559
+ (signer) => signer !== serverKP.publicKey() && signer !== clientSigningKey
38560
+ );
38561
+ if (clientSignersFound.length === 0) {
37568
38562
  throw new errors.InvalidChallengeError(
37569
38563
  "None of the given signers match the transaction signatures"
37570
38564
  );
37571
38565
  }
37572
- return signersFound;
38566
+ return clientSignersFound;
37573
38567
  }
37574
38568
  function verifyChallengeTxThreshold(challengeTx, serverAccountID, networkPassphrase, threshold, signerSummary, homeDomains, webAuthDomain) {
37575
38569
  const signers = signerSummary.map((signer) => signer.key);
@@ -37663,10 +38657,10 @@ __webpack_require__(/*! @noble/hashes/sha2.js */ "../../node_modules/@noble/hash
37663
38657
  __webpack_require__(/*! ../base/signing.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/signing.js");
37664
38658
  var keypair = __webpack_require__(/*! ../base/keypair.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/keypair.js");
37665
38659
  __webpack_require__(/*! @exodus/bytes/base32.js */ "../../node_modules/@exodus/bytes/base32.js");
38660
+ __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
38661
+ __webpack_require__(/*! ../base/util/decode_encode_muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/decode_encode_muxed_account.js");
37666
38662
  __webpack_require__(/*! ../base/util/continued_fraction.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/continued_fraction.js");
37667
38663
  __webpack_require__(/*! ../base/util/bignumber.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/util/bignumber.js");
37668
- __webpack_require__(/*! ../base/muxed_account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/base/muxed_account.js");
37669
- __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
37670
38664
  var errors = __webpack_require__(/*! ./errors.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/webauth/errors.js");
37671
38665
 
37672
38666
  function gatherTxSigners(transaction, signers) {
@@ -44510,6 +45504,7 @@ exports.ConfigUpgradeSet = ConfigUpgradeSet;
44510
45504
 
44511
45505
  const CONTRACT_COST_COUNT_LIMIT = 1024;
44512
45506
  const SC_SPEC_DOC_LIMIT = 1024;
45507
+ const SC_SPEC_TYPE_NAME_LIMIT = 1024;
44513
45508
  const SCSYMBOL_LIMIT = 32;
44514
45509
  const MASK_ACCOUNT_FLAGS = 7;
44515
45510
  const MASK_ACCOUNT_FLAGS_V17 = 15;
@@ -44541,6 +45536,7 @@ exports.MAX_OPS_PER_TX = MAX_OPS_PER_TX;
44541
45536
  exports.MAX_SIGNERS = MAX_SIGNERS;
44542
45537
  exports.SCSYMBOL_LIMIT = SCSYMBOL_LIMIT;
44543
45538
  exports.SC_SPEC_DOC_LIMIT = SC_SPEC_DOC_LIMIT;
45539
+ exports.SC_SPEC_TYPE_NAME_LIMIT = SC_SPEC_TYPE_NAME_LIMIT;
44544
45540
  exports.TX_ADVERT_VECTOR_MAX_SIZE = TX_ADVERT_VECTOR_MAX_SIZE;
44545
45541
  exports.TX_DEMAND_VECTOR_MAX_SIZE = TX_DEMAND_VECTOR_MAX_SIZE;
44546
45542
  //# sourceMappingURL=constants.js.map
@@ -45141,6 +46137,42 @@ class ContractCostType extends enumValue.EnumValue {
45141
46137
  static bn254FrPow = new ContractCostType("bn254FrPow", 83);
45142
46138
  static bn254FrInv = new ContractCostType("bn254FrInv", 84);
45143
46139
  static bn254G1Msm = new ContractCostType("bn254G1Msm", 85);
46140
+ static mlDsa44DecodeVerifyingKey = new ContractCostType(
46141
+ "mlDsa44DecodeVerifyingKey",
46142
+ 86
46143
+ );
46144
+ static mlDsa65DecodeVerifyingKey = new ContractCostType(
46145
+ "mlDsa65DecodeVerifyingKey",
46146
+ 87
46147
+ );
46148
+ static mlDsa87DecodeVerifyingKey = new ContractCostType(
46149
+ "mlDsa87DecodeVerifyingKey",
46150
+ 88
46151
+ );
46152
+ static mlDsa44DecodeSignature = new ContractCostType(
46153
+ "mlDsa44DecodeSignature",
46154
+ 89
46155
+ );
46156
+ static mlDsa65DecodeSignature = new ContractCostType(
46157
+ "mlDsa65DecodeSignature",
46158
+ 90
46159
+ );
46160
+ static mlDsa87DecodeSignature = new ContractCostType(
46161
+ "mlDsa87DecodeSignature",
46162
+ 91
46163
+ );
46164
+ static verifyMlDsa44Sig = new ContractCostType(
46165
+ "verifyMlDsa44Sig",
46166
+ 92
46167
+ );
46168
+ static verifyMlDsa65Sig = new ContractCostType(
46169
+ "verifyMlDsa65Sig",
46170
+ 93
46171
+ );
46172
+ static verifyMlDsa87Sig = new ContractCostType(
46173
+ "verifyMlDsa87Sig",
46174
+ 94
46175
+ );
45144
46176
  static schema = jsXdr.enumType("ContractCostType", {
45145
46177
  wasmInsnExec: 0,
45146
46178
  memAlloc: 1,
@@ -45227,7 +46259,16 @@ class ContractCostType extends enumValue.EnumValue {
45227
46259
  bn254FrMul: 82,
45228
46260
  bn254FrPow: 83,
45229
46261
  bn254FrInv: 84,
45230
- bn254G1Msm: 85
46262
+ bn254G1Msm: 85,
46263
+ mlDsa44DecodeVerifyingKey: 86,
46264
+ mlDsa65DecodeVerifyingKey: 87,
46265
+ mlDsa87DecodeVerifyingKey: 88,
46266
+ mlDsa44DecodeSignature: 89,
46267
+ mlDsa65DecodeSignature: 90,
46268
+ mlDsa87DecodeSignature: 91,
46269
+ verifyMlDsa44Sig: 92,
46270
+ verifyMlDsa65Sig: 93,
46271
+ verifyMlDsa87Sig: 94
45231
46272
  });
45232
46273
  static fromValue(value) {
45233
46274
  return enumValue.enumFromValue(
@@ -56570,6 +57611,11 @@ class MemoText extends MemoBase {
56570
57611
  super();
56571
57612
  this.text = text instanceof xdrString.XdrString ? text : new xdrString.XdrString(text);
56572
57613
  }
57614
+ /**
57615
+ * Decodes `text` leniently: invalid bytes become U+FFFD, so a
57616
+ * value rebuilt from this string can differ on the wire. Use
57617
+ * `text` to keep the bytes.
57618
+ */
56573
57619
  get value() {
56574
57620
  return this.text.toString();
56575
57621
  }
@@ -56868,6 +57914,51 @@ exports.MuxedAccountMuxedEd25519 = MuxedAccountMuxedEd25519;
56868
57914
  //# sourceMappingURL=muxed-account.js.map
56869
57915
 
56870
57916
 
57917
+ /***/ }),
57918
+
57919
+ /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-contract.js":
57920
+ /*!***************************************************************************************!*\
57921
+ !*** ../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-contract.js ***!
57922
+ \***************************************************************************************/
57923
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
57924
+
57925
+ "use strict";
57926
+
57927
+
57928
+ var jsXdr = __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
57929
+ var xdrValue = __webpack_require__(/*! ../values/xdr-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/values/xdr-value.js");
57930
+ var contractId = __webpack_require__(/*! ./contract-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/contract-id.js");
57931
+
57932
+ class MuxedContract extends xdrValue.XdrValue {
57933
+ id;
57934
+ contractId;
57935
+ static schema = jsXdr.struct("MuxedContract", {
57936
+ id: jsXdr.uint64(),
57937
+ contractId: contractId.ContractId.schema
57938
+ });
57939
+ constructor(input) {
57940
+ super();
57941
+ this.id = input.id;
57942
+ this.contractId = input.contractId;
57943
+ }
57944
+ toXdrObject() {
57945
+ return {
57946
+ id: this.id,
57947
+ contractId: this.contractId.toXdrObject()
57948
+ };
57949
+ }
57950
+ static fromXdrObject(wire) {
57951
+ return new MuxedContract({
57952
+ id: wire.id,
57953
+ contractId: contractId.ContractId.fromXdrObject(wire.contractId)
57954
+ });
57955
+ }
57956
+ }
57957
+
57958
+ exports.MuxedContract = MuxedContract;
57959
+ //# sourceMappingURL=muxed-contract.js.map
57960
+
57961
+
56871
57962
  /***/ }),
56872
57963
 
56873
57964
  /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-ed25519-account.js":
@@ -62337,13 +63428,18 @@ class ScAddressType extends enumValue.EnumValue {
62337
63428
  "scAddressTypeLiquidityPool",
62338
63429
  4
62339
63430
  );
63431
+ static scAddressTypeMuxedContract = new ScAddressType(
63432
+ "scAddressTypeMuxedContract",
63433
+ 5
63434
+ );
62340
63435
  static schema = enumValue.withMemberPrefix(
62341
63436
  jsXdr.enumType("ScAddressType", {
62342
63437
  scAddressTypeAccount: 0,
62343
63438
  scAddressTypeContract: 1,
62344
63439
  scAddressTypeMuxedAccount: 2,
62345
63440
  scAddressTypeClaimableBalance: 3,
62346
- scAddressTypeLiquidityPool: 4
63441
+ scAddressTypeLiquidityPool: 4,
63442
+ scAddressTypeMuxedContract: 5
62347
63443
  }),
62348
63444
  "scAddressType"
62349
63445
  );
@@ -62386,6 +63482,7 @@ var contractId = __webpack_require__(/*! ./contract-id.js */ "../../node_modules
62386
63482
  var muxedEd25519Account = __webpack_require__(/*! ./muxed-ed25519-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-ed25519-account.js");
62387
63483
  var claimableBalanceId = __webpack_require__(/*! ./claimable-balance-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/claimable-balance-id.js");
62388
63484
  var poolId = __webpack_require__(/*! ./pool-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/pool-id.js");
63485
+ var muxedContract = __webpack_require__(/*! ./muxed-contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-contract.js");
62389
63486
 
62390
63487
  class ScAddressBase extends xdrValue.XdrValue {
62391
63488
  constructor() {
@@ -62415,6 +63512,11 @@ class ScAddressBase extends xdrValue.XdrValue {
62415
63512
  "scAddressTypeLiquidityPool",
62416
63513
  4,
62417
63514
  jsXdr.field("liquidityPoolId", poolId.PoolId.schema)
63515
+ ),
63516
+ jsXdr.case(
63517
+ "scAddressTypeMuxedContract",
63518
+ 5,
63519
+ jsXdr.field("muxedContract", muxedContract.MuxedContract.schema)
62418
63520
  )
62419
63521
  ]
62420
63522
  });
@@ -62433,6 +63535,9 @@ class ScAddressBase extends xdrValue.XdrValue {
62433
63535
  static scAddressTypeLiquidityPool(liquidityPoolId) {
62434
63536
  return new ScAddressLiquidityPool(liquidityPoolId);
62435
63537
  }
63538
+ static scAddressTypeMuxedContract(muxedContract) {
63539
+ return new ScAddressMuxedContract(muxedContract);
63540
+ }
62436
63541
  static fromXdrObject(wire) {
62437
63542
  switch (wire.type) {
62438
63543
  case 0:
@@ -62451,6 +63556,10 @@ class ScAddressBase extends xdrValue.XdrValue {
62451
63556
  return new ScAddressLiquidityPool(
62452
63557
  poolId.PoolId.fromXdrObject(wire.liquidityPoolId)
62453
63558
  );
63559
+ case 5:
63560
+ return new ScAddressMuxedContract(
63561
+ muxedContract.MuxedContract.fromXdrObject(wire.muxedContract)
63562
+ );
62454
63563
  }
62455
63564
  throw new jsXdr.XdrError(
62456
63565
  `ScAddress: unknown type ${wire.type}`
@@ -62539,6 +63648,20 @@ class ScAddressLiquidityPool extends ScAddressBase {
62539
63648
  return { type: 4, liquidityPoolId: this.liquidityPoolId.toXdrObject() };
62540
63649
  }
62541
63650
  }
63651
+ class ScAddressMuxedContract extends ScAddressBase {
63652
+ type = "scAddressTypeMuxedContract";
63653
+ muxedContract;
63654
+ constructor(muxedContract) {
63655
+ super();
63656
+ this.muxedContract = muxedContract;
63657
+ }
63658
+ get value() {
63659
+ return this.muxedContract;
63660
+ }
63661
+ toXdrObject() {
63662
+ return { type: 5, muxedContract: this.muxedContract.toXdrObject() };
63663
+ }
63664
+ }
62542
63665
  const ScAddress = ScAddressBase;
62543
63666
 
62544
63667
  exports.ScAddress = ScAddress;
@@ -62547,6 +63670,7 @@ exports.ScAddressClaimableBalance = ScAddressClaimableBalance;
62547
63670
  exports.ScAddressContract = ScAddressContract;
62548
63671
  exports.ScAddressLiquidityPool = ScAddressLiquidityPool;
62549
63672
  exports.ScAddressMuxedAccount = ScAddressMuxedAccount;
63673
+ exports.ScAddressMuxedContract = ScAddressMuxedContract;
62550
63674
  //# sourceMappingURL=sc-address.js.map
62551
63675
 
62552
63676
 
@@ -63793,7 +64917,7 @@ class ScSpecEventV0 extends xdrValue.XdrValue {
63793
64917
  static schema = jsXdr.struct("ScSpecEventV0", {
63794
64918
  doc: xdrString.xdrString(1024),
63795
64919
  lib: xdrString.xdrString(80),
63796
- name: xdrString.xdrString(32),
64920
+ name: xdrString.xdrString(1024),
63797
64921
  prefixTopics: jsXdr.array(xdrString.xdrString(32), 2),
63798
64922
  params: jsXdr.array(scSpecEventParamV0.ScSpecEventParamV0.schema, jsXdr.UNBOUNDED_MAX_LENGTH),
63799
64923
  dataFormat: scSpecEventDataFormat.ScSpecEventDataFormat.schema
@@ -64684,7 +65808,7 @@ var xdrString = __webpack_require__(/*! ../values/xdr-string.js */ "../../node_m
64684
65808
  class ScSpecTypeUdt extends xdrValue.XdrValue {
64685
65809
  name;
64686
65810
  static schema = jsXdr.struct("ScSpecTypeUdt", {
64687
- name: xdrString.xdrString(60)
65811
+ name: xdrString.xdrString(1024)
64688
65812
  });
64689
65813
  constructor(input) {
64690
65814
  super();
@@ -64878,7 +66002,7 @@ class ScSpecUdtEnumV0 extends xdrValue.XdrValue {
64878
66002
  {
64879
66003
  doc: xdrString.xdrString(1024),
64880
66004
  lib: xdrString.xdrString(80),
64881
- name: xdrString.xdrString(60),
66005
+ name: xdrString.xdrString(1024),
64882
66006
  cases: jsXdr.array(scSpecUdtEnumCaseV0.ScSpecUdtEnumCaseV0.schema, jsXdr.UNBOUNDED_MAX_LENGTH)
64883
66007
  }
64884
66008
  );
@@ -64990,7 +66114,7 @@ class ScSpecUdtErrorEnumV0 extends xdrValue.XdrValue {
64990
66114
  {
64991
66115
  doc: xdrString.xdrString(1024),
64992
66116
  lib: xdrString.xdrString(80),
64993
- name: xdrString.xdrString(60),
66117
+ name: xdrString.xdrString(1024),
64994
66118
  cases: jsXdr.array(scSpecUdtErrorEnumCaseV0.ScSpecUdtErrorEnumCaseV0.schema, jsXdr.UNBOUNDED_MAX_LENGTH)
64995
66119
  }
64996
66120
  );
@@ -65103,7 +66227,7 @@ class ScSpecUdtStructV0 extends xdrValue.XdrValue {
65103
66227
  {
65104
66228
  doc: xdrString.xdrString(1024),
65105
66229
  lib: xdrString.xdrString(80),
65106
- name: xdrString.xdrString(60),
66230
+ name: xdrString.xdrString(1024),
65107
66231
  fields: jsXdr.array(scSpecUdtStructFieldV0.ScSpecUdtStructFieldV0.schema, jsXdr.UNBOUNDED_MAX_LENGTH)
65108
66232
  }
65109
66233
  );
@@ -65430,7 +66554,7 @@ class ScSpecUdtUnionV0 extends xdrValue.XdrValue {
65430
66554
  {
65431
66555
  doc: xdrString.xdrString(1024),
65432
66556
  lib: xdrString.xdrString(80),
65433
- name: xdrString.xdrString(60),
66557
+ name: xdrString.xdrString(1024),
65434
66558
  cases: jsXdr.array(scSpecUdtUnionCaseV0.ScSpecUdtUnionCaseV0.schema, jsXdr.UNBOUNDED_MAX_LENGTH)
65435
66559
  }
65436
66560
  );
@@ -66041,6 +67165,11 @@ class ScValString extends ScValBase {
66041
67165
  super();
66042
67166
  this.str = str instanceof xdrString.XdrString ? str : new xdrString.XdrString(str);
66043
67167
  }
67168
+ /**
67169
+ * Decodes `str` leniently: invalid bytes become U+FFFD, so a
67170
+ * value rebuilt from this string can differ on the wire. Use
67171
+ * `str` to keep the bytes.
67172
+ */
66044
67173
  get value() {
66045
67174
  return this.str.toString();
66046
67175
  }
@@ -66055,6 +67184,11 @@ class ScValSymbol extends ScValBase {
66055
67184
  super();
66056
67185
  this.sym = sym instanceof xdrString.XdrString ? sym : new xdrString.XdrString(sym);
66057
67186
  }
67187
+ /**
67188
+ * Decodes `sym` leniently: invalid bytes become U+FFFD, so a
67189
+ * value rebuilt from this string can differ on the wire. Use
67190
+ * `sym` to keep the bytes.
67191
+ */
66058
67192
  get value() {
66059
67193
  return this.sym.toString();
66060
67194
  }
@@ -66154,6 +67288,11 @@ class ScValExecutableTag extends ScValBase {
66154
67288
  super();
66155
67289
  this.executableTag = executableTag instanceof xdrString.XdrString ? executableTag : new xdrString.XdrString(executableTag);
66156
67290
  }
67291
+ /**
67292
+ * Decodes `executableTag` leniently: invalid bytes become U+FFFD, so a
67293
+ * value rebuilt from this string can differ on the wire. Use
67294
+ * `executableTag` to keep the bytes.
67295
+ */
66157
67296
  get value() {
66158
67297
  return this.executableTag.toString();
66159
67298
  }
@@ -70401,6 +71540,8 @@ var xdrValue = __webpack_require__(/*! ../values/xdr-value.js */ "../../node_mod
70401
71540
  var stellarValueType = __webpack_require__(/*! ./stellar-value-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-type.js");
70402
71541
  var ledgerCloseValueSignature = __webpack_require__(/*! ./ledger-close-value-signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-close-value-signature.js");
70403
71542
  var stellarValueProposedValue = __webpack_require__(/*! ./stellar-value-proposed-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-value.js");
71543
+ var stellarValueSignedMsValue = __webpack_require__(/*! ./stellar-value-signed-ms-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-signed-ms-value.js");
71544
+ var stellarValueProposedMsValue = __webpack_require__(/*! ./stellar-value-proposed-ms-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-ms-value.js");
70404
71545
 
70405
71546
  class StellarValueExtBase extends xdrValue.XdrValue {
70406
71547
  constructor() {
@@ -70426,6 +71567,16 @@ class StellarValueExtBase extends xdrValue.XdrValue {
70426
71567
  "stellarValueEmptyTxSet",
70427
71568
  2,
70428
71569
  jsXdr.field("proposedValue", stellarValueProposedValue.StellarValueProposedValue.schema)
71570
+ ),
71571
+ jsXdr.case(
71572
+ "stellarValueSignedMs",
71573
+ 3,
71574
+ jsXdr.field("signedMsValue", stellarValueSignedMsValue.StellarValueSignedMsValue.schema)
71575
+ ),
71576
+ jsXdr.case(
71577
+ "stellarValueEmptyTxSetMs",
71578
+ 4,
71579
+ jsXdr.field("proposedMsValue", stellarValueProposedMsValue.StellarValueProposedMsValue.schema)
70429
71580
  )
70430
71581
  ],
70431
71582
  switchKey: "v"
@@ -70440,6 +71591,12 @@ class StellarValueExtBase extends xdrValue.XdrValue {
70440
71591
  static stellarValueEmptyTxSet(proposedValue) {
70441
71592
  return new StellarValueExtEmptyTxSet(proposedValue);
70442
71593
  }
71594
+ static stellarValueSignedMs(signedMsValue) {
71595
+ return new StellarValueExtSignedMs(signedMsValue);
71596
+ }
71597
+ static stellarValueEmptyTxSetMs(proposedMsValue) {
71598
+ return new StellarValueExtEmptyTxSetMs(proposedMsValue);
71599
+ }
70443
71600
  static fromXdrObject(wire) {
70444
71601
  switch (wire.v) {
70445
71602
  case 0:
@@ -70452,6 +71609,14 @@ class StellarValueExtBase extends xdrValue.XdrValue {
70452
71609
  return new StellarValueExtEmptyTxSet(
70453
71610
  stellarValueProposedValue.StellarValueProposedValue.fromXdrObject(wire.proposedValue)
70454
71611
  );
71612
+ case 3:
71613
+ return new StellarValueExtSignedMs(
71614
+ stellarValueSignedMsValue.StellarValueSignedMsValue.fromXdrObject(wire.signedMsValue)
71615
+ );
71616
+ case 4:
71617
+ return new StellarValueExtEmptyTxSetMs(
71618
+ stellarValueProposedMsValue.StellarValueProposedMsValue.fromXdrObject(wire.proposedMsValue)
71619
+ );
70455
71620
  }
70456
71621
  throw new jsXdr.XdrError(
70457
71622
  `StellarValueExt: unknown v ${wire.v}`
@@ -70504,15 +71669,111 @@ class StellarValueExtEmptyTxSet extends StellarValueExtBase {
70504
71669
  return { v: 2, proposedValue: this.proposedValue.toXdrObject() };
70505
71670
  }
70506
71671
  }
71672
+ class StellarValueExtSignedMs extends StellarValueExtBase {
71673
+ type = "stellarValueSignedMs";
71674
+ signedMsValue;
71675
+ constructor(signedMsValue) {
71676
+ super();
71677
+ this.signedMsValue = signedMsValue;
71678
+ }
71679
+ get value() {
71680
+ return this.signedMsValue;
71681
+ }
71682
+ toXdrObject() {
71683
+ return { v: 3, signedMsValue: this.signedMsValue.toXdrObject() };
71684
+ }
71685
+ }
71686
+ class StellarValueExtEmptyTxSetMs extends StellarValueExtBase {
71687
+ type = "stellarValueEmptyTxSetMs";
71688
+ proposedMsValue;
71689
+ constructor(proposedMsValue) {
71690
+ super();
71691
+ this.proposedMsValue = proposedMsValue;
71692
+ }
71693
+ get value() {
71694
+ return this.proposedMsValue;
71695
+ }
71696
+ toXdrObject() {
71697
+ return { v: 4, proposedMsValue: this.proposedMsValue.toXdrObject() };
71698
+ }
71699
+ }
70507
71700
  const StellarValueExt = StellarValueExtBase;
70508
71701
 
70509
71702
  exports.StellarValueExt = StellarValueExt;
70510
71703
  exports.StellarValueExtBasic = StellarValueExtBasic;
70511
71704
  exports.StellarValueExtEmptyTxSet = StellarValueExtEmptyTxSet;
71705
+ exports.StellarValueExtEmptyTxSetMs = StellarValueExtEmptyTxSetMs;
70512
71706
  exports.StellarValueExtSigned = StellarValueExtSigned;
71707
+ exports.StellarValueExtSignedMs = StellarValueExtSignedMs;
70513
71708
  //# sourceMappingURL=stellar-value-ext.js.map
70514
71709
 
70515
71710
 
71711
+ /***/ }),
71712
+
71713
+ /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-ms-value.js":
71714
+ /*!********************************************************************************************************!*\
71715
+ !*** ../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-ms-value.js ***!
71716
+ \********************************************************************************************************/
71717
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
71718
+
71719
+ "use strict";
71720
+
71721
+
71722
+ var jsXdr = __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
71723
+ var xdrValue = __webpack_require__(/*! ../values/xdr-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/values/xdr-value.js");
71724
+ var hash = __webpack_require__(/*! ./hash.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/hash.js");
71725
+ var ledgerCloseValueSignature = __webpack_require__(/*! ./ledger-close-value-signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-close-value-signature.js");
71726
+
71727
+ class StellarValueProposedMsValue extends xdrValue.XdrValue {
71728
+ closeTimeMs;
71729
+ txSetHash;
71730
+ previousLedgerHash;
71731
+ previousLedgerVersion;
71732
+ lcValueSignature;
71733
+ static schema = jsXdr.struct(
71734
+ "StellarValueProposedMsValue",
71735
+ {
71736
+ closeTimeMs: jsXdr.uint64(),
71737
+ txSetHash: hash.Hash.schema,
71738
+ previousLedgerHash: hash.Hash.schema,
71739
+ previousLedgerVersion: jsXdr.uint32(),
71740
+ lcValueSignature: ledgerCloseValueSignature.LedgerCloseValueSignature.schema
71741
+ }
71742
+ );
71743
+ constructor(input) {
71744
+ super();
71745
+ this.closeTimeMs = input.closeTimeMs;
71746
+ this.txSetHash = input.txSetHash instanceof hash.Hash ? input.txSetHash : new hash.Hash(input.txSetHash);
71747
+ this.previousLedgerHash = input.previousLedgerHash instanceof hash.Hash ? input.previousLedgerHash : new hash.Hash(input.previousLedgerHash);
71748
+ this.previousLedgerVersion = input.previousLedgerVersion;
71749
+ this.lcValueSignature = input.lcValueSignature;
71750
+ }
71751
+ toXdrObject() {
71752
+ return {
71753
+ closeTimeMs: this.closeTimeMs,
71754
+ txSetHash: this.txSetHash.toXdrObject(),
71755
+ previousLedgerHash: this.previousLedgerHash.toXdrObject(),
71756
+ previousLedgerVersion: this.previousLedgerVersion,
71757
+ lcValueSignature: this.lcValueSignature.toXdrObject()
71758
+ };
71759
+ }
71760
+ static fromXdrObject(wire) {
71761
+ return new StellarValueProposedMsValue({
71762
+ closeTimeMs: wire.closeTimeMs,
71763
+ txSetHash: hash.Hash.fromXdrObject(wire.txSetHash),
71764
+ previousLedgerHash: hash.Hash.fromXdrObject(wire.previousLedgerHash),
71765
+ previousLedgerVersion: wire.previousLedgerVersion,
71766
+ lcValueSignature: ledgerCloseValueSignature.LedgerCloseValueSignature.fromXdrObject(
71767
+ wire.lcValueSignature
71768
+ )
71769
+ });
71770
+ }
71771
+ }
71772
+
71773
+ exports.StellarValueProposedMsValue = StellarValueProposedMsValue;
71774
+ //# sourceMappingURL=stellar-value-proposed-ms-value.js.map
71775
+
71776
+
70516
71777
  /***/ }),
70517
71778
 
70518
71779
  /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-value.js":
@@ -70574,6 +71835,56 @@ exports.StellarValueProposedValue = StellarValueProposedValue;
70574
71835
  //# sourceMappingURL=stellar-value-proposed-value.js.map
70575
71836
 
70576
71837
 
71838
+ /***/ }),
71839
+
71840
+ /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-signed-ms-value.js":
71841
+ /*!******************************************************************************************************!*\
71842
+ !*** ../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-signed-ms-value.js ***!
71843
+ \******************************************************************************************************/
71844
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
71845
+
71846
+ "use strict";
71847
+
71848
+
71849
+ var jsXdr = __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stellar/js-xdr/dist/js-xdr.cjs");
71850
+ var xdrValue = __webpack_require__(/*! ../values/xdr-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/values/xdr-value.js");
71851
+ var ledgerCloseValueSignature = __webpack_require__(/*! ./ledger-close-value-signature.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/ledger-close-value-signature.js");
71852
+
71853
+ class StellarValueSignedMsValue extends xdrValue.XdrValue {
71854
+ closeTimeMs;
71855
+ lcValueSignature;
71856
+ static schema = jsXdr.struct(
71857
+ "StellarValueSignedMsValue",
71858
+ {
71859
+ closeTimeMs: jsXdr.uint64(),
71860
+ lcValueSignature: ledgerCloseValueSignature.LedgerCloseValueSignature.schema
71861
+ }
71862
+ );
71863
+ constructor(input) {
71864
+ super();
71865
+ this.closeTimeMs = input.closeTimeMs;
71866
+ this.lcValueSignature = input.lcValueSignature;
71867
+ }
71868
+ toXdrObject() {
71869
+ return {
71870
+ closeTimeMs: this.closeTimeMs,
71871
+ lcValueSignature: this.lcValueSignature.toXdrObject()
71872
+ };
71873
+ }
71874
+ static fromXdrObject(wire) {
71875
+ return new StellarValueSignedMsValue({
71876
+ closeTimeMs: wire.closeTimeMs,
71877
+ lcValueSignature: ledgerCloseValueSignature.LedgerCloseValueSignature.fromXdrObject(
71878
+ wire.lcValueSignature
71879
+ )
71880
+ });
71881
+ }
71882
+ }
71883
+
71884
+ exports.StellarValueSignedMsValue = StellarValueSignedMsValue;
71885
+ //# sourceMappingURL=stellar-value-signed-ms-value.js.map
71886
+
71887
+
70577
71888
  /***/ }),
70578
71889
 
70579
71890
  /***/ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-type.js":
@@ -70601,11 +71912,21 @@ class StellarValueType extends enumValue.EnumValue {
70601
71912
  "stellarValueEmptyTxSet",
70602
71913
  2
70603
71914
  );
71915
+ static stellarValueSignedMs = new StellarValueType(
71916
+ "stellarValueSignedMs",
71917
+ 3
71918
+ );
71919
+ static stellarValueEmptyTxSetMs = new StellarValueType(
71920
+ "stellarValueEmptyTxSetMs",
71921
+ 4
71922
+ );
70604
71923
  static schema = enumValue.withMemberPrefix(
70605
71924
  jsXdr.enumType("StellarValueType", {
70606
71925
  stellarValueBasic: 0,
70607
71926
  stellarValueSigned: 1,
70608
- stellarValueEmptyTxSet: 2
71927
+ stellarValueEmptyTxSet: 2,
71928
+ stellarValueSignedMs: 3,
71929
+ stellarValueEmptyTxSetMs: 4
70609
71930
  }),
70610
71931
  "stellarValue"
70611
71932
  );
@@ -75640,6 +76961,7 @@ var memoType = __webpack_require__(/*! ./generated/memo-type.js */ "../../node_m
75640
76961
  var messageType = __webpack_require__(/*! ./generated/message-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/message-type.js");
75641
76962
  var muxedAccount = __webpack_require__(/*! ./generated/muxed-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account.js");
75642
76963
  var muxedAccountMed25519 = __webpack_require__(/*! ./generated/muxed-account-med25519.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-account-med25519.js");
76964
+ var muxedContract = __webpack_require__(/*! ./generated/muxed-contract.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-contract.js");
75643
76965
  var muxedEd25519Account = __webpack_require__(/*! ./generated/muxed-ed25519-account.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/muxed-ed25519-account.js");
75644
76966
  var nodeId = __webpack_require__(/*! ./generated/node-id.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/node-id.js");
75645
76967
  var offerEntry = __webpack_require__(/*! ./generated/offer-entry.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/offer-entry.js");
@@ -75778,7 +77100,9 @@ var stateArchivalSettings = __webpack_require__(/*! ./generated/state-archival-s
75778
77100
  var stellarMessage = __webpack_require__(/*! ./generated/stellar-message.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-message.js");
75779
77101
  var stellarValue = __webpack_require__(/*! ./generated/stellar-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value.js");
75780
77102
  var stellarValueExt = __webpack_require__(/*! ./generated/stellar-value-ext.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-ext.js");
77103
+ var stellarValueProposedMsValue = __webpack_require__(/*! ./generated/stellar-value-proposed-ms-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-ms-value.js");
75781
77104
  var stellarValueProposedValue = __webpack_require__(/*! ./generated/stellar-value-proposed-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-proposed-value.js");
77105
+ var stellarValueSignedMsValue = __webpack_require__(/*! ./generated/stellar-value-signed-ms-value.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-signed-ms-value.js");
75782
77106
  var stellarValueType = __webpack_require__(/*! ./generated/stellar-value-type.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stellar-value-type.js");
75783
77107
  var storedDebugTransactionSet = __webpack_require__(/*! ./generated/stored-debug-transaction-set.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stored-debug-transaction-set.js");
75784
77108
  var storedTransactionSet = __webpack_require__(/*! ./generated/stored-transaction-set.js */ "../../node_modules/@stellar/stellar-sdk/lib/cjs/xdr/generated/stored-transaction-set.js");
@@ -76476,6 +77800,7 @@ exports.MuxedAccount = muxedAccount.MuxedAccount;
76476
77800
  exports.MuxedAccountEd25519 = muxedAccount.MuxedAccountEd25519;
76477
77801
  exports.MuxedAccountMuxedEd25519 = muxedAccount.MuxedAccountMuxedEd25519;
76478
77802
  exports.MuxedAccountMed25519 = muxedAccountMed25519.MuxedAccountMed25519;
77803
+ exports.MuxedContract = muxedContract.MuxedContract;
76479
77804
  exports.MuxedEd25519Account = muxedEd25519Account.MuxedEd25519Account;
76480
77805
  exports.NodeId = nodeId.NodeId;
76481
77806
  exports.OfferEntry = offerEntry.OfferEntry;
@@ -76646,6 +77971,7 @@ exports.ScAddressClaimableBalance = scAddress.ScAddressClaimableBalance;
76646
77971
  exports.ScAddressContract = scAddress.ScAddressContract;
76647
77972
  exports.ScAddressLiquidityPool = scAddress.ScAddressLiquidityPool;
76648
77973
  exports.ScAddressMuxedAccount = scAddress.ScAddressMuxedAccount;
77974
+ exports.ScAddressMuxedContract = scAddress.ScAddressMuxedContract;
76649
77975
  exports.ScAddressType = scAddressType.ScAddressType;
76650
77976
  exports.ScBytes = scBytes.ScBytes;
76651
77977
  exports.ScEnvMetaEntry = scEnvMetaEntry.ScEnvMetaEntry;
@@ -76873,8 +78199,12 @@ exports.StellarValue = stellarValue.StellarValue;
76873
78199
  exports.StellarValueExt = stellarValueExt.StellarValueExt;
76874
78200
  exports.StellarValueExtBasic = stellarValueExt.StellarValueExtBasic;
76875
78201
  exports.StellarValueExtEmptyTxSet = stellarValueExt.StellarValueExtEmptyTxSet;
78202
+ exports.StellarValueExtEmptyTxSetMs = stellarValueExt.StellarValueExtEmptyTxSetMs;
76876
78203
  exports.StellarValueExtSigned = stellarValueExt.StellarValueExtSigned;
78204
+ exports.StellarValueExtSignedMs = stellarValueExt.StellarValueExtSignedMs;
78205
+ exports.StellarValueProposedMsValue = stellarValueProposedMsValue.StellarValueProposedMsValue;
76877
78206
  exports.StellarValueProposedValue = stellarValueProposedValue.StellarValueProposedValue;
78207
+ exports.StellarValueSignedMsValue = stellarValueSignedMsValue.StellarValueSignedMsValue;
76878
78208
  exports.StellarValueType = stellarValueType.StellarValueType;
76879
78209
  exports.StoredDebugTransactionSet = storedDebugTransactionSet.StoredDebugTransactionSet;
76880
78210
  exports.StoredTransactionSet = storedTransactionSet.StoredTransactionSet;
@@ -77009,6 +78339,7 @@ exports.MAX_OPS_PER_TX = constants.MAX_OPS_PER_TX;
77009
78339
  exports.MAX_SIGNERS = constants.MAX_SIGNERS;
77010
78340
  exports.SCSYMBOL_LIMIT = constants.SCSYMBOL_LIMIT;
77011
78341
  exports.SC_SPEC_DOC_LIMIT = constants.SC_SPEC_DOC_LIMIT;
78342
+ exports.SC_SPEC_TYPE_NAME_LIMIT = constants.SC_SPEC_TYPE_NAME_LIMIT;
77012
78343
  exports.TX_ADVERT_VECTOR_MAX_SIZE = constants.TX_ADVERT_VECTOR_MAX_SIZE;
77013
78344
  exports.TX_DEMAND_VECTOR_MAX_SIZE = constants.TX_DEMAND_VECTOR_MAX_SIZE;
77014
78345
  exports.Int128 = int128.Int128;
@@ -77777,6 +79108,7 @@ function asDataView(bytes) {
77777
79108
  return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
77778
79109
  }
77779
79110
  function med25519ToStrkey(w) {
79111
+ bigintParts.assertBigIntFits(w.id, false, 64, "MuxedEd25519Account.id");
77780
79112
  const payload = new Uint8Array(40);
77781
79113
  payload.set(w.ed25519, 0);
77782
79114
  asDataView(payload).setBigUint64(32, w.id);
@@ -77789,6 +79121,12 @@ function med25519FromStrkey(json) {
77789
79121
  ed25519: raw.subarray(0, 32)
77790
79122
  };
77791
79123
  }
79124
+ function muxedContractToStrkey(w) {
79125
+ return strkey.StrKey.encodeMuxedContract(strkey.packMuxedContract(w.contractId, w.id));
79126
+ }
79127
+ function muxedContractFromStrkey(json) {
79128
+ return strkey.unpackMuxedContract(strkey.StrKey.decodeMuxedContract(json));
79129
+ }
77792
79130
  function signedPayloadToStrkey(w) {
77793
79131
  const buf = new Uint8Array(32 + 4 + roundUp4(w.payload.length));
77794
79132
  buf.set(w.ed25519, 0);
@@ -77860,6 +79198,17 @@ const MED25519_OVERRIDE = {
77860
79198
  };
77861
79199
  OVERRIDES.set("MuxedEd25519Account", MED25519_OVERRIDE);
77862
79200
  OVERRIDES.set("MuxedAccountMed25519", MED25519_OVERRIDE);
79201
+ OVERRIDES.set("MuxedContract", {
79202
+ toJson(wire) {
79203
+ return muxedContractToStrkey(wire);
79204
+ },
79205
+ fromJson(json) {
79206
+ if (typeof json !== "string") {
79207
+ throw new jsXdr.XdrError("MuxedContract: expected W-strkey string");
79208
+ }
79209
+ return muxedContractFromStrkey(json);
79210
+ }
79211
+ });
77863
79212
  OVERRIDES.set("SignerKey", {
77864
79213
  toJson(wire) {
77865
79214
  const w = wire;
@@ -77930,6 +79279,14 @@ OVERRIDES.set("ScAddress", {
77930
79279
  }
77931
79280
  case 4:
77932
79281
  return strkey.StrKey.encodeLiquidityPool(w.liquidityPoolId);
79282
+ case 5:
79283
+ return muxedContractToStrkey(w.muxedContract);
79284
+ default: {
79285
+ const unknown = w;
79286
+ throw new jsXdr.XdrError(
79287
+ `ScAddress: unsupported type ${unknown.type}`
79288
+ );
79289
+ }
77933
79290
  }
77934
79291
  },
77935
79292
  fromJson(json) {
@@ -77967,6 +79324,9 @@ OVERRIDES.set("ScAddress", {
77967
79324
  liquidityPoolId: strkey.StrKey.decodeLiquidityPool(json)
77968
79325
  };
77969
79326
  }
79327
+ if (json.startsWith("W")) {
79328
+ return { type: 5, muxedContract: muxedContractFromStrkey(json) };
79329
+ }
77970
79330
  throw new jsXdr.XdrError(`ScAddress: unsupported strkey prefix in ${json}`);
77971
79331
  }
77972
79332
  });
@@ -78147,6 +79507,12 @@ var jsXdr = __webpack_require__(/*! @stellar/js-xdr */ "../../node_modules/@stel
78147
79507
  const HEX = "0123456789abcdef";
78148
79508
  class XdrString {
78149
79509
  bytes;
79510
+ /**
79511
+ * A string input is UTF-8 encoded. A lone surrogate (for example from
79512
+ * a `slice()` that cuts a surrogate pair) encodes as U+FFFD with no
79513
+ * error. Check `String.prototype.isWellFormed()` (ES2024) first when the
79514
+ * input can be cut text.
79515
+ */
78150
79516
  constructor(input) {
78151
79517
  if (input instanceof XdrString) {
78152
79518
  this.bytes = input.bytes.slice();
@@ -90870,7 +92236,7 @@ function includes(array, value) {
90870
92236
  /***/ ((module) => {
90871
92237
 
90872
92238
  "use strict";
90873
- module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"5.1.0","engines":{"node":">=22.12.0"},"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/node":"^22.10.2","@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","smol-toml":"^1.7.1","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.7.3","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"@stablelib/base64":"^2.0.0","@stablelib/utf8":"^2.0.0","@stellar/stellar-sdk":"17.0.1","axios":"^1.4.0","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","uint8array-extras":"^1.5.0","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"}}');
92239
+ module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"6.0.0","engines":{"node":">=22.12.0"},"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/node":"^22.10.2","@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","smol-toml":"^1.7.1","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.7.3","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"@stablelib/base64":"^2.0.0","@stablelib/utf8":"^2.0.0","@stellar/stellar-sdk":"17.4.0","axios":"^1.4.0","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","uint8array-extras":"^1.5.0","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"}}');
90874
92240
 
90875
92241
  /***/ }),
90876
92242