ault-sdk-ts 0.8.0 → 0.9.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 +104 -1
- package/dist/agent/sign-and-broadcast.d.ts +1 -1
- package/dist/agent/tx/perpetual.d.ts +10 -0
- package/dist/client.d.ts +2 -0
- package/dist/core/clob-msgs.d.ts +12 -3
- package/dist/core/manifest-types.d.ts +8 -0
- package/dist/core/network.d.ts +11 -7
- package/dist/core/perpetual-gas.d.ts +12 -0
- package/dist/core/perpetual-msgs.d.ts +60 -0
- package/dist/eip712/msg-encoders.generated.d.ts +8 -0
- package/dist/eip712/msg.generated.d.ts +76 -6
- package/dist/eip712/registry.d.ts +11 -0
- package/dist/eip712/types.d.ts +5 -0
- package/dist/high-level/tx/perpetual.d.ts +3 -0
- package/dist/high-level/types.d.ts +83 -4
- package/dist/index.cjs +25837 -10411
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25760 -10598
- package/dist/index.js.map +1 -1
- package/dist/perp/decimal.d.ts +39 -0
- package/dist/perp/funding.d.ts +18 -0
- package/dist/perp/index.d.ts +5 -0
- package/dist/perp/margin.d.ts +33 -0
- package/dist/perp/orders.d.ts +27 -0
- package/dist/perp/position.d.ts +29 -0
- package/dist/proto/gen/ault/accountx/v1/query.d.ts +10 -1
- package/dist/proto/gen/ault/authority/v1/authority.d.ts +2 -0
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +7 -0
- package/dist/proto/gen/ault/clob/v1/twap.d.ts +11 -8
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +11 -1
- package/dist/proto/gen/ault/common/v1/system.d.ts +31 -0
- package/dist/proto/gen/ault/lending/v1/genesis.d.ts +34 -0
- package/dist/proto/gen/ault/lending/v1/lending.d.ts +152 -0
- package/dist/proto/gen/ault/lending/v1/params.d.ts +42 -0
- package/dist/proto/gen/ault/lending/v1/query.d.ts +157 -0
- package/dist/proto/gen/ault/lending/v1/tx.d.ts +236 -0
- package/dist/proto/gen/ault/margin/v1/genesis.d.ts +102 -0
- package/dist/proto/gen/ault/margin/v1/margin.d.ts +130 -0
- package/dist/proto/gen/ault/margin/v1/params.d.ts +31 -0
- package/dist/proto/gen/ault/margin/v1/query.d.ts +127 -0
- package/dist/proto/gen/ault/margin/v1/tx.d.ts +181 -0
- package/dist/proto/gen/ault/market/v1/market.d.ts +9 -0
- package/dist/proto/gen/ault/market/v1/tx.d.ts +16 -0
- package/dist/proto/gen/ault/oracle/v1/genesis.d.ts +69 -0
- package/dist/proto/gen/ault/oracle/v1/oracle.d.ts +154 -0
- package/dist/proto/gen/ault/oracle/v1/query.d.ts +93 -0
- package/dist/proto/gen/ault/oracle/v1/tx.d.ts +151 -0
- package/dist/proto/gen/ault/perpetual/v1/genesis.d.ts +119 -0
- package/dist/proto/gen/ault/perpetual/v1/order.d.ts +46 -0
- package/dist/proto/gen/ault/perpetual/v1/params.d.ts +30 -0
- package/dist/proto/gen/ault/perpetual/v1/perpetual.d.ts +192 -0
- package/dist/proto/gen/ault/perpetual/v1/query.d.ts +150 -0
- package/dist/proto/gen/ault/perpetual/v1/tx.d.ts +97 -0
- package/dist/proto/gen/ault/systemtx/v1/genesis.d.ts +37 -0
- package/dist/proto/gen/ault/vault/v1/genesis.d.ts +90 -0
- package/dist/proto/gen/ault/vault/v1/params.d.ts +55 -0
- package/dist/proto/gen/ault/vault/v1/query.d.ts +152 -0
- package/dist/proto/gen/ault/vault/v1/tx.d.ts +194 -0
- package/dist/proto/gen/ault/vault/v1/vault.d.ts +227 -0
- package/dist/rest/dex-types.generated.d.ts +2045 -27
- package/dist/rest/dex.d.ts +18 -1
- package/dist/rest/dex.generated.d.ts +5097 -1276
- package/dist/rest/perpetual.d.ts +46 -0
- package/dist/rest/tokenregistry.d.ts +7 -0
- package/dist/utils/cosmos-dec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ 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";
|
|
15
16
|
import type { RateLimitApi } from "../rest/ratelimit";
|
|
16
17
|
import type { RewardApi } from "../rest/reward";
|
|
17
18
|
import type { StakingApi } from "../rest/staking";
|
|
@@ -26,6 +27,7 @@ import type { Params as ClobParams } from "../proto/gen/ault/clob/v1/params";
|
|
|
26
27
|
import type { Params as LicenseChainParams } from "../proto/gen/ault/license/v1/license";
|
|
27
28
|
import type { Params as MarketParams } from "../proto/gen/ault/market/v1/params";
|
|
28
29
|
import type { MarketType } from "../proto/gen/ault/market/v1/market";
|
|
30
|
+
import type { PerpetualMarketConfig } from "../proto/gen/ault/perpetual/v1/perpetual";
|
|
29
31
|
import type { Params as MinerChainParams } from "../proto/gen/ault/miner/v1/miner";
|
|
30
32
|
import type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
|
|
31
33
|
import type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
|
|
@@ -354,12 +356,39 @@ export interface AuthorityTxApi {
|
|
|
354
356
|
} & TxOptions): Promise<TxResult>;
|
|
355
357
|
}
|
|
356
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
|
+
*/
|
|
357
366
|
createMarket(params: {
|
|
358
367
|
marketType: MarketTypeInput;
|
|
359
368
|
baseDenom: string;
|
|
360
369
|
quoteDenom: string;
|
|
361
370
|
tickPrecision: number;
|
|
362
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>;
|
|
363
392
|
updateMarket(params: {
|
|
364
393
|
updates: MarketUpdateInput[];
|
|
365
394
|
} & TxOptions): Promise<TxResult>;
|
|
@@ -393,6 +422,13 @@ export type LimitOrderParams = {
|
|
|
393
422
|
builderFeeRate?: string;
|
|
394
423
|
/** Optional 8-byte client order id. Omitted from the signed payload when absent. */
|
|
395
424
|
cloid?: Uint8Array;
|
|
425
|
+
/**
|
|
426
|
+
* Perpetual markets only (chain v3): the order may only reduce the existing
|
|
427
|
+
* position and is rejected when it would flip or grow it. Packed into the
|
|
428
|
+
* message's `options`; omitted entirely when not `true`, so spot orders and
|
|
429
|
+
* pre-v3 sign bytes are unchanged.
|
|
430
|
+
*/
|
|
431
|
+
reduceOnly?: boolean;
|
|
396
432
|
};
|
|
397
433
|
/**
|
|
398
434
|
* TWAP order (chain v2.1.0+). The chain splits `totalDeposit` into equal
|
|
@@ -436,6 +472,8 @@ export type ScaleOrderParams = {
|
|
|
436
472
|
postOnly?: boolean;
|
|
437
473
|
builderAddress?: string;
|
|
438
474
|
builderFeeRate?: string;
|
|
475
|
+
/** Perpetual markets only; see `LimitOrderParams.reduceOnly`. */
|
|
476
|
+
reduceOnly?: boolean;
|
|
439
477
|
};
|
|
440
478
|
/** Each entry may be an 8-byte cloid or a 16-byte chain order_id; the chain accepts both. */
|
|
441
479
|
export type CancelOrdersParams = {
|
|
@@ -710,10 +748,49 @@ export interface AgentClobTxApi {
|
|
|
710
748
|
placeTwapOrder(params: TwapOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceTwapOrderResult>;
|
|
711
749
|
}
|
|
712
750
|
/**
|
|
713
|
-
*
|
|
714
|
-
*
|
|
751
|
+
* x/perpetual collateral and margin messages (chain v3). All four are fee-free
|
|
752
|
+
* and agent-signable. Amounts are integer strings in the collateral denom's
|
|
753
|
+
* base units (see `client.perpetual.getCollateralDenom()`).
|
|
754
|
+
*/
|
|
755
|
+
export type PerpDepositParams = {
|
|
756
|
+
amount: string;
|
|
757
|
+
};
|
|
758
|
+
export type PerpWithdrawParams = {
|
|
759
|
+
amount: string;
|
|
760
|
+
};
|
|
761
|
+
export type SetMarginConfigParams = {
|
|
762
|
+
marketId: Uint8Array;
|
|
763
|
+
/** Whole-number leverage, 1..maxLeverage of the market's applicable margin tier. */
|
|
764
|
+
leverage: number;
|
|
765
|
+
/** `true` = cross margin, `false` = isolated. Locked while a position or resting order exists. */
|
|
766
|
+
cross: boolean;
|
|
767
|
+
};
|
|
768
|
+
export type ModifyPositionMarginParams = {
|
|
769
|
+
marketId: Uint8Array;
|
|
770
|
+
/** Signed integer string: positive moves cross collateral into the isolated position, negative returns it. */
|
|
771
|
+
marginDelta: string;
|
|
772
|
+
};
|
|
773
|
+
export interface PerpetualTxApi {
|
|
774
|
+
/** Move collateral from the bank balance into the perpetual cross account. */
|
|
775
|
+
depositPerpCollateral(params: PerpDepositParams & TxOptions): Promise<TxResult>;
|
|
776
|
+
/** Move collateral from the perpetual cross account back to the bank balance. */
|
|
777
|
+
withdrawPerpCollateral(params: PerpWithdrawParams & TxOptions): Promise<TxResult>;
|
|
778
|
+
/** Set margin mode and leverage for one market. */
|
|
779
|
+
setMarginConfig(params: SetMarginConfigParams & TxOptions): Promise<TxResult>;
|
|
780
|
+
/** Add collateral to or remove it from an isolated position. */
|
|
781
|
+
modifyPositionMargin(params: ModifyPositionMarginParams & TxOptions): Promise<TxResult>;
|
|
782
|
+
}
|
|
783
|
+
export interface AgentPerpetualTxApi {
|
|
784
|
+
depositPerpCollateral(params: PerpDepositParams & AgentTxOptions): Promise<TxResult>;
|
|
785
|
+
withdrawPerpCollateral(params: PerpWithdrawParams & AgentTxOptions): Promise<TxResult>;
|
|
786
|
+
setMarginConfig(params: SetMarginConfigParams & AgentTxOptions): Promise<TxResult>;
|
|
787
|
+
modifyPositionMargin(params: ModifyPositionMarginParams & AgentTxOptions): Promise<TxResult>;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Agent identity + agent-signed CLOB and perpetual tx surface attached to a
|
|
791
|
+
* `Client`. `client.asAgent` is non-null only after `client.attachAgent(...)`.
|
|
715
792
|
*/
|
|
716
|
-
export interface AgentSurface extends AgentClobTxApi {
|
|
793
|
+
export interface AgentSurface extends AgentClobTxApi, AgentPerpetualTxApi {
|
|
717
794
|
/** Agent address (bech32). */
|
|
718
795
|
readonly address: string;
|
|
719
796
|
/** Master address — same as `client.address`. */
|
|
@@ -735,7 +812,7 @@ export interface AttachAgentOptions {
|
|
|
735
812
|
* High-level client interface for the Ault SDK.
|
|
736
813
|
* Provides simplified methods for common operations.
|
|
737
814
|
*/
|
|
738
|
-
export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi, CloidLookupApi {
|
|
815
|
+
export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, PerpetualTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi, CloidLookupApi {
|
|
739
816
|
/** Network configuration */
|
|
740
817
|
readonly network: NetworkConfig;
|
|
741
818
|
/** Signer address in Ault bech32 format */
|
|
@@ -764,6 +841,8 @@ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobT
|
|
|
764
841
|
readonly staking: StakingApi;
|
|
765
842
|
/** Token registry module queries */
|
|
766
843
|
readonly tokenregistry: TokenRegistryApi;
|
|
844
|
+
/** Perpetual module queries (chain v3): collateral, positions, account risk, funding. */
|
|
845
|
+
readonly perpetual: PerpetualApi;
|
|
767
846
|
/**
|
|
768
847
|
* Agent-signed tx surface. Null until `attachAgent` is called; cleared by
|
|
769
848
|
* `detachAgent`. The reference changes on attach/detach — consumers
|