@candledottv/agent-sdk 0.6.3 → 0.6.5
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 +2 -1
- package/dist/client.d.ts +316 -31
- package/dist/client.d.ts.map +1 -1
- package/dist/hyperliquid-markets.d.ts +48 -0
- package/dist/hyperliquid-markets.d.ts.map +1 -1
- package/dist/hyperliquid-withdraw.d.ts +11 -19
- package/dist/hyperliquid-withdraw.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +331 -32
- package/dist/quant.d.ts +118 -0
- package/dist/quant.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,7 +130,8 @@ const fill = await candle.trade({ mint: "9dXSV8...CNDL", side: "buy", amountRaw:
|
|
|
130
130
|
- `getPortfolio()`, `getProfilePnl(keyPrefix)`, `getProfileTrades(keyPrefix)` and
|
|
131
131
|
`getSpendLimits()` read the account's holdings, a profile's P&L and fills, and this key's caps.
|
|
132
132
|
- `fees.list()` and `fees.claim(mint, { dryRun })` read what the account's launched tokens can pay in creator fees and claim it to the wallet fixed at launch (off until the server enables it).
|
|
133
|
-
- `closeEmptyAccounts()` closes the embedded wallet's empty token accounts and returns the rent
|
|
133
|
+
- `closeEmptyAccounts()` closes the embedded wallet's empty token accounts and returns the rent;
|
|
134
|
+
with `wallet` and `privyWalletId`, a Solana TEE wallet's, signed through `signLinkedTransaction()`.
|
|
134
135
|
- The `perps*` methods (`perpsSetup`, `perpsOpen`, `perpsClose`, `perpsOrders`,
|
|
135
136
|
`perpsPositions`, ...) drive Hyperliquid perps.
|
|
136
137
|
|
package/dist/client.d.ts
CHANGED
|
@@ -56,8 +56,12 @@ export type Chain = "solana" | "hood";
|
|
|
56
56
|
* NFT gate; see docs/superpowers/specs/2026-08-04-test-curve-configs-design.md). Test tiers are
|
|
57
57
|
* creatable only where the API's ENABLE_TEST_CURVES flag is on; the server refuses them
|
|
58
58
|
* otherwise, so client code needs no gate of its own.
|
|
59
|
+
*
|
|
60
|
+
* Then the experimental fast curves (Solana, SOL or CNDL): the presets `exp-a`, `exp-b` and
|
|
61
|
+
* `exp-c`, and `exp-custom`, which takes the launcher's own V and G in `curve`. `exp-custom` is
|
|
62
|
+
* creatable only where the API has EXP_CUSTOM_CURVES on; elsewhere it is refused as an unknown mode.
|
|
59
63
|
*/
|
|
60
|
-
export type LaunchTier = "open" | "exclusive" | "test-open" | "test-exclusive";
|
|
64
|
+
export type LaunchTier = "open" | "exclusive" | "test-open" | "test-exclusive" | "exp-a" | "exp-b" | "exp-c" | "exp-custom";
|
|
61
65
|
/**
|
|
62
66
|
* `finalstretch`: pump.fun tokens at 50% or more of their bonding curve, most complete first; no delta, read the whole list.
|
|
63
67
|
* It exists only where the API has it switched on; elsewhere it is refused like an unknown bucket.
|
|
@@ -176,6 +180,49 @@ export interface PresetsPayload {
|
|
|
176
180
|
matrixVersion: number;
|
|
177
181
|
presets: LaunchPreset[];
|
|
178
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Solana pool fee at graduation: a flat tier in bps, or an anti-snipe fall from `startBps` (at most
|
|
185
|
+
* 2500) to `endBps` over `minutes` (at most 30). Omitted, the pool keeps today's flat 50 bps.
|
|
186
|
+
*/
|
|
187
|
+
export type PoolFee = {
|
|
188
|
+
tier: 25 | 50 | 100;
|
|
189
|
+
} | {
|
|
190
|
+
startBps: number;
|
|
191
|
+
endBps: 25 | 50 | 100;
|
|
192
|
+
minutes: number;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* The `graduation` block of a dry run, present only when the launch chose a non-default pool fee or
|
|
196
|
+
* shape. Estimates are at the graduation threshold; the final burn follows the frozen on-chain price.
|
|
197
|
+
*/
|
|
198
|
+
export interface LaunchGraduationPreview {
|
|
199
|
+
/** The chosen schedule; absent when the launch kept the flat 50 bps pool. */
|
|
200
|
+
poolFeeSchedule?: PoolFee;
|
|
201
|
+
poolOpen?: "curve_price";
|
|
202
|
+
expPoolShape?: "full_range";
|
|
203
|
+
/** Base burned at the threshold, raw. */
|
|
204
|
+
estimatedBurnRaw?: string;
|
|
205
|
+
/** Base seeded into the pool at the threshold, raw. */
|
|
206
|
+
estimatedSeedRaw?: string;
|
|
207
|
+
/** curve_price only: the most bps the staker carve plus the team allocation can add up to on this tier. */
|
|
208
|
+
maxStakerCarveBps?: number;
|
|
209
|
+
/** The fee at pool open (a falling schedule's start). */
|
|
210
|
+
startBps?: number;
|
|
211
|
+
/** Where a falling schedule settles. */
|
|
212
|
+
endBps?: number;
|
|
213
|
+
shape?: "curve_price" | "legacy" | "full_range" | "floor";
|
|
214
|
+
burnsRemainder?: boolean;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* `mode: "exp-custom"` only, and required there: the launcher-chosen curve, in WHOLE units of the
|
|
218
|
+
* quote asset (sol or cndl) as decimal strings, never raw units. `"12"` is 12 SOL.
|
|
219
|
+
*/
|
|
220
|
+
export interface LaunchCurve {
|
|
221
|
+
/** V: the virtual quote the curve starts with. */
|
|
222
|
+
virtualQuote: string;
|
|
223
|
+
/** G: the quote the curve raises before it graduates. */
|
|
224
|
+
threshold: string;
|
|
225
|
+
}
|
|
179
226
|
/** POST /api/v1/launch/headless request body. The server is the authoritative validator. */
|
|
180
227
|
export interface LaunchRequest {
|
|
181
228
|
/** Idempotency key, unique per account. launch() generates "sdk-" + UUID when absent. */
|
|
@@ -183,7 +230,20 @@ export interface LaunchRequest {
|
|
|
183
230
|
chain?: Chain;
|
|
184
231
|
quoteAsset?: string;
|
|
185
232
|
mode?: LaunchTier;
|
|
233
|
+
/** `mode: "exp-custom"` only, and required there. Dry-run first: the API checks the limits. */
|
|
234
|
+
curve?: LaunchCurve;
|
|
235
|
+
/**
|
|
236
|
+
* An `exp-` mode only: an extra creator fee of 100 or 200 basis points on top of the curve's 1%
|
|
237
|
+
* and the pool's 0.5%, paid to the creator in full. 0 is the same as leaving it out.
|
|
238
|
+
*/
|
|
239
|
+
creatorFeeBps?: 0 | 100 | 200;
|
|
186
240
|
stakerAllocationBps?: number;
|
|
241
|
+
/** Solana only: the graduated pool's fee. Omitted keeps the flat 50 bps pool. */
|
|
242
|
+
poolFee?: PoolFee;
|
|
243
|
+
/** Solana preset tiers only: "curve_price" opens the pool at the curve's last price and burns the rest. Omitted is "legacy". */
|
|
244
|
+
poolOpen?: "legacy" | "curve_price";
|
|
245
|
+
/** Solana exp- curves only: "full_range" opens the pool across the whole price range. Omitted is "floor". */
|
|
246
|
+
expPoolShape?: "floor" | "full_range";
|
|
187
247
|
/** Hood only, required there: which Uniswap version the curve graduates through. */
|
|
188
248
|
dexVersion?: "v3" | "v4";
|
|
189
249
|
/** Initial dev buy. Solana: JSON number in the pair's base units. Hood: decimal string in wei. */
|
|
@@ -254,21 +314,94 @@ export interface ConfirmSelfLaunchRequest {
|
|
|
254
314
|
/** POST /api/v1/launch/self/confirm response. Mirrors LaunchResult. */
|
|
255
315
|
export interface ConfirmSelfLaunchResult extends LaunchResult {
|
|
256
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* An `exp-` launch's curve terms, on every launch response of those modes. Display figures from the
|
|
319
|
+
* closed form, before fees.
|
|
320
|
+
*/
|
|
321
|
+
export interface LaunchCurveTerms extends CurveTerms {
|
|
322
|
+
/** V in the quote's raw units. */
|
|
323
|
+
virtualQuoteRaw?: string;
|
|
324
|
+
/** The first buy `firstBuySupplyPct` prices, raw. */
|
|
325
|
+
firstBuyRaw?: string;
|
|
326
|
+
/** That buy's share of the whole supply, before fees, as a percentage. */
|
|
327
|
+
firstBuySupplyPct?: number;
|
|
328
|
+
}
|
|
329
|
+
/** One venue's fee on a trade of one whole quote unit, in whole quote units. */
|
|
330
|
+
export interface LaunchPreviewFeeLine {
|
|
331
|
+
feeBps: number;
|
|
332
|
+
fee: number;
|
|
333
|
+
/** What the token's earning slot receives: half the base fee, and any extra creator fee in full. */
|
|
334
|
+
creatorShare: number;
|
|
335
|
+
/** What the platform receives: the other half of the base fee. */
|
|
336
|
+
platformShare: number;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The launch preview a dry run returns as `curveTerms`, on every mode, from servers that have it.
|
|
340
|
+
* `firstBuyRaw` is the request's own `buyAmount` (a reference buy when it is 0) and
|
|
341
|
+
* `firstBuySupplyPct` that buy's share before fees.
|
|
342
|
+
*/
|
|
343
|
+
export interface LaunchPreviewTerms extends LaunchCurveTerms {
|
|
344
|
+
firstBuyRaw: string;
|
|
345
|
+
firstBuySupplyPct: number;
|
|
346
|
+
/** The same buy as the curve program fills it from an empty curve. */
|
|
347
|
+
firstBuy: {
|
|
348
|
+
basis: "buyAmount" | "reference";
|
|
349
|
+
amountRaw: string;
|
|
350
|
+
curveFeeRaw: string;
|
|
351
|
+
/** Tokens received after the curve fee, raw. */
|
|
352
|
+
tokensOutRaw: string;
|
|
353
|
+
supplyPct: number;
|
|
354
|
+
};
|
|
355
|
+
fees: {
|
|
356
|
+
curve: LaunchPreviewFeeLine;
|
|
357
|
+
pool: LaunchPreviewFeeLine;
|
|
358
|
+
};
|
|
359
|
+
migration: {
|
|
360
|
+
venue: "meteora_damm_v2" | "uniswap_v3" | "uniswap_v4";
|
|
361
|
+
poolFeeBps: number;
|
|
362
|
+
/** `floor`: the pool's lower bound is the curve's start price (exp- modes). */
|
|
363
|
+
poolShape: "full_range" | "floor";
|
|
364
|
+
/** The pool's opening price against the curve's last price, percent; negative opens below it. */
|
|
365
|
+
openingPriceStepPct: number;
|
|
366
|
+
lpLock: "permanent";
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/** The request as a dry run resolved and validated it. */
|
|
370
|
+
export interface ResolvedLaunch {
|
|
371
|
+
chain: Chain;
|
|
372
|
+
quoteAsset: string;
|
|
373
|
+
mode: LaunchTier;
|
|
374
|
+
stakerAllocationBps: number;
|
|
375
|
+
/** Present only when the launch has an extra creator fee. */
|
|
376
|
+
creatorFeeBps?: 100 | 200;
|
|
377
|
+
/** `exp-custom` only: the curve as validated and hashed, in the quote's raw units. */
|
|
378
|
+
curve?: {
|
|
379
|
+
virtualQuoteRaw: string;
|
|
380
|
+
thresholdRaw: string;
|
|
381
|
+
};
|
|
382
|
+
dexVersion: "v3" | "v4" | null;
|
|
383
|
+
visibility: string;
|
|
384
|
+
buyAmount: string;
|
|
385
|
+
}
|
|
257
386
|
/** POST /api/v1/launch/headless/dry-run response. */
|
|
258
387
|
export interface DryRunResult {
|
|
259
388
|
success: true;
|
|
260
389
|
dryRun: true;
|
|
261
390
|
/** Wallet the real launch pays from; null when no wallet is available for the resolved chain. */
|
|
262
391
|
launchWallet: string | null;
|
|
263
|
-
resolved:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
392
|
+
resolved: ResolvedLaunch;
|
|
393
|
+
/**
|
|
394
|
+
* The launch preview: the curve's terms, the first buy priced on this request's own buyAmount,
|
|
395
|
+
* the fee lines and the migration terms. Every mode, from servers that have it; an older server
|
|
396
|
+
* sends it on exp- modes only, as `LaunchCurveTerms`.
|
|
397
|
+
*/
|
|
398
|
+
curveTerms?: LaunchPreviewTerms;
|
|
399
|
+
/**
|
|
400
|
+
* The dev-buy ceiling this launch is held to, in buyAmount's base units: on an exp- curve the
|
|
401
|
+
* lower of 10% of the threshold and the ordinary ceiling. null for a pair with no dev buy; absent
|
|
402
|
+
* from older servers.
|
|
403
|
+
*/
|
|
404
|
+
devBuyMax?: string | null;
|
|
272
405
|
checks: {
|
|
273
406
|
image: string;
|
|
274
407
|
/** `"ok"` when a `bannerUrl` was sent and checked; absent otherwise. */
|
|
@@ -292,6 +425,8 @@ export interface DryRunResult {
|
|
|
292
425
|
maxNameBytes: number;
|
|
293
426
|
fits: boolean;
|
|
294
427
|
};
|
|
428
|
+
/** Present only when the launch chose a non-default pool fee or shape. */
|
|
429
|
+
graduation?: LaunchGraduationPreview;
|
|
295
430
|
}
|
|
296
431
|
/**
|
|
297
432
|
* POST /api/v1/launch/self/dry-run response: the headless dry run's shape, with `launchWallet` the
|
|
@@ -318,6 +453,10 @@ export interface LaunchResult {
|
|
|
318
453
|
quoteAsset: string;
|
|
319
454
|
mode: LaunchTier;
|
|
320
455
|
stakerAllocationBps: number;
|
|
456
|
+
/** Present only when the launch has an extra creator fee. */
|
|
457
|
+
creatorFeeBps?: 100 | 200;
|
|
458
|
+
/** An exp- launch's curve terms; absent on every other mode. */
|
|
459
|
+
curveTerms?: LaunchCurveTerms;
|
|
321
460
|
matrixVersion: number;
|
|
322
461
|
links: {
|
|
323
462
|
candle: string;
|
|
@@ -1730,7 +1869,7 @@ export interface EvmSignTransactionParams {
|
|
|
1730
1869
|
*
|
|
1731
1870
|
* A TEE payer (Ember Phase 4c) may also start from USDC, and needs `clientTradeId`: the server
|
|
1732
1871
|
* then resolves the destination to this key's own TEE wallet on Hood (`toWalletId` names one when
|
|
1733
|
-
* the key has several),
|
|
1872
|
+
* the key has several), honours any cap on the origin asset (none is required), and charges no fee. That bridge is
|
|
1734
1873
|
* gated by the server's `TEE_BRIDGE_ENABLED`; with it off the build answers `PAIR_UNSUPPORTED`.
|
|
1735
1874
|
* A Hood-origin bridge signs one leg at a time and is not this call; `candle swap` runs it.
|
|
1736
1875
|
*/
|
|
@@ -1999,6 +2138,8 @@ export interface PerpsWithdrawStatus {
|
|
|
1999
2138
|
netUsdc: string;
|
|
2000
2139
|
minimumOutUsdc: string;
|
|
2001
2140
|
relayRequestId: string;
|
|
2141
|
+
/** Relay `protocol.v2.orderId`, when the quote stored one. Status reads still use `relayRequestId`. */
|
|
2142
|
+
relayOrderId?: string;
|
|
2002
2143
|
nonce: number;
|
|
2003
2144
|
failureReason: string | null;
|
|
2004
2145
|
relay?: {
|
|
@@ -2153,7 +2294,7 @@ export interface PerpsOrders {
|
|
|
2153
2294
|
* Perps C (BE-647, HL-ED-8): `perpsDeposit()`. Relay moves funds from the key's Hood or Solana TEE
|
|
2154
2295
|
* wallet onto Hyperliquid perps USDC at the key's EVM TEE wallet's own address. The asset decides
|
|
2155
2296
|
* the paying chain: SOL or USDC from the Solana TEE wallet, ETH or USDG from the Hood one. Needs
|
|
2156
|
-
* `swap:write
|
|
2297
|
+
* `swap:write`; any cap on the asset still applies. There is no withdrawal yet.
|
|
2157
2298
|
*/
|
|
2158
2299
|
export interface PerpsDepositParams {
|
|
2159
2300
|
/** Idempotency id, 1 to 128 of `A-Za-z0-9._:-`. Rebuilding under the same id answers its job. */
|
|
@@ -2171,15 +2312,25 @@ export interface PerpsDepositParams {
|
|
|
2171
2312
|
perpsWalletId?: string;
|
|
2172
2313
|
/** Relay slippage, 1 to 1000 bps (default 100). */
|
|
2173
2314
|
maxSlippageBps?: number;
|
|
2174
|
-
/**
|
|
2315
|
+
/**
|
|
2316
|
+
* Sign and submit (default), or `false` for a dry run: the API previews the deposit (`preview:
|
|
2317
|
+
* true`), locking no wallet, reserving no USD window and recording no id, and nothing is signed.
|
|
2318
|
+
*/
|
|
2175
2319
|
submit?: boolean;
|
|
2176
2320
|
}
|
|
2177
|
-
/**
|
|
2321
|
+
/**
|
|
2322
|
+
* What `POST /agent/perps/deposit` builds. A Hood build also carries the first sequenced leg. A
|
|
2323
|
+
* preview (`status: "preview"`, from `submit: false`) has no `depositId`, `expiresAt` or sequenced
|
|
2324
|
+
* leg; from Hood it carries `plannedLegs` instead.
|
|
2325
|
+
*/
|
|
2178
2326
|
export interface PerpsDepositBuild {
|
|
2179
2327
|
success: true;
|
|
2180
|
-
status: "built";
|
|
2328
|
+
status: "built" | "preview";
|
|
2329
|
+
/** A dry run: nothing is held, and the same id still builds a new deposit. */
|
|
2330
|
+
preview?: true;
|
|
2181
2331
|
clientDepositId: string;
|
|
2182
|
-
|
|
2332
|
+
/** Absent on a preview. */
|
|
2333
|
+
depositId?: string;
|
|
2183
2334
|
chain: "solana" | "hood";
|
|
2184
2335
|
venue: "relay";
|
|
2185
2336
|
network: HyperliquidNetwork;
|
|
@@ -2205,9 +2356,17 @@ export interface PerpsDepositBuild {
|
|
|
2205
2356
|
};
|
|
2206
2357
|
statusChecks: string[];
|
|
2207
2358
|
requestId: string | null;
|
|
2208
|
-
|
|
2359
|
+
/** Absent on a preview. */
|
|
2360
|
+
expiresAt?: number;
|
|
2209
2361
|
/** Solana: the one unsigned deposit. */
|
|
2210
2362
|
transactionsBase64?: string[];
|
|
2363
|
+
/** A Hood preview: the legs' calldata, nothing sequenced. */
|
|
2364
|
+
plannedLegs?: Array<{
|
|
2365
|
+
kind: string;
|
|
2366
|
+
to: string;
|
|
2367
|
+
data: string;
|
|
2368
|
+
value: string;
|
|
2369
|
+
}>;
|
|
2211
2370
|
/** Hood: the sequenced leg protocol's first body. */
|
|
2212
2371
|
mode?: "sequenced";
|
|
2213
2372
|
operationId?: string;
|
|
@@ -2469,11 +2628,18 @@ export interface SkippedEmptyTokenAccount extends EmptyTokenAccount {
|
|
|
2469
2628
|
export interface PreviewCloseEmptyAccountsRequest {
|
|
2470
2629
|
/** Mints whose empty accounts stay open, e.g. the pair token a held holder-reward coin pays in. */
|
|
2471
2630
|
keep?: string[];
|
|
2631
|
+
/**
|
|
2632
|
+
* A Solana TEE wallet's linked-wallet id, to preview that wallet instead of the embedded one
|
|
2633
|
+
* (BE-1687). Any key bound to the wallet may preview it.
|
|
2634
|
+
*/
|
|
2635
|
+
wallet?: string;
|
|
2472
2636
|
}
|
|
2473
2637
|
/** previewCloseEmptyAccounts()'s result. Nothing was built, signed or written to produce it. */
|
|
2474
2638
|
export interface CloseEmptyAccountsPreview {
|
|
2475
2639
|
success: true;
|
|
2476
2640
|
wallet: string;
|
|
2641
|
+
/** The TEE wallet's linked-wallet id, on a TEE wallet's preview. */
|
|
2642
|
+
linkedWalletId?: string;
|
|
2477
2643
|
keep: string[];
|
|
2478
2644
|
accounts: EmptyTokenAccount[];
|
|
2479
2645
|
accountCount: number;
|
|
@@ -2497,9 +2663,18 @@ export interface CloseEmptyAccountsRequest {
|
|
|
2497
2663
|
keep?: string[];
|
|
2498
2664
|
/** The preview's `accounts[].account`, to close only what was shown. Omit to close every qualifying account. */
|
|
2499
2665
|
accounts?: string[];
|
|
2666
|
+
/**
|
|
2667
|
+
* A Solana TEE wallet's linked-wallet id, to close that wallet's accounts instead of the embedded
|
|
2668
|
+
* wallet's (BE-1687). Needs `swap:write`, `privyWalletId`, and the wallet's signer in `secretStore`.
|
|
2669
|
+
*/
|
|
2670
|
+
wallet?: string;
|
|
2671
|
+
/** The TEE wallet's Privy wallet id, which signLinkedTransaction() signs for. Required with `wallet`. */
|
|
2672
|
+
privyWalletId?: string;
|
|
2500
2673
|
}
|
|
2501
2674
|
/** A close transaction that landed. */
|
|
2502
2675
|
export interface CloseEmptyAccountsBatch {
|
|
2676
|
+
/** The transaction's place in a TEE wallet's built batch. */
|
|
2677
|
+
index?: number;
|
|
2503
2678
|
signature: string;
|
|
2504
2679
|
accounts: string[];
|
|
2505
2680
|
lamports: string;
|
|
@@ -2510,18 +2685,37 @@ export interface CloseEmptyAccountsBatch {
|
|
|
2510
2685
|
* re-preview before re-running.
|
|
2511
2686
|
*/
|
|
2512
2687
|
export interface CloseEmptyAccountsFailure {
|
|
2688
|
+
/** The transaction's place in a TEE wallet's built batch. */
|
|
2689
|
+
index?: number;
|
|
2513
2690
|
accounts: string[];
|
|
2514
2691
|
code: string;
|
|
2515
2692
|
message: string;
|
|
2516
2693
|
signature?: string;
|
|
2517
2694
|
}
|
|
2695
|
+
/**
|
|
2696
|
+
* A TEE wallet's close transaction the chain has not settled yet (BE-1687). Its rent is not counted,
|
|
2697
|
+
* and the operation stays `recovering` until every one is settled.
|
|
2698
|
+
*/
|
|
2699
|
+
export interface CloseEmptyAccountsUnresolved {
|
|
2700
|
+
index: number;
|
|
2701
|
+
accounts: string[];
|
|
2702
|
+
/** Known once the transaction was signed and recorded. */
|
|
2703
|
+
signature?: string;
|
|
2704
|
+
reason: string;
|
|
2705
|
+
}
|
|
2518
2706
|
/** closeEmptyAccounts()'s result. A run in which nothing landed throws a CandleApiError instead. */
|
|
2519
2707
|
export interface CloseEmptyAccountsResult {
|
|
2520
2708
|
success: true;
|
|
2521
|
-
/**
|
|
2522
|
-
|
|
2709
|
+
/**
|
|
2710
|
+
* `partial`: some batch failed, or more accounts remain than one call closes. `recovering`, a TEE
|
|
2711
|
+
* wallet's close only: a transaction may still land. Nothing is sent again; read
|
|
2712
|
+
* getCloseEmptyAccountsJob(clientTradeId, { wallet }) until it settles.
|
|
2713
|
+
*/
|
|
2714
|
+
status: "completed" | "partial" | "nothing_to_close" | "recovering";
|
|
2523
2715
|
clientTradeId: string;
|
|
2524
2716
|
wallet: string;
|
|
2717
|
+
/** The TEE wallet's linked-wallet id, on a TEE wallet's close. */
|
|
2718
|
+
linkedWalletId?: string;
|
|
2525
2719
|
keep: string[];
|
|
2526
2720
|
closed: EmptyTokenAccount[];
|
|
2527
2721
|
transactions: CloseEmptyAccountsBatch[];
|
|
@@ -2530,8 +2724,11 @@ export interface CloseEmptyAccountsResult {
|
|
|
2530
2724
|
solRecovered: string;
|
|
2531
2725
|
/** The base network fee of the transactions that landed, reverted ones included, 5,000 lamports each. */
|
|
2532
2726
|
feeLamports: string;
|
|
2533
|
-
|
|
2534
|
-
|
|
2727
|
+
/** Absent while `status` is `recovering`: no net is final until every transaction settles. */
|
|
2728
|
+
netLamports?: string;
|
|
2729
|
+
netSol?: string;
|
|
2730
|
+
/** A TEE close that landed before its fee could be read: `feeLamports` does not count it yet. */
|
|
2731
|
+
feeUnresolved?: true;
|
|
2535
2732
|
failed: CloseEmptyAccountsFailure[];
|
|
2536
2733
|
/** Accounts in batches never sent, after a failure that stops the run. */
|
|
2537
2734
|
unattempted: string[];
|
|
@@ -2544,15 +2741,35 @@ export interface CloseEmptyAccountsResult {
|
|
|
2544
2741
|
remaining: number;
|
|
2545
2742
|
/** Present when this is the stored report of an earlier call under the same id. */
|
|
2546
2743
|
replayed?: true;
|
|
2744
|
+
/** `recovering` only: what the server says to do next. */
|
|
2745
|
+
message?: string;
|
|
2746
|
+
/** `recovering` only: the TEE close transactions not settled yet. */
|
|
2747
|
+
unresolved?: CloseEmptyAccountsUnresolved[];
|
|
2748
|
+
}
|
|
2749
|
+
/** Which wallet getCloseEmptyAccountsJob() reads: the embedded wallet's runs, or a TEE wallet's. */
|
|
2750
|
+
export interface CloseEmptyAccountsJobOptions {
|
|
2751
|
+
/** A Solana TEE wallet's linked-wallet id (BE-1687). Omit for the embedded wallet. */
|
|
2752
|
+
wallet?: string;
|
|
2547
2753
|
}
|
|
2548
2754
|
export interface CloseEmptyAccountsJob {
|
|
2549
2755
|
clientTradeId: string;
|
|
2550
2756
|
kind: "close-empty";
|
|
2551
|
-
|
|
2757
|
+
/** `built`, a TEE wallet's only: the transactions await their signatures, or are being sent or recovered. */
|
|
2758
|
+
status: "running" | "built" | "completed" | "failed";
|
|
2759
|
+
/** On a TEE wallet's job. */
|
|
2760
|
+
walletKind?: "tee";
|
|
2761
|
+
linkedWalletId?: string;
|
|
2762
|
+
/** A TEE wallet's send state: `idle` before submit, then `submitting`, `recovering` or `done`. */
|
|
2763
|
+
submitState?: "idle" | "submitting" | "recovering" | "done";
|
|
2764
|
+
/** On a TEE wallet's job: whether this read reconciled the row against the chain. */
|
|
2765
|
+
reconciled?: boolean;
|
|
2552
2766
|
createdAt: number;
|
|
2553
2767
|
finishedAt?: number;
|
|
2554
2768
|
httpStatus?: number;
|
|
2555
|
-
/**
|
|
2769
|
+
/**
|
|
2770
|
+
* The report the close call returned, once it finished. On a TEE wallet's job, the build while
|
|
2771
|
+
* its signatures are awaited, the report (`recovering` until the chain settles), or the stored error.
|
|
2772
|
+
*/
|
|
2556
2773
|
result?: CloseEmptyAccountsResult | Record<string, unknown>;
|
|
2557
2774
|
}
|
|
2558
2775
|
/** trade()'s one-call request: mirrors BuildTradeRequest minus clientTradeId/payer, plus who signs. */
|
|
@@ -2654,6 +2871,42 @@ export interface BuildAtomicLaunchResult {
|
|
|
2654
2871
|
legs: AtomicBundleResponseLeg[];
|
|
2655
2872
|
expiresAt: number;
|
|
2656
2873
|
}
|
|
2874
|
+
/** One first buy in an atomic dry run, as `/build` would floor it. */
|
|
2875
|
+
export interface AtomicDryRunFill {
|
|
2876
|
+
/** The leg's index in the bundle, 1 to 4. */
|
|
2877
|
+
index: number;
|
|
2878
|
+
signer: AtomicBundleLegSigner;
|
|
2879
|
+
payerType: "main" | "linked";
|
|
2880
|
+
wallet: string;
|
|
2881
|
+
amountRaw: string;
|
|
2882
|
+
/** The agent-tier fee `/build` appends to this leg, raw. */
|
|
2883
|
+
feeRaw: string;
|
|
2884
|
+
/** What `/build`'s leg would carry: the ladder fill, and the floor it signs at. */
|
|
2885
|
+
expectedFill: {
|
|
2886
|
+
amountOutRaw: string;
|
|
2887
|
+
minAmountOutRaw: string;
|
|
2888
|
+
};
|
|
2889
|
+
supplyPct: number;
|
|
2890
|
+
}
|
|
2891
|
+
/** POST /api/v1/launch/atomic/dry-run response. */
|
|
2892
|
+
export interface AtomicDryRunResult {
|
|
2893
|
+
success: true;
|
|
2894
|
+
dryRun: true;
|
|
2895
|
+
/** The wallet that pays for the launch leg. Never checked for balance. */
|
|
2896
|
+
launchWallet: string;
|
|
2897
|
+
launchSigner: AtomicBundleLegSigner;
|
|
2898
|
+
resolved: Omit<ResolvedLaunch, "dexVersion" | "buyAmount">;
|
|
2899
|
+
curveTerms?: LaunchPreviewTerms;
|
|
2900
|
+
/** Present only when the launch chose a non-default pool fee or shape. */
|
|
2901
|
+
graduation?: LaunchGraduationPreview;
|
|
2902
|
+
fills: AtomicDryRunFill[];
|
|
2903
|
+
/** Whether the first buys alone take the new curve to its threshold inside the bundle. */
|
|
2904
|
+
graduatesInBundle: boolean;
|
|
2905
|
+
checks: {
|
|
2906
|
+
exclusiveEligible?: boolean;
|
|
2907
|
+
};
|
|
2908
|
+
matrixVersion: number;
|
|
2909
|
+
}
|
|
2657
2910
|
/**
|
|
2658
2911
|
* POST /api/v1/launch/atomic/submit request body: EXACTLY the client-signer legs
|
|
2659
2912
|
* `BuildAtomicLaunchResult.legs` named (`signer: "client"`), in leg order -- omit every "server"
|
|
@@ -3011,6 +3264,10 @@ export declare class CandleClient {
|
|
|
3011
3264
|
* Lists the embedded Solana wallet's empty token accounts that a close would reclaim, on both
|
|
3012
3265
|
* token programs, and the SOL their rent returns (BE-418). Read-only: nothing is built, signed or
|
|
3013
3266
|
* written, and any key scope may call it.
|
|
3267
|
+
*
|
|
3268
|
+
* With `wallet` (a Solana TEE wallet's linked-wallet id, BE-1687), the same preview for that TEE
|
|
3269
|
+
* wallet, by any key bound to it. Off on a deployment until it is enabled
|
|
3270
|
+
* (`AGENT_TEE_CLOSE_EMPTY_ENABLED`): until then it throws LAUNCH_DISABLED.
|
|
3014
3271
|
*/
|
|
3015
3272
|
previewCloseEmptyAccounts(req?: PreviewCloseEmptyAccountsRequest): Promise<CloseEmptyAccountsPreview>;
|
|
3016
3273
|
/**
|
|
@@ -3023,10 +3280,27 @@ export declare class CandleClient {
|
|
|
3023
3280
|
* returns its stored report (`replayed: true`), a repeat while it runs throws CLOSE_IN_PROGRESS,
|
|
3024
3281
|
* and the same id with a different request throws IDEMPOTENCY_CONFLICT. So a retry under the
|
|
3025
3282
|
* same id is safe, and this method still never retries on its own.
|
|
3283
|
+
*
|
|
3284
|
+
* With `wallet` (a Solana TEE wallet's linked-wallet id bound to this key, BE-1687), the TEE
|
|
3285
|
+
* wallet's close instead. Needs `swap:write`, `privyWalletId`, and that wallet's signer in
|
|
3286
|
+
* `secretStore`. Three steps: `POST /agent/wallets/:id/close-empty/build` (the server builds
|
|
3287
|
+
* the close transactions, every one CloseAccount with the TEE wallet as fee payer, rent
|
|
3288
|
+
* destination and owner, and stamps them for the relay), `signLinkedTransaction()` per
|
|
3289
|
+
* transaction, then `POST .../close-empty/submit` with the whole signed batch, which the server
|
|
3290
|
+
* checks against the build before it sends anything. A build with nothing to close returns
|
|
3291
|
+
* `nothing_to_close` without signing. A `recovering` result means a transaction may still land:
|
|
3292
|
+
* nothing is sent again, and getCloseEmptyAccountsJob(clientTradeId, { wallet }) reads it until
|
|
3293
|
+
* it settles. A TEE wallet's build is signable once: after a lost answer, read the job rather
|
|
3294
|
+
* than calling this again. Off on a deployment until it is enabled
|
|
3295
|
+
* (`AGENT_TEE_CLOSE_EMPTY_ENABLED`): until then it throws LAUNCH_DISABLED.
|
|
3026
3296
|
*/
|
|
3027
3297
|
closeEmptyAccounts(req: CloseEmptyAccountsRequest): Promise<CloseEmptyAccountsResult>;
|
|
3028
|
-
/**
|
|
3029
|
-
|
|
3298
|
+
/**
|
|
3299
|
+
* Reads a closeEmptyAccounts() run by its clientTradeId, without sending anything (BE-418). With
|
|
3300
|
+
* `wallet`, a TEE wallet's run (BE-1687, `swap:write`): that read also reconciles the run against
|
|
3301
|
+
* the chain, so a `recovering` close settles by reading it again. It never signs or sends.
|
|
3302
|
+
*/
|
|
3303
|
+
getCloseEmptyAccountsJob(clientTradeId: string, opts?: CloseEmptyAccountsJobOptions): Promise<CloseEmptyAccountsJob>;
|
|
3030
3304
|
/**
|
|
3031
3305
|
* Imports an existing wallet via Candle's ciphertext-only flow (PR3): calls
|
|
3032
3306
|
* `/agent/wallets/import/init` for Privy's HPKE receiver public key, encrypts `privateKey`
|
|
@@ -3361,6 +3635,16 @@ export declare class CandleClient {
|
|
|
3361
3635
|
* before the call when you can.
|
|
3362
3636
|
*/
|
|
3363
3637
|
buildAtomicLaunch(req: BuildAtomicLaunchRequest): Promise<BuildAtomicLaunchResult>;
|
|
3638
|
+
/**
|
|
3639
|
+
* Atomic launch dry run: the same body as `buildAtomicLaunch()`, the same checks (payers, plan,
|
|
3640
|
+
* the Believer check, each leg's fee and spend limits, the key's transaction cap) and the same
|
|
3641
|
+
* refusals, plus the launch preview and one fill per first buy. Records, reserves and draws
|
|
3642
|
+
* nothing: no day-cap slot, no vanity mint, no spend reservation, and the `clientLaunchId` stays
|
|
3643
|
+
* unused. Does not check balances, the day cap, a `clientLaunchId` already used with another body,
|
|
3644
|
+
* a TEE leg's USD spend window or the transaction's size; `buildAtomicLaunch()` can still refuse
|
|
3645
|
+
* for those. Sends the body as given, like `dryRunLaunch()`: name a `clientLaunchId`.
|
|
3646
|
+
*/
|
|
3647
|
+
dryRunAtomicLaunch(req: BuildAtomicLaunchRequest): Promise<AtomicDryRunResult>;
|
|
3364
3648
|
/**
|
|
3365
3649
|
* The atomic build request itself. Sets `clientLaunchId` on the result from the request, since
|
|
3366
3650
|
* the server's body omits it. Shared by buildAtomicLaunch() and launchAtomic(), each of which
|
|
@@ -3674,11 +3958,12 @@ export declare class CandleClient {
|
|
|
3674
3958
|
* through Relay (spec 2026-10-17, route A). MOVES REAL FUNDS. Needs `perps:withdraw`.
|
|
3675
3959
|
*
|
|
3676
3960
|
* Every signature is checked first, and a mismatch throws with nothing signed: the NonceMapping
|
|
3677
|
-
* names this key's account and
|
|
3678
|
-
*
|
|
3679
|
-
*
|
|
3680
|
-
*
|
|
3681
|
-
*
|
|
3961
|
+
* names this key's account and the build's Relay order id (`relayOrderId`, never the step
|
|
3962
|
+
* `relayRequestId`), and the build lands on one of `ownDestinations` (the recipient check: Relay's
|
|
3963
|
+
* own record of the request is not read, BE-1777); then the SendAsset carries the mapping's nonce,
|
|
3964
|
+
* the exact amount asked for, and the pinned token, dex and depository. The client posts the
|
|
3965
|
+
* SendAsset to Hyperliquid itself and reports the answer. There is no confirmation gate here: the
|
|
3966
|
+
* CLI has one (`candle perps withdraw`).
|
|
3682
3967
|
*/
|
|
3683
3968
|
perpsWithdraw(params: PerpsWithdrawParams): Promise<PerpsWithdrawResult>;
|
|
3684
3969
|
/**
|
|
@@ -3729,7 +4014,7 @@ export declare function __setEvmReceiptWaitForTest(opts: {
|
|
|
3729
4014
|
pollMs?: number;
|
|
3730
4015
|
} | null): void;
|
|
3731
4016
|
/** This build's own version. Kept in lockstep with package.json by the release-bump CI guard. */
|
|
3732
|
-
export declare const SDK_VERSION = "0.6.
|
|
4017
|
+
export declare const SDK_VERSION = "0.6.5";
|
|
3733
4018
|
/** Test seam: the once-per-process latch would otherwise weld the suite's first case to the rest. */
|
|
3734
4019
|
export declare function __resetSdkUpdateNoticeForTest(): void;
|
|
3735
4020
|
//# sourceMappingURL=client.d.ts.map
|