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.

index.js 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. var desc = Object.getOwnPropertyDescriptor(m, k);
  5. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  6. desc = { enumerable: true, get: function() { return m[k]; } };
  7. }
  8. Object.defineProperty(o, k2, desc);
  9. }) : (function(o, m, k, k2) {
  10. if (k2 === undefined) k2 = k;
  11. o[k2] = m[k];
  12. }));
  13. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  14. Object.defineProperty(o, "default", { enumerable: true, value: v });
  15. }) : function(o, v) {
  16. o["default"] = v;
  17. });
  18. var __importStar = (this && this.__importStar) || function (mod) {
  19. if (mod && mod.__esModule) return mod;
  20. var result = {};
  21. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  22. __setModuleDefault(result, mod);
  23. return result;
  24. };
  25. var __importDefault = (this && this.__importDefault) || function (mod) {
  26. return (mod && mod.__esModule) ? mod : { "default": mod };
  27. };
  28. Object.defineProperty(exports, "__esModule", { value: true });
  29. exports.parseNFTokenID = exports.createCrossChainPayment = exports.getNFTokenID = exports.encodeForSigningClaim = exports.encodeForSigning = exports.encodeForMultiSigning = exports.decode = exports.encode = exports.decodeXAddress = exports.encodeXAddress = exports.decodeAccountPublic = exports.encodeAccountPublic = exports.decodeNodePublic = exports.encodeNodePublic = exports.decodeAccountID = exports.encodeAccountID = exports.decodeSeed = exports.encodeSeed = exports.isValidClassicAddress = exports.isValidXAddress = exports.xAddressToClassicAddress = exports.classicAddressToXAddress = exports.convertHexToString = exports.convertStringToHex = exports.verifyPaymentChannelClaim = exports.verifyKeypairSignature = exports.signPaymentChannelClaim = exports.deriveXAddress = exports.deriveAddress = exports.deriveKeypair = exports.hashes = exports.isValidAddress = exports.isValidSecret = exports.qualityToDecimal = exports.transferRateToDecimal = exports.decimalToTransferRate = exports.percentToTransferRate = exports.decimalToQuality = exports.percentToQuality = exports.unixTimeToRippleTime = exports.rippleTimeToUnixTime = exports.isoTimeToRippleTime = exports.rippleTimeToISOTime = exports.hasNextPage = exports.xrpToDrops = exports.dropsToXrp = exports.getBalanceChanges = void 0;
  30. const ripple_address_codec_1 = require("ripple-address-codec");
  31. Object.defineProperty(exports, "classicAddressToXAddress", { enumerable: true, get: function () { return ripple_address_codec_1.classicAddressToXAddress; } });
  32. Object.defineProperty(exports, "decodeAccountID", { enumerable: true, get: function () { return ripple_address_codec_1.decodeAccountID; } });
  33. Object.defineProperty(exports, "decodeAccountPublic", { enumerable: true, get: function () { return ripple_address_codec_1.decodeAccountPublic; } });
  34. Object.defineProperty(exports, "decodeNodePublic", { enumerable: true, get: function () { return ripple_address_codec_1.decodeNodePublic; } });
  35. Object.defineProperty(exports, "decodeSeed", { enumerable: true, get: function () { return ripple_address_codec_1.decodeSeed; } });
  36. Object.defineProperty(exports, "decodeXAddress", { enumerable: true, get: function () { return ripple_address_codec_1.decodeXAddress; } });
  37. Object.defineProperty(exports, "encodeAccountID", { enumerable: true, get: function () { return ripple_address_codec_1.encodeAccountID; } });
  38. Object.defineProperty(exports, "encodeAccountPublic", { enumerable: true, get: function () { return ripple_address_codec_1.encodeAccountPublic; } });
  39. Object.defineProperty(exports, "encodeNodePublic", { enumerable: true, get: function () { return ripple_address_codec_1.encodeNodePublic; } });
  40. Object.defineProperty(exports, "encodeSeed", { enumerable: true, get: function () { return ripple_address_codec_1.encodeSeed; } });
  41. Object.defineProperty(exports, "encodeXAddress", { enumerable: true, get: function () { return ripple_address_codec_1.encodeXAddress; } });
  42. Object.defineProperty(exports, "isValidClassicAddress", { enumerable: true, get: function () { return ripple_address_codec_1.isValidClassicAddress; } });
  43. Object.defineProperty(exports, "isValidXAddress", { enumerable: true, get: function () { return ripple_address_codec_1.isValidXAddress; } });
  44. Object.defineProperty(exports, "xAddressToClassicAddress", { enumerable: true, get: function () { return ripple_address_codec_1.xAddressToClassicAddress; } });
  45. const rbc = __importStar(require("ripple-binary-codec"));
  46. const ripple_keypairs_1 = require("ripple-keypairs");
  47. Object.defineProperty(exports, "verifyKeypairSignature", { enumerable: true, get: function () { return ripple_keypairs_1.verify; } });
  48. const createCrossChainPayment_1 = __importDefault(require("./createCrossChainPayment"));
  49. exports.createCrossChainPayment = createCrossChainPayment_1.default;
  50. const derive_1 = require("./derive");
  51. Object.defineProperty(exports, "deriveKeypair", { enumerable: true, get: function () { return derive_1.deriveKeypair; } });
  52. Object.defineProperty(exports, "deriveAddress", { enumerable: true, get: function () { return derive_1.deriveAddress; } });
  53. Object.defineProperty(exports, "deriveXAddress", { enumerable: true, get: function () { return derive_1.deriveXAddress; } });
  54. const getBalanceChanges_1 = __importDefault(require("./getBalanceChanges"));
  55. exports.getBalanceChanges = getBalanceChanges_1.default;
  56. const getNFTokenID_1 = __importDefault(require("./getNFTokenID"));
  57. exports.getNFTokenID = getNFTokenID_1.default;
  58. const hashes_1 = require("./hashes");
  59. const parseNFTokenID_1 = __importDefault(require("./parseNFTokenID"));
  60. exports.parseNFTokenID = parseNFTokenID_1.default;
  61. const quality_1 = require("./quality");
  62. Object.defineProperty(exports, "percentToTransferRate", { enumerable: true, get: function () { return quality_1.percentToTransferRate; } });
  63. Object.defineProperty(exports, "decimalToTransferRate", { enumerable: true, get: function () { return quality_1.decimalToTransferRate; } });
  64. Object.defineProperty(exports, "transferRateToDecimal", { enumerable: true, get: function () { return quality_1.transferRateToDecimal; } });
  65. Object.defineProperty(exports, "percentToQuality", { enumerable: true, get: function () { return quality_1.percentToQuality; } });
  66. Object.defineProperty(exports, "decimalToQuality", { enumerable: true, get: function () { return quality_1.decimalToQuality; } });
  67. Object.defineProperty(exports, "qualityToDecimal", { enumerable: true, get: function () { return quality_1.qualityToDecimal; } });
  68. const signPaymentChannelClaim_1 = __importDefault(require("./signPaymentChannelClaim"));
  69. exports.signPaymentChannelClaim = signPaymentChannelClaim_1.default;
  70. const stringConversion_1 = require("./stringConversion");
  71. Object.defineProperty(exports, "convertHexToString", { enumerable: true, get: function () { return stringConversion_1.convertHexToString; } });
  72. Object.defineProperty(exports, "convertStringToHex", { enumerable: true, get: function () { return stringConversion_1.convertStringToHex; } });
  73. const timeConversion_1 = require("./timeConversion");
  74. Object.defineProperty(exports, "rippleTimeToISOTime", { enumerable: true, get: function () { return timeConversion_1.rippleTimeToISOTime; } });
  75. Object.defineProperty(exports, "isoTimeToRippleTime", { enumerable: true, get: function () { return timeConversion_1.isoTimeToRippleTime; } });
  76. Object.defineProperty(exports, "rippleTimeToUnixTime", { enumerable: true, get: function () { return timeConversion_1.rippleTimeToUnixTime; } });
  77. Object.defineProperty(exports, "unixTimeToRippleTime", { enumerable: true, get: function () { return timeConversion_1.unixTimeToRippleTime; } });
  78. const verifyPaymentChannelClaim_1 = __importDefault(require("./verifyPaymentChannelClaim"));
  79. exports.verifyPaymentChannelClaim = verifyPaymentChannelClaim_1.default;
  80. const xrpConversion_1 = require("./xrpConversion");
  81. Object.defineProperty(exports, "xrpToDrops", { enumerable: true, get: function () { return xrpConversion_1.xrpToDrops; } });
  82. Object.defineProperty(exports, "dropsToXrp", { enumerable: true, get: function () { return xrpConversion_1.dropsToXrp; } });
  83. function isValidSecret(secret) {
  84. try {
  85. (0, derive_1.deriveKeypair)(secret);
  86. return true;
  87. }
  88. catch (_err) {
  89. return false;
  90. }
  91. }
  92. exports.isValidSecret = isValidSecret;
  93. function encode(object) {
  94. return rbc.encode(object);
  95. }
  96. exports.encode = encode;
  97. function encodeForSigning(object) {
  98. return rbc.encodeForSigning(object);
  99. }
  100. exports.encodeForSigning = encodeForSigning;
  101. function encodeForSigningClaim(object) {
  102. return rbc.encodeForSigningClaim(object);
  103. }
  104. exports.encodeForSigningClaim = encodeForSigningClaim;
  105. function encodeForMultiSigning(object, signer) {
  106. return rbc.encodeForMultisigning(object, signer);
  107. }
  108. exports.encodeForMultiSigning = encodeForMultiSigning;
  109. function decode(hex) {
  110. return rbc.decode(hex);
  111. }
  112. exports.decode = decode;
  113. function isValidAddress(address) {
  114. return (0, ripple_address_codec_1.isValidXAddress)(address) || (0, ripple_address_codec_1.isValidClassicAddress)(address);
  115. }
  116. exports.isValidAddress = isValidAddress;
  117. function hasNextPage(response) {
  118. return Boolean(response.result['marker']);
  119. }
  120. exports.hasNextPage = hasNextPage;
  121. const hashes = {
  122. hashSignedTx: hashes_1.hashSignedTx,
  123. hashTx: hashes_1.hashTx,
  124. hashAccountRoot: hashes_1.hashAccountRoot,
  125. hashSignerListId: hashes_1.hashSignerListId,
  126. hashOfferId: hashes_1.hashOfferId,
  127. hashTrustline: hashes_1.hashTrustline,
  128. hashTxTree: hashes_1.hashTxTree,
  129. hashStateTree: hashes_1.hashStateTree,
  130. hashLedger: hashes_1.hashLedger,
  131. hashLedgerHeader: hashes_1.hashLedgerHeader,
  132. hashEscrow: hashes_1.hashEscrow,
  133. hashPaymentChannel: hashes_1.hashPaymentChannel,
  134. };
  135. exports.hashes = hashes;
  136. //# sourceMappingURL=index.js.map