ault-sdk-ts 0.8.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 (91) hide show
  1. package/README.md +267 -51
  2. package/dist/agent/attach.d.ts +10 -1
  3. package/dist/agent/sign-and-broadcast.d.ts +2 -2
  4. package/dist/agent/tx/perpetual.d.ts +10 -0
  5. package/dist/agent/tx/vault.d.ts +11 -0
  6. package/dist/client.d.ts +10 -0
  7. package/dist/core/address.d.ts +6 -0
  8. package/dist/core/clob-msgs.d.ts +21 -3
  9. package/dist/core/lending-gas.d.ts +5 -0
  10. package/dist/core/lending-msgs.d.ts +52 -0
  11. package/dist/core/manifest-types.d.ts +60 -0
  12. package/dist/core/margin-account.d.ts +18 -0
  13. package/dist/core/margin-gas.d.ts +7 -0
  14. package/dist/core/margin-msgs.d.ts +52 -0
  15. package/dist/core/network.d.ts +37 -7
  16. package/dist/core/perpetual-gas.d.ts +12 -0
  17. package/dist/core/perpetual-msgs.d.ts +44 -0
  18. package/dist/core/vault-gas.d.ts +8 -0
  19. package/dist/core/vault-msgs.d.ts +150 -0
  20. package/dist/eip712/msg-encoders.generated.d.ts +8 -0
  21. package/dist/eip712/msg.generated.d.ts +51 -68
  22. package/dist/eip712/registry.d.ts +17 -0
  23. package/dist/eip712/types.d.ts +5 -0
  24. package/dist/high-level/tx/lending.d.ts +3 -0
  25. package/dist/high-level/tx/license.d.ts +1 -1
  26. package/dist/high-level/tx/margin.d.ts +3 -0
  27. package/dist/high-level/tx/perpetual.d.ts +3 -0
  28. package/dist/high-level/tx/vault.d.ts +3 -0
  29. package/dist/high-level/types.d.ts +280 -152
  30. package/dist/index.cjs +23569 -12952
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.ts +9 -0
  33. package/dist/index.js +23364 -13023
  34. package/dist/index.js.map +1 -1
  35. package/dist/perp/decimal.d.ts +39 -0
  36. package/dist/perp/funding.d.ts +18 -0
  37. package/dist/perp/index.d.ts +5 -0
  38. package/dist/perp/margin.d.ts +33 -0
  39. package/dist/perp/orders.d.ts +27 -0
  40. package/dist/perp/position.d.ts +29 -0
  41. package/dist/proto/gen/ault/accountx/v1/query.d.ts +10 -1
  42. package/dist/proto/gen/ault/authority/v1/authority.d.ts +2 -0
  43. package/dist/proto/gen/ault/clob/v1/genesis.d.ts +7 -0
  44. package/dist/proto/gen/ault/clob/v1/twap.d.ts +11 -8
  45. package/dist/proto/gen/ault/clob/v1/tx.d.ts +11 -1
  46. package/dist/proto/gen/ault/common/v1/system.d.ts +31 -0
  47. package/dist/proto/gen/ault/lending/v1/genesis.d.ts +34 -0
  48. package/dist/proto/gen/ault/lending/v1/lending.d.ts +152 -0
  49. package/dist/proto/gen/ault/lending/v1/params.d.ts +42 -0
  50. package/dist/proto/gen/ault/lending/v1/query.d.ts +157 -0
  51. package/dist/proto/gen/ault/lending/v1/tx.d.ts +236 -0
  52. package/dist/proto/gen/ault/margin/v1/genesis.d.ts +102 -0
  53. package/dist/proto/gen/ault/margin/v1/margin.d.ts +130 -0
  54. package/dist/proto/gen/ault/margin/v1/params.d.ts +31 -0
  55. package/dist/proto/gen/ault/margin/v1/query.d.ts +127 -0
  56. package/dist/proto/gen/ault/margin/v1/tx.d.ts +181 -0
  57. package/dist/proto/gen/ault/market/v1/market.d.ts +9 -0
  58. package/dist/proto/gen/ault/market/v1/tx.d.ts +16 -0
  59. package/dist/proto/gen/ault/oracle/v1/genesis.d.ts +69 -0
  60. package/dist/proto/gen/ault/oracle/v1/oracle.d.ts +154 -0
  61. package/dist/proto/gen/ault/oracle/v1/query.d.ts +93 -0
  62. package/dist/proto/gen/ault/oracle/v1/tx.d.ts +151 -0
  63. package/dist/proto/gen/ault/perpetual/v1/genesis.d.ts +119 -0
  64. package/dist/proto/gen/ault/perpetual/v1/order.d.ts +46 -0
  65. package/dist/proto/gen/ault/perpetual/v1/params.d.ts +30 -0
  66. package/dist/proto/gen/ault/perpetual/v1/perpetual.d.ts +192 -0
  67. package/dist/proto/gen/ault/perpetual/v1/query.d.ts +150 -0
  68. package/dist/proto/gen/ault/perpetual/v1/tx.d.ts +97 -0
  69. package/dist/proto/gen/ault/systemtx/v1/genesis.d.ts +37 -0
  70. package/dist/proto/gen/ault/vault/v1/genesis.d.ts +90 -0
  71. package/dist/proto/gen/ault/vault/v1/params.d.ts +55 -0
  72. package/dist/proto/gen/ault/vault/v1/query.d.ts +152 -0
  73. package/dist/proto/gen/ault/vault/v1/tx.d.ts +194 -0
  74. package/dist/proto/gen/ault/vault/v1/vault.d.ts +227 -0
  75. package/dist/rest/dex-types.generated.d.ts +2045 -27
  76. package/dist/rest/dex.d.ts +52 -2
  77. package/dist/rest/dex.generated.d.ts +5097 -1276
  78. package/dist/rest/lending.d.ts +46 -0
  79. package/dist/rest/margin.d.ts +33 -0
  80. package/dist/rest/oracle.d.ts +19 -0
  81. package/dist/rest/pagination.d.ts +6 -2
  82. package/dist/rest/perpetual.d.ts +46 -0
  83. package/dist/rest/portfolio.d.ts +32 -0
  84. package/dist/rest/tokenregistry.d.ts +7 -0
  85. package/dist/rest/vault.d.ts +26 -0
  86. package/dist/utils/cosmos-dec.d.ts +1 -0
  87. package/package.json +1 -1
  88. package/dist/high-level/tx/authority.d.ts +0 -3
  89. package/dist/high-level/tx/market.d.ts +0 -3
  90. package/dist/high-level/tx/ratelimit.d.ts +0 -3
  91. package/dist/high-level/tx/tokenregistry.d.ts +0 -3
@@ -49,6 +49,11 @@ export type Eip712Field = {
49
49
  type: string;
50
50
  jsName?: string;
51
51
  protoHint?: string;
52
+ /**
53
+ * The proto field carries (gogoproto.jsontag) without omitempty, so the
54
+ * chain's legacy amino JSON always emits it, zero value included.
55
+ */
56
+ dontOmitEmpty?: boolean;
52
57
  };
53
58
  export interface Eip712TypedData<TPrimary extends string = "Tx"> {
54
59
  types: Record<string, Eip712Field[]>;
@@ -0,0 +1,3 @@
1
+ import type { LendingTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createLendingTxApi({ signerAddress, exec, getGas }: TxModuleContext): LendingTxApi;
@@ -1,3 +1,3 @@
1
1
  import type { LicenseTxApi } from "../types";
2
2
  import type { TxModuleContext } from "./context";
3
- export declare function createLicenseTxApi({ signerAddress, exec, getGas }: TxModuleContext): LicenseTxApi;
3
+ export declare function createLicenseTxApi({ signerAddress, exec }: TxModuleContext): LicenseTxApi;
@@ -0,0 +1,3 @@
1
+ import type { MarginTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createMarginTxApi({ signerAddress, exec, getGas }: TxModuleContext): MarginTxApi;
@@ -0,0 +1,3 @@
1
+ import type { PerpetualTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createPerpetualTxApi({ signerAddress, exec, getGas, }: TxModuleContext): PerpetualTxApi;
@@ -0,0 +1,3 @@
1
+ import type { VaultTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createVaultTxApi({ signerAddress, exec, getGas }: TxModuleContext): VaultTxApi;
@@ -6,12 +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
+ 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";
15
23
  import type { RateLimitApi } from "../rest/ratelimit";
16
24
  import type { RewardApi } from "../rest/reward";
17
25
  import type { StakingApi } from "../rest/staking";
@@ -19,28 +27,13 @@ import type { TokenRegistryApi } from "../rest/tokenregistry";
19
27
  import type { OrderResponse as ChainOrderResponse, TwapOrderResult } from "../proto/gen/ault/clob/v1/query";
20
28
  import type { OrderResponse as DexOrderResponse } from "../rest/dex.generated";
21
29
  import type { License } from "../proto/gen/ault/license/v1/license";
22
- import type { Params as AgentParams } from "../proto/gen/ault/agent/v1/params";
23
30
  import type { Role } from "../proto/gen/ault/authority/v1/authority";
24
- import type { Params as AccountxParams } from "../proto/gen/ault/accountx/v1/params";
25
- import type { Params as ClobParams } from "../proto/gen/ault/clob/v1/params";
26
- import type { Params as LicenseChainParams } from "../proto/gen/ault/license/v1/license";
27
- import type { Params as MarketParams } from "../proto/gen/ault/market/v1/params";
28
- import type { MarketType } from "../proto/gen/ault/market/v1/market";
29
- import type { Params as MinerChainParams } from "../proto/gen/ault/miner/v1/miner";
30
- import type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
31
31
  import type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
32
- import type { TransferLimitConfig } from "../proto/gen/ault/tokenregistry/v1/tokenregistry";
33
32
  import type { Any as ProtoAny } from "../proto/gen/google/protobuf/any";
34
33
  import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
35
34
  import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
36
35
  import type { BigIntLike } from "../core/address";
37
36
  export type { BigIntLike };
38
- export type MarketTypeInput = MarketType;
39
- export type MarketUpdateInput = {
40
- marketId: Uint8Array;
41
- makerFeeRate: string;
42
- takerFeeRate: string;
43
- };
44
37
  /** Common transaction options available on all methods */
45
38
  export interface TxOptions {
46
39
  gasLimit?: string;
@@ -200,18 +193,6 @@ export type ModifyOrdersResult = TxResult & {
200
193
  failed: string[];
201
194
  };
202
195
  export interface LicenseTxApi {
203
- mintLicense(params: {
204
- to: string;
205
- uri: string;
206
- reason?: string;
207
- } & TxOptions): Promise<TxResult>;
208
- batchMintLicense(params: {
209
- recipients: Array<{
210
- to: string;
211
- uri: string;
212
- }>;
213
- reason?: string;
214
- } & TxOptions): Promise<TxResult>;
215
196
  transferLicense(params: {
216
197
  licenseId: BigIntLike;
217
198
  to: string;
@@ -224,41 +205,6 @@ export interface LicenseTxApi {
224
205
  */
225
206
  openAccountFeeDenom?: string;
226
207
  } & TxOptions): Promise<TxResult>;
227
- burnLicense(params: {
228
- licenseId: BigIntLike;
229
- reason?: string;
230
- } & TxOptions): Promise<TxResult>;
231
- revokeLicense(params: {
232
- licenseId: BigIntLike;
233
- reason?: string;
234
- } & TxOptions): Promise<TxResult>;
235
- setTokenURI(params: {
236
- licenseId: BigIntLike;
237
- uri: string;
238
- } & TxOptions): Promise<TxResult>;
239
- approveMember(params: {
240
- member: string;
241
- } & TxOptions): Promise<TxResult>;
242
- batchApproveMember(params: {
243
- members: string[];
244
- } & TxOptions): Promise<TxResult>;
245
- revokeMember(params: {
246
- member: string;
247
- } & TxOptions): Promise<TxResult>;
248
- batchRevokeMember(params: {
249
- members: string[];
250
- } & TxOptions): Promise<TxResult>;
251
- setKYCApprovers(params: {
252
- add?: string[];
253
- remove?: string[];
254
- } & TxOptions): Promise<TxResult>;
255
- setMinters(params: {
256
- add?: string[];
257
- remove?: string[];
258
- } & TxOptions): Promise<TxResult>;
259
- updateLicenseParams(params: {
260
- params: LicenseChainParams;
261
- } & TxOptions): Promise<TxResult>;
262
208
  }
263
209
  export interface MinerTxApi {
264
210
  delegateMining(params: {
@@ -300,9 +246,6 @@ export interface MinerTxApi {
300
246
  newCommissionRate: number;
301
247
  newCommissionRecipient?: string;
302
248
  } & TxOptions): Promise<TxResult>;
303
- updateMinerParams(params: {
304
- params: MinerChainParams;
305
- } & TxOptions): Promise<TxResult>;
306
249
  }
307
250
  export interface AgentTxApi {
308
251
  approveAgent(params: {
@@ -318,9 +261,6 @@ export interface AgentTxApi {
318
261
  revokeAgent(params: {
319
262
  agentAddress: string;
320
263
  } & TxOptions): Promise<TxResult>;
321
- updateAgentParams(params: {
322
- params: AgentParams;
323
- } & TxOptions): Promise<TxResult>;
324
264
  }
325
265
  export interface AccountxTxApi {
326
266
  /**
@@ -339,41 +279,6 @@ export interface AccountxTxApi {
339
279
  feeDenom: string;
340
280
  account?: string;
341
281
  } & TxOptions): Promise<TxResult>;
342
- updateAccountxParams(params: {
343
- params: AccountxParams;
344
- } & TxOptions): Promise<TxResult>;
345
- }
346
- export interface AuthorityTxApi {
347
- grantRole(params: {
348
- role: AuthorityRoleInput;
349
- members: string[];
350
- } & TxOptions): Promise<TxResult>;
351
- revokeRole(params: {
352
- role: AuthorityRoleInput;
353
- members: string[];
354
- } & TxOptions): Promise<TxResult>;
355
- }
356
- export interface MarketTxApi {
357
- createMarket(params: {
358
- marketType: MarketTypeInput;
359
- baseDenom: string;
360
- quoteDenom: string;
361
- tickPrecision: number;
362
- } & TxOptions): Promise<TxResult>;
363
- updateMarket(params: {
364
- updates: MarketUpdateInput[];
365
- } & TxOptions): Promise<TxResult>;
366
- haltMarkets(params: {
367
- marketIds: Uint8Array[];
368
- } & TxOptions): Promise<TxResult>;
369
- resumeMarkets(params: {
370
- marketIds: Uint8Array[];
371
- } & TxOptions): Promise<TxResult>;
372
- haltAllMarkets(params?: TxOptions): Promise<TxResult>;
373
- resumeAllMarkets(params?: TxOptions): Promise<TxResult>;
374
- updateMarketParams(params: {
375
- params: MarketParams;
376
- } & TxOptions): Promise<TxResult>;
377
282
  }
378
283
  export type LimitOrderParams = {
379
284
  marketId: Uint8Array;
@@ -393,6 +298,21 @@ export type LimitOrderParams = {
393
298
  builderFeeRate?: string;
394
299
  /** Optional 8-byte client order id. Omitted from the signed payload when absent. */
395
300
  cloid?: Uint8Array;
301
+ /**
302
+ * Perpetual markets only (chain v3): the order may only reduce the existing
303
+ * position and is rejected when it would flip or grow it. Packed into the
304
+ * message's `options`; omitted entirely when not `true`, so spot orders and
305
+ * pre-v3 sign bytes are unchanged.
306
+ */
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;
396
316
  };
397
317
  /**
398
318
  * TWAP order (chain v2.1.0+). The chain splits `totalDeposit` into equal
@@ -424,6 +344,8 @@ export type MarketOrderParams = {
424
344
  builderFeeRate?: string;
425
345
  /** Optional 8-byte client order id. Omitted from the signed payload when absent. */
426
346
  cloid?: Uint8Array;
347
+ /** Spot markets only; see `LimitOrderParams.margin`. */
348
+ margin?: MarginOrderOptions;
427
349
  };
428
350
  export type ScaleOrderParams = {
429
351
  marketId: Uint8Array;
@@ -436,6 +358,8 @@ export type ScaleOrderParams = {
436
358
  postOnly?: boolean;
437
359
  builderAddress?: string;
438
360
  builderFeeRate?: string;
361
+ /** Perpetual markets only; see `LimitOrderParams.reduceOnly`. */
362
+ reduceOnly?: boolean;
439
363
  };
440
364
  /** Each entry may be an 8-byte cloid or a 16-byte chain order_id; the chain accepts both. */
441
365
  export type CancelOrdersParams = {
@@ -500,14 +424,6 @@ export interface ClobTxApi {
500
424
  wait?: false;
501
425
  } & TxOptions): Promise<TxResult>;
502
426
  placeTwapOrder(params: TwapOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceTwapOrderResult>;
503
- updateClobParams(params: {
504
- params: ClobParams;
505
- } & TxOptions): Promise<TxResult>;
506
- }
507
- export interface RateLimitTxApi {
508
- updateRateLimitParams(params: {
509
- params: RateLimitParams;
510
- } & TxOptions): Promise<TxResult>;
511
427
  }
512
428
  export interface RewardTxApi {
513
429
  setReferralCode(params: {
@@ -516,10 +432,6 @@ export interface RewardTxApi {
516
432
  setReferral(params: {
517
433
  code: string;
518
434
  } & TxOptions): Promise<TxResult>;
519
- updateEligibleReferrers(params: {
520
- add?: string[];
521
- remove?: string[];
522
- } & TxOptions): Promise<TxResult>;
523
435
  approveBuilder(params: {
524
436
  builder: string;
525
437
  maxFeeRate: string;
@@ -527,15 +439,177 @@ export interface RewardTxApi {
527
439
  revokeBuilder(params: {
528
440
  builder: string;
529
441
  } & TxOptions): Promise<TxResult>;
530
- setDeployerShare(params: {
531
- marketId: Uint8Array;
532
- recipient: string;
533
- 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;
529
+ } & TxOptions): Promise<TxResult>;
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;
534
541
  } & TxOptions): Promise<TxResult>;
535
- updateRewardParams(params: {
536
- params: RewardParams;
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;
537
546
  } & TxOptions): Promise<TxResult>;
538
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
+ }
539
613
  export interface StakingTxApi {
540
614
  delegate(params: {
541
615
  validatorAddress: string;
@@ -574,32 +648,6 @@ export interface StakingTxApi {
574
648
  validatorAddresses: string[];
575
649
  } & TxOptions): Promise<TxResult[]>;
576
650
  }
577
- export interface TokenRegistryTxApi {
578
- enableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;
579
- disableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;
580
- registerTokenPair(params: {
581
- erc20Address: string;
582
- enabled: boolean;
583
- } & TxOptions): Promise<TxResult>;
584
- enableTokenPair(params: {
585
- erc20Address: string;
586
- } & TxOptions): Promise<TxResult>;
587
- disableTokenPair(params: {
588
- erc20Address: string;
589
- } & TxOptions): Promise<TxResult>;
590
- /**
591
- * Set the transfer rate limit for a registered token pair. `registerTokenPair`
592
- * writes a zero (unlimited) config; this is the follow-up to tighten it.
593
- */
594
- setTransferLimit(params: {
595
- erc20Address: string;
596
- transferLimit: TransferLimitConfig;
597
- } & TxOptions): Promise<TxResult>;
598
- /** Remove the transfer rate limit for a registered token pair. */
599
- removeTransferLimit(params: {
600
- erc20Address: string;
601
- } & TxOptions): Promise<TxResult>;
602
- }
603
651
  export interface LicenseDelegationStatus {
604
652
  licenseId: string;
605
653
  isDelegated: boolean;
@@ -710,15 +758,79 @@ export interface AgentClobTxApi {
710
758
  placeTwapOrder(params: TwapOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceTwapOrderResult>;
711
759
  }
712
760
  /**
713
- * Agent identity + agent-signed CLOB tx surface attached to a `Client`.
714
- * `client.asAgent` is non-null only after `client.attachAgent(...)`.
761
+ * x/perpetual collateral and margin messages (chain v3). All four are fee-free
762
+ * and agent-signable. Amounts are integer strings in the collateral denom's
763
+ * base units (see `client.perpetual.getCollateralDenom()`).
715
764
  */
716
- export interface AgentSurface extends AgentClobTxApi {
765
+ export type PerpDepositParams = {
766
+ amount: string;
767
+ };
768
+ export type PerpWithdrawParams = {
769
+ amount: string;
770
+ };
771
+ export type SetMarginConfigParams = {
772
+ marketId: Uint8Array;
773
+ /** Whole-number leverage, 1..maxLeverage of the market's applicable margin tier. */
774
+ leverage: number;
775
+ /** `true` = cross margin, `false` = isolated. Locked while a position or resting order exists. */
776
+ cross: boolean;
777
+ };
778
+ export type ModifyPositionMarginParams = {
779
+ marketId: Uint8Array;
780
+ /** Signed integer string: positive moves cross collateral into the isolated position, negative returns it. */
781
+ marginDelta: string;
782
+ };
783
+ export interface PerpetualTxApi {
784
+ /** Move collateral from the bank balance into the perpetual cross account. */
785
+ depositPerpCollateral(params: PerpDepositParams & TxOptions): Promise<TxResult>;
786
+ /** Move collateral from the perpetual cross account back to the bank balance. */
787
+ withdrawPerpCollateral(params: PerpWithdrawParams & TxOptions): Promise<TxResult>;
788
+ /** Set margin mode and leverage for one market. */
789
+ setMarginConfig(params: SetMarginConfigParams & TxOptions): Promise<TxResult>;
790
+ /** Add collateral to or remove it from an isolated position. */
791
+ modifyPositionMargin(params: ModifyPositionMarginParams & TxOptions): Promise<TxResult>;
792
+ }
793
+ export interface AgentPerpetualTxApi {
794
+ depositPerpCollateral(params: PerpDepositParams & AgentTxOptions): Promise<TxResult>;
795
+ withdrawPerpCollateral(params: PerpWithdrawParams & AgentTxOptions): Promise<TxResult>;
796
+ setMarginConfig(params: SetMarginConfigParams & AgentTxOptions): Promise<TxResult>;
797
+ modifyPositionMargin(params: ModifyPositionMarginParams & AgentTxOptions): Promise<TxResult>;
798
+ }
799
+ /**
800
+ * Agent identity + agent-signed CLOB and perpetual tx surface attached to a
801
+ * `Client`. `client.asAgent` is non-null only after `client.attachAgent(...)`.
802
+ */
803
+ export interface AgentSurface extends AgentClobTxApi, AgentPerpetualTxApi, AgentVaultTxApi {
717
804
  /** Agent address (bech32). */
718
805
  readonly address: string;
719
806
  /** Master address — same as `client.address`. */
720
807
  readonly masterAddress: string;
721
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
+ }
722
834
  export interface AttachAgentOptions {
723
835
  /** Hex-encoded agent private key (with or without `0x`). */
724
836
  agentPrivateKey: string;
@@ -735,7 +847,7 @@ export interface AttachAgentOptions {
735
847
  * High-level client interface for the Ault SDK.
736
848
  * Provides simplified methods for common operations.
737
849
  */
738
- export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi, CloidLookupApi {
850
+ export interface Client extends AccountxTxApi, AgentTxApi, ClobTxApi, LendingTxApi, LicenseTxApi, MarginTxApi, MinerTxApi, PerpetualTxApi, RewardTxApi, StakingTxApi, VaultTxApi, ParallelQueryApi, CloidLookupApi {
739
851
  /** Network configuration */
740
852
  readonly network: NetworkConfig;
741
853
  /** Signer address in Ault bech32 format */
@@ -764,6 +876,16 @@ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobT
764
876
  readonly staking: StakingApi;
765
877
  /** Token registry module queries */
766
878
  readonly tokenregistry: TokenRegistryApi;
879
+ /** Perpetual module queries (chain v3): collateral, positions, account risk, funding. */
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;
767
889
  /**
768
890
  * Agent-signed tx surface. Null until `attachAgent` is called; cleared by
769
891
  * `detachAgent`. The reference changes on attach/detach — consumers
@@ -779,6 +901,12 @@ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobT
779
901
  attachAgent(options: AttachAgentOptions): AgentSurface;
780
902
  /** Detach the current agent identity. `client.asAgent` becomes null. No-op if no agent attached. */
781
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;
782
910
  /** Access to the underlying low-level client for advanced use cases. */
783
911
  readonly _lowLevel: AultClient;
784
912
  /** Access to the underlying manifest resolver. Stable, advanced use only. */