@lombard.finance/sdk 3.6.3 → 3.6.5
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/README.md +26 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +54 -53
- package/dist/index2.cjs +9 -9
- package/dist/index2.js +205 -193
- package/package.json +1 -1
- package/src/index.ts +6 -1
- package/src/metrics/get-lbtc-apy.ts +28 -2
- package/src/metrics/get-positions-summary.ts +15 -18
- package/src/tokens/token-addresses.ts +1 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -35,7 +35,12 @@ export {
|
|
|
35
35
|
getPositionsSummary,
|
|
36
36
|
type PositionsSummary,
|
|
37
37
|
} from './metrics/get-positions-summary';
|
|
38
|
-
export {
|
|
38
|
+
export {
|
|
39
|
+
getApy,
|
|
40
|
+
type LbtcApy,
|
|
41
|
+
getEstimatedApy,
|
|
42
|
+
type LbtcEstimatedApy,
|
|
43
|
+
} from './metrics/get-lbtc-apy';
|
|
39
44
|
export {
|
|
40
45
|
getAdditionalRewards,
|
|
41
46
|
type RewardsDistribution,
|
|
@@ -43,5 +43,31 @@ export async function getApy({
|
|
|
43
43
|
return apy;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
type EstimatedApyResponse = { lbtc_estimated_apy: number };
|
|
47
|
+
export type LbtcEstimatedApy = {
|
|
48
|
+
/**
|
|
49
|
+
* The estimated APY for LBTC based on the specified partner context.
|
|
50
|
+
*
|
|
51
|
+
* This value reflects a projected annual percentage yield that may vary
|
|
52
|
+
* depending on the `partnerId`, taking into account potential partner-specific
|
|
53
|
+
* incentives, compounding assumptions, or estimated future rewards.
|
|
54
|
+
*/
|
|
55
|
+
estimatedApy: BigNumber;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Returns the estimated APY for LBTC. */
|
|
59
|
+
export async function getEstimatedApy({
|
|
60
|
+
partnerId,
|
|
61
|
+
env,
|
|
62
|
+
}: { partnerId?: string } & IEnvParam) {
|
|
63
|
+
const { baseApiUrl } = getApiConfig(env);
|
|
64
|
+
|
|
65
|
+
const url = `${baseApiUrl}/api/v1/analytics/estimated-apy?partner_id=${partnerId || ''}`;
|
|
66
|
+
const { data } = await axios.get<EstimatedApyResponse>(url);
|
|
67
|
+
|
|
68
|
+
const apy: LbtcEstimatedApy = {
|
|
69
|
+
estimatedApy: BigNumber(data.lbtc_estimated_apy),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return apy;
|
|
73
|
+
}
|
|
@@ -22,6 +22,7 @@ type Response = {
|
|
|
22
22
|
},
|
|
23
23
|
];
|
|
24
24
|
last_updated: string;
|
|
25
|
+
in_progress: boolean;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
function mapRewardAssetToToken(asset: PositionAsset) {
|
|
@@ -83,6 +84,19 @@ export type PositionsSummary = {
|
|
|
83
84
|
* The timestamp when the PnL data was last updated.
|
|
84
85
|
*/
|
|
85
86
|
lastUpdated: Date;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates whether the backend is currently processing the PnL calculation.
|
|
89
|
+
*
|
|
90
|
+
* - `true`: A new calculation request was received, but the backend is experiencing high load
|
|
91
|
+
* or processing is not yet complete. The latest data is not yet available.
|
|
92
|
+
*
|
|
93
|
+
* - `false`: The most recent calculation has been completed and cached.
|
|
94
|
+
* Use `lastUpdated` to understand how fresh the data is:
|
|
95
|
+
* - If `lastUpdated` is recent (e.g., within the last few seconds), you're seeing the latest data.
|
|
96
|
+
* - If `lastUpdated` is up to 30 minutes old, you're seeing cached data from a recent request.
|
|
97
|
+
* The backend avoids recalculating within this caching window.
|
|
98
|
+
*/
|
|
99
|
+
inProgress: boolean;
|
|
86
100
|
};
|
|
87
101
|
|
|
88
102
|
/** Retrieves the yield positions summary for the specified account address. */
|
|
@@ -110,25 +124,8 @@ export async function getPositionsSummary({
|
|
|
110
124
|
rate: BigNumber(ds.rate || 0),
|
|
111
125
|
})),
|
|
112
126
|
lastUpdated: new Date(data.last_updated),
|
|
127
|
+
inProgress: Boolean(data.in_progress),
|
|
113
128
|
};
|
|
114
129
|
|
|
115
130
|
return info;
|
|
116
131
|
}
|
|
117
|
-
|
|
118
|
-
// Response example:
|
|
119
|
-
// url: https://bft-dev.stage.lombard.finance/api/v1/analytics/0x2513196b4fD01Ed5888d1dB49AB9a42208E9fF90/summary
|
|
120
|
-
// {
|
|
121
|
-
// btc_price_usd: { price: 118395.552997, timestamp: '2025-07-23T11:01:59Z' },
|
|
122
|
-
// btc_value: 0.0003895271690089053,
|
|
123
|
-
// btc_pnl: 8.716900890527854e-8,
|
|
124
|
-
// snapshot: [
|
|
125
|
-
// {
|
|
126
|
-
// asset: 'ASSET_LBTC',
|
|
127
|
-
// type: 'BALANCE_TYPE_HOLDING',
|
|
128
|
-
// balance: 0.00038944,
|
|
129
|
-
// pnl: 8.716900890527854e-8,
|
|
130
|
-
// rate: 1.0002238316785776,
|
|
131
|
-
// },
|
|
132
|
-
// ],
|
|
133
|
-
// last_updated: '2025-07-23T11:38:52.516364988Z',
|
|
134
|
-
// }
|
|
@@ -39,6 +39,7 @@ export const TOKEN_ADDRESSES: TokenAddresses = {
|
|
|
39
39
|
[ChainId.berachain]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
40
40
|
[ChainId.binanceSmartChain]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
41
41
|
[ChainId.corn]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
42
|
+
[ChainId.etherlink]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
42
43
|
[ChainId.katana]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
43
44
|
[ChainId.morph]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
44
45
|
[ChainId.sonic]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|