diff options
| author | Adam Soltys <[email protected]> | 2021-09-23 23:35:32 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-09-23 23:35:32 -0700 |
| commit | d87b3d5bce1add35eaf513b160ffc20f440168af (patch) | |
| tree | edd17c0b660e5e0ad216fe9378d6fc075fb111ed | |
| parent | 6fe6c1b9d715e7501ada4505af46062714a3d055 (diff) | |
| download | coinos-server-d87b3d5bce1add35eaf513b160ffc20f440168af.tar.gz coinos-server-d87b3d5bce1add35eaf513b160ffc20f440168af.zip | |
use liquidjs-lib with dynafed block parsing
| -rw-r--r-- | lib/buildliquidtx.js | 2 | ||||
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | routes/liquid/receive.js | 4 | ||||
| -rw-r--r-- | routes/liquid/send.js | 2 | ||||
| -rw-r--r-- | routes/liquid/taxi.js | 2 | ||||
| -rw-r--r-- | routes/users.js | 2 | ||||
| -rw-r--r-- | yarn.lock | 183 |
7 files changed, 149 insertions, 48 deletions
diff --git a/lib/buildliquidtx.js b/lib/buildliquidtx.js index aab8e000..fd6be94d 100644 --- a/lib/buildliquidtx.js +++ b/lib/buildliquidtx.js @@ -1,5 +1,5 @@ const axios = require("axios"); -const liquid = require("@asoltys/liquidjs-lib"); +const liquid = require("liquidjs-lib"); const coinselect = require("coinselect"); const split = require("coinselect/split"); const api = prod diff --git a/package.json b/package.json index eed789a4..3757a653 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ }, "dependencies": { "@asoltys/bitcoin-core": "^3.0.7", - "@asoltys/liquidjs-lib": "^5.1.38", "async-mutex": "^0.2.4", "axios": "^0.21.1", "bcrypt": "^5.0.0", @@ -35,6 +34,7 @@ "jsonwebtoken": "^8.5.1", "knex": "^0.95.6", "lightning": "^3.5.0", + "liquidjs-lib": "https://github.com/asoltys/liquidjs-lib#4a0bb0c4b38d327ec247d49e89219798fb0b28e2", "lnurl": "^0.16.1", "long": "^4.0.0", "mailgun-js": "^0.22.0", diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index bc4293d3..5d41c269 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -4,7 +4,7 @@ const zmq = require("zeromq/v5-compat"); const { Op } = require("sequelize"); const { fromBase58 } = require("bip32"); const bitcoin = require("bitcoinjs-lib"); -const { Block, networks } = require("@asoltys/liquidjs-lib"); +const { Block, networks } = require("liquidjs-lib"); const network = networks[ @@ -197,7 +197,7 @@ zmqRawBlock.on("message", async (topic, message, sequence) => { let hash, json; - hash = await lq.getBlockHash(block.height); + hash = await lq.getBlockHash(block.blockHeight); json = await lq.getBlock(hash, 2); json.tx.map(async (tx) => { diff --git a/routes/liquid/send.js b/routes/liquid/send.js index f5c46a6f..59334103 100644 --- a/routes/liquid/send.js +++ b/routes/liquid/send.js @@ -1,6 +1,6 @@ const btc = config.liquid.btcasset; const lcad = config.liquid.cadasset; -const { Transaction } = require("@asoltys/liquidjs-lib"); +const { Transaction } = require("liquidjs-lib"); sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { try { diff --git a/routes/liquid/taxi.js b/routes/liquid/taxi.js index 4e4af372..c18ea72f 100644 --- a/routes/liquid/taxi.js +++ b/routes/liquid/taxi.js @@ -4,7 +4,7 @@ const { Psbt, payments, networks -} = require("@asoltys/liquidjs-lib"); +} = require("liquidjs-lib"); const wretch = require("wretch"); const fetch = require("node-fetch"); wretch().polyfills({ fetch }); diff --git a/routes/users.js b/routes/users.js index 23f016c7..5131e98a 100644 --- a/routes/users.js +++ b/routes/users.js @@ -5,7 +5,7 @@ const authenticator = require("otplib").authenticator; const getAccount = require("../lib/account"); const Sequelize = require("sequelize"); const bitcoin = require("bitcoinjs-lib"); -const liquid = require("@asoltys/liquidjs-lib"); +const liquid = require("liquidjs-lib"); const { fromBase58, fromPrivateKey } = require("bip32"); const { Mutex } = require("async-mutex"); const bip32 = require("bip32"); @@ -13,30 +13,6 @@ semver "^5.1.0" standard-error "^1.1.0" -"@asoltys/liquidjs-lib@^5.1.38": - version "5.1.38" - resolved "https://registry.yarnpkg.com/@asoltys/liquidjs-lib/-/liquidjs-lib-5.1.38.tgz#397e91a4ada53e5973b50727e13f529adacf42f4" - integrity sha512-hEP5GdUy5V0NYz7wnc+GLDGNQcpIx/KIfFFK96FiScG990UdRUvgJx/33o+MEmUyyh5zzcr2V7CWNtF8moSxnw== - dependencies: - "@asoltys/secp256k1-zkp" "^2.0.4" - axios "^0.21.1" - bech32 "^1.1.2" - bip174 vulpemventures/bip174.git - bip32 "^2.0.4" - bip66 "^1.1.0" - bitcoin-ops "^1.4.0" - bs58check "^2.0.0" - buffer-es6 "^4.9.3" - create-hash "^1.1.0" - create-hmac "^1.1.3" - merkle-lib "^2.0.10" - pushdata-bitcoin "^1.0.1" - randombytes "^2.0.1" - tiny-secp256k1 "^1.1.1" - typeforce "^1.11.3" - varuint-bitcoin "^1.0.4" - wif "^2.0.1" - "@asoltys/request@^2.88.2": version "2.88.2" resolved "https://registry.yarnpkg.com/@asoltys/request/-/request-2.88.2.tgz#105184146ff8a2b18f9ac93835b5a16461c1e14d" @@ -62,14 +38,6 @@ tunnel-agent "^0.6.0" uuid "^3.3.2" -"@asoltys/secp256k1-zkp@^2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@asoltys/secp256k1-zkp/-/secp256k1-zkp-2.0.4.tgz#a0b5fcabd92a089fdbb0e47750d3f43d66b24d94" - integrity sha512-oe4ZhZQNdtF49/bX/yJaB2kGu2hf7QXzaCFxlHA8lcU4uejH9NIQvy9lqHyLyRDT+xy4VVG2g/BGJPFgc8MywA== - dependencies: - "@types/node" "^13.9.2" - long "^4.0.0" - "@cto.af/textdecoder@^0.0.0": version "0.0.0" resolved "https://registry.yarnpkg.com/@cto.af/textdecoder/-/textdecoder-0.0.0.tgz#e1e8d84c936c30a0f4619971f19ca41941af9fdc" @@ -93,6 +61,17 @@ protobufjs "^6.10.0" yargs "^16.1.1" +"@jest/types@^27.1.1": + version "27.1.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.1.1.tgz#77a3fc014f906c65752d12123a0134359707c0ad" + integrity sha512-yqJPDDseb0mXgKqmNqypCsb85C22K1aY5+LUxh7syIM9n/b0AsaltxNy+o6tt29VcfGDpYEve175bm3uOhcehA== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^16.0.0" + chalk "^4.0.0" + "@mapbox/node-pre-gyp@^1.0.0": version "1.0.5" resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz#2a0b32fcb416fb3f2250fd24cb2a81421a4f5950" @@ -350,6 +329,33 @@ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.7.tgz#c8fa532b60a0042219cdf173ca21a975ef0666ad" integrity sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" + integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.0.2.tgz#ac383c4d4aaddd29bbf2b916d8d105c304a5fcd7" + integrity sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA== + dependencies: + jest-diff "^27.0.0" + pretty-format "^27.0.0" + "@types/long@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" @@ -435,6 +441,26 @@ dependencies: "@types/node" "*" +"@types/yargs-parser@*": + version "20.2.1" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" + integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== + +"@types/yargs@^16.0.0": + version "16.0.4" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977" + integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== + dependencies: + "@types/yargs-parser" "*" + +"@vulpemventures/secp256k1-zkp@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@vulpemventures/secp256k1-zkp/-/secp256k1-zkp-2.0.0.tgz#d1bb464f50fa3693e95126c0409d773f6d0b7497" + integrity sha512-LhWeEp9pDWYpuE5Lvvb8QRuxG/9cd+NTxNaAzrg+JT0sO11D7hyxyvSgnHkuTVT7FDdmmQQGZ6lkutfynE45rQ== + dependencies: + "@types/node" "^13.9.2" + long "^4.0.0" + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -537,6 +563,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + any-promise@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -751,15 +782,16 @@ bindings@^1.3.0, bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" +bip174-liquid@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/bip174-liquid/-/bip174-liquid-1.0.3.tgz#5009444091da80277c45ee90c255d7919646f907" + integrity sha512-e69sC0Cq2tBJuhG2+wieXv40DN13YBR/wbIjZp4Mqwpar5vQm8Ldqijdd6N33XG7LtfvQi/zKm5fSzdPY/9mgw== + bip174@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bip174/-/bip174-2.0.1.tgz#39cf8ca99e50ce538fb762589832f4481d07c254" integrity sha512-i3X26uKJOkDTAalYAp0Er+qGMDhrbbh2o93/xiPyAN2s25KrClSpe3VXo/7mNJoqA5qfko8rLS2l3RWZgYmjKQ== -bip174@vulpemventures/bip174.git: - version "1.0.3" - resolved "https://codeload.github.com/vulpemventures/bip174/tar.gz/b6d0ffe54e0dfa72e971b68372f89b25f7602502" - bip32@^2.0.4, bip32@^2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" @@ -837,6 +869,13 @@ bitcoinjs-lib@^3.3.1: varuint-bitcoin "^1.0.4" wif "^2.0.1" +blech32@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/blech32/-/blech32-1.0.1.tgz#400b9a8953ff80164553a8cf58fece208762e16b" + integrity sha512-1/vr1wwB8jvfVCkLQMVXLaIyx7Lgxh/6IqVuQlSsCNzWNzU+64oXzOQ/9BRnN4GANjx9i0O3OSQonDlL4FraSA== + dependencies: + long "^4.0.0" + version "0.1.81" resolved "https://registry.yarnpkg.com/blessed/-/blessed-0.1.81.tgz#f962d687ec2c369570ae71af843256e6d0ca1129" @@ -997,11 +1036,6 @@ [email protected]: resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= -buffer-es6@^4.9.3: - version "4.9.3" - resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" - integrity sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ= - buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -1088,6 +1122,14 @@ [email protected], chalk@^3.0.0, chalk@~3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + charm@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/charm/-/charm-0.1.2.tgz#06c21eed1a1b06aeb67553cdc53e23274bac2296" @@ -1542,6 +1584,11 @@ [email protected]: readable-stream "1.1.x" streamsearch "0.1.2" +diff-sequences@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.0.6.tgz#3305cb2e55a033924054695cc66019fd7f8e5723" + integrity sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ== + dot-prop@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" @@ -2556,6 +2603,21 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= +jest-diff@^27.0.0: + version "27.2.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.2.0.tgz#bda761c360f751bab1e7a2fe2fc2b0a35ce8518c" + integrity sha512-QSO9WC6btFYWtRJ3Hac0sRrkspf7B01mGrrQEiCW6TobtViJ9RWL0EmOs/WnBsZDsI/Y2IoSHZA2x6offu0sYw== + dependencies: + chalk "^4.0.0" + diff-sequences "^27.0.6" + jest-get-type "^27.0.6" + pretty-format "^27.2.0" + +jest-get-type@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.0.6.tgz#0eb5c7f755854279ce9b68a9f1a4122f69047cfe" + integrity sha512-XTkK5exIeUbbveehcSR8w0bhH+c0yloW/Wpl+9vZrjzztCPWrxhHwkIFpZzCt71oRBsgxmuUfxEqOYoZI2macg== + joycon@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf" @@ -2744,6 +2806,30 @@ lightning@^3.5.0: invoices "2.0.0" psbt "1.1.10" +"liquidjs-lib@https://github.com/asoltys/liquidjs-lib#4a0bb0c4b38d327ec247d49e89219798fb0b28e2": + version "5.2.0" + resolved "https://github.com/asoltys/liquidjs-lib#4a0bb0c4b38d327ec247d49e89219798fb0b28e2" + dependencies: + "@types/jest" "^27.0.2" + "@vulpemventures/secp256k1-zkp" "^2.0.0" + axios "^0.21.1" + bech32 "^1.1.2" + bip174-liquid "^1.0.3" + bip32 "^2.0.4" + bip66 "^1.1.0" + bitcoin-ops "^1.4.0" + blech32 "^1.0.1" + bs58check "^2.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.3" + merkle-lib "^2.0.10" + pushdata-bitcoin "^1.0.1" + randombytes "^2.0.1" + tiny-secp256k1 "^1.1.1" + typeforce "^1.11.3" + varuint-bitcoin "^1.0.4" + wif "^2.0.1" + lnurl@^0.16.1: version "0.16.1" resolved "https://registry.yarnpkg.com/lnurl/-/lnurl-0.16.1.tgz#2bb8523f181ab8a8826e5b559be9e4cb183e0176" @@ -3683,6 +3769,16 @@ prettier@^1.18.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +pretty-format@^27.0.0, pretty-format@^27.2.0: + version "27.2.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.2.0.tgz#ee37a94ce2a79765791a8649ae374d468c18ef19" + integrity sha512-KyJdmgBkMscLqo8A7K77omgLx5PWPiXJswtTtFV7XgVZv2+qPk6UivpXXO+5k6ZEbWIbLoKdx1pZ6ldINzbwTA== + dependencies: + "@jest/types" "^27.1.1" + ansi-regex "^5.0.0" + ansi-styles "^5.0.0" + react-is "^17.0.1" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -3893,6 +3989,11 @@ rc@^1.2.7, rc@^1.2.8: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + read@^1.0.4: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" |
