@1delta/data-sdk 0.0.3 → 0.0.4
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/chains.d.ts +52 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -17
- package/dist/index.mjs +27 -17
- package/dist/lending.d.ts +1 -1
- package/package.json +1 -1
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
type L2ChainInfo = {
|
|
2
|
+
type: string;
|
|
3
|
+
chain: string;
|
|
4
|
+
bridges?: {
|
|
5
|
+
url: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
interface ChainInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
chain: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
icon?: string;
|
|
13
|
+
rpc: string[];
|
|
14
|
+
features?: {
|
|
15
|
+
name: string;
|
|
16
|
+
}[];
|
|
17
|
+
faucets: string[];
|
|
18
|
+
nativeCurrency: {
|
|
19
|
+
name: string;
|
|
20
|
+
symbol: string;
|
|
21
|
+
decimals: number;
|
|
22
|
+
};
|
|
23
|
+
infoURL: string;
|
|
24
|
+
shortName: string;
|
|
25
|
+
key?: string;
|
|
26
|
+
chainId: string;
|
|
27
|
+
networkId: string;
|
|
28
|
+
slip44?: number;
|
|
29
|
+
ens?: {
|
|
30
|
+
registry: string;
|
|
31
|
+
};
|
|
32
|
+
explorers: {
|
|
33
|
+
name: string;
|
|
34
|
+
url: string;
|
|
35
|
+
icon?: string;
|
|
36
|
+
standard: string;
|
|
37
|
+
}[];
|
|
38
|
+
enum: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
parent?: L2ChainInfo;
|
|
41
|
+
redFlags?: string[];
|
|
42
|
+
}
|
|
43
|
+
/** chainId -> ChainInfo */
|
|
44
|
+
type ChainInfoMap = {
|
|
45
|
+
[chainId: string]: ChainInfo;
|
|
46
|
+
};
|
|
47
|
+
/** Override datas used in the SDK - works across all module instances */
|
|
48
|
+
export declare function initializeChainData({ chainsOverride }: {
|
|
49
|
+
chainsOverride?: ChainInfoMap;
|
|
50
|
+
}): void;
|
|
51
|
+
export declare const chains: () => ChainInfoMap;
|
|
52
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
var
|
|
3
|
+
// src/chains.ts
|
|
4
|
+
var GLOBAL_CHAIN_DATA_KEY = "__1delta_chain_registry__";
|
|
5
5
|
function getGlobalData() {
|
|
6
|
-
return globalThis[
|
|
6
|
+
return globalThis[GLOBAL_CHAIN_DATA_KEY];
|
|
7
|
+
}
|
|
8
|
+
function initializeChainData({ chainsOverride }) {
|
|
9
|
+
if (chainsOverride) globalThis[GLOBAL_CHAIN_DATA_KEY] = chainsOverride;
|
|
10
|
+
}
|
|
11
|
+
var chains = () => getGlobalData();
|
|
12
|
+
|
|
13
|
+
// src/lending.ts
|
|
14
|
+
var GLOBAL_LENDER_DATA_KEY = "__1delta_lender_registry__";
|
|
15
|
+
function getGlobalData2() {
|
|
16
|
+
return globalThis[GLOBAL_LENDER_DATA_KEY];
|
|
7
17
|
}
|
|
8
|
-
function
|
|
18
|
+
function initializeLenderData({
|
|
9
19
|
aaveTokensOverride,
|
|
10
20
|
aavePoolsOverride,
|
|
11
21
|
compoundV3PoolsOverride,
|
|
@@ -18,7 +28,7 @@ function initializeData({
|
|
|
18
28
|
compoundV3ReservesOverride,
|
|
19
29
|
compoundV2ReservesOverride
|
|
20
30
|
}) {
|
|
21
|
-
const data =
|
|
31
|
+
const data = getGlobalData2();
|
|
22
32
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
23
33
|
if (aavePoolsOverride) data.aavePools = aavePoolsOverride;
|
|
24
34
|
if (compoundV3PoolsOverride) data.compoundV3Pools = compoundV3PoolsOverride;
|
|
@@ -31,21 +41,22 @@ function initializeData({
|
|
|
31
41
|
if (compoundV3ReservesOverride) data.compoundV3Reserves = compoundV3ReservesOverride;
|
|
32
42
|
if (compoundV2ReservesOverride) data.compoundV2Reserves = compoundV2ReservesOverride;
|
|
33
43
|
}
|
|
34
|
-
var aaveTokens = () =>
|
|
35
|
-
var aavePools = () =>
|
|
36
|
-
var aaveReserves = () =>
|
|
37
|
-
var compoundV3Reserves = () =>
|
|
38
|
-
var compoundV2Reserves = () =>
|
|
39
|
-
var compoundV3Pools = () =>
|
|
40
|
-
var morphoPools = () =>
|
|
41
|
-
var compoundV3BaseData = () =>
|
|
42
|
-
var compoundV2Pools = () =>
|
|
43
|
-
var compoundV2Tokens = () =>
|
|
44
|
-
var initConfig = () =>
|
|
44
|
+
var aaveTokens = () => getGlobalData2().aaveTokens;
|
|
45
|
+
var aavePools = () => getGlobalData2().aavePools;
|
|
46
|
+
var aaveReserves = () => getGlobalData2().aaveReserves;
|
|
47
|
+
var compoundV3Reserves = () => getGlobalData2().compoundV3Reserves;
|
|
48
|
+
var compoundV2Reserves = () => getGlobalData2().compoundV2Reserves;
|
|
49
|
+
var compoundV3Pools = () => getGlobalData2().compoundV3Pools;
|
|
50
|
+
var morphoPools = () => getGlobalData2().morphoPools;
|
|
51
|
+
var compoundV3BaseData = () => getGlobalData2().compoundV3BaseData;
|
|
52
|
+
var compoundV2Pools = () => getGlobalData2().compoundV2Pools;
|
|
53
|
+
var compoundV2Tokens = () => getGlobalData2().compoundV2Tokens;
|
|
54
|
+
var initConfig = () => getGlobalData2().initConfig;
|
|
45
55
|
|
|
46
56
|
exports.aavePools = aavePools;
|
|
47
57
|
exports.aaveReserves = aaveReserves;
|
|
48
58
|
exports.aaveTokens = aaveTokens;
|
|
59
|
+
exports.chains = chains;
|
|
49
60
|
exports.compoundV2Pools = compoundV2Pools;
|
|
50
61
|
exports.compoundV2Reserves = compoundV2Reserves;
|
|
51
62
|
exports.compoundV2Tokens = compoundV2Tokens;
|
|
@@ -53,5 +64,6 @@ exports.compoundV3BaseData = compoundV3BaseData;
|
|
|
53
64
|
exports.compoundV3Pools = compoundV3Pools;
|
|
54
65
|
exports.compoundV3Reserves = compoundV3Reserves;
|
|
55
66
|
exports.initConfig = initConfig;
|
|
56
|
-
exports.
|
|
67
|
+
exports.initializeChainData = initializeChainData;
|
|
68
|
+
exports.initializeLenderData = initializeLenderData;
|
|
57
69
|
exports.morphoPools = morphoPools;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var
|
|
1
|
+
// src/chains.ts
|
|
2
|
+
var GLOBAL_CHAIN_DATA_KEY = "__1delta_chain_registry__";
|
|
3
3
|
function getGlobalData() {
|
|
4
|
-
return globalThis[
|
|
4
|
+
return globalThis[GLOBAL_CHAIN_DATA_KEY];
|
|
5
|
+
}
|
|
6
|
+
function initializeChainData({ chainsOverride }) {
|
|
7
|
+
if (chainsOverride) globalThis[GLOBAL_CHAIN_DATA_KEY] = chainsOverride;
|
|
8
|
+
}
|
|
9
|
+
var chains = () => getGlobalData();
|
|
10
|
+
|
|
11
|
+
// src/lending.ts
|
|
12
|
+
var GLOBAL_LENDER_DATA_KEY = "__1delta_lender_registry__";
|
|
13
|
+
function getGlobalData2() {
|
|
14
|
+
return globalThis[GLOBAL_LENDER_DATA_KEY];
|
|
5
15
|
}
|
|
6
|
-
function
|
|
16
|
+
function initializeLenderData({
|
|
7
17
|
aaveTokensOverride,
|
|
8
18
|
aavePoolsOverride,
|
|
9
19
|
compoundV3PoolsOverride,
|
|
@@ -16,7 +26,7 @@ function initializeData({
|
|
|
16
26
|
compoundV3ReservesOverride,
|
|
17
27
|
compoundV2ReservesOverride
|
|
18
28
|
}) {
|
|
19
|
-
const data =
|
|
29
|
+
const data = getGlobalData2();
|
|
20
30
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
21
31
|
if (aavePoolsOverride) data.aavePools = aavePoolsOverride;
|
|
22
32
|
if (compoundV3PoolsOverride) data.compoundV3Pools = compoundV3PoolsOverride;
|
|
@@ -29,16 +39,16 @@ function initializeData({
|
|
|
29
39
|
if (compoundV3ReservesOverride) data.compoundV3Reserves = compoundV3ReservesOverride;
|
|
30
40
|
if (compoundV2ReservesOverride) data.compoundV2Reserves = compoundV2ReservesOverride;
|
|
31
41
|
}
|
|
32
|
-
var aaveTokens = () =>
|
|
33
|
-
var aavePools = () =>
|
|
34
|
-
var aaveReserves = () =>
|
|
35
|
-
var compoundV3Reserves = () =>
|
|
36
|
-
var compoundV2Reserves = () =>
|
|
37
|
-
var compoundV3Pools = () =>
|
|
38
|
-
var morphoPools = () =>
|
|
39
|
-
var compoundV3BaseData = () =>
|
|
40
|
-
var compoundV2Pools = () =>
|
|
41
|
-
var compoundV2Tokens = () =>
|
|
42
|
-
var initConfig = () =>
|
|
42
|
+
var aaveTokens = () => getGlobalData2().aaveTokens;
|
|
43
|
+
var aavePools = () => getGlobalData2().aavePools;
|
|
44
|
+
var aaveReserves = () => getGlobalData2().aaveReserves;
|
|
45
|
+
var compoundV3Reserves = () => getGlobalData2().compoundV3Reserves;
|
|
46
|
+
var compoundV2Reserves = () => getGlobalData2().compoundV2Reserves;
|
|
47
|
+
var compoundV3Pools = () => getGlobalData2().compoundV3Pools;
|
|
48
|
+
var morphoPools = () => getGlobalData2().morphoPools;
|
|
49
|
+
var compoundV3BaseData = () => getGlobalData2().compoundV3BaseData;
|
|
50
|
+
var compoundV2Pools = () => getGlobalData2().compoundV2Pools;
|
|
51
|
+
var compoundV2Tokens = () => getGlobalData2().compoundV2Tokens;
|
|
52
|
+
var initConfig = () => getGlobalData2().initConfig;
|
|
43
53
|
|
|
44
|
-
export { aavePools, aaveReserves, aaveTokens, compoundV2Pools, compoundV2Reserves, compoundV2Tokens, compoundV3BaseData, compoundV3Pools, compoundV3Reserves, initConfig,
|
|
54
|
+
export { aavePools, aaveReserves, aaveTokens, chains, compoundV2Pools, compoundV2Reserves, compoundV2Tokens, compoundV3BaseData, compoundV3Pools, compoundV3Reserves, initConfig, initializeChainData, initializeLenderData, morphoPools };
|
package/dist/lending.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ type InitConfigType = {
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
/** Override datas used in the SDK - works across all module instances */
|
|
81
|
-
export declare function
|
|
81
|
+
export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOverride, compoundV3PoolsOverride, compoundV3BaseDataOverride, morphoPoolsOverride, compoundV2TokensOverride, compoundV2PoolsOverride, initConfigOverride, aaveReservesOverride, compoundV3ReservesOverride, compoundV2ReservesOverride, }: {
|
|
82
82
|
aaveTokensOverride?: AaveTokensType;
|
|
83
83
|
aavePoolsOverride?: AavePoolsType;
|
|
84
84
|
compoundV3PoolsOverride?: CompoundV3PoolsType;
|