bitpay-rates 1.2.3 → 1.2.9
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 +6 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# bitpay-rates
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/bycolco/bitpay-rates)
|
|
4
3
|
[](https://bundlephobia.com/result?p=bitpay-rates)
|
|
5
4
|
[](https://bundlephobia.com/result?p=bitpay-rates)
|
|
6
5
|
|
|
@@ -19,7 +18,7 @@ Getting a rate by code
|
|
|
19
18
|
```js
|
|
20
19
|
import bitpayRates from 'bitpay-rates';
|
|
21
20
|
|
|
22
|
-
const code = '
|
|
21
|
+
const code = 'ARS'; // see list of codes bellow
|
|
23
22
|
|
|
24
23
|
// Using promise
|
|
25
24
|
const ratePromise = bitpayRates.get(code);
|
|
@@ -38,9 +37,9 @@ Successful response
|
|
|
38
37
|
|
|
39
38
|
```json
|
|
40
39
|
{
|
|
41
|
-
"code": "
|
|
42
|
-
"name": "
|
|
43
|
-
"rate":
|
|
40
|
+
"code": "ARS",
|
|
41
|
+
"name": "Argentine Peso",
|
|
42
|
+
"rate": 3793422.92
|
|
44
43
|
}
|
|
45
44
|
```
|
|
46
45
|
|
|
@@ -80,9 +79,9 @@ Successful response
|
|
|
80
79
|
]
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
## Available Codes (updated:
|
|
82
|
+
## Available Codes (updated: 2023-01-11)
|
|
84
83
|
|
|
85
|
-
[Follow this link](CODES.md
|
|
84
|
+
[Follow this link](CODES.md) to see the complete list of codes.
|
|
86
85
|
|
|
87
86
|
## Related Packages
|
|
88
87
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export type RateObj={code:string;name:string;rate:number;};export type RateResponse=RateObj|[RateObj];export type Callback=(error:Error|null,data?:RateResponse)=>void;export declare const get:(code?:string|Callback,callback?:Callback)=>Promise<RateResponse>|void;declare const _default:{get:(code?:string|Callback|undefined,callback?:Callback|undefined)=>void|Promise<RateResponse>;};export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __importDefault=(this&&this.__importDefault)||function(mod){return(mod&&mod.__esModule)?mod:{"default":mod};};Object.defineProperty(exports,"__esModule",{value:true});exports.get=void 0;const https_1=__importDefault(require("https"));const defaultOptions={host:'bitpay.com',path:'/rates',headers:{},agent:false,};const returnPromise=(options)=>{return new Promise((resolve,reject)=>{returnCallback(options,(err,data)=>{if(err)return reject(err);return resolve(data);});});};const returnCallback=(options,callback)=>{https_1.default.get(options,(res)=>{let dataBuffer='';res.on('data',(chunk)=>{dataBuffer+=chunk.toString('utf8');});res.on('end',()=>{try{const{data}=JSON.parse(dataBuffer);return callback(null,data);}catch(err){return callback(err);}});}).on('error',(err)=>{return callback(err);});};const get=(code,callback)=>{const options={...defaultOptions};if(typeof code==='string'){options.path+=`/${code.toUpperCase()}`;}if(typeof code==='function'){return returnCallback(options,code);}else if(callback){return returnCallback(options,callback);}else{return returnPromise(options);}};exports.get=get;exports.default={get:exports.get};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitpay-rates",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "A tiny NodeJS wrapper for the BitPay Rates API",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=10"
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
"countries",
|
|
13
13
|
"price"
|
|
14
14
|
],
|
|
15
|
-
"author": "Mario Colque <
|
|
15
|
+
"author": "Mario Colque <dev@colkito.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"main": "dist/index.js",
|
|
18
18
|
"types": "dist/index.d.ts",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/
|
|
21
|
+
"url": "https://github.com/colkito/bitpay-rates.git"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/colkito/bitpay-rates/issues"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://github.com/
|
|
26
|
+
"homepage": "https://github.com/colkito/bitpay-rates#readme",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"test": "jest",
|
|
29
29
|
"test:watch": "jest --watch",
|