xrpl 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68777,6 +68777,63 @@ var ECDSA;
68777
68777
  exports["default"] = ECDSA;
68778
68778
 
68779
68779
 
68780
+ /***/ }),
68781
+
68782
+ /***/ "./dist/npm/Wallet/defaultFaucets.js":
68783
+ /*!*******************************************!*\
68784
+ !*** ./dist/npm/Wallet/defaultFaucets.js ***!
68785
+ \*******************************************/
68786
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
68787
+
68788
+ "use strict";
68789
+
68790
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
68791
+ exports.getDefaultFaucetPath = exports.getFaucetHost = exports.FaucetNetworkPaths = exports.FaucetNetwork = void 0;
68792
+ const errors_1 = __webpack_require__(/*! ../errors */ "./dist/npm/errors.js");
68793
+ var FaucetNetwork;
68794
+ (function (FaucetNetwork) {
68795
+ FaucetNetwork["Testnet"] = "faucet.altnet.rippletest.net";
68796
+ FaucetNetwork["Devnet"] = "faucet.devnet.rippletest.net";
68797
+ FaucetNetwork["AMMDevnet"] = "ammfaucet.devnet.rippletest.net";
68798
+ FaucetNetwork["NFTDevnet"] = "faucet-nft.ripple.com";
68799
+ FaucetNetwork["HooksV2Testnet"] = "hooks-testnet-v2.xrpl-labs.com";
68800
+ })(FaucetNetwork = exports.FaucetNetwork || (exports.FaucetNetwork = {}));
68801
+ exports.FaucetNetworkPaths = {
68802
+ [FaucetNetwork.Testnet]: '/accounts',
68803
+ [FaucetNetwork.Devnet]: '/accounts',
68804
+ [FaucetNetwork.AMMDevnet]: '/accounts',
68805
+ [FaucetNetwork.NFTDevnet]: '/accounts',
68806
+ [FaucetNetwork.HooksV2Testnet]: '/accounts',
68807
+ };
68808
+ function getFaucetHost(client) {
68809
+ const connectionUrl = client.url;
68810
+ if (connectionUrl.includes('hooks-testnet-v2')) {
68811
+ return FaucetNetwork.HooksV2Testnet;
68812
+ }
68813
+ if (connectionUrl.includes('altnet') || connectionUrl.includes('testnet')) {
68814
+ return FaucetNetwork.Testnet;
68815
+ }
68816
+ if (connectionUrl.includes('amm')) {
68817
+ return FaucetNetwork.AMMDevnet;
68818
+ }
68819
+ if (connectionUrl.includes('devnet')) {
68820
+ return FaucetNetwork.Devnet;
68821
+ }
68822
+ if (connectionUrl.includes('xls20-sandbox')) {
68823
+ return FaucetNetwork.NFTDevnet;
68824
+ }
68825
+ throw new errors_1.XRPLFaucetError('Faucet URL is not defined or inferrable.');
68826
+ }
68827
+ exports.getFaucetHost = getFaucetHost;
68828
+ function getDefaultFaucetPath(hostname) {
68829
+ if (hostname === undefined) {
68830
+ return '/accounts';
68831
+ }
68832
+ return exports.FaucetNetworkPaths[hostname] || '/accounts';
68833
+ }
68834
+ exports.getDefaultFaucetPath = getDefaultFaucetPath;
68835
+
68836
+
68780
68837
  /***/ }),
68781
68838
 
68782
68839
  /***/ "./dist/npm/Wallet/fundWallet.js":
@@ -68801,17 +68858,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
68801
68858
  return (mod && mod.__esModule) ? mod : { "default": mod };
68802
68859
  };
68803
68860
  Object.defineProperty(exports, "__esModule", ({ value: true }));
68804
- exports._private = void 0;
68805
68861
  const https_1 = __webpack_require__(/*! https */ "../../node_modules/https-browserify/index.js");
68806
68862
  const ripple_address_codec_1 = __webpack_require__(/*! ripple-address-codec */ "../../node_modules/ripple-address-codec/dist/index.js");
68807
68863
  const errors_1 = __webpack_require__(/*! ../errors */ "./dist/npm/errors.js");
68864
+ const defaultFaucets_1 = __webpack_require__(/*! ./defaultFaucets */ "./dist/npm/Wallet/defaultFaucets.js");
68808
68865
  const _1 = __importDefault(__webpack_require__(/*! . */ "./dist/npm/Wallet/index.js"));
68809
- var FaucetNetwork;
68810
- (function (FaucetNetwork) {
68811
- FaucetNetwork["Testnet"] = "faucet.altnet.rippletest.net";
68812
- FaucetNetwork["Devnet"] = "faucet.devnet.rippletest.net";
68813
- FaucetNetwork["NFTDevnet"] = "faucet-nft.ripple.com";
68814
- })(FaucetNetwork || (FaucetNetwork = {}));
68815
68866
  const INTERVAL_SECONDS = 1;
68816
68867
  const MAX_ATTEMPTS = 20;
68817
68868
  function fundWallet(wallet, options) {
@@ -68824,6 +68875,7 @@ function fundWallet(wallet, options) {
68824
68875
  : _1.default.generate();
68825
68876
  const postBody = Buffer.from(new TextEncoder().encode(JSON.stringify({
68826
68877
  destination: walletToFund.classicAddress,
68878
+ xrpAmount: options === null || options === void 0 ? void 0 : options.amount,
68827
68879
  })));
68828
68880
  let startingBalance = 0;
68829
68881
  try {
@@ -68831,7 +68883,10 @@ function fundWallet(wallet, options) {
68831
68883
  }
68832
68884
  catch (_a) {
68833
68885
  }
68834
- const httpOptions = getHTTPOptions(this, postBody, options === null || options === void 0 ? void 0 : options.faucetHost);
68886
+ const httpOptions = getHTTPOptions(this, postBody, {
68887
+ hostname: options === null || options === void 0 ? void 0 : options.faucetHost,
68888
+ pathname: options === null || options === void 0 ? void 0 : options.faucetPath,
68889
+ });
68835
68890
  return returnPromise(httpOptions, this, startingBalance, walletToFund, postBody);
68836
68891
  });
68837
68892
  }
@@ -68853,11 +68908,14 @@ function returnPromise(options, client, startingBalance, walletToFund, postBody)
68853
68908
  });
68854
68909
  });
68855
68910
  }
68856
- function getHTTPOptions(client, postBody, hostname) {
68911
+ function getHTTPOptions(client, postBody, options) {
68912
+ var _a, _b;
68913
+ const finalHostname = (_a = options === null || options === void 0 ? void 0 : options.hostname) !== null && _a !== void 0 ? _a : (0, defaultFaucets_1.getFaucetHost)(client);
68914
+ const finalPathname = (_b = options === null || options === void 0 ? void 0 : options.pathname) !== null && _b !== void 0 ? _b : (0, defaultFaucets_1.getDefaultFaucetPath)(finalHostname);
68857
68915
  return {
68858
- hostname: hostname !== null && hostname !== void 0 ? hostname : getFaucetHost(client),
68916
+ hostname: finalHostname,
68859
68917
  port: 443,
68860
- path: '/accounts',
68918
+ path: finalPathname,
68861
68919
  method: 'POST',
68862
68920
  headers: {
68863
68921
  'Content-Type': 'application/json',
@@ -68870,7 +68928,9 @@ function onEnd(response, chunks, client, startingBalance, walletToFund, resolve,
68870
68928
  return __awaiter(this, void 0, void 0, function* () {
68871
68929
  const body = Buffer.concat(chunks).toString();
68872
68930
  if ((_a = response.headers['content-type']) === null || _a === void 0 ? void 0 : _a.startsWith('application/json')) {
68873
- yield processSuccessfulResponse(client, body, startingBalance, walletToFund, resolve, reject);
68931
+ const faucetWallet = JSON.parse(body);
68932
+ const classicAddress = faucetWallet.account.classicAddress;
68933
+ yield processSuccessfulResponse(client, classicAddress, walletToFund, startingBalance, resolve, reject);
68874
68934
  }
68875
68935
  else {
68876
68936
  reject(new errors_1.XRPLFaucetError(`Content type is not \`application/json\`: ${JSON.stringify({
@@ -68881,10 +68941,8 @@ function onEnd(response, chunks, client, startingBalance, walletToFund, resolve,
68881
68941
  }
68882
68942
  });
68883
68943
  }
68884
- function processSuccessfulResponse(client, body, startingBalance, walletToFund, resolve, reject) {
68944
+ function processSuccessfulResponse(client, classicAddress, walletToFund, startingBalance, resolve, reject) {
68885
68945
  return __awaiter(this, void 0, void 0, function* () {
68886
- const faucetWallet = JSON.parse(body);
68887
- const classicAddress = faucetWallet.account.classicAddress;
68888
68946
  if (!classicAddress) {
68889
68947
  reject(new errors_1.XRPLFaucetError(`The faucet account is undefined`));
68890
68948
  return;
@@ -68944,25 +69002,7 @@ function getUpdatedBalance(client, address, originalBalance) {
68944
69002
  });
68945
69003
  });
68946
69004
  }
68947
- function getFaucetHost(client) {
68948
- const connectionUrl = client.url;
68949
- if (connectionUrl.includes('altnet') || connectionUrl.includes('testnet')) {
68950
- return FaucetNetwork.Testnet;
68951
- }
68952
- if (connectionUrl.includes('devnet')) {
68953
- return FaucetNetwork.Devnet;
68954
- }
68955
- if (connectionUrl.includes('xls20-sandbox')) {
68956
- return FaucetNetwork.NFTDevnet;
68957
- }
68958
- throw new errors_1.XRPLFaucetError('Faucet URL is not defined or inferrable.');
68959
- }
68960
69005
  exports["default"] = fundWallet;
68961
- const _private = {
68962
- FaucetNetwork,
68963
- getFaucetHost,
68964
- };
68965
- exports._private = _private;
68966
69006
 
68967
69007
 
68968
69008
  /***/ }),
@@ -69116,7 +69156,9 @@ class Wallet {
69116
69156
  };
69117
69157
  }
69118
69158
  verifyTransaction(signedTransaction) {
69119
- const tx = (0, ripple_binary_codec_1.decode)(signedTransaction);
69159
+ const tx = typeof signedTransaction === 'string'
69160
+ ? (0, ripple_binary_codec_1.decode)(signedTransaction)
69161
+ : signedTransaction;
69120
69162
  const messageHex = (0, ripple_binary_codec_1.encodeForSigning)(tx);
69121
69163
  const signature = tx.TxnSignature;
69122
69164
  return (0, ripple_keypairs_1.verify)(messageHex, signature, this.publicKey);
@@ -72570,7 +72612,7 @@ exports.submitAndWait = exports.submit = void 0;
72570
72612
  const ripple_binary_codec_1 = __webpack_require__(/*! ripple-binary-codec */ "../../node_modules/ripple-binary-codec/dist/index.js");
72571
72613
  const errors_1 = __webpack_require__(/*! ../errors */ "./dist/npm/errors.js");
72572
72614
  const utils_1 = __webpack_require__(/*! ../utils */ "./dist/npm/utils/index.js");
72573
- const LEDGER_CLOSE_TIME = 4000;
72615
+ const LEDGER_CLOSE_TIME = 1000;
72574
72616
  function sleep(ms) {
72575
72617
  return __awaiter(this, void 0, void 0, function* () {
72576
72618
  return new Promise((resolve) => {