@upshiftfinance/sdk 0.4.0 → 0.5.0
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 +5 -1
- package/esm/index.d.mts +15 -0
- package/esm/index.mjs +18 -0
- package/lib/adapters/sui/actions.d.ts +260 -14
- package/lib/adapters/sui/actions.js +332 -13
- package/lib/adapters/sui/client.d.ts +3 -3
- package/lib/adapters/sui/client.js +27 -9
- package/lib/adapters/sui/getters.d.ts +104 -2
- package/lib/adapters/sui/getters.js +283 -5
- package/lib/adapters/sui/index.d.ts +154 -7
- package/lib/adapters/sui/index.js +166 -9
- package/lib/adapters/sui/targets.d.ts +7 -1
- package/lib/adapters/sui/targets.js +7 -1
- package/lib/core/analytics/method-taxonomy.js +2 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/errors/index.d.ts +15 -2
- package/lib/evm/methods/crossChainVault.js +25 -43
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/main.d.ts +4 -2
- package/lib/modules/vaults/getters.js +34 -6
- package/lib/modules/vaults/main.d.ts +4 -2
- package/lib/modules/vaults/main.js +3 -1
- package/lib/sdk.d.ts +16359 -15349
- package/package.json +21 -2
package/README.md
CHANGED
|
@@ -154,7 +154,7 @@ src.ts/
|
|
|
154
154
|
│ ├── evm/ # EVM adapter (approve, deposit, redeem, read helpers)
|
|
155
155
|
│ ├── solana/ # Solana program adapters
|
|
156
156
|
│ ├── stellar/ # Stellar vault adapters
|
|
157
|
-
│ └── sui/ # Sui
|
|
157
|
+
│ └── sui/ # Sui client, contract targets, vault reads and actions
|
|
158
158
|
├── evm/ # EVM cross-chain (LayerZero OVault)
|
|
159
159
|
├── modules/ # Feature modules
|
|
160
160
|
│ ├── vaults/ # Vault read operations
|
|
@@ -183,6 +183,7 @@ src.ts/
|
|
|
183
183
|
- `evm-2`: Current EVM vault architecture (separate receipt tokens)
|
|
184
184
|
- `sol-0`: Solana program-based vaults
|
|
185
185
|
- `stellar-0`: Stellar-based vaults
|
|
186
|
+
- `sui-0`: Sui Move vaults
|
|
186
187
|
|
|
187
188
|
### Data Enrichment
|
|
188
189
|
|
|
@@ -337,6 +338,9 @@ if (walletClient) sdk.evm.setSigner(walletClient);
|
|
|
337
338
|
|
|
338
339
|
| Method | Description |
|
|
339
340
|
| --- | --- |
|
|
341
|
+
| `vaultDeposit(options)` | Build an unsigned deposit (dry-run first) |
|
|
342
|
+
| `vaultRedeem(options)` | Build an unsigned instant redemption (dry-run first) |
|
|
343
|
+
| `executeTransaction({ bytes, signature })` | Execute a wallet-signed transaction and wait for it |
|
|
340
344
|
| `isSuiAddress(address)` | Whether a string is a Sui address / object ID (`0x` + 64 hex) |
|
|
341
345
|
| `isSuiVault(chainId)` | Whether a chain ID is Sui's (`-2`) |
|
|
342
346
|
| `network`, `rpcUrl` | The `sui` config passed to `new UpshiftSDK({ sui })` |
|
package/esm/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type entry for ESM consumers of `@upshiftfinance/sdk` (paired with
|
|
3
|
+
* `esm/index.mjs`).
|
|
4
|
+
*
|
|
5
|
+
* The declaration rollup `lib/sdk.d.ts` describes a CommonJS module. Under
|
|
6
|
+
* ESM-mode TypeScript (`module: node16 | nodenext`), a default import of a CJS
|
|
7
|
+
* declaration resolves to the whole `module.exports`, so
|
|
8
|
+
* `new UpshiftSDK()` failed to typecheck ("This expression is not
|
|
9
|
+
* constructable"). `import = require` reads the CJS module as-is, letting us
|
|
10
|
+
* re-export its `default` (the `UpshiftSDK` class) as the ESM default.
|
|
11
|
+
*/
|
|
12
|
+
import sdk = require('../lib/sdk.js');
|
|
13
|
+
|
|
14
|
+
export * from '../lib/sdk.js';
|
|
15
|
+
export default sdk.default;
|
package/esm/index.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESM entry point for `@upshiftfinance/sdk`.
|
|
3
|
+
*
|
|
4
|
+
* The SDK is compiled to CommonJS (`lib/index.js`), where the default export
|
|
5
|
+
* lives on `exports.default`. Node's ESM loader (and tools that follow it:
|
|
6
|
+
* Vite SSR, vitest, tsx, plain `node` with `"type": "module"`) maps a default
|
|
7
|
+
* import of a CJS module to the whole `module.exports` object, so
|
|
8
|
+
* `import UpshiftSDK from '@upshiftfinance/sdk'` returned a namespace object
|
|
9
|
+
* and `new UpshiftSDK()` threw "UpshiftSDK is not a constructor".
|
|
10
|
+
*
|
|
11
|
+
* This wrapper re-exports the same CJS module instance (no dual-package
|
|
12
|
+
* hazard: one copy of every class, cache, and `instanceof` check) and binds
|
|
13
|
+
* its `default` to the `UpshiftSDK` class.
|
|
14
|
+
*/
|
|
15
|
+
import cjs from '../lib/index.js';
|
|
16
|
+
|
|
17
|
+
export * from '../lib/index.js';
|
|
18
|
+
export default cjs.default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sui vault actions: deposit and
|
|
2
|
+
* Sui vault actions: deposit, instant redeem, and the withdrawal queue
|
|
3
|
+
* (request, cancel, claim).
|
|
3
4
|
*
|
|
4
5
|
* Each builder dry-runs the exact transaction with the sender's own coins, so
|
|
5
6
|
* a vault that would reject it (paused, queue attached, limits) fails here
|
|
@@ -23,10 +24,16 @@ export interface ISuiDepositParams {
|
|
|
23
24
|
/** Wallet that pays the deposit and receives the shares. */
|
|
24
25
|
sender: string;
|
|
25
26
|
/**
|
|
26
|
-
* Smallest share amount to accept. Defaults to the
|
|
27
|
-
*
|
|
27
|
+
* Smallest share amount to accept. Wins over `slippageBps`. Defaults to the
|
|
28
|
+
* dry run's preview less `slippageBps`.
|
|
28
29
|
*/
|
|
29
30
|
minSharesOut?: bigint;
|
|
31
|
+
/**
|
|
32
|
+
* Tolerance below the dry run's preview, in basis points (0–10000), used
|
|
33
|
+
* when `minSharesOut` is not set. Defaults to {@link DEFAULT_SUI_SLIPPAGE_BPS}.
|
|
34
|
+
* `0` demands exactly the preview.
|
|
35
|
+
*/
|
|
36
|
+
slippageBps?: number;
|
|
30
37
|
}
|
|
31
38
|
/** Parameters for {@link buildSuiRedeemTransaction}. */
|
|
32
39
|
export interface ISuiRedeemParams {
|
|
@@ -37,10 +44,16 @@ export interface ISuiRedeemParams {
|
|
|
37
44
|
/** Wallet that holds the shares and receives the assets. */
|
|
38
45
|
sender: string;
|
|
39
46
|
/**
|
|
40
|
-
* Smallest asset amount to accept, net of the instant fee.
|
|
41
|
-
* dry run's
|
|
47
|
+
* Smallest asset amount to accept, net of the instant fee. Wins over
|
|
48
|
+
* `slippageBps`. Defaults to the dry run's preview less `slippageBps`.
|
|
42
49
|
*/
|
|
43
50
|
minAssetsOut?: bigint;
|
|
51
|
+
/**
|
|
52
|
+
* Tolerance below the dry run's preview, in basis points (0–10000), used
|
|
53
|
+
* when `minAssetsOut` is not set. Defaults to {@link DEFAULT_SUI_SLIPPAGE_BPS}.
|
|
54
|
+
* `0` demands exactly the preview.
|
|
55
|
+
*/
|
|
56
|
+
slippageBps?: number;
|
|
44
57
|
}
|
|
45
58
|
/** An unsigned deposit transaction and the minimum it enforces. */
|
|
46
59
|
export interface ISuiDepositTransaction {
|
|
@@ -69,8 +82,28 @@ export interface ISuiSignedTransaction {
|
|
|
69
82
|
/** The sender's signature, base64. */
|
|
70
83
|
signature: string;
|
|
71
84
|
}
|
|
72
|
-
/**
|
|
73
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Default tolerance below the previewed output: 10 basis points (0.1%).
|
|
87
|
+
*
|
|
88
|
+
* Between the dry run and execution the price moves only by rounding (a unit
|
|
89
|
+
* as other deposits and redemptions land) and by management fee accruing for
|
|
90
|
+
* a few seconds; 0.1% absorbs both. An operator AUM report can move it by up
|
|
91
|
+
* to the vault's report bound (percent-level), which this still rejects with
|
|
92
|
+
* `slippage` rather than fill at a price the user did not see.
|
|
93
|
+
*/
|
|
94
|
+
export declare const DEFAULT_SUI_SLIPPAGE_BPS = 10;
|
|
95
|
+
/**
|
|
96
|
+
* The minimum output for a previewed amount: `expected` less `slippageBps`,
|
|
97
|
+
* rounded down.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
export declare function suiMinOut(expected: bigint, slippageBps: number): bigint;
|
|
101
|
+
/**
|
|
102
|
+
* A failed Sui execution: `effects.status.error` of a failed transaction, or
|
|
103
|
+
* the `executionError` of a `SimulationError` a wallet's build throws. Only
|
|
104
|
+
* the fields the mapping reads.
|
|
105
|
+
*/
|
|
106
|
+
export interface ISuiExecutionError {
|
|
74
107
|
message?: string;
|
|
75
108
|
MoveAbort?: {
|
|
76
109
|
abortCode?: string;
|
|
@@ -87,10 +120,23 @@ interface ISuiExecutionError {
|
|
|
87
120
|
* {@link UpshiftVaultAbortError} with a stable reason, anything else an
|
|
88
121
|
* {@link UpshiftSDKError} (`UNKNOWN`).
|
|
89
122
|
*
|
|
123
|
+
* The SDK applies this itself to its dry runs and to `executeTransaction`.
|
|
124
|
+
* Use it when the wallet builds, signs or executes a transaction and fails,
|
|
125
|
+
* e.g. because the vault changed after the SDK built it.
|
|
126
|
+
*
|
|
90
127
|
* @param executionError - `effects.status.error` of a failed transaction, or
|
|
91
128
|
* the `executionError` of a `SimulationError`.
|
|
92
129
|
* @param context - Structured context for the error (e.g. network, digest).
|
|
93
|
-
* @
|
|
130
|
+
* @returns The typed error; throw it or branch on its `reason`.
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* try {
|
|
134
|
+
* await dAppKit.signTransaction({ transaction });
|
|
135
|
+
* } catch (err) {
|
|
136
|
+
* if (err?.executionError) throw Sui.actions.suiExecutionErrorToSdkError(err.executionError);
|
|
137
|
+
* throw err;
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
94
140
|
*/
|
|
95
141
|
export declare function suiExecutionErrorToSdkError(executionError: ISuiExecutionError | undefined, context?: Record<string, unknown>): UpshiftSDKError;
|
|
96
142
|
/**
|
|
@@ -103,7 +149,11 @@ export declare function suiExecutionErrorToSdkError(executionError: ISuiExecutio
|
|
|
103
149
|
*
|
|
104
150
|
* RPC cost: one dry run (plus the coin lookup it needs).
|
|
105
151
|
*
|
|
106
|
-
*
|
|
152
|
+
* The minimum is the dry run's preview less `slippageBps` (default 0.1%),
|
|
153
|
+
* unless `minSharesOut` is given.
|
|
154
|
+
*
|
|
155
|
+
* @param params - Vault, amount, sender, and optional `minSharesOut` or
|
|
156
|
+
* `slippageBps`.
|
|
107
157
|
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
108
158
|
* @returns The unsigned transaction, the shares the dry run minted and the
|
|
109
159
|
* minimum it enforces.
|
|
@@ -120,13 +170,18 @@ export declare function suiExecutionErrorToSdkError(executionError: ISuiExecutio
|
|
|
120
170
|
* { vault: ref, amount: 1_000_000n, sender: account.address },
|
|
121
171
|
* sdkSuiConfig,
|
|
122
172
|
* );
|
|
123
|
-
* const
|
|
173
|
+
* const digest = await submitSuiTransaction(
|
|
174
|
+
* await dAppKit.signTransaction({ transaction }),
|
|
175
|
+
* 'testnet',
|
|
176
|
+
* sdkSuiConfig,
|
|
177
|
+
* );
|
|
124
178
|
* ```
|
|
125
179
|
*/
|
|
126
180
|
export declare function buildSuiDepositTransaction(params: ISuiDepositParams, sui?: ISuiConfig): Promise<ISuiDepositTransaction>;
|
|
127
181
|
/**
|
|
128
|
-
* Build an unsigned instant redemption:
|
|
129
|
-
* asset amount and send the assets to the sender —
|
|
182
|
+
* Build an unsigned instant redemption: charge the management fee, redeem
|
|
183
|
+
* shares with a minimum net asset amount and send the assets to the sender —
|
|
184
|
+
* one transaction.
|
|
130
185
|
*
|
|
131
186
|
* The shares are `coinWithBalance(Share)`. A vault with a withdrawal queue
|
|
132
187
|
* attached has instant redemption off; that fails here with `queue_attached`.
|
|
@@ -137,7 +192,11 @@ export declare function buildSuiDepositTransaction(params: ISuiDepositParams, su
|
|
|
137
192
|
*
|
|
138
193
|
* RPC cost: one dry run (plus the coin lookup it needs).
|
|
139
194
|
*
|
|
140
|
-
*
|
|
195
|
+
* The minimum is the dry run's net preview less `slippageBps` (default 0.1%),
|
|
196
|
+
* unless `minAssetsOut` is given.
|
|
197
|
+
*
|
|
198
|
+
* @param params - Vault, shares, sender, and optional `minAssetsOut` or
|
|
199
|
+
* `slippageBps`.
|
|
141
200
|
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
142
201
|
* @returns The unsigned transaction, the dry run's gross and net assets and
|
|
143
202
|
* the minimum it enforces.
|
|
@@ -150,6 +209,194 @@ export declare function buildSuiDepositTransaction(params: ISuiDepositParams, su
|
|
|
150
209
|
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
151
210
|
*/
|
|
152
211
|
export declare function buildSuiRedeemTransaction(params: ISuiRedeemParams, sui?: ISuiConfig): Promise<ISuiRedeemTransaction>;
|
|
212
|
+
/** Parameters for {@link buildSuiRequestRedeemTransaction}. */
|
|
213
|
+
export interface ISuiRequestRedeemParams {
|
|
214
|
+
/** The vault and its coin types and network. */
|
|
215
|
+
vault: ISuiVaultRef;
|
|
216
|
+
/** Shares to escrow, in share base units. */
|
|
217
|
+
shares: bigint;
|
|
218
|
+
/** Wallet that holds the shares and owns the request. */
|
|
219
|
+
sender: string;
|
|
220
|
+
/** Address the claim pays, into its address balance. Defaults to `sender`. */
|
|
221
|
+
payout?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Who besides the owner may claim the request during the first day after it
|
|
224
|
+
* becomes claimable; from then on anyone may. Defaults to the owner alone,
|
|
225
|
+
* so nobody else can choose the moment the holder leaves (the claim is
|
|
226
|
+
* priced then). Pass a keeper's address to let it settle at once, or `null`
|
|
227
|
+
* to let anyone claim as soon as the cooldown ends. The payout goes to
|
|
228
|
+
* `payout` whoever claims.
|
|
229
|
+
*/
|
|
230
|
+
finalizer?: string | null;
|
|
231
|
+
}
|
|
232
|
+
/** An unsigned withdrawal request and the request it creates. */
|
|
233
|
+
export interface ISuiRequestRedeemTransaction {
|
|
234
|
+
/** Unsigned transaction, sender set; sign it with the sender's wallet. */
|
|
235
|
+
transaction: Transaction;
|
|
236
|
+
/** The wallet's numeric ID for the request on this vault. */
|
|
237
|
+
requestId: bigint;
|
|
238
|
+
/** Object ID the request will have; pass it as `request` to claim or cancel. */
|
|
239
|
+
request: string;
|
|
240
|
+
/**
|
|
241
|
+
* What the shares would pay at today's price, in asset base units. The claim
|
|
242
|
+
* is priced when it happens, so this is an estimate.
|
|
243
|
+
*/
|
|
244
|
+
expectedAssets: bigint;
|
|
245
|
+
}
|
|
246
|
+
/** Parameters for {@link buildSuiCancelRedeemRequestTransaction}. */
|
|
247
|
+
export interface ISuiCancelRedeemRequestParams {
|
|
248
|
+
/** The vault and its coin types and network. */
|
|
249
|
+
vault: ISuiVaultRef;
|
|
250
|
+
/** Request object ID, from `getSuiWithdrawalRequests` or the request build. */
|
|
251
|
+
request: string;
|
|
252
|
+
/** Wallet that made the request; it gets the shares back. */
|
|
253
|
+
sender: string;
|
|
254
|
+
}
|
|
255
|
+
/** An unsigned cancellation and the shares it returns. */
|
|
256
|
+
export interface ISuiCancelRedeemRequestTransaction {
|
|
257
|
+
/** Unsigned transaction, sender set; sign it with the sender's wallet. */
|
|
258
|
+
transaction: Transaction;
|
|
259
|
+
/** Shares the dry run returned to the sender. */
|
|
260
|
+
shares: bigint;
|
|
261
|
+
}
|
|
262
|
+
/** Parameters for {@link buildSuiClaimWithdrawalTransaction}. */
|
|
263
|
+
export interface ISuiClaimWithdrawalParams {
|
|
264
|
+
/** The vault and its coin types and network. */
|
|
265
|
+
vault: ISuiVaultRef;
|
|
266
|
+
/** Request object ID, from `getSuiWithdrawalRequests` or the request build. */
|
|
267
|
+
request: string;
|
|
268
|
+
/**
|
|
269
|
+
* Wallet that signs and pays gas: the owner, the request's finalizer, or
|
|
270
|
+
* anyone the request permits. The assets go to the request's payout.
|
|
271
|
+
*/
|
|
272
|
+
sender: string;
|
|
273
|
+
/**
|
|
274
|
+
* Smallest asset amount to accept. Wins over `slippageBps`. Defaults to the
|
|
275
|
+
* dry run's preview less `slippageBps`.
|
|
276
|
+
*/
|
|
277
|
+
minAssetsOut?: bigint;
|
|
278
|
+
/**
|
|
279
|
+
* Tolerance below the dry run's preview, in basis points (0–10000), used
|
|
280
|
+
* when `minAssetsOut` is not set. Defaults to {@link DEFAULT_SUI_SLIPPAGE_BPS}.
|
|
281
|
+
*/
|
|
282
|
+
slippageBps?: number;
|
|
283
|
+
}
|
|
284
|
+
/** An unsigned claim and what it pays. */
|
|
285
|
+
export interface ISuiClaimWithdrawalTransaction {
|
|
286
|
+
/** Unsigned transaction, sender set; sign it with the sender's wallet. */
|
|
287
|
+
transaction: Transaction;
|
|
288
|
+
/** Escrowed shares the claim burns. */
|
|
289
|
+
shares: bigint;
|
|
290
|
+
/** Previewed payout, in asset base units (no fee on queued withdrawals). */
|
|
291
|
+
expectedAssets: bigint;
|
|
292
|
+
/** Minimum assets the transaction accepts. */
|
|
293
|
+
minAssetsOut: bigint;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Build an unsigned withdrawal request for a vault with a withdrawal queue:
|
|
297
|
+
* escrow the shares in a new request object and share it — one transaction.
|
|
298
|
+
*
|
|
299
|
+
* The request is priced when it is claimed, not now. Once the vault's cooldown
|
|
300
|
+
* has run, claim it with {@link buildSuiClaimWithdrawalTransaction}; it can be
|
|
301
|
+
* cancelled at any time with {@link buildSuiCancelRedeemRequestTransaction}.
|
|
302
|
+
*
|
|
303
|
+
* The request ID is the lowest the wallet has never used on this vault
|
|
304
|
+
* (`0, 1, 2, …`), which is how `getSuiWithdrawalRequests` finds requests
|
|
305
|
+
* without an event index. Two requests built before either lands get the same
|
|
306
|
+
* ID; the second then fails (the node refuses its stale coins, or it aborts
|
|
307
|
+
* with `request_id_in_use`) — build it again.
|
|
308
|
+
*
|
|
309
|
+
* The finalizer defaults to the owner: only the owner can claim during the
|
|
310
|
+
* first day the request is claimable, then anyone can (e.g. a keeper).
|
|
311
|
+
*
|
|
312
|
+
* RPC cost: one object read for the next ID (more after 23 earlier requests),
|
|
313
|
+
* then one dry run (plus the coin lookup it needs).
|
|
314
|
+
*
|
|
315
|
+
* @param params - Vault, shares, sender, and optional `payout` and `finalizer`.
|
|
316
|
+
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
317
|
+
* @returns The unsigned transaction, the request ID and the request's object ID.
|
|
318
|
+
* @throws {@link UpshiftValidationError} for a malformed address, an
|
|
319
|
+
* out-of-range amount, unknown contract IDs, or a transaction that cannot be
|
|
320
|
+
* built (e.g. the sender lacks the shares).
|
|
321
|
+
* @throws {@link UpshiftVaultAbortError} when the vault would reject it
|
|
322
|
+
* (`queue_not_attached`, `paused`, `above_max_withdrawal`, `invalid_payout`,
|
|
323
|
+
* `request_id_in_use`, `version_retired`), or the shares would pay nothing
|
|
324
|
+
* (`zero_output`).
|
|
325
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
326
|
+
* @example
|
|
327
|
+
* ```ts
|
|
328
|
+
* const { transaction, request } = await buildSuiRequestRedeemTransaction(
|
|
329
|
+
* { vault: ref, shares: 1_000_000n, sender: account.address },
|
|
330
|
+
* sdkSuiConfig,
|
|
331
|
+
* );
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
export declare function buildSuiRequestRedeemTransaction(params: ISuiRequestRedeemParams, sui?: ISuiConfig): Promise<ISuiRequestRedeemTransaction>;
|
|
335
|
+
/**
|
|
336
|
+
* Build an unsigned cancellation of a pending withdrawal request: the escrowed
|
|
337
|
+
* shares go back to the sender — one transaction.
|
|
338
|
+
*
|
|
339
|
+
* Allowed at any time while the request exists, also while the vault is
|
|
340
|
+
* paused or after the request expired. Only the wallet that made it may.
|
|
341
|
+
*
|
|
342
|
+
* RPC cost: one dry run.
|
|
343
|
+
*
|
|
344
|
+
* @param params - Vault, request object ID and sender.
|
|
345
|
+
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
346
|
+
* @returns The unsigned transaction and the shares it returns.
|
|
347
|
+
* @throws {@link UpshiftValidationError} for a malformed address, unknown
|
|
348
|
+
* contract IDs, or a transaction that cannot be built (e.g. the request no
|
|
349
|
+
* longer exists).
|
|
350
|
+
* @throws {@link UpshiftVaultAbortError} when the vault would reject it
|
|
351
|
+
* (`not_request_owner`, `version_retired`).
|
|
352
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const { transaction } = await buildSuiCancelRedeemRequestTransaction(
|
|
356
|
+
* { vault: ref, request, sender: account.address },
|
|
357
|
+
* sdkSuiConfig,
|
|
358
|
+
* );
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export declare function buildSuiCancelRedeemRequestTransaction(params: ISuiCancelRedeemRequestParams, sui?: ISuiConfig): Promise<ISuiCancelRedeemRequestTransaction>;
|
|
362
|
+
/**
|
|
363
|
+
* Build an unsigned claim of a withdrawal request: charge the management fee,
|
|
364
|
+
* then burn the escrowed shares and pay their current value to the request's
|
|
365
|
+
* payout, with a minimum — one transaction.
|
|
366
|
+
*
|
|
367
|
+
* The payout lands in the payout address's **address balance**, not as a
|
|
368
|
+
* coin object. Balance reads (`getBalance`) include it; wallets that only
|
|
369
|
+
* list coin objects may not show it.
|
|
370
|
+
*
|
|
371
|
+
* The request is priced now, at the vault's current share price, without the
|
|
372
|
+
* instant-redemption fee. It can be claimed from `eligibleAtMs` until
|
|
373
|
+
* `expiresAtMs`, by its owner, its finalizer (anyone when it names none), and
|
|
374
|
+
* by anyone from one day after it became eligible.
|
|
375
|
+
*
|
|
376
|
+
* RPC cost: one dry run.
|
|
377
|
+
*
|
|
378
|
+
* @param params - Vault, request object ID, sender, and optional
|
|
379
|
+
* `minAssetsOut` or `slippageBps`.
|
|
380
|
+
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
381
|
+
* @returns The unsigned transaction, the shares it burns, the dry run's
|
|
382
|
+
* payout and the minimum it enforces.
|
|
383
|
+
* @throws {@link UpshiftValidationError} for a malformed address, an
|
|
384
|
+
* out-of-range minimum, unknown contract IDs, or a transaction that cannot
|
|
385
|
+
* be built (e.g. the request no longer exists).
|
|
386
|
+
* @throws {@link UpshiftVaultAbortError} when the vault would reject it
|
|
387
|
+
* (`not_eligible_yet`, `request_expired`, `not_finalizer`, `paused`,
|
|
388
|
+
* `above_max_withdrawal`, `insufficient_liquidity`, `zero_output`,
|
|
389
|
+
* `slippage`, `version_retired`).
|
|
390
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* const { transaction, expectedAssets } = await buildSuiClaimWithdrawalTransaction(
|
|
394
|
+
* { vault: ref, request, sender: account.address },
|
|
395
|
+
* sdkSuiConfig,
|
|
396
|
+
* );
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
export declare function buildSuiClaimWithdrawalTransaction(params: ISuiClaimWithdrawalParams, sui?: ISuiConfig): Promise<ISuiClaimWithdrawalTransaction>;
|
|
153
400
|
/**
|
|
154
401
|
* Execute a signed transaction and wait until the network has indexed it.
|
|
155
402
|
*
|
|
@@ -171,4 +418,3 @@ export declare function buildSuiRedeemTransaction(params: ISuiRedeemParams, sui?
|
|
|
171
418
|
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
172
419
|
*/
|
|
173
420
|
export declare function submitSuiTransaction(signed: ISuiSignedTransaction, network: ISuiNetwork, sui?: ISuiConfig): Promise<string>;
|
|
174
|
-
export {};
|