You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

defaultFaucets.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getDefaultFaucetPath = exports.getFaucetHost = exports.FaucetNetworkPaths = exports.FaucetNetwork = void 0;
  4. const errors_1 = require("../errors");
  5. var FaucetNetwork;
  6. (function (FaucetNetwork) {
  7. FaucetNetwork["Testnet"] = "faucet.altnet.rippletest.net";
  8. FaucetNetwork["Devnet"] = "faucet.devnet.rippletest.net";
  9. FaucetNetwork["AMMDevnet"] = "ammfaucet.devnet.rippletest.net";
  10. FaucetNetwork["HooksV2Testnet"] = "hooks-testnet-v2.xrpl-labs.com";
  11. })(FaucetNetwork = exports.FaucetNetwork || (exports.FaucetNetwork = {}));
  12. exports.FaucetNetworkPaths = {
  13. [FaucetNetwork.Testnet]: '/accounts',
  14. [FaucetNetwork.Devnet]: '/accounts',
  15. [FaucetNetwork.AMMDevnet]: '/accounts',
  16. [FaucetNetwork.HooksV2Testnet]: '/accounts',
  17. };
  18. function getFaucetHost(client) {
  19. const connectionUrl = client.url;
  20. if (connectionUrl.includes('hooks-testnet-v2')) {
  21. return FaucetNetwork.HooksV2Testnet;
  22. }
  23. if (connectionUrl.includes('altnet') || connectionUrl.includes('testnet')) {
  24. return FaucetNetwork.Testnet;
  25. }
  26. if (connectionUrl.includes('amm')) {
  27. return FaucetNetwork.AMMDevnet;
  28. }
  29. if (connectionUrl.includes('devnet')) {
  30. return FaucetNetwork.Devnet;
  31. }
  32. throw new errors_1.XRPLFaucetError('Faucet URL is not defined or inferrable.');
  33. }
  34. exports.getFaucetHost = getFaucetHost;
  35. function getDefaultFaucetPath(hostname) {
  36. if (hostname === undefined) {
  37. return '/accounts';
  38. }
  39. return exports.FaucetNetworkPaths[hostname] || '/accounts';
  40. }
  41. exports.getDefaultFaucetPath = getDefaultFaucetPath;
  42. //# sourceMappingURL=defaultFaucets.js.map