@xoxno/sdk-js 1.0.117 → 1.0.119

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.
@@ -1,14 +1,13 @@
1
1
  /**
2
- * Snapshot + structural tests for the Stellar lending ADMIN / CONFIG / KEEPER /
3
- * ACCESS transaction builders.
2
+ * Snapshot + structural tests for the Stellar lending admin / config / keeper /
3
+ * access transaction builders.
4
4
  *
5
- * Beyond the function-name / arg-count / determinism / snapshot guards shared
6
- * with `lending.test.ts`, this suite decodes the complex `#[contracttype]`
7
- * struct args (`MarketOracleConfigInput`, `AssetConfigRaw`) back out of the XDR
8
- * and asserts the ScMap keys are ascending-sorted (the Soroban host requires
9
- * sorted symbol keys) and that the oracle union / custom-option tags are
10
- * well-formed. The encoders reuse the same `scStruct` already proven on-chain
11
- * by the production swap builders; for the all-lowercase snake_case field sets
12
- * used here, JS lexicographic order matches Soroban's symbol collation.
5
+ * Beyond the function-name / arg-count / determinism / snapshot guards, this
6
+ * suite decodes the complex `#[contracttype]` struct args
7
+ * (`MarketOracleConfigInput`, `AssetConfigRaw`) back out of the XDR and asserts
8
+ * the ScMap keys are ascending-sorted (the Soroban host requires sorted symbol
9
+ * keys) and that the oracle union / custom-option tags are well-formed. For the
10
+ * all-lowercase snake_case field sets used here, JS lexicographic order matches
11
+ * Soroban's symbol collation.
13
12
  */
14
13
  export {};
@@ -1,11 +1,8 @@
1
1
  /**
2
- * Decoder tests locked against REAL captured event XDR.
2
+ * Decoder tests locked against captured event XDR.
3
3
  *
4
- * `fixtures/lending-events.json` was produced by publishing every controller
5
- * `#[contractevent]` in a soroban-sdk 26 test env and serializing each event's
6
- * topics + `data` to base64 XDR via `ScVal::to_xdr_base64` — byte-identical to
7
- * what Soroban RPC `getEvents` delivers. These tests prove the decoders match
8
- * on-chain reality (not a hand-built assumption) and that the four legacy
9
- * consumer bugs are fixed.
4
+ * `fixtures/lending-events.json` holds every controller `#[contractevent]`'s
5
+ * topics + `data` serialized to base64 XDR, exactly as Soroban RPC `getEvents`
6
+ * delivers them.
10
7
  */
11
8
  export {};
@@ -1,10 +1,4 @@
1
1
  /**
2
- * Byte-identical parity guard for the Stellar lending activity-id primitives.
3
- *
4
- * Expected values are computed from api-v2's verbatim formula (the source these
5
- * functions were ported from). Both consumers route their id derivation through
6
- * these functions, so locking the outputs here is what makes the Phase 4
7
- * activity-indexing consolidation safe — divergence shows up as a failing
8
- * assertion, not as duplicated Cosmos docs.
2
+ * Tests for the Stellar lending activity-id primitives, locking their outputs.
9
3
  */
10
4
  export {};
@@ -1,10 +1,6 @@
1
1
  /**
2
- * Stellar Soroban lending ADMIN / CONFIG / KEEPER / ACCESS transaction builders.
3
- *
4
- * Companion to `lending.ts` (user operations). Every state-changing controller
5
- * entry point that is not a plain user op lives here, 1:1 with the controller
6
- * `#[contractimpl]` methods in `rs-lending-xlm/contracts/controller/src/{access,
7
- * config,router}.rs`. Each builder returns an unsigned `BuiltStellarTx` XDR.
2
+ * Stellar lending admin / config / keeper / access transaction builders. Each
3
+ * builder returns an unsigned `BuiltStellarTx` XDR.
8
4
  *
9
5
  * Auth model:
10
6
  * - `#[only_owner]` methods take no `caller` param — the tx source
@@ -12,10 +8,6 @@
12
8
  * - `#[only_role(caller, "ROLE")]` and caller-taking methods encode
13
9
  * `opts.caller` as the leading `Address` arg; that account must hold the
14
10
  * role and sign the tx.
15
- *
16
- * The complex contract structs (`InterestRateModel`, `MarketParamsRaw`,
17
- * `AssetConfigRaw`, `PositionLimits`, `MarketOracleConfigInput`) are encoded
18
- * here from their `@xoxno/types` builder-input DTOs.
19
11
  */
20
12
  import type { AssetConfigRawDto, InterestRateModelDto, MarketOracleConfigInputDto, MarketParamsRawDto, OracleSourceConfigInputDto, PositionLimitsDto } from '@xoxno/types';
21
13
  import { type BuiltStellarTx, type StellarBuilderOptions } from './lending';
@@ -1,25 +1,16 @@
1
1
  /**
2
- * Decoders for the 21 XOXNO Stellar lending controller `#[contractevent]`s.
2
+ * Decoders for the 21 Stellar lending controller `#[contractevent]`s.
3
3
  *
4
- * Public API is **base64-XDR-string in** `decodeStellarLendingEvent(topicsB64,
5
- * dataB64)` parses with the SDK's own bundled `@stellar/stellar-sdk`, so no live
6
- * `xdr.ScVal` ever crosses the consumer boundary. This makes decoding immune to
7
- * the dual-package hazard and to `@stellar/stellar-sdk` version skew between the
8
- * SDK and its consumers (Soroban RPC `getEvents` already delivers `topic[]` and
9
- * `value` as base64 XDR — pass them straight through).
4
+ * The public API takes base64-XDR strings (`decodeStellarLendingEvent(topicsB64,
5
+ * dataB64)`) and parses them with this SDK's bundled `@stellar/stellar-sdk`, so
6
+ * no live `xdr.ScVal` crosses the consumer boundary. Soroban RPC `getEvents`
7
+ * already delivers `topic[]` and `value` as base64 XDR — pass them straight
8
+ * through.
10
9
  *
11
- * soroban-sdk 26 serializes every contractevent `data` as an `ScMap` keyed by
12
- * field name (verified against real captured emissions, including single-field
13
- * and batch events), so `scValToNative` yields a snake_case-keyed object with
14
- * `bigint` for i128/u64, `number` for u32, strkey strings for addresses,
15
- * strings for symbols, `null` for absent `Option`s, and arrays for `Vec`s.
16
- *
17
- * Bug fixes baked in vs the consumers' legacy decoders:
18
- * - the real `debt:ceiling_batch_update` is decoded (the single
19
- * `debt:ceiling_update` is dead on-chain but kept for completeness);
20
- * - `oracle:twap_degraded` is decoded;
21
- * - borrow-side deltas expose risk fields as `undefined` (not 0);
22
- * - no `liquidation_fees_bps` is read off position deltas (it does not exist).
10
+ * Each contractevent `data` serializes as an `ScMap` keyed by field name, so
11
+ * `scValToNative` yields a snake_case-keyed object with `bigint` for i128/u64,
12
+ * `number` for u32, strkey strings for addresses, strings for symbols, `null`
13
+ * for absent `Option`s, and arrays for `Vec`s.
23
14
  */
24
15
  import type { StellarLendingDecodedEvent } from '@xoxno/types';
25
16
  /**
@@ -1,16 +1,10 @@
1
1
  /**
2
- * Stellar lending activity-id derivation the single owner of the inputs that
3
- * compose `NftActivityDoc.id` (`${txHash}-${eventIdentifier}-${eventOrder}`).
2
+ * Stellar lending activity-id derivation: the inputs that compose
3
+ * `NftActivityDoc.id` (`${txHash}-${eventIdentifier}-${eventOrder}`).
4
4
  *
5
- * Both indexing consumers (xoxno-api-v2, xoxno-az-functions) MUST derive these
6
- * inputs here so the activity ids they write to `NFT_ACTIVITY_DATA` are
7
- * byte-identical the hard gate for consolidating activity indexing into a
8
- * single producer. Ported verbatim from api-v2's `stellar-lending-activity.mapper`.
9
- *
10
- * The activity-type string values mirror `@xoxno/types` `XoxnoLendingActivity`.
11
- * They are inlined (not imported) because `@xoxno/types` does not re-export its
12
- * enums on the top-level type surface and the SDK keeps that NestJS-coupled
13
- * module out of its runtime bundle.
5
+ * The activity-type string values mirror `@xoxno/types` `XoxnoLendingActivity`,
6
+ * inlined rather than imported since `@xoxno/types` does not re-export its enums
7
+ * on its top-level type surface.
14
8
  */
15
9
  /** Synthetic NFT collection ticker for Stellar lending accounts. */
16
10
  export declare const XOXNO_LENDING_STELLAR_TICKER = "XLENDXLM-a7c9f3";
@@ -1,40 +1,19 @@
1
1
  /**
2
- * Stellar Soroban lending transaction builders (Wave 1B).
2
+ * Stellar lending user-operation transaction builders.
3
3
  *
4
- * Each builder takes a Wave 0 `*Args` DTO from @xoxno/types plus a shared
5
- * `StellarBuilderOptions` ({ network, caller, sourceSequence, ... }) and
6
- * returns an unsigned transaction XDR string ready for wallet signing
7
- * (Freighter / LOBSTR / xBull / WalletConnect via StellarWalletsKit).
4
+ * Each builder takes an `*Args` DTO from `@xoxno/types` plus a shared
5
+ * `StellarBuilderOptions` ({ network, caller, sourceSequence, ... }) and returns
6
+ * an unsigned transaction XDR string ready for wallet signing.
8
7
  *
9
- * Mirrors the Stellar controller entry points in
10
- * rs-lending/stellar/controller/src/lib.rs:
11
- *
12
- * supply(caller, account_id: u64, e_mode_category: u32, assets: Vec<(Address, i128)>) -> u64
13
- * borrow(caller, account_id: u64, borrows: Vec<(Address, i128)>)
14
- * withdraw(caller, account_id: u64, withdrawals: Vec<(Address, i128)>)
15
- * repay(caller, account_id: u64, payments: Vec<(Address, i128)>)
16
- * liquidate(liquidator, account_id: u64, debt_payments: Vec<(Address, i128)>)
17
- * flash_loan(caller, asset, amount: i128, receiver, data: Bytes)
18
- * multiply(caller, account_id, e_mode_category, collateral_token,
19
- * debt_to_flash_loan: i128, debt_token, mode: u32, steps: SwapSteps) -> u64
20
- * swap_debt(caller, account_id, existing_debt_token, new_debt_amount: i128,
21
- * new_debt_token, steps: SwapSteps)
22
- * swap_collateral(caller, account_id, current_collateral, from_amount: i128,
23
- * new_collateral, steps: SwapSteps)
24
- * repay_debt_with_collateral(caller, account_id, collateral_token,
25
- * collateral_amount: i128, debt_token,
26
- * steps: SwapSteps, close_position: bool)
27
- *
28
- * i128 values cross the boundary as decimal strings and are encoded via
29
- * `new ScInt(str).toI128()`. addresses (Stellar `G...` accounts and Soroban
8
+ * i128 values cross the boundary as decimal strings, encoded via
9
+ * `new ScInt(str).toI128()`. Addresses (Stellar `G...` accounts and Soroban
30
10
  * `C...` contracts) are encoded via `new Address(str).toScVal()`.
31
11
  *
32
- * These builders are RPC-free on purpose: they accept a caller-supplied
33
- * `sourceSequence` so the returned XDR is deterministic and snapshot-testable.
34
- * The UI hook layer (Wave 1C) is responsible for fetching the current sequence
35
- * via `rpc.Server.getAccount(caller)` and calling `rpc.Server.prepareTransaction`
36
- * (which handles simulation + Soroban footprint/auth/resource fee) before
37
- * handing the XDR to the wallet to sign.
12
+ * Builders are RPC-free: they accept a caller-supplied `sourceSequence` so the
13
+ * returned XDR is deterministic and snapshot-testable. The caller fetches the
14
+ * current sequence via `rpc.Server.getAccount(caller)` and runs
15
+ * `rpc.Server.prepareTransaction` (simulation + Soroban footprint/auth/resource
16
+ * fee) before handing the XDR to the wallet to sign.
38
17
  */
39
18
  import type { AggregatorSwapDto, BorrowArgs, FlashLoanArgs, LiquidateArgs, MultiplyArgs, RepayArgs, RepayDebtWithCollateralArgs, SupplyArgs, SwapCollateralArgs, SwapDebtArgs, SwapHopDto, SwapPathDto, SwapVenue, WithdrawArgs } from '@xoxno/types';
40
19
  import { xdr } from '@stellar/stellar-sdk';
@@ -70,36 +49,12 @@ export interface BuiltStellarTx {
70
49
  }
71
50
  /**
72
51
  * Input shape for the Stellar-specific `swap` payload carried on
73
- * `MultiplyArgs.steps`, `SwapDebtArgs.steps`, `SwapCollateralArgs.steps`,
52
+ * `MultiplyArgs.steps`, `SwapDebtArgs.steps`, `SwapCollateralArgs.steps`, and
74
53
  * `RepayDebtWithCollateralArgs.steps`.
75
54
  *
76
- * @xoxno/types declares `steps: unknown` on the Wave 0 DTOs so every chain
77
- * owns its own encoding. On Stellar, callers MUST pass an
78
- * `AggregatorSwapDto` which is serialised into the Soroban
79
- * `AggregatorSwap` struct from `rs-lending-xlm common/src/types.rs`:
80
- *
81
- * pub struct SwapHop {
82
- * pub fee_bps: u32,
83
- * pub pool: Address,
84
- * pub token_in: Address,
85
- * pub token_out: Address,
86
- * pub venue: SwapVenue, // tag-only enum
87
- * }
88
- * pub struct SwapPath {
89
- * pub amount_in: i128,
90
- * pub hops: Vec<SwapHop>,
91
- * pub min_amount_out: i128,
92
- * }
93
- * pub struct AggregatorSwap { // controller payload
94
- * pub paths: Vec<SwapPath>,
95
- * pub total_min_out: i128,
96
- * }
97
- *
98
- * The controller wraps `AggregatorSwap` in `BatchSwap` (filling
99
- * `sender = current_contract_address`) before forwarding to the router.
100
- *
101
- * Re-exported from this module so consumers can `import { StellarSwapStepsInput }`
102
- * and get the canonical typed shape without reaching into `@xoxno/types`.
55
+ * `@xoxno/types` declares `steps: unknown` on these DTOs so every chain owns its
56
+ * own encoding. On Stellar, callers must pass an `AggregatorSwapDto`, which is
57
+ * serialised into the Soroban `AggregatorSwap` struct.
103
58
  */
104
59
  export type StellarSwapStepsInput = AggregatorSwapDto;
105
60
  export type StellarSwapHopInput = SwapHopDto;
@@ -1,26 +1,15 @@
1
1
  /**
2
- * Shared Soroban `ScVal` encoding primitives for the Stellar lending SDK.
3
- *
4
- * Extracted verbatim from `lending.ts` so both the user-operation builders
5
- * (`lending.ts`) and the admin/config builders (`admin.ts`) encode against one
6
- * implementation. Behavior-preserving: the existing builder XDR snapshots must
7
- * not change.
2
+ * Soroban `ScVal` encoding primitives for the Stellar lending builders.
8
3
  *
9
4
  * i128/u128 values cross the boundary as decimal strings (`new ScInt(str)`).
10
5
  * Addresses (Stellar `G...` accounts and Soroban `C...` contracts) encode via
11
- * `new Address(str).toScVal()`. Soroban `#[contracttype]` structs are ScMaps
12
- * with `Symbol` keys in ascending order — `scStruct` lex-sorts the field names,
13
- * which matches Soroban's small-symbol collation for the all-lowercase
14
- * snake_case field sets used here.
6
+ * `new Address(str).toScVal()`.
15
7
  */
16
8
  import type { AggregatorSwapDto, SwapVenue } from '@xoxno/types';
17
9
  import { xdr } from '@stellar/stellar-sdk';
18
10
  /**
19
- * Inlined copy of `SWAP_VENUES` from `@xoxno/types` so the SDK can validate a
20
- * runtime-supplied venue without forcing the (NestJS-coupled) `@xoxno/types`
21
- * module to load at runtime. Kept in lockstep with the upstream constant; any
22
- * new on-chain venue must be added in both places + the contract's `SwapVenue`
23
- * enum.
11
+ * On-chain swap venues, validated at runtime for a caller-supplied venue.
12
+ * Mirrors `SWAP_VENUES` from `@xoxno/types` and the contract's `SwapVenue` enum.
24
13
  */
25
14
  export declare const STELLAR_SWAP_VENUES: readonly ["Soroswap", "Aquarius", "Phoenix", "NativeAmm", "StaticBridge"];
26
15
  export type StellarSwapStepsInput = AggregatorSwapDto;
@@ -78,10 +67,9 @@ export declare const encodeSwapVenue: (venue: SwapVenue) => xdr.ScVal;
78
67
  */
79
68
  export declare const encodeAggregatorSwap: (swap: StellarSwapStepsInput) => xdr.ScVal;
80
69
  /**
81
- * Validate the untyped `steps` field from a Wave 0 DTO and narrow it to
82
- * `AggregatorSwapDto`. Throws a clear error if the caller passed the wrong
83
- * shape so the failure surfaces at the SDK boundary, not deep inside the
84
- * Soroban host on-chain.
70
+ * Validate the untyped `steps` field and narrow it to `AggregatorSwapDto`.
71
+ * Throws if the caller passed the wrong shape so the failure surfaces at the
72
+ * SDK boundary, not inside the Soroban host on-chain.
85
73
  */
86
74
  export declare const asStellarSwapSteps: (steps: unknown) => StellarSwapStepsInput;
87
75
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.117",
3
+ "version": "1.0.119",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {
@@ -104,6 +104,6 @@
104
104
  "@multiversx/sdk-core": "^15.3.2",
105
105
  "@multiversx/sdk-network-providers": "^2.9.3",
106
106
  "@stellar/stellar-sdk": "^15.0.1",
107
- "@xoxno/types": "^1.0.404"
107
+ "@xoxno/types": "^1.0.407"
108
108
  }
109
109
  }