@xoxno/sdk-js 1.0.212 → 1.0.214
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 +73 -42
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/sdk/index.d.ts +4 -4
- package/dist/cjs/sdk/stellar/__tests__/integration.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/admin.d.ts +28 -28
- package/dist/cjs/sdk/stellar/cctp.d.ts +2 -2
- package/dist/cjs/sdk/stellar/contracts.d.ts +98 -61
- package/dist/cjs/sdk/stellar/events/index.d.ts +2 -2
- package/dist/cjs/sdk/stellar/governance.d.ts +50 -49
- package/dist/cjs/sdk/stellar/index.d.ts +22 -14
- package/dist/cjs/sdk/stellar/lending-api-types.d.ts +943 -0
- package/dist/cjs/sdk/stellar/lending-read-types.d.ts +54 -269
- package/dist/cjs/sdk/stellar/lending-read.d.ts +279 -131
- package/dist/cjs/sdk/stellar/lending.d.ts +134 -63
- package/dist/cjs/sdk/stellar/prepare.d.ts +27 -7
- package/dist/cjs/sdk/stellar/quote.d.ts +16 -9
- package/dist/cjs/sdk/stellar/swap.d.ts +4 -5
- package/dist/cjs/sdk/stellar-schema.d.ts +5 -0
- package/dist/cjs/sdk/swagger.d.ts +96 -51
- package/dist/cjs/sdk/types.d.ts +2 -2
- package/dist/cjs/utils/api.d.ts +14 -4
- package/dist/cjs/utils/const.d.ts +0 -2
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.LICENSE.txt +8 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +2 -1
- package/dist/index.esm.js.LICENSE.txt +8 -0
- package/dist/sdk/index.d.ts +4 -4
- package/dist/sdk/stellar/__tests__/integration.test.d.ts +1 -0
- package/dist/sdk/stellar/admin.d.ts +28 -28
- package/dist/sdk/stellar/cctp.d.ts +2 -2
- package/dist/sdk/stellar/contracts.d.ts +98 -61
- package/dist/sdk/stellar/events/index.d.ts +2 -2
- package/dist/sdk/stellar/governance.d.ts +50 -49
- package/dist/sdk/stellar/index.cjs +2 -1
- package/dist/sdk/stellar/index.cjs.LICENSE.txt +8 -0
- package/dist/sdk/stellar/index.d.ts +22 -14
- package/dist/sdk/stellar/index.esm.js +2 -1
- package/dist/sdk/stellar/index.esm.js.LICENSE.txt +8 -0
- package/dist/sdk/stellar/lending-api-types.d.ts +943 -0
- package/dist/sdk/stellar/lending-read-types.d.ts +54 -269
- package/dist/sdk/stellar/lending-read.d.ts +279 -131
- package/dist/sdk/stellar/lending.d.ts +134 -63
- package/dist/sdk/stellar/prepare.d.ts +27 -7
- package/dist/sdk/stellar/quote.d.ts +16 -9
- package/dist/sdk/stellar/swap.d.ts +4 -5
- package/dist/sdk/stellar-schema.d.ts +5 -0
- package/dist/sdk/swagger.d.ts +96 -51
- package/dist/sdk/types.d.ts +2 -2
- package/dist/utils/api.d.ts +14 -4
- package/dist/utils/const.d.ts +0 -2
- package/package.json +9 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stellar lending user-operation transaction builders.
|
|
3
3
|
*
|
|
4
|
-
* Each builder takes
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
4
|
+
* Each builder takes a typed Stellar argument object plus shared
|
|
5
|
+
* `StellarLendingBuilderOptions` ({ network, caller, sourceSequence,
|
|
6
|
+
* controllerAddress, ... }) and returns
|
|
7
|
+
* unsigned transaction XDR that must be prepared before wallet signing.
|
|
7
8
|
*
|
|
8
9
|
* i128 values cross the boundary as decimal strings, encoded via
|
|
9
10
|
* `new ScInt(str).toI128()`. Addresses (Stellar `G...` accounts and Soroban
|
|
@@ -16,14 +17,16 @@
|
|
|
16
17
|
* fee) before handing the XDR to the wallet to sign.
|
|
17
18
|
*/
|
|
18
19
|
import { xdr } from '@stellar/stellar-sdk';
|
|
19
|
-
import { type StellarNetwork } from './contracts';
|
|
20
|
-
import { type StellarSeizeModeInput, type StellarStrategySwapHopInput, type StellarStrategySwapInput, type StellarStrategySwapPathInput } from './scval-encode';
|
|
20
|
+
import { type StellarNetwork } from './contracts.js';
|
|
21
|
+
import { type StellarSeizeModeInput, type StellarStrategySwapHopInput, type StellarStrategySwapInput, type StellarStrategySwapPathInput } from './scval-encode.js';
|
|
21
22
|
/**
|
|
22
23
|
* Stellar `G...` public key of the caller (tx source account).
|
|
23
24
|
*/
|
|
24
25
|
export type StellarAccountAddress = string;
|
|
25
26
|
export interface StellarBuilderOptions {
|
|
27
|
+
/** Must match the API deployment, RPC and signing wallet. */
|
|
26
28
|
network: StellarNetwork;
|
|
29
|
+
/** Transaction source and authorizing wallet public key (G...). */
|
|
27
30
|
caller: StellarAccountAddress;
|
|
28
31
|
/**
|
|
29
32
|
* Current sequence number of the caller account, as a decimal string.
|
|
@@ -32,26 +35,23 @@ export interface StellarBuilderOptions {
|
|
|
32
35
|
* makes builders sync-friendly, RPC-free, and deterministic for snapshot tests.
|
|
33
36
|
*/
|
|
34
37
|
sourceSequence: string;
|
|
35
|
-
/**
|
|
36
|
-
* Override the controller contract address. Normally resolved from env via
|
|
37
|
-
* `getStellarLendingController(network)` — override is for tests and
|
|
38
|
-
* preview/staging deployments.
|
|
39
|
-
*/
|
|
40
|
-
controllerAddress?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Override the governance (timelock) contract address. Normally resolved from
|
|
43
|
-
* env via `getStellarGovernance(network)` — override is for tests and
|
|
44
|
-
* preview/staging deployments. Required (env or override) for the governance
|
|
45
|
-
* `propose_*` / `execute` / `execute_*` builders.
|
|
46
|
-
*/
|
|
47
|
-
governanceAddress?: string;
|
|
48
38
|
/** Base fee in stroops (default BASE_FEE = "100"). */
|
|
49
39
|
fee?: string;
|
|
50
40
|
/** Tx timeout in seconds (default 300). */
|
|
51
41
|
timeoutSeconds?: number;
|
|
52
42
|
}
|
|
43
|
+
/** Shared options plus the lending controller contract selected by the host. */
|
|
44
|
+
export interface StellarLendingBuilderOptions extends StellarBuilderOptions {
|
|
45
|
+
/** Soroban lending controller contract (C...). Supplied by the host app. */
|
|
46
|
+
controllerAddress: string;
|
|
47
|
+
}
|
|
48
|
+
/** Shared options plus the governance timelock contract selected by the host. */
|
|
49
|
+
export interface StellarGovernanceBuilderOptions extends StellarBuilderOptions {
|
|
50
|
+
/** Soroban governance/timelock contract (C...). Supplied by the host app. */
|
|
51
|
+
governanceAddress: string;
|
|
52
|
+
}
|
|
53
53
|
export interface BuiltStellarTx {
|
|
54
|
-
/** Unsigned
|
|
54
|
+
/** Unsigned base64 XDR. Pass to prepareStellarBuiltTx before wallet signing. */
|
|
55
55
|
xdr: string;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
@@ -68,7 +68,7 @@ export interface BuiltStellarTx {
|
|
|
68
68
|
export type StellarSwapStepsInput = StellarStrategySwapInput;
|
|
69
69
|
export type StellarSwapHopInput = StellarStrategySwapHopInput;
|
|
70
70
|
export type StellarSwapPathInput = StellarStrategySwapPathInput;
|
|
71
|
-
export type { StellarSeizeModeInput, StellarSwapVenue } from './scval-encode';
|
|
71
|
+
export type { StellarSeizeModeInput, StellarSwapVenue } from './scval-encode.js';
|
|
72
72
|
/**
|
|
73
73
|
* Assemble an unsigned XDR that invokes a single Soroban contract method.
|
|
74
74
|
*
|
|
@@ -77,39 +77,43 @@ export type { StellarSeizeModeInput, StellarSwapVenue } from './scval-encode';
|
|
|
77
77
|
* footprint + auth entries + resource fees) before signing. The UI layer
|
|
78
78
|
* does this via `rpc.Server.prepareTransaction`.
|
|
79
79
|
*/
|
|
80
|
-
export declare function buildTx(opts:
|
|
80
|
+
export declare function buildTx(opts: StellarLendingBuilderOptions, method: string, params: xdr.ScVal[]): BuiltStellarTx;
|
|
81
81
|
/** A `(hub_id, asset)` coordinate — the `HubAssetKey` struct, builder-side. */
|
|
82
82
|
export interface StellarHubAsset {
|
|
83
|
+
/** Liquidity hub from the selected reserve; independent of its risk spoke. */
|
|
83
84
|
hubId: number;
|
|
85
|
+
/** Token contract address (C...), including SAC addresses for classic assets. */
|
|
84
86
|
asset: string;
|
|
85
87
|
}
|
|
86
|
-
/** A
|
|
88
|
+
/** A hub/token coordinate with a token base-unit amount. */
|
|
87
89
|
export interface StellarHubAssetAmount extends StellarHubAsset {
|
|
90
|
+
/** i128 decimal string in token base units; e.g. 1 token at 7 decimals is "10000000". */
|
|
88
91
|
amount: string;
|
|
89
92
|
}
|
|
90
93
|
export interface StellarSupplyArgs extends StellarHubAssetAmount {
|
|
91
|
-
/**
|
|
92
|
-
accountNonce?: number;
|
|
93
|
-
/**
|
|
94
|
-
spokeId
|
|
94
|
+
/** Lending account ID, distinct from the Stellar sequence. Prefer decimal strings; omit / 0 opens an account. */
|
|
95
|
+
accountNonce?: number | string;
|
|
96
|
+
/** Positive risk-spoke ID. Must match the existing account when topping up. */
|
|
97
|
+
spokeId: number;
|
|
95
98
|
}
|
|
96
99
|
export interface StellarSupplyBatchArgs {
|
|
97
|
-
accountNonce?: number;
|
|
98
|
-
|
|
100
|
+
accountNonce?: number | string;
|
|
101
|
+
/** Positive risk-spoke ID; never inferred from the asset or hub. */
|
|
102
|
+
spokeId: number;
|
|
99
103
|
assets: ReadonlyArray<StellarHubAssetAmount>;
|
|
100
104
|
}
|
|
101
105
|
export interface StellarBorrowArgs extends StellarHubAssetAmount {
|
|
102
|
-
accountNonce: number;
|
|
106
|
+
accountNonce: number | string;
|
|
103
107
|
/** Optional recipient override (`C...`/`G...`); debt is recorded on the account. */
|
|
104
108
|
to?: string;
|
|
105
109
|
}
|
|
106
110
|
export interface StellarBorrowBatchArgs {
|
|
107
|
-
accountNonce: number;
|
|
111
|
+
accountNonce: number | string;
|
|
108
112
|
borrows: ReadonlyArray<StellarHubAssetAmount>;
|
|
109
113
|
to?: string;
|
|
110
114
|
}
|
|
111
115
|
export interface StellarWithdrawArgs extends StellarHubAssetAmount {
|
|
112
|
-
accountNonce: number;
|
|
116
|
+
accountNonce: number | string;
|
|
113
117
|
/**
|
|
114
118
|
* Optional recipient override (`C...` or `G...`). The pool pays the
|
|
115
119
|
* withdrawn tokens to this address instead of the caller. Omit for the
|
|
@@ -119,19 +123,19 @@ export interface StellarWithdrawArgs extends StellarHubAssetAmount {
|
|
|
119
123
|
to?: string;
|
|
120
124
|
}
|
|
121
125
|
export interface StellarWithdrawBatchArgs {
|
|
122
|
-
accountNonce: number;
|
|
126
|
+
accountNonce: number | string;
|
|
123
127
|
withdrawals: ReadonlyArray<StellarHubAssetAmount>;
|
|
124
128
|
to?: string;
|
|
125
129
|
}
|
|
126
130
|
export interface StellarRepayArgs extends StellarHubAssetAmount {
|
|
127
|
-
accountNonce: number;
|
|
131
|
+
accountNonce: number | string;
|
|
128
132
|
}
|
|
129
133
|
export interface StellarRepayBatchArgs {
|
|
130
|
-
accountNonce: number;
|
|
134
|
+
accountNonce: number | string;
|
|
131
135
|
payments: ReadonlyArray<StellarHubAssetAmount>;
|
|
132
136
|
}
|
|
133
137
|
export interface StellarLiquidateArgs {
|
|
134
|
-
accountNonce: number;
|
|
138
|
+
accountNonce: number | string;
|
|
135
139
|
debtPayments: ReadonlyArray<StellarHubAssetAmount>;
|
|
136
140
|
/**
|
|
137
141
|
* How the liquidator takes delivery of the seized collateral. Defaults to
|
|
@@ -147,33 +151,34 @@ export interface StellarFlashLoanArgs extends StellarHubAsset {
|
|
|
147
151
|
data: string | Uint8Array;
|
|
148
152
|
}
|
|
149
153
|
export interface StellarMultiplyArgs {
|
|
150
|
-
accountNonce?: number;
|
|
151
|
-
|
|
154
|
+
accountNonce?: number | string;
|
|
155
|
+
/** Positive risk-spoke ID. Must match the existing account when reusing it. */
|
|
156
|
+
spokeId: number;
|
|
152
157
|
collateral: StellarHubAsset;
|
|
153
158
|
debtToFlashLoan: string;
|
|
154
159
|
debt: StellarHubAsset;
|
|
155
|
-
/**
|
|
160
|
+
/** Stellar PositionMode: 0 normal, 1 multiply, 2 long, 3 short. */
|
|
156
161
|
mode: number;
|
|
157
162
|
steps: StellarSwapStepsInput;
|
|
158
163
|
initialPayment?: StellarHubAssetAmount;
|
|
159
164
|
convertSwap?: StellarSwapStepsInput;
|
|
160
165
|
}
|
|
161
166
|
export interface StellarSwapDebtArgs {
|
|
162
|
-
accountNonce: number;
|
|
167
|
+
accountNonce: number | string;
|
|
163
168
|
existingDebt: StellarHubAsset;
|
|
164
169
|
newDebtAmount: string;
|
|
165
170
|
newDebt: StellarHubAsset;
|
|
166
171
|
steps: StellarSwapStepsInput;
|
|
167
172
|
}
|
|
168
173
|
export interface StellarSwapCollateralArgs {
|
|
169
|
-
accountNonce: number;
|
|
174
|
+
accountNonce: number | string;
|
|
170
175
|
current: StellarHubAsset;
|
|
171
176
|
fromAmount: string;
|
|
172
177
|
newCollateral: StellarHubAsset;
|
|
173
178
|
steps: StellarSwapStepsInput;
|
|
174
179
|
}
|
|
175
180
|
export interface StellarRepayDebtWithCollateralArgs {
|
|
176
|
-
accountNonce: number;
|
|
181
|
+
accountNonce: number | string;
|
|
177
182
|
collateral: StellarHubAsset;
|
|
178
183
|
collateralAmount: string;
|
|
179
184
|
debt: StellarHubAsset;
|
|
@@ -183,7 +188,7 @@ export interface StellarRepayDebtWithCollateralArgs {
|
|
|
183
188
|
/**
|
|
184
189
|
* `migrate_from_blend` references the *Blend* pool's bare-`Address` assets, so
|
|
185
190
|
* collateral / supply / debt stay token-keyed; only the account's risk spoke
|
|
186
|
-
*
|
|
191
|
+
* and destination liquidity hub cross on the XOXNO side.
|
|
187
192
|
*/
|
|
188
193
|
export interface StellarMigrateFromBlendArgs {
|
|
189
194
|
accountId: number | string;
|
|
@@ -199,32 +204,68 @@ export interface StellarMigrateFromBlendArgs {
|
|
|
199
204
|
}
|
|
200
205
|
/**
|
|
201
206
|
* supply(caller, account_id: u64, spoke_id: u32, assets: Vec<(HubAssetKey, i128)>)
|
|
207
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
208
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
209
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
210
|
+
* @category Lending transactions
|
|
211
|
+
*/
|
|
212
|
+
export declare function buildStellarSupplyBatchTx(opts: StellarLendingBuilderOptions, args: StellarSupplyBatchArgs): BuiltStellarTx;
|
|
213
|
+
/** Single-asset `supply` — wraps the asset in a 1-element batch.
|
|
214
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
215
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
216
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
217
|
+
* @category Lending transactions
|
|
202
218
|
*/
|
|
203
|
-
export declare function
|
|
204
|
-
/** Single-asset `supply` — wraps the asset in a 1-element batch. */
|
|
205
|
-
export declare function buildStellarSupplyTx(opts: StellarBuilderOptions, args: StellarSupplyArgs): BuiltStellarTx;
|
|
219
|
+
export declare function buildStellarSupplyTx(opts: StellarLendingBuilderOptions, args: StellarSupplyArgs): BuiltStellarTx;
|
|
206
220
|
/**
|
|
207
221
|
* borrow(caller, account_id: u64, borrows: Vec<(HubAssetKey, i128)>,
|
|
208
222
|
* to: Option<Address>) — `to` is always sent; absent means the caller
|
|
209
223
|
* receives the funds.
|
|
224
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
225
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
226
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
227
|
+
* @category Lending transactions
|
|
210
228
|
*/
|
|
211
|
-
export declare function buildStellarBorrowBatchTx(opts:
|
|
212
|
-
/** Single-asset `borrow`.
|
|
213
|
-
|
|
229
|
+
export declare function buildStellarBorrowBatchTx(opts: StellarLendingBuilderOptions, args: StellarBorrowBatchArgs): BuiltStellarTx;
|
|
230
|
+
/** Single-asset `borrow`.
|
|
231
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
232
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
233
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
234
|
+
* @category Lending transactions
|
|
235
|
+
*/
|
|
236
|
+
export declare function buildStellarBorrowTx(opts: StellarLendingBuilderOptions, args: StellarBorrowArgs): BuiltStellarTx;
|
|
214
237
|
/**
|
|
215
238
|
* withdraw(caller, account_id: u64, withdrawals: Vec<(HubAssetKey, i128)>,
|
|
216
239
|
* to: Option<Address>) — `to` is always sent; absent means the caller
|
|
217
240
|
* receives the funds.
|
|
241
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
242
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
243
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
244
|
+
* @category Lending transactions
|
|
245
|
+
*/
|
|
246
|
+
export declare function buildStellarWithdrawBatchTx(opts: StellarLendingBuilderOptions, args: StellarWithdrawBatchArgs): BuiltStellarTx;
|
|
247
|
+
/** Single-asset `withdraw`. Amount "0" withdraws the full supplied position.
|
|
248
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
249
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
250
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
251
|
+
* @category Lending transactions
|
|
218
252
|
*/
|
|
219
|
-
export declare function
|
|
220
|
-
/** Single-asset `withdraw`. */
|
|
221
|
-
export declare function buildStellarWithdrawTx(opts: StellarBuilderOptions, args: StellarWithdrawArgs): BuiltStellarTx;
|
|
253
|
+
export declare function buildStellarWithdrawTx(opts: StellarLendingBuilderOptions, args: StellarWithdrawArgs): BuiltStellarTx;
|
|
222
254
|
/**
|
|
223
255
|
* repay(caller, account_id: u64, payments: Vec<(HubAssetKey, i128)>)
|
|
256
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
257
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
258
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
259
|
+
* @category Lending transactions
|
|
260
|
+
*/
|
|
261
|
+
export declare function buildStellarRepayBatchTx(opts: StellarLendingBuilderOptions, args: StellarRepayBatchArgs): BuiltStellarTx;
|
|
262
|
+
/** Single-asset `repay`.
|
|
263
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
264
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
265
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
266
|
+
* @category Lending transactions
|
|
224
267
|
*/
|
|
225
|
-
export declare function
|
|
226
|
-
/** Single-asset `repay`. */
|
|
227
|
-
export declare function buildStellarRepayTx(opts: StellarBuilderOptions, args: StellarRepayArgs): BuiltStellarTx;
|
|
268
|
+
export declare function buildStellarRepayTx(opts: StellarLendingBuilderOptions, args: StellarRepayArgs): BuiltStellarTx;
|
|
228
269
|
/**
|
|
229
270
|
* liquidate(liquidator, account_id: u64, debt_payments: Vec<(HubAssetKey, i128)>,
|
|
230
271
|
* seize_mode: SeizeMode) -> u64
|
|
@@ -233,8 +274,12 @@ export declare function buildStellarRepayTx(opts: StellarBuilderOptions, args: S
|
|
|
233
274
|
* `SeizeMode::Credit` (freshly opened when `Credit(0)` was passed), and `0`
|
|
234
275
|
* under `SeizeMode::Transfer`. Read it from the simulation / tx result with
|
|
235
276
|
* `decodeStellarLiquidateReturn`.
|
|
277
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
278
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
279
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
280
|
+
* @category Lending transactions
|
|
236
281
|
*/
|
|
237
|
-
export declare function buildStellarLiquidateTx(opts:
|
|
282
|
+
export declare function buildStellarLiquidateTx(opts: StellarLendingBuilderOptions, args: StellarLiquidateArgs): BuiltStellarTx;
|
|
238
283
|
/**
|
|
239
284
|
* Decode `liquidate`'s `u64` return value from its base64 XDR — the receiving
|
|
240
285
|
* account id, as a decimal string. `'0'` means `SeizeMode::Transfer` (the
|
|
@@ -247,22 +292,32 @@ export declare function buildStellarLiquidateTx(opts: StellarBuilderOptions, arg
|
|
|
247
292
|
export declare function decodeStellarLiquidateReturn(returnValueB64: string): string;
|
|
248
293
|
/**
|
|
249
294
|
* flash_loan(caller, asset: HubAssetKey, amount: i128, receiver, data: Bytes)
|
|
295
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
296
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
297
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
298
|
+
* @category Lending transactions
|
|
250
299
|
*/
|
|
251
|
-
export declare function buildStellarFlashLoanTx(opts:
|
|
300
|
+
export declare function buildStellarFlashLoanTx(opts: StellarLendingBuilderOptions, args: StellarFlashLoanArgs): BuiltStellarTx;
|
|
252
301
|
/**
|
|
253
302
|
* Build a `migrate_from_blend` controller invocation: atomically moves a Blend
|
|
254
303
|
* V2 position (collateral + supply + debt) into XOXNO at zero flash-loan fee.
|
|
255
304
|
*
|
|
256
|
-
* ABI: `migrate_from_blend(caller, account_id, spoke_id, blend_pool,
|
|
305
|
+
* ABI: `migrate_from_blend(caller, account_id, spoke_id, hub_id, blend_pool,
|
|
257
306
|
* collateral_assets, supply_assets, debt_caps: Vec<(Address, i128)>)`. Pass
|
|
258
307
|
* `accountId = "0"` to open a new account. Each debt cap should slightly exceed
|
|
259
308
|
* the live Blend debt — Blend refunds the excess, reconciled on-chain.
|
|
260
309
|
*
|
|
261
310
|
* Like every builder this emits an unsigned invoke; the nested `submit(from =
|
|
262
311
|
* user)` authorization is materialized by `prepareTransaction` (simulation) and
|
|
263
|
-
* signed by the wallet over the whole envelope.
|
|
312
|
+
* signed by the wallet over the whole envelope. The Blend pool must be approved
|
|
313
|
+
* by the controller. Use an explicit destination hub and spoke; this operation
|
|
314
|
+
* does not consume aggregator route bytes.
|
|
315
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
316
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
317
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
318
|
+
* @category Lending transactions
|
|
264
319
|
*/
|
|
265
|
-
export declare function buildStellarMigrateFromBlendTx(opts:
|
|
320
|
+
export declare function buildStellarMigrateFromBlendTx(opts: StellarLendingBuilderOptions, args: StellarMigrateFromBlendArgs): BuiltStellarTx;
|
|
266
321
|
/**
|
|
267
322
|
* multiply(caller, account_id, spoke_id, collateral: HubAssetKey,
|
|
268
323
|
* debt_to_flash_loan: i128, debt: HubAssetKey, mode: PositionMode,
|
|
@@ -272,21 +327,37 @@ export declare function buildStellarMigrateFromBlendTx(opts: StellarBuilderOptio
|
|
|
272
327
|
* `mode` is a repr(u32) `PositionMode` → encoded as `scvU32`. The two trailing
|
|
273
328
|
* `Option`s seed an optional initial collateral payment and a secondary swap
|
|
274
329
|
* converting it into the collateral token; both omit to Soroban `Void`.
|
|
330
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
331
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
332
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
333
|
+
* @category Lending transactions
|
|
275
334
|
*/
|
|
276
|
-
export declare function buildStellarMultiplyTx(opts:
|
|
335
|
+
export declare function buildStellarMultiplyTx(opts: StellarLendingBuilderOptions, args: StellarMultiplyArgs): BuiltStellarTx;
|
|
277
336
|
/**
|
|
278
337
|
* swap_debt(caller, account_id, existing_debt: HubAssetKey, amount: i128,
|
|
279
338
|
* new_debt: HubAssetKey, swap: Bytes)
|
|
339
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
340
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
341
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
342
|
+
* @category Lending transactions
|
|
280
343
|
*/
|
|
281
|
-
export declare function buildStellarSwapDebtTx(opts:
|
|
344
|
+
export declare function buildStellarSwapDebtTx(opts: StellarLendingBuilderOptions, args: StellarSwapDebtArgs): BuiltStellarTx;
|
|
282
345
|
/**
|
|
283
346
|
* swap_collateral(caller, account_id, current: HubAssetKey, amount: i128,
|
|
284
347
|
* new: HubAssetKey, swap: Bytes)
|
|
348
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
349
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
350
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
351
|
+
* @category Lending transactions
|
|
285
352
|
*/
|
|
286
|
-
export declare function buildStellarSwapCollateralTx(opts:
|
|
353
|
+
export declare function buildStellarSwapCollateralTx(opts: StellarLendingBuilderOptions, args: StellarSwapCollateralArgs): BuiltStellarTx;
|
|
287
354
|
/**
|
|
288
355
|
* repay_debt_with_collateral(caller, account_id, collateral: HubAssetKey,
|
|
289
356
|
* collateral_amount: i128, debt: HubAssetKey,
|
|
290
357
|
* swap: Bytes, close_position: bool)
|
|
358
|
+
* @param opts - Network, caller, current source sequence and deployment addresses.
|
|
359
|
+
* @param args - Operation arguments; token amounts are decimal base-unit strings.
|
|
360
|
+
* @returns Unsigned XDR; prepare with prepareStellarBuiltTx before wallet signing.
|
|
361
|
+
* @category Lending transactions
|
|
291
362
|
*/
|
|
292
|
-
export declare function buildStellarRepayDebtWithCollateralTx(opts:
|
|
363
|
+
export declare function buildStellarRepayDebtWithCollateralTx(opts: StellarLendingBuilderOptions, args: StellarRepayDebtWithCollateralArgs): BuiltStellarTx;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { FeeBumpTransaction, Transaction } from '@stellar/stellar-sdk';
|
|
2
|
-
import type { BuiltStellarTx } from './lending';
|
|
2
|
+
import type { BuiltStellarTx } from './lending.js';
|
|
3
|
+
import { type StellarNetwork } from './contracts.js';
|
|
4
|
+
/** Options for preparing unsigned XDR. The wallet must sign on this network. */
|
|
5
|
+
export interface StellarPrepareOptions {
|
|
6
|
+
/** Selected Stellar network. Omission preserves the legacy unsigned-XDR API. */
|
|
7
|
+
network?: StellarNetwork;
|
|
8
|
+
/** Contract used to qualify errors before mapping controller/pool error codes. */
|
|
9
|
+
invokedContractId?: string;
|
|
10
|
+
}
|
|
3
11
|
/**
|
|
4
12
|
* The single `rpc.Server` capability the prepare helpers need. Declared
|
|
5
13
|
* structurally instead of `Pick<rpc.Server, 'prepareTransaction'>` so the
|
|
@@ -16,10 +24,22 @@ export declare function tagStellarInvokedContractError(contractId: string, error
|
|
|
16
24
|
* Simulate a built Soroban envelope (footprint, auth, resource fee) and return
|
|
17
25
|
* prepared base64 XDR. Optionally tag failures with the invoked contract id so
|
|
18
26
|
* UIs can map `Error(Contract, #N)` codes to the right ABI.
|
|
27
|
+
* @param server - Host application's RPC server on the selected network.
|
|
28
|
+
* @param xdr - Unsigned builder output, not a signed transaction.
|
|
29
|
+
* @param opts - Pass `network` explicitly; it must match the RPC and wallet.
|
|
30
|
+
* @returns Prepared, unsigned base64 XDR for wallet signing.
|
|
31
|
+
* @remarks This helper does not sign, submit, or wait for confirmation. Existing
|
|
32
|
+
* calls without `network` retain a neutral hash domain because XDR contains no
|
|
33
|
+
* passphrase; always select the actual network when the wallet signs.
|
|
34
|
+
* @category Transaction preparation
|
|
19
35
|
*/
|
|
20
|
-
export declare function prepareStellarTxXdr(server: StellarTxPreparer, xdr: string, opts?:
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
export declare function prepareStellarTxXdr(server: StellarTxPreparer, xdr: string, opts?: StellarPrepareOptions): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Prepare {@link BuiltStellarTx} before wallet signing.
|
|
39
|
+
* @param server - Host RPC server for the selected deployment.
|
|
40
|
+
* @param built - Unsigned output of any Stellar transaction builder.
|
|
41
|
+
* @param opts - Network and optional contract context for error mapping.
|
|
42
|
+
* @returns Prepared unsigned base64 XDR; sign this result, then submit it.
|
|
43
|
+
* @category Transaction preparation
|
|
44
|
+
*/
|
|
45
|
+
export declare function prepareStellarBuiltTx(server: StellarTxPreparer, built: BuiltStellarTx, opts?: StellarPrepareOptions): Promise<string>;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* after the SDK encoder rewrites field names.
|
|
13
13
|
*/
|
|
14
14
|
import type { StellarAggregatorQuoteRequestDto, StellarAggregatorQuoteResponseDto, StellarTokenKind } from '@xoxno/types';
|
|
15
|
-
import {
|
|
15
|
+
import type { StellarNetwork } from './contracts.js';
|
|
16
16
|
/**
|
|
17
17
|
* Resolved token entry returned by the quote server's tokens endpoint.
|
|
18
18
|
* Mirrors the indexer's `TokenEntry` JSON exactly.
|
|
@@ -31,10 +31,10 @@ export interface StellarQuoteToken {
|
|
|
31
31
|
degree: number;
|
|
32
32
|
}
|
|
33
33
|
export interface StellarQuoteFetchOptions {
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
|
|
34
|
+
/** Quote-server base URL selected by the host application. */
|
|
35
|
+
baseUrl: string;
|
|
36
|
+
/** @deprecated The URL is explicit; network is retained for source compatibility. */
|
|
37
|
+
network?: StellarNetwork;
|
|
38
38
|
/** Per-call fetch options (signal, headers, etc.). */
|
|
39
39
|
fetchOptions?: RequestInit;
|
|
40
40
|
}
|
|
@@ -45,14 +45,21 @@ export interface StellarQuoteFetchOptions {
|
|
|
45
45
|
* `amountOut`. Reverse mode: pass `amountOut` to compute the minimum
|
|
46
46
|
* `amountIn` that delivers at least that output.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
48
|
+
* For lending strategies, pass the quote's `routeXdr` to the builder's
|
|
49
|
+
* `steps`. Amounts are token base-unit decimal strings. Requote after changes
|
|
50
|
+
* to amount, direction or slippage; preparation is the execution check.
|
|
51
|
+
*
|
|
52
|
+
* Passing both `sender` (G...) and `router` (C...) may return a direct-swap
|
|
53
|
+
* envelope under `transaction.envelopeXdr`. Prepare it before wallet signing.
|
|
54
|
+
* @param request - Exactly one of amountIn or amountOut; optional referralId is forwarded unchanged.
|
|
55
|
+
* @param opts - Quote-server URL and optional fetch options supplied by the host.
|
|
56
|
+
* @returns Quote estimates and opaque route bytes; does not execute a swap.
|
|
57
|
+
* @category Strategy quotes
|
|
52
58
|
*/
|
|
53
59
|
export declare function getStellarAggregatorQuote(request: StellarAggregatorQuoteRequestDto, opts: StellarQuoteFetchOptions): Promise<StellarAggregatorQuoteResponseDto>;
|
|
54
60
|
/**
|
|
55
61
|
* List tokens currently indexed by the quote server. Useful to populate
|
|
56
62
|
* pickers or validate that a user-supplied token has on-chain liquidity.
|
|
63
|
+
* @category Strategy quotes
|
|
57
64
|
*/
|
|
58
65
|
export declare function getStellarQuoteTokens(opts: StellarQuoteFetchOptions): Promise<StellarQuoteToken[]>;
|
|
@@ -11,18 +11,17 @@
|
|
|
11
11
|
* opaque route bytes to the controller, which forwards them to the aggregator.
|
|
12
12
|
*/
|
|
13
13
|
import type { StellarAggregatorQuoteResponseDto } from '@xoxno/types';
|
|
14
|
-
import type { BuiltStellarTx, StellarBuilderOptions } from './lending';
|
|
15
|
-
import { type StellarStrategyPayloadInput, type StellarStrategySwapHopInput, type StellarStrategySwapInput, type StellarStrategySwapPathInput } from './scval-encode';
|
|
14
|
+
import type { BuiltStellarTx, StellarBuilderOptions } from './lending.js';
|
|
15
|
+
import { type StellarStrategyPayloadInput, type StellarStrategySwapHopInput, type StellarStrategySwapInput, type StellarStrategySwapPathInput } from './scval-encode.js';
|
|
16
16
|
export type StellarStrategyPayload = StellarStrategyPayloadInput;
|
|
17
17
|
export type StellarStrategySwap = StellarStrategySwapInput;
|
|
18
18
|
export type StellarStrategySwapHop = StellarStrategySwapHopInput;
|
|
19
19
|
export type StellarStrategySwapPath = StellarStrategySwapPathInput;
|
|
20
20
|
export interface StellarExecuteStrategyBuilderOptions extends StellarBuilderOptions {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* resolved from `STELLAR_AGGREGATOR_ROUTER[network]`.
|
|
22
|
+
* Aggregator router contract (C...) selected by the host application.
|
|
24
23
|
*/
|
|
25
|
-
routerAddress
|
|
24
|
+
routerAddress: string;
|
|
26
25
|
/**
|
|
27
26
|
* Total input amount passed to `execute_strategy` (i128 decimal string).
|
|
28
27
|
* For a quote-derived swap, pass `quote.amountIn`.
|