@xoxno/sdk-js 1.0.229 → 1.0.230
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/index.d.ts +1 -0
- 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 +7 -2
- 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/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.d.ts +34 -0
- package/dist/utils/soroban-errors.d.ts +18 -1
- package/package.json +1 -1
|
@@ -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;
|