ault-sdk-ts 0.9.0 → 0.10.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.
Files changed (42) hide show
  1. package/README.md +206 -93
  2. package/dist/agent/attach.d.ts +10 -1
  3. package/dist/agent/sign-and-broadcast.d.ts +1 -1
  4. package/dist/agent/tx/vault.d.ts +11 -0
  5. package/dist/client.d.ts +8 -0
  6. package/dist/core/address.d.ts +6 -0
  7. package/dist/core/clob-msgs.d.ts +9 -0
  8. package/dist/core/lending-gas.d.ts +5 -0
  9. package/dist/core/lending-msgs.d.ts +52 -0
  10. package/dist/core/manifest-types.d.ts +52 -0
  11. package/dist/core/margin-account.d.ts +18 -0
  12. package/dist/core/margin-gas.d.ts +7 -0
  13. package/dist/core/margin-msgs.d.ts +52 -0
  14. package/dist/core/network.d.ts +26 -0
  15. package/dist/core/perpetual-msgs.d.ts +0 -16
  16. package/dist/core/vault-gas.d.ts +8 -0
  17. package/dist/core/vault-msgs.d.ts +150 -0
  18. package/dist/eip712/msg.generated.d.ts +19 -106
  19. package/dist/eip712/registry.d.ts +7 -1
  20. package/dist/high-level/tx/lending.d.ts +3 -0
  21. package/dist/high-level/tx/license.d.ts +1 -1
  22. package/dist/high-level/tx/margin.d.ts +3 -0
  23. package/dist/high-level/tx/vault.d.ts +3 -0
  24. package/dist/high-level/types.d.ts +227 -178
  25. package/dist/index.cjs +16049 -20858
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +6 -0
  28. package/dist/index.js +15992 -20813
  29. package/dist/index.js.map +1 -1
  30. package/dist/rest/dex-types.generated.d.ts +1 -1
  31. package/dist/rest/dex.d.ts +34 -1
  32. package/dist/rest/lending.d.ts +46 -0
  33. package/dist/rest/margin.d.ts +33 -0
  34. package/dist/rest/oracle.d.ts +19 -0
  35. package/dist/rest/pagination.d.ts +6 -2
  36. package/dist/rest/portfolio.d.ts +32 -0
  37. package/dist/rest/vault.d.ts +26 -0
  38. package/package.json +1 -1
  39. package/dist/high-level/tx/authority.d.ts +0 -3
  40. package/dist/high-level/tx/market.d.ts +0 -3
  41. package/dist/high-level/tx/ratelimit.d.ts +0 -3
  42. package/dist/high-level/tx/tokenregistry.d.ts +0 -3
@@ -6,13 +6,20 @@ import type { ManifestResolver } from "../core/manifest-resolver";
6
6
  import type { Manifest } from "../core/manifest-types";
7
7
  import type { AccountxApi } from "../rest/accountx";
8
8
  import type { AgentApi } from "../rest/agent";
9
- import type { AuthorityApi, AuthorityRoleInput } from "../rest/authority";
9
+ import type { AuthorityApi } from "../rest/authority";
10
10
  import type { BankApi } from "../rest/bank";
11
11
  import type { ClobApi } from "../rest/clob";
12
12
  import type { LicenseApi } from "../rest/license";
13
13
  import type { MarketApi } from "../rest/market";
14
14
  import type { MinerApi } from "../rest/miner";
15
15
  import type { PerpetualApi } from "../rest/perpetual";
16
+ import type { LendingApi } from "../rest/lending";
17
+ import type { MarginOrderOptions } from "../core/margin-msgs";
18
+ import type { LendingPoolId } from "../core/lending-msgs";
19
+ import type { VaultConfigInput, VaultFeeInput, VaultLockupInput, VaultStatusInput } from "../core/vault-msgs";
20
+ import type { MarginApi } from "../rest/margin";
21
+ import type { OracleApi } from "../rest/oracle";
22
+ import type { VaultApi } from "../rest/vault";
16
23
  import type { RateLimitApi } from "../rest/ratelimit";
17
24
  import type { RewardApi } from "../rest/reward";
18
25
  import type { StakingApi } from "../rest/staking";
@@ -20,29 +27,13 @@ import type { TokenRegistryApi } from "../rest/tokenregistry";
20
27
  import type { OrderResponse as ChainOrderResponse, TwapOrderResult } from "../proto/gen/ault/clob/v1/query";
21
28
  import type { OrderResponse as DexOrderResponse } from "../rest/dex.generated";
22
29
  import type { License } from "../proto/gen/ault/license/v1/license";
23
- import type { Params as AgentParams } from "../proto/gen/ault/agent/v1/params";
24
30
  import type { Role } from "../proto/gen/ault/authority/v1/authority";
25
- import type { Params as AccountxParams } from "../proto/gen/ault/accountx/v1/params";
26
- import type { Params as ClobParams } from "../proto/gen/ault/clob/v1/params";
27
- import type { Params as LicenseChainParams } from "../proto/gen/ault/license/v1/license";
28
- import type { Params as MarketParams } from "../proto/gen/ault/market/v1/params";
29
- import type { MarketType } from "../proto/gen/ault/market/v1/market";
30
- import type { PerpetualMarketConfig } from "../proto/gen/ault/perpetual/v1/perpetual";
31
- import type { Params as MinerChainParams } from "../proto/gen/ault/miner/v1/miner";
32
- import type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
33
31
  import type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
34
- import type { TransferLimitConfig } from "../proto/gen/ault/tokenregistry/v1/tokenregistry";
35
32
  import type { Any as ProtoAny } from "../proto/gen/google/protobuf/any";
36
33
  import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
37
34
  import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
38
35
  import type { BigIntLike } from "../core/address";
39
36
  export type { BigIntLike };
40
- export type MarketTypeInput = MarketType;
41
- export type MarketUpdateInput = {
42
- marketId: Uint8Array;
43
- makerFeeRate: string;
44
- takerFeeRate: string;
45
- };
46
37
  /** Common transaction options available on all methods */
47
38
  export interface TxOptions {
48
39
  gasLimit?: string;
@@ -202,18 +193,6 @@ export type ModifyOrdersResult = TxResult & {
202
193
  failed: string[];
203
194
  };
204
195
  export interface LicenseTxApi {
205
- mintLicense(params: {
206
- to: string;
207
- uri: string;
208
- reason?: string;
209
- } & TxOptions): Promise<TxResult>;
210
- batchMintLicense(params: {
211
- recipients: Array<{
212
- to: string;
213
- uri: string;
214
- }>;
215
- reason?: string;
216
- } & TxOptions): Promise<TxResult>;
217
196
  transferLicense(params: {
218
197
  licenseId: BigIntLike;
219
198
  to: string;
@@ -226,41 +205,6 @@ export interface LicenseTxApi {
226
205
  */
227
206
  openAccountFeeDenom?: string;
228
207
  } & TxOptions): Promise<TxResult>;
229
- burnLicense(params: {
230
- licenseId: BigIntLike;
231
- reason?: string;
232
- } & TxOptions): Promise<TxResult>;
233
- revokeLicense(params: {
234
- licenseId: BigIntLike;
235
- reason?: string;
236
- } & TxOptions): Promise<TxResult>;
237
- setTokenURI(params: {
238
- licenseId: BigIntLike;
239
- uri: string;
240
- } & TxOptions): Promise<TxResult>;
241
- approveMember(params: {
242
- member: string;
243
- } & TxOptions): Promise<TxResult>;
244
- batchApproveMember(params: {
245
- members: string[];
246
- } & TxOptions): Promise<TxResult>;
247
- revokeMember(params: {
248
- member: string;
249
- } & TxOptions): Promise<TxResult>;
250
- batchRevokeMember(params: {
251
- members: string[];
252
- } & TxOptions): Promise<TxResult>;
253
- setKYCApprovers(params: {
254
- add?: string[];
255
- remove?: string[];
256
- } & TxOptions): Promise<TxResult>;
257
- setMinters(params: {
258
- add?: string[];
259
- remove?: string[];
260
- } & TxOptions): Promise<TxResult>;
261
- updateLicenseParams(params: {
262
- params: LicenseChainParams;
263
- } & TxOptions): Promise<TxResult>;
264
208
  }
265
209
  export interface MinerTxApi {
266
210
  delegateMining(params: {
@@ -302,9 +246,6 @@ export interface MinerTxApi {
302
246
  newCommissionRate: number;
303
247
  newCommissionRecipient?: string;
304
248
  } & TxOptions): Promise<TxResult>;
305
- updateMinerParams(params: {
306
- params: MinerChainParams;
307
- } & TxOptions): Promise<TxResult>;
308
249
  }
309
250
  export interface AgentTxApi {
310
251
  approveAgent(params: {
@@ -320,9 +261,6 @@ export interface AgentTxApi {
320
261
  revokeAgent(params: {
321
262
  agentAddress: string;
322
263
  } & TxOptions): Promise<TxResult>;
323
- updateAgentParams(params: {
324
- params: AgentParams;
325
- } & TxOptions): Promise<TxResult>;
326
264
  }
327
265
  export interface AccountxTxApi {
328
266
  /**
@@ -341,68 +279,6 @@ export interface AccountxTxApi {
341
279
  feeDenom: string;
342
280
  account?: string;
343
281
  } & TxOptions): Promise<TxResult>;
344
- updateAccountxParams(params: {
345
- params: AccountxParams;
346
- } & TxOptions): Promise<TxResult>;
347
- }
348
- export interface AuthorityTxApi {
349
- grantRole(params: {
350
- role: AuthorityRoleInput;
351
- members: string[];
352
- } & TxOptions): Promise<TxResult>;
353
- revokeRole(params: {
354
- role: AuthorityRoleInput;
355
- members: string[];
356
- } & TxOptions): Promise<TxResult>;
357
- }
358
- export interface MarketTxApi {
359
- /**
360
- * Create a spot market. A perpetual market needs its `PerpetualMarketConfig`
361
- * at creation (x/market rejects `MsgCreateMarket` for
362
- * `MARKET_TYPE_PERPETUAL` without one, and the market type cannot change
363
- * afterwards), so use `createPerpetualMarket` for that; passing
364
- * `MARKET_TYPE_PERPETUAL` here throws.
365
- */
366
- createMarket(params: {
367
- marketType: MarketTypeInput;
368
- baseDenom: string;
369
- quoteDenom: string;
370
- tickPrecision: number;
371
- } & TxOptions): Promise<TxResult>;
372
- /**
373
- * Create a perpetual market (chain v3) with the config x/perpetual trades it
374
- * under: margin tiers, funding caps, oracle feed ids and the mark price
375
- * bounds. The quote denom is expected to be the module's collateral denom.
376
- * The config's decimal fields take human-readable strings ("0.0001").
377
- */
378
- createPerpetualMarket(params: {
379
- baseDenom: string;
380
- quoteDenom: string;
381
- tickPrecision: number;
382
- config: PerpetualMarketConfig;
383
- } & TxOptions): Promise<TxResult>;
384
- /**
385
- * Replace the config a perpetual market trades under. Only the market's
386
- * deployer may send this; the config replaces the previous one whole.
387
- */
388
- setPerpetualMarketConfig(params: {
389
- marketId: Uint8Array;
390
- config: PerpetualMarketConfig;
391
- } & TxOptions): Promise<TxResult>;
392
- updateMarket(params: {
393
- updates: MarketUpdateInput[];
394
- } & TxOptions): Promise<TxResult>;
395
- haltMarkets(params: {
396
- marketIds: Uint8Array[];
397
- } & TxOptions): Promise<TxResult>;
398
- resumeMarkets(params: {
399
- marketIds: Uint8Array[];
400
- } & TxOptions): Promise<TxResult>;
401
- haltAllMarkets(params?: TxOptions): Promise<TxResult>;
402
- resumeAllMarkets(params?: TxOptions): Promise<TxResult>;
403
- updateMarketParams(params: {
404
- params: MarketParams;
405
- } & TxOptions): Promise<TxResult>;
406
282
  }
407
283
  export type LimitOrderParams = {
408
284
  marketId: Uint8Array;
@@ -429,6 +305,14 @@ export type LimitOrderParams = {
429
305
  * pre-v3 sign bytes are unchanged.
430
306
  */
431
307
  reduceOnly?: boolean;
308
+ /**
309
+ * Spot markets only (chain v3): escrow from the owner's margin account
310
+ * instead of the bank balance. The account is the cross one with
311
+ * `cross: true`, otherwise the market's isolated one (`marginAccountAddress`).
312
+ * Over EIP-712 at least one flag must be set; an all-false isolated order
313
+ * signs through the agent path.
314
+ */
315
+ margin?: MarginOrderOptions;
432
316
  };
433
317
  /**
434
318
  * TWAP order (chain v2.1.0+). The chain splits `totalDeposit` into equal
@@ -460,6 +344,8 @@ export type MarketOrderParams = {
460
344
  builderFeeRate?: string;
461
345
  /** Optional 8-byte client order id. Omitted from the signed payload when absent. */
462
346
  cloid?: Uint8Array;
347
+ /** Spot markets only; see `LimitOrderParams.margin`. */
348
+ margin?: MarginOrderOptions;
463
349
  };
464
350
  export type ScaleOrderParams = {
465
351
  marketId: Uint8Array;
@@ -538,14 +424,6 @@ export interface ClobTxApi {
538
424
  wait?: false;
539
425
  } & TxOptions): Promise<TxResult>;
540
426
  placeTwapOrder(params: TwapOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceTwapOrderResult>;
541
- updateClobParams(params: {
542
- params: ClobParams;
543
- } & TxOptions): Promise<TxResult>;
544
- }
545
- export interface RateLimitTxApi {
546
- updateRateLimitParams(params: {
547
- params: RateLimitParams;
548
- } & TxOptions): Promise<TxResult>;
549
427
  }
550
428
  export interface RewardTxApi {
551
429
  setReferralCode(params: {
@@ -554,10 +432,6 @@ export interface RewardTxApi {
554
432
  setReferral(params: {
555
433
  code: string;
556
434
  } & TxOptions): Promise<TxResult>;
557
- updateEligibleReferrers(params: {
558
- add?: string[];
559
- remove?: string[];
560
- } & TxOptions): Promise<TxResult>;
561
435
  approveBuilder(params: {
562
436
  builder: string;
563
437
  maxFeeRate: string;
@@ -565,15 +439,177 @@ export interface RewardTxApi {
565
439
  revokeBuilder(params: {
566
440
  builder: string;
567
441
  } & TxOptions): Promise<TxResult>;
568
- setDeployerShare(params: {
569
- marketId: Uint8Array;
570
- recipient: string;
571
- shareRate: string;
442
+ }
443
+ /** A coin in its denom's base units, e.g. `{ denom: "uusdc", amount: "1000000" }`. */
444
+ export interface CoinInput {
445
+ denom: string;
446
+ amount: string;
447
+ }
448
+ export interface LendingCoinParams {
449
+ poolId: LendingPoolId;
450
+ coin: CoinInput;
451
+ }
452
+ /**
453
+ * x/lending position operations, signed by the position owner (not
454
+ * agent-signable). Amounts are base units; the chain converts to shares.
455
+ */
456
+ export interface LendingTxApi {
457
+ /** Supply to a pool's lending side. Earns the supply rate; can be borrowed. */
458
+ lendingSupply(params: LendingCoinParams & TxOptions): Promise<TxResult>;
459
+ /** Withdraw a supply. Fails when the pool lacks the liquidity. */
460
+ lendingWithdraw(params: LendingCoinParams & TxOptions): Promise<TxResult>;
461
+ /** Post collateral. It earns nothing and is not lent out. */
462
+ lendingSupplyCollateral(params: LendingCoinParams & TxOptions): Promise<TxResult>;
463
+ /** Withdraw collateral; refused when the position would become unhealthy. */
464
+ lendingWithdrawCollateral(params: LendingCoinParams & TxOptions): Promise<TxResult>;
465
+ /** Borrow against the signer's collateral in the pool. */
466
+ lendingBorrow(params: LendingCoinParams & TxOptions): Promise<TxResult>;
467
+ /** Repay debt in the coin's denom; `borrower` defaults to the signer. */
468
+ lendingRepay(params: LendingCoinParams & {
469
+ borrower?: string;
470
+ } & TxOptions): Promise<TxResult>;
471
+ /** Liquidate an unhealthy position, seizing `seizeDenom` collateral plus the bonus. */
472
+ lendingLiquidate(params: {
473
+ poolId: LendingPoolId;
474
+ borrower: string;
475
+ repay: CoinInput;
476
+ seizeDenom: string;
477
+ } & TxOptions): Promise<TxResult>;
478
+ /** Donate to the insurance fund. Not fee-free; gas is simulated unless `gasLimit` is set. */
479
+ fundLendingInsuranceFund(params: {
480
+ coin: CoinInput;
481
+ } & TxOptions): Promise<TxResult>;
482
+ }
483
+ /**
484
+ * x/margin account operations. Without `marketId` they act on the signer's
485
+ * cross margin account, with one on that market's isolated account. Margin
486
+ * orders themselves are clob orders with `margin` options.
487
+ */
488
+ export interface MarginTxApi {
489
+ /** Move coins from the bank balance into the margin account as collateral. */
490
+ depositMargin(params: {
491
+ amount: CoinInput[];
492
+ marketId?: Uint8Array;
493
+ } & TxOptions): Promise<TxResult>;
494
+ /** Withdraw collateral back to the bank; bounded by the dex-api's `maxTransferable`. */
495
+ withdrawMargin(params: {
496
+ amount: CoinInput[];
497
+ marketId?: Uint8Array;
498
+ } & TxOptions): Promise<TxResult>;
499
+ /** Borrow into the margin account from the margin Lending pool. */
500
+ borrowMargin(params: {
501
+ amount: CoinInput;
502
+ marketId?: Uint8Array;
503
+ } & TxOptions): Promise<TxResult>;
504
+ /** Repay the margin account's debt out of its own collateral. */
505
+ repayMargin(params: {
506
+ amount: CoinInput;
507
+ marketId?: Uint8Array;
508
+ } & TxOptions): Promise<TxResult>;
509
+ }
510
+ /**
511
+ * x/vault operations a wallet signs over EIP-712. Creating a vault or
512
+ * changing its config signs through the agent path (`client.asAgent` for a
513
+ * vault you own, `client.attachVaultManager` for a vault account's own
514
+ * messages).
515
+ */
516
+ export interface VaultTxApi {
517
+ /** Deposit into a vault; mints shares at the current share price. */
518
+ depositToVault(params: {
519
+ vaultAddress: string;
520
+ amount: CoinInput;
521
+ } & TxOptions): Promise<TxResult>;
522
+ /**
523
+ * Redeem raw shares (10^18 per human share). Settles at once when the vault
524
+ * has idle funds, otherwise queues a redemption request.
525
+ */
526
+ redeemFromVault(params: {
527
+ vaultAddress: string;
528
+ shares: string;
572
529
  } & TxOptions): Promise<TxResult>;
573
- updateRewardParams(params: {
574
- params: RewardParams;
530
+ /**
531
+ * Hand a vault you own to a new manager. A child vault has none; a normal
532
+ * trading vault's new manager must hold its `managerFractionBps` of shares.
533
+ */
534
+ updateVaultManager(params: {
535
+ vaultAddress: string;
536
+ manager: string;
537
+ } & TxOptions): Promise<TxResult>;
538
+ /** Drop a scheduled config update of a vault you own before it applies. */
539
+ cancelVaultConfigUpdate(params: {
540
+ vaultAddress: string;
541
+ } & TxOptions): Promise<TxResult>;
542
+ /** Pause, resume or close a vault you own (its owner, not its manager). Closing is final. */
543
+ setVaultStatus(params: {
544
+ vaultAddress: string;
545
+ status: VaultStatusInput;
575
546
  } & TxOptions): Promise<TxResult>;
576
547
  }
548
+ export interface CreateVaultParams {
549
+ vaultDenom: string;
550
+ config: VaultConfigInput;
551
+ /** Required unless `relationship` is `child`; a child vault takes none. */
552
+ lockup?: VaultLockupInput;
553
+ fee: VaultFeeInput;
554
+ /** Required, positive and in `vaultDenom`, for a normal trading vault; other vaults take none. */
555
+ initialDeposit?: CoinInput;
556
+ /**
557
+ * Defaults to the owner, which a normal vault's manager must be. A child
558
+ * vault takes none: its parent's manager runs it.
559
+ */
560
+ manager?: string;
561
+ /**
562
+ * Required (positive) for a trading vault with an unrestricted lockup;
563
+ * zero for a fund window, a lending vault and a child vault.
564
+ */
565
+ exitFeeBps?: number;
566
+ /**
567
+ * Default `normal`. `child` is only sent from a parent vault's account
568
+ * (`attachVaultManager`). A `parent` vault is owned by x/gov, so no account
569
+ * can create one here; it comes from a governance proposal.
570
+ */
571
+ relationship?: "normal" | "parent" | "child";
572
+ }
573
+ /**
574
+ * Agent-signed vault administration, sent by a vault's owner. On
575
+ * `client.asAgent` the owner is the master: it creates normal vaults and
576
+ * administers the ones it owns. On the manager surface of a parent vault the
577
+ * owner is the parent vault's account: `createVault` makes a child and the
578
+ * rest act on its children. x/vault rejects these from any other vault
579
+ * account.
580
+ */
581
+ export interface AgentVaultTxApi {
582
+ createVault(params: CreateVaultParams & AgentTxOptions): Promise<TxResult>;
583
+ updateVaultConfig(params: {
584
+ vaultAddress: string;
585
+ config: VaultConfigInput;
586
+ } & AgentTxOptions): Promise<TxResult>;
587
+ cancelVaultConfigUpdate(params: {
588
+ vaultAddress: string;
589
+ } & AgentTxOptions): Promise<TxResult>;
590
+ setVaultStatus(params: {
591
+ vaultAddress: string;
592
+ status: VaultStatusInput;
593
+ } & AgentTxOptions): Promise<TxResult>;
594
+ }
595
+ /** Operations only a vault's own account can send, signed by its manager. */
596
+ export interface VaultAccountTxApi {
597
+ /** Move a normal Lending vault's supply between two of its configured pools. */
598
+ reallocateVault(params: {
599
+ sourcePoolId: LendingPoolId;
600
+ destinationPoolId: LendingPoolId;
601
+ amount: CoinInput;
602
+ } & AgentTxOptions): Promise<TxResult>;
603
+ /**
604
+ * Move capital between this parent vault and one of its children, in the
605
+ * parent's denom: into the child when `isDeposit`, back to the parent otherwise.
606
+ */
607
+ transferChildVault(params: {
608
+ childVault: string;
609
+ amount: CoinInput;
610
+ isDeposit: boolean;
611
+ } & AgentTxOptions): Promise<TxResult>;
612
+ }
577
613
  export interface StakingTxApi {
578
614
  delegate(params: {
579
615
  validatorAddress: string;
@@ -612,32 +648,6 @@ export interface StakingTxApi {
612
648
  validatorAddresses: string[];
613
649
  } & TxOptions): Promise<TxResult[]>;
614
650
  }
615
- export interface TokenRegistryTxApi {
616
- enableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;
617
- disableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;
618
- registerTokenPair(params: {
619
- erc20Address: string;
620
- enabled: boolean;
621
- } & TxOptions): Promise<TxResult>;
622
- enableTokenPair(params: {
623
- erc20Address: string;
624
- } & TxOptions): Promise<TxResult>;
625
- disableTokenPair(params: {
626
- erc20Address: string;
627
- } & TxOptions): Promise<TxResult>;
628
- /**
629
- * Set the transfer rate limit for a registered token pair. `registerTokenPair`
630
- * writes a zero (unlimited) config; this is the follow-up to tighten it.
631
- */
632
- setTransferLimit(params: {
633
- erc20Address: string;
634
- transferLimit: TransferLimitConfig;
635
- } & TxOptions): Promise<TxResult>;
636
- /** Remove the transfer rate limit for a registered token pair. */
637
- removeTransferLimit(params: {
638
- erc20Address: string;
639
- } & TxOptions): Promise<TxResult>;
640
- }
641
651
  export interface LicenseDelegationStatus {
642
652
  licenseId: string;
643
653
  isDelegated: boolean;
@@ -790,12 +800,37 @@ export interface AgentPerpetualTxApi {
790
800
  * Agent identity + agent-signed CLOB and perpetual tx surface attached to a
791
801
  * `Client`. `client.asAgent` is non-null only after `client.attachAgent(...)`.
792
802
  */
793
- export interface AgentSurface extends AgentClobTxApi, AgentPerpetualTxApi {
803
+ export interface AgentSurface extends AgentClobTxApi, AgentPerpetualTxApi, AgentVaultTxApi {
794
804
  /** Agent address (bech32). */
795
805
  readonly address: string;
796
806
  /** Master address — same as `client.address`. */
797
807
  readonly masterAddress: string;
798
808
  }
809
+ /**
810
+ * Surface for acting as a vault account: every message is sent from the
811
+ * vault's own account and signed by the key that controls it (the manager of
812
+ * a normal or parent vault, the parent's manager for a child) or that key's
813
+ * registered agent. Build it with `client.attachVaultManager(...)`.
814
+ *
815
+ * x/vault accepts a different set per vault (rc.2 account control):
816
+ * - normal trading vault, child vault: limit, market and scale orders,
817
+ * modify and cancel, on the vault's configured spot markets;
818
+ * - normal lending vault: `reallocateVault`;
819
+ * - parent vault: `createVault` (children), `updateVaultConfig`,
820
+ * `cancelVaultConfigUpdate` and `setVaultStatus` on its children, and
821
+ * `transferChildVault`. A parent vault does not trade.
822
+ *
823
+ * TWAP orders are not available from a vault account.
824
+ */
825
+ export interface VaultManagerSurface extends Omit<AgentClobTxApi, "placeTwapOrder">, AgentVaultTxApi, VaultAccountTxApi {
826
+ /** Address of the signing key (the manager or its agent). */
827
+ readonly address: string;
828
+ /** The vault account every message is sent from. */
829
+ readonly vaultAddress: string;
830
+ }
831
+ export interface AttachVaultManagerOptions extends AttachAgentOptions {
832
+ vaultAddress: string;
833
+ }
799
834
  export interface AttachAgentOptions {
800
835
  /** Hex-encoded agent private key (with or without `0x`). */
801
836
  agentPrivateKey: string;
@@ -812,7 +847,7 @@ export interface AttachAgentOptions {
812
847
  * High-level client interface for the Ault SDK.
813
848
  * Provides simplified methods for common operations.
814
849
  */
815
- export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, PerpetualTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi, CloidLookupApi {
850
+ export interface Client extends AccountxTxApi, AgentTxApi, ClobTxApi, LendingTxApi, LicenseTxApi, MarginTxApi, MinerTxApi, PerpetualTxApi, RewardTxApi, StakingTxApi, VaultTxApi, ParallelQueryApi, CloidLookupApi {
816
851
  /** Network configuration */
817
852
  readonly network: NetworkConfig;
818
853
  /** Signer address in Ault bech32 format */
@@ -843,6 +878,14 @@ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobT
843
878
  readonly tokenregistry: TokenRegistryApi;
844
879
  /** Perpetual module queries (chain v3): collateral, positions, account risk, funding. */
845
880
  readonly perpetual: PerpetualApi;
881
+ /** Lending module queries (x/lending, chain state at the latest height). */
882
+ readonly lending: LendingApi;
883
+ /** Margin module queries (x/margin). */
884
+ readonly margin: MarginApi;
885
+ /** Vault module queries (x/vault). */
886
+ readonly vault: VaultApi;
887
+ /** Oracle module queries (x/oracle). */
888
+ readonly oracle: OracleApi;
846
889
  /**
847
890
  * Agent-signed tx surface. Null until `attachAgent` is called; cleared by
848
891
  * `detachAgent`. The reference changes on attach/detach — consumers
@@ -858,6 +901,12 @@ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobT
858
901
  attachAgent(options: AttachAgentOptions): AgentSurface;
859
902
  /** Detach the current agent identity. `client.asAgent` becomes null. No-op if no agent attached. */
860
903
  detachAgent(): void;
904
+ /**
905
+ * Build a surface that trades and administers `vaultAddress` from the
906
+ * vault's own account, signed with the manager's key or its registered
907
+ * agent. Independent of `asAgent`; call it once per managed vault.
908
+ */
909
+ attachVaultManager(options: AttachVaultManagerOptions): VaultManagerSurface;
861
910
  /** Access to the underlying low-level client for advanced use cases. */
862
911
  readonly _lowLevel: AultClient;
863
912
  /** Access to the underlying manifest resolver. Stable, advanced use only. */