@shapeshiftoss/caip 1.4.0 → 1.5.1
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/dist/adapters/coingecko/index.js +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/package.json +5 -3
|
@@ -18,15 +18,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
21
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
25
|
exports.CAIP19ToCoingecko = exports.coingeckoToCAIP19 = exports.url = void 0;
|
|
26
|
+
const toLower_1 = __importDefault(require("lodash/toLower"));
|
|
23
27
|
const adapters = __importStar(require("./generated"));
|
|
24
28
|
exports.url = 'https://api.coingecko.com/api/v3/coins/list?include_platform=true';
|
|
25
29
|
const generatedCAIP19ToCoingeckoMap = Object.values(adapters).reduce((acc, cur) => ({
|
|
26
30
|
...acc,
|
|
27
31
|
...cur
|
|
28
32
|
}));
|
|
29
|
-
const invert = (data) => Object.entries(data).reduce((acc, [k, v]) => (
|
|
33
|
+
const invert = (data) => Object.entries(data).reduce((acc, [k, v]) => ((acc[v] = k), acc), {});
|
|
30
34
|
const generatedCoingeckoToCAIP19Map = invert(generatedCAIP19ToCoingeckoMap);
|
|
31
35
|
const coingeckoToCAIP19 = (id) => {
|
|
32
36
|
const generated = generatedCoingeckoToCAIP19Map[id];
|
|
@@ -37,9 +41,9 @@ const coingeckoToCAIP19 = (id) => {
|
|
|
37
41
|
};
|
|
38
42
|
exports.coingeckoToCAIP19 = coingeckoToCAIP19;
|
|
39
43
|
const CAIP19ToCoingecko = (caip19) => {
|
|
40
|
-
const generated = generatedCAIP19ToCoingeckoMap[caip19];
|
|
44
|
+
const generated = generatedCAIP19ToCoingeckoMap[(0, toLower_1.default)(caip19)];
|
|
41
45
|
if (!generated) {
|
|
42
|
-
throw new Error(`CAIP19ToCoingecko: no id found for caip19 ${caip19}`);
|
|
46
|
+
throw new Error(`CAIP19ToCoingecko: no id found for caip19 ${(0, toLower_1.default)(caip19)}`);
|
|
43
47
|
}
|
|
44
48
|
return generated;
|
|
45
49
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,10 +19,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.caip19 = exports.caip2 = exports.adapters = void 0;
|
|
22
|
+
exports.fromCAIP19 = exports.caip19 = exports.caip2 = exports.adapters = void 0;
|
|
23
23
|
const adapters = __importStar(require("./adapters/coingecko"));
|
|
24
24
|
exports.adapters = adapters;
|
|
25
25
|
const caip2 = __importStar(require("./caip2/caip2"));
|
|
26
26
|
exports.caip2 = caip2;
|
|
27
27
|
const caip19 = __importStar(require("./caip19/caip19"));
|
|
28
28
|
exports.caip19 = caip19;
|
|
29
|
+
var caip19_1 = require("./caip19/caip19");
|
|
30
|
+
Object.defineProperty(exports, "fromCAIP19", { enumerable: true, get: function () { return caip19_1.fromCAIP19; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/caip",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "CAIP Implementation",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
"test": "jest test",
|
|
25
25
|
"type-check": "tsc --project ./tsconfig.json --noEmit"
|
|
26
26
|
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@shapeshiftoss/types": "^1.13.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
32
|
+
"@shapeshiftoss/types": "^1.13.1",
|
|
31
33
|
"axios": "^0.24.0"
|
|
32
34
|
}
|
|
33
35
|
}
|