xrpl 2.0.3 → 2.0.4
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/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest.js +1 -1
- package/package.json +5 -5
package/build/xrpl-latest.js
CHANGED
@@ -2117,7 +2117,7 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
2117
2117
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
2118
2118
|
|
2119
2119
|
"use strict";
|
2120
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Currency = void 0;\nvar hash_160_1 = __webpack_require__(/*! ./hash-160 */ \"../../node_modules/ripple-binary-codec/dist/types/hash-160.js\");\nvar buffer_1 = __webpack_require__(/*! buffer/ */ \"../../node_modules/ripple-binary-codec/node_modules/buffer/index.js\");\nvar ISO_REGEX = /^[A-Z0-9]{3}$/;\nvar HEX_REGEX = /^[A-F0-9]{40}$/;\n/**\n * Convert an ISO code to a currency bytes representation\n */\nfunction isoToBytes(iso) {\n var bytes = buffer_1.Buffer.alloc(20);\n if (iso !== 'XRP') {\n var isoBytes = iso.split('').map(function (c) { return c.charCodeAt(0); });\n bytes.set(isoBytes, 12);\n }\n return bytes;\n}\n/**\n * Tests if ISO is a valid iso code\n */\nfunction isIsoCode(iso) {\n return ISO_REGEX.test(iso);\n}\nfunction isoCodeFromHex(code) {\n var iso = code.toString();\n if (iso === 'XRP') {\n throw new Error('Disallowed currency code: to indicate the currency XRP you must use 20 bytes of 0s');\n }\n if (isIsoCode(iso)) {\n return iso;\n }\n return null;\n}\n/**\n * Tests if hex is a valid hex-string\n */\nfunction isHex(hex) {\n return HEX_REGEX.test(hex);\n}\n/**\n * Tests if a string is a valid representation of a currency\n */\nfunction isStringRepresentation(input) {\n return input.length === 3 || isHex(input);\n}\n/**\n * Tests if a Buffer is a valid representation of a currency\n */\nfunction isBytesArray(bytes) {\n return bytes.byteLength === 20;\n}\n/**\n * Ensures that a value is a valid representation of a currency\n */\nfunction isValidRepresentation(input) {\n return input instanceof buffer_1.Buffer\n ? isBytesArray(input)\n : isStringRepresentation(input);\n}\n/**\n * Generate bytes from a string or buffer representation of a currency\n */\nfunction bytesFromRepresentation(input) {\n if (!isValidRepresentation(input)) {\n throw new Error(\"Unsupported Currency representation: \".concat(input));\n }\n return input.length === 3 ? isoToBytes(input) : buffer_1.Buffer.from(input, 'hex');\n}\n/**\n * Class defining how to encode and decode Currencies\n */\nvar Currency = /** @class */ (function (_super) {\n __extends(Currency, _super);\n function Currency(byteBuf) {\n var _this = _super.call(this, byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.XRP.bytes) || this;\n var code = _this.bytes.slice(12, 15);\n if (_this.bytes[0] !== 0) {\n _this._iso = null;\n }\n else if (
|
2120
|
+
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Currency = void 0;\nvar hash_160_1 = __webpack_require__(/*! ./hash-160 */ \"../../node_modules/ripple-binary-codec/dist/types/hash-160.js\");\nvar buffer_1 = __webpack_require__(/*! buffer/ */ \"../../node_modules/ripple-binary-codec/node_modules/buffer/index.js\");\nvar ISO_REGEX = /^[A-Z0-9]{3}$/;\nvar HEX_REGEX = /^[A-F0-9]{40}$/;\n/**\n * Convert an ISO code to a currency bytes representation\n */\nfunction isoToBytes(iso) {\n var bytes = buffer_1.Buffer.alloc(20);\n if (iso !== 'XRP') {\n var isoBytes = iso.split('').map(function (c) { return c.charCodeAt(0); });\n bytes.set(isoBytes, 12);\n }\n return bytes;\n}\n/**\n * Tests if ISO is a valid iso code\n */\nfunction isIsoCode(iso) {\n return ISO_REGEX.test(iso);\n}\nfunction isoCodeFromHex(code) {\n var iso = code.toString();\n if (iso === 'XRP') {\n throw new Error('Disallowed currency code: to indicate the currency XRP you must use 20 bytes of 0s');\n }\n if (isIsoCode(iso)) {\n return iso;\n }\n return null;\n}\n/**\n * Tests if hex is a valid hex-string\n */\nfunction isHex(hex) {\n return HEX_REGEX.test(hex);\n}\n/**\n * Tests if a string is a valid representation of a currency\n */\nfunction isStringRepresentation(input) {\n return input.length === 3 || isHex(input);\n}\n/**\n * Tests if a Buffer is a valid representation of a currency\n */\nfunction isBytesArray(bytes) {\n return bytes.byteLength === 20;\n}\n/**\n * Ensures that a value is a valid representation of a currency\n */\nfunction isValidRepresentation(input) {\n return input instanceof buffer_1.Buffer\n ? isBytesArray(input)\n : isStringRepresentation(input);\n}\n/**\n * Generate bytes from a string or buffer representation of a currency\n */\nfunction bytesFromRepresentation(input) {\n if (!isValidRepresentation(input)) {\n throw new Error(\"Unsupported Currency representation: \".concat(input));\n }\n return input.length === 3 ? isoToBytes(input) : buffer_1.Buffer.from(input, 'hex');\n}\n/**\n * Class defining how to encode and decode Currencies\n */\nvar Currency = /** @class */ (function (_super) {\n __extends(Currency, _super);\n function Currency(byteBuf) {\n var _this = _super.call(this, byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.XRP.bytes) || this;\n var code = _this.bytes.slice(12, 15);\n if (_this.bytes[0] !== 0) {\n _this._iso = null;\n }\n else if (/^0*$/.test(_this.bytes.toString('hex'))) {\n _this._iso = 'XRP';\n }\n else {\n _this._iso = isoCodeFromHex(code);\n }\n return _this;\n }\n /**\n * Return the ISO code of this currency\n *\n * @returns ISO code if it exists, else null\n */\n Currency.prototype.iso = function () {\n return this._iso;\n };\n /**\n * Constructs a Currency object\n *\n * @param val Currency object or a string representation of a currency\n */\n Currency.from = function (value) {\n if (value instanceof Currency) {\n return value;\n }\n if (typeof value === 'string') {\n return new Currency(bytesFromRepresentation(value));\n }\n throw new Error('Cannot construct Currency from value given');\n };\n /**\n * Gets the JSON representation of a currency\n *\n * @returns JSON representation\n */\n Currency.prototype.toJSON = function () {\n var iso = this.iso();\n if (iso !== null) {\n return iso;\n }\n return this.bytes.toString('hex').toUpperCase();\n };\n Currency.XRP = new Currency(buffer_1.Buffer.alloc(20));\n return Currency;\n}(hash_160_1.Hash160));\nexports.Currency = Currency;\n//# sourceMappingURL=currency.js.map\n\n//# sourceURL=webpack://xrpl/../../node_modules/ripple-binary-codec/dist/types/currency.js?");
|
2121
2121
|
|
2122
2122
|
/***/ }),
|
2123
2123
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "xrpl",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.4",
|
4
4
|
"license": "ISC",
|
5
5
|
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
|
6
6
|
"files": [
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"bip39": "^3.0.4",
|
25
25
|
"https-proxy-agent": "^5.0.0",
|
26
26
|
"lodash": "^4.17.4",
|
27
|
-
"ripple-address-codec": "^4.2.
|
28
|
-
"ripple-binary-codec": "^1.2.
|
29
|
-
"ripple-keypairs": "^1.1.
|
27
|
+
"ripple-address-codec": "^4.2.2",
|
28
|
+
"ripple-binary-codec": "^1.2.2",
|
29
|
+
"ripple-keypairs": "^1.1.2",
|
30
30
|
"ws": "^8.2.2"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
@@ -66,5 +66,5 @@
|
|
66
66
|
"engines": {
|
67
67
|
"node": ">=10.13.0"
|
68
68
|
},
|
69
|
-
"gitHead": "
|
69
|
+
"gitHead": "78d9b117941cd9ce06d6f1291eb24e882482ceab"
|
70
70
|
}
|