From bc410a2409a8ab5395b732c1b33116ff37864eec Mon Sep 17 00:00:00 2001 From: Paul Puey Date: Tue, 8 Aug 2023 10:44:58 -0700 Subject: [PATCH 1/2] Upgrade edge-core-js 1.4.0 --- package.json | 2 +- test/createUserDump.ts | 31 ++-- test/fakeCurrencyPlugin.ts | 4 +- yarn.lock | 299 +++++-------------------------------- 4 files changed, 55 insertions(+), 281 deletions(-) diff --git a/package.json b/package.json index d526f697..8e799284 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "buffer": "^6.0.3", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "edge-core-js": "^0.19.43", + "edge-core-js": "^1.4.0", "eslint": "^7.14.0", "eslint-config-standard-kit": "0.15.1", "eslint-plugin-flowtype": "^5.2.0", diff --git a/test/createUserDump.ts b/test/createUserDump.ts index aee1c728..b4791a14 100644 --- a/test/createUserDump.ts +++ b/test/createUserDump.ts @@ -44,7 +44,11 @@ async function main(): Promise { thorchainda: true } }) - const account = await context.createAccount('bob', 'bob123', '1111') + const account = await context.createAccount({ + username: 'bob', + password: 'bob123', + pin: '1111' + }) await account.createCurrencyWallet('wallet:bitcoin', { fiatCurrencyCode: 'iso:EUR', name: 'My Fake Bitcoin' @@ -65,24 +69,23 @@ async function main(): Promise { fiatCurrencyCode: 'iso:USD', name: 'My Fake Matic' }) - const ethEnabledTokens = ethWallet.currencyInfo.metaTokens.map( - token => token.currencyCode - ) - await ethWallet.enableTokens(ethEnabledTokens) + const ethGetBuiltinTokens = allPlugins.ethereum.getBuiltinTokens ?? (() => []) + const ethEnabledTokens = await ethGetBuiltinTokens() + await ethWallet.changeEnabledTokenIds(Object.keys(ethEnabledTokens)) - const avaxEnabledTokens = avaxWallet.currencyInfo.metaTokens.map( - token => token.currencyCode - ) - await avaxWallet.enableTokens(avaxEnabledTokens) + const avaxGetBuiltinTokens = + allPlugins.avalanche.getBuiltinTokens ?? (() => []) + const avaxEnabledTokens = await avaxGetBuiltinTokens() + await avaxWallet.changeEnabledTokenIds(Object.keys(avaxEnabledTokens)) - const maticEnabledTokens = maticWallet.currencyInfo.metaTokens.map( - token => token.currencyCode - ) - await maticWallet.enableTokens(maticEnabledTokens) + const maticGetBuiltinTokens = + allPlugins.polygon.getBuiltinTokens ?? (() => []) + const maticEnabledTokens = await maticGetBuiltinTokens() + await maticWallet.changeEnabledTokenIds(Object.keys(maticEnabledTokens)) const data = await world.dumpFakeUser(account) const dump = { - loginKey: account.loginKey, + loginKey: account.getLoginKey(), data } fs.writeFileSync(DUMP_USER_FILE, JSON.stringify(dump, null, 2), { diff --git a/test/fakeCurrencyPlugin.ts b/test/fakeCurrencyPlugin.ts index 4e432c78..e49a343b 100644 --- a/test/fakeCurrencyPlugin.ts +++ b/test/fakeCurrencyPlugin.ts @@ -8,7 +8,6 @@ import { asString } from 'cleaners' import { - EdgeCreatePrivateKeyOptions, EdgeCurrencyCodeOptions, EdgeCurrencyEngine, EdgeCurrencyEngineCallbacks, @@ -312,6 +311,7 @@ class FakeCurrencyEngine { blockHeight: 0, currencyCode, date: defaultTx.date, + isSend: true, nativeAmount: total, networkFee: tokenSpend ? '0' : this.defaultSettings.networkFee, parentNetworkFee: tokenSpend @@ -350,7 +350,7 @@ class FakeCurrencyTools { async createPrivateKey( walletType: string, - opts?: EdgeCreatePrivateKeyOptions + opts?: JsonObject ): Promise { if (walletType !== this.currencyInfo.walletType) { throw new Error('Unsupported key type') diff --git a/yarn.lock b/yarn.lock index bdf31bd5..a3d322cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1430,13 +1430,6 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== -"@types/pbkdf2@^3.0.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" - integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== - dependencies: - "@types/node" "*" - "@types/request@^2.48.7": version "2.48.8" resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.8.tgz#0b90fde3b655ab50976cb8c5ac00faca22f5a82c" @@ -1447,13 +1440,6 @@ "@types/tough-cookie" "*" form-data "^2.5.0" -"@types/secp256k1@^4.0.1": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.2.tgz#20c29a87149d980f64464e56539bf4810fdb5d1d" - integrity sha512-QMg+9v0bbNJ2peLuHRWxzmy0HRJIG6gFZNhaRSp7S3ggSbCCxiqQB2/ybvhXyhHOCequpNkrx7OavNhrWOsW0A== - dependencies: - "@types/node" "*" - "@types/tough-cookie@*": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" @@ -1962,13 +1948,18 @@ base-x@^1.0.4: resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" integrity sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w= -base-x@^3.0.2, base-x@^3.0.6: +base-x@^3.0.6: version "3.0.9" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== dependencies: safe-buffer "^5.0.1" +base-x@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a" + integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw== + base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -1996,12 +1987,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -blakejs@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" - integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= - -bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.7, bn.js@^4.11.9: +bn.js@^4.11.7, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -2050,18 +2036,6 @@ browser-stdout@1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserify-aes@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - browserslist@^4.14.5, browserslist@^4.16.3, browserslist@^4.20.2: version "4.21.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.3.tgz#5df277694eb3c48bc5c4b05af3e8b7e09c5a6d1a" @@ -2072,32 +2046,11 @@ browserslist@^4.14.5, browserslist@^4.16.3, browserslist@^4.20.2: node-releases "^2.0.6" update-browserslist-db "^1.0.5" -bs58@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" - integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= - dependencies: - base-x "^3.0.2" - -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" - integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== - dependencies: - bs58 "^4.0.0" - create-hash "^1.1.0" - safe-buffer "^5.1.2" - buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= - buffer@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" @@ -2244,24 +2197,21 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== -cleaners@^0.3.11, cleaners@^0.3.13, cleaners@^0.3.9: +cleaners@^0.3.13, cleaners@^0.3.9: version "0.3.13" resolved "https://registry.yarnpkg.com/cleaners/-/cleaners-0.3.13.tgz#de9954f8c4ef01fcb54e41a8510f48059815b3e8" integrity sha512-sCedc8LIXUhLmXT9rkkAToi9mjYhI7J/gKRWiF0Qw6eC0ymILHxq+vhuaKoKdcSWpYi2YqqwSlvNtD+92gf4pA== +cleaners@^0.3.14: + version "0.3.16" + resolved "https://registry.yarnpkg.com/cleaners/-/cleaners-0.3.16.tgz#d3a7ab936cb78b0d6ac19ba87b2d28ec41f30502" + integrity sha512-Ecu8Fwv3wT7GV44K4Zas2CQJI11ZV/yPwoh8Gg9BSV6rAmhNsqFeWceA1RII1czbarFSG3XClUePrpI806OvRw== + cli-boxes@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" @@ -2425,29 +2375,6 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.4, create-hmac@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - cross-fetch@^3.1.4: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" @@ -2651,21 +2578,19 @@ duplexer3@^0.1.4: resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= -edge-core-js@^0.19.43: - version "0.19.43" - resolved "https://registry.yarnpkg.com/edge-core-js/-/edge-core-js-0.19.43.tgz#fe6050292846637aa68ac367808f55bf40f81e68" - integrity sha512-3m/yg6nuJu1d7nJcD3mmGK+s4pjT0tla4fBJSgu6TsTuMUOKcO4SQL76m0SC6WEUnhioLxUzm5YY4Hiq5x1/1Q== +edge-core-js@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/edge-core-js/-/edge-core-js-1.4.0.tgz#6e11c27cd6917d109ebf3600a0bc10afddb45508" + integrity sha512-xemar4vYRSJPwTFuA+MPJZw+gSPBg8Larhcw2/PbUDhQMnwHct6UVoxhn1YsVZK3vj7HnBEDeZC98nttQNdQXw== dependencies: aes-js "^3.1.0" - base-x "^1.0.4" + base-x "^4.0.0" biggystring "^4.0.0" - cleaners "^0.3.11" + cleaners "^0.3.14" currency-codes "^1.1.2" disklet "^0.5.2" edge-sync-client "^0.2.7" elliptic "^6.4.0" - ethereumjs-tx "^1.3.7" - ethereumjs-util "^5.2.0" hash.js "^1.1.7" hmac-drbg "^1.0.1" node-fetch "^2.6.1" @@ -2674,8 +2599,8 @@ edge-core-js@^0.19.43: redux-pixies "^0.3.6" rfc4648 "^1.4.0" scrypt-js "^2.0.3" - serverlet "^0.1.0" - yaob "^0.3.9" + serverlet "^0.1.2" + yaob "^0.3.11" yavent "^0.1.3" edge-sync-client@^0.2.7: @@ -2695,7 +2620,7 @@ electron-to-chromium@^1.4.202: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.232.tgz#67a0a874b0057662244230d18d3a9847c135a9d9" integrity sha512-nd+FW8xHjM+PxNWG44nKnwHaBDdVpJUZuI2sS2JJPt/QpdombnmoCRWEEQNnzaktdIQhsNWdD+dlqxwO8Bn99g== -elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2: +elliptic@6.5.4, elliptic@^6.4.0: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -3048,53 +2973,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethereum-common@^0.0.18: - version "0.0.18" - resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" - integrity sha1-L9w1dvIykDNYl26znaeDIT/5Uj8= - -ethereum-cryptography@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" - integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== - dependencies: - "@types/pbkdf2" "^3.0.0" - "@types/secp256k1" "^4.0.1" - blakejs "^1.1.0" - browserify-aes "^1.2.0" - bs58check "^2.1.2" - create-hash "^1.2.0" - create-hmac "^1.1.7" - hash.js "^1.1.7" - keccak "^3.0.0" - pbkdf2 "^3.0.17" - randombytes "^2.1.0" - safe-buffer "^5.1.2" - scrypt-js "^3.0.0" - secp256k1 "^4.0.1" - setimmediate "^1.0.5" - -ethereumjs-tx@^1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" - integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== - dependencies: - ethereum-common "^0.0.18" - ethereumjs-util "^5.0.0" - -ethereumjs-util@^5.0.0, ethereumjs-util@^5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" - integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== - dependencies: - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "^0.1.3" - rlp "^2.0.0" - safe-buffer "^5.1.1" - ethers@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.0.tgz#0055da174b9e076b242b8282638bc94e04b39835" @@ -3131,27 +3009,11 @@ ethers@^5.7.0: "@ethersproject/web" "5.7.0" "@ethersproject/wordlists" "5.7.0" -ethjs-util@^0.1.3: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" - integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== - dependencies: - is-hex-prefixed "1.0.0" - strip-hex-prefix "1.0.0" - events@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - execa@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" @@ -3613,15 +3475,6 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== - dependencies: - inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -3746,7 +3599,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: +inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3862,11 +3715,6 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" -is-hex-prefixed@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" - integrity sha1-fY035q135dEnFIkTxXPggtd39VQ= - is-installed-globally@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" @@ -4187,14 +4035,6 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -keccak@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" - integrity sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA== - dependencies: - node-addon-api "^2.0.0" - node-gyp-build "^4.2.0" - keyv@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" @@ -4432,15 +4272,6 @@ make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: dependencies: semver "^6.0.0" -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - md5@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" @@ -4659,11 +4490,6 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-addon-api@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" - integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== - node-fetch@2.6.7, node-fetch@^2.6.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -4671,11 +4497,6 @@ node-fetch@2.6.7, node-fetch@^2.6.1: dependencies: whatwg-url "^5.0.0" -node-gyp-build@^4.2.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" - integrity sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg== - node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" @@ -5047,17 +4868,6 @@ pathval@^1.1.1: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== -pbkdf2@^3.0.17: - version "3.1.2" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" - integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -5237,7 +5047,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@^3.5.0, readable-stream@^3.6.0: +readable-stream@^3.5.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -5451,21 +5261,6 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -rlp@^2.0.0: - version "2.2.6" - resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.6.tgz#c80ba6266ac7a483ef1e69e8e2f056656de2fb2c" - integrity sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg== - dependencies: - bn.js "^4.11.1" - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -5480,7 +5275,7 @@ rxjs@^6.6.7: dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -5508,7 +5303,7 @@ schema-utils@^3.0.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -scrypt-js@3.0.1, scrypt-js@^3.0.0: +scrypt-js@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -5518,15 +5313,6 @@ scrypt-js@^2.0.3: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== -secp256k1@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.2.tgz#15dd57d0f0b9fdb54ac1fa1694f40e5e9a54f4a1" - integrity sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg== - dependencies: - elliptic "^6.5.2" - node-addon-api "^2.0.0" - node-gyp-build "^4.2.0" - semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" @@ -5573,24 +5359,16 @@ serverlet@^0.1.0: resolved "https://registry.yarnpkg.com/serverlet/-/serverlet-0.1.1.tgz#1f2f7347ad8411f785f2b7d1bbd7df9d3f1e5249" integrity sha512-/AjpvNVeMNUKLq0K4gV4lSxSuGntF/e9O9YemvKSDSZaxB/Mr60JPSK+Do5u9UO4rS3iW0Xd1l+Gz/gyLz3dBA== +serverlet@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/serverlet/-/serverlet-0.1.2.tgz#3a29cb22a1648b575ba357274cb7b5000fc9cd72" + integrity sha512-+NnrJFjtFJqzqVz5yZYJyddrKnhrmlrnGS0wTTfjMKzIp7QsFoYkGjB1STgrIjpE9v2cGTOkaOvRz6lJQx98kw== + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== -setimmediate@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= - -sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -5849,13 +5627,6 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-hex-prefix@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" - integrity sha1-DF8VX+8RUTczd96du1iNoFUA428= - dependencies: - is-hex-prefixed "1.0.0" - strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -6444,10 +6215,10 @@ yaml@^1.10.0: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaob@^0.3.9: - version "0.3.10" - resolved "https://registry.yarnpkg.com/yaob/-/yaob-0.3.10.tgz#fb86d54d564ff6014f6f52fafc4219b6c068f613" - integrity sha512-QU+03xtNssGOw01Tten5zlfNcrsMPQjy0Nr/gueVEbXYsXHgYeDKXNLgPNMdYdTY7qkvLj8IGLOk/MKtsUh+Fg== +yaob@^0.3.11: + version "0.3.11" + resolved "https://registry.yarnpkg.com/yaob/-/yaob-0.3.11.tgz#54dc4e03f5edabf7a0701c57e73e97cc69d2fc42" + integrity sha512-RRMKxWsjMGF9X7fyPny0w3icGriQCCT7FMtNrmxxyjxQIQn8GB4+CT4SWpgUca82RBvjRt5pRqKmbnvmMfKc9A== dependencies: rfc4648 "^1.1.0" From fdf49b5a1498347e75216fc4085e393aceb18ee8 Mon Sep 17 00:00:00 2001 From: Paul Puey Date: Fri, 4 Aug 2023 22:00:00 +0100 Subject: [PATCH 2/2] Add XRP DEX support Requires upgraded accountbased --- package.json | 3 +- src/index.ts | 2 + src/swap-helpers.ts | 47 ++++- src/swap/defi/xrp/xrpDexHelpers.ts | 328 +++++++++++++++++++++++++++++ src/swap/defi/xrp/xrpDexTypes.ts | 51 +++++ src/swap/defi/xrpDex.ts | 272 ++++++++++++++++++++++++ src/swap/swapuz.ts | 1 + yarn.lock | 273 ++++++++++++++++++++++-- 8 files changed, 951 insertions(+), 26 deletions(-) create mode 100644 src/swap/defi/xrp/xrpDexHelpers.ts create mode 100644 src/swap/defi/xrp/xrpDexTypes.ts create mode 100644 src/swap/defi/xrpDex.ts diff --git a/package.json b/package.json index 8e799284..d5ed8a72 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "ethers": "^5.7.0", "hashjs": "^1.2.0", "iso4217": "^0.2.0", - "utf8": "^3.0.0" + "utf8": "^3.0.0", + "xrpl": "^2.10.0" }, "devDependencies": { "@babel/core": "^7.0.0", diff --git a/src/index.ts b/src/index.ts index cc85c6ce..d6f4e8bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,7 @@ import { makeThorchainDaPlugin } from './swap/defi/thorchainDa' import { makeSpookySwapPlugin } from './swap/defi/uni-v2-based/plugins/spookySwap' import { makeTombSwapPlugin } from './swap/defi/uni-v2-based/plugins/tombSwap' import { makeVelodromePlugin } from './swap/defi/uni-v2-based/plugins/velodrome' +import { makeXrpDexPlugin } from './swap/defi/xrpDex' import { makeExolixPlugin } from './swap/exolix' import { makeGodexPlugin } from './swap/godex' import { makeLetsExchangePlugin } from './swap/letsexchange' @@ -52,6 +53,7 @@ const edgeCorePlugins = { thorchainda: makeThorchainDaPlugin, transfer: makeTransferPlugin, velodrome: makeVelodromePlugin, + xrpdex: makeXrpDexPlugin, letsexchange: makeLetsExchangePlugin } diff --git a/src/swap-helpers.ts b/src/swap-helpers.ts index b2d2772b..e8e480f4 100644 --- a/src/swap-helpers.ts +++ b/src/swap-helpers.ts @@ -8,10 +8,12 @@ import { EdgeSwapRequest, EdgeSwapResult, EdgeTransaction, + EdgeTxSwap, JsonObject, SwapCurrencyError } from 'edge-core-js/types' +import { MakeTxParams } from './swap/defi/xrp/xrpDexTypes' import { EdgeSwapRequestPlugin } from './swap/types' const likeKindAssets = [ @@ -32,10 +34,21 @@ export function ensureInFuture( return target < date.valueOf() ? date : new Date(target) } -export interface SwapOrder { +interface SwapOrderSpendInfo { + spendInfo: EdgeSpendInfo +} + +interface SwapOrderMakeTx { + makeTxParams: MakeTxParams +} + +type SwapOrderInner = SwapOrderMakeTx | SwapOrderSpendInfo + +export type SwapOrder = SwapOrderInner & { + canBePartial?: boolean + maxFulfillmentSeconds?: number request: EdgeSwapRequest swapInfo: EdgeSwapInfo - spendInfo: EdgeSpendInfo fromNativeAmount: string expirationDate?: Date preTx?: EdgeTransaction @@ -46,21 +59,32 @@ export async function makeSwapPluginQuote( order: SwapOrder ): Promise { const { + canBePartial, + maxFulfillmentSeconds, fromNativeAmount, request, swapInfo, - spendInfo, expirationDate, preTx, metadataNotes } = order - const { fromWallet } = request - const tx = await fromWallet.makeSpend(spendInfo) - const toNativeAmount = spendInfo.swapData?.payoutNativeAmount - const destinationAddress = spendInfo.swapData?.payoutAddress - const isEstimate = spendInfo.swapData?.isEstimate ?? false - const quoteId = spendInfo.swapData?.orderId + + let tx: EdgeTransaction + let swapData: EdgeTxSwap | undefined + if ('spendInfo' in order) { + const { spendInfo } = order + swapData = spendInfo.swapData + tx = await fromWallet.makeSpend(spendInfo) + } else { + const { makeTxParams } = order + swapData = makeTxParams.swapData + tx = await fromWallet.otherMethods.makeTx(makeTxParams) + } + const toNativeAmount = swapData?.payoutNativeAmount + const destinationAddress = swapData?.payoutAddress + const isEstimate = swapData?.isEstimate ?? false + const quoteId = swapData?.orderId if ( fromNativeAmount == null || toNativeAmount == null || @@ -81,6 +105,8 @@ export async function makeSwapPluginQuote( ) const out: EdgeSwapQuote = { + canBePartial, + maxFulfillmentSeconds, request, swapInfo, fromNativeAmount, @@ -138,6 +164,9 @@ export const getMaxSwappable = async ( requestCopy.nativeAmount = balance requestCopy.quoteFor = 'from' const swapOrder = await fetchSwap(requestCopy, ...args) + if (!('spendInfo' in swapOrder)) { + return request + } // Then use getMaxSpendable with the partner's address delete swapOrder.spendInfo.spendTargets[0].nativeAmount diff --git a/src/swap/defi/xrp/xrpDexHelpers.ts b/src/swap/defi/xrp/xrpDexHelpers.ts new file mode 100644 index 00000000..cf8db3ab --- /dev/null +++ b/src/swap/defi/xrp/xrpDexHelpers.ts @@ -0,0 +1,328 @@ +/** + * Routines copied from https://github.com/florent-uzio/xrpl.js-demo.git + */ + +import { + BookOfferCurrency, + BookOffersRequest, + dropsToXrp, + xrpToDrops +} from 'xrpl' +import { BookOffersResponse } from 'xrpl/dist/npm/models/methods/bookOffers' + +import { MethodOptions } from './xrpDexTypes' + +// https://xrpl.org/currency-formats.html#nonstandard-currency-codes +const NON_STANDARD_CODE_LENGTH = 40 +const ONE_MILLION = 1000000 + +const validHexRegex = /^[0-9A-Fa-f]+$/g + +interface ConvertAmountProps { + amount: string | number + decimals?: number + to: 'drops' | 'xrp' +} + +const convertAmount = ({ + amount, + to, + decimals = 4 +}: ConvertAmountProps): string => { + if (to === 'drops') { + try { + return xrpToDrops(amount) + } catch { + return (+amount * ONE_MILLION).toFixed(decimals).toString() + } + } else { + try { + return dropsToXrp(amount) + } catch { + return (+amount / ONE_MILLION).toFixed(decimals).toString() + } + } +} + +/** + * Convert an hexadecimal value to readable string. + * + * @param hex The hexadecimal to convert. + * @returns A human readable string. + */ +export const hexToString = (hex: string): string => { + let string = '' + if (hex.match(validHexRegex) == null) return '' + + for (let i = 0; i < hex.length; i += 2) { + const part = hex.substring(i, i + 2) + const code = parseInt(part, 16) + if (!isNaN(code) && code !== 0) { + string += String.fromCharCode(code) + } + } + return string +} + +/** + * Converts a human readable currency code to hexadecimal. + * If the currency has 3 characters (XRP, EUR, USD...) then return immediately this currency code. + * If the currency has more than 3 characters, then encode it to the XRP ledger format. + * Example: USDM will become 5553444D00000000000000000000000000000000 + * + * @param currencyCode The currency code to potentially encode to the XRP ledger format. + * @returns A {@link string} + */ +const convertCurrencyCodeToHex = (currencyCode: string): string => { + if (currencyCode.length > 3) { + return Buffer.from(currencyCode, 'ascii') + .toString('hex') + .toUpperCase() + .padEnd(NON_STANDARD_CODE_LENGTH, '0') + } + return currencyCode +} + +/** + * Helper to correctly display the currency code if its length is more than 3. + * Example: 5553444D00000000000000000000000000000000 will become USDM + * + * @param currencyCode The currency code to potentially format correctly. + * @returns A {@link String} representing the currency code readable by a human. + */ +export const convertHexCurrencyCodeToString = ( + currencyCode: string +): string => { + if (currencyCode.length === NON_STANDARD_CODE_LENGTH) { + return hexToString(currencyCode) + } + return currencyCode +} + +export const getBookOffers = async ( + // eslint-disable-next-line @typescript-eslint/naming-convention + { taker_gets, taker_pays, ...rest }: BookOffersRequest, + { client, showLogs }: MethodOptions +): Promise => { + // Convert currencies to hex if needed + taker_gets.currency = convertCurrencyCodeToHex(taker_gets.currency) + taker_pays.currency = convertCurrencyCodeToHex(taker_pays.currency) + + // Send the request + const response = await client.request({ + taker_gets, + taker_pays, + ...rest + }) + + if (showLogs === true) { + console.log(JSON.stringify(response, undefined, 2)) + } + return response +} + +export type GetBuyQuoteProps = Omit< + BookOffersRequest, + 'taker_gets' | 'taker_pays' | 'command' +> & { + /** + * The currency we want to buy. + * If the currency is an IOU, the issuer needs to be mentioned. + */ + weWant: BookOfferCurrency + /** + * The amount of token we want to buy. + */ + weWantAmountOfToken: number + /** + * The counter currency. + */ + counterCurrency: BookOfferCurrency +} + +/** + * Function to get a quote of a token to buy. + * This is an experimental function and must not be used in production without checking it does what you need. + * + * @param {Object} props The props to pass to the function. + * @param {TakerAmount} props.weWant The token we want to acquire. Specify the currency and optionaly the issuer (if the currency is not XRP). + * @param {number} props.weWantAmountOfToken The amount of token we want to acquire. + * @param {string} props.taker (Optional) The Address of an account to use as a perspective. The response includes this account's Offers even if they are unfunded. + * @param {TakerAmount} props.counterCurrency The counter currency. + * @returns void, display a message regarding the result of the quote. + */ +export const getBuyQuote = async ( + { weWant, weWantAmountOfToken, counterCurrency, ...rest }: GetBuyQuoteProps, + { client, showLogs }: MethodOptions +): Promise => { + const offers = await getBookOffers( + { + command: 'book_offers', + taker_gets: weWant, + taker_pays: counterCurrency, + ...rest + }, + { client, showLogs } + ) + + // Amount of remaining token we want to buy. + let remaining = weWantAmountOfToken + + // Total amount of the opposite token we will sell. + let total = 0 + + for (const offer of offers.result.offers) { + if (offer.quality == null) break + + // Get the price for this offer. + const offerPrice = +offer.quality + + // Get the amount of currency this offer is selling. + const available = + typeof offer.TakerGets === 'string' + ? +dropsToXrp(offer.TakerGets) + : +offer.TakerGets.value + + // If the available amount is more than what we want to exchange, add the corresponding total to our total. + if (available > remaining) { + const amountOfTokens = remaining * offerPrice + + total += amountOfTokens + break + } + // Otherwise, add the total amount for this offer to our total and decrease the remaining amount. + else { + const amountOfTokens = available * offerPrice + + total += amountOfTokens + + remaining -= available + } + } + + if (counterCurrency.currency.toUpperCase() === 'XRP') { + total = +convertAmount({ amount: total, to: 'xrp' }) + } + + if (weWant.currency.toUpperCase() === 'XRP') { + total = +convertAmount({ amount: total, to: 'drops' }) + } + + const currencyReadable = convertHexCurrencyCodeToString(weWant.currency) + const counterCurrencyReadable = convertHexCurrencyCodeToString( + counterCurrency.currency + ) + + if (showLogs === true) { + console.log( + `You need to sell at least ${total} ${counterCurrencyReadable} to buy ${weWantAmountOfToken} ${currencyReadable}` + ) + } + + return total +} + +type GetSellQuoteProps = Omit< + BookOffersRequest, + 'taker_gets' | 'taker_pays' | 'command' +> & { + /** + * The currency we want to sell. + * If the currency is an IOU, the issuer needs to be mentioned. + */ + weSell: BookOfferCurrency + /** + * The amount of currency we want to sell. + */ + weSellAmountOfTokens: number + /** + * The counter currency. + */ + counterCurrency: BookOfferCurrency +} + +/** + * Function to get a quote of a token to sell. + * The quote will give you the amount of the counter token that you can expect to get from that sell. + * This is an experimental function and must not be used in production without checking it does what you need. + * + * @param {Object} props The props to pass to the function. + * @param {TakerAmount} props.weSell The token we want to sell. Specify the currency and optionaly the issuer (if the currency is not XRP). + * @param {number} props.weSellAmountOfTokens The amount of token we want to sell. + * @param {string} props.taker (Optional) The Address of an account to use as a perspective. The response includes this account's Offers even if they are unfunded. + * @param {TakerAmount} props.counterCurrency The counter currency. + * @returns void, display a message regarding the result of the quote. + */ +export const getSellQuote = async ( + { weSell, weSellAmountOfTokens, counterCurrency, ...rest }: GetSellQuoteProps, + { client, showLogs }: MethodOptions +): Promise => { + const offers = await getBookOffers( + { + command: 'book_offers', + taker_gets: counterCurrency, + taker_pays: weSell, + ...rest + }, + { client, showLogs } + ) + + /** Amount of remaining token we want to sell. */ + let remaining = weSellAmountOfTokens + + // Total amount of the opposite token we will get. + let total = 0 + + // Loop through the offers + for (const offer of offers.result.offers) { + if (offer.quality == null) break + + // Get the price for this offer. + const offerPrice = +offer.quality + + /** The amount of currency this offer is buying. */ + const available = + typeof offer.TakerPays === 'string' + ? +convertAmount({ amount: offer.TakerPays, to: 'xrp' }) + : +offer.TakerPays.value + + // If the available amount is more than what we want to exchange, add the corresponding total to our total. + if (available > remaining) { + const amountOfTokens = remaining / offerPrice + total += amountOfTokens + + break + } + // Otherwise, add the total amount for this offer to our total and decrease the remaining amount. + else { + // amount of tokens to acquire + const amountOfTokens = available / offerPrice + + total += amountOfTokens + + remaining -= available + } + } + + // Convert the total from drops to XRP if the counter currency is XRP + if (counterCurrency.currency.toUpperCase() === 'XRP') { + total = +convertAmount({ amount: total, to: 'xrp' }) + } + + // Multiply the total by a million to get a correct value + if (weSell.currency.toUpperCase() === 'XRP') { + total = +convertAmount({ amount: total, to: 'drops' }) + } + + const currencyReadable = convertHexCurrencyCodeToString(weSell.currency) + const counterCurrencyReadable = convertHexCurrencyCodeToString( + counterCurrency.currency + ) + + if (showLogs === true) { + console.log( + `You will get ${total} ${counterCurrencyReadable} if you sell ${weSellAmountOfTokens} ${currencyReadable}` + ) + } + return total +} diff --git a/src/swap/defi/xrp/xrpDexTypes.ts b/src/swap/defi/xrp/xrpDexTypes.ts new file mode 100644 index 00000000..d3957333 --- /dev/null +++ b/src/swap/defi/xrp/xrpDexTypes.ts @@ -0,0 +1,51 @@ +import { EdgeMetadata, EdgeTxSwap } from 'edge-core-js' +import { Client, Wallet } from 'xrpl' + +/** + * Duplicated from edge-currency-accountbased until this + * is elevatd to a type in edge-core-js + */ +export interface MakeTxParams { + type: 'MakeTxDexSwap' + metadata?: EdgeMetadata + swapData?: EdgeTxSwap + fromTokenId?: string + fromNativeAmount: string + toTokenId?: string + toNativeAmount: string + + /** + * UNIX time (seconds) to expire the DEX swap if it hasn't executed + */ + expiration?: number +} + +/** + * Below types copied from https://github.com/florent-uzio/xrpl.js-demo.git + */ +export interface TxnOptions { + wallet: Wallet + client: Client + showLogs?: boolean +} + +export type MethodOptions = Pick + +export type LedgerIndex = number | ('validated' | 'closed' | 'current') + +export interface BaseRequest { + [x: string]: unknown + id?: number | string + command: string + api_version?: number +} + +export interface LookupByLedgerRequest { + ledger_hash?: string + ledger_index?: LedgerIndex +} + +export interface BookOfferCurrency { + currency: string + issuer?: string +} diff --git a/src/swap/defi/xrpDex.ts b/src/swap/defi/xrpDex.ts new file mode 100644 index 00000000..8eeab522 --- /dev/null +++ b/src/swap/defi/xrpDex.ts @@ -0,0 +1,272 @@ +import { round } from 'biggystring' +import { asArray, asNumber, asObject, asOptional, asString } from 'cleaners' +import { + EdgeCorePluginOptions, + EdgeSwapInfo, + EdgeSwapPlugin, + EdgeSwapQuote, + EdgeSwapRequest, + EdgeTxSwap, + SwapCurrencyError +} from 'edge-core-js/types' +import { Client } from 'xrpl' + +import { makeSwapPluginQuote, SwapOrder } from '../../swap-helpers' +import { + convertRequest, + fetchInfo, + getAddress, + promiseWithTimeout, + shuffleArray +} from '../../util/utils' +import { EdgeSwapRequestPlugin } from '../types' +import { getBuyQuote, getSellQuote } from './xrp/xrpDexHelpers' +import { MakeTxParams } from './xrp/xrpDexTypes' + +const pluginId = 'xrpdex' +const swapInfo: EdgeSwapInfo = { + pluginId, + isDex: true, + displayName: 'XRP DEX', + supportEmail: 'support@edge.app' +} + +export const asInitOptions = asObject({ + appId: asOptional(asString, 'edge') +}) + +const EXPIRATION_MS = 1000 * 60 +const DEX_MAX_FULLFILLMENT_TIME_S = 5 * 60 // 5 mins +const RIPPLE_SERVERS_DEFAULT = ['wss://s2.ripple.com'] +const EXCHANGE_INFO_UPDATE_FREQ_MS = 60000 +const VOLATILITY_SPREAD_DEFAULT = 0.0075 + +export const asExchangeInfo = asObject({ + swap: asObject({ + plugins: asObject({ + xrpdex: asObject({ + volatilitySpread: asNumber, + rippleServers: asOptional(asArray(asString)) + }) + }) + }) +}) + +type ExchangeInfo = ReturnType + +let exchangeInfo: ExchangeInfo | undefined +let exchangeInfoLastUpdate: number = 0 + +export function makeXrpDexPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin { + const { io, log } = opts + const { fetchCors = io.fetch } = io + const { appId } = asInitOptions(opts.initOptions) + + const fetchSwapQuoteInner = async ( + request: EdgeSwapRequestPlugin + ): Promise => { + const { + fromCurrencyCode, + fromTokenId, + toCurrencyCode, + toTokenId, + nativeAmount, + fromWallet, + toWallet, + quoteFor + } = request + + // Only support ripple wallets + if ( + fromWallet.currencyInfo.pluginId !== 'ripple' || + toWallet.currencyInfo.pluginId !== 'ripple' + ) { + throw new SwapCurrencyError(swapInfo, request) + } + + // Source and dest wallet must be the same + if (fromWallet.id !== toWallet.id) { + throw new Error('XRP DEX must use same wallet for source and destination') + } + + // Do not support transfer between same assets + if (request.fromTokenId === request.toTokenId) { + throw new SwapCurrencyError(swapInfo, request) + } + + const rippleServers: string[] = RIPPLE_SERVERS_DEFAULT + const volatilitySpread: number = VOLATILITY_SPREAD_DEFAULT + + const fromIssuer = + fromTokenId != null ? fromTokenId.split('-')[1] : undefined + const toIssuer = toTokenId != null ? toTokenId.split('-')[1] : undefined + const fromCurrency = + fromTokenId != null ? fromTokenId.split('-')[0] : fromCurrencyCode + const toCurrency = + toTokenId != null ? toTokenId.split('-')[0] : toCurrencyCode + + // Grab addresses: + const toAddress = await getAddress(toWallet) + + const now = Date.now() + if ( + now - exchangeInfoLastUpdate > EXCHANGE_INFO_UPDATE_FREQ_MS || + exchangeInfo == null + ) { + try { + const exchangeInfoResponse = await promiseWithTimeout( + fetchInfo(fetchCors, `v1/exchangeInfo/${appId}`) + ) + + if (exchangeInfoResponse.ok === true) { + exchangeInfo = asExchangeInfo(await exchangeInfoResponse.json()) + exchangeInfoLastUpdate = now + } else { + // Error is ok. We just use defaults + log('Error getting info server exchangeInfo. Using defaults...') + } + } catch (e: any) { + log( + 'Error getting info server exchangeInfo. Using defaults...', + e.message + ) + } + } + + // ---------------------------------------------------------------- + // Get a quote + // ---------------------------------------------------------------- + + const client = await getXrplConnectedClient(rippleServers) + + let quote: number + let fromNativeAmount: string + let toNativeAmount: string + const taker = await getAddress(fromWallet) + + if (quoteFor === 'from') { + fromNativeAmount = nativeAmount + const exchangeAmount = await fromWallet.nativeToDenomination( + nativeAmount, + fromCurrencyCode + ) + + quote = await getSellQuote( + { + weSell: { + currency: fromCurrency, + issuer: fromIssuer + }, + weSellAmountOfTokens: Number(exchangeAmount), + counterCurrency: { + currency: toCurrency, + issuer: toIssuer + }, + taker + }, + { client, showLogs: false } + ) + quote = quote * (1 - volatilitySpread) + toNativeAmount = await toWallet.denominationToNative( + String(quote), + toCurrencyCode + ) + toNativeAmount = round(toNativeAmount, 0) + } else { + toNativeAmount = nativeAmount + const exchangeAmount = await toWallet.nativeToDenomination( + nativeAmount, + toCurrencyCode + ) + + quote = await getBuyQuote( + { + weWant: { + currency: toCurrency, + issuer: toIssuer + }, + weWantAmountOfToken: Number(exchangeAmount), + counterCurrency: { + currency: fromCurrency, + issuer: fromIssuer + }, + taker + }, + { client, showLogs: false } + ) + quote = quote * (1 + volatilitySpread) + fromNativeAmount = await fromWallet.denominationToNative( + String(quote), + fromCurrencyCode + ) + fromNativeAmount = round(fromNativeAmount, 0) + } + + const timestampNow = Date.now() + const expiration = timestampNow / 1000 + DEX_MAX_FULLFILLMENT_TIME_S + + const swapData: EdgeTxSwap = { + isEstimate: false, + payoutAddress: toAddress, + payoutCurrencyCode: toCurrencyCode, + payoutNativeAmount: toNativeAmount, + payoutWalletId: toWallet.id, + plugin: { ...swapInfo } + } + + const makeTxParams: MakeTxParams = { + type: 'MakeTxDexSwap', + metadata: {}, + swapData, + fromTokenId, + fromNativeAmount, + toTokenId, + toNativeAmount, + expiration + } + + await client.disconnect() + + return { + canBePartial: true, + maxFulfillmentSeconds: DEX_MAX_FULLFILLMENT_TIME_S, + request, + makeTxParams, + swapInfo, + fromNativeAmount, + expirationDate: new Date(Date.now() + EXPIRATION_MS) + } + } + + const out: EdgeSwapPlugin = { + swapInfo, + + async fetchSwapQuote(req: EdgeSwapRequest): Promise { + const request = convertRequest(req) + + const swapOrder = await fetchSwapQuoteInner(request) + return await makeSwapPluginQuote(swapOrder) + } + } + return out +} + +const getXrplConnectedClient = async (servers: string[]): Promise => { + let client + let error + if (servers.length === 0) { + throw new Error('No ripple servers') + } + const shuffled = shuffleArray(servers) + for (const server of shuffled) { + client = new Client(server) + try { + await client.connect() + return client + } catch (e) { + error = e + // Harmless if one server fails + } + } + throw error +} diff --git a/src/swap/swapuz.ts b/src/swap/swapuz.ts index 9ff465df..6cd186a8 100644 --- a/src/swap/swapuz.ts +++ b/src/swap/swapuz.ts @@ -262,6 +262,7 @@ export function makeSwapuzPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin { while (--retries !== 0) { requestToHack.nativeAmount = fromQuoteNativeAmount const swapOrder = await fetchSwapQuoteInner(requestToHack) + if (!('spendInfo' in swapOrder)) break if (swapOrder.spendInfo.swapData?.payoutNativeAmount == null) break const toExchangeAmount = await toWallet.nativeToDenomination( diff --git a/yarn.lock b/yarn.lock index a3d322cc..e0fc043f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1287,6 +1287,11 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@noble/hashes@^1.2.0": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" + integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1425,6 +1430,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.57.tgz#786f74cef16acf2c5eb11795b6c3f7ae93596662" integrity sha512-diBb5AE2V8h9Fs9zEDtBwSeLvIACng/aAkdZ3ujMV+cGuIQ9Nc/V+wQqurk9HJp8ni5roBxQHW21z/ZYbGDivg== +"@types/node@10.12.18": + version "10.12.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" + integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== + "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" @@ -1710,6 +1720,13 @@ aes-js@^3.1.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" integrity sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ== +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1948,7 +1965,7 @@ base-x@^1.0.4: resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" integrity sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w= -base-x@^3.0.6: +base-x@^3.0.2, base-x@^3.0.6, base-x@^3.0.9: version "3.0.9" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== @@ -1970,6 +1987,11 @@ bech32@1.1.4: resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== +big-integer@^1.6.48: + version "1.6.51" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" + integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== + big.js@^5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" @@ -1982,17 +2004,49 @@ biggystring@^4.0.0, biggystring@^4.1.3: dependencies: bn.js "^4.11.7" +bignumber.js@^9.0.0: + version "9.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" + integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bn.js@^4.11.7, bn.js@^4.11.9: +bindings@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bip32@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" + integrity sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA== + dependencies: + "@types/node" "10.12.18" + bs58check "^2.1.1" + create-hash "^1.2.0" + create-hmac "^1.1.7" + tiny-secp256k1 "^1.1.3" + typeforce "^1.11.5" + wif "^2.0.6" + +bip39@^3.0.4: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.0.tgz#c55a418deaf48826a6ceb34ac55b3ee1577e18a3" + integrity sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A== + dependencies: + "@noble/hashes" "^1.2.0" + +bn.js@^4.11.7, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.2.1: +bn.js@^5.1.1, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -2026,7 +2080,7 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.1.0: +brorand@^1.0.5, brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= @@ -2046,12 +2100,28 @@ browserslist@^4.14.5, browserslist@^4.16.3, browserslist@^4.20.2: node-releases "^2.0.6" update-browserslist-db "^1.0.5" +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +bs58check@<3.0.0, bs58check@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer@^6.0.3: +buffer@6.0.3, buffer@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -2197,6 +2267,14 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== +cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -2375,6 +2453,29 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + cross-fetch@^3.1.4: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" @@ -2425,6 +2526,13 @@ dateformat@^4.5.1: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + debug@4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" @@ -2446,13 +2554,6 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -2463,6 +2564,11 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +decimal.js@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== + decompress-response@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" @@ -2620,7 +2726,7 @@ electron-to-chromium@^1.4.202: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.232.tgz#67a0a874b0057662244230d18d3a9847c135a9d9" integrity sha512-nd+FW8xHjM+PxNWG44nKnwHaBDdVpJUZuI2sS2JJPt/QpdombnmoCRWEEQNnzaktdIQhsNWdD+dlqxwO8Bn99g== -elliptic@6.5.4, elliptic@^6.4.0: +elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -3101,6 +3207,11 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -3475,6 +3586,15 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -3525,6 +3645,14 @@ http-cache-semantics@^4.0.0: resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -3599,7 +3727,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -4204,7 +4332,7 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= -lodash@^4.17.15, lodash@^4.17.21: +lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -4272,6 +4400,15 @@ make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: dependencies: semver "^6.0.0" +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + md5@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" @@ -4470,6 +4607,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nan@^2.13.2: + version "2.17.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" + integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== + nanoid@3.1.20: version "3.1.20" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" @@ -5056,6 +5198,15 @@ readable-stream@^3.5.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" @@ -5261,6 +5412,45 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +ripple-address-codec@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-4.3.0.tgz#45edeb0312b4fe4607b37b7c4cff467802ad571d" + integrity sha512-Tvd81i7hpDmNqHvkj6iYlj8Tv3I1Romw5gfjni9eacewJvGV2xe+p2y0FAw39z72qfciRMhQyHvpnviBcWVBNw== + dependencies: + base-x "^3.0.9" + create-hash "^1.1.2" + +ripple-binary-codec@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-1.8.0.tgz#ecff1d6f4250f0c48622c602267ef7c4393ae63e" + integrity sha512-rtnLT6x1wKCRVWc/SL7jKD6lM5Nzf51HyM8A3AluBGTR8ubzAoAL3wzexCILKXbPhiBorrHRjLgB8L6IB2jhjw== + dependencies: + assert "^2.0.0" + big-integer "^1.6.48" + buffer "6.0.3" + create-hash "^1.2.0" + decimal.js "^10.2.0" + ripple-address-codec "^4.3.0" + +ripple-keypairs@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/ripple-keypairs/-/ripple-keypairs-1.3.0.tgz#fb28f15d0c764e36af7b25c4c782c3997abf84ad" + integrity sha512-LzM3Up9Pwz3dYqnczzNptimN3AxtjeGbDGeiOzREzbkslKiZcJ615b/ghBN4H23SC6W1GAL95juEzzimDi4THw== + dependencies: + bn.js "^5.1.1" + brorand "^1.0.5" + elliptic "^6.5.4" + hash.js "^1.0.3" + ripple-address-codec "^4.3.0" + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -5275,7 +5465,7 @@ rxjs@^6.6.7: dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -5369,6 +5559,14 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -5757,6 +5955,17 @@ through@^2.3.8: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= +tiny-secp256k1@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz#7e224d2bee8ab8283f284e40e6b4acb74ffe047c" + integrity sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA== + dependencies: + bindings "^1.3.0" + bn.js "^4.11.8" + create-hmac "^1.1.7" + elliptic "^6.4.0" + nan "^2.13.2" + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -5847,6 +6056,11 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +typeforce@^1.11.5: + version "1.18.0" + resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" + integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== + typescript@^4.1.2: version "4.8.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" @@ -6132,6 +6346,13 @@ widest-line@^3.1.0: dependencies: string-width "^4.0.0" +wif@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/wif/-/wif-2.0.6.tgz#08d3f52056c66679299726fade0d432ae74b4704" + integrity sha512-HIanZn1zmduSF+BQhkE+YXIbEiH0xPr1012QbFEGB0xsKqJii0/SqJjyn8dFv6y36kOznMgMB+LGcbZTJ1xACQ== + dependencies: + bs58check "<3.0.0" + wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" @@ -6185,6 +6406,11 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@^8.2.2: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + xdg-basedir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13" @@ -6195,6 +6421,21 @@ xml@^1.0.0: resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw== +xrpl@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/xrpl/-/xrpl-2.10.0.tgz#1a8b84c32e12adeaabb31f8c8527df1566991624" + integrity sha512-E77rkZ2cnOfJpGp5Tx6+BYAL2rFrEMvEksJmnhtHW9zC9rV4VqkwehrvPgt7duUXO7Vk9SutJ/HYsnz+Pw7KCA== + dependencies: + bignumber.js "^9.0.0" + bip32 "^2.0.6" + bip39 "^3.0.4" + https-proxy-agent "^5.0.0" + lodash "^4.17.4" + ripple-address-codec "^4.3.0" + ripple-binary-codec "^1.8.0" + ripple-keypairs "^1.3.0" + ws "^8.2.2" + y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"