bitpay-rates 1.2.10 → 1.2.11
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/README.md +13 -23
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
[](https://bundlephobia.com/result?p=bitpay-rates)
|
|
4
4
|
[](https://bundlephobia.com/result?p=bitpay-rates)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
A lightweight Node.js wrapper for [BitPay's](https://bitpay.com/rates) exchange rates API, now in TypeScript.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Zero-dependency, `promise` and `callback` support for easy integration into your project. ✨
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
12
|
-
- nodejs >=
|
|
12
|
+
- nodejs >= 12.x
|
|
13
13
|
|
|
14
14
|
## Examples
|
|
15
15
|
|
|
16
|
-
Getting a rate by code
|
|
16
|
+
Getting a rate by `code`:
|
|
17
17
|
|
|
18
18
|
```js
|
|
19
19
|
import bitpayRates from 'bitpay-rates';
|
|
@@ -21,19 +21,13 @@ import bitpayRates from 'bitpay-rates';
|
|
|
21
21
|
const code = 'ARS'; // see list of codes bellow
|
|
22
22
|
|
|
23
23
|
// Using promise
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
bitpayRates
|
|
25
|
+
.get(code)
|
|
26
26
|
.then((rate) => console.log('Promise Rate:', rate))
|
|
27
|
-
.catch((err) => console.
|
|
28
|
-
|
|
29
|
-
// Using callback
|
|
30
|
-
bitpayRates.get(code, (err, res) => {
|
|
31
|
-
console.log('Callback Error:', err);
|
|
32
|
-
console.log('Callback Rate:', res);
|
|
33
|
-
});
|
|
27
|
+
.catch((err) => console.error('Promise Error:', err));
|
|
34
28
|
```
|
|
35
29
|
|
|
36
|
-
Successful response
|
|
30
|
+
Successful response:
|
|
37
31
|
|
|
38
32
|
```json
|
|
39
33
|
{
|
|
@@ -43,25 +37,19 @@ Successful response
|
|
|
43
37
|
}
|
|
44
38
|
```
|
|
45
39
|
|
|
46
|
-
Getting all the rates
|
|
40
|
+
Getting `all` the rates:
|
|
47
41
|
|
|
48
42
|
```js
|
|
49
43
|
import bitpayRates from 'bitpay-rates';
|
|
50
44
|
|
|
51
|
-
// Using promise
|
|
52
|
-
const ratesPromise = bitpayRates.get();
|
|
53
|
-
ratesPromise
|
|
54
|
-
.then((rates) => console.log('Promise Rates:', rates))
|
|
55
|
-
.catch((err) => console.log('Promise Error:', err));
|
|
56
|
-
|
|
57
45
|
// Using callback
|
|
58
46
|
bitpayRates.get((err, res) => {
|
|
59
|
-
console.
|
|
47
|
+
console.error('Callback Error:', err);
|
|
60
48
|
console.log('Callback Rates:', res);
|
|
61
49
|
});
|
|
62
50
|
```
|
|
63
51
|
|
|
64
|
-
Successful response
|
|
52
|
+
Successful response:
|
|
65
53
|
|
|
66
54
|
```json
|
|
67
55
|
[
|
|
@@ -79,6 +67,8 @@ Successful response
|
|
|
79
67
|
]
|
|
80
68
|
```
|
|
81
69
|
|
|
70
|
+
More examples [here](example/rates-example.js).
|
|
71
|
+
|
|
82
72
|
## Available Codes (updated: 2023-01-11)
|
|
83
73
|
|
|
84
74
|
[Follow this link](CODES.md) to see the complete list of codes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitpay-rates",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"description": "A tiny NodeJS wrapper for the BitPay Rates API",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=10"
|
|
@@ -34,9 +34,7 @@
|
|
|
34
34
|
"minify": "jsmin -l 3 -o dist/index.js dist/index.js",
|
|
35
35
|
"minifyDeclarations": "jsmin -l 3 -o dist/index.d.ts dist/index.d.ts",
|
|
36
36
|
"prepublishOnly": "npm test && npm run lint && npm run build",
|
|
37
|
-
"preversion": "npm run lint"
|
|
38
|
-
"version": "npm run format && git add -A src",
|
|
39
|
-
"postversion": "git push && git push --tags"
|
|
37
|
+
"preversion": "npm run lint && npm run format"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
40
|
"@types/jest": "^26.0.21",
|