ault-sdk-ts 0.11.0 → 0.12.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 -23
- package/dist/client.d.ts +2 -0
- package/dist/core/address.d.ts +1 -1
- package/dist/core/clob-gas.d.ts +4 -0
- package/dist/core/clob-msgs.d.ts +14 -6
- package/dist/core/clob-responses.d.ts +4 -1
- package/dist/core/conditional-msgs.d.ts +98 -0
- package/dist/core/manifest-types.d.ts +22 -2
- package/dist/core/margin-account.d.ts +8 -0
- package/dist/core/network.d.ts +21 -11
- package/dist/core/perpetual-msgs.d.ts +8 -0
- package/dist/core/vault-gas.d.ts +3 -1
- package/dist/core/vault-msgs.d.ts +46 -28
- package/dist/eip712/msg.generated.d.ts +19 -8
- package/dist/eip712/types.d.ts +5 -0
- package/dist/high-level/types.d.ts +172 -32
- package/dist/high-level-client.d.ts +1 -1
- package/dist/index.cjs +22007 -18578
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21855 -18453
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/authority/v1/tx.d.ts +12 -0
- package/dist/proto/gen/ault/clob/v1/conditional.d.ts +60 -0
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +13 -0
- package/dist/proto/gen/ault/clob/v1/group.d.ts +71 -0
- package/dist/proto/gen/ault/clob/v1/params.d.ts +5 -0
- package/dist/proto/gen/ault/clob/v1/query.d.ts +16 -0
- package/dist/proto/gen/ault/clob/v1/twap.d.ts +8 -4
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +90 -1
- package/dist/proto/gen/ault/lending/v1/params.d.ts +2 -0
- package/dist/proto/gen/ault/lending/v1/tx.d.ts +1 -0
- package/dist/proto/gen/ault/margin/v1/genesis.d.ts +10 -48
- package/dist/proto/gen/ault/margin/v1/margin.d.ts +14 -64
- package/dist/proto/gen/ault/margin/v1/query.d.ts +4 -46
- package/dist/proto/gen/ault/margin/v1/tx.d.ts +11 -29
- package/dist/proto/gen/ault/miner/v1/miner.d.ts +4 -2
- package/dist/proto/gen/ault/oracle/v1/oracle.d.ts +5 -7
- package/dist/proto/gen/ault/oracle/v1/tx.d.ts +1 -1
- package/dist/proto/gen/ault/perpetual/v1/params.d.ts +6 -0
- package/dist/proto/gen/ault/perpetual/v1/perpetual.d.ts +10 -7
- package/dist/proto/gen/ault/spot/v1/genesis.d.ts +2 -0
- package/dist/proto/gen/ault/spot/v1/params.d.ts +25 -0
- package/dist/proto/gen/ault/spot/v1/query.d.ts +29 -0
- package/dist/proto/gen/ault/spot/v1/tx.d.ts +30 -0
- package/dist/proto/gen/ault/vault/v1/genesis.d.ts +22 -12
- package/dist/proto/gen/ault/vault/v1/query.d.ts +4 -18
- package/dist/proto/gen/ault/vault/v1/tx.d.ts +25 -5
- package/dist/proto/gen/ault/vault/v1/vault.d.ts +29 -57
- package/dist/rest/clob.d.ts +35 -3
- package/dist/rest/dex-types.generated.d.ts +548 -81
- package/dist/rest/dex.d.ts +3 -1
- package/dist/rest/dex.generated.d.ts +670 -123
- package/dist/rest/margin.d.ts +1 -5
- package/dist/rest/spot.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
|
|
2
|
-
import { type LockupPolicy } from "../proto/gen/ault/vault/v1/vault";
|
|
3
2
|
export type VaultStatusInput = "active" | "paused" | "closed";
|
|
4
|
-
export type VaultFeeInput = {
|
|
5
|
-
type: "none" | "managementDilution" | "performanceExit";
|
|
6
|
-
/** Fee rate in basis points (100 = 1%). */
|
|
7
|
-
rateBps: number;
|
|
8
|
-
};
|
|
9
3
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* Deposits are accepted from `depositOpenTime` until `depositCloseTime` and
|
|
5
|
+
* redemptions from `redemptionOpenTime` on. A vault created without one takes
|
|
6
|
+
* deposits and redemptions at any time.
|
|
12
7
|
*/
|
|
13
|
-
export
|
|
14
|
-
type: "unrestricted";
|
|
15
|
-
} | {
|
|
16
|
-
type: "fundWindow";
|
|
8
|
+
export interface VaultFundWindowInput {
|
|
17
9
|
depositOpenTime: Date;
|
|
18
10
|
depositCloseTime: Date;
|
|
19
11
|
redemptionOpenTime: Date;
|
|
20
|
-
}
|
|
12
|
+
}
|
|
21
13
|
export interface LendingVaultConfigInput {
|
|
22
14
|
/** Pools the vault may supply to, with the most it may supply to each (base units). */
|
|
23
15
|
pools: Array<{
|
|
@@ -29,8 +21,13 @@ export interface LendingVaultConfigInput {
|
|
|
29
21
|
/** Order in which pools are drawn down to pay redemptions. */
|
|
30
22
|
withdrawalQueue: Array<bigint | number | string>;
|
|
31
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* `spot` and `perpetual` let the manager trade those markets; `backstop` lets
|
|
26
|
+
* a protocol child vault take over perpetual accounts liquidation cannot close.
|
|
27
|
+
*/
|
|
28
|
+
export type TradingActionInput = "spot" | "perpetual" | "backstop";
|
|
32
29
|
export interface TradingVaultConfigInput {
|
|
33
|
-
allowedActions:
|
|
30
|
+
allowedActions: TradingActionInput[];
|
|
34
31
|
spotMarketIds: Uint8Array[];
|
|
35
32
|
lendingPoolIds?: Array<bigint | number | string>;
|
|
36
33
|
/** Share of each fill the manager keeps, in basis points. */
|
|
@@ -47,6 +44,14 @@ export type VaultConfigInput = {
|
|
|
47
44
|
export declare const GOV_MODULE_ADDRESS = "ault10d07y265gmmuvt4z0w9aw880jnsr700jtfne29";
|
|
48
45
|
/** Whether `address` (bech32 or 0x) is a vault account. */
|
|
49
46
|
export declare function isVaultAddress(address: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The type and relationship a vault address encodes, or undefined when the
|
|
49
|
+
* address is not a vault account.
|
|
50
|
+
*/
|
|
51
|
+
export declare function vaultAddressKind(address: string): {
|
|
52
|
+
vaultType: "lending" | "trading";
|
|
53
|
+
relationship: "normal" | "parent" | "child";
|
|
54
|
+
} | undefined;
|
|
50
55
|
/**
|
|
51
56
|
* Deposits `amount` of the vault's denom and mints shares to the sender.
|
|
52
57
|
* Normal and parent vaults take deposits; a child vault does not.
|
|
@@ -70,37 +75,41 @@ export declare function buildVaultRedeemMsg(sender: string, params: {
|
|
|
70
75
|
*
|
|
71
76
|
* - A normal vault is owned and, at first, managed by the account that sends
|
|
72
77
|
* it (`manager` defaults to it and may not differ; hand it over later with
|
|
73
|
-
* `updateVaultManager`). A normal trading vault needs
|
|
74
|
-
* its denom
|
|
78
|
+
* `updateVaultManager`). A normal trading vault needs a positive
|
|
79
|
+
* `initialDeposit` in its trading denom (the chain's perpetual collateral
|
|
80
|
+
* denom, at least the module's `minInitialDeposit`), which makes the owner
|
|
81
|
+
* its first depositor.
|
|
75
82
|
* - A parent vault is owned by x/gov (`GOV_MODULE_ADDRESS`), so it can only be
|
|
76
83
|
* created by a governance proposal; `manager` names who runs it.
|
|
77
84
|
* - A child vault is created by its parent vault's account (`owner` is the
|
|
78
85
|
* parent vault, through `attachVaultManager`), with no `manager` and no
|
|
79
|
-
* `
|
|
86
|
+
* `fundWindow`.
|
|
80
87
|
*
|
|
81
|
-
* Lending vaults are always normal
|
|
82
|
-
* `initialDeposit
|
|
83
|
-
* (see `eip712Unsupported` on the registry entry).
|
|
88
|
+
* Lending vaults are always normal, take their denom in `vaultDenom` and no
|
|
89
|
+
* `initialDeposit`; trading vaults use the perpetual collateral denom.
|
|
84
90
|
*/
|
|
85
91
|
export declare function buildCreateVaultMsg(owner: string, params: {
|
|
86
|
-
vaultDenom: string;
|
|
87
92
|
config: VaultConfigInput;
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
/** Lending vaults only: the denom depositors supply. */
|
|
94
|
+
vaultDenom?: string;
|
|
95
|
+
/** Lending vaults only: management fee in basis points. */
|
|
96
|
+
managementFeeBps?: number;
|
|
97
|
+
/** Trading vaults only: performance fee in basis points (normal vaults). */
|
|
98
|
+
performanceFeeBps?: number;
|
|
99
|
+
/** Trading vaults only: exit fee in basis points. */
|
|
100
|
+
exitFeeBps?: number;
|
|
101
|
+
fundWindow?: VaultFundWindowInput;
|
|
90
102
|
initialDeposit?: Coin;
|
|
91
103
|
manager?: string;
|
|
92
|
-
exitFeeBps?: number;
|
|
93
104
|
/** `parent` or `child` for protocol vault trees; default `normal`. */
|
|
94
105
|
relationship?: "normal" | "parent" | "child";
|
|
95
|
-
}): import("../index.js").Eip712Msg<Omit<import("../proto/gen/ault/vault/v1/tx").MsgCreateVault, "lending" | "trading" | "
|
|
96
|
-
lockup: Omit<LockupPolicy, "unrestricted" | "fundWindow"> & Partial<Pick<LockupPolicy, "unrestricted" | "fundWindow">>;
|
|
97
|
-
}, "/ault.vault.v1.MsgCreateVault">;
|
|
106
|
+
}): import("../index.js").Eip712Msg<Omit<import("../proto/gen/ault/vault/v1/tx").MsgCreateVault, "fundWindow" | "lending" | "trading" | "lendingTerms" | "tradingTerms"> & Partial<Pick<import("../proto/gen/ault/vault/v1/tx").MsgCreateVault, "fundWindow" | "lending" | "trading" | "lendingTerms" | "tradingTerms">>, "/ault.vault.v1.MsgCreateVault">;
|
|
98
107
|
/**
|
|
99
108
|
* Schedules a new configuration of the vault's own type (a lending config for
|
|
100
109
|
* a lending vault, a trading config for a trading vault). It applies after
|
|
101
110
|
* the chain's config delay; `buildCancelVaultConfigUpdateMsg` drops it before
|
|
102
111
|
* then. Sent by the vault's owner: the user for a normal vault, the parent
|
|
103
|
-
* vault's account for a child.
|
|
112
|
+
* vault's account for a child.
|
|
104
113
|
*/
|
|
105
114
|
export declare function buildUpdateVaultConfigMsg(owner: string, params: {
|
|
106
115
|
vaultAddress: string;
|
|
@@ -138,6 +147,15 @@ export declare function buildVaultTransferMsg(parentVault: string, params: {
|
|
|
138
147
|
amount: Coin;
|
|
139
148
|
isDeposit: boolean;
|
|
140
149
|
}): import("../index.js").Eip712Msg<import("../proto/gen/ault/vault/v1/tx").MsgVaultTransfer, "/ault.vault.v1.MsgVaultTransfer">;
|
|
150
|
+
/**
|
|
151
|
+
* Hands a perpetual account that liquidation cannot close to a child vault
|
|
152
|
+
* holding the backstop action. Sent from the governing parent vault's account
|
|
153
|
+
* (chain v3.0.0-rc.3), signed by its manager through the agent path.
|
|
154
|
+
*/
|
|
155
|
+
export declare function buildBackstopTransferMsg(parentVault: string, params: {
|
|
156
|
+
sourceAccount: string;
|
|
157
|
+
childVault: string;
|
|
158
|
+
}): import("../index.js").Eip712Msg<import("../proto/gen/ault/vault/v1/tx").MsgBackstopTransfer, "/ault.vault.v1.MsgBackstopTransfer">;
|
|
141
159
|
/**
|
|
142
160
|
* Moves a normal Lending vault's supply from one configured pool to another.
|
|
143
161
|
* Sent from the vault's own account, signed by its manager through the agent
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import type { Eip712Msg } from "./builder";
|
|
2
2
|
import type { MsgOpenAccount } from "../proto/gen/ault/accountx/v1/tx";
|
|
3
3
|
import type { MsgApproveAgent, MsgRevokeAgent } from "../proto/gen/ault/agent/v1/tx";
|
|
4
|
-
import type { ModifyOrder, MsgCancelOrders, MsgModifyOrders, MsgPlaceLimitOrder, MsgPlaceMarketOrder, MsgPlaceScaleOrder, MsgPlaceTwapOrder } from "../proto/gen/ault/clob/v1/tx";
|
|
4
|
+
import type { ModifyConditionalOrder, ModifyOrder, MsgCancelOrders, MsgModifyConditionalOrders, MsgModifyOrders, MsgPlaceConditionalOrder, MsgPlaceGroupOrder, MsgPlaceLimitOrder, MsgPlaceMarketOrder, MsgPlaceScaleOrder, MsgPlaceTwapOrder, OrderLeg } from "../proto/gen/ault/clob/v1/tx";
|
|
5
5
|
import type { MsgBorrow, MsgFundInsuranceFund, MsgLiquidate as MsgLiquidateAultLendingV1, MsgRepay, MsgSupply, MsgSupplyCollateral, MsgWithdraw as MsgWithdrawAultLendingV1, MsgWithdrawCollateral } from "../proto/gen/ault/lending/v1/tx";
|
|
6
6
|
import type { MsgTransferLicense } from "../proto/gen/ault/license/v1/tx";
|
|
7
7
|
import type { MsgBorrowMargin, MsgDepositMargin, MsgRepayMargin, MsgWithdrawMargin } from "../proto/gen/ault/margin/v1/tx";
|
|
8
8
|
import type { MsgBatchSubmitWork, MsgCancelMiningDelegation, MsgDelegateMining, MsgRedelegateMining, MsgRegisterOperator, MsgSetOwnerVrfKey, MsgSubmitWork, MsgUnregisterOperator, MsgUpdateOperatorInfo, WorkSubmission } from "../proto/gen/ault/miner/v1/tx";
|
|
9
9
|
import type { MsgDeposit as MsgDepositAultPerpetualV1, MsgLiquidate as MsgLiquidateAultPerpetualV1, MsgModifyPositionMargin, MsgSetMarginConfig, MsgWithdraw as MsgWithdrawAultPerpetualV1 } from "../proto/gen/ault/perpetual/v1/tx";
|
|
10
10
|
import type { MsgApproveBuilder, MsgRevokeBuilder, MsgSetReferral, MsgSetReferralCode } from "../proto/gen/ault/reward/v1/tx";
|
|
11
|
-
import type { MsgCancelVaultConfigUpdate, MsgCreateVault, MsgDeposit as MsgDepositAultVaultV1, MsgReallocate, MsgRedeem, MsgSetVaultStatus, MsgUpdateVaultConfig, MsgUpdateVaultManager, MsgVaultTransfer } from "../proto/gen/ault/vault/v1/tx";
|
|
12
|
-
import type { LockupPolicy } from "../proto/gen/ault/vault/v1/vault";
|
|
11
|
+
import type { MsgBackstopTransfer, MsgCancelVaultConfigUpdate, MsgCreateVault, MsgDeposit as MsgDepositAultVaultV1, MsgReallocate, MsgRedeem, MsgSetVaultStatus, MsgUpdateVaultConfig, MsgUpdateVaultManager, MsgVaultTransfer } from "../proto/gen/ault/vault/v1/tx";
|
|
13
12
|
import type { MsgWithdrawDelegatorReward } from "../proto/gen/cosmos/distribution/v1beta1/tx";
|
|
14
13
|
import type { MsgBeginRedelegate, MsgDelegate, MsgUndelegate } from "../proto/gen/cosmos/staking/v1beta1/tx";
|
|
15
|
-
type
|
|
14
|
+
type ModifyConditionalOrderInput = Omit<ModifyConditionalOrder, "limit" | "market"> & Partial<Pick<ModifyConditionalOrder, "limit" | "market">>;
|
|
16
15
|
type ModifyOrderInput = Omit<ModifyOrder, "newPrice" | "newQuantity"> & Partial<Pick<ModifyOrder, "newPrice" | "newQuantity">>;
|
|
16
|
+
type OrderLegInput = Omit<OrderLeg, "conditional" | "existingOrderId" | "limit" | "market"> & Partial<Pick<OrderLeg, "conditional" | "existingOrderId" | "limit" | "market">>;
|
|
17
17
|
type WorkSubmissionInput = Omit<WorkSubmission, "nonce"> & Partial<Pick<WorkSubmission, "nonce">>;
|
|
18
18
|
type MsgApproveAgentInput = Omit<MsgApproveAgent, "expiresAt" | "name"> & Partial<Pick<MsgApproveAgent, "expiresAt" | "name">>;
|
|
19
19
|
type MsgBatchSubmitWorkInput = Omit<MsgBatchSubmitWork, "submissions"> & {
|
|
20
20
|
submissions: WorkSubmissionInput[];
|
|
21
21
|
};
|
|
22
|
-
type MsgCreateVaultInput = Omit<MsgCreateVault, "lending" | "trading" | "
|
|
23
|
-
|
|
22
|
+
type MsgCreateVaultInput = Omit<MsgCreateVault, "fundWindow" | "lending" | "lendingTerms" | "trading" | "tradingTerms"> & Partial<Pick<MsgCreateVault, "fundWindow" | "lending" | "lendingTerms" | "trading" | "tradingTerms">>;
|
|
23
|
+
type MsgModifyConditionalOrdersInput = Omit<MsgModifyConditionalOrders, "orders"> & {
|
|
24
|
+
orders: ModifyConditionalOrderInput[];
|
|
24
25
|
};
|
|
25
26
|
type MsgModifyOrdersInput = Omit<MsgModifyOrders, "orders"> & {
|
|
26
27
|
orders: ModifyOrderInput[];
|
|
27
28
|
};
|
|
29
|
+
type MsgPlaceConditionalOrderInput = Omit<MsgPlaceConditionalOrder, "cloid" | "limit" | "market"> & Partial<Pick<MsgPlaceConditionalOrder, "cloid" | "limit" | "market">>;
|
|
30
|
+
type MsgPlaceGroupOrderInput = Omit<MsgPlaceGroupOrder, "tertiary" | "primary" | "secondary"> & Partial<Pick<MsgPlaceGroupOrder, "tertiary">> & {
|
|
31
|
+
primary: OrderLegInput;
|
|
32
|
+
} & {
|
|
33
|
+
secondary: OrderLegInput;
|
|
34
|
+
};
|
|
28
35
|
type MsgPlaceLimitOrderInput = Omit<MsgPlaceLimitOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "postOnly" | "timeInForce"> & Partial<Pick<MsgPlaceLimitOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "postOnly" | "timeInForce">>;
|
|
29
36
|
type MsgPlaceMarketOrderInput = Omit<MsgPlaceMarketOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "priceTolerance" | "worstPrice"> & Partial<Pick<MsgPlaceMarketOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "priceTolerance" | "worstPrice">>;
|
|
30
37
|
type MsgPlaceScaleOrderInput = Omit<MsgPlaceScaleOrder, "builderAddress" | "builderFeeRate" | "options" | "postOnly"> & Partial<Pick<MsgPlaceScaleOrder, "builderAddress" | "builderFeeRate" | "options" | "postOnly">>;
|
|
31
|
-
type MsgPlaceTwapOrderInput = Omit<MsgPlaceTwapOrder, "builderAddress" | "builderFeeRate" | "cloid" | "priceTolerance" | "worstPrice"> & Partial<Pick<MsgPlaceTwapOrder, "builderAddress" | "builderFeeRate" | "cloid" | "priceTolerance" | "worstPrice">>;
|
|
38
|
+
type MsgPlaceTwapOrderInput = Omit<MsgPlaceTwapOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "priceTolerance" | "worstPrice"> & Partial<Pick<MsgPlaceTwapOrder, "builderAddress" | "builderFeeRate" | "cloid" | "options" | "priceTolerance" | "worstPrice">>;
|
|
32
39
|
type MsgRegisterOperatorInput = Omit<MsgRegisterOperator, "commissionRecipient"> & Partial<Pick<MsgRegisterOperator, "commissionRecipient">>;
|
|
33
40
|
type MsgSubmitWorkInput = Omit<MsgSubmitWork, "nonce"> & Partial<Pick<MsgSubmitWork, "nonce">>;
|
|
34
41
|
type MsgTransferLicenseInput = Omit<MsgTransferLicense, "openAccountFeeDenom"> & Partial<Pick<MsgTransferLicense, "openAccountFeeDenom">>;
|
|
@@ -44,7 +51,10 @@ export declare const msg: {
|
|
|
44
51
|
};
|
|
45
52
|
readonly clob: {
|
|
46
53
|
readonly cancelOrders: (value: MsgCancelOrders) => Eip712Msg<MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders">;
|
|
54
|
+
readonly modifyConditionalOrders: (value: MsgModifyConditionalOrdersInput) => Eip712Msg<MsgModifyConditionalOrdersInput, "/ault.clob.v1.MsgModifyConditionalOrders">;
|
|
47
55
|
readonly modifyOrders: (value: MsgModifyOrdersInput) => Eip712Msg<MsgModifyOrdersInput, "/ault.clob.v1.MsgModifyOrders">;
|
|
56
|
+
readonly placeConditionalOrder: (value: MsgPlaceConditionalOrderInput) => Eip712Msg<MsgPlaceConditionalOrderInput, "/ault.clob.v1.MsgPlaceConditionalOrder">;
|
|
57
|
+
readonly placeGroupOrder: (value: MsgPlaceGroupOrderInput) => Eip712Msg<MsgPlaceGroupOrderInput, "/ault.clob.v1.MsgPlaceGroupOrder">;
|
|
48
58
|
readonly placeLimitOrder: (value: MsgPlaceLimitOrderInput) => Eip712Msg<MsgPlaceLimitOrderInput, "/ault.clob.v1.MsgPlaceLimitOrder">;
|
|
49
59
|
readonly placeMarketOrder: (value: MsgPlaceMarketOrderInput) => Eip712Msg<MsgPlaceMarketOrderInput, "/ault.clob.v1.MsgPlaceMarketOrder">;
|
|
50
60
|
readonly placeScaleOrder: (value: MsgPlaceScaleOrderInput) => Eip712Msg<MsgPlaceScaleOrderInput, "/ault.clob.v1.MsgPlaceScaleOrder">;
|
|
@@ -102,6 +112,7 @@ export declare const msg: {
|
|
|
102
112
|
readonly undelegate: (value: MsgUndelegate) => Eip712Msg<MsgUndelegate, "/cosmos.staking.v1beta1.MsgUndelegate">;
|
|
103
113
|
};
|
|
104
114
|
readonly vault: {
|
|
115
|
+
readonly backstopTransfer: (value: MsgBackstopTransfer) => Eip712Msg<MsgBackstopTransfer, "/ault.vault.v1.MsgBackstopTransfer">;
|
|
105
116
|
readonly cancelVaultConfigUpdate: (value: MsgCancelVaultConfigUpdate) => Eip712Msg<MsgCancelVaultConfigUpdate, "/ault.vault.v1.MsgCancelVaultConfigUpdate">;
|
|
106
117
|
readonly createVault: (value: MsgCreateVaultInput) => Eip712Msg<MsgCreateVaultInput, "/ault.vault.v1.MsgCreateVault">;
|
|
107
118
|
readonly deposit: (value: MsgDepositAultVaultV1) => Eip712Msg<MsgDepositAultVaultV1, "/ault.vault.v1.MsgDeposit">;
|
|
@@ -113,5 +124,5 @@ export declare const msg: {
|
|
|
113
124
|
readonly vaultTransfer: (value: MsgVaultTransfer) => Eip712Msg<MsgVaultTransfer, "/ault.vault.v1.MsgVaultTransfer">;
|
|
114
125
|
};
|
|
115
126
|
};
|
|
116
|
-
export type AnyEip712Msg = Eip712Msg<MsgOpenAccount, "/ault.accountx.v1.MsgOpenAccount"> | Eip712Msg<MsgApproveAgentInput, "/ault.agent.v1.MsgApproveAgent"> | Eip712Msg<MsgRevokeAgent, "/ault.agent.v1.MsgRevokeAgent"> | Eip712Msg<MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders"> | Eip712Msg<MsgModifyOrdersInput, "/ault.clob.v1.MsgModifyOrders"> | Eip712Msg<MsgPlaceLimitOrderInput, "/ault.clob.v1.MsgPlaceLimitOrder"> | Eip712Msg<MsgPlaceMarketOrderInput, "/ault.clob.v1.MsgPlaceMarketOrder"> | Eip712Msg<MsgPlaceScaleOrderInput, "/ault.clob.v1.MsgPlaceScaleOrder"> | Eip712Msg<MsgPlaceTwapOrderInput, "/ault.clob.v1.MsgPlaceTwapOrder"> | Eip712Msg<MsgBorrow, "/ault.lending.v1.MsgBorrow"> | Eip712Msg<MsgFundInsuranceFund, "/ault.lending.v1.MsgFundInsuranceFund"> | Eip712Msg<MsgLiquidateAultLendingV1, "/ault.lending.v1.MsgLiquidate"> | Eip712Msg<MsgRepay, "/ault.lending.v1.MsgRepay"> | Eip712Msg<MsgSupply, "/ault.lending.v1.MsgSupply"> | Eip712Msg<MsgSupplyCollateral, "/ault.lending.v1.MsgSupplyCollateral"> | Eip712Msg<MsgWithdrawAultLendingV1, "/ault.lending.v1.MsgWithdraw"> | Eip712Msg<MsgWithdrawCollateral, "/ault.lending.v1.MsgWithdrawCollateral"> | Eip712Msg<MsgTransferLicenseInput, "/ault.license.v1.MsgTransferLicense"> | Eip712Msg<MsgBorrowMargin, "/ault.margin.v1.MsgBorrowMargin"> | Eip712Msg<MsgDepositMargin, "/ault.margin.v1.MsgDepositMargin"> | Eip712Msg<MsgRepayMargin, "/ault.margin.v1.MsgRepayMargin"> | Eip712Msg<MsgWithdrawMargin, "/ault.margin.v1.MsgWithdrawMargin"> | Eip712Msg<MsgBatchSubmitWorkInput, "/ault.miner.v1.MsgBatchSubmitWork"> | Eip712Msg<MsgCancelMiningDelegation, "/ault.miner.v1.MsgCancelMiningDelegation"> | Eip712Msg<MsgDelegateMining, "/ault.miner.v1.MsgDelegateMining"> | Eip712Msg<MsgRedelegateMining, "/ault.miner.v1.MsgRedelegateMining"> | Eip712Msg<MsgRegisterOperatorInput, "/ault.miner.v1.MsgRegisterOperator"> | Eip712Msg<MsgSetOwnerVrfKey, "/ault.miner.v1.MsgSetOwnerVrfKey"> | Eip712Msg<MsgSubmitWorkInput, "/ault.miner.v1.MsgSubmitWork"> | Eip712Msg<MsgUnregisterOperator, "/ault.miner.v1.MsgUnregisterOperator"> | Eip712Msg<MsgUpdateOperatorInfoInput, "/ault.miner.v1.MsgUpdateOperatorInfo"> | Eip712Msg<MsgDepositAultPerpetualV1, "/ault.perpetual.v1.MsgDeposit"> | Eip712Msg<MsgLiquidateAultPerpetualV1, "/ault.perpetual.v1.MsgLiquidate"> | Eip712Msg<MsgModifyPositionMargin, "/ault.perpetual.v1.MsgModifyPositionMargin"> | Eip712Msg<MsgSetMarginConfig, "/ault.perpetual.v1.MsgSetMarginConfig"> | Eip712Msg<MsgWithdrawAultPerpetualV1, "/ault.perpetual.v1.MsgWithdraw"> | Eip712Msg<MsgApproveBuilder, "/ault.reward.v1.MsgApproveBuilder"> | Eip712Msg<MsgRevokeBuilder, "/ault.reward.v1.MsgRevokeBuilder"> | Eip712Msg<MsgSetReferral, "/ault.reward.v1.MsgSetReferral"> | Eip712Msg<MsgSetReferralCode, "/ault.reward.v1.MsgSetReferralCode"> | Eip712Msg<MsgCancelVaultConfigUpdate, "/ault.vault.v1.MsgCancelVaultConfigUpdate"> | Eip712Msg<MsgCreateVaultInput, "/ault.vault.v1.MsgCreateVault"> | Eip712Msg<MsgDepositAultVaultV1, "/ault.vault.v1.MsgDeposit"> | Eip712Msg<MsgReallocate, "/ault.vault.v1.MsgReallocate"> | Eip712Msg<MsgRedeem, "/ault.vault.v1.MsgRedeem"> | Eip712Msg<MsgSetVaultStatus, "/ault.vault.v1.MsgSetVaultStatus"> | Eip712Msg<MsgUpdateVaultConfigInput, "/ault.vault.v1.MsgUpdateVaultConfig"> | Eip712Msg<MsgUpdateVaultManager, "/ault.vault.v1.MsgUpdateVaultManager"> | Eip712Msg<MsgVaultTransfer, "/ault.vault.v1.MsgVaultTransfer"> | Eip712Msg<MsgWithdrawDelegatorReward, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"> | Eip712Msg<MsgBeginRedelegate, "/cosmos.staking.v1beta1.MsgBeginRedelegate"> | Eip712Msg<MsgDelegate, "/cosmos.staking.v1beta1.MsgDelegate"> | Eip712Msg<MsgUndelegate, "/cosmos.staking.v1beta1.MsgUndelegate">;
|
|
127
|
+
export type AnyEip712Msg = Eip712Msg<MsgOpenAccount, "/ault.accountx.v1.MsgOpenAccount"> | Eip712Msg<MsgApproveAgentInput, "/ault.agent.v1.MsgApproveAgent"> | Eip712Msg<MsgRevokeAgent, "/ault.agent.v1.MsgRevokeAgent"> | Eip712Msg<MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders"> | Eip712Msg<MsgModifyConditionalOrdersInput, "/ault.clob.v1.MsgModifyConditionalOrders"> | Eip712Msg<MsgModifyOrdersInput, "/ault.clob.v1.MsgModifyOrders"> | Eip712Msg<MsgPlaceConditionalOrderInput, "/ault.clob.v1.MsgPlaceConditionalOrder"> | Eip712Msg<MsgPlaceGroupOrderInput, "/ault.clob.v1.MsgPlaceGroupOrder"> | Eip712Msg<MsgPlaceLimitOrderInput, "/ault.clob.v1.MsgPlaceLimitOrder"> | Eip712Msg<MsgPlaceMarketOrderInput, "/ault.clob.v1.MsgPlaceMarketOrder"> | Eip712Msg<MsgPlaceScaleOrderInput, "/ault.clob.v1.MsgPlaceScaleOrder"> | Eip712Msg<MsgPlaceTwapOrderInput, "/ault.clob.v1.MsgPlaceTwapOrder"> | Eip712Msg<MsgBorrow, "/ault.lending.v1.MsgBorrow"> | Eip712Msg<MsgFundInsuranceFund, "/ault.lending.v1.MsgFundInsuranceFund"> | Eip712Msg<MsgLiquidateAultLendingV1, "/ault.lending.v1.MsgLiquidate"> | Eip712Msg<MsgRepay, "/ault.lending.v1.MsgRepay"> | Eip712Msg<MsgSupply, "/ault.lending.v1.MsgSupply"> | Eip712Msg<MsgSupplyCollateral, "/ault.lending.v1.MsgSupplyCollateral"> | Eip712Msg<MsgWithdrawAultLendingV1, "/ault.lending.v1.MsgWithdraw"> | Eip712Msg<MsgWithdrawCollateral, "/ault.lending.v1.MsgWithdrawCollateral"> | Eip712Msg<MsgTransferLicenseInput, "/ault.license.v1.MsgTransferLicense"> | Eip712Msg<MsgBorrowMargin, "/ault.margin.v1.MsgBorrowMargin"> | Eip712Msg<MsgDepositMargin, "/ault.margin.v1.MsgDepositMargin"> | Eip712Msg<MsgRepayMargin, "/ault.margin.v1.MsgRepayMargin"> | Eip712Msg<MsgWithdrawMargin, "/ault.margin.v1.MsgWithdrawMargin"> | Eip712Msg<MsgBatchSubmitWorkInput, "/ault.miner.v1.MsgBatchSubmitWork"> | Eip712Msg<MsgCancelMiningDelegation, "/ault.miner.v1.MsgCancelMiningDelegation"> | Eip712Msg<MsgDelegateMining, "/ault.miner.v1.MsgDelegateMining"> | Eip712Msg<MsgRedelegateMining, "/ault.miner.v1.MsgRedelegateMining"> | Eip712Msg<MsgRegisterOperatorInput, "/ault.miner.v1.MsgRegisterOperator"> | Eip712Msg<MsgSetOwnerVrfKey, "/ault.miner.v1.MsgSetOwnerVrfKey"> | Eip712Msg<MsgSubmitWorkInput, "/ault.miner.v1.MsgSubmitWork"> | Eip712Msg<MsgUnregisterOperator, "/ault.miner.v1.MsgUnregisterOperator"> | Eip712Msg<MsgUpdateOperatorInfoInput, "/ault.miner.v1.MsgUpdateOperatorInfo"> | Eip712Msg<MsgDepositAultPerpetualV1, "/ault.perpetual.v1.MsgDeposit"> | Eip712Msg<MsgLiquidateAultPerpetualV1, "/ault.perpetual.v1.MsgLiquidate"> | Eip712Msg<MsgModifyPositionMargin, "/ault.perpetual.v1.MsgModifyPositionMargin"> | Eip712Msg<MsgSetMarginConfig, "/ault.perpetual.v1.MsgSetMarginConfig"> | Eip712Msg<MsgWithdrawAultPerpetualV1, "/ault.perpetual.v1.MsgWithdraw"> | Eip712Msg<MsgApproveBuilder, "/ault.reward.v1.MsgApproveBuilder"> | Eip712Msg<MsgRevokeBuilder, "/ault.reward.v1.MsgRevokeBuilder"> | Eip712Msg<MsgSetReferral, "/ault.reward.v1.MsgSetReferral"> | Eip712Msg<MsgSetReferralCode, "/ault.reward.v1.MsgSetReferralCode"> | Eip712Msg<MsgBackstopTransfer, "/ault.vault.v1.MsgBackstopTransfer"> | Eip712Msg<MsgCancelVaultConfigUpdate, "/ault.vault.v1.MsgCancelVaultConfigUpdate"> | Eip712Msg<MsgCreateVaultInput, "/ault.vault.v1.MsgCreateVault"> | Eip712Msg<MsgDepositAultVaultV1, "/ault.vault.v1.MsgDeposit"> | Eip712Msg<MsgReallocate, "/ault.vault.v1.MsgReallocate"> | Eip712Msg<MsgRedeem, "/ault.vault.v1.MsgRedeem"> | Eip712Msg<MsgSetVaultStatus, "/ault.vault.v1.MsgSetVaultStatus"> | Eip712Msg<MsgUpdateVaultConfigInput, "/ault.vault.v1.MsgUpdateVaultConfig"> | Eip712Msg<MsgUpdateVaultManager, "/ault.vault.v1.MsgUpdateVaultManager"> | Eip712Msg<MsgVaultTransfer, "/ault.vault.v1.MsgVaultTransfer"> | Eip712Msg<MsgWithdrawDelegatorReward, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"> | Eip712Msg<MsgBeginRedelegate, "/cosmos.staking.v1beta1.MsgBeginRedelegate"> | Eip712Msg<MsgDelegate, "/cosmos.staking.v1beta1.MsgDelegate"> | Eip712Msg<MsgUndelegate, "/cosmos.staking.v1beta1.MsgUndelegate">;
|
|
117
128
|
export {};
|
package/dist/eip712/types.d.ts
CHANGED
|
@@ -54,6 +54,11 @@ export type Eip712Field = {
|
|
|
54
54
|
* chain's legacy amino JSON always emits it, zero value included.
|
|
55
55
|
*/
|
|
56
56
|
dontOmitEmpty?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The field stands for an amino oneof (named in CamelCase). Its configs, one
|
|
59
|
+
* per member, live under the message's `anyTypes` like an interface Any's.
|
|
60
|
+
*/
|
|
61
|
+
oneof?: boolean;
|
|
57
62
|
};
|
|
58
63
|
export interface Eip712TypedData<TPrimary extends string = "Tx"> {
|
|
59
64
|
types: Record<string, Eip712Field[]>;
|
|
@@ -8,7 +8,7 @@ import type { AccountxApi } from "../rest/accountx";
|
|
|
8
8
|
import type { AgentApi } from "../rest/agent";
|
|
9
9
|
import type { AuthorityApi } from "../rest/authority";
|
|
10
10
|
import type { BankApi } from "../rest/bank";
|
|
11
|
-
import type { ClobApi } from "../rest/clob";
|
|
11
|
+
import type { ClobApi, ConditionalOrder } 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";
|
|
@@ -16,12 +16,13 @@ import type { PerpetualApi } from "../rest/perpetual";
|
|
|
16
16
|
import type { LendingApi } from "../rest/lending";
|
|
17
17
|
import type { MarginOrderOptions } from "../core/margin-msgs";
|
|
18
18
|
import type { LendingPoolId } from "../core/lending-msgs";
|
|
19
|
-
import type { VaultConfigInput,
|
|
19
|
+
import type { VaultConfigInput, VaultFundWindowInput, VaultStatusInput } from "../core/vault-msgs";
|
|
20
20
|
import type { MarginApi } from "../rest/margin";
|
|
21
21
|
import type { OracleApi } from "../rest/oracle";
|
|
22
22
|
import type { VaultApi } from "../rest/vault";
|
|
23
23
|
import type { RateLimitApi } from "../rest/ratelimit";
|
|
24
24
|
import type { RewardApi } from "../rest/reward";
|
|
25
|
+
import type { SpotApi } from "../rest/spot";
|
|
25
26
|
import type { StakingApi } from "../rest/staking";
|
|
26
27
|
import type { TokenRegistryApi } from "../rest/tokenregistry";
|
|
27
28
|
import type { OrderResponse as ChainOrderResponse, TwapOrderResult } from "../proto/gen/ault/clob/v1/query";
|
|
@@ -33,6 +34,23 @@ import type { Any as ProtoAny } from "../proto/gen/google/protobuf/any";
|
|
|
33
34
|
import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
|
|
34
35
|
import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
|
|
35
36
|
import type { BigIntLike } from "../core/address";
|
|
37
|
+
import type { ConditionalOrderInput, GroupLegInput, GroupTypeInput } from "../core/conditional-msgs";
|
|
38
|
+
/** See `buildConditionalOrderMsg`. */
|
|
39
|
+
export type ConditionalOrderParams = ConditionalOrderInput;
|
|
40
|
+
/** See `buildModifyConditionalOrdersMsg`. */
|
|
41
|
+
export type ModifyConditionalOrdersParams = {
|
|
42
|
+
orders: Array<{
|
|
43
|
+
orderRef: Uint8Array;
|
|
44
|
+
} & Omit<ConditionalOrderInput, "cloid">>;
|
|
45
|
+
};
|
|
46
|
+
/** See `buildGroupOrderMsg`. */
|
|
47
|
+
export type GroupOrderParams = {
|
|
48
|
+
marketId: Uint8Array;
|
|
49
|
+
type: GroupTypeInput;
|
|
50
|
+
primary: GroupLegInput;
|
|
51
|
+
secondary: GroupLegInput;
|
|
52
|
+
tertiary?: GroupLegInput;
|
|
53
|
+
};
|
|
36
54
|
export type { BigIntLike };
|
|
37
55
|
/** Common transaction options available on all methods */
|
|
38
56
|
export interface TxOptions {
|
|
@@ -192,6 +210,26 @@ export type ModifyOrdersResult = TxResult & {
|
|
|
192
210
|
}>;
|
|
193
211
|
failed: string[];
|
|
194
212
|
};
|
|
213
|
+
/** Conditional order result when `wait: true`: the id of the waiting order (byte 0 = 3). */
|
|
214
|
+
export type PlaceConditionalOrderResult = TxResult & {
|
|
215
|
+
orderId: string;
|
|
216
|
+
cloid?: string;
|
|
217
|
+
};
|
|
218
|
+
/** `failed` echoes the request's refs (id or cloid) as hex. */
|
|
219
|
+
export type ModifyConditionalOrdersResult = TxResult & {
|
|
220
|
+
succeeded: Array<{
|
|
221
|
+
orderId: string;
|
|
222
|
+
cloid?: string;
|
|
223
|
+
}>;
|
|
224
|
+
failed: string[];
|
|
225
|
+
};
|
|
226
|
+
/** Group order result when `wait: true`: one entry per leg, in request order. */
|
|
227
|
+
export type PlaceGroupOrderResult = TxResult & {
|
|
228
|
+
legs: Array<{
|
|
229
|
+
orderId: string;
|
|
230
|
+
cloid?: string;
|
|
231
|
+
}>;
|
|
232
|
+
};
|
|
195
233
|
export interface LicenseTxApi {
|
|
196
234
|
transferLicense(params: {
|
|
197
235
|
licenseId: BigIntLike;
|
|
@@ -299,27 +337,27 @@ export type LimitOrderParams = {
|
|
|
299
337
|
/** Optional 8-byte client order id. Omitted from the signed payload when absent. */
|
|
300
338
|
cloid?: Uint8Array;
|
|
301
339
|
/**
|
|
302
|
-
* Perpetual markets only (chain v3)
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
340
|
+
* Perpetual markets only (chain v3), and required there: the chain needs
|
|
341
|
+
* the `PerpetualOrderOptions` Any on every perp order, so pass `false` for a
|
|
342
|
+
* plain order and `true` to only shrink the position. Leave it undefined on
|
|
343
|
+
* spot markets, which reject the options.
|
|
306
344
|
*/
|
|
307
345
|
reduceOnly?: boolean;
|
|
308
346
|
/**
|
|
309
347
|
* Spot markets only (chain v3): escrow from the owner's margin account
|
|
310
348
|
* instead of the bank balance. The account is the cross one with
|
|
311
349
|
* `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
350
|
*/
|
|
315
351
|
margin?: MarginOrderOptions;
|
|
316
352
|
};
|
|
317
353
|
/**
|
|
318
354
|
* TWAP order (chain v2.1.0+). The chain splits `totalDeposit` into equal
|
|
319
|
-
* slices executed
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
* `
|
|
355
|
+
* slices executed every 30s (fixed interval) until `deadline`; `numSlices` in
|
|
356
|
+
* the result = window / 30s. On spot `totalDeposit` is quote for a buy and
|
|
357
|
+
* base for a sell; on a perpetual market (v3.0.0-rc.3) it is the base
|
|
358
|
+
* quantity and `reduceOnly` is required. The order must be worth at least 10×
|
|
359
|
+
* the market's minimum order. `worstPrice` / `priceTolerance` optionally guard
|
|
360
|
+
* each slice like a market order's.
|
|
323
361
|
*/
|
|
324
362
|
export type TwapOrderParams = {
|
|
325
363
|
marketId: Uint8Array;
|
|
@@ -333,6 +371,8 @@ export type TwapOrderParams = {
|
|
|
333
371
|
builderFeeRate?: string;
|
|
334
372
|
/** Optional 8-byte client order id. Omitted from the signed payload when absent. */
|
|
335
373
|
cloid?: Uint8Array;
|
|
374
|
+
/** Perpetual markets only, and required there; see `LimitOrderParams.reduceOnly`. */
|
|
375
|
+
reduceOnly?: boolean;
|
|
336
376
|
};
|
|
337
377
|
export type MarketOrderParams = {
|
|
338
378
|
marketId: Uint8Array;
|
|
@@ -424,6 +464,38 @@ export interface ClobTxApi {
|
|
|
424
464
|
wait?: false;
|
|
425
465
|
} & TxOptions): Promise<TxResult>;
|
|
426
466
|
placeTwapOrder(params: TwapOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceTwapOrderResult>;
|
|
467
|
+
/**
|
|
468
|
+
* Stop-loss / take-profit (chain v3.0.0-rc.3): waits, reserving nothing,
|
|
469
|
+
* until the market's last traded price crosses the trigger, then places its
|
|
470
|
+
* order.
|
|
471
|
+
*/
|
|
472
|
+
placeConditionalOrder(params: ConditionalOrderParams & {
|
|
473
|
+
wait: true;
|
|
474
|
+
} & TxOptions): Promise<PlaceConditionalOrderResult>;
|
|
475
|
+
placeConditionalOrder(params: ConditionalOrderParams & {
|
|
476
|
+
wait?: false;
|
|
477
|
+
} & TxOptions): Promise<TxResult>;
|
|
478
|
+
placeConditionalOrder(params: ConditionalOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceConditionalOrderResult>;
|
|
479
|
+
/**
|
|
480
|
+
* Replace the trigger and order of waiting conditional orders (1 to 100).
|
|
481
|
+
* Over EIP-712 every entry must have the same shape (same order type, the
|
|
482
|
+
* same optional fields set): typed data types a list by its first element.
|
|
483
|
+
*/
|
|
484
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & {
|
|
485
|
+
wait: true;
|
|
486
|
+
} & TxOptions): Promise<ModifyConditionalOrdersResult>;
|
|
487
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & {
|
|
488
|
+
wait?: false;
|
|
489
|
+
} & TxOptions): Promise<TxResult>;
|
|
490
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & OrderWaitOption & TxOptions): Promise<TxResult | ModifyConditionalOrdersResult>;
|
|
491
|
+
/** OCO, OTO or OTOCO linked orders on one market; perpetual markets take only OTOCO. */
|
|
492
|
+
placeGroupOrder(params: GroupOrderParams & {
|
|
493
|
+
wait: true;
|
|
494
|
+
} & TxOptions): Promise<PlaceGroupOrderResult>;
|
|
495
|
+
placeGroupOrder(params: GroupOrderParams & {
|
|
496
|
+
wait?: false;
|
|
497
|
+
} & TxOptions): Promise<TxResult>;
|
|
498
|
+
placeGroupOrder(params: GroupOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceGroupOrderResult>;
|
|
427
499
|
}
|
|
428
500
|
export interface RewardTxApi {
|
|
429
501
|
setReferralCode(params: {
|
|
@@ -508,10 +580,9 @@ export interface MarginTxApi {
|
|
|
508
580
|
} & TxOptions): Promise<TxResult>;
|
|
509
581
|
}
|
|
510
582
|
/**
|
|
511
|
-
* x/vault operations a wallet signs over EIP-712.
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* messages).
|
|
583
|
+
* x/vault operations a wallet signs over EIP-712. The same administration is
|
|
584
|
+
* available through the agent (`client.asAgent` for a vault you own,
|
|
585
|
+
* `client.attachVaultManager` for a vault account's own messages).
|
|
515
586
|
*/
|
|
516
587
|
export interface VaultTxApi {
|
|
517
588
|
/** Deposit into a vault; mints shares at the current share price. */
|
|
@@ -544,25 +615,39 @@ export interface VaultTxApi {
|
|
|
544
615
|
vaultAddress: string;
|
|
545
616
|
status: VaultStatusInput;
|
|
546
617
|
} & TxOptions): Promise<TxResult>;
|
|
618
|
+
/** Create a normal vault owned and managed by the signer; see `CreateVaultParams`. */
|
|
619
|
+
createVault(params: CreateVaultParams & TxOptions): Promise<TxResult>;
|
|
620
|
+
/** Schedule a new config for a vault you own; it applies after the chain's delay. */
|
|
621
|
+
updateVaultConfig(params: {
|
|
622
|
+
vaultAddress: string;
|
|
623
|
+
config: VaultConfigInput;
|
|
624
|
+
} & TxOptions): Promise<TxResult>;
|
|
547
625
|
}
|
|
548
626
|
export interface CreateVaultParams {
|
|
549
|
-
vaultDenom: string;
|
|
550
627
|
config: VaultConfigInput;
|
|
551
|
-
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
628
|
+
/** Lending vaults only: the denom depositors supply. Trading vaults use the perpetual collateral denom. */
|
|
629
|
+
vaultDenom?: string;
|
|
630
|
+
/** Lending vaults only, in basis points. */
|
|
631
|
+
managementFeeBps?: number;
|
|
632
|
+
/** Normal trading vaults only, in basis points. */
|
|
633
|
+
performanceFeeBps?: number;
|
|
634
|
+
/**
|
|
635
|
+
* Trading vaults: required (positive) without a fund window, zero with one
|
|
636
|
+
* and for a child vault.
|
|
637
|
+
*/
|
|
638
|
+
exitFeeBps?: number;
|
|
639
|
+
/** When deposits and redemptions open; none means at any time. A child vault takes none. */
|
|
640
|
+
fundWindow?: VaultFundWindowInput;
|
|
641
|
+
/**
|
|
642
|
+
* Required and positive, in the perpetual collateral denom, for a normal
|
|
643
|
+
* trading vault (at least the module's `minInitialDeposit`); other vaults take none.
|
|
644
|
+
*/
|
|
555
645
|
initialDeposit?: CoinInput;
|
|
556
646
|
/**
|
|
557
647
|
* Defaults to the owner, which a normal vault's manager must be. A child
|
|
558
648
|
* vault takes none: its parent's manager runs it.
|
|
559
649
|
*/
|
|
560
650
|
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
651
|
/**
|
|
567
652
|
* Default `normal`. `child` is only sent from a parent vault's account
|
|
568
653
|
* (`attachVaultManager`). A `parent` vault is owned by x/gov, so no account
|
|
@@ -609,6 +694,15 @@ export interface VaultAccountTxApi {
|
|
|
609
694
|
amount: CoinInput;
|
|
610
695
|
isDeposit: boolean;
|
|
611
696
|
} & AgentTxOptions): Promise<TxResult>;
|
|
697
|
+
/**
|
|
698
|
+
* Parent vault only (chain v3.0.0-rc.3): hand a perpetual account that
|
|
699
|
+
* liquidation cannot close to one of this parent's child vaults, which must
|
|
700
|
+
* hold the backstop action.
|
|
701
|
+
*/
|
|
702
|
+
backstopTransfer(params: {
|
|
703
|
+
sourceAccount: string;
|
|
704
|
+
childVault: string;
|
|
705
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
612
706
|
}
|
|
613
707
|
export interface StakingTxApi {
|
|
614
708
|
delegate(params: {
|
|
@@ -677,6 +771,9 @@ export interface ParallelQueryApi {
|
|
|
677
771
|
* the chain proto {@link ChainOrderResponse}.
|
|
678
772
|
* - `source: "chain-twap"` — the cloid resolved to a live TWAP order; `order` is
|
|
679
773
|
* the chain proto {@link TwapOrderResult} (parent order + slice schedule).
|
|
774
|
+
* - `source: "chain-conditional"` — the cloid resolved to a conditional order
|
|
775
|
+
* still waiting for its trigger; `order` carries the `limit` or `market` order
|
|
776
|
+
* it will place. Once it triggers, the cloid moves to that order.
|
|
680
777
|
* - `source: "dex"` — chain had no live match, answered by the indexed dex-api;
|
|
681
778
|
* `order` is the dex REST {@link DexOrderResponse} DTO (`clientOrderId` is hex).
|
|
682
779
|
* - `source: "none"` — neither leg found an order for this cloid.
|
|
@@ -687,6 +784,9 @@ export type CloidOrder = {
|
|
|
687
784
|
} | {
|
|
688
785
|
source: "chain-twap";
|
|
689
786
|
order: TwapOrderResult;
|
|
787
|
+
} | {
|
|
788
|
+
source: "chain-conditional";
|
|
789
|
+
order: ConditionalOrder;
|
|
690
790
|
} | {
|
|
691
791
|
source: "dex";
|
|
692
792
|
order: DexOrderResponse;
|
|
@@ -756,6 +856,34 @@ export interface AgentClobTxApi {
|
|
|
756
856
|
wait?: false;
|
|
757
857
|
} & AgentTxOptions): Promise<TxResult>;
|
|
758
858
|
placeTwapOrder(params: TwapOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceTwapOrderResult>;
|
|
859
|
+
/**
|
|
860
|
+
* Stop-loss / take-profit (chain v3.0.0-rc.3): waits, reserving nothing,
|
|
861
|
+
* until the market's last traded price crosses the trigger, then places its
|
|
862
|
+
* order.
|
|
863
|
+
*/
|
|
864
|
+
placeConditionalOrder(params: ConditionalOrderParams & {
|
|
865
|
+
wait: true;
|
|
866
|
+
} & AgentTxOptions): Promise<PlaceConditionalOrderResult>;
|
|
867
|
+
placeConditionalOrder(params: ConditionalOrderParams & {
|
|
868
|
+
wait?: false;
|
|
869
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
870
|
+
placeConditionalOrder(params: ConditionalOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceConditionalOrderResult>;
|
|
871
|
+
/** Replace the trigger and order of waiting conditional orders (1 to 100). */
|
|
872
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & {
|
|
873
|
+
wait: true;
|
|
874
|
+
} & AgentTxOptions): Promise<ModifyConditionalOrdersResult>;
|
|
875
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & {
|
|
876
|
+
wait?: false;
|
|
877
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
878
|
+
modifyConditionalOrders(params: ModifyConditionalOrdersParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | ModifyConditionalOrdersResult>;
|
|
879
|
+
/** OCO, OTO or OTOCO linked orders on one market; perpetual markets take only OTOCO. */
|
|
880
|
+
placeGroupOrder(params: GroupOrderParams & {
|
|
881
|
+
wait: true;
|
|
882
|
+
} & AgentTxOptions): Promise<PlaceGroupOrderResult>;
|
|
883
|
+
placeGroupOrder(params: GroupOrderParams & {
|
|
884
|
+
wait?: false;
|
|
885
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
886
|
+
placeGroupOrder(params: GroupOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceGroupOrderResult>;
|
|
759
887
|
}
|
|
760
888
|
/**
|
|
761
889
|
* x/perpetual collateral and margin messages (chain v3). All four are fee-free
|
|
@@ -789,6 +917,14 @@ export interface PerpetualTxApi {
|
|
|
789
917
|
setMarginConfig(params: SetMarginConfigParams & TxOptions): Promise<TxResult>;
|
|
790
918
|
/** Add collateral to or remove it from an isolated position. */
|
|
791
919
|
modifyPositionMargin(params: ModifyPositionMarginParams & TxOptions): Promise<TxResult>;
|
|
920
|
+
/**
|
|
921
|
+
* Liquidate perpetual accounts below maintenance (chain v3.0.0-rc.3, any
|
|
922
|
+
* sender). Not fee-free and not agent-signable; gas is simulated unless
|
|
923
|
+
* `gasLimit` is set.
|
|
924
|
+
*/
|
|
925
|
+
liquidatePerpAccounts(params: {
|
|
926
|
+
accounts: string[];
|
|
927
|
+
} & TxOptions): Promise<TxResult>;
|
|
792
928
|
}
|
|
793
929
|
export interface AgentPerpetualTxApi {
|
|
794
930
|
depositPerpCollateral(params: PerpDepositParams & AgentTxOptions): Promise<TxResult>;
|
|
@@ -812,17 +948,19 @@ export interface AgentSurface extends AgentClobTxApi, AgentPerpetualTxApi, Agent
|
|
|
812
948
|
* a normal or parent vault, the parent's manager for a child) or that key's
|
|
813
949
|
* registered agent. Build it with `client.attachVaultManager(...)`.
|
|
814
950
|
*
|
|
815
|
-
* x/vault accepts a different set per vault (rc.
|
|
951
|
+
* x/vault accepts a different set per vault (v3.0.0-rc.3 account control):
|
|
816
952
|
* - normal trading vault, child vault: limit, market and scale orders,
|
|
817
|
-
* modify and cancel, on the vault's configured spot markets
|
|
953
|
+
* modify and cancel, on the vault's configured spot markets and, with the
|
|
954
|
+
* perpetual action, on perpetual markets, plus the perpetual collateral and
|
|
955
|
+
* margin messages;
|
|
818
956
|
* - normal lending vault: `reallocateVault`;
|
|
819
957
|
* - parent vault: `createVault` (children), `updateVaultConfig`,
|
|
820
|
-
* `cancelVaultConfigUpdate` and `setVaultStatus` on its children,
|
|
821
|
-
* `transferChildVault`. A parent vault does not trade.
|
|
958
|
+
* `cancelVaultConfigUpdate` and `setVaultStatus` on its children,
|
|
959
|
+
* `transferChildVault` and `backstopTransfer`. A parent vault does not trade.
|
|
822
960
|
*
|
|
823
|
-
* TWAP orders are not available from a vault account.
|
|
961
|
+
* TWAP, conditional and group orders are not available from a vault account.
|
|
824
962
|
*/
|
|
825
|
-
export interface VaultManagerSurface extends Omit<AgentClobTxApi, "placeTwapOrder">, AgentVaultTxApi, VaultAccountTxApi {
|
|
963
|
+
export interface VaultManagerSurface extends Omit<AgentClobTxApi, "placeTwapOrder" | "placeConditionalOrder" | "modifyConditionalOrders" | "placeGroupOrder">, AgentPerpetualTxApi, AgentVaultTxApi, VaultAccountTxApi {
|
|
826
964
|
/** Address of the signing key (the manager or its agent). */
|
|
827
965
|
readonly address: string;
|
|
828
966
|
/** The vault account every message is sent from. */
|
|
@@ -872,6 +1010,8 @@ export interface Client extends AccountxTxApi, AgentTxApi, ClobTxApi, LendingTxA
|
|
|
872
1010
|
readonly ratelimit: RateLimitApi;
|
|
873
1011
|
/** Reward module queries */
|
|
874
1012
|
readonly reward: RewardApi;
|
|
1013
|
+
/** Spot module queries (chain v3.0.0-rc.3): the minimum spot order. */
|
|
1014
|
+
readonly spot: SpotApi;
|
|
875
1015
|
/** Staking/distribution queries */
|
|
876
1016
|
readonly staking: StakingApi;
|
|
877
1017
|
/** Token registry module queries */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, TxOptions, OrderWaitOption, PlaceOrderResult, PlaceScaleOrderResult, PlaceTwapOrderResult, TwapOrderParams, CancelOrdersResult, ModifyOrdersParams, ModifyOrdersResult, CloidOrder, CloidLookupApi, } from "./high-level/types";
|
|
1
|
+
export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, TxOptions, OrderWaitOption, PlaceOrderResult, PlaceScaleOrderResult, PlaceTwapOrderResult, TwapOrderParams, CancelOrdersResult, ModifyOrdersParams, ModifyOrdersResult, CloidOrder, CloidLookupApi, ConditionalOrderParams, ModifyConditionalOrdersParams, GroupOrderParams, PlaceConditionalOrderResult, ModifyConditionalOrdersResult, PlaceGroupOrderResult, VaultManagerSurface, } from "./high-level/types";
|
|
2
2
|
export { createClient } from "./high-level/create-client";
|