@psf/bch-js 4.20.26 → 4.20.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -1
- package/package.json +1 -1
- package/src/address.js +3 -3
- package/src/crypto.js +3 -3
- package/src/electrumx.js +2 -2
- package/src/price.js +5 -5
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
Copyright 2021
|
|
1
|
+
Copyright 2021 Permissionless Software Foundation contributors
|
|
2
2
|
|
|
3
3
|
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:
|
|
4
4
|
|
|
5
5
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software
|
|
6
6
|
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
+
|
package/package.json
CHANGED
package/src/address.js
CHANGED
|
@@ -223,7 +223,7 @@ class Address {
|
|
|
223
223
|
* @api Address.hash160ToCash() hash160ToCash()
|
|
224
224
|
* @apiName hash160ToCash
|
|
225
225
|
* @apiGroup Address
|
|
226
|
-
* @apiDescription Convert hash160 to cash address.
|
|
226
|
+
* @apiDescription Convert hash160 to cash address. Accepts either hexadecimal or buffer.
|
|
227
227
|
*
|
|
228
228
|
* @apiExample Example usage:
|
|
229
229
|
* bchjs.Address.hash160ToCash("573d93b475be4f1925f3b74ed951201b0147eac1")
|
|
@@ -794,13 +794,13 @@ class Address {
|
|
|
794
794
|
* @apiDescription Detect an addess from an OutputScript..
|
|
795
795
|
*
|
|
796
796
|
* @apiExample Example usage:
|
|
797
|
-
* const
|
|
797
|
+
* const scriptBuffer = bchjs.Script.encode([
|
|
798
798
|
* Buffer.from("BOX", "ascii"),
|
|
799
799
|
* bchjs.Script.opcodes.OP_CAT,
|
|
800
800
|
* Buffer.from("BITBOX", "ascii"),
|
|
801
801
|
* bchjs.Script.opcodes.OP_EQUAL
|
|
802
802
|
* ]);
|
|
803
|
-
* const p2sh_hash160 = bchjs.Crypto.hash160(
|
|
803
|
+
* const p2sh_hash160 = bchjs.Crypto.hash160(scriptBuffer);
|
|
804
804
|
* const scriptPubKey = bchjs.Script.scriptHash.output.encode(p2sh_hash160);
|
|
805
805
|
*
|
|
806
806
|
* // mainnet address from output script
|
package/src/crypto.js
CHANGED
|
@@ -22,7 +22,7 @@ class Crypto {
|
|
|
22
22
|
* // buffer from hex
|
|
23
23
|
* let buffer = Buffer.from('03123464075c7a5fa6b8680afa2c962a02e7bf071c6b2395b0ac711d462cac9354', 'hex')
|
|
24
24
|
* bchjs.Crypto.sha256(buffer)
|
|
25
|
-
* // <Buffer
|
|
25
|
+
* // <Buffer 97 8c 09 dd 46 09 1d 19 22 fa 01 e9 f4 a9 75 b9 1a 37 1f 26 ba 83 99 de 27 d5 38 01 15 21 21 de>
|
|
26
26
|
*
|
|
27
27
|
* */
|
|
28
28
|
// Translate address from any address format into a specific format.
|
|
@@ -60,7 +60,7 @@ class Crypto {
|
|
|
60
60
|
* @api Crypto.hash256() hash256()
|
|
61
61
|
* @apiName hash256
|
|
62
62
|
* @apiGroup Crypto
|
|
63
|
-
* @apiDescription Utility for creating double sha256 hash digests of data.
|
|
63
|
+
* @apiDescription Utility for creating double sha256 hash digests of buffer encoded data.
|
|
64
64
|
*
|
|
65
65
|
* @apiExample Example usage:
|
|
66
66
|
* // buffer from hex
|
|
@@ -86,7 +86,7 @@ class Crypto {
|
|
|
86
86
|
* @api Crypto.hash160() hash160()
|
|
87
87
|
* @apiName hash160
|
|
88
88
|
* @apiGroup Crypto
|
|
89
|
-
* @apiDescription Utility for creating ripemd160(sha256()) hash digests of data.
|
|
89
|
+
* @apiDescription Utility for creating ripemd160(sha256()) hash digests of buffer encoded data.
|
|
90
90
|
*
|
|
91
91
|
* @apiExample Example usage:
|
|
92
92
|
* // buffer from hex
|
package/src/electrumx.js
CHANGED
|
@@ -142,7 +142,7 @@ class ElectrumX {
|
|
|
142
142
|
* (async () => {
|
|
143
143
|
* try {
|
|
144
144
|
* let balance = await bchjs.Electrumx.balance('bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf');
|
|
145
|
-
* console.log(
|
|
145
|
+
* console.log(balance);
|
|
146
146
|
* } catch(error) {
|
|
147
147
|
* console.error(error)
|
|
148
148
|
* }
|
|
@@ -159,7 +159,7 @@ class ElectrumX {
|
|
|
159
159
|
* (async () => {
|
|
160
160
|
* try {
|
|
161
161
|
* let balance = await bchjs.Electrumx.balance(['bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf', 'bitcoincash:qpdh9s677ya8tnx7zdhfrn8qfyvy22wj4qa7nwqa5v']);
|
|
162
|
-
* console.log(
|
|
162
|
+
* console.log(balance);
|
|
163
163
|
* } catch(error) {
|
|
164
164
|
* console.error(error)
|
|
165
165
|
* }
|
package/src/price.js
CHANGED
|
@@ -58,7 +58,7 @@ class Price {
|
|
|
58
58
|
* let current = await bchjs.Price.getUsd();
|
|
59
59
|
* console.log(current);
|
|
60
60
|
* } catch(err) {
|
|
61
|
-
* console.
|
|
61
|
+
* console.error(err)
|
|
62
62
|
* }
|
|
63
63
|
*})()
|
|
64
64
|
*
|
|
@@ -94,7 +94,7 @@ class Price {
|
|
|
94
94
|
* let current = await bchjs.Price.rates();
|
|
95
95
|
* console.log(current);
|
|
96
96
|
* } catch(err) {
|
|
97
|
-
* console.
|
|
97
|
+
* console.error(err)
|
|
98
98
|
* }
|
|
99
99
|
*})()
|
|
100
100
|
*
|
|
@@ -137,7 +137,7 @@ class Price {
|
|
|
137
137
|
* let current = await bchjs.Price.getBchaUsd();
|
|
138
138
|
* console.log(current);
|
|
139
139
|
* } catch(err) {
|
|
140
|
-
* console.
|
|
140
|
+
* console.error(err)
|
|
141
141
|
* }
|
|
142
142
|
*})()
|
|
143
143
|
*
|
|
@@ -175,7 +175,7 @@ class Price {
|
|
|
175
175
|
* let current = await bchjs.Price.getXecUsd();
|
|
176
176
|
* console.log(current);
|
|
177
177
|
* } catch(err) {
|
|
178
|
-
* console.
|
|
178
|
+
* console.error(err)
|
|
179
179
|
* }
|
|
180
180
|
*})()
|
|
181
181
|
*
|
|
@@ -210,7 +210,7 @@ class Price {
|
|
|
210
210
|
* let current = await bchjs.Price.getBchUsd();
|
|
211
211
|
* console.log(current);
|
|
212
212
|
* } catch(err) {
|
|
213
|
-
* console.
|
|
213
|
+
* console.error(err)
|
|
214
214
|
* }
|
|
215
215
|
*})()
|
|
216
216
|
*
|