Compare commits

...
35 Commits
Author SHA1 Message Date
Chris Troutner d0a23608e0 Merge pull request #87 from Permissionless-Software-Foundation/ct-unstable
fix(deps): Updating npm dependencies:
2023-05-12 06:49:00 -07:00
Chris Troutner 6cc5196a78 fix(deps): Updating npm dependencies: 2023-05-12 06:47:41 -07:00
Chris Troutner 7b1aba9da8 Merge pull request #86 from Permissionless-Software-Foundation/ct-unstable
updating dependencies
2023-04-06 06:12:31 -07:00
Chris Troutner 3539f0af50 fix(deps): Updating dependencies 2023-04-06 06:11:08 -07:00
Chris Troutner 34fa039ced Removing debugging 2023-02-08 15:08:00 -08:00
Chris Troutner f42ccafffa More debugging 2023-02-08 14:52:17 -08:00
Chris Troutner 842e6ead69 Debugging utxoBulk 2023-02-08 14:33:15 -08:00
Chris Troutner 62ef3e0a93 Merge pull request #85 from Permissionless-Software-Foundation/ct-unstable
Created JSON RPC endpoint for bulk UTXO lookup
2023-02-08 05:43:25 -08:00
Chris Troutner c9ab4b5ef8 fix(tests): Got unit tests to 100% 2023-02-08 05:37:12 -08:00
Chris Troutner f338f26593 fix(tests): Increased test coverage 2023-02-08 05:33:48 -08:00
Chris Troutner dc302066f0 linting 2023-02-08 05:20:58 -08:00
Chris Troutner fe5c95078b feat(utxoBulk): Created JSON RPC endpoint for bulk UTXO lookup 2023-02-08 05:20:38 -08:00
Chris Troutner c21554008c Merge pull request #84 from Permissionless-Software-Foundation/ct-unstable
fix(getTokenData2()): Adding updateCache argument
2023-01-26 18:03:17 -08:00
Chris Troutner e2a900d3a0 fix(getTokenData2()): Adding updateCache argument 2023-01-26 18:01:13 -08:00
Chris Troutner c870b54cae fix(getTokenData2()): Adding updateCache argument 2023-01-26 18:00:05 -08:00
Chris Troutner f022951680 Merge pull request #83 from Permissionless-Software-Foundation/ct-unstable
fix(deps): Updating dependencies
2022-11-02 04:56:51 -07:00
Chris Troutner 942a8f20ec fix(deps): Updating dependencies 2022-11-02 04:54:46 -07:00
Chris Troutner 683c1e4b2b Merge pull request #82 from Permissionless-Software-Foundation/ct-unstable
fix(getTokenData2): Adding token icon lookup
2022-10-06 21:10:50 -07:00
Chris Troutner 953690baa5 fix(getTokenData2): Adding token icon lookup 2022-10-06 21:07:12 -07:00
Chris Troutner 80a65c4e03 Merge pull request #81 from Permissionless-Software-Foundation/ct-unstable
fix(ipfs): Swapping out IPFS docker container with bandwidth limited …
2022-08-22 16:56:28 -07:00
Chris Troutner 63ecd21734 fix(ipfs): Swapping out IPFS docker container with bandwidth limited version 2022-08-22 16:52:11 -07:00
Chris Troutner ae957a835a Merge pull request #80 from Permissionless-Software-Foundation/ct-unstable
Syncing with upstream ipfs-service-provider
2022-08-03 18:34:50 -07:00
Chris Troutner c61feba1e6 Fixing merge conflicts with upstream 2022-08-03 17:47:00 -07:00
Chris Troutner 8a05f1f063 fix(deps): Updating dependencies 2022-08-03 17:43:28 -07:00
Chris Troutner b23acd3cdc Merge pull request #97 from Permissionless-Software-Foundation/ct-unstable
fix(production): Switching to Docker Image
2022-07-25 19:17:27 -07:00
Chris Troutner c71fda38ff fix(production): Switching to Docker Image 2022-07-25 19:14:44 -07:00
Chris Troutner f99f49d840 Merge pull request #96 from Permissionless-Software-Foundation/ct-unstable
Configuring ports with env vars
2022-07-25 17:58:40 -07:00
Chris Troutner 2edd924c57 fix(production): Adding 4003 websocket port 2022-07-25 17:56:02 -07:00
Chris Troutner 689c8fd8d9 fix(ipfs): Using config to set ports 2022-07-25 17:40:05 -07:00
Chris Troutner ffd6c452c9 Merge pull request #95 from Permissionless-Software-Foundation/ct-unstable
fix(mocks): Another update to IPFS test mocks
2022-07-24 08:15:55 -07:00
Chris Troutner fc8e160874 fix(mocks): Another update to IPFS test mocks 2022-07-24 08:14:27 -07:00
Chris Troutner d2f83307e6 Merge pull request #94 from Permissionless-Software-Foundation/ct-unstable
fix(mocks): Improvement to adapter mocks used in tests
2022-07-24 08:08:13 -07:00
Chris Troutner 1a09fcd26f fix(mocks): Improvement to adapter mocks used in tests 2022-07-24 08:06:32 -07:00
Chris Troutner d095d40b3f Merge pull request #79 from Permissionless-Software-Foundation/ct-unstable
fix(getTokenData): JSON controller accepts flag for showing tx history
2022-07-12 15:04:56 -07:00
Chris Troutner fac9f12072 fix(getTokenData): JSON controller accepts flag for showing tx history 2022-07-12 15:02:40 -07:00
12 changed files with 602 additions and 538 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2021 Permissionless Software Foundation
Copyright (c) 2022 Permissionless Software Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+51 -501
View File
@@ -9,12 +9,12 @@
"version": "2.0.0",
"license": "MIT",
"dependencies": {
"@psf/bch-js": "6.4.1",
"@psf/bch-js": "6.7.3",
"axios": "0.27.2",
"bcryptjs": "2.4.3",
"glob": "7.1.6",
"ipfs": "0.62.3",
"ipfs-coord": "8.0.2",
"ipfs-coord": "8.0.8",
"ipfs-http-client": "55.0.0",
"jsonrpc-lite": "2.2.0",
"jsonwebtoken": "8.5.1",
@@ -1445,15 +1445,15 @@
"license": "BSD-3-Clause"
},
"node_modules/@psf/bch-js": {
"version": "6.4.1",
"resolved": "http://94.130.170.209:4873/@psf%2fbch-js/-/bch-js-6.4.1.tgz",
"integrity": "sha512-/BLGzWH02VqaDNeY05QGMhrCtYDw5bXn45Egz+L5FLcyZaOqONR4kl80T6a8xvTPcREO4R+AjGTRBpfjdikwpA==",
"version": "6.7.3",
"resolved": "http://94.130.170.209:4873/@psf%2fbch-js/-/bch-js-6.7.3.tgz",
"integrity": "sha512-z6oJvPAXxSObPhqUAxCkCuPL2bp3Bs1oyhBZpQ5SR6cbJzcOMhuI4bHho2srH5agSCU+bbjehBMRGvo18eGW0A==",
"license": "MIT",
"dependencies": {
"@chris.troutner/bip32-utils": "1.0.5",
"@psf/bip21": "2.0.1",
"@psf/bitcoincash-ops": "2.0.0",
"@psf/bitcoincashjs-lib": "4.0.2",
"@psf/bitcoincashjs-lib": "4.0.3",
"@psf/coininfo": "4.0.0",
"axios": "0.26.1",
"bc-bip68": "1.0.5",
@@ -1492,10 +1492,14 @@
},
"node_modules/@psf/bitcoincash-ops": {
"version": "2.0.0",
"resolved": "http://94.130.170.209:4873/@psf%2fbitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz",
"integrity": "sha512-M3PWqRpeJq6rli2NqWGbas76z9TrdGOmNuDFACBWBMctPucEAsFQY2AmyFHRSa7hEwythwvrPh9AG/n6ehmEog==",
"license": "MIT"
},
"node_modules/@psf/bitcoincashjs-lib": {
"version": "4.0.2",
"version": "4.0.3",
"resolved": "http://94.130.170.209:4873/@psf%2fbitcoincashjs-lib/-/bitcoincashjs-lib-4.0.3.tgz",
"integrity": "sha512-sJYi7jYUqR7S+Z8TjN3W/5Lcju7xcIBxYLhIEpnOF+jR9kMt0ftpVjQBt8vVsJZUD8ArL9bf59oDETjdOUcdGQ==",
"license": "MIT",
"dependencies": {
"@psf/bitcoincash-ops": "^2.0.0",
@@ -1527,6 +1531,8 @@
},
"node_modules/@psf/pushdata-bitcoin": {
"version": "1.2.2",
"resolved": "http://94.130.170.209:4873/@psf%2fpushdata-bitcoin/-/pushdata-bitcoin-1.2.2.tgz",
"integrity": "sha512-e1qkZLJFU6Ldg7TMBgSkiR5U1NfpRgSIr2ppk8BeED/Q9wUc9DEVAjXfPMD65xgXdqnlyFEtLbpPMWwyydMVUQ==",
"license": "MIT",
"dependencies": {
"@psf/bitcoincash-ops": "^2.0.0"
@@ -2929,6 +2935,8 @@
},
"node_modules/bech32": {
"version": "1.1.4",
"resolved": "http://94.130.170.209:4873/bech32/-/bech32-1.1.4.tgz",
"integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==",
"license": "MIT"
},
"node_modules/before-after-hook": {
@@ -5336,125 +5344,6 @@
"esbuild-windows-arm64": "0.14.48"
}
},
"node_modules/esbuild-android-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-android-64/-/esbuild-android-64-0.14.48.tgz",
"integrity": "sha512-3aMjboap/kqwCUpGWIjsk20TtxVoKck8/4Tu19rubh7t5Ra0Yrpg30Mt1QXXlipOazrEceGeWurXKeFJgkPOUg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-android-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-android-arm64/-/esbuild-android-arm64-0.14.48.tgz",
"integrity": "sha512-vptI3K0wGALiDq+EvRuZotZrJqkYkN5282iAfcffjI5lmGG9G1ta/CIVauhY42MBXwEgDJkweiDcDMRLzBZC4g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-darwin-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-darwin-64/-/esbuild-darwin-64-0.14.48.tgz",
"integrity": "sha512-gGQZa4+hab2Va/Zww94YbshLuWteyKGD3+EsVon8EWTWhnHFRm5N9NbALNbwi/7hQ/hM1Zm4FuHg+k6BLsl5UA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-darwin-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.48.tgz",
"integrity": "sha512-bFjnNEXjhZT+IZ8RvRGNJthLWNHV5JkCtuOFOnjvo5pC0sk2/QVk0Qc06g2PV3J0TcU6kaPC3RN9yy9w2PSLEA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-freebsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.48.tgz",
"integrity": "sha512-1NOlwRxmOsnPcWOGTB10JKAkYSb2nue0oM1AfHWunW/mv3wERfJmnYlGzL3UAOIUXZqW8GeA2mv+QGwq7DToqA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-freebsd-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.48.tgz",
"integrity": "sha512-gXqKdO8wabVcYtluAbikDH2jhXp+Klq5oCD5qbVyUG6tFiGhrC9oczKq3vIrrtwcxDQqK6+HDYK8Zrd4bCA9Gw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-32": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-32/-/esbuild-linux-32-0.14.48.tgz",
"integrity": "sha512-ghGyDfS289z/LReZQUuuKq9KlTiTspxL8SITBFQFAFRA/IkIvDpnZnCAKTCjGXAmUqroMQfKJXMxyjJA69c/nQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-64/-/esbuild-linux-64-0.14.48.tgz",
@@ -5472,108 +5361,6 @@
"node": ">=12"
}
},
"node_modules/esbuild-linux-arm": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-arm/-/esbuild-linux-arm-0.14.48.tgz",
"integrity": "sha512-+VfSV7Akh1XUiDNXgqgY1cUP1i2vjI+BmlyXRfVz5AfV3jbpde8JTs5Q9sYgaoq5cWfuKfoZB/QkGOI+QcL1Tw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.48.tgz",
"integrity": "sha512-3CFsOlpoxlKPRevEHq8aAntgYGYkE1N9yRYAcPyng/p4Wyx0tPR5SBYsxLKcgPB9mR8chHEhtWYz6EZ+H199Zw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-mips64le": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.48.tgz",
"integrity": "sha512-cs0uOiRlPp6ymknDnjajCgvDMSsLw5mST2UXh+ZIrXTj2Ifyf2aAP3Iw4DiqgnyYLV2O/v/yWBJx+WfmKEpNLA==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-ppc64le": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.48.tgz",
"integrity": "sha512-+2F0vJMkuI0Wie/wcSPDCqXvSFEELH7Jubxb7mpWrA/4NpT+/byjxDz0gG6R1WJoeDefcrMfpBx4GFNN1JQorQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-riscv64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.48.tgz",
"integrity": "sha512-BmaK/GfEE+5F2/QDrIXteFGKnVHGxlnK9MjdVKMTfvtmudjY3k2t8NtlY4qemKSizc+QwyombGWTBDc76rxePA==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-linux-s390x": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.48.tgz",
"integrity": "sha512-tndw/0B9jiCL+KWKo0TSMaUm5UWBLsfCKVdbfMlb3d5LeV9WbijZ8Ordia8SAYv38VSJWOEt6eDCdOx8LqkC4g==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-loader": {
"version": "2.19.0",
"resolved": "http://94.130.170.209:4873/esbuild-loader/-/esbuild-loader-2.19.0.tgz",
@@ -5595,108 +5382,6 @@
"webpack": "^4.40.0 || ^5.0.0"
}
},
"node_modules/esbuild-netbsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.48.tgz",
"integrity": "sha512-V9hgXfwf/T901Lr1wkOfoevtyNkrxmMcRHyticybBUHookznipMOHoF41Al68QBsqBxnITCEpjjd4yAos7z9Tw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-openbsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.48.tgz",
"integrity": "sha512-+IHf4JcbnnBl4T52egorXMatil/za0awqzg2Vy6FBgPcBpisDWT2sVz/tNdrK9kAqj+GZG/jZdrOkj7wsrNTKA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-sunos-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-sunos-64/-/esbuild-sunos-64-0.14.48.tgz",
"integrity": "sha512-77m8bsr5wOpOWbGi9KSqDphcq6dFeJyun8TA+12JW/GAjyfTwVtOnN8DOt6DSPUfEV+ltVMNqtXUeTeMAxl5KA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-windows-32": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-32/-/esbuild-windows-32-0.14.48.tgz",
"integrity": "sha512-EPgRuTPP8vK9maxpTGDe5lSoIBHGKO/AuxDncg5O3NkrPeLNdvvK8oywB0zGaAZXxYWfNNSHskvvDgmfVTguhg==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-windows-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-64/-/esbuild-windows-64-0.14.48.tgz",
"integrity": "sha512-YmpXjdT1q0b8ictSdGwH3M8VCoqPpK1/UArze3X199w6u8hUx3V8BhAi1WjbsfDYRBanVVtduAhh2sirImtAvA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild-windows-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.48.tgz",
"integrity": "sha512-HHaOMCsCXp0rz5BT2crTka6MPWVno121NKApsGs/OIW5QC0ggC69YMGs1aJct9/9FSUF4A1xNE/cLvgB5svR4g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/escalade": {
"version": "3.1.1",
"license": "MIT",
@@ -6836,21 +6521,6 @@
"version": "1.0.0",
"license": "ISC"
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "http://94.130.170.209:4873/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"license": "MIT"
@@ -8058,9 +7728,9 @@
}
},
"node_modules/ipfs-coord": {
"version": "8.0.2",
"resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.2.tgz",
"integrity": "sha512-CdUH4GLLFArUDb8LIRAXxPlhbRQ44A5PEWB4J9zzDB3by93O7DLEgjqPqLDolalzrtiQBVzoARO/exZvdxBF+w==",
"version": "8.0.8",
"resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.8.tgz",
"integrity": "sha512-2ivZ7dCIrpS7VBN0DohaGBYRe3bzybkGbl0lOTyNeCUhrrYniC66dAnfdCY8CmpEeXoEYsaW2hLmohz4jDHywQ==",
"license": "MIT",
"dependencies": {
"axios": "0.21.4",
@@ -11379,6 +11049,8 @@
},
"node_modules/merkle-lib": {
"version": "2.0.10",
"resolved": "http://94.130.170.209:4873/merkle-lib/-/merkle-lib-2.0.10.tgz",
"integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY=",
"license": "MIT"
},
"node_modules/methods": {
@@ -12259,6 +11931,8 @@
"node_modules/node-fetch": {
"name": "@achingbrain/node-fetch",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-iTASGs+HTFK5E4ZqcMsHmeJ4zodyq8L38lZV33jwqcBJYoUt3HjN4+ot+O9/0b+ke8ddE7UgOtVuZN/OkV19/g==",
"license": "MIT",
"engines": {
"node": "4.x || >=6.0.0"
@@ -19363,6 +19037,8 @@
},
"node_modules/typeforce": {
"version": "1.18.0",
"resolved": "http://94.130.170.209:4873/typeforce/-/typeforce-1.18.0.tgz",
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==",
"license": "MIT"
},
"node_modules/uc.micro": {
@@ -21294,14 +20970,14 @@
"version": "1.1.0"
},
"@psf/bch-js": {
"version": "6.4.1",
"resolved": "http://94.130.170.209:4873/@psf%2fbch-js/-/bch-js-6.4.1.tgz",
"integrity": "sha512-/BLGzWH02VqaDNeY05QGMhrCtYDw5bXn45Egz+L5FLcyZaOqONR4kl80T6a8xvTPcREO4R+AjGTRBpfjdikwpA==",
"version": "6.7.3",
"resolved": "http://94.130.170.209:4873/@psf%2fbch-js/-/bch-js-6.7.3.tgz",
"integrity": "sha512-z6oJvPAXxSObPhqUAxCkCuPL2bp3Bs1oyhBZpQ5SR6cbJzcOMhuI4bHho2srH5agSCU+bbjehBMRGvo18eGW0A==",
"requires": {
"@chris.troutner/bip32-utils": "1.0.5",
"@psf/bip21": "2.0.1",
"@psf/bitcoincash-ops": "2.0.0",
"@psf/bitcoincashjs-lib": "4.0.2",
"@psf/bitcoincashjs-lib": "4.0.3",
"@psf/coininfo": "4.0.0",
"axios": "0.26.1",
"bc-bip68": "1.0.5",
@@ -21339,10 +21015,14 @@
}
},
"@psf/bitcoincash-ops": {
"version": "2.0.0"
"version": "2.0.0",
"resolved": "http://94.130.170.209:4873/@psf%2fbitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz",
"integrity": "sha512-M3PWqRpeJq6rli2NqWGbas76z9TrdGOmNuDFACBWBMctPucEAsFQY2AmyFHRSa7hEwythwvrPh9AG/n6ehmEog=="
},
"@psf/bitcoincashjs-lib": {
"version": "4.0.2",
"version": "4.0.3",
"resolved": "http://94.130.170.209:4873/@psf%2fbitcoincashjs-lib/-/bitcoincashjs-lib-4.0.3.tgz",
"integrity": "sha512-sJYi7jYUqR7S+Z8TjN3W/5Lcju7xcIBxYLhIEpnOF+jR9kMt0ftpVjQBt8vVsJZUD8ArL9bf59oDETjdOUcdGQ==",
"requires": {
"@psf/bitcoincash-ops": "^2.0.0",
"@psf/pushdata-bitcoin": "^1.2.2",
@@ -21369,6 +21049,8 @@
},
"@psf/pushdata-bitcoin": {
"version": "1.2.2",
"resolved": "http://94.130.170.209:4873/@psf%2fpushdata-bitcoin/-/pushdata-bitcoin-1.2.2.tgz",
"integrity": "sha512-e1qkZLJFU6Ldg7TMBgSkiR5U1NfpRgSIr2ppk8BeED/Q9wUc9DEVAjXfPMD65xgXdqnlyFEtLbpPMWwyydMVUQ==",
"requires": {
"@psf/bitcoincash-ops": "^2.0.0"
}
@@ -22403,7 +22085,9 @@
"version": "2.4.3"
},
"bech32": {
"version": "1.1.4"
"version": "1.1.4",
"resolved": "http://94.130.170.209:4873/bech32/-/bech32-1.1.4.tgz",
"integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="
},
"before-after-hook": {
"version": "2.2.2",
@@ -24135,55 +23819,6 @@
"esbuild-windows-arm64": "0.14.48"
}
},
"esbuild-android-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-android-64/-/esbuild-android-64-0.14.48.tgz",
"integrity": "sha512-3aMjboap/kqwCUpGWIjsk20TtxVoKck8/4Tu19rubh7t5Ra0Yrpg30Mt1QXXlipOazrEceGeWurXKeFJgkPOUg==",
"dev": true,
"optional": true
},
"esbuild-android-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-android-arm64/-/esbuild-android-arm64-0.14.48.tgz",
"integrity": "sha512-vptI3K0wGALiDq+EvRuZotZrJqkYkN5282iAfcffjI5lmGG9G1ta/CIVauhY42MBXwEgDJkweiDcDMRLzBZC4g==",
"dev": true,
"optional": true
},
"esbuild-darwin-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-darwin-64/-/esbuild-darwin-64-0.14.48.tgz",
"integrity": "sha512-gGQZa4+hab2Va/Zww94YbshLuWteyKGD3+EsVon8EWTWhnHFRm5N9NbALNbwi/7hQ/hM1Zm4FuHg+k6BLsl5UA==",
"dev": true,
"optional": true
},
"esbuild-darwin-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.48.tgz",
"integrity": "sha512-bFjnNEXjhZT+IZ8RvRGNJthLWNHV5JkCtuOFOnjvo5pC0sk2/QVk0Qc06g2PV3J0TcU6kaPC3RN9yy9w2PSLEA==",
"dev": true,
"optional": true
},
"esbuild-freebsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.48.tgz",
"integrity": "sha512-1NOlwRxmOsnPcWOGTB10JKAkYSb2nue0oM1AfHWunW/mv3wERfJmnYlGzL3UAOIUXZqW8GeA2mv+QGwq7DToqA==",
"dev": true,
"optional": true
},
"esbuild-freebsd-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.48.tgz",
"integrity": "sha512-gXqKdO8wabVcYtluAbikDH2jhXp+Klq5oCD5qbVyUG6tFiGhrC9oczKq3vIrrtwcxDQqK6+HDYK8Zrd4bCA9Gw==",
"dev": true,
"optional": true
},
"esbuild-linux-32": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-32/-/esbuild-linux-32-0.14.48.tgz",
"integrity": "sha512-ghGyDfS289z/LReZQUuuKq9KlTiTspxL8SITBFQFAFRA/IkIvDpnZnCAKTCjGXAmUqroMQfKJXMxyjJA69c/nQ==",
"dev": true,
"optional": true
},
"esbuild-linux-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-64/-/esbuild-linux-64-0.14.48.tgz",
@@ -24191,48 +23826,6 @@
"dev": true,
"optional": true
},
"esbuild-linux-arm": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-arm/-/esbuild-linux-arm-0.14.48.tgz",
"integrity": "sha512-+VfSV7Akh1XUiDNXgqgY1cUP1i2vjI+BmlyXRfVz5AfV3jbpde8JTs5Q9sYgaoq5cWfuKfoZB/QkGOI+QcL1Tw==",
"dev": true,
"optional": true
},
"esbuild-linux-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.48.tgz",
"integrity": "sha512-3CFsOlpoxlKPRevEHq8aAntgYGYkE1N9yRYAcPyng/p4Wyx0tPR5SBYsxLKcgPB9mR8chHEhtWYz6EZ+H199Zw==",
"dev": true,
"optional": true
},
"esbuild-linux-mips64le": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.48.tgz",
"integrity": "sha512-cs0uOiRlPp6ymknDnjajCgvDMSsLw5mST2UXh+ZIrXTj2Ifyf2aAP3Iw4DiqgnyYLV2O/v/yWBJx+WfmKEpNLA==",
"dev": true,
"optional": true
},
"esbuild-linux-ppc64le": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.48.tgz",
"integrity": "sha512-+2F0vJMkuI0Wie/wcSPDCqXvSFEELH7Jubxb7mpWrA/4NpT+/byjxDz0gG6R1WJoeDefcrMfpBx4GFNN1JQorQ==",
"dev": true,
"optional": true
},
"esbuild-linux-riscv64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.48.tgz",
"integrity": "sha512-BmaK/GfEE+5F2/QDrIXteFGKnVHGxlnK9MjdVKMTfvtmudjY3k2t8NtlY4qemKSizc+QwyombGWTBDc76rxePA==",
"dev": true,
"optional": true
},
"esbuild-linux-s390x": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.48.tgz",
"integrity": "sha512-tndw/0B9jiCL+KWKo0TSMaUm5UWBLsfCKVdbfMlb3d5LeV9WbijZ8Ordia8SAYv38VSJWOEt6eDCdOx8LqkC4g==",
"dev": true,
"optional": true
},
"esbuild-loader": {
"version": "2.19.0",
"resolved": "http://94.130.170.209:4873/esbuild-loader/-/esbuild-loader-2.19.0.tgz",
@@ -24247,48 +23840,6 @@
"webpack-sources": "^2.2.0"
}
},
"esbuild-netbsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.48.tgz",
"integrity": "sha512-V9hgXfwf/T901Lr1wkOfoevtyNkrxmMcRHyticybBUHookznipMOHoF41Al68QBsqBxnITCEpjjd4yAos7z9Tw==",
"dev": true,
"optional": true
},
"esbuild-openbsd-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.48.tgz",
"integrity": "sha512-+IHf4JcbnnBl4T52egorXMatil/za0awqzg2Vy6FBgPcBpisDWT2sVz/tNdrK9kAqj+GZG/jZdrOkj7wsrNTKA==",
"dev": true,
"optional": true
},
"esbuild-sunos-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-sunos-64/-/esbuild-sunos-64-0.14.48.tgz",
"integrity": "sha512-77m8bsr5wOpOWbGi9KSqDphcq6dFeJyun8TA+12JW/GAjyfTwVtOnN8DOt6DSPUfEV+ltVMNqtXUeTeMAxl5KA==",
"dev": true,
"optional": true
},
"esbuild-windows-32": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-32/-/esbuild-windows-32-0.14.48.tgz",
"integrity": "sha512-EPgRuTPP8vK9maxpTGDe5lSoIBHGKO/AuxDncg5O3NkrPeLNdvvK8oywB0zGaAZXxYWfNNSHskvvDgmfVTguhg==",
"dev": true,
"optional": true
},
"esbuild-windows-64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-64/-/esbuild-windows-64-0.14.48.tgz",
"integrity": "sha512-YmpXjdT1q0b8ictSdGwH3M8VCoqPpK1/UArze3X199w6u8hUx3V8BhAi1WjbsfDYRBanVVtduAhh2sirImtAvA==",
"dev": true,
"optional": true
},
"esbuild-windows-arm64": {
"version": "0.14.48",
"resolved": "http://94.130.170.209:4873/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.48.tgz",
"integrity": "sha512-HHaOMCsCXp0rz5BT2crTka6MPWVno121NKApsGs/OIW5QC0ggC69YMGs1aJct9/9FSUF4A1xNE/cLvgB5svR4g==",
"dev": true,
"optional": true
},
"escalade": {
"version": "3.1.1"
},
@@ -25026,13 +24577,6 @@
"fs.realpath": {
"version": "1.0.0"
},
"fsevents": {
"version": "2.3.2",
"resolved": "http://94.130.170.209:4873/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": {
"version": "1.1.1"
},
@@ -25818,9 +25362,9 @@
}
},
"ipfs-coord": {
"version": "8.0.2",
"resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.2.tgz",
"integrity": "sha512-CdUH4GLLFArUDb8LIRAXxPlhbRQ44A5PEWB4J9zzDB3by93O7DLEgjqPqLDolalzrtiQBVzoARO/exZvdxBF+w==",
"version": "8.0.8",
"resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.8.tgz",
"integrity": "sha512-2ivZ7dCIrpS7VBN0DohaGBYRe3bzybkGbl0lOTyNeCUhrrYniC66dAnfdCY8CmpEeXoEYsaW2hLmohz4jDHywQ==",
"requires": {
"axios": "0.21.4",
"bch-encrypt-lib": "2.0.0",
@@ -28313,7 +27857,9 @@
"dev": true
},
"merkle-lib": {
"version": "2.0.10"
"version": "2.0.10",
"resolved": "http://94.130.170.209:4873/merkle-lib/-/merkle-lib-2.0.10.tgz",
"integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY="
},
"methods": {
"version": "1.1.2"
@@ -28910,7 +28456,9 @@
}
},
"node-fetch": {
"version": "npm:@achingbrain/node-fetch@2.6.7"
"version": "npm:@achingbrain/node-fetch@2.6.7",
"resolved": "https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-iTASGs+HTFK5E4ZqcMsHmeJ4zodyq8L38lZV33jwqcBJYoUt3HjN4+ot+O9/0b+ke8ddE7UgOtVuZN/OkV19/g=="
},
"node-forge": {
"version": "1.3.1",
@@ -33758,7 +33306,9 @@
}
},
"typeforce": {
"version": "1.18.0"
"version": "1.18.0",
"resolved": "http://94.130.170.209:4873/typeforce/-/typeforce-1.18.0.tgz",
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
},
"uc.micro": {
"version": "1.0.6",
+2 -2
View File
@@ -24,12 +24,12 @@
},
"repository": "Permissionless-Software-Foundation/ipfs-bch-wallet-service",
"dependencies": {
"@psf/bch-js": "6.4.1",
"@psf/bch-js": "6.7.3",
"axios": "0.27.2",
"bcryptjs": "2.4.3",
"glob": "7.1.6",
"ipfs": "0.62.3",
"ipfs-coord": "8.0.2",
"ipfs-coord": "8.0.8",
"ipfs-http-client": "55.0.0",
"jsonrpc-lite": "2.2.0",
"jsonwebtoken": "8.5.1",
+13 -14
View File
@@ -4,7 +4,7 @@ version: '3.9'
services:
mongo-bch-service:
image: mongo
image: mongo:4.2.0
container_name: mongo-bch-service
ports:
- '5555:27017' # <host port>:<container port>
@@ -14,10 +14,15 @@ services:
restart: always
ipfs-bch-wallet:
image: ipfs/go-ipfs:v0.13.0
image: christroutner/trickle-ipfs:v1.0.1
#build:
# context: ./
# dockerfile: Dockerfile
container_name: ipfs-bch-wallet
environment:
MY_ENV_VAR: 'placeholder'
IPFS_DAEMON_ARGUMENTS: '--enable-pubsub-experiment --migrate=true --agent-version-suffix=docker --routing=dhtclient'
UPLOAD_KBPS: '100'
DOWNLOAD_KBPS: '100'
logging:
driver: 'json-file'
options:
@@ -26,20 +31,14 @@ services:
mem_limit: 2000mb
ports:
- 4001:4001
- 4003:4003
- 172.17.0.1:5001:5001
- 172.17.0.1:8080:8080
command: [
'./start-ipfs.sh'
]
volumes:
- ../data/go-ipfs/data:/data/ipfs
#- ../../swarm.key:/data/ipfs/swarm.key
# https://docs.docker.com/compose/compose-file/compose-file-v3/#command
# https://github.com/ipfs/go-ipfs/blob/91c52657166bcf86f2476926e4fe56694dc26562/Dockerfile#L115
command:
[
'daemon',
'--migrate=true',
'--agent-version-suffix=docker',
'--enable-pubsub-experiment'
]
- ../data/go-ipfs/data:/root/.ipfs
restart: always
bch-wallet-service:
+1 -1
View File
@@ -42,6 +42,6 @@ export SVC_ENV=production
export IPFS_HOST=172.17.0.1
export IPFS_API_PORT=5001
export IPFS_TCP_PORT=4001
#export IPFS_WS_PORT=4002
export IPFS_WS_PORT=4003
npm start
+2 -2
View File
@@ -18,8 +18,8 @@ export DEBUG_LEVEL=2
# Production settings that use external IPFS node.
# https://github.com/christroutner/docker-ipfs
export SVC_ENV=production
#export IPFS_HOST=localhost
export IPFS_HOST=172.17.0.1
export IPFS_HOST=localhost
# export IPFS_HOST=172.17.0.1
export IPFS_API_PORT=5001
# Configure IPFS ports
+5 -1
View File
@@ -5,6 +5,7 @@
// Local libraries
const IpfsAdapter = require('./ipfs')
const IpfsCoordAdapter = require('./ipfs-coord')
const config = require('../../../config')
class IPFS {
constructor (localConfig = {}) {
@@ -12,6 +13,7 @@ class IPFS {
this.ipfsAdapter = new IpfsAdapter()
this.IpfsCoordAdapter = IpfsCoordAdapter
this.process = process
this.config = config
this.ipfsCoordAdapter = {} // placeholder
@@ -40,7 +42,9 @@ class IPFS {
// Start ipfs-coord
this.ipfsCoordAdapter = new this.IpfsCoordAdapter({
ipfs: this.ipfs,
bchjs
bchjs,
tcpPort: this.config.ipfsTcpPort,
wsPort: this.config.ipfsWsPort
})
await this.ipfsCoordAdapter.start()
console.log('ipfs-coord is ready.')
+216 -2
View File
@@ -60,6 +60,10 @@ class BCHRPC {
await this.rateLimit.limiter(rpcData.from)
return await this.utxos(rpcData)
case 'utxosBulk':
await this.rateLimit.limiter(rpcData.from)
return await this.utxosBulk(rpcData)
case 'broadcast':
await this.rateLimit.limiter(rpcData.from)
return await this.broadcast(rpcData)
@@ -79,6 +83,10 @@ class BCHRPC {
case 'getTokenData':
await this.rateLimit.limiter(rpcData.from)
return await this.getTokenData(rpcData)
case 'getTokenData2':
await this.rateLimit.limiter(rpcData.from)
return await this.getTokenData2(rpcData)
}
} catch (err) {
console.error('Error in BCHRPC/rpcRouter()')
@@ -362,6 +370,145 @@ class BCHRPC {
}
}
/**
* @api {JSON} /bch UTXOs Bulk
* @apiPermission public
* @apiName UTXOs Bulk
* @apiGroup JSON BCH
* @apiDescription This endpoint provides the same data as as the utxos
* endpoint, but it allows retrieval of UTXOs for up to 20 addresses at
* a time. This reduces the number of JSON RPC calls, and is very handy
* for HD wallets that need to quickly scan a lot of addresses.
*
* Given an array of addresses, this endpoint will return an object
* with the following properties
*
* - jsonrpc: "" - jsonrpc version
* - id: "" - jsonrpc id
* - result: {} - Result of the request with the RPC information
* - method: "" - Method used in the request
* - receiver: "" - Receiver address
* - value: [] - Final result value of the request
* - address: "" - the address these UTXOs are associated with
* - bchUtxos: [] - UTXOs confirmed to be spendable as normal BCH
* - nullUtxo: [] - UTXOs that did not pass SLP validation. Should be ignored and
* not spent, to be safe.
* - slpUtxos: {} - UTXOs confirmed to be colored as valid SLP tokens
* - type1: {}
* - tokens: [] - SLP token Type 1 tokens.
* - mintBatons: [] - SLP token Type 1 mint batons.
* - nft: {}
* - tokens: [] - NFT tokens
* - groupTokens: [] - NFT Group tokens, used to create NFT tokens.
* - groupMintBatons: [] - Minting baton to create more NFT Group tokens.
*
* @apiExample Example usage:
* {"jsonrpc":"2.0","id":"555","method":"bch","params":{ "endpoint": "utxos", "address": "bitcoincash:qrl2nlsaayk6ekxn80pq0ks32dya8xfclyktem2mqj"}}
*
* @apiSuccessExample {json} Success-Response:
*
* {
* "jsonrpc":"2.0",
* "id":"555",
* "result":{
* "method":"bch",
* "reciever":"QmU86vLVbUY1UhziKB6rak7GPKRA2QHWvzNm2AjEvXNsT6",
* "value":[
* {
* "address":"bitcoincash:qrl2nlsaayk6ekxn80pq0ks32dya8xfclyktem2mqj",
* "bchUtxos":[
* {
* "height":631219,
* "tx_hash":"ae2daa01c8172545b5edd205ea438706bcb74e63d4084a26b9ff2a46d46dc97f",
* "tx_pos":0,
* "value":1000,
* "txid":"ae2daa01c8172545b5edd205ea438706bcb74e63d4084a26b9ff2a46d46dc97f",
* "vout":0,
* "isValid":false
* }
* ],
* "nullUtxos":[
*
* ],
* "slpUtxos":{
* "type1":{
* "mintBatons":[
*
* ],
* "tokens":[
*
* ]
* },
* "nft":{
* "groupMintBatons":[
*
* ],
* "groupTokens":[
*
* ],
* "tokens":[
*
* ]
* }
* }
* }
* ]
* }
* }
*
*/
async utxosBulk (rpcData) {
try {
// console.log('createUser rpcData: ', rpcData)
const addrs = rpcData.payload.params.addresses
// console.log('addrs: ', addrs)
// Input validation
if (!Array.isArray(addrs)) {
throw new Error('addresses parameter must be an array')
}
if (addrs.length > 20) {
throw new Error('addresses parameter must not exceed 20 elements')
}
const result = []
for (let i = 0; i < addrs.length; i++) {
const thisAddr = addrs[i]
const data = await this.bchjs.Utxo.get(thisAddr)
// console.log(`data: ${JSON.stringify(data, null, 2)}`)
result.push({
address: thisAddr,
utxos: data
})
}
// console.log('result: ', result)
const retObj = {}
retObj.status = 200
retObj.success = true
retObj.data = result
// console.log('retObj: ', retObj)
return retObj
} catch (err) {
console.error('Error in JSON RPC BCH utxosBulk()')
console.error('Error in JSON RPC utxosBulk(): ', err)
// throw err
// Return an error response
return {
success: false,
status: 422,
message: err.message,
endpoint: 'utxosBulk'
}
}
}
/**
* @api {JSON} /bch Broadcast
* @apiPermission public
@@ -704,6 +851,9 @@ class BCHRPC {
* specification for mutable data for tokens:
* https://github.com/Permissionless-Software-Foundation/specifications/blob/master/ps002-slp-mutable-data.md
*
* If optional parameter 'withTxHistory' is true, data will include the
* transaction history of the token.
*
* - jsonrpc: "" - jsonrpc version
* - id: "" - jsonrpc id
* - result: {} - Result of the petition with the RPC information
@@ -711,7 +861,7 @@ class BCHRPC {
* - tokenData: - Address public key
*
* @apiExample Example usage:
* {"jsonrpc":"2.0","id":"555","method":"bch","params":{ "endpoint": "getTokenData", "tokenId": "c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d" }}
* {"jsonrpc":"2.0","id":"555","method":"bch","params":{ "endpoint": "getTokenData", "tokenId": "c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d", "withTxHistory": true }}
*
* @apiSuccessExample {json} Success-Response:
* {
@@ -754,7 +904,9 @@ class BCHRPC {
const tokenId = rpcData.payload.params.tokenId
// console.log('tokenId: ', tokenId)
const tokenData = await this.bchjs.PsfSlpIndexer.getTokenData(tokenId)
const withTxHistory = !!rpcData.payload.params.withTxHistory
const tokenData = await this.bchjs.PsfSlpIndexer.getTokenData(tokenId, withTxHistory)
const retObj = {
success: true,
@@ -783,6 +935,68 @@ class BCHRPC {
}
}
}
/**
* @api {JSON} /bch getTokenData2
* @apiPermission public
* @apiName getTokenData2
* @apiGroup JSON BCH
* @apiDescription Get token icon and other media
*
* Get the icon for a token, given it's token ID.
* This function expects a string input of a token ID property.
* This function returns an object with a tokenIcon property that contains
* the URL to the icon.
*
* The output object always have these properties:
* - tokenIcon: A url to the token icon, if it exists.
* - tokenStats: Data about the token from psf-slp-indexer.
* - optimizedTokenIcon: An alternative, potentially more optimal, url to the token icon, if it exists.
* - iconRepoCompatible: true if the token icon is available via token.bch.sx
* - ps002Compatible: true if the token icon is compatible with PS007 specification.
*
* @apiExample Example usage:
* {"jsonrpc":"2.0","id":"555","method":"bch","params":{ "endpoint": "getTokenData2", "tokenId": "c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d", "withTxHistory": true }}
*
*/
async getTokenData2 (rpcData) {
try {
// console.log('createUser rpcData: ', rpcData)
const tokenId = rpcData.payload.params.tokenId
// console.log('tokenId: ', tokenId)
const updateCache = rpcData.payload.params.updateCache
const tokenData = await this.bchjs.PsfSlpIndexer.getTokenData2(tokenId, updateCache)
const retObj = {
success: true,
status: 200,
endpoint: 'getTokenData2',
tokenData
}
// retObj.status = 200
return retObj
} catch (err) {
console.error('Error in JSON RPC BCH utxoIsValid()')
// Handle different error formats.
let error = err
if (err.error && typeof err.error === 'string') {
error = new Error(err.error)
}
// Return an error response
return {
success: false,
status: 422,
message: error.message,
endpoint: 'getTokenData2'
}
}
}
}
module.exports = BCHRPC
@@ -27,7 +27,7 @@ describe('#BCH', () => {
payload: {
params: {
utxo: {
txid: 'b94e1ff82eb5781f98296f0af2488ff06202f12ee92b0175963b8dba688d1b40',
txid: 'a2059b1321e96a90a386894a68fa5829756118895b3cdb9a0393d94fd2ceed93',
vout: 0
}
}
@@ -45,7 +45,7 @@ describe('#BCH', () => {
payload: {
params: {
utxo: {
tx_hash: 'b94e1ff82eb5781f98296f0af2488ff06202f12ee92b0175963b8dba688d1b40',
tx_hash: 'a2059b1321e96a90a386894a68fa5829756118895b3cdb9a0393d94fd2ceed93',
tx_pos: 0
}
}
@@ -100,7 +100,7 @@ describe('#BCH', () => {
const rpcData = {
payload: {
params: {
tokenId: 'c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d'
tokenId: '5f31905f335fa932879c5aabfd1c14ac748f6696148bd300f845ea5016ad573e'
}
}
}
@@ -113,5 +113,21 @@ describe('#BCH', () => {
assert.property(result.tokenData, 'mutableData')
assert.equal(result.success, true)
})
it('should return data for a token with tx history', async () => {
const rpcData = {
payload: {
params: {
tokenId: '43eddfb11c9941edffb8c8815574bb0a43969a7b1de39ad14cd043eaa24fd38d',
withTxHistory: true
}
}
}
const result = await uut.getTokenData(rpcData)
// console.log('result: ', result)
assert.isArray(result.tokenData.genesisData.txs)
})
})
})
@@ -118,6 +118,25 @@ describe('#BCHRPC', () => {
assert.equal(result, true)
})
it('should route to the utxosBulk method', async () => {
// Mock dependencies
sandbox.stub(uut, 'utxosBulk').resolves(true)
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const txCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxosBulk'
})
const jsonStr = JSON.stringify(txCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
rpcData.from = 'Origin request'
const result = await uut.bchRouter(rpcData)
assert.equal(result, true)
})
it('should route to the broadcast method', async () => {
// Mock dependencies
sandbox.stub(uut, 'broadcast').resolves(true)
@@ -175,6 +194,63 @@ describe('#BCHRPC', () => {
assert.equal(result, true)
})
it('should route to the utxoIsValid method', async () => {
// Mock dependencies
sandbox.stub(uut, 'utxoIsValid').resolves(true)
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxoIsValid'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
rpcData.from = 'Origin request'
const result = await uut.bchRouter(rpcData)
assert.equal(result, true)
})
it('should route to the getTokenData method', async () => {
// Mock dependencies
sandbox.stub(uut, 'getTokenData').resolves(true)
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'getTokenData'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
rpcData.from = 'Origin request'
const result = await uut.bchRouter(rpcData)
assert.equal(result, true)
})
it('should route to the getTokenData2 method', async () => {
// Mock dependencies
sandbox.stub(uut, 'getTokenData2').resolves(true)
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'getTokenData2'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
rpcData.from = 'Origin request'
const result = await uut.bchRouter(rpcData)
assert.equal(result, true)
})
it('should return 500 status on routing issue', async () => {
// Mock dependencies
sandbox.stub(uut, 'txHistory').rejects(new Error('test error'))
@@ -301,7 +377,7 @@ describe('#BCHRPC', () => {
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxos',
addresses: 'testAddr'
address: 'testAddr'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
@@ -322,7 +398,7 @@ describe('#BCHRPC', () => {
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxos',
addresses: 'testAddr'
address: 'testAddr'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
@@ -337,6 +413,98 @@ describe('#BCHRPC', () => {
})
})
describe('#utxosBulk', () => {
it('should return UTXO data from bchjs for multiple addresses', async () => {
// Mock dependencies
sandbox.stub(uut.bchjs.Utxo, 'get').resolves({ success: true })
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxosBulk',
addresses: ['testAddr1', 'testAddr2']
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
const response = await uut.utxosBulk(rpcData)
// console.log('response: ', response)
assert.equal(response.success, true)
assert.equal(response.status, 200)
})
it('should return an error for invalid address', async () => {
// Force an error
sandbox.stub(uut.bchjs.Utxo, 'get').rejects(new Error('Invalid address'))
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxosBulk',
addresses: ['testAddr1', 'testAddr2']
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
const response = await uut.utxosBulk(rpcData)
// console.log('response: ', response)
assert.equal(response.success, false)
assert.equal(response.status, 422)
assert.equal(response.message, 'Invalid address')
assert.equal(response.endpoint, 'utxosBulk')
})
it('should throw error if input is not an array', async () => {
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxosBulk',
addresses: 'singleAddress'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
const response = await uut.utxosBulk(rpcData)
// console.log('response: ', response)
assert.equal(response.success, false)
assert.equal(response.status, 422)
assert.equal(response.message, 'addresses parameter must be an array')
assert.equal(response.endpoint, 'utxosBulk')
})
it('should throw error if input array is larger than 20 elements', async () => {
// Generate an array larger than 20 elements
const inputArray = []
for (let i = 0; i < 25; i++) {
inputArray.push(i)
}
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'utxosBulk',
addresses: inputArray
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
const response = await uut.utxosBulk(rpcData)
// console.log('response: ', response)
assert.equal(response.success, false)
assert.equal(response.status, 422)
assert.equal(response.message, 'addresses parameter must not exceed 20 elements')
assert.equal(response.endpoint, 'utxosBulk')
})
})
describe('#broadcast', () => {
it('should return data from bchjs', async () => {
// Mock dependencies
@@ -385,6 +553,32 @@ describe('#BCHRPC', () => {
assert.equal(response.message, 'Invalid data')
assert.equal(response.endpoint, 'broadcast')
})
it('should return an error if full node returns a string error', async () => {
// Force an error
sandbox
.stub(uut.bchjs.RawTransactions, 'sendRawTransaction')
// .rejects(new Error('Invalid data'))
.rejects({ error: 'Invalid data' })
// Generate the parsed data that the main router would pass to this
// endpoint.
const id = uid()
const rpcCall = jsonrpc.request(id, 'bch', {
endpoint: 'broadcast',
hex: 'testHex'
})
const jsonStr = JSON.stringify(rpcCall, null, 2)
const rpcData = jsonrpc.parse(jsonStr)
const response = await uut.broadcast(rpcData)
// console.log('response: ', response)
assert.equal(response.success, false)
assert.equal(response.status, 422)
assert.equal(response.message, 'Invalid data')
assert.equal(response.endpoint, 'broadcast')
})
})
describe('#txData', () => {
@@ -568,7 +762,8 @@ describe('#BCHRPC', () => {
// Mock dependencies
sandbox
.stub(uut.bchjs.Utxo, 'isValid')
.rejects(new Error('test error'))
// .rejects(new Error('test error'))
.rejects({ error: 'test error' })
const rpcData = {
payload: {
@@ -619,7 +814,8 @@ describe('#BCHRPC', () => {
// Mock dependencies
sandbox
.stub(uut.bchjs.PsfSlpIndexer, 'getTokenData')
.rejects(new Error('test error'))
// .rejects(new Error('test error'))
.rejects({ error: 'test error' })
const rpcData = {
payload: {
@@ -638,4 +834,53 @@ describe('#BCHRPC', () => {
assert.equal(result.endpoint, 'getTokenData')
})
})
describe('#getTokenData2', () => {
it('should return data from PsfSlpIndexer.getTokenData2()', async () => {
// Mock dependencies
sandbox
.stub(uut.bchjs.PsfSlpIndexer, 'getTokenData2')
.resolves({ a: 'b' })
const rpcData = {
payload: {
params: {
tokenId: 'c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d'
}
}
}
const result = await uut.getTokenData2(rpcData)
// console.log('result: ', result)
assert.equal(result.success, true)
assert.equal(result.status, 200)
assert.equal(result.endpoint, 'getTokenData2')
assert.property(result, 'tokenData')
})
it('should catch and return errors', async () => {
// Mock dependencies
sandbox
.stub(uut.bchjs.PsfSlpIndexer, 'getTokenData2')
// .rejects(new Error('test error'))
.rejects({ error: 'test error' })
const rpcData = {
payload: {
params: {
tokenId: 'c85042ab08a2099f27de880a30f9a42874202751d834c42717a20801a00aab0d'
}
}
}
const result = await uut.getTokenData2(rpcData)
// console.log('result: ', result)
assert.equal(result.success, false)
assert.equal(result.status, 422)
assert.equal(result.message, 'test error')
assert.equal(result.endpoint, 'getTokenData2')
})
})
})
+22
View File
@@ -55,6 +55,28 @@ describe('#server', () => {
// Not throwing an error is a success
})
it('should warn if user admin can not be created', async () => {
// Mock dependencies and force desired code path
sandbox.stub(uut.mongoose, 'connect').resolves()
sandbox.stub(uut.controllers, 'initAdapters').resolves()
sandbox.stub(uut.controllers, 'initUseCases').resolves()
sandbox.stub(uut.controllers, 'attachRESTControllers').resolves()
sandbox.stub(uut.adminLib, 'createSystemUser').rejects('test error')
sandbox.stub(uut.controllers, 'attachControllers').resolves()
uut.config.env = 'dev'
const result = await uut.startServer()
// console.log('result: ', result)
assert.property(result, 'env')
// Turn off the server.
uut.server.close()
// Restor config env
uut.config.env = 'test'
})
})
describe('#sleep', () => {
+21 -7
View File
@@ -2,12 +2,19 @@
Mocks for the Adapter library.
*/
const ipfs = {
ipfsAdapter: {
ipfs: {}
},
ipfsCoordAdapter: {
ipfsCoord: {
class IpfsAdapter {
constructor () {
this.ipfs = {
files: {
stat: () => {}
}
}
}
}
class IpfsCoordAdapter {
constructor () {
this.ipfsCoord = {
useCases: {
peer: {
sendPrivateMessage: () => {}
@@ -17,6 +24,12 @@ const ipfs = {
}
}
const ipfs = {
ipfsAdapter: new IpfsAdapter(),
ipfsCoordAdapter: new IpfsCoordAdapter()
}
ipfs.ipfs = ipfs.ipfsAdapter.ipfs
const localdb = {
Users: class Users {
static findById () {}
@@ -76,7 +89,8 @@ const bchjs = {
chunk100: () => {}
},
PsfSlpIndexer: {
getTokenData: () => {}
getTokenData: () => {},
getTokenData2: () => {}
}
}