@xoxno/sdk-js 1.0.229 → 1.0.231
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/sdk/stellar/contracts.d.ts +2 -2
- package/dist/cjs/sdk/stellar/events/decode.d.ts +4 -6
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/lending-read.d.ts +16 -2
- package/dist/cjs/sdk/stellar/lending.d.ts +34 -0
- package/dist/cjs/utils/soroban-errors.d.ts +18 -1
- package/dist/esm/sdk/stellar/contracts.js +1 -1
- package/dist/esm/sdk/stellar/events/decode.js +115 -9
- package/dist/esm/sdk/stellar/lending-read.js +40 -4
- package/dist/esm/sdk/stellar/lending.js +45 -0
- package/dist/esm/utils/soroban-errors.js +412 -19
- package/dist/index.cjs +1 -1
- package/dist/sdk/stellar/contracts.d.ts +2 -2
- package/dist/sdk/stellar/events/decode.d.ts +4 -6
- 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/lending-read.d.ts +16 -2
- package/dist/sdk/stellar/lending.d.ts +34 -0
- package/dist/utils/soroban-errors.d.ts +18 -1
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** Typed Stellar lending reads. Configure the API deployment with XOXNOClient.apiUrl.
|
|
2
2
|
* These cached HTTP reads do not simulate transactions or authorize spending.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type OurRequestInit, type XOXNOClient } from '../../utils/api.js';
|
|
5
5
|
import type * as Api from './lending-api-types.js';
|
|
6
|
+
import type { UserTokenInventoryResponseDto } from '@xoxno/types';
|
|
6
7
|
import type { StellarLendingMarketSide, StellarLendingHoldersSide, StellarMarketGraphQuery, StellarReservesParams, StellarActivityQuery, StellarActivityPageQuery, StellarGovernanceQuery, StellarPositionsQuery, StellarRevenueQuery, StellarFeeRevenueQuery, StellarParticipantsQuery, StellarLiquidationsQuery, StellarLiquidationsLeaderboardQuery, StellarVolumeQuery, StellarDistributionQuery, StellarRateSpreadQuery } from './lending-read-types.js';
|
|
7
8
|
/** Load assets, hubs, spokes, reserves and keyed reserve details in one response.
|
|
8
9
|
* @category Stellar lending reads
|
|
@@ -56,7 +57,18 @@ export declare const getStellarUserPositions: (client: XOXNOClient, owner: strin
|
|
|
56
57
|
* @category Stellar lending reads
|
|
57
58
|
*/
|
|
58
59
|
export declare const getStellarAccountPositions: (client: XOXNOClient, accountId: string, init?: OurRequestInit) => Promise<Api.AccountPositionsDto>;
|
|
59
|
-
/** Read
|
|
60
|
+
/** Read a G or C wallet's token holdings from `/user/{owner}/token-inventory`:
|
|
61
|
+
* Horizon balances (native XLM and classic assets, keyed by their SAC id) plus
|
|
62
|
+
* indexed Soroban tokens, cached for about 10 seconds. Each token's
|
|
63
|
+
* `identifier` is its contract id and `balance` is base units as a decimal
|
|
64
|
+
* string. Tokens without a balance or trustline are absent.
|
|
65
|
+
* @category Stellar lending reads
|
|
66
|
+
*/
|
|
67
|
+
export declare const getStellarWalletTokens: (client: XOXNOClient, owner: string, init?: OurRequestInit) => Promise<UserTokenInventoryResponseDto>;
|
|
68
|
+
/** Read exact token base-unit holdings of one asset for a G or C wallet, from
|
|
69
|
+
* {@link getStellarWalletTokens}. An asset the wallet does not hold returns
|
|
70
|
+
* `amount: '0'`, with decimals read from the lending asset. Holdings may exceed
|
|
71
|
+
* spendable funds (reserves, liabilities).
|
|
60
72
|
* @category Stellar lending reads
|
|
61
73
|
*/
|
|
62
74
|
export declare const getStellarWalletBalance: (client: XOXNOClient, owner: string, asset: string, init?: OurRequestInit) => Promise<Api.StellarWalletBalanceDto>;
|
|
@@ -218,6 +230,8 @@ export declare const stellarLendingRead: (client: XOXNOClient) => {
|
|
|
218
230
|
userPositions: (owner: string, init?: OurRequestInit) => Promise<Api.AccountPositionsDto>;
|
|
219
231
|
/** {@inheritDoc getStellarAccountPositions} */
|
|
220
232
|
accountPositions: (accountId: string, init?: OurRequestInit) => Promise<Api.AccountPositionsDto>;
|
|
233
|
+
/** {@inheritDoc getStellarWalletTokens} */
|
|
234
|
+
walletTokens: (owner: string, init?: OurRequestInit) => Promise<UserTokenInventoryResponseDto>;
|
|
221
235
|
/** {@inheritDoc getStellarWalletBalance} */
|
|
222
236
|
walletBalance: (owner: string, asset: string, init?: OurRequestInit) => Promise<Api.StellarWalletBalanceDto>;
|
|
223
237
|
/** {@inheritDoc getStellarAssetPage} */
|
|
@@ -299,6 +299,40 @@ export declare function buildStellarLiquidateTx(opts: StellarLendingBuilderOptio
|
|
|
299
299
|
* `decodeStellarLendingEvent`. Hold a parsed ScVal? Pass `toBase64Xdr(scv)`.
|
|
300
300
|
*/
|
|
301
301
|
export declare function decodeStellarLiquidateReturn(returnValueB64: string): string;
|
|
302
|
+
/**
|
|
303
|
+
* get_liquidation_estimate(account_id: u64, debt_payments: Vec<(HubAssetKey, i128)>,
|
|
304
|
+
* seize_mode: SeizeMode) -> LiquidationEstimate
|
|
305
|
+
*
|
|
306
|
+
* Read-only view: simulate the built transaction (`server.simulateTransaction`)
|
|
307
|
+
* and decode `result.retval` with `decodeStellarLiquidationEstimate`. Takes the
|
|
308
|
+
* same args as `buildStellarLiquidateTx`, so an estimate and the real call stay
|
|
309
|
+
* encoded identically. Never submit this transaction.
|
|
310
|
+
* @param opts - Network, caller (any account; it is only the simulation source), sequence and controller.
|
|
311
|
+
* @param args - The liquidation you intend to send.
|
|
312
|
+
* @returns Unsigned XDR to simulate.
|
|
313
|
+
* @category Lending transactions
|
|
314
|
+
*/
|
|
315
|
+
export declare function buildStellarLiquidationEstimateTx(opts: StellarLendingBuilderOptions, args: StellarLiquidateArgs): BuiltStellarTx;
|
|
316
|
+
/** One `PaymentTuple`: a token amount without a hub id. */
|
|
317
|
+
export interface StellarPaymentTuple {
|
|
318
|
+
asset: string;
|
|
319
|
+
/** Token base units for Transfer legs; RAY-scaled supply shares for Credit seizure. */
|
|
320
|
+
amount: string;
|
|
321
|
+
}
|
|
322
|
+
/** Decoded `LiquidationEstimate`; i128 fields as decimal strings. */
|
|
323
|
+
export interface StellarLiquidationEstimate {
|
|
324
|
+
seizedCollaterals: StellarPaymentTuple[];
|
|
325
|
+
protocolFees: StellarPaymentTuple[];
|
|
326
|
+
refunds: StellarPaymentTuple[];
|
|
327
|
+
maxPaymentWad: string;
|
|
328
|
+
bonusRateBps: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Decode `get_liquidation_estimate`'s return value from base64 XDR (Soroban
|
|
332
|
+
* RPC `result.retval`). Tuples carry token addresses without hub ids; match
|
|
333
|
+
* them to the target's `(hub_id, asset)` positions yourself.
|
|
334
|
+
*/
|
|
335
|
+
export declare function decodeStellarLiquidationEstimate(returnValueB64: string): StellarLiquidationEstimate;
|
|
302
336
|
/**
|
|
303
337
|
* flash_loan(caller, asset: HubAssetKey, amount: i128, receiver, data: Bytes)
|
|
304
338
|
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
export interface MapSorobanErrorOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Accept only an error emitted by one of these contract IDs (`C…`), for
|
|
4
|
+
* example the lending controller and pool. The emitter is read from the
|
|
5
|
+
* diagnostic event log, or from the `[xoxno-invoked:<id>]` tag that
|
|
6
|
+
* `prepareStellarTxXdr` adds when the string has no event log.
|
|
7
|
+
*
|
|
8
|
+
* RPC simulation errors usually carry only the top-level code
|
|
9
|
+
* (`HostError: Error(Contract, #N)`). With only the tag, a code raised by a
|
|
10
|
+
* nested contract (for example the swap aggregator) cannot be told apart;
|
|
11
|
+
* read the simulation's diagnostic events when that matters.
|
|
12
|
+
*/
|
|
13
|
+
contracts?: readonly string[];
|
|
14
|
+
}
|
|
1
15
|
/**
|
|
2
16
|
* Extracts a `Error(Contract, #N)` code from a raw Soroban simulation/RPC error
|
|
3
17
|
* string and resolves it against the rs-lending-xlm catalog. Matches only the
|
|
4
18
|
* exact `Error(Contract, #N)` pattern — never loose digits, since raw error
|
|
5
19
|
* strings can contain unrelated numbers (fees, ledgers, sequence numbers).
|
|
20
|
+
*
|
|
21
|
+
* Without `opts.contracts` it maps the first code in the string, whichever
|
|
22
|
+
* contract emitted it.
|
|
6
23
|
*/
|
|
7
|
-
export declare function mapSorobanError(raw: string): {
|
|
24
|
+
export declare function mapSorobanError(raw: string, opts?: MapSorobanErrorOptions): {
|
|
8
25
|
code: number;
|
|
9
26
|
name: string;
|
|
10
27
|
message: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.231",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"dependencies": {
|
|
141
141
|
"@multiversx/sdk-core": "^15.3.2",
|
|
142
142
|
"@multiversx/sdk-network-providers": "^2.9.3",
|
|
143
|
-
"@xoxno/types": "1.0.
|
|
143
|
+
"@xoxno/types": "1.0.501",
|
|
144
144
|
"buffer": "^6.0.3"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|