@shapeshiftoss/caip 1.9.0 → 1.10.0
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.
|
@@ -25,13 +25,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.CAIP19ToYearn = exports.yearnToCAIP19 = void 0;
|
|
26
26
|
const toLower_1 = __importDefault(require("lodash/toLower"));
|
|
27
27
|
const adapters = __importStar(require("./generated"));
|
|
28
|
-
const
|
|
28
|
+
const generatedCAIP19ToYearnMap = Object.values(adapters).reduce((acc, cur) => ({
|
|
29
29
|
...acc,
|
|
30
30
|
...cur
|
|
31
31
|
}));
|
|
32
32
|
const invert = (data) => Object.entries(data).reduce((acc, [k, v]) => ((acc[v] = k), acc), {});
|
|
33
|
-
const
|
|
34
|
-
const yearnToCAIP19 = (id) =>
|
|
33
|
+
const generatedYearnToCAIP19Map = invert(generatedCAIP19ToYearnMap);
|
|
34
|
+
const yearnToCAIP19 = (id) => generatedYearnToCAIP19Map[id];
|
|
35
35
|
exports.yearnToCAIP19 = yearnToCAIP19;
|
|
36
|
-
const CAIP19ToYearn = (caip19) =>
|
|
36
|
+
const CAIP19ToYearn = (caip19) => generatedCAIP19ToYearnMap[(0, toLower_1.default)(caip19)];
|
|
37
37
|
exports.CAIP19ToYearn = CAIP19ToYearn;
|
|
@@ -12,9 +12,9 @@ const toLower_1 = __importDefault(require("lodash/toLower"));
|
|
|
12
12
|
const uniqBy_1 = __importDefault(require("lodash/uniqBy"));
|
|
13
13
|
const caip2_1 = require("../../caip2/caip2");
|
|
14
14
|
const caip19_1 = require("./../../caip19/caip19");
|
|
15
|
-
//
|
|
15
|
+
const network = 1; // 1 for mainnet
|
|
16
16
|
const provider = new providers_1.JsonRpcProvider(process.env.REACT_APP_UNCHAINED_ETHEREUM_HTTP_URL);
|
|
17
|
-
const yearnSdk = new sdk_1.Yearn(
|
|
17
|
+
const yearnSdk = new sdk_1.Yearn(network, { provider, disableAllowlist: true });
|
|
18
18
|
const writeFiles = async (data) => {
|
|
19
19
|
const path = './src/adapters/yearn/generated/';
|
|
20
20
|
const file = '/adapter.json';
|
|
@@ -37,13 +37,12 @@ const fetchData = async () => {
|
|
|
37
37
|
exports.fetchData = fetchData;
|
|
38
38
|
const parseEthData = (data) => {
|
|
39
39
|
const chain = types_1.ChainTypes.Ethereum;
|
|
40
|
-
const network = types_1.NetworkTypes.MAINNET;
|
|
41
40
|
const contractType = types_1.ContractTypes.ERC20;
|
|
42
41
|
const result = data.reduce((acc, datum) => {
|
|
43
42
|
const { address } = datum;
|
|
44
43
|
const id = address;
|
|
45
44
|
const tokenId = (0, toLower_1.default)(address);
|
|
46
|
-
const caip19 = (0, caip19_1.toCAIP19)({ chain, network, contractType, tokenId });
|
|
45
|
+
const caip19 = (0, caip19_1.toCAIP19)({ chain, network: types_1.NetworkTypes.MAINNET, contractType, tokenId });
|
|
47
46
|
acc[caip19] = id;
|
|
48
47
|
return acc;
|
|
49
48
|
}, {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/caip",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "CAIP Implementation",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@shapeshiftoss/types": "^1.13.1",
|
|
36
|
-
"@yfi/sdk": "^1.0.
|
|
36
|
+
"@yfi/sdk": "^1.0.27",
|
|
37
37
|
"axios": "^0.24.0"
|
|
38
38
|
}
|
|
39
39
|
}
|