lynx-client 0.0.25 → 0.0.27
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/cjs/lib/constants/pairIds.js +2 -0
- package/dist/cjs/lib/contractsIntegration/RateModelLensService/RateModelLensService.js +25 -17
- package/dist/cjs/lib/priceFeeds/pyth/pythFeedConstants.js +2 -0
- package/dist/cjs/lib/utils/ethersTypes.js +21 -7
- package/dist/esm/lib/constants/pairIds.d.ts +2 -1
- package/dist/esm/lib/constants/pairIds.d.ts.map +1 -1
- package/dist/esm/lib/constants/pairIds.js +2 -0
- package/dist/esm/lib/contractsIntegration/RateModelLensService/RateModelLensService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/RateModelLensService/RateModelLensService.js +25 -17
- package/dist/esm/lib/priceFeeds/pyth/pythFeedConstants.d.ts.map +1 -1
- package/dist/esm/lib/priceFeeds/pyth/pythFeedConstants.js +2 -0
- package/dist/esm/lib/utils/ethersTypes.d.ts +2 -2
- package/dist/esm/lib/utils/ethersTypes.d.ts.map +1 -1
- package/dist/esm/lib/utils/ethersTypes.js +21 -7
- package/dist/types/lib/constants/pairIds.d.ts +2 -1
- package/dist/types/lib/constants/pairIds.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/RateModelLensService/RateModelLensService.d.ts.map +1 -1
- package/dist/types/lib/priceFeeds/pyth/pythFeedConstants.d.ts.map +1 -1
- package/dist/types/lib/utils/ethersTypes.d.ts +2 -2
- package/dist/types/lib/utils/ethersTypes.d.ts.map +1 -1
- package/package.json +5 -2
|
@@ -11,6 +11,7 @@ exports.PAIR_CONFIGS_IDS = {
|
|
|
11
11
|
BNB_USD: 3,
|
|
12
12
|
FTM_USD: 4,
|
|
13
13
|
SOL_USD: 5,
|
|
14
|
+
XRP_USD: 6,
|
|
14
15
|
// CRYPTO -- Specific cases
|
|
15
16
|
FLR_USD: 1001,
|
|
16
17
|
// CRYPTO -- new version of previous pair
|
|
@@ -44,6 +45,7 @@ exports.PAIR_CONFIGS_IDENTIFIERS = {
|
|
|
44
45
|
BNB_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.BNB_USD, "BNB", "USD"),
|
|
45
46
|
FTM_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.FTM_USD, "FTM", "USD"),
|
|
46
47
|
SOL_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.SOL_USD, "SOL", "USD"),
|
|
48
|
+
XRP_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.XRP_USD, "XRP", "USD"),
|
|
47
49
|
// CRYPTO -- Specific cases
|
|
48
50
|
FLR_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.FLR_USD, "FLR", "USD"),
|
|
49
51
|
// CRYPTO -- new version of previous pair
|
|
@@ -4,16 +4,16 @@ exports.RateModelLensService = void 0;
|
|
|
4
4
|
const RateModelLens__factory_1 = require("../../typechain/factories/contracts/Peripheral/Lens/RateModelLens__factory");
|
|
5
5
|
const ethersTypes_1 = require("../../utils/ethersTypes");
|
|
6
6
|
const IRateModelLensService_1 = require("./IRateModelLensService");
|
|
7
|
-
|
|
8
|
-
const
|
|
7
|
+
const chipsCalculationsUtils_1 = require("../../lynxSystem/chipsCalculationsUtils");
|
|
8
|
+
const lynxScalesUtils_1 = require("../../lynxSystem/lynxScalesUtils");
|
|
9
9
|
// Helper functions for converting raw values to human-readable
|
|
10
10
|
function convertRateParamsToUnits(raw) {
|
|
11
11
|
return {
|
|
12
|
-
baseRateInUnits:
|
|
13
|
-
multiplierInUnits:
|
|
14
|
-
kink:
|
|
15
|
-
postKinkMultiplierInUnits:
|
|
16
|
-
rateOnKinkInUnits:
|
|
12
|
+
baseRateInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.baseRate),
|
|
13
|
+
multiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.multiplier),
|
|
14
|
+
kink: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.kink),
|
|
15
|
+
postKinkMultiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.postKinkMultiplier),
|
|
16
|
+
rateOnKinkInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.rateOnKink),
|
|
17
17
|
raw: {
|
|
18
18
|
baseRate: raw.baseRate,
|
|
19
19
|
multiplier: raw.multiplier,
|
|
@@ -25,11 +25,11 @@ function convertRateParamsToUnits(raw) {
|
|
|
25
25
|
}
|
|
26
26
|
function convertIRMRateParamsToUnits(raw) {
|
|
27
27
|
return {
|
|
28
|
-
baseRateInUnits:
|
|
29
|
-
multiplierInUnits:
|
|
30
|
-
kink:
|
|
31
|
-
postKinkMultiplierInUnits:
|
|
32
|
-
rateOnKinkInUnits:
|
|
28
|
+
baseRateInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.baseRate),
|
|
29
|
+
multiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.multiplier),
|
|
30
|
+
kink: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.kink),
|
|
31
|
+
postKinkMultiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.postKinkMultiplier),
|
|
32
|
+
rateOnKinkInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.rateOnKink),
|
|
33
33
|
raw: {
|
|
34
34
|
baseRate: raw.baseRate,
|
|
35
35
|
multiplier: raw.multiplier,
|
|
@@ -43,7 +43,7 @@ function convertAccountantConfig(raw) {
|
|
|
43
43
|
return {
|
|
44
44
|
accountant: raw.accountant,
|
|
45
45
|
lexPool: raw.lexPool,
|
|
46
|
-
minTotalOIForFundingInUnits:
|
|
46
|
+
minTotalOIForFundingInUnits: (0, chipsCalculationsUtils_1.chipsBnToUnits)(raw.minTotalOIForFunding),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
function convertPairSpecificParams(raw) {
|
|
@@ -68,7 +68,9 @@ class RateModelLensService {
|
|
|
68
68
|
const fundingRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.fundingRateModelGroups, IRateModelLensService_1.EMPTY_FUNDING_RATE_MODEL_GROUP_RAW, {
|
|
69
69
|
accountantConfigs: IRateModelLensService_1.EMPTY_FRM_ACCOUNTANT_CONFIG_RAW,
|
|
70
70
|
pairSpecificParams: IRateModelLensService_1.EMPTY_FRM_PAIR_SPECIFIC_PARAMS_RAW,
|
|
71
|
-
}
|
|
71
|
+
}, {
|
|
72
|
+
baseRateParams: IRateModelLensService_1.EMPTY_FRM_BASE_RATE_PARAMS_RAW,
|
|
73
|
+
}, ['lexPools', 'accountants']);
|
|
72
74
|
// Convert to human-readable
|
|
73
75
|
const fundingRateModelGroups = fundingRateModelGroupsRaw.map((group) => ({
|
|
74
76
|
fundingRateModel: group.fundingRateModel,
|
|
@@ -81,7 +83,9 @@ class RateModelLensService {
|
|
|
81
83
|
pairSpecificParams: group.pairSpecificParams.map(convertPairSpecificParams),
|
|
82
84
|
}));
|
|
83
85
|
// Convert interest rate model groups (raw)
|
|
84
|
-
const interestRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.interestRateModelGroups, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW
|
|
86
|
+
const interestRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.interestRateModelGroups, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW, {}, {
|
|
87
|
+
baseRateParams: IRateModelLensService_1.EMPTY_IRM_BASE_RATE_PARAMS_RAW,
|
|
88
|
+
}, ['lexPools', 'accountants']);
|
|
85
89
|
// Convert to human-readable
|
|
86
90
|
const interestRateModelGroups = interestRateModelGroupsRaw.map((group) => ({
|
|
87
91
|
interestRateModel: group.interestRateModel,
|
|
@@ -102,7 +106,9 @@ class RateModelLensService {
|
|
|
102
106
|
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_FUNDING_RATE_MODEL_GROUP_RAW, {
|
|
103
107
|
accountantConfigs: IRateModelLensService_1.EMPTY_FRM_ACCOUNTANT_CONFIG_RAW,
|
|
104
108
|
pairSpecificParams: IRateModelLensService_1.EMPTY_FRM_PAIR_SPECIFIC_PARAMS_RAW,
|
|
105
|
-
}
|
|
109
|
+
}, {
|
|
110
|
+
baseRateParams: IRateModelLensService_1.EMPTY_FRM_BASE_RATE_PARAMS_RAW,
|
|
111
|
+
}, ['lexPools', 'accountants']);
|
|
106
112
|
// Convert to human-readable
|
|
107
113
|
return rawGroups.map((group) => ({
|
|
108
114
|
fundingRateModel: group.fundingRateModel,
|
|
@@ -118,7 +124,9 @@ class RateModelLensService {
|
|
|
118
124
|
async getInterestRateModelGroups(lexPools) {
|
|
119
125
|
const result = await this.contract.getInterestRateModelGroups(lexPools);
|
|
120
126
|
// Convert to raw first
|
|
121
|
-
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW
|
|
127
|
+
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW, {}, {
|
|
128
|
+
baseRateParams: IRateModelLensService_1.EMPTY_IRM_BASE_RATE_PARAMS_RAW,
|
|
129
|
+
}, ['lexPools', 'accountants']);
|
|
122
130
|
// Convert to human-readable
|
|
123
131
|
return rawGroups.map((group) => ({
|
|
124
132
|
interestRateModel: group.interestRateModel,
|
|
@@ -8,6 +8,7 @@ exports.PYTH_PRICE_KEYS = {
|
|
|
8
8
|
[pairIds_1.PAIR_CONFIGS_IDS.BNB_USD]: "Crypto.BNB/USD",
|
|
9
9
|
[pairIds_1.PAIR_CONFIGS_IDS.FTM_USD]: "Crypto.FTM/USD",
|
|
10
10
|
[pairIds_1.PAIR_CONFIGS_IDS.SOL_USD]: "Crypto.SOL/USD",
|
|
11
|
+
[pairIds_1.PAIR_CONFIGS_IDS.XRP_USD]: "Crypto.XRP/USD",
|
|
11
12
|
[pairIds_1.PAIR_CONFIGS_IDS.FLR_USD]: "Crypto.FLR/USD",
|
|
12
13
|
[pairIds_1.PAIR_CONFIGS_IDS.S_USD]: "Crypto.S/USD",
|
|
13
14
|
// Forex
|
|
@@ -42,6 +43,7 @@ exports.PYTH_PAIRS_PRICE_FEED_IDS = {
|
|
|
42
43
|
// NOTE : Using S instead of deprecated FTM
|
|
43
44
|
[pairIds_1.PAIR_CONFIGS_IDS.FTM_USD]: "0xf490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d",
|
|
44
45
|
[pairIds_1.PAIR_CONFIGS_IDS.SOL_USD]: "0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d",
|
|
46
|
+
[pairIds_1.PAIR_CONFIGS_IDS.XRP_USD]: "0xec5d399846a9209f3fe5881d70aae9268c94339ff9817e8d18ff19fa05eea1c8",
|
|
45
47
|
[pairIds_1.PAIR_CONFIGS_IDS.S_USD]: "0xf490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d",
|
|
46
48
|
[pairIds_1.PAIR_CONFIGS_IDS.FLR_USD]: "0x035aa8d0a2d74e19438f2c1440edff9f3b95f915ca65f681a25ed0bad3dc228d",
|
|
47
49
|
[pairIds_1.PAIR_CONFIGS_IDS.EUR_USD]: "0xa995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b",
|
|
@@ -9,13 +9,18 @@ function ethersStructResponseToObject(ethersStructResponse,
|
|
|
9
9
|
// NOTE : This is needed due to changes in ethers 6 + typechain that returns weird proxy object for struct which
|
|
10
10
|
// makes it hard/impossible to get the proper keys of the intended type.
|
|
11
11
|
// TODO : Solve it if possible ?
|
|
12
|
-
emptyConcreteObject,
|
|
12
|
+
emptyConcreteObject = undefined,
|
|
13
13
|
// NOTE : This is needed because inner array's object's fields cannot be auto inferred (same as with the main object)
|
|
14
14
|
// TODO : Improve type to allow only keys found in the original object
|
|
15
|
-
innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}
|
|
15
|
+
innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {},
|
|
16
|
+
// Keys of arrays that contain primitive values (strings, numbers, etc.) rather than structs
|
|
17
|
+
primitiveArrayKeys = []) {
|
|
16
18
|
const obj = {};
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
+
// If no emptyConcreteObject provided, use keys from the response (filtering out numeric indices)
|
|
20
|
+
const keys = emptyConcreteObject
|
|
21
|
+
? Object.keys(emptyConcreteObject)
|
|
22
|
+
: Object.keys(ethersStructResponse).filter(key => Number.isNaN(parseInt(key)));
|
|
23
|
+
for (const key of keys) {
|
|
19
24
|
// DEV_NOTE : We assume that all numeric keys belongs to the array and ignore them
|
|
20
25
|
if (Number.isNaN(parseInt(key))) {
|
|
21
26
|
// @ts-ignore
|
|
@@ -43,7 +48,14 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
43
48
|
// @ts-ignore
|
|
44
49
|
obj[key] = [];
|
|
45
50
|
}
|
|
51
|
+
else if (primitiveArrayKeys.includes(key)) {
|
|
52
|
+
// Handle primitive arrays (strings, addresses, numbers, etc.)
|
|
53
|
+
// Convert ethers Result array to plain array of strings
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
obj[key] = Array.from(value).map(item => String(item));
|
|
56
|
+
}
|
|
46
57
|
else {
|
|
58
|
+
// Handle struct arrays (existing behavior)
|
|
47
59
|
const emptyObjectOfArray =
|
|
48
60
|
// @ts-ignore
|
|
49
61
|
innerArraysConcreteObjectMap[key] ?? {};
|
|
@@ -52,7 +64,9 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
52
64
|
// `@@@@ innerArraysConcreteObjectMap[key] ${innerArraysConcreteObjectMap[key]}`,
|
|
53
65
|
// );
|
|
54
66
|
// @ts-ignore
|
|
55
|
-
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray
|
|
67
|
+
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray,
|
|
68
|
+
// JSON.parse(stringifyObject(value[0] as object)),
|
|
69
|
+
{}, {}, primitiveArrayKeys);
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
72
|
else {
|
|
@@ -66,8 +80,8 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
66
80
|
}
|
|
67
81
|
return obj;
|
|
68
82
|
}
|
|
69
|
-
function ethersStructResponseToArray(ethersStructResponseArray, emptyConcreteObject, innerArraysConcreteObjectMap = {}) {
|
|
70
|
-
return ethersStructResponseArray.map((struct) => ethersStructResponseToObject(struct, emptyConcreteObject, innerArraysConcreteObjectMap));
|
|
83
|
+
function ethersStructResponseToArray(ethersStructResponseArray, emptyConcreteObject = undefined, innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}, primitiveArrayKeys = []) {
|
|
84
|
+
return ethersStructResponseArray.map((struct) => ethersStructResponseToObject(struct, emptyConcreteObject, innerArraysConcreteObjectMap, innerStructsConcreteObjectMap, primitiveArrayKeys));
|
|
71
85
|
}
|
|
72
86
|
function isFunction(functionToCheck) {
|
|
73
87
|
return (functionToCheck && {}.toString.call(functionToCheck) === "[object Function]");
|
|
@@ -11,6 +11,7 @@ export declare const PAIR_CONFIGS_IDS: {
|
|
|
11
11
|
readonly BNB_USD: 3;
|
|
12
12
|
readonly FTM_USD: 4;
|
|
13
13
|
readonly SOL_USD: 5;
|
|
14
|
+
readonly XRP_USD: 6;
|
|
14
15
|
readonly FLR_USD: 1001;
|
|
15
16
|
readonly S_USD: 2004;
|
|
16
17
|
readonly EUR_USD: 8001;
|
|
@@ -29,7 +30,7 @@ export declare const PAIR_CONFIGS_IDS: {
|
|
|
29
30
|
readonly USD_CHF_CAT: 18102;
|
|
30
31
|
};
|
|
31
32
|
export type TPairIds = (typeof PAIR_CONFIGS_IDS)[TKeysOfConst<typeof PAIR_CONFIGS_IDS>];
|
|
32
|
-
export type TPairConfigsNames = "BTC_USD" | "ETH_USD" | "BNB_USD" | "FTM_USD" | "SOL_USD" | "FLR_USD" | "S_USD" | "EUR_USD" | "GBP_USD" | "AUD_USD" | "NZD_USD" | "USD_JPY" | "USD_CHF" | "BTC_USD_CAT" | "ETH_USD_CAT" | "EUR_USD_CAT" | "GBP_USD_CAT" | "AUD_USD_CAT" | "NZD_USD_CAT" | "USD_JPY_CAT" | "USD_CHF_CAT";
|
|
33
|
+
export type TPairConfigsNames = "BTC_USD" | "ETH_USD" | "BNB_USD" | "FTM_USD" | "SOL_USD" | "XRP_USD" | "FLR_USD" | "S_USD" | "EUR_USD" | "GBP_USD" | "AUD_USD" | "NZD_USD" | "USD_JPY" | "USD_CHF" | "BTC_USD_CAT" | "ETH_USD_CAT" | "EUR_USD_CAT" | "GBP_USD_CAT" | "AUD_USD_CAT" | "NZD_USD_CAT" | "USD_JPY_CAT" | "USD_CHF_CAT";
|
|
33
34
|
export declare const PAIR_CONFIGS_IDENTIFIERS: Record<TPairConfigsNames, TPairConfigsIdentifier>;
|
|
34
35
|
export declare function getPairConfigsIdentifierFromPairId(pairId: TPairIds): TPairConfigsIdentifier | undefined;
|
|
35
36
|
export type TPairFromTo = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pairIds.d.ts","sourceRoot":"","sources":["../../../../lib/constants/pairIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"pairIds.d.ts","sourceRoot":"","sources":["../../../../lib/constants/pairIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CA2CnB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,YAAY,CAC3D,OAAO,gBAAgB,CACxB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,iBAAiB,EACjB,sBAAsB,CA0JvB,CAAC;AAwBF,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,QAAQ,GACf,sBAAsB,GAAG,SAAS,CAGpC;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAKtB,CAAC"}
|
|
@@ -11,6 +11,7 @@ exports.PAIR_CONFIGS_IDS = {
|
|
|
11
11
|
BNB_USD: 3,
|
|
12
12
|
FTM_USD: 4,
|
|
13
13
|
SOL_USD: 5,
|
|
14
|
+
XRP_USD: 6,
|
|
14
15
|
// CRYPTO -- Specific cases
|
|
15
16
|
FLR_USD: 1001,
|
|
16
17
|
// CRYPTO -- new version of previous pair
|
|
@@ -44,6 +45,7 @@ exports.PAIR_CONFIGS_IDENTIFIERS = {
|
|
|
44
45
|
BNB_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.BNB_USD, "BNB", "USD"),
|
|
45
46
|
FTM_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.FTM_USD, "FTM", "USD"),
|
|
46
47
|
SOL_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.SOL_USD, "SOL", "USD"),
|
|
48
|
+
XRP_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.XRP_USD, "XRP", "USD"),
|
|
47
49
|
// CRYPTO -- Specific cases
|
|
48
50
|
FLR_USD: buildCryptoPairConfigsIdentifier(groupIds_1.GROUP_CONFIGS_IDS.basicCryptoGroup, exports.PAIR_CONFIGS_IDS.FLR_USD, "FLR", "USD"),
|
|
49
51
|
// CRYPTO -- new version of previous pair
|
package/dist/esm/lib/contractsIntegration/RateModelLensService/RateModelLensService.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RateModelLensService.d.ts","sourceRoot":"","sources":["../../../../../lib/contractsIntegration/RateModelLensService/RateModelLensService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAA;AAMvF,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,
|
|
1
|
+
{"version":3,"file":"RateModelLensService.d.ts","sourceRoot":"","sources":["../../../../../lib/contractsIntegration/RateModelLensService/RateModelLensService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAA;AAMvF,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAY9B,MAAM,yBAAyB,CAAA;AAuDhC,qBAAa,oBAAqB,YAAW,qBAAqB;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAE5B,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EAAE,eAAe,EAAE,MAAM;IAOlE,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI5D,yBAAyB,CAC7B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,gCAAgC,CAAC;IA4DtC,yBAAyB,CAC7B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAgCpC,0BAA0B,CAC9B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAyB3C,WAAW,IAAI,aAAa;CAG7B"}
|
|
@@ -4,16 +4,16 @@ exports.RateModelLensService = void 0;
|
|
|
4
4
|
const RateModelLens__factory_1 = require("../../typechain/factories/contracts/Peripheral/Lens/RateModelLens__factory");
|
|
5
5
|
const ethersTypes_1 = require("../../utils/ethersTypes");
|
|
6
6
|
const IRateModelLensService_1 = require("./IRateModelLensService");
|
|
7
|
-
|
|
8
|
-
const
|
|
7
|
+
const chipsCalculationsUtils_1 = require("../../lynxSystem/chipsCalculationsUtils");
|
|
8
|
+
const lynxScalesUtils_1 = require("../../lynxSystem/lynxScalesUtils");
|
|
9
9
|
// Helper functions for converting raw values to human-readable
|
|
10
10
|
function convertRateParamsToUnits(raw) {
|
|
11
11
|
return {
|
|
12
|
-
baseRateInUnits:
|
|
13
|
-
multiplierInUnits:
|
|
14
|
-
kink:
|
|
15
|
-
postKinkMultiplierInUnits:
|
|
16
|
-
rateOnKinkInUnits:
|
|
12
|
+
baseRateInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.baseRate),
|
|
13
|
+
multiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.multiplier),
|
|
14
|
+
kink: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.kink),
|
|
15
|
+
postKinkMultiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.postKinkMultiplier),
|
|
16
|
+
rateOnKinkInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.rateOnKink),
|
|
17
17
|
raw: {
|
|
18
18
|
baseRate: raw.baseRate,
|
|
19
19
|
multiplier: raw.multiplier,
|
|
@@ -25,11 +25,11 @@ function convertRateParamsToUnits(raw) {
|
|
|
25
25
|
}
|
|
26
26
|
function convertIRMRateParamsToUnits(raw) {
|
|
27
27
|
return {
|
|
28
|
-
baseRateInUnits:
|
|
29
|
-
multiplierInUnits:
|
|
30
|
-
kink:
|
|
31
|
-
postKinkMultiplierInUnits:
|
|
32
|
-
rateOnKinkInUnits:
|
|
28
|
+
baseRateInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.baseRate),
|
|
29
|
+
multiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.multiplier),
|
|
30
|
+
kink: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.kink),
|
|
31
|
+
postKinkMultiplierInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.postKinkMultiplier),
|
|
32
|
+
rateOnKinkInUnits: (0, lynxScalesUtils_1.precisionBnToFloat)(raw.rateOnKink),
|
|
33
33
|
raw: {
|
|
34
34
|
baseRate: raw.baseRate,
|
|
35
35
|
multiplier: raw.multiplier,
|
|
@@ -43,7 +43,7 @@ function convertAccountantConfig(raw) {
|
|
|
43
43
|
return {
|
|
44
44
|
accountant: raw.accountant,
|
|
45
45
|
lexPool: raw.lexPool,
|
|
46
|
-
minTotalOIForFundingInUnits:
|
|
46
|
+
minTotalOIForFundingInUnits: (0, chipsCalculationsUtils_1.chipsBnToUnits)(raw.minTotalOIForFunding),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
function convertPairSpecificParams(raw) {
|
|
@@ -68,7 +68,9 @@ class RateModelLensService {
|
|
|
68
68
|
const fundingRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.fundingRateModelGroups, IRateModelLensService_1.EMPTY_FUNDING_RATE_MODEL_GROUP_RAW, {
|
|
69
69
|
accountantConfigs: IRateModelLensService_1.EMPTY_FRM_ACCOUNTANT_CONFIG_RAW,
|
|
70
70
|
pairSpecificParams: IRateModelLensService_1.EMPTY_FRM_PAIR_SPECIFIC_PARAMS_RAW,
|
|
71
|
-
}
|
|
71
|
+
}, {
|
|
72
|
+
baseRateParams: IRateModelLensService_1.EMPTY_FRM_BASE_RATE_PARAMS_RAW,
|
|
73
|
+
}, ['lexPools', 'accountants']);
|
|
72
74
|
// Convert to human-readable
|
|
73
75
|
const fundingRateModelGroups = fundingRateModelGroupsRaw.map((group) => ({
|
|
74
76
|
fundingRateModel: group.fundingRateModel,
|
|
@@ -81,7 +83,9 @@ class RateModelLensService {
|
|
|
81
83
|
pairSpecificParams: group.pairSpecificParams.map(convertPairSpecificParams),
|
|
82
84
|
}));
|
|
83
85
|
// Convert interest rate model groups (raw)
|
|
84
|
-
const interestRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.interestRateModelGroups, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW
|
|
86
|
+
const interestRateModelGroupsRaw = (0, ethersTypes_1.ethersStructResponseToArray)(result.interestRateModelGroups, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW, {}, {
|
|
87
|
+
baseRateParams: IRateModelLensService_1.EMPTY_IRM_BASE_RATE_PARAMS_RAW,
|
|
88
|
+
}, ['lexPools', 'accountants']);
|
|
85
89
|
// Convert to human-readable
|
|
86
90
|
const interestRateModelGroups = interestRateModelGroupsRaw.map((group) => ({
|
|
87
91
|
interestRateModel: group.interestRateModel,
|
|
@@ -102,7 +106,9 @@ class RateModelLensService {
|
|
|
102
106
|
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_FUNDING_RATE_MODEL_GROUP_RAW, {
|
|
103
107
|
accountantConfigs: IRateModelLensService_1.EMPTY_FRM_ACCOUNTANT_CONFIG_RAW,
|
|
104
108
|
pairSpecificParams: IRateModelLensService_1.EMPTY_FRM_PAIR_SPECIFIC_PARAMS_RAW,
|
|
105
|
-
}
|
|
109
|
+
}, {
|
|
110
|
+
baseRateParams: IRateModelLensService_1.EMPTY_FRM_BASE_RATE_PARAMS_RAW,
|
|
111
|
+
}, ['lexPools', 'accountants']);
|
|
106
112
|
// Convert to human-readable
|
|
107
113
|
return rawGroups.map((group) => ({
|
|
108
114
|
fundingRateModel: group.fundingRateModel,
|
|
@@ -118,7 +124,9 @@ class RateModelLensService {
|
|
|
118
124
|
async getInterestRateModelGroups(lexPools) {
|
|
119
125
|
const result = await this.contract.getInterestRateModelGroups(lexPools);
|
|
120
126
|
// Convert to raw first
|
|
121
|
-
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW
|
|
127
|
+
const rawGroups = (0, ethersTypes_1.ethersStructResponseToArray)(result, IRateModelLensService_1.EMPTY_INTEREST_RATE_MODEL_GROUP_RAW, {}, {
|
|
128
|
+
baseRateParams: IRateModelLensService_1.EMPTY_IRM_BASE_RATE_PARAMS_RAW,
|
|
129
|
+
}, ['lexPools', 'accountants']);
|
|
122
130
|
// Convert to human-readable
|
|
123
131
|
return rawGroups.map((group) => ({
|
|
124
132
|
interestRateModel: group.interestRateModel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythFeedConstants.d.ts","sourceRoot":"","sources":["../../../../../lib/priceFeeds/pyth/pythFeedConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pythFeedConstants.d.ts","sourceRoot":"","sources":["../../../../../lib/priceFeeds/pyth/pythFeedConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAgCpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAKjD,CAAC;AAGH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAyC9D,CAAC"}
|
|
@@ -8,6 +8,7 @@ exports.PYTH_PRICE_KEYS = {
|
|
|
8
8
|
[pairIds_1.PAIR_CONFIGS_IDS.BNB_USD]: "Crypto.BNB/USD",
|
|
9
9
|
[pairIds_1.PAIR_CONFIGS_IDS.FTM_USD]: "Crypto.FTM/USD",
|
|
10
10
|
[pairIds_1.PAIR_CONFIGS_IDS.SOL_USD]: "Crypto.SOL/USD",
|
|
11
|
+
[pairIds_1.PAIR_CONFIGS_IDS.XRP_USD]: "Crypto.XRP/USD",
|
|
11
12
|
[pairIds_1.PAIR_CONFIGS_IDS.FLR_USD]: "Crypto.FLR/USD",
|
|
12
13
|
[pairIds_1.PAIR_CONFIGS_IDS.S_USD]: "Crypto.S/USD",
|
|
13
14
|
// Forex
|
|
@@ -42,6 +43,7 @@ exports.PYTH_PAIRS_PRICE_FEED_IDS = {
|
|
|
42
43
|
// NOTE : Using S instead of deprecated FTM
|
|
43
44
|
[pairIds_1.PAIR_CONFIGS_IDS.FTM_USD]: "0xf490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d",
|
|
44
45
|
[pairIds_1.PAIR_CONFIGS_IDS.SOL_USD]: "0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d",
|
|
46
|
+
[pairIds_1.PAIR_CONFIGS_IDS.XRP_USD]: "0xec5d399846a9209f3fe5881d70aae9268c94339ff9817e8d18ff19fa05eea1c8",
|
|
45
47
|
[pairIds_1.PAIR_CONFIGS_IDS.S_USD]: "0xf490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d",
|
|
46
48
|
[pairIds_1.PAIR_CONFIGS_IDS.FLR_USD]: "0x035aa8d0a2d74e19438f2c1440edff9f3b95f915ca65f681a25ed0bad3dc228d",
|
|
47
49
|
[pairIds_1.PAIR_CONFIGS_IDS.EUR_USD]: "0xa995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b",
|
|
@@ -9,6 +9,6 @@ export type TSafeBigNumberStruct<T extends object> = {
|
|
|
9
9
|
/**
|
|
10
10
|
* This functions takes a tuple returned from an 'ethers' contract object and returns it in a pure object form.
|
|
11
11
|
*/
|
|
12
|
-
export declare function ethersStructResponseToObject<T extends object>(ethersStructResponse: object, emptyConcreteObject
|
|
13
|
-
export declare function ethersStructResponseToArray<T extends object>(ethersStructResponseArray: object[], emptyConcreteObject
|
|
12
|
+
export declare function ethersStructResponseToObject<T extends object>(ethersStructResponse: object, emptyConcreteObject?: T | undefined, innerArraysConcreteObjectMap?: object, innerStructsConcreteObjectMap?: object, primitiveArrayKeys?: string[]): T;
|
|
13
|
+
export declare function ethersStructResponseToArray<T extends object>(ethersStructResponseArray: object[], emptyConcreteObject?: T | undefined, innerArraysConcreteObjectMap?: object, innerStructsConcreteObjectMap?: object, primitiveArrayKeys?: string[]): T[];
|
|
14
14
|
//# sourceMappingURL=ethersTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACzC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACxC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACzC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACxC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAG9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAE1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,CA2EH;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,yBAAyB,EAAE,MAAM,EAAE,EACnC,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAC9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAC1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,EAAE,CAUL"}
|
|
@@ -9,13 +9,18 @@ function ethersStructResponseToObject(ethersStructResponse,
|
|
|
9
9
|
// NOTE : This is needed due to changes in ethers 6 + typechain that returns weird proxy object for struct which
|
|
10
10
|
// makes it hard/impossible to get the proper keys of the intended type.
|
|
11
11
|
// TODO : Solve it if possible ?
|
|
12
|
-
emptyConcreteObject,
|
|
12
|
+
emptyConcreteObject = undefined,
|
|
13
13
|
// NOTE : This is needed because inner array's object's fields cannot be auto inferred (same as with the main object)
|
|
14
14
|
// TODO : Improve type to allow only keys found in the original object
|
|
15
|
-
innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}
|
|
15
|
+
innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {},
|
|
16
|
+
// Keys of arrays that contain primitive values (strings, numbers, etc.) rather than structs
|
|
17
|
+
primitiveArrayKeys = []) {
|
|
16
18
|
const obj = {};
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
+
// If no emptyConcreteObject provided, use keys from the response (filtering out numeric indices)
|
|
20
|
+
const keys = emptyConcreteObject
|
|
21
|
+
? Object.keys(emptyConcreteObject)
|
|
22
|
+
: Object.keys(ethersStructResponse).filter(key => Number.isNaN(parseInt(key)));
|
|
23
|
+
for (const key of keys) {
|
|
19
24
|
// DEV_NOTE : We assume that all numeric keys belongs to the array and ignore them
|
|
20
25
|
if (Number.isNaN(parseInt(key))) {
|
|
21
26
|
// @ts-ignore
|
|
@@ -43,7 +48,14 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
43
48
|
// @ts-ignore
|
|
44
49
|
obj[key] = [];
|
|
45
50
|
}
|
|
51
|
+
else if (primitiveArrayKeys.includes(key)) {
|
|
52
|
+
// Handle primitive arrays (strings, addresses, numbers, etc.)
|
|
53
|
+
// Convert ethers Result array to plain array of strings
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
obj[key] = Array.from(value).map(item => String(item));
|
|
56
|
+
}
|
|
46
57
|
else {
|
|
58
|
+
// Handle struct arrays (existing behavior)
|
|
47
59
|
const emptyObjectOfArray =
|
|
48
60
|
// @ts-ignore
|
|
49
61
|
innerArraysConcreteObjectMap[key] ?? {};
|
|
@@ -52,7 +64,9 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
52
64
|
// `@@@@ innerArraysConcreteObjectMap[key] ${innerArraysConcreteObjectMap[key]}`,
|
|
53
65
|
// );
|
|
54
66
|
// @ts-ignore
|
|
55
|
-
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray
|
|
67
|
+
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray,
|
|
68
|
+
// JSON.parse(stringifyObject(value[0] as object)),
|
|
69
|
+
{}, {}, primitiveArrayKeys);
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
72
|
else {
|
|
@@ -66,8 +80,8 @@ innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}) {
|
|
|
66
80
|
}
|
|
67
81
|
return obj;
|
|
68
82
|
}
|
|
69
|
-
function ethersStructResponseToArray(ethersStructResponseArray, emptyConcreteObject, innerArraysConcreteObjectMap = {}) {
|
|
70
|
-
return ethersStructResponseArray.map((struct) => ethersStructResponseToObject(struct, emptyConcreteObject, innerArraysConcreteObjectMap));
|
|
83
|
+
function ethersStructResponseToArray(ethersStructResponseArray, emptyConcreteObject = undefined, innerArraysConcreteObjectMap = {}, innerStructsConcreteObjectMap = {}, primitiveArrayKeys = []) {
|
|
84
|
+
return ethersStructResponseArray.map((struct) => ethersStructResponseToObject(struct, emptyConcreteObject, innerArraysConcreteObjectMap, innerStructsConcreteObjectMap, primitiveArrayKeys));
|
|
71
85
|
}
|
|
72
86
|
function isFunction(functionToCheck) {
|
|
73
87
|
return (functionToCheck && {}.toString.call(functionToCheck) === "[object Function]");
|
|
@@ -11,6 +11,7 @@ export declare const PAIR_CONFIGS_IDS: {
|
|
|
11
11
|
readonly BNB_USD: 3;
|
|
12
12
|
readonly FTM_USD: 4;
|
|
13
13
|
readonly SOL_USD: 5;
|
|
14
|
+
readonly XRP_USD: 6;
|
|
14
15
|
readonly FLR_USD: 1001;
|
|
15
16
|
readonly S_USD: 2004;
|
|
16
17
|
readonly EUR_USD: 8001;
|
|
@@ -29,7 +30,7 @@ export declare const PAIR_CONFIGS_IDS: {
|
|
|
29
30
|
readonly USD_CHF_CAT: 18102;
|
|
30
31
|
};
|
|
31
32
|
export type TPairIds = (typeof PAIR_CONFIGS_IDS)[TKeysOfConst<typeof PAIR_CONFIGS_IDS>];
|
|
32
|
-
export type TPairConfigsNames = "BTC_USD" | "ETH_USD" | "BNB_USD" | "FTM_USD" | "SOL_USD" | "FLR_USD" | "S_USD" | "EUR_USD" | "GBP_USD" | "AUD_USD" | "NZD_USD" | "USD_JPY" | "USD_CHF" | "BTC_USD_CAT" | "ETH_USD_CAT" | "EUR_USD_CAT" | "GBP_USD_CAT" | "AUD_USD_CAT" | "NZD_USD_CAT" | "USD_JPY_CAT" | "USD_CHF_CAT";
|
|
33
|
+
export type TPairConfigsNames = "BTC_USD" | "ETH_USD" | "BNB_USD" | "FTM_USD" | "SOL_USD" | "XRP_USD" | "FLR_USD" | "S_USD" | "EUR_USD" | "GBP_USD" | "AUD_USD" | "NZD_USD" | "USD_JPY" | "USD_CHF" | "BTC_USD_CAT" | "ETH_USD_CAT" | "EUR_USD_CAT" | "GBP_USD_CAT" | "AUD_USD_CAT" | "NZD_USD_CAT" | "USD_JPY_CAT" | "USD_CHF_CAT";
|
|
33
34
|
export declare const PAIR_CONFIGS_IDENTIFIERS: Record<TPairConfigsNames, TPairConfigsIdentifier>;
|
|
34
35
|
export declare function getPairConfigsIdentifierFromPairId(pairId: TPairIds): TPairConfigsIdentifier | undefined;
|
|
35
36
|
export type TPairFromTo = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pairIds.d.ts","sourceRoot":"","sources":["../../../../lib/constants/pairIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"pairIds.d.ts","sourceRoot":"","sources":["../../../../lib/constants/pairIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CA2CnB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,YAAY,CAC3D,OAAO,gBAAgB,CACxB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,iBAAiB,EACjB,sBAAsB,CA0JvB,CAAC;AAwBF,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,QAAQ,GACf,sBAAsB,GAAG,SAAS,CAGpC;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAKtB,CAAC"}
|
package/dist/types/lib/contractsIntegration/RateModelLensService/RateModelLensService.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RateModelLensService.d.ts","sourceRoot":"","sources":["../../../../../lib/contractsIntegration/RateModelLensService/RateModelLensService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAA;AAMvF,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,
|
|
1
|
+
{"version":3,"file":"RateModelLensService.d.ts","sourceRoot":"","sources":["../../../../../lib/contractsIntegration/RateModelLensService/RateModelLensService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAA;AAMvF,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAY9B,MAAM,yBAAyB,CAAA;AAuDhC,qBAAa,oBAAqB,YAAW,qBAAqB;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAE5B,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EAAE,eAAe,EAAE,MAAM;IAOlE,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI5D,yBAAyB,CAC7B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,gCAAgC,CAAC;IA4DtC,yBAAyB,CAC7B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAgCpC,0BAA0B,CAC9B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAyB3C,WAAW,IAAI,aAAa;CAG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythFeedConstants.d.ts","sourceRoot":"","sources":["../../../../../lib/priceFeeds/pyth/pythFeedConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pythFeedConstants.d.ts","sourceRoot":"","sources":["../../../../../lib/priceFeeds/pyth/pythFeedConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAgCpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAKjD,CAAC;AAGH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAyC9D,CAAC"}
|
|
@@ -9,6 +9,6 @@ export type TSafeBigNumberStruct<T extends object> = {
|
|
|
9
9
|
/**
|
|
10
10
|
* This functions takes a tuple returned from an 'ethers' contract object and returns it in a pure object form.
|
|
11
11
|
*/
|
|
12
|
-
export declare function ethersStructResponseToObject<T extends object>(ethersStructResponse: object, emptyConcreteObject
|
|
13
|
-
export declare function ethersStructResponseToArray<T extends object>(ethersStructResponseArray: object[], emptyConcreteObject
|
|
12
|
+
export declare function ethersStructResponseToObject<T extends object>(ethersStructResponse: object, emptyConcreteObject?: T | undefined, innerArraysConcreteObjectMap?: object, innerStructsConcreteObjectMap?: object, primitiveArrayKeys?: string[]): T;
|
|
13
|
+
export declare function ethersStructResponseToArray<T extends object>(ethersStructResponseArray: object[], emptyConcreteObject?: T | undefined, innerArraysConcreteObjectMap?: object, innerStructsConcreteObjectMap?: object, primitiveArrayKeys?: string[]): T[];
|
|
14
14
|
//# sourceMappingURL=ethersTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACzC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACxC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACzC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACxC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAG9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAE1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,CA2EH;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,yBAAyB,EAAE,MAAM,EAAE,EACnC,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAC9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAC1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,EAAE,CAUL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lynx-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "Client library for interacting with Lynx publicly available services",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
24
24
|
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
25
25
|
"prepublishOnly": "npm run build",
|
|
26
|
-
"test": "jest"
|
|
26
|
+
"test": "jest",
|
|
27
|
+
"test:rate-model-lens": "tsx scripts/testRateModelLens.ts"
|
|
27
28
|
},
|
|
28
29
|
"repository": {
|
|
29
30
|
"type": "git",
|
|
@@ -37,9 +38,11 @@
|
|
|
37
38
|
"homepage": "https://github.com/lynx-protocol/lynx-client#readme",
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/jest": "^30.0.0",
|
|
41
|
+
"@types/node": "^22.0.0",
|
|
40
42
|
"jest": "^30.1.3",
|
|
41
43
|
"prettier": "^3.6.2",
|
|
42
44
|
"ts-jest": "^29.4.1",
|
|
45
|
+
"tsx": "^4.19.2",
|
|
43
46
|
"typescript": "^5.9.2"
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|