@upshiftfinance/sdk 0.3.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 +6 -2
- package/esm/index.d.mts +15 -0
- package/esm/index.mjs +18 -0
- package/lib/abis/KycRegistry.d.ts +109 -0
- package/lib/abis/KycRegistry.js +73 -0
- package/lib/abis/index.d.ts +1 -0
- package/lib/abis/index.js +1 -0
- package/lib/adapters/sui/actions.d.ts +420 -0
- package/lib/adapters/sui/actions.js +701 -0
- package/lib/adapters/sui/client.d.ts +3 -3
- package/lib/adapters/sui/client.js +27 -9
- package/lib/adapters/sui/getters.d.ts +268 -0
- package/lib/adapters/sui/getters.js +669 -0
- package/lib/adapters/sui/index.d.ts +243 -3
- package/lib/adapters/sui/index.js +250 -3
- package/lib/adapters/sui/targets.d.ts +42 -1
- package/lib/adapters/sui/targets.js +42 -1
- package/lib/core/analytics/method-taxonomy.d.ts +1 -1
- package/lib/core/analytics/method-taxonomy.js +9 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/constants/core.d.ts +5 -0
- package/lib/core/constants/core.js +5 -0
- package/lib/core/constants/kyc.d.ts +9 -0
- package/lib/core/constants/kyc.js +12 -0
- package/lib/core/constants/web3.d.ts +2 -2
- package/lib/core/constants/web3.js +9 -2
- package/lib/core/errors/index.d.ts +90 -1
- package/lib/core/errors/index.js +94 -1
- package/lib/core/fetcher.d.ts +5 -0
- package/lib/core/fetcher.js +1 -1
- package/lib/core/helpers/chain-support.d.ts +2 -2
- package/lib/core/helpers/chain-support.js +3 -3
- package/lib/core/helpers/kyc.d.ts +47 -0
- package/lib/core/helpers/kyc.js +111 -0
- package/lib/core/helpers/revert-decode.js +3 -2
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +2 -0
- 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 +33 -3
- package/lib/main.js +32 -0
- package/lib/modules/api/kyc.d.ts +4 -0
- package/lib/modules/api/kyc.js +148 -0
- package/lib/modules/api/main.d.ts +63 -1
- package/lib/modules/api/main.js +64 -0
- package/lib/modules/vaults/getters.d.ts +3 -1
- package/lib/modules/vaults/getters.js +82 -10
- package/lib/modules/vaults/main.d.ts +41 -3
- package/lib/modules/vaults/main.js +82 -6
- package/lib/modules/vaults/types.d.ts +7 -1
- package/lib/modules/vaults/utils.js +4 -1
- package/lib/sdk.d.ts +16363 -14615
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/kyc.d.ts +61 -0
- package/lib/types/kyc.js +3 -0
- package/lib/types/vaults.d.ts +2 -0
- package/lib/types/webserver.d.ts +5 -0
- package/package.json +21 -2
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sui vault actions: deposit, instant redeem, and the withdrawal queue
|
|
3
|
+
* (request, cancel, claim).
|
|
4
|
+
*
|
|
5
|
+
* Each builder dry-runs the exact transaction with the sender's own coins, so
|
|
6
|
+
* a vault that would reject it (paused, queue attached, limits) fails here
|
|
7
|
+
* with a typed {@link UpshiftVaultAbortError} instead of in the wallet, and the
|
|
8
|
+
* dry run's preview sets the transaction's minimum output. The result is an
|
|
9
|
+
* unsigned `Transaction` for the wallet to sign; {@link submitSuiTransaction}
|
|
10
|
+
* executes a signed one and waits for it.
|
|
11
|
+
*
|
|
12
|
+
* @module SuiActions
|
|
13
|
+
*/
|
|
14
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
15
|
+
import type { ISuiConfig, ISuiNetwork } from '../../types';
|
|
16
|
+
import { UpshiftSDKError } from '../../core/errors';
|
|
17
|
+
import { type ISuiVaultRef } from './getters';
|
|
18
|
+
/** Parameters for {@link buildSuiDepositTransaction}. */
|
|
19
|
+
export interface ISuiDepositParams {
|
|
20
|
+
/** The vault and its coin types and network. */
|
|
21
|
+
vault: ISuiVaultRef;
|
|
22
|
+
/** Deposit amount in asset base units. */
|
|
23
|
+
amount: bigint;
|
|
24
|
+
/** Wallet that pays the deposit and receives the shares. */
|
|
25
|
+
sender: string;
|
|
26
|
+
/**
|
|
27
|
+
* Smallest share amount to accept. Wins over `slippageBps`. Defaults to the
|
|
28
|
+
* dry run's preview less `slippageBps`.
|
|
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;
|
|
37
|
+
}
|
|
38
|
+
/** Parameters for {@link buildSuiRedeemTransaction}. */
|
|
39
|
+
export interface ISuiRedeemParams {
|
|
40
|
+
/** The vault and its coin types and network. */
|
|
41
|
+
vault: ISuiVaultRef;
|
|
42
|
+
/** Shares to redeem, in share base units. */
|
|
43
|
+
shares: bigint;
|
|
44
|
+
/** Wallet that holds the shares and receives the assets. */
|
|
45
|
+
sender: string;
|
|
46
|
+
/**
|
|
47
|
+
* Smallest asset amount to accept, net of the instant fee. Wins over
|
|
48
|
+
* `slippageBps`. Defaults to the dry run's preview less `slippageBps`.
|
|
49
|
+
*/
|
|
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;
|
|
57
|
+
}
|
|
58
|
+
/** An unsigned deposit transaction and the minimum it enforces. */
|
|
59
|
+
export interface ISuiDepositTransaction {
|
|
60
|
+
/** Unsigned transaction, sender set; sign it with the sender's wallet. */
|
|
61
|
+
transaction: Transaction;
|
|
62
|
+
/** Shares the dry run minted. */
|
|
63
|
+
expectedShares: bigint;
|
|
64
|
+
/** Minimum shares the transaction accepts. */
|
|
65
|
+
minSharesOut: bigint;
|
|
66
|
+
}
|
|
67
|
+
/** An unsigned instant-redeem transaction and the minimum it enforces. */
|
|
68
|
+
export interface ISuiRedeemTransaction {
|
|
69
|
+
/** Unsigned transaction, sender set; sign it with the sender's wallet. */
|
|
70
|
+
transaction: Transaction;
|
|
71
|
+
/** Gross assets before the instant fee. */
|
|
72
|
+
expectedGrossAssets: bigint;
|
|
73
|
+
/** Assets the dry run paid, net of the instant fee. */
|
|
74
|
+
expectedAssets: bigint;
|
|
75
|
+
/** Minimum net assets the transaction accepts. */
|
|
76
|
+
minAssetsOut: bigint;
|
|
77
|
+
}
|
|
78
|
+
/** A transaction signed by the sender's wallet. */
|
|
79
|
+
export interface ISuiSignedTransaction {
|
|
80
|
+
/** Transaction bytes, base64, as the wallet returns them. */
|
|
81
|
+
bytes: string;
|
|
82
|
+
/** The sender's signature, base64. */
|
|
83
|
+
signature: string;
|
|
84
|
+
}
|
|
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 {
|
|
107
|
+
message?: string;
|
|
108
|
+
MoveAbort?: {
|
|
109
|
+
abortCode?: string;
|
|
110
|
+
location?: {
|
|
111
|
+
module?: string;
|
|
112
|
+
};
|
|
113
|
+
cleverError?: {
|
|
114
|
+
constantName?: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Map a failed Sui execution to an SDK error: a contract abort becomes an
|
|
120
|
+
* {@link UpshiftVaultAbortError} with a stable reason, anything else an
|
|
121
|
+
* {@link UpshiftSDKError} (`UNKNOWN`).
|
|
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
|
+
*
|
|
127
|
+
* @param executionError - `effects.status.error` of a failed transaction, or
|
|
128
|
+
* the `executionError` of a `SimulationError`.
|
|
129
|
+
* @param context - Structured context for the error (e.g. network, digest).
|
|
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
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function suiExecutionErrorToSdkError(executionError: ISuiExecutionError | undefined, context?: Record<string, unknown>): UpshiftSDKError;
|
|
142
|
+
/**
|
|
143
|
+
* Build an unsigned deposit: charge the management fee, deposit with a minimum
|
|
144
|
+
* share amount, and send the shares to the sender — one transaction.
|
|
145
|
+
*
|
|
146
|
+
* The payment is `coinWithBalance(Asset)`: the wallet selects and merges the
|
|
147
|
+
* sender's coins when it signs. The fee is charged first so the deposit is
|
|
148
|
+
* priced on a current NAV.
|
|
149
|
+
*
|
|
150
|
+
* RPC cost: one dry run (plus the coin lookup it needs).
|
|
151
|
+
*
|
|
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`.
|
|
157
|
+
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
158
|
+
* @returns The unsigned transaction, the shares the dry run minted and the
|
|
159
|
+
* minimum it enforces.
|
|
160
|
+
* @throws {@link UpshiftValidationError} for a malformed sender or vault, an
|
|
161
|
+
* out-of-range amount, unknown contract IDs, or a transaction that cannot be
|
|
162
|
+
* built (e.g. the sender lacks the asset).
|
|
163
|
+
* @throws {@link UpshiftVaultAbortError} when the vault would reject the
|
|
164
|
+
* deposit (`paused`, `below_min_deposit`, `above_max_deposit`,
|
|
165
|
+
* `deposit_cap_exceeded`, `zero_output`, `slippage`, `version_retired`).
|
|
166
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* const { transaction } = await buildSuiDepositTransaction(
|
|
170
|
+
* { vault: ref, amount: 1_000_000n, sender: account.address },
|
|
171
|
+
* sdkSuiConfig,
|
|
172
|
+
* );
|
|
173
|
+
* const digest = await submitSuiTransaction(
|
|
174
|
+
* await dAppKit.signTransaction({ transaction }),
|
|
175
|
+
* 'testnet',
|
|
176
|
+
* sdkSuiConfig,
|
|
177
|
+
* );
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export declare function buildSuiDepositTransaction(params: ISuiDepositParams, sui?: ISuiConfig): Promise<ISuiDepositTransaction>;
|
|
181
|
+
/**
|
|
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.
|
|
185
|
+
*
|
|
186
|
+
* The shares are `coinWithBalance(Share)`. A vault with a withdrawal queue
|
|
187
|
+
* attached has instant redemption off; that fails here with `queue_attached`.
|
|
188
|
+
*
|
|
189
|
+
* Side effect on failure: when the vault rejects the dry run, the failure is
|
|
190
|
+
* reported to that vault's curator (fire-and-forget; see
|
|
191
|
+
* `monitoring.curatorAlerts`).
|
|
192
|
+
*
|
|
193
|
+
* RPC cost: one dry run (plus the coin lookup it needs).
|
|
194
|
+
*
|
|
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`.
|
|
200
|
+
* @param sui - The SDK's `sui` config; applied only for `params.vault.network`.
|
|
201
|
+
* @returns The unsigned transaction, the dry run's gross and net assets and
|
|
202
|
+
* the minimum it enforces.
|
|
203
|
+
* @throws {@link UpshiftValidationError} for a malformed sender or vault, an
|
|
204
|
+
* out-of-range amount, unknown contract IDs, or a transaction that cannot be
|
|
205
|
+
* built (e.g. the sender lacks the shares).
|
|
206
|
+
* @throws {@link UpshiftVaultAbortError} when the vault would reject the
|
|
207
|
+
* redemption (`queue_attached`, `paused`, `above_max_withdrawal`,
|
|
208
|
+
* `insufficient_liquidity`, `zero_output`, `slippage`, `version_retired`).
|
|
209
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
210
|
+
*/
|
|
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>;
|
|
400
|
+
/**
|
|
401
|
+
* Execute a signed transaction and wait until the network has indexed it.
|
|
402
|
+
*
|
|
403
|
+
* Side effect on failure: a failed instant redemption is reported to that
|
|
404
|
+
* vault's curator with its digest (fire-and-forget; see
|
|
405
|
+
* `monitoring.curatorAlerts`).
|
|
406
|
+
*
|
|
407
|
+
* RPC cost: one execution plus the confirmation poll.
|
|
408
|
+
*
|
|
409
|
+
* @param signed - Bytes and signature from the wallet's `signTransaction`.
|
|
410
|
+
* @param network - Network the transaction was built for.
|
|
411
|
+
* @param sui - The SDK's `sui` config; applied only for `network`.
|
|
412
|
+
* @returns The transaction digest once it succeeded and is indexed.
|
|
413
|
+
* @throws {@link UpshiftVaultAbortError} when the vault aborted it on chain.
|
|
414
|
+
* @throws {@link UpshiftSDKError} (`UNKNOWN`) when it failed for another
|
|
415
|
+
* reason; `context.digest` names it.
|
|
416
|
+
* @throws {@link UpshiftTransactionError} when it executed but was not
|
|
417
|
+
* indexed in time; check `signature` (the digest) before retrying.
|
|
418
|
+
* @throws {@link UpshiftNetworkError} when every Sui endpoint fails.
|
|
419
|
+
*/
|
|
420
|
+
export declare function submitSuiTransaction(signed: ISuiSignedTransaction, network: ISuiNetwork, sui?: ISuiConfig): Promise<string>;
|