mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-05 21:35:49 +00:00
feat: remove lodash as a dependency (#2378)
This will reduce the bundle size by ~23%(117kb). Only 4 methods were used `flatten`, `flatMap`, `omitBy`, and `groupBy`. `omitBy and `groupBy` were recreated while the es2019 implementations of `flatten` and `flatMap` are used. `lodash` is still used in the tests which is fine because it makes the tests cleaner. Closes #2118
This commit is contained in:
179
package-lock.json
generated
179
package-lock.json
generated
@@ -47,6 +47,7 @@
|
|||||||
"jest": "^29.3.1",
|
"jest": "^29.3.1",
|
||||||
"jest-mock": "^29.3.1",
|
"jest-mock": "^29.3.1",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"path-browserify": "1.0.1",
|
"path-browserify": "1.0.1",
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
@@ -176,9 +177,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/compat-data": {
|
"node_modules/@babel/compat-data": {
|
||||||
"version": "7.20.14",
|
"version": "7.22.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.6.tgz",
|
||||||
"integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==",
|
"integrity": "sha512-29tfsWTq2Ftu7MXmimyC0C5FDZv5DYxOZkh3XD3+QW4V/BYuv/LyEsjj3c0hqedEaDt6DBfDvexMKU8YevdqFg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -259,16 +260,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-compilation-targets": {
|
"node_modules/@babel/helper-compilation-targets": {
|
||||||
"version": "7.20.7",
|
"version": "7.22.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.6.tgz",
|
||||||
"integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==",
|
"integrity": "sha512-534sYEqWD9VfUm3IPn2SLcH4Q3P86XL+QvqdC7ZsFrzyyPF3T4XGiVghF6PTYNdWg6pXuoqXxNQAhbYeEInTzA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/compat-data": "^7.20.5",
|
"@babel/compat-data": "^7.22.6",
|
||||||
"@babel/helper-validator-option": "^7.18.6",
|
"@babel/helper-validator-option": "^7.22.5",
|
||||||
"browserslist": "^4.21.3",
|
"@nicolo-ribaudo/semver-v6": "^6.3.3",
|
||||||
"lru-cache": "^5.1.1",
|
"browserslist": "^4.21.9",
|
||||||
"semver": "^6.3.0"
|
"lru-cache": "^5.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -277,15 +278,6 @@
|
|||||||
"@babel/core": "^7.0.0"
|
"@babel/core": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-compilation-targets/node_modules/semver": {
|
|
||||||
"version": "6.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
|
||||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@babel/helper-environment-visitor": {
|
"node_modules/@babel/helper-environment-visitor": {
|
||||||
"version": "7.22.20",
|
"version": "7.22.20",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
|
||||||
@@ -321,31 +313,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-module-imports": {
|
"node_modules/@babel/helper-module-imports": {
|
||||||
"version": "7.18.6",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz",
|
||||||
"integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==",
|
"integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/types": "^7.18.6"
|
"@babel/types": "^7.22.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-module-transforms": {
|
"node_modules/@babel/helper-module-transforms": {
|
||||||
"version": "7.20.11",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.5.tgz",
|
||||||
"integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==",
|
"integrity": "sha512-+hGKDt/Ze8GFExiVHno/2dvG5IdstpzCq0y4Qc9OJ25D4q3pKfiIP/4Vp3/JvhDkLKsDK2api3q3fpIgiIF5bw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-environment-visitor": "^7.18.9",
|
"@babel/helper-environment-visitor": "^7.22.5",
|
||||||
"@babel/helper-module-imports": "^7.18.6",
|
"@babel/helper-module-imports": "^7.22.5",
|
||||||
"@babel/helper-simple-access": "^7.20.2",
|
"@babel/helper-simple-access": "^7.22.5",
|
||||||
"@babel/helper-split-export-declaration": "^7.18.6",
|
"@babel/helper-split-export-declaration": "^7.22.5",
|
||||||
"@babel/helper-validator-identifier": "^7.19.1",
|
"@babel/helper-validator-identifier": "^7.22.5",
|
||||||
"@babel/template": "^7.20.7",
|
"@babel/template": "^7.22.5",
|
||||||
"@babel/traverse": "^7.20.10",
|
"@babel/traverse": "^7.22.5",
|
||||||
"@babel/types": "^7.20.7"
|
"@babel/types": "^7.22.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -361,12 +353,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-simple-access": {
|
"node_modules/@babel/helper-simple-access": {
|
||||||
"version": "7.20.2",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz",
|
||||||
"integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==",
|
"integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/types": "^7.20.2"
|
"@babel/types": "^7.22.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -403,9 +395,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-validator-option": {
|
"node_modules/@babel/helper-validator-option": {
|
||||||
"version": "7.18.6",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz",
|
||||||
"integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==",
|
"integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -2441,6 +2433,15 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@nicolo-ribaudo/semver-v6": {
|
||||||
|
"version": "6.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz",
|
||||||
|
"integrity": "sha512-3Yc1fUTs69MG/uZbJlLSI3JISMn2UV2rg+1D/vROUqZyh3l6iYHCs7GMp+M40ZD7yOdDbYjJcU1oTJhrc+dGKg==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@noble/hashes": {
|
"node_modules/@noble/hashes": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
|
||||||
@@ -10752,7 +10753,8 @@
|
|||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/lodash._reinterpolate": {
|
"node_modules/lodash._reinterpolate": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
@@ -11778,9 +11780,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.14",
|
"version": "2.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz",
|
||||||
"integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==",
|
"integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/noms": {
|
"node_modules/noms": {
|
||||||
@@ -16527,7 +16529,6 @@
|
|||||||
"bip32": "^2.0.6",
|
"bip32": "^2.0.6",
|
||||||
"bip39": "^3.0.4",
|
"bip39": "^3.0.4",
|
||||||
"https-proxy-agent": "^5.0.0",
|
"https-proxy-agent": "^5.0.0",
|
||||||
"lodash": "^4.17.4",
|
|
||||||
"ripple-address-codec": "^4.3.1",
|
"ripple-address-codec": "^4.3.1",
|
||||||
"ripple-binary-codec": "^1.11.0",
|
"ripple-binary-codec": "^1.11.0",
|
||||||
"ripple-keypairs": "^1.3.1",
|
"ripple-keypairs": "^1.3.1",
|
||||||
@@ -16545,6 +16546,7 @@
|
|||||||
"karma-chrome-launcher": "^3.1.1",
|
"karma-chrome-launcher": "^3.1.1",
|
||||||
"karma-jasmine": "^5.1.0",
|
"karma-jasmine": "^5.1.0",
|
||||||
"karma-webpack": "^5.0.0",
|
"karma-webpack": "^5.0.0",
|
||||||
|
"lodash": "^4.17.4",
|
||||||
"node-polyfill-webpack-plugin": "^2.0.1",
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"typedoc": "0.25.0"
|
"typedoc": "0.25.0"
|
||||||
@@ -16646,9 +16648,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/compat-data": {
|
"@babel/compat-data": {
|
||||||
"version": "7.20.14",
|
"version": "7.22.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.6.tgz",
|
||||||
"integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==",
|
"integrity": "sha512-29tfsWTq2Ftu7MXmimyC0C5FDZv5DYxOZkh3XD3+QW4V/BYuv/LyEsjj3c0hqedEaDt6DBfDvexMKU8YevdqFg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/core": {
|
"@babel/core": {
|
||||||
@@ -16714,24 +16716,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-compilation-targets": {
|
"@babel/helper-compilation-targets": {
|
||||||
"version": "7.20.7",
|
"version": "7.22.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.6.tgz",
|
||||||
"integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==",
|
"integrity": "sha512-534sYEqWD9VfUm3IPn2SLcH4Q3P86XL+QvqdC7ZsFrzyyPF3T4XGiVghF6PTYNdWg6pXuoqXxNQAhbYeEInTzA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/compat-data": "^7.20.5",
|
"@babel/compat-data": "^7.22.6",
|
||||||
"@babel/helper-validator-option": "^7.18.6",
|
"@babel/helper-validator-option": "^7.22.5",
|
||||||
"browserslist": "^4.21.3",
|
"@nicolo-ribaudo/semver-v6": "^6.3.3",
|
||||||
"lru-cache": "^5.1.1",
|
"browserslist": "^4.21.9",
|
||||||
"semver": "^6.3.0"
|
"lru-cache": "^5.1.1"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"semver": {
|
|
||||||
"version": "6.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
|
||||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-environment-visitor": {
|
"@babel/helper-environment-visitor": {
|
||||||
@@ -16760,28 +16754,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-module-imports": {
|
"@babel/helper-module-imports": {
|
||||||
"version": "7.18.6",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz",
|
||||||
"integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==",
|
"integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/types": "^7.18.6"
|
"@babel/types": "^7.22.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-module-transforms": {
|
"@babel/helper-module-transforms": {
|
||||||
"version": "7.20.11",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.5.tgz",
|
||||||
"integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==",
|
"integrity": "sha512-+hGKDt/Ze8GFExiVHno/2dvG5IdstpzCq0y4Qc9OJ25D4q3pKfiIP/4Vp3/JvhDkLKsDK2api3q3fpIgiIF5bw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/helper-environment-visitor": "^7.18.9",
|
"@babel/helper-environment-visitor": "^7.22.5",
|
||||||
"@babel/helper-module-imports": "^7.18.6",
|
"@babel/helper-module-imports": "^7.22.5",
|
||||||
"@babel/helper-simple-access": "^7.20.2",
|
"@babel/helper-simple-access": "^7.22.5",
|
||||||
"@babel/helper-split-export-declaration": "^7.18.6",
|
"@babel/helper-split-export-declaration": "^7.22.5",
|
||||||
"@babel/helper-validator-identifier": "^7.19.1",
|
"@babel/helper-validator-identifier": "^7.22.5",
|
||||||
"@babel/template": "^7.20.7",
|
"@babel/template": "^7.22.5",
|
||||||
"@babel/traverse": "^7.20.10",
|
"@babel/traverse": "^7.22.5",
|
||||||
"@babel/types": "^7.20.7"
|
"@babel/types": "^7.22.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-plugin-utils": {
|
"@babel/helper-plugin-utils": {
|
||||||
@@ -16791,12 +16785,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/helper-simple-access": {
|
"@babel/helper-simple-access": {
|
||||||
"version": "7.20.2",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz",
|
||||||
"integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==",
|
"integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/types": "^7.20.2"
|
"@babel/types": "^7.22.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-split-export-declaration": {
|
"@babel/helper-split-export-declaration": {
|
||||||
@@ -16821,9 +16815,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/helper-validator-option": {
|
"@babel/helper-validator-option": {
|
||||||
"version": "7.18.6",
|
"version": "7.22.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz",
|
||||||
"integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==",
|
"integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/helpers": {
|
"@babel/helpers": {
|
||||||
@@ -18452,6 +18446,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@nicolo-ribaudo/semver-v6": {
|
||||||
|
"version": "6.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz",
|
||||||
|
"integrity": "sha512-3Yc1fUTs69MG/uZbJlLSI3JISMn2UV2rg+1D/vROUqZyh3l6iYHCs7GMp+M40ZD7yOdDbYjJcU1oTJhrc+dGKg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@noble/hashes": {
|
"@noble/hashes": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
|
||||||
@@ -25053,7 +25053,8 @@
|
|||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"lodash._reinterpolate": {
|
"lodash._reinterpolate": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
"jest": "^29.3.1",
|
"jest": "^29.3.1",
|
||||||
"jest-mock": "^29.3.1",
|
"jest-mock": "^29.3.1",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"path-browserify": "1.0.1",
|
"path-browserify": "1.0.1",
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
"bip32": "^2.0.6",
|
"bip32": "^2.0.6",
|
||||||
"bip39": "^3.0.4",
|
"bip39": "^3.0.4",
|
||||||
"https-proxy-agent": "^5.0.0",
|
"https-proxy-agent": "^5.0.0",
|
||||||
"lodash": "^4.17.4",
|
|
||||||
"ripple-address-codec": "^4.3.1",
|
"ripple-address-codec": "^4.3.1",
|
||||||
"ripple-binary-codec": "^1.11.0",
|
"ripple-binary-codec": "^1.11.0",
|
||||||
"ripple-keypairs": "^1.3.1",
|
"ripple-keypairs": "^1.3.1",
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
"karma-chrome-launcher": "^3.1.1",
|
"karma-chrome-launcher": "^3.1.1",
|
||||||
"karma-jasmine": "^5.1.0",
|
"karma-jasmine": "^5.1.0",
|
||||||
"karma-webpack": "^5.0.0",
|
"karma-webpack": "^5.0.0",
|
||||||
|
"lodash": "^4.17.4",
|
||||||
"node-polyfill-webpack-plugin": "^2.0.1",
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"typedoc": "0.25.0"
|
"typedoc": "0.25.0"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
"build:lib": "tsc --build tsconfig.build.json",
|
"build:lib": "tsc --build tsconfig.build.json",
|
||||||
"build:web": "webpack",
|
"build:web": "webpack",
|
||||||
"build:browserTests": "webpack --config ./test/webpack.config.js",
|
"build:browserTests": "webpack --config ./test/webpack.config.js",
|
||||||
"analyze": "run-s build:web --analyze",
|
"analyze": "webpack --analyze",
|
||||||
"watch": "run-s build:lib --watch",
|
"watch": "run-s build:lib --watch",
|
||||||
"clean": "rm -rf dist build coverage",
|
"clean": "rm -rf dist build coverage",
|
||||||
"docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xrpl.org >> ../../docs/CNAME",
|
"docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xrpl.org >> ../../docs/CNAME",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { fromSeed } from 'bip32'
|
import { fromSeed } from 'bip32'
|
||||||
import { mnemonicToSeedSync, validateMnemonic } from 'bip39'
|
import { mnemonicToSeedSync, validateMnemonic } from 'bip39'
|
||||||
import omitBy from 'lodash/omitBy'
|
|
||||||
import {
|
import {
|
||||||
classicAddressToXAddress,
|
classicAddressToXAddress,
|
||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
@@ -26,6 +25,7 @@ import ECDSA from '../ECDSA'
|
|||||||
import { ValidationError } from '../errors'
|
import { ValidationError } from '../errors'
|
||||||
import { Transaction, validate } from '../models/transactions'
|
import { Transaction, validate } from '../models/transactions'
|
||||||
import { ensureClassicAddress } from '../sugar/utils'
|
import { ensureClassicAddress } from '../sugar/utils'
|
||||||
|
import { omitBy } from '../utils/collections'
|
||||||
import { hashSignedTx } from '../utils/hashes/hashLedger'
|
import { hashSignedTx } from '../utils/hashes/hashLedger'
|
||||||
|
|
||||||
import { rfc1751MnemonicToKey } from './rfc1751'
|
import { rfc1751MnemonicToKey } from './rfc1751'
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { BigNumber } from 'bignumber.js'
|
import { BigNumber } from 'bignumber.js'
|
||||||
import { flatMap } from 'lodash'
|
|
||||||
import { decodeAccountID } from 'ripple-address-codec'
|
import { decodeAccountID } from 'ripple-address-codec'
|
||||||
import {
|
import {
|
||||||
decode,
|
decode,
|
||||||
@@ -128,10 +127,9 @@ function getTransactionWithAllSigners(
|
|||||||
transactions: Transaction[],
|
transactions: Transaction[],
|
||||||
): Transaction {
|
): Transaction {
|
||||||
// Signers must be sorted in the combined transaction - See compareSigners' documentation for more details
|
// Signers must be sorted in the combined transaction - See compareSigners' documentation for more details
|
||||||
const sortedSigners: Signer[] = flatMap(
|
const sortedSigners: Signer[] = transactions
|
||||||
transactions,
|
.flatMap((tx) => tx.Signers ?? [])
|
||||||
(tx) => tx.Signers ?? [],
|
.sort(compareSigners)
|
||||||
).sort(compareSigners)
|
|
||||||
|
|
||||||
return { ...transactions[0], Signers: sortedSigners }
|
return { ...transactions[0], Signers: sortedSigners }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
import { Agent } from 'http'
|
import { Agent } from 'http'
|
||||||
|
|
||||||
import omitBy from 'lodash/omitBy'
|
|
||||||
import WebSocket from 'ws'
|
import WebSocket from 'ws'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -12,6 +11,7 @@ import {
|
|||||||
XrplError,
|
XrplError,
|
||||||
} from '../errors'
|
} from '../errors'
|
||||||
import { BaseRequest } from '../models/methods/baseMethod'
|
import { BaseRequest } from '../models/methods/baseMethod'
|
||||||
|
import { omitBy } from '../utils/collections'
|
||||||
|
|
||||||
import ConnectionManager from './ConnectionManager'
|
import ConnectionManager from './ConnectionManager'
|
||||||
import ExponentialBackoff from './ExponentialBackoff'
|
import ExponentialBackoff from './ExponentialBackoff'
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import flatMap from 'lodash/flatMap'
|
|
||||||
|
|
||||||
import type { Balance, Client } from '..'
|
import type { Balance, Client } from '..'
|
||||||
import {
|
import {
|
||||||
AccountLinesRequest,
|
AccountLinesRequest,
|
||||||
@@ -108,7 +106,7 @@ async function getBalances(
|
|||||||
// combine results
|
// combine results
|
||||||
await Promise.all([xrpPromise, linesPromise]).then(
|
await Promise.all([xrpPromise, linesPromise]).then(
|
||||||
([xrpBalance, linesResponses]) => {
|
([xrpBalance, linesResponses]) => {
|
||||||
const accountLinesBalance = flatMap(linesResponses, (response) =>
|
const accountLinesBalance = linesResponses.flatMap((response) =>
|
||||||
formatBalances(response.result.lines),
|
formatBalances(response.result.lines),
|
||||||
)
|
)
|
||||||
if (xrpBalance !== '') {
|
if (xrpBalance !== '') {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable max-lines-per-function -- Needs to process orderbooks. */
|
/* eslint-disable max-lines-per-function -- Needs to process orderbooks. */
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import flatMap from 'lodash/flatMap'
|
|
||||||
|
|
||||||
import type { Client } from '../client'
|
import type { Client } from '../client'
|
||||||
import { ValidationError } from '../errors'
|
import { ValidationError } from '../errors'
|
||||||
@@ -10,6 +9,7 @@ import {
|
|||||||
BookOffer,
|
BookOffer,
|
||||||
BookOfferCurrency,
|
BookOfferCurrency,
|
||||||
BookOffersRequest,
|
BookOffersRequest,
|
||||||
|
BookOffersResponse,
|
||||||
} from '../models/methods/bookOffers'
|
} from '../models/methods/bookOffers'
|
||||||
|
|
||||||
const DEFAULT_LIMIT = 20
|
const DEFAULT_LIMIT = 20
|
||||||
@@ -112,17 +112,18 @@ async function getOrderbook(
|
|||||||
taker: options.taker ? options.taker : undefined,
|
taker: options.taker ? options.taker : undefined,
|
||||||
}
|
}
|
||||||
// 2. Make Request
|
// 2. Make Request
|
||||||
const directOfferResults = await this.requestAll(request)
|
const directOfferResults: BookOffersResponse[] = await this.requestAll(
|
||||||
|
request,
|
||||||
|
)
|
||||||
request.taker_gets = currency1
|
request.taker_gets = currency1
|
||||||
request.taker_pays = currency2
|
request.taker_pays = currency2
|
||||||
const reverseOfferResults = await this.requestAll(request)
|
const reverseOfferResults = await this.requestAll(request)
|
||||||
// 3. Return Formatted Response
|
// 3. Return Formatted Response
|
||||||
const directOffers = flatMap(
|
|
||||||
directOfferResults,
|
const directOffers = directOfferResults.flatMap(
|
||||||
(directOfferResult) => directOfferResult.result.offers,
|
(directOfferResult: BookOffersResponse) => directOfferResult.result.offers,
|
||||||
)
|
)
|
||||||
const reverseOffers = flatMap(
|
const reverseOffers = reverseOfferResults.flatMap(
|
||||||
reverseOfferResults,
|
|
||||||
(reverseOfferResult) => reverseOfferResult.result.offers,
|
(reverseOfferResult) => reverseOfferResult.result.offers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
52
packages/xrpl/src/utils/collections.ts
Normal file
52
packages/xrpl/src/utils/collections.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
type ValueOf<T> = T[keyof T]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an object composed of keys generated from the results of running each element of collection thru iteratee.
|
||||||
|
* The order of grouped values is determined by the order they occur in collection.
|
||||||
|
* The corresponding value of each key is an array of elements responsible for generating the key.
|
||||||
|
*
|
||||||
|
* Similar to lodash's groupBy
|
||||||
|
*
|
||||||
|
* @param array - array to iterate over
|
||||||
|
* @param iteratee - function that returns key of the group to place the item
|
||||||
|
*
|
||||||
|
* @returns a map of arrays
|
||||||
|
*/
|
||||||
|
export function groupBy<T>(
|
||||||
|
array: T[],
|
||||||
|
iteratee: (value: T, index: number, array: T[]) => string,
|
||||||
|
): { [p: string]: T[] } {
|
||||||
|
// eslint-disable-next-line max-params -- need all the params for the fallback
|
||||||
|
return array.reduce<{ [key: string]: T[] }>(function predicate(
|
||||||
|
acc,
|
||||||
|
value,
|
||||||
|
index,
|
||||||
|
arrayReference,
|
||||||
|
) {
|
||||||
|
;(acc[iteratee(value, index, arrayReference)] ||= []).push(value)
|
||||||
|
return acc
|
||||||
|
},
|
||||||
|
{})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an object composed of the own and inherited enumerable string keyed properties of object that
|
||||||
|
* predicate doesn't return truthy for.
|
||||||
|
*
|
||||||
|
* @param obj - Object to have properties removed.
|
||||||
|
* @param predicate - function that returns whether the property should be removed from the obj.
|
||||||
|
*
|
||||||
|
* @returns object
|
||||||
|
*/
|
||||||
|
export function omitBy<T extends object>(
|
||||||
|
obj: T,
|
||||||
|
predicate: (objElement: ValueOf<T>, k: string | number | symbol) => boolean,
|
||||||
|
): Partial<T> {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We know the keys are properties of T
|
||||||
|
const keys: Array<keyof T> = Object.keys(obj) as Array<keyof T>
|
||||||
|
const keysToKeep = keys.filter((kb) => !predicate(obj[kb], kb))
|
||||||
|
return keysToKeep.reduce((acc: Partial<T>, key: keyof T) => {
|
||||||
|
acc[key] = obj[key]
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import flatten from 'lodash/flatten'
|
|
||||||
import groupBy from 'lodash/groupBy'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Amount,
|
Amount,
|
||||||
@@ -10,6 +8,7 @@ import {
|
|||||||
Node,
|
Node,
|
||||||
} from '../models'
|
} from '../models'
|
||||||
|
|
||||||
|
import { groupBy } from './collections'
|
||||||
import { dropsToXrp } from './xrpConversion'
|
import { dropsToXrp } from './xrpConversion'
|
||||||
|
|
||||||
interface BalanceChange {
|
interface BalanceChange {
|
||||||
@@ -182,5 +181,5 @@ export default function getBalanceChanges(
|
|||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
})
|
})
|
||||||
return groupByAccount(flatten(quantities))
|
return groupByAccount(quantities.flat())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import flatMap from 'lodash/flatMap'
|
|
||||||
import { decode } from 'ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { NFToken } from '../models/ledger/NFTokenPage'
|
import { NFToken } from '../models/ledger/NFTokenPage'
|
||||||
@@ -33,6 +32,7 @@ function ensureDecodedMeta(
|
|||||||
* @returns The NFTokenID for the minted NFT.
|
* @returns The NFTokenID for the minted NFT.
|
||||||
* @throws if meta is not TransactionMetadata.
|
* @throws if meta is not TransactionMetadata.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line max-lines-per-function -- This function has a lot of documentation
|
||||||
export default function getNFTokenID(
|
export default function getNFTokenID(
|
||||||
meta: TransactionMetadata | string | undefined,
|
meta: TransactionMetadata | string | undefined,
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
@@ -57,7 +57,6 @@ export default function getNFTokenID(
|
|||||||
* not changed. Thus why we add the additional condition to check
|
* not changed. Thus why we add the additional condition to check
|
||||||
* if the PreviousFields contains NFTokens
|
* if the PreviousFields contains NFTokens
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const affectedNodes = decodedMeta.AffectedNodes.filter((node) => {
|
const affectedNodes = decodedMeta.AffectedNodes.filter((node) => {
|
||||||
if (isCreatedNode(node)) {
|
if (isCreatedNode(node)) {
|
||||||
return node.CreatedNode.LedgerEntryType === 'NFTokenPage'
|
return node.CreatedNode.LedgerEntryType === 'NFTokenPage'
|
||||||
@@ -72,25 +71,28 @@ export default function getNFTokenID(
|
|||||||
})
|
})
|
||||||
/* eslint-disable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
/* eslint-disable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
||||||
const previousTokenIDSet = new Set(
|
const previousTokenIDSet = new Set(
|
||||||
flatMap(affectedNodes, (node) => {
|
affectedNodes
|
||||||
|
.flatMap((node) => {
|
||||||
const nftokens = isModifiedNode(node)
|
const nftokens = isModifiedNode(node)
|
||||||
? (node.ModifiedNode.PreviousFields?.NFTokens as NFToken[])
|
? (node.ModifiedNode.PreviousFields?.NFTokens as NFToken[])
|
||||||
: []
|
: []
|
||||||
return nftokens.map((token) => token.NFToken.NFTokenID)
|
return nftokens.map((token) => token.NFToken.NFTokenID)
|
||||||
}).filter((id) => Boolean(id)),
|
})
|
||||||
|
.filter((id) => Boolean(id)),
|
||||||
)
|
)
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition -- Cleaner to read */
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition -- Cleaner to read */
|
||||||
const finalTokenIDs = flatMap(affectedNodes, (node) =>
|
const finalTokenIDs = affectedNodes
|
||||||
|
.flatMap((node) =>
|
||||||
(
|
(
|
||||||
(((node as ModifiedNode).ModifiedNode?.FinalFields?.NFTokens ??
|
(((node as ModifiedNode).ModifiedNode?.FinalFields?.NFTokens ??
|
||||||
(node as CreatedNode).CreatedNode?.NewFields?.NFTokens) as NFToken[]) ??
|
(node as CreatedNode).CreatedNode?.NewFields
|
||||||
[]
|
?.NFTokens) as NFToken[]) ?? []
|
||||||
).map((token) => token.NFToken.NFTokenID),
|
).map((token) => token.NFToken.NFTokenID),
|
||||||
).filter((nftokenID) => Boolean(nftokenID))
|
)
|
||||||
|
.filter((nftokenID) => Boolean(nftokenID))
|
||||||
/* eslint-enable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
/* eslint-enable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
||||||
/* eslint-enable @typescript-eslint/no-unnecessary-condition -- Cleaner to read */
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition -- Cleaner to read */
|
||||||
|
|
||||||
const nftokenID = finalTokenIDs.find((id) => !previousTokenIDSet.has(id))
|
const nftokenID = finalTokenIDs.find((id) => !previousTokenIDSet.has(id))
|
||||||
|
|
||||||
return nftokenID
|
return nftokenID
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
|
"lib": ["es2019", "dom"],
|
||||||
"outDir": "./dist/npm",
|
"outDir": "./dist/npm",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
|
"lib": ["es2019", "dom"],
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user