@xoxno/sdk-js 1.0.224 → 1.0.226
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 +39 -0
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/read/__tests__/client.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/read/client.d.ts +19 -0
- package/dist/cjs/sdk/stellar/read/index.d.ts +4 -0
- package/dist/cjs/sdk/stellar/read/schemas.d.ts +370 -0
- package/dist/cjs/sdk/stellar/read/types.d.ts +83 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/sdk/index.js +198 -0
- package/dist/esm/sdk/stellar/admin.js +385 -0
- package/dist/esm/sdk/stellar/auth-policy.js +310 -0
- package/dist/esm/sdk/stellar/cctp.js +23 -0
- package/dist/esm/sdk/stellar/contracts.js +49 -0
- package/dist/esm/sdk/stellar/events/decode.js +415 -0
- package/dist/esm/sdk/stellar/events/id.js +62 -0
- package/dist/esm/sdk/stellar/events/index.js +2 -0
- package/dist/esm/sdk/stellar/governance.js +403 -0
- package/dist/esm/sdk/stellar/index.js +26 -0
- package/dist/esm/sdk/stellar/lending-api-types.js +3 -0
- package/dist/esm/sdk/stellar/lending-read-types.js +1 -0
- package/dist/esm/sdk/stellar/lending-read.js +341 -0
- package/dist/esm/sdk/stellar/lending.js +358 -0
- package/dist/esm/sdk/stellar/math/account.js +256 -0
- package/dist/esm/sdk/stellar/math/index.js +11 -0
- package/dist/esm/sdk/stellar/math/limits.js +273 -0
- package/dist/esm/sdk/stellar/math/projection.js +130 -0
- package/dist/esm/sdk/stellar/math/rates.js +62 -0
- package/dist/esm/sdk/stellar/math/scaled.js +156 -0
- package/dist/esm/sdk/stellar/position-mode.js +11 -0
- package/dist/esm/sdk/stellar/prepare.js +47 -0
- package/dist/esm/sdk/stellar/quote.js +87 -0
- package/dist/esm/sdk/stellar/read/client.js +82 -0
- package/dist/esm/sdk/stellar/read/index.js +3 -0
- package/dist/esm/sdk/stellar/read/schemas.js +158 -0
- package/dist/esm/sdk/stellar/read/types.js +1 -0
- package/dist/esm/sdk/stellar/repay-swap.js +12 -0
- package/dist/esm/sdk/stellar/route-verify.js +285 -0
- package/dist/esm/sdk/stellar/scval-encode.js +464 -0
- package/dist/esm/sdk/stellar/swap-history.js +46 -0
- package/dist/esm/sdk/stellar/swap-index.js +1 -0
- package/dist/esm/sdk/stellar/swap.js +117 -0
- package/dist/esm/sdk/stellar/xdr-compat.js +17 -0
- package/dist/esm/sdk/stellar-schema.js +129 -0
- package/dist/esm/sdk/swagger.js +1957 -0
- package/dist/esm/sdk/types.js +1 -0
- package/dist/esm/sdk/utils.js +21 -0
- package/dist/esm/utils/api.js +169 -0
- package/dist/esm/utils/const.js +11 -0
- package/dist/esm/utils/errors.js +20 -0
- package/dist/esm/utils/guards.js +29 -0
- package/dist/esm/utils/helpers.js +20 -0
- package/dist/esm/utils/regex.js +14 -0
- package/dist/esm/utils/soroban-errors.js +149 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -2
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.d.ts +1 -0
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/read/__tests__/client.test.d.ts +1 -0
- package/dist/sdk/stellar/read/client.d.ts +19 -0
- package/dist/sdk/stellar/read/index.cjs +1 -0
- package/dist/sdk/stellar/read/index.d.ts +4 -0
- package/dist/sdk/stellar/read/index.esm.js +1 -0
- package/dist/sdk/stellar/read/schemas.d.ts +370 -0
- package/dist/sdk/stellar/read/types.d.ts +83 -0
- package/package.json +20 -4
- package/dist/index.esm.js.LICENSE.txt +0 -8
package/README.md
CHANGED
|
@@ -8,10 +8,49 @@ npm install @xoxno/sdk-js
|
|
|
8
8
|
|
|
9
9
|
## Basic usage
|
|
10
10
|
|
|
11
|
+
For render-ready Stellar lending data in browsers or React Native, use the
|
|
12
|
+
read subpath. It has no Stellar, MultiversX or Node runtime imports:
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { createStellarLendingReadClient } from '@xoxno/sdk-js/stellar-lending/read'
|
|
16
|
+
|
|
17
|
+
const lending = createStellarLendingReadClient({ baseUrl: 'https://api.xoxno.com' })
|
|
18
|
+
const assets = await lending.assets({ usage: 'collateral' })
|
|
19
|
+
const positions = await lending.positions(owner)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`baseUrl` selects the API deployment, which must expose the new
|
|
23
|
+
`/stellar-lending/v1` read routes. Supply `fetch` if the host has no global
|
|
24
|
+
implementation. Both methods accept `signal`; positions follows every `Link`
|
|
25
|
+
page, including empty pages. APYs are fractions, raw amounts are exact integer
|
|
26
|
+
token base-unit strings, and unavailable data stays null. Capacities are indexed
|
|
27
|
+
estimates; prepare/simulate before signing. Public response types and inline
|
|
28
|
+
OpenAPI schemas are exported from the same subpath.
|
|
29
|
+
|
|
30
|
+
The Stellar peer is optional for REST reads. Install `@stellar/stellar-sdk`
|
|
31
|
+
when using transaction builders, RPC reads or swap decoders.
|
|
32
|
+
|
|
11
33
|
For Stellar lending, start with the [integration guide](md/stellar-lending.md)
|
|
12
34
|
and [checked example](examples/stellar-lending.ts). They cover typed market
|
|
13
35
|
discovery and unsigned XDR preparation, wallet signing, submission and confirmation.
|
|
14
36
|
Generate focused API documentation with `npm run docs:stellar`.
|
|
37
|
+
Decode direct XOXNO swap history synchronously with
|
|
38
|
+
`decodeStellarSwapEnvelope` from `@xoxno/sdk-js/stellar-swap`:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { decodeStellarSwapEnvelope } from '@xoxno/sdk-js/stellar-swap'
|
|
42
|
+
|
|
43
|
+
const swap = decodeStellarSwapEnvelope({
|
|
44
|
+
envelopeXdr, networkPassphrase, routerAddress, viewer, operationIndex,
|
|
45
|
+
})
|
|
46
|
+
// swap: { tokenIn, tokenOut, amountInAtoms, operationIndex } | null
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Pin `routerAddress` for the selected network. Fee bumps use inner operation
|
|
50
|
+
indices; omit the index only when there is one matching swap. The input amount
|
|
51
|
+
is an exact base-unit string. Actual output must come from ledger effects;
|
|
52
|
+
the route minimum is not the received amount. This decoder makes no network requests.
|
|
53
|
+
|
|
15
54
|
`XOXNOClient` requires an application-supplied `apiUrl`; the SDK does not read
|
|
16
55
|
environment variables or select an API deployment for you.
|
|
17
56
|
For Stellar infrastructure, use the exported `STELLAR_NETWORKS` manifest and
|
|
@@ -9,6 +9,7 @@ export type { OurRequestInit, XOXNOClientOptions } from '../../utils/api.js';
|
|
|
9
9
|
export * from './contracts.js';
|
|
10
10
|
export * from './lending.js';
|
|
11
11
|
export * from './lending-read.js';
|
|
12
|
+
export * from './read/index.js';
|
|
12
13
|
export * from './admin.js';
|
|
13
14
|
export * from './governance.js';
|
|
14
15
|
export * from './events/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LendingAsset, LendingAssetUsage, LendingPosition } from './types.js';
|
|
2
|
+
export interface StellarLendingReadClientOptions {
|
|
3
|
+
/** API root, for example https://api.xoxno.com. May include a deployment prefix. */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Inject the host's fetch implementation when unavailable globally; it must honor redirect: 'error'. */
|
|
6
|
+
fetch?: typeof globalThis.fetch;
|
|
7
|
+
}
|
|
8
|
+
export interface StellarLendingReadOptions {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
export interface StellarLendingReadClient {
|
|
12
|
+
/** Omitted usage defaults to collateral on the API. */
|
|
13
|
+
assets(options?: StellarLendingReadOptions & {
|
|
14
|
+
usage?: LendingAssetUsage;
|
|
15
|
+
}): Promise<LendingAsset[]>;
|
|
16
|
+
/** Collect every page, including a next link on an empty page. */
|
|
17
|
+
positions(owner: string, options?: StellarLendingReadOptions): Promise<LendingPosition[]>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createStellarLendingReadClient(options: StellarLendingReadClientOptions): StellarLendingReadClient;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/** OpenAPI response schema for LendingPosition[]. Every property is required; nullable data remains explicit. */
|
|
2
|
+
export declare const lendingPositionsSchema: {
|
|
3
|
+
type: "array";
|
|
4
|
+
items: {
|
|
5
|
+
type: "object";
|
|
6
|
+
required: string[];
|
|
7
|
+
properties: {
|
|
8
|
+
accountId: {
|
|
9
|
+
type: "string";
|
|
10
|
+
};
|
|
11
|
+
nftContract: {
|
|
12
|
+
type: "string";
|
|
13
|
+
};
|
|
14
|
+
network: {
|
|
15
|
+
enum: string[];
|
|
16
|
+
type: "string";
|
|
17
|
+
};
|
|
18
|
+
spokeId: {
|
|
19
|
+
nullable: boolean;
|
|
20
|
+
type: "number";
|
|
21
|
+
};
|
|
22
|
+
spokeName: {
|
|
23
|
+
nullable: boolean;
|
|
24
|
+
type: "string";
|
|
25
|
+
};
|
|
26
|
+
supplied: {
|
|
27
|
+
type: "array";
|
|
28
|
+
items: {
|
|
29
|
+
type: "object";
|
|
30
|
+
required: string[];
|
|
31
|
+
properties: {
|
|
32
|
+
hubId: {
|
|
33
|
+
type: "number";
|
|
34
|
+
};
|
|
35
|
+
hubName: {
|
|
36
|
+
type: "string";
|
|
37
|
+
};
|
|
38
|
+
amountRaw: {
|
|
39
|
+
description: string;
|
|
40
|
+
nullable: boolean;
|
|
41
|
+
type: "string";
|
|
42
|
+
};
|
|
43
|
+
amount: {
|
|
44
|
+
nullable: boolean;
|
|
45
|
+
type: "string";
|
|
46
|
+
};
|
|
47
|
+
apy: {
|
|
48
|
+
description: string;
|
|
49
|
+
nullable: boolean;
|
|
50
|
+
type: "number";
|
|
51
|
+
};
|
|
52
|
+
priceUsd: {
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
type: "number";
|
|
55
|
+
};
|
|
56
|
+
valueUsd: {
|
|
57
|
+
nullable: boolean;
|
|
58
|
+
type: "number";
|
|
59
|
+
};
|
|
60
|
+
priceStatus: {
|
|
61
|
+
type: "object";
|
|
62
|
+
required: string[];
|
|
63
|
+
properties: {
|
|
64
|
+
valid: {
|
|
65
|
+
type: "boolean";
|
|
66
|
+
};
|
|
67
|
+
stale: {
|
|
68
|
+
type: "boolean";
|
|
69
|
+
};
|
|
70
|
+
deviation: {
|
|
71
|
+
type: "boolean";
|
|
72
|
+
};
|
|
73
|
+
timestamp: {
|
|
74
|
+
nullable: boolean;
|
|
75
|
+
type: "number";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
indexRay: {
|
|
80
|
+
nullable: boolean;
|
|
81
|
+
type: "string";
|
|
82
|
+
};
|
|
83
|
+
indexedAt: {
|
|
84
|
+
type: "number";
|
|
85
|
+
};
|
|
86
|
+
indexedLedger: {
|
|
87
|
+
type: "number";
|
|
88
|
+
};
|
|
89
|
+
sac: {
|
|
90
|
+
type: "string";
|
|
91
|
+
};
|
|
92
|
+
symbol: {
|
|
93
|
+
type: "string";
|
|
94
|
+
};
|
|
95
|
+
name: {
|
|
96
|
+
type: "string";
|
|
97
|
+
};
|
|
98
|
+
decimals: {
|
|
99
|
+
nullable: boolean;
|
|
100
|
+
type: "number";
|
|
101
|
+
};
|
|
102
|
+
logoUrl: {
|
|
103
|
+
nullable: boolean;
|
|
104
|
+
type: "string";
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
borrow: {
|
|
110
|
+
type: "array";
|
|
111
|
+
items: {
|
|
112
|
+
type: "object";
|
|
113
|
+
required: string[];
|
|
114
|
+
properties: {
|
|
115
|
+
hubId: {
|
|
116
|
+
type: "number";
|
|
117
|
+
};
|
|
118
|
+
hubName: {
|
|
119
|
+
type: "string";
|
|
120
|
+
};
|
|
121
|
+
amountRaw: {
|
|
122
|
+
description: string;
|
|
123
|
+
nullable: boolean;
|
|
124
|
+
type: "string";
|
|
125
|
+
};
|
|
126
|
+
amount: {
|
|
127
|
+
nullable: boolean;
|
|
128
|
+
type: "string";
|
|
129
|
+
};
|
|
130
|
+
apy: {
|
|
131
|
+
description: string;
|
|
132
|
+
nullable: boolean;
|
|
133
|
+
type: "number";
|
|
134
|
+
};
|
|
135
|
+
priceUsd: {
|
|
136
|
+
nullable: boolean;
|
|
137
|
+
type: "number";
|
|
138
|
+
};
|
|
139
|
+
valueUsd: {
|
|
140
|
+
nullable: boolean;
|
|
141
|
+
type: "number";
|
|
142
|
+
};
|
|
143
|
+
priceStatus: {
|
|
144
|
+
type: "object";
|
|
145
|
+
required: string[];
|
|
146
|
+
properties: {
|
|
147
|
+
valid: {
|
|
148
|
+
type: "boolean";
|
|
149
|
+
};
|
|
150
|
+
stale: {
|
|
151
|
+
type: "boolean";
|
|
152
|
+
};
|
|
153
|
+
deviation: {
|
|
154
|
+
type: "boolean";
|
|
155
|
+
};
|
|
156
|
+
timestamp: {
|
|
157
|
+
nullable: boolean;
|
|
158
|
+
type: "number";
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
indexRay: {
|
|
163
|
+
nullable: boolean;
|
|
164
|
+
type: "string";
|
|
165
|
+
};
|
|
166
|
+
indexedAt: {
|
|
167
|
+
type: "number";
|
|
168
|
+
};
|
|
169
|
+
indexedLedger: {
|
|
170
|
+
type: "number";
|
|
171
|
+
};
|
|
172
|
+
sac: {
|
|
173
|
+
type: "string";
|
|
174
|
+
};
|
|
175
|
+
symbol: {
|
|
176
|
+
type: "string";
|
|
177
|
+
};
|
|
178
|
+
name: {
|
|
179
|
+
type: "string";
|
|
180
|
+
};
|
|
181
|
+
decimals: {
|
|
182
|
+
nullable: boolean;
|
|
183
|
+
type: "number";
|
|
184
|
+
};
|
|
185
|
+
logoUrl: {
|
|
186
|
+
nullable: boolean;
|
|
187
|
+
type: "string";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
hasDebt: {
|
|
193
|
+
nullable: boolean;
|
|
194
|
+
description: string;
|
|
195
|
+
type: "boolean";
|
|
196
|
+
};
|
|
197
|
+
healthFactor: {
|
|
198
|
+
description: string;
|
|
199
|
+
nullable: boolean;
|
|
200
|
+
type: "number";
|
|
201
|
+
};
|
|
202
|
+
borrowLimitUsd: {
|
|
203
|
+
nullable: boolean;
|
|
204
|
+
type: "number";
|
|
205
|
+
};
|
|
206
|
+
availableBorrowUsd: {
|
|
207
|
+
description: string;
|
|
208
|
+
nullable: boolean;
|
|
209
|
+
type: "number";
|
|
210
|
+
};
|
|
211
|
+
netApy: {
|
|
212
|
+
description: string;
|
|
213
|
+
nullable: boolean;
|
|
214
|
+
type: "number";
|
|
215
|
+
};
|
|
216
|
+
dataStatus: {
|
|
217
|
+
enum: string[];
|
|
218
|
+
type: "string";
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/** OpenAPI response schema for LendingAsset[]. Capacities are indexed estimates. */
|
|
224
|
+
export declare const lendingAssetsSchema: {
|
|
225
|
+
type: "array";
|
|
226
|
+
items: {
|
|
227
|
+
type: "object";
|
|
228
|
+
required: string[];
|
|
229
|
+
properties: {
|
|
230
|
+
hubId: {
|
|
231
|
+
type: "number";
|
|
232
|
+
};
|
|
233
|
+
hubName: {
|
|
234
|
+
type: "string";
|
|
235
|
+
};
|
|
236
|
+
network: {
|
|
237
|
+
enum: string[];
|
|
238
|
+
type: "string";
|
|
239
|
+
};
|
|
240
|
+
supplyApy: {
|
|
241
|
+
description: string;
|
|
242
|
+
nullable: boolean;
|
|
243
|
+
type: "number";
|
|
244
|
+
};
|
|
245
|
+
borrowApy: {
|
|
246
|
+
description: string;
|
|
247
|
+
nullable: boolean;
|
|
248
|
+
type: "number";
|
|
249
|
+
};
|
|
250
|
+
priceUsd: {
|
|
251
|
+
nullable: boolean;
|
|
252
|
+
type: "number";
|
|
253
|
+
};
|
|
254
|
+
priceStatus: {
|
|
255
|
+
type: "object";
|
|
256
|
+
required: string[];
|
|
257
|
+
properties: {
|
|
258
|
+
valid: {
|
|
259
|
+
type: "boolean";
|
|
260
|
+
};
|
|
261
|
+
stale: {
|
|
262
|
+
type: "boolean";
|
|
263
|
+
};
|
|
264
|
+
deviation: {
|
|
265
|
+
type: "boolean";
|
|
266
|
+
};
|
|
267
|
+
timestamp: {
|
|
268
|
+
nullable: boolean;
|
|
269
|
+
type: "number";
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
spokes: {
|
|
274
|
+
type: "array";
|
|
275
|
+
items: {
|
|
276
|
+
type: "object";
|
|
277
|
+
required: string[];
|
|
278
|
+
properties: {
|
|
279
|
+
spokeId: {
|
|
280
|
+
type: "number";
|
|
281
|
+
};
|
|
282
|
+
spokeName: {
|
|
283
|
+
type: "string";
|
|
284
|
+
};
|
|
285
|
+
ltvBps: {
|
|
286
|
+
type: "number";
|
|
287
|
+
};
|
|
288
|
+
supplyCapacity: {
|
|
289
|
+
type: "object";
|
|
290
|
+
required: string[];
|
|
291
|
+
properties: {
|
|
292
|
+
amountRaw: {
|
|
293
|
+
nullable: boolean;
|
|
294
|
+
type: "string";
|
|
295
|
+
};
|
|
296
|
+
amount: {
|
|
297
|
+
nullable: boolean;
|
|
298
|
+
type: "string";
|
|
299
|
+
};
|
|
300
|
+
usd: {
|
|
301
|
+
nullable: boolean;
|
|
302
|
+
type: "number";
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
borrowCapacity: {
|
|
307
|
+
type: "object";
|
|
308
|
+
required: string[];
|
|
309
|
+
properties: {
|
|
310
|
+
amountRaw: {
|
|
311
|
+
nullable: boolean;
|
|
312
|
+
type: "string";
|
|
313
|
+
};
|
|
314
|
+
amount: {
|
|
315
|
+
nullable: boolean;
|
|
316
|
+
type: "string";
|
|
317
|
+
};
|
|
318
|
+
usd: {
|
|
319
|
+
nullable: boolean;
|
|
320
|
+
type: "number";
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
canSupply: {
|
|
325
|
+
type: "boolean";
|
|
326
|
+
};
|
|
327
|
+
canBeCollateral: {
|
|
328
|
+
type: "boolean";
|
|
329
|
+
};
|
|
330
|
+
canBorrow: {
|
|
331
|
+
type: "boolean";
|
|
332
|
+
};
|
|
333
|
+
canOpenAccount: {
|
|
334
|
+
description: string;
|
|
335
|
+
type: "boolean";
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
dataStatus: {
|
|
341
|
+
enum: string[];
|
|
342
|
+
type: "string";
|
|
343
|
+
};
|
|
344
|
+
indexedAt: {
|
|
345
|
+
description: string;
|
|
346
|
+
type: "number";
|
|
347
|
+
};
|
|
348
|
+
indexedLedger: {
|
|
349
|
+
type: "number";
|
|
350
|
+
};
|
|
351
|
+
sac: {
|
|
352
|
+
type: "string";
|
|
353
|
+
};
|
|
354
|
+
symbol: {
|
|
355
|
+
type: "string";
|
|
356
|
+
};
|
|
357
|
+
name: {
|
|
358
|
+
type: "string";
|
|
359
|
+
};
|
|
360
|
+
decimals: {
|
|
361
|
+
nullable: boolean;
|
|
362
|
+
type: "number";
|
|
363
|
+
};
|
|
364
|
+
logoUrl: {
|
|
365
|
+
nullable: boolean;
|
|
366
|
+
type: "string";
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Render-ready REST data. Null means unavailable, never an inferred zero. */
|
|
2
|
+
export type LendingAssetUsage = 'collateral' | 'borrow';
|
|
3
|
+
export type LendingDataStatus = 'ready' | 'stale' | 'incomplete';
|
|
4
|
+
export interface LendingToken {
|
|
5
|
+
sac: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
name: string;
|
|
8
|
+
decimals: number | null;
|
|
9
|
+
logoUrl: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface LendingPriceStatus {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
stale: boolean;
|
|
14
|
+
deviation: boolean;
|
|
15
|
+
timestamp: number | null;
|
|
16
|
+
}
|
|
17
|
+
export interface PositionAsset extends LendingToken {
|
|
18
|
+
hubId: number;
|
|
19
|
+
hubName: string;
|
|
20
|
+
/** Integer token base units, never scaled shares. */
|
|
21
|
+
amountRaw: string | null;
|
|
22
|
+
amount: string | null;
|
|
23
|
+
/** Fraction: 0.05 means 5%. */
|
|
24
|
+
apy: number | null;
|
|
25
|
+
priceUsd: number | null;
|
|
26
|
+
valueUsd: number | null;
|
|
27
|
+
priceStatus: LendingPriceStatus;
|
|
28
|
+
indexRay: string | null;
|
|
29
|
+
indexedAt: number;
|
|
30
|
+
indexedLedger: number;
|
|
31
|
+
}
|
|
32
|
+
export interface LendingPosition {
|
|
33
|
+
accountId: string;
|
|
34
|
+
nftContract: string;
|
|
35
|
+
network: 'mainnet' | 'testnet';
|
|
36
|
+
spokeId: number | null;
|
|
37
|
+
spokeName: string | null;
|
|
38
|
+
supplied: PositionAsset[];
|
|
39
|
+
borrow: PositionAsset[];
|
|
40
|
+
/** Null when account rows are unavailable. */
|
|
41
|
+
hasDebt: boolean | null;
|
|
42
|
+
/** Null without debt or when risk inputs are unavailable. */
|
|
43
|
+
healthFactor: number | null;
|
|
44
|
+
borrowLimitUsd: number | null;
|
|
45
|
+
/** Account headroom, before per-market constraints. */
|
|
46
|
+
availableBorrowUsd: number | null;
|
|
47
|
+
/** Net annual yield divided by positive net equity; fraction. */
|
|
48
|
+
netApy: number | null;
|
|
49
|
+
dataStatus: LendingDataStatus;
|
|
50
|
+
}
|
|
51
|
+
export interface Capacity {
|
|
52
|
+
amountRaw: string | null;
|
|
53
|
+
amount: string | null;
|
|
54
|
+
usd: number | null;
|
|
55
|
+
}
|
|
56
|
+
export interface AssetSpoke {
|
|
57
|
+
spokeId: number;
|
|
58
|
+
spokeName: string;
|
|
59
|
+
ltvBps: number;
|
|
60
|
+
supplyCapacity: Capacity;
|
|
61
|
+
borrowCapacity: Capacity;
|
|
62
|
+
canSupply: boolean;
|
|
63
|
+
canBeCollateral: boolean;
|
|
64
|
+
canBorrow: boolean;
|
|
65
|
+
/** Spoke admits new accounts; other entry gates still apply. */
|
|
66
|
+
canOpenAccount: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface LendingAsset extends LendingToken {
|
|
69
|
+
hubId: number;
|
|
70
|
+
hubName: string;
|
|
71
|
+
network: 'mainnet' | 'testnet';
|
|
72
|
+
/** Fraction: 0.05 means 5%. */
|
|
73
|
+
supplyApy: number | null;
|
|
74
|
+
/** Fraction: 0.05 means 5%. */
|
|
75
|
+
borrowApy: number | null;
|
|
76
|
+
priceUsd: number | null;
|
|
77
|
+
priceStatus: LendingPriceStatus;
|
|
78
|
+
spokes: AssetSpoke[];
|
|
79
|
+
dataStatus: LendingDataStatus;
|
|
80
|
+
/** Pool timestamp. Capacities are indexed estimates; prepare/simulate before signing. */
|
|
81
|
+
indexedAt: number;
|
|
82
|
+
indexedLedger: number;
|
|
83
|
+
}
|