@xoxno/sdk-js 1.0.222 → 1.0.224
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/__tests__/admin.test.d.ts +0 -12
- package/dist/cjs/sdk/stellar/__tests__/builders-hubasset.test.d.ts +0 -11
- package/dist/cjs/sdk/stellar/__tests__/governance.test.d.ts +0 -4
- package/dist/cjs/sdk/stellar/__tests__/lending.test.d.ts +0 -20
- package/dist/cjs/sdk/stellar/__tests__/strategy-program.test.d.ts +0 -8
- package/dist/cjs/sdk/stellar/__tests__/swap-history.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/admin.d.ts +0 -12
- package/dist/cjs/sdk/stellar/governance.d.ts +0 -4
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/quote.d.ts +0 -8
- package/dist/cjs/sdk/stellar/scval-encode.d.ts +0 -4
- package/dist/cjs/sdk/stellar/swap-history.d.ts +25 -0
- package/dist/cjs/sdk/stellar/swap-index.d.ts +2 -0
- package/dist/cjs/sdk/stellar/swap.d.ts +0 -10
- package/dist/cjs/sdk/stellar/xdr-compat.d.ts +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/__tests__/admin.test.d.ts +0 -12
- package/dist/sdk/stellar/__tests__/builders-hubasset.test.d.ts +0 -11
- package/dist/sdk/stellar/__tests__/governance.test.d.ts +0 -4
- package/dist/sdk/stellar/__tests__/lending.test.d.ts +0 -20
- package/dist/sdk/stellar/__tests__/strategy-program.test.d.ts +0 -8
- package/dist/sdk/stellar/__tests__/swap-history.test.d.ts +1 -0
- package/dist/sdk/stellar/admin.d.ts +0 -12
- package/dist/sdk/stellar/governance.d.ts +0 -4
- 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/quote.d.ts +0 -8
- package/dist/sdk/stellar/scval-encode.d.ts +0 -4
- package/dist/sdk/stellar/swap-history.d.ts +25 -0
- package/dist/sdk/stellar/swap-index.cjs +2 -0
- package/dist/sdk/stellar/swap-index.cjs.LICENSE.txt +8 -0
- package/dist/sdk/stellar/swap-index.d.ts +2 -0
- package/dist/sdk/stellar/swap-index.esm.js +2 -0
- package/dist/sdk/stellar/swap-index.esm.js.LICENSE.txt +8 -0
- package/dist/sdk/stellar/swap.d.ts +0 -10
- package/dist/sdk/stellar/xdr-compat.d.ts +11 -0
- package/package.json +15 -4
|
@@ -1,13 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snapshot + structural tests for the Stellar lending admin / config / keeper /
|
|
3
|
-
* access transaction builders.
|
|
4
|
-
*
|
|
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.
|
|
12
|
-
*/
|
|
13
1
|
export {};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-hub ABI encoding tests for the Stellar lending builders.
|
|
3
|
-
*
|
|
4
|
-
* Asserts the on-the-wire ScVal shape after the migration from the old
|
|
5
|
-
* `(Address, i128)` + `e_mode_category` ABI to the multi-hub
|
|
6
|
-
* `(HubAssetKey, i128)` + `spoke_id` ABI:
|
|
7
|
-
* - `supply` carries `spoke_id` as a `u32` and a `Vec<(HubAssetKey, i128)>`.
|
|
8
|
-
* - each `HubAssetKey` is a struct/map whose symbol keys are sorted
|
|
9
|
-
* (`asset`, `hub_id`) — the canonical Soroban `#[contracttype]` layout.
|
|
10
|
-
* - `borrow` carries the same `Vec<(HubAssetKey, i128)>` payload.
|
|
11
|
-
*/
|
|
12
1
|
export {};
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snapshot + sanity tests for the Stellar Soroban lending transaction builders.
|
|
3
|
-
*
|
|
4
|
-
* These tests assert:
|
|
5
|
-
* 1. Every builder returns a non-empty base64 XDR.
|
|
6
|
-
* 2. XDR parses back into a valid Transaction with exactly one InvokeHostFunction
|
|
7
|
-
* operation targeting the configured controller contract.
|
|
8
|
-
* 3. The function name encoded in the XDR matches the Stellar controller
|
|
9
|
-
* entry point exactly (`supply`, `borrow`, `withdraw`, `repay`,
|
|
10
|
-
* `liquidate`, `flash_loan`, `multiply`, `swap_debt`, `swap_collateral`,
|
|
11
|
-
* `repay_debt_with_collateral`).
|
|
12
|
-
* 4. The XDR is deterministic — identical fixture inputs yield identical XDR.
|
|
13
|
-
* 5. Stable snapshots for the full XDR of every builder (regression guard
|
|
14
|
-
* for any unintended encoding change).
|
|
15
|
-
*
|
|
16
|
-
* Builders are RPC-free — they accept a `sourceSequence` so output is
|
|
17
|
-
* fully deterministic and snapshot-testable. The UI layer is responsible
|
|
18
|
-
* for fetching the sequence and running `rpc.Server.prepareTransaction`
|
|
19
|
-
* before signing.
|
|
20
|
-
*/
|
|
21
1
|
export {};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cross-language wire-format check for the aggregator's packed strategy program.
|
|
3
|
-
*
|
|
4
|
-
* The same fixtures are asserted byte-for-byte in
|
|
5
|
-
* `contracts/swap-aggregator/tests/unit/payload_wire_format.rs` and
|
|
6
|
-
* `arb-algo/stellar-indexer/src/transaction/abi.rs`. If this file and those
|
|
7
|
-
* diverge, routes built by this SDK will be rejected on-chain.
|
|
8
|
-
*/
|
|
9
1
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,8 +27,6 @@ export declare const encodePriceKey: (key: StellarPriceKey | Record<string, stri
|
|
|
27
27
|
* upper/lower bps (lower is derived as reciprocal when only bps is given).
|
|
28
28
|
*/
|
|
29
29
|
export declare const encodeAssetOracle: (cfg: AssetOracleConfigInputDto | StellarAssetOracle | Record<string, unknown>) => xdr.ScVal;
|
|
30
|
-
/** @deprecated Use {@link encodeAssetOracle}. */
|
|
31
|
-
export declare const encodeMarketOracleConfigInput: (cfg: AssetOracleConfigInputDto | StellarAssetOracle | Record<string, unknown>) => xdr.ScVal;
|
|
32
30
|
export interface RoleGrantArgs {
|
|
33
31
|
account: string;
|
|
34
32
|
role: string;
|
|
@@ -39,8 +37,6 @@ export interface TransferOwnershipArgs {
|
|
|
39
37
|
}
|
|
40
38
|
/** Governance / aggregator `ConfigureAssetOracle` args. */
|
|
41
39
|
export type ConfigureAssetOracleArgs = ConfigureAssetOracleArgsDto;
|
|
42
|
-
/** @deprecated Alias — use ConfigureAssetOracleArgs. */
|
|
43
|
-
export type ConfigureMarketOracleArgs = ConfigureAssetOracleArgs;
|
|
44
40
|
/** Edit dual-source tolerance (PriceKey + bps). */
|
|
45
41
|
export type EditOracleToleranceArgs = EditOracleToleranceArgsDto;
|
|
46
42
|
export interface CreateLiquidityPoolArgs {
|
|
@@ -90,8 +86,6 @@ export declare function buildStellarSetSwapAggregatorTx(opts: StellarLendingBuil
|
|
|
90
86
|
export declare function buildStellarSetPriceAggregatorTx(opts: StellarLendingBuilderOptions, args: {
|
|
91
87
|
aggregator: string;
|
|
92
88
|
}): BuiltStellarTx;
|
|
93
|
-
/** @deprecated Use buildStellarSetSwapAggregatorTx. */
|
|
94
|
-
export declare const buildStellarSetAggregatorTx: typeof buildStellarSetSwapAggregatorTx;
|
|
95
89
|
/** set_accumulator(addr: Address) — #[only_owner] */
|
|
96
90
|
export declare function buildStellarSetAccumulatorTx(opts: StellarLendingBuilderOptions, args: {
|
|
97
91
|
accumulator: string;
|
|
@@ -106,18 +100,12 @@ export declare function buildStellarApproveBlendPoolTx(opts: StellarLendingBuild
|
|
|
106
100
|
export declare function buildStellarRevokeBlendPoolTx(opts: StellarLendingBuilderOptions, args: {
|
|
107
101
|
pool: string;
|
|
108
102
|
}): BuiltStellarTx;
|
|
109
|
-
/** @deprecated Use buildStellarApproveBlendPoolTx. */
|
|
110
|
-
export declare const buildStellarApproveTokenTx: typeof buildStellarApproveBlendPoolTx;
|
|
111
|
-
/** @deprecated Use buildStellarRevokeBlendPoolTx. */
|
|
112
|
-
export declare const buildStellarRevokeTokenTx: typeof buildStellarRevokeBlendPoolTx;
|
|
113
103
|
/**
|
|
114
104
|
* Direct price-aggregator `set_oracle(key, oracle)` — owner only (governance
|
|
115
105
|
* contract address as tx source after deploy). Prefer governance propose path
|
|
116
106
|
* in production.
|
|
117
107
|
*/
|
|
118
108
|
export declare function buildStellarSetOracleTx(opts: StellarLendingBuilderOptions, args: ConfigureAssetOracleArgs): BuiltStellarTx;
|
|
119
|
-
/** @deprecated Use buildStellarSetOracleTx. */
|
|
120
|
-
export declare const buildStellarSetMarketOracleConfigTx: typeof buildStellarSetOracleTx;
|
|
121
109
|
/** price-aggregator `set_tolerance(key, OracleTolerance)` — owner only. */
|
|
122
110
|
export declare function buildStellarSetOracleToleranceTx(opts: StellarLendingBuilderOptions, args: EditOracleToleranceArgs & {
|
|
123
111
|
upperRatioBps?: number;
|
|
@@ -113,8 +113,6 @@ export declare function buildStellarProposeSetSwapAggregatorTx(opts: StellarGove
|
|
|
113
113
|
export declare function buildStellarProposeSetPriceAggregatorTx(opts: StellarGovernanceBuilderOptions, args: {
|
|
114
114
|
aggregator: string;
|
|
115
115
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
116
|
-
/** @deprecated Use buildStellarProposeSetSwapAggregatorTx. */
|
|
117
|
-
export declare const buildStellarProposeSetAggregatorTx: typeof buildStellarProposeSetSwapAggregatorTx;
|
|
118
116
|
/** propose(SetAccumulator(addr)) */
|
|
119
117
|
export declare function buildStellarProposeSetAccumulatorTx(opts: StellarGovernanceBuilderOptions, args: {
|
|
120
118
|
accumulator: string;
|
|
@@ -187,8 +185,6 @@ export declare function buildStellarProposeTransferCtrlOwnershipTx(opts: Stellar
|
|
|
187
185
|
* Token keys at propose time.
|
|
188
186
|
*/
|
|
189
187
|
export declare function buildStellarProposeConfigureAssetOracleTx(opts: StellarGovernanceBuilderOptions, args: ConfigureAssetOracleArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
190
|
-
/** @deprecated Use buildStellarProposeConfigureAssetOracleTx. */
|
|
191
|
-
export declare const buildStellarProposeConfigureMarketOracleTx: typeof buildStellarProposeConfigureAssetOracleTx;
|
|
192
188
|
/** propose(EditOracleTolerance(EditToleranceArgs)) */
|
|
193
189
|
export declare function buildStellarProposeEditOracleToleranceTx(opts: StellarGovernanceBuilderOptions, args: EditOracleToleranceProposalArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
194
190
|
/** propose(UpgradeGov(hash)) */
|
|
@@ -14,6 +14,7 @@ export * from './governance.js';
|
|
|
14
14
|
export * from './events/index.js';
|
|
15
15
|
export * from './quote.js';
|
|
16
16
|
export * from './swap.js';
|
|
17
|
+
export * from './swap-history.js';
|
|
17
18
|
export * from './route-verify.js';
|
|
18
19
|
export * from './auth-policy.js';
|
|
19
20
|
export * from './prepare.js';
|
|
@@ -31,14 +31,6 @@ export interface StellarQuoteToken {
|
|
|
31
31
|
pool?: string | null;
|
|
32
32
|
/** LP only: constituent token ids in pool order. */
|
|
33
33
|
assets?: string[] | null;
|
|
34
|
-
/** @deprecated Not returned by the service; always `undefined`. */
|
|
35
|
-
kind?: never;
|
|
36
|
-
/** @deprecated Not returned by the service; always `undefined`. */
|
|
37
|
-
sacPeer?: never;
|
|
38
|
-
/** @deprecated Not returned by the service; always `undefined`. */
|
|
39
|
-
code?: never;
|
|
40
|
-
/** @deprecated Not returned by the service; always `undefined`. */
|
|
41
|
-
degree?: never;
|
|
42
34
|
}
|
|
43
35
|
/** Liquidity snapshot the route was searched against. */
|
|
44
36
|
export interface StellarQuoteSnapshot {
|
|
@@ -161,8 +161,6 @@ export declare const scStruct: (fields: Record<string, xdr.ScVal>) => xdr.ScVal;
|
|
|
161
161
|
* callers that construct routes locally.
|
|
162
162
|
*/
|
|
163
163
|
export declare const encodeStrategyPayload: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
|
|
164
|
-
/** @deprecated Use `encodeStrategyPayload`. */
|
|
165
|
-
export declare const encodeAggregatorSwap: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
|
|
166
164
|
export declare const encodeStrategyPayloadToBytes: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
|
|
167
165
|
/**
|
|
168
166
|
* Validate the untyped `steps` field and narrow it to `StrategyPayload`.
|
|
@@ -185,8 +183,6 @@ export declare const emptyStrategySwapBytes: () => xdr.ScVal;
|
|
|
185
183
|
* - decoded `StrategyPayload` object
|
|
186
184
|
*/
|
|
187
185
|
export declare const asStellarStrategySwapBytes: (steps: unknown) => xdr.ScVal;
|
|
188
|
-
/** @deprecated Use `asStellarStrategyPayload` or `asStellarStrategySwapBytes`. */
|
|
189
|
-
export declare const asStellarSwapSteps: (steps: unknown) => StellarStrategyPayloadInput;
|
|
190
186
|
/**
|
|
191
187
|
* Validate the untyped `data` field on FlashLoanArgs and narrow it to
|
|
192
188
|
* Buffer / hex string for Soroban `Bytes` encoding.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface StellarSwapEnvelopeOptions {
|
|
2
|
+
envelopeXdr: string;
|
|
3
|
+
networkPassphrase: string;
|
|
4
|
+
/** Router pinned by the application for this network. */
|
|
5
|
+
routerAddress: string;
|
|
6
|
+
/** Only swaps whose encoded sender equals this address are returned. */
|
|
7
|
+
viewer: string;
|
|
8
|
+
/** Zero-based operation index in the inner transaction. */
|
|
9
|
+
operationIndex?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface DecodedStellarSwapEnvelope {
|
|
12
|
+
tokenIn: string;
|
|
13
|
+
tokenOut: string;
|
|
14
|
+
/** Exact positive input in base units; never converted to a JS number. */
|
|
15
|
+
amountInAtoms: string;
|
|
16
|
+
operationIndex: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Synchronously decode direct XOXNO router swaps, including fee-bump envelopes.
|
|
20
|
+
* Returns null for malformed, unrelated or ambiguous envelopes. Without an
|
|
21
|
+
* operation index exactly one matching swap is required. No RPC or output
|
|
22
|
+
* amount inference: the route minimum is not the amount actually received.
|
|
23
|
+
* The network passphrase parses the envelope; it cannot prove its network.
|
|
24
|
+
*/
|
|
25
|
+
export declare function decodeStellarSwapEnvelope(options: StellarSwapEnvelopeOptions): DecodedStellarSwapEnvelope | null;
|
|
@@ -53,9 +53,6 @@ export interface StellarExecuteStrategyBuilderOptions extends StellarBuilderOpti
|
|
|
53
53
|
*/
|
|
54
54
|
referralId?: number | string;
|
|
55
55
|
}
|
|
56
|
-
/** @deprecated Use `StellarExecuteStrategyBuilderOptions`. */
|
|
57
|
-
export interface StellarBatchSwapBuilderOptions extends StellarExecuteStrategyBuilderOptions {
|
|
58
|
-
}
|
|
59
56
|
export declare const encodeStrategyPayloadToRouteXdr: (payload: StellarStrategyPayloadInput) => string;
|
|
60
57
|
/**
|
|
61
58
|
* Build an unsigned XDR for a direct user -> aggregator router swap.
|
|
@@ -65,11 +62,6 @@ export declare const encodeStrategyPayloadToRouteXdr: (payload: StellarStrategyP
|
|
|
65
62
|
* custom route builders.
|
|
66
63
|
*/
|
|
67
64
|
export declare function buildStellarExecuteStrategyTx(opts: StellarExecuteStrategyBuilderOptions, swap: StellarStrategySwapInput): BuiltStellarTx;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated The router no longer exposes `batch_execute`; this wrapper now
|
|
70
|
-
* builds `execute_strategy(sender, total_in, swap_xdr)`.
|
|
71
|
-
*/
|
|
72
|
-
export declare function buildStellarBatchSwapTx(opts: StellarBatchSwapBuilderOptions, swap: StellarStrategySwapInput): BuiltStellarTx;
|
|
73
65
|
/**
|
|
74
66
|
* Translate a quote-server response into the decoded `StrategyPayload` shape.
|
|
75
67
|
* Prefer `mapQuoteResponseToStrategySwap` when the quote includes `routeXdr`.
|
|
@@ -85,5 +77,3 @@ export declare function mapQuoteResponseToStrategyPayload(quote: StellarAggregat
|
|
|
85
77
|
* @throws StellarRouteVerificationError — never sign a quote that throws here.
|
|
86
78
|
*/
|
|
87
79
|
export declare function mapQuoteResponseToStrategySwap(quote: StellarAggregatorQuoteResponseDto, opts?: StellarQuoteMapOptions): StellarStrategySwapInput;
|
|
88
|
-
/** @deprecated Use `mapQuoteResponseToStrategyPayload`. */
|
|
89
|
-
export declare const mapQuoteResponseToAggregatorSwap: typeof mapQuoteResponseToStrategyPayload;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
type FieldValue<T> = T extends (...args: never[]) => infer R ? R : T;
|
|
3
|
+
/** SDK 16 exposes XDR getters; SDK 17 exposes the same fields as properties. */
|
|
4
|
+
export declare function xdrField<T, K extends keyof T>(value: T, key: K): FieldValue<T[K]>;
|
|
5
|
+
export declare function xdrType(value: unknown): string | undefined;
|
|
6
|
+
/** SDK 17 opaque byte fields wrap their Uint8Array in `value`. */
|
|
7
|
+
export declare function xdrBytes(value: {
|
|
8
|
+
bytes: unknown;
|
|
9
|
+
}): Buffer;
|
|
10
|
+
export declare function xdrOpaque(value: unknown): Buffer;
|
|
11
|
+
export {};
|