@shapeshiftoss/caip 1.7.0 → 1.10.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/coincap/generated/{bip122:000000000019d6689c085ae165831e93 → bip122_000000000019d6689c085ae165831e93}/adapter.json +0 -0
- package/dist/adapters/coincap/generated/eip155_1/adapter.json +1 -0
- package/dist/adapters/coincap/generated/index.d.ts +2 -2
- package/dist/adapters/coincap/generated/index.js +2 -2
- package/dist/adapters/coincap/index.d.ts +2 -2
- package/dist/adapters/coincap/index.js +2 -14
- package/dist/adapters/coincap/utils.js +2 -5
- package/dist/adapters/coingecko/generated/{bip122:000000000019d6689c085ae165831e93 → bip122_000000000019d6689c085ae165831e93}/adapter.json +0 -0
- package/dist/adapters/coingecko/generated/eip155_1/adapter.json +1 -0
- package/dist/adapters/coingecko/generated/index.d.ts +2 -2
- package/dist/adapters/coingecko/generated/index.js +2 -2
- package/dist/adapters/coingecko/index.d.ts +2 -2
- package/dist/adapters/coingecko/index.js +2 -14
- package/dist/adapters/coingecko/utils.js +1 -1
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +1 -0
- package/dist/adapters/yearn/generate.d.ts +1 -0
- package/dist/adapters/yearn/generate.js +9 -0
- package/dist/adapters/yearn/generated/eip155_1/adapter.json +1 -0
- package/dist/adapters/yearn/generated/index.d.ts +2 -0
- package/dist/adapters/yearn/generated/index.js +8 -0
- package/dist/adapters/yearn/index.d.ts +2 -0
- package/dist/adapters/yearn/index.js +37 -0
- package/dist/adapters/yearn/utils.d.ts +7 -0
- package/dist/adapters/yearn/utils.js +56 -0
- package/package.json +4 -1
- package/dist/adapters/coincap/generated/eip155:1/adapter.json +0 -1
- package/dist/adapters/coingecko/generated/eip155:1/adapter.json +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import bip122 from './
|
|
2
|
-
import eip155 from './
|
|
1
|
+
import bip122 from './bip122_000000000019d6689c085ae165831e93/adapter.json';
|
|
2
|
+
import eip155 from './eip155_1/adapter.json';
|
|
3
3
|
export { bip122, eip155 };
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.eip155 = exports.bip122 = void 0;
|
|
7
|
-
const adapter_json_1 = __importDefault(require("./
|
|
7
|
+
const adapter_json_1 = __importDefault(require("./bip122_000000000019d6689c085ae165831e93/adapter.json"));
|
|
8
8
|
exports.bip122 = adapter_json_1.default;
|
|
9
|
-
const adapter_json_2 = __importDefault(require("./
|
|
9
|
+
const adapter_json_2 = __importDefault(require("./eip155_1/adapter.json"));
|
|
10
10
|
exports.eip155 = adapter_json_2.default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const coingeckoUrl = "https://api.coingecko.com/api/v3/coins/list?include_platform=true";
|
|
2
|
-
export declare const coingeckoToCAIP19: (id: string) => string;
|
|
3
|
-
export declare const CAIP19ToCoingecko: (caip19: string) => string;
|
|
2
|
+
export declare const coingeckoToCAIP19: (id: string) => string | undefined;
|
|
3
|
+
export declare const CAIP19ToCoingecko: (caip19: string) => string | undefined;
|
|
@@ -32,19 +32,7 @@ const generatedCAIP19ToCoingeckoMap = Object.values(adapters).reduce((acc, cur)
|
|
|
32
32
|
}));
|
|
33
33
|
const invert = (data) => Object.entries(data).reduce((acc, [k, v]) => ((acc[v] = k), acc), {});
|
|
34
34
|
const generatedCoingeckoToCAIP19Map = invert(generatedCAIP19ToCoingeckoMap);
|
|
35
|
-
const coingeckoToCAIP19 = (id) =>
|
|
36
|
-
const generated = generatedCoingeckoToCAIP19Map[id];
|
|
37
|
-
if (!generated) {
|
|
38
|
-
throw new Error(`coingeckoToCAIP19: no caip19 found for id ${id}`);
|
|
39
|
-
}
|
|
40
|
-
return generated;
|
|
41
|
-
};
|
|
35
|
+
const coingeckoToCAIP19 = (id) => generatedCoingeckoToCAIP19Map[id];
|
|
42
36
|
exports.coingeckoToCAIP19 = coingeckoToCAIP19;
|
|
43
|
-
const CAIP19ToCoingecko = (caip19) =>
|
|
44
|
-
const generated = generatedCAIP19ToCoingeckoMap[(0, toLower_1.default)(caip19)];
|
|
45
|
-
if (!generated) {
|
|
46
|
-
throw new Error(`CAIP19ToCoingecko: no id found for caip19 ${(0, toLower_1.default)(caip19)}`);
|
|
47
|
-
}
|
|
48
|
-
return generated;
|
|
49
|
-
};
|
|
37
|
+
const CAIP19ToCoingecko = (caip19) => generatedCAIP19ToCoingeckoMap[(0, toLower_1.default)(caip19)];
|
|
50
38
|
exports.CAIP19ToCoingecko = CAIP19ToCoingecko;
|
|
@@ -12,7 +12,7 @@ const caip19_1 = require("./../../caip19/caip19");
|
|
|
12
12
|
const writeFiles = async (data) => {
|
|
13
13
|
const path = './src/adapters/coingecko/generated/';
|
|
14
14
|
const file = '/adapter.json';
|
|
15
|
-
const writeFile = async ([k, v]) => await fs_1.default.promises.writeFile(`${path}${k}${file}
|
|
15
|
+
const writeFile = async ([k, v]) => await fs_1.default.promises.writeFile(`${path}${k}${file}`.replace(':', '_'), JSON.stringify(v));
|
|
16
16
|
await Promise.all(Object.entries(data).map(writeFile));
|
|
17
17
|
console.info('Generated CoinGecko CAIP19 adapter data.');
|
|
18
18
|
};
|
package/dist/adapters/index.d.ts
CHANGED
package/dist/adapters/index.js
CHANGED
|
@@ -12,3 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./coingecko"), exports);
|
|
14
14
|
__exportStar(require("./coincap"), exports);
|
|
15
|
+
__exportStar(require("./yearn"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
const main = async () => {
|
|
5
|
+
const data = await (0, utils_1.fetchData)();
|
|
6
|
+
const output = (0, utils_1.parseData)(data);
|
|
7
|
+
await (0, utils_1.writeFiles)(output);
|
|
8
|
+
};
|
|
9
|
+
main();
|