From 4817b4881fe3efa73f8b79d9dd137c1e1185e308 Mon Sep 17 00:00:00 2001 From: James Cramer Date: Thu, 20 Jun 2019 12:50:53 -0400 Subject: [PATCH 1/3] add slpAddress format to fromXPub return type --- src/routes/v2/address.ts | 4 +++- test/v2/address.js | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/v2/address.ts b/src/routes/v2/address.ts index 2e9246cb..7c7188f1 100644 --- a/src/routes/v2/address.ts +++ b/src/routes/v2/address.ts @@ -845,10 +845,12 @@ async function fromXPubSingle( let cashAddr: string = bitbox.Address.fromXPub(xpub, hdPath) let legacyAddr: string = bitbox.Address.toLegacyAddress(cashAddr) + let slpAddr: string = SLP.Address.toSLPAddress(cashAddr) res.status(200) return res.json({ cashAddress: cashAddr, - legacyAddress: legacyAddr + legacyAddress: legacyAddr, + slpAddress: slpAddr }) } catch (err) { // Attempt to decode the error message. diff --git a/test/v2/address.js b/test/v2/address.js index ad5e6fe9..1551b731 100644 --- a/test/v2/address.js +++ b/test/v2/address.js @@ -1373,6 +1373,9 @@ describe("#AddressRouter", () => { // Assert that required fields exist in the returned object. assert.exists(result.legacyAddress); assert.exists(result.cashAddress); + assert.isTrue(result.cashAddress.includes('bitcoincash:')) + assert.exists(result.slpAddress); + assert.isTrue(result.slpAddress.includes('simpleledger:')) }); }); }); From 7e9c29cf4784db84a20feb0fc5341c3f9ed3dfbb Mon Sep 17 00:00:00 2001 From: James Cramer Date: Thu, 20 Jun 2019 13:11:13 -0400 Subject: [PATCH 2/3] fixed unit test --- test/v2/address.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/v2/address.js b/test/v2/address.js index 1551b731..530d5e01 100644 --- a/test/v2/address.js +++ b/test/v2/address.js @@ -1373,9 +1373,9 @@ describe("#AddressRouter", () => { // Assert that required fields exist in the returned object. assert.exists(result.legacyAddress); assert.exists(result.cashAddress); - assert.isTrue(result.cashAddress.includes('bitcoincash:')) + assert.isTrue(result.cashAddress.includes('bchtest:')) assert.exists(result.slpAddress); - assert.isTrue(result.slpAddress.includes('simpleledger:')) + assert.isTrue(result.slpAddress.includes('slptest:')) }); }); }); From 593d573ecc36339ad25902d34ef6032d8ef0b770 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Thu, 20 Jun 2019 10:23:39 -0700 Subject: [PATCH 3/3] Bump v. --- dist/public/bitcoin-com-mainnet-rest-v2.json | 2 +- dist/public/bitcoin-com-testnet-rest-v2.json | 2 +- package.json | 4 +- swaggerJSONFiles/info.json | 2 +- swaggerJSONFilesBuilt/mainnet/info.json | 2 +- swaggerJSONFilesBuilt/testnet/info.json | 2 +- yarn.lock | 108 ++++++++----------- 7 files changed, 50 insertions(+), 72 deletions(-) diff --git a/dist/public/bitcoin-com-mainnet-rest-v2.json b/dist/public/bitcoin-com-mainnet-rest-v2.json index 2fff4438..753634a9 100644 --- a/dist/public/bitcoin-com-mainnet-rest-v2.json +++ b/dist/public/bitcoin-com-mainnet-rest-v2.json @@ -1129,7 +1129,7 @@ "openapi": "3.0.0", "info": { "description": "rest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)", - "version": "3.11.6", + "version": "3.11.7", "title": "REST", "license": { "name": "MIT", diff --git a/dist/public/bitcoin-com-testnet-rest-v2.json b/dist/public/bitcoin-com-testnet-rest-v2.json index c4ad5cfb..51e9c03b 100644 --- a/dist/public/bitcoin-com-testnet-rest-v2.json +++ b/dist/public/bitcoin-com-testnet-rest-v2.json @@ -1129,7 +1129,7 @@ "openapi": "3.0.0", "info": { "description": "trest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)", - "version": "3.11.6", + "version": "3.11.7", "title": "REST", "license": { "name": "MIT", diff --git a/package.json b/package.json index cc8c1bd5..578fe8a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rest.bitcoin.com", - "version": "3.11.6", + "version": "3.11.7", "description": "REST API for Bitcoin.com's Cloud", "author": "Gabriel Cardona ", "contributors": [ @@ -24,7 +24,7 @@ }, "dependencies": { "axios": "^0.19.0", - "bitbox-sdk": "8.3.3", + "bitbox-sdk": "8.4.2", "bitcoincash-zmq-decoder": "0.1.5", "body-parser": "^1.18.3", "cashaccounts": "^0.4.2", diff --git a/swaggerJSONFiles/info.json b/swaggerJSONFiles/info.json index e34d4fff..42006c2f 100644 --- a/swaggerJSONFiles/info.json +++ b/swaggerJSONFiles/info.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "description": "The Bitcoin Cash JSON PRC over HTTP", - "version": "3.11.6", + "version": "3.11.7", "title": "REST", "license": { "name": "MIT", diff --git a/swaggerJSONFilesBuilt/mainnet/info.json b/swaggerJSONFilesBuilt/mainnet/info.json index cc231e0c..1699f24c 100644 --- a/swaggerJSONFilesBuilt/mainnet/info.json +++ b/swaggerJSONFilesBuilt/mainnet/info.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "description": "rest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)", - "version": "3.11.6", + "version": "3.11.7", "title": "REST", "license": { "name": "MIT", diff --git a/swaggerJSONFilesBuilt/testnet/info.json b/swaggerJSONFilesBuilt/testnet/info.json index 4dba71d5..526d0598 100644 --- a/swaggerJSONFilesBuilt/testnet/info.json +++ b/swaggerJSONFilesBuilt/testnet/info.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "description": "trest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)", - "version": "3.11.6", + "version": "3.11.7", "title": "REST", "license": { "name": "MIT", diff --git a/yarn.lock b/yarn.lock index d1143a81..294b6ea2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1456,17 +1456,17 @@ bch-wallet-bridge-provider-interface@^0.1.1: bchaddrjs "^0.2.2" bitcoincashjs "^0.1.10" -"bchaddrjs-slp@git+https://github.com/simpleledger/bchaddrjs.git": +"bchaddrjs-slp@git://github.com/simpleledger/bchaddrjs.git#master": version "0.2.6" - resolved "git+https://github.com/simpleledger/bchaddrjs.git#ea05d679783a6737f2f99adc37ebf485dc64f006" + uid ea05d679783a6737f2f99adc37ebf485dc64f006 + resolved "git://github.com/simpleledger/bchaddrjs.git#ea05d679783a6737f2f99adc37ebf485dc64f006" dependencies: bs58check "^2.1.2" cashaddrjs-slp "^0.2.11" -"bchaddrjs-slp@git://github.com/simpleledger/bchaddrjs.git#master": +"bchaddrjs-slp@https://github.com/simpleledger/bchaddrjs.git": version "0.2.6" - uid ea05d679783a6737f2f99adc37ebf485dc64f006 - resolved "git://github.com/simpleledger/bchaddrjs.git#ea05d679783a6737f2f99adc37ebf485dc64f006" + resolved "https://github.com/simpleledger/bchaddrjs.git#ea05d679783a6737f2f99adc37ebf485dc64f006" dependencies: bs58check "^2.1.2" cashaddrjs-slp "^0.2.11" @@ -1634,13 +1634,13 @@ bip-schnorr@^0.3.0: random-bytes "^1.0.0" safe-buffer "^5.0.1" -"bip21@github:Bitcoin-com/bip21": +bip21@Bitcoin-com/bip21, "bip21@github:Bitcoin-com/bip21": version "2.0.1" resolved "https://codeload.github.com/Bitcoin-com/bip21/tar.gz/28f8d03a3a16ed11eb5b963248ed1be8c46c6d6f" dependencies: qs "^6.3.0" -"bip32-utils@github:Bitcoin-com/bip32-utils#0.13.0": +bip32-utils@Bitcoin-com/bip32-utils#0.13.0: version "0.13.0" resolved "https://codeload.github.com/Bitcoin-com/bip32-utils/tar.gz/966fb8f0e0d4c667e4ee89adfa20c2078d66887c" dependencies: @@ -1649,7 +1649,7 @@ bip-schnorr@^0.3.0: standard "^11.0.1" tape "*" -"bip32-utils@github:Bitcoin-com/bip32-utils#0.13.1": +bip32-utils@Bitcoin-com/bip32-utils#0.13.1, "bip32-utils@github:Bitcoin-com/bip32-utils#0.13.1": version "0.13.1" resolved "https://codeload.github.com/Bitcoin-com/bip32-utils/tar.gz/b8a33ebd0a0ac39de7cd987e5c3f77a8c5d84e58" dependencies: @@ -1726,17 +1726,14 @@ bitbox-sdk@8.1.0: socket.io-client "^2.1.1" wif "^2.0.6" -bitbox-sdk@8.3.3: - version "8.3.3" - resolved "https://registry.yarnpkg.com/bitbox-sdk/-/bitbox-sdk-8.3.3.tgz#5fa5d58b47ee2d8f016e864895726f192679195a" +bitbox-sdk@8.4.2: + version "8.4.2" + resolved "https://registry.yarnpkg.com/bitbox-sdk/-/bitbox-sdk-8.4.2.tgz#0d9ebc77f92b7884faae8a1a9ebbabf48315c877" dependencies: "@types/bigi" "^1.4.2" "@types/bip39" "^2.4.2" - "@types/chai" "^4.1.7" - "@types/mocha" "^5.2.6" "@types/node" "^10.11.7" "@types/randombytes" "^2.0.0" - "@types/sinon" "^7.0.11" "@types/wif" "^2.0.1" assert "^1.4.1" axios "0.19.0" @@ -1819,14 +1816,14 @@ bitcoin-cash-rpc@^0.4.2: dependencies: axios "^0.19.0" +bitcoin-ops@Bitcoin-com/bitcoincash-ops#1.5.0: + version "1.5.0" + resolved "https://codeload.github.com/Bitcoin-com/bitcoincash-ops/tar.gz/f1363d462fd044f35f94a220bf9568e25d985646" + bitcoin-ops@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz#e45de620398e22fd4ca6023de43974ff42240278" -"bitcoin-ops@github:Bitcoin-com/bitcoincash-ops#1.5.0": - version "1.5.0" - resolved "https://codeload.github.com/Bitcoin-com/bitcoincash-ops/tar.gz/f1363d462fd044f35f94a220bf9568e25d985646" - bitcoin-txdecoder@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/bitcoin-txdecoder/-/bitcoin-txdecoder-0.0.3.tgz#f9052d6ea7bb0cbc8f22c024869391296b6c86dd" @@ -1844,50 +1841,49 @@ bitcoincash-zmq-decoder@0.1.5: dependencies: bitcoinjs-lib "3.3.*" -"bitcoincashjs-lib@git+https://github.com/Bitcoin-com/bitcoincashjs-lib.git": - version "4.0.1" - uid "28447b40a4ccd23913f7ade6589dc7214c99e60a" - resolved "git+https://github.com/Bitcoin-com/bitcoincashjs-lib.git#28447b40a4ccd23913f7ade6589dc7214c99e60a" +bitcoincashjs-lib@Bitcoin-com/bitcoincashjs-lib#3.3.4: + version "3.3.4" + resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/12fa5fe9b535816b54b9efedd6caf278d3e55b90" dependencies: bech32 "^1.1.2" bigi "^1.4.0" bip66 "^1.1.0" - bitcoincash-ops Bitcoin-com/bitcoincash-ops#2.0.0 + bitcoin-ops "^1.3.0" bs58check "^2.0.0" create-hash "^1.1.0" create-hmac "^1.1.3" ecurve "^1.0.0" merkle-lib "^2.0.10" - pushdata-bitcoin Bitcoin-com/pushdata-bitcoin#1.2.1 + pushdata-bitcoin "^1.0.1" randombytes "^2.0.1" safe-buffer "^5.0.1" typeforce "^1.11.3" varuint-bitcoin "^1.0.4" wif "^2.0.1" -"bitcoincashjs-lib@github:Bitcoin-com/bitcoincashjs-lib#3.3.4": - version "3.3.4" - resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/12fa5fe9b535816b54b9efedd6caf278d3e55b90" +bitcoincashjs-lib@Bitcoin-com/bitcoincashjs-lib#v4.0.0: + version "4.0.0" + resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/3d360c780ec7df4a74aea93664c2b5ff8b08949a" dependencies: bech32 "^1.1.2" bigi "^1.4.0" bip66 "^1.1.0" - bitcoin-ops "^1.3.0" + bitcoincash-ops Bitcoin-com/bitcoincash-ops#2.0.0 bs58check "^2.0.0" create-hash "^1.1.0" create-hmac "^1.1.3" ecurve "^1.0.0" merkle-lib "^2.0.10" - pushdata-bitcoin "^1.0.1" + pushdata-bitcoin Bitcoin-com/pushdata-bitcoin#1.2.1 randombytes "^2.0.1" safe-buffer "^5.0.1" typeforce "^1.11.3" varuint-bitcoin "^1.0.4" wif "^2.0.1" -"bitcoincashjs-lib@github:Bitcoin-com/bitcoincashjs-lib#v4.0.0": - version "4.0.0" - resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/3d360c780ec7df4a74aea93664c2b5ff8b08949a" +"bitcoincashjs-lib@github:Bitcoin-com/bitcoincashjs-lib#v4.0.1": + version "4.0.1" + resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/28447b40a4ccd23913f7ade6589dc7214c99e60a" dependencies: bech32 "^1.1.2" bigi "^1.4.0" @@ -1905,9 +1901,9 @@ bitcoincash-zmq-decoder@0.1.5: varuint-bitcoin "^1.0.4" wif "^2.0.1" -"bitcoincashjs-lib@github:Bitcoin-com/bitcoincashjs-lib#v4.0.1": +"bitcoincashjs-lib@https://github.com/Bitcoin-com/bitcoincashjs-lib.git": version "4.0.1" - resolved "https://codeload.github.com/Bitcoin-com/bitcoincashjs-lib/tar.gz/28447b40a4ccd23913f7ade6589dc7214c99e60a" + resolved "https://github.com/Bitcoin-com/bitcoincashjs-lib.git#28447b40a4ccd23913f7ade6589dc7214c99e60a" dependencies: bech32 "^1.1.2" bigi "^1.4.0" @@ -1971,9 +1967,9 @@ bitcore-lib-cash@^0.19.0: inherits "=2.0.1" lodash "=4.17.11" -"bitcore-lib-cash@git+https://github.com/paOol/bitcore-lib-cash.git": +"bitcore-lib-cash@https://github.com/paOol/bitcore-lib-cash.git": version "0.20.0" - resolved "git+https://github.com/paOol/bitcore-lib-cash.git#6812d317ee01ae20fcd341ee4ea09a848322c426" + resolved "https://github.com/paOol/bitcore-lib-cash.git#6812d317ee01ae20fcd341ee4ea09a848322c426" dependencies: bn.js "=4.11.8" bs58 "=4.0.1" @@ -2848,7 +2844,7 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -"coininfo@github:Bitcoin-com/coininfo": +coininfo@Bitcoin-com/coininfo, "coininfo@github:Bitcoin-com/coininfo": version "4.0.0" resolved "https://codeload.github.com/Bitcoin-com/coininfo/tar.gz/eece2c6141d08c3e7783929f2a1e1e681aa1a82c" dependencies: @@ -3374,7 +3370,7 @@ debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@~4.1.0: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -5373,7 +5369,7 @@ import-lazy@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -6269,7 +6265,7 @@ libnpm@^2.0.1: read-package-json "^2.0.13" stringify-package "^1.0.0" -libnpmaccess@*, libnpmaccess@^3.0.1: +libnpmaccess@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-3.0.1.tgz#5b3a9de621f293d425191aa2e779102f84167fa8" dependencies: @@ -6295,7 +6291,7 @@ libnpmhook@^5.0.2: get-stream "^4.0.0" npm-registry-fetch "^3.8.0" -libnpmorg@*, libnpmorg@^1.0.0: +libnpmorg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/libnpmorg/-/libnpmorg-1.0.0.tgz#979b868c48ba28c5820e3bb9d9e73c883c16a232" dependencies: @@ -6318,7 +6314,7 @@ libnpmpublish@^1.1.0: semver "^5.5.1" ssri "^6.0.1" -libnpmsearch@*, libnpmsearch@^2.0.0: +libnpmsearch@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/libnpmsearch/-/libnpmsearch-2.0.1.tgz#eccc73a8fbf267d765d18082b85daa2512501f96" dependencies: @@ -6326,7 +6322,7 @@ libnpmsearch@*, libnpmsearch@^2.0.0: get-stream "^4.0.0" npm-registry-fetch "^3.8.0" -libnpmteam@*, libnpmteam@^1.0.1: +libnpmteam@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/libnpmteam/-/libnpmteam-1.0.1.tgz#ff704b1b6c06ea674b3b1101ac3e305f5114f213" dependencies: @@ -6430,10 +6426,6 @@ lodash._basecopy@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - lodash._basetostring@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" @@ -6449,25 +6441,11 @@ lodash._basevalues@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" -lodash._getnative@*, lodash._getnative@^3.0.0: +lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" @@ -6553,7 +6531,7 @@ lodash.mergewith@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927" -lodash.restparam@*, lodash.restparam@^3.0.0: +lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" @@ -7544,7 +7522,7 @@ npm-pick-manifest@^2.2.3: npm-package-arg "^6.0.0" semver "^5.4.1" -npm-profile@*, npm-profile@^4.0.1: +npm-profile@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-4.0.1.tgz#d350f7a5e6b60691c7168fbb8392c3603583f5aa" dependencies: @@ -9013,7 +8991,7 @@ readable-stream@~1.1.10, readable-stream@~1.1.9: isarray "0.0.1" string_decoder "~0.10.x" -readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: +readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" dependencies: