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
|
@@ -25,10 +25,22 @@ export interface MsgRevokeRole {
|
|
|
25
25
|
/** MsgRevokeRoleResponse is the response for MsgRevokeRole. */
|
|
26
26
|
export interface MsgRevokeRoleResponse {
|
|
27
27
|
}
|
|
28
|
+
/** MsgRenounceRole defines a message for a sender to renounce its own role. */
|
|
29
|
+
export interface MsgRenounceRole {
|
|
30
|
+
/** sender is the address renouncing the role. */
|
|
31
|
+
sender: string;
|
|
32
|
+
/** role is the role to renounce. */
|
|
33
|
+
role: Role;
|
|
34
|
+
}
|
|
35
|
+
/** MsgRenounceRoleResponse is the response for MsgRenounceRole. */
|
|
36
|
+
export interface MsgRenounceRoleResponse {
|
|
37
|
+
}
|
|
28
38
|
export declare const MsgGrantRole: MessageFns<MsgGrantRole>;
|
|
29
39
|
export declare const MsgGrantRoleResponse: MessageFns<MsgGrantRoleResponse>;
|
|
30
40
|
export declare const MsgRevokeRole: MessageFns<MsgRevokeRole>;
|
|
31
41
|
export declare const MsgRevokeRoleResponse: MessageFns<MsgRevokeRoleResponse>;
|
|
42
|
+
export declare const MsgRenounceRole: MessageFns<MsgRenounceRole>;
|
|
43
|
+
export declare const MsgRenounceRoleResponse: MessageFns<MsgRenounceRoleResponse>;
|
|
32
44
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
33
45
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
34
46
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { Any } from "../../../google/protobuf/any";
|
|
3
|
+
export declare const protobufPackage = "ault.clob.v1";
|
|
4
|
+
/**
|
|
5
|
+
* Condition is the trigger condition shared by conditional order placement,
|
|
6
|
+
* modification, and the stored parent record.
|
|
7
|
+
*/
|
|
8
|
+
export interface Condition {
|
|
9
|
+
triggerPrice: string;
|
|
10
|
+
triggerAbove: boolean;
|
|
11
|
+
deadline: Date | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* ConditionalOrder is a conditional order waiting for its trigger, held by
|
|
15
|
+
* x/clob. It reserves nothing: when the trigger fires, the executable order is
|
|
16
|
+
* placed like any other order, escrow included.
|
|
17
|
+
*/
|
|
18
|
+
export interface ConditionalOrder {
|
|
19
|
+
id: Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* orderer is the account the executable order will be held in, resolved at
|
|
22
|
+
* placement through the market module. A close-out of that account cancels
|
|
23
|
+
* this order with the account's other orders.
|
|
24
|
+
*/
|
|
25
|
+
orderer: Uint8Array;
|
|
26
|
+
marketId: Uint8Array;
|
|
27
|
+
isBuy: boolean;
|
|
28
|
+
condition: Condition | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* trigger_tick is derived from condition.trigger_price at placement and
|
|
31
|
+
* modification.
|
|
32
|
+
*/
|
|
33
|
+
triggerTick: bigint;
|
|
34
|
+
/**
|
|
35
|
+
* order contains the executable MsgPlaceLimitOrder, MsgPlaceMarketOrder, or
|
|
36
|
+
* a future market module's registered order message.
|
|
37
|
+
*/
|
|
38
|
+
order: Any | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const Condition: MessageFns<Condition>;
|
|
41
|
+
export declare const ConditionalOrder: MessageFns<ConditionalOrder>;
|
|
42
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
43
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
44
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
45
|
+
} : Partial<T>;
|
|
46
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
47
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
48
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
49
|
+
} & {
|
|
50
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
51
|
+
};
|
|
52
|
+
export interface MessageFns<T> {
|
|
53
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
54
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
55
|
+
fromJSON(object: any): T;
|
|
56
|
+
toJSON(message: T): unknown;
|
|
57
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
58
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { ConditionalOrder } from "./conditional";
|
|
3
|
+
import { OrderLink } from "./group";
|
|
2
4
|
import { Params } from "./params";
|
|
3
5
|
import { TwapOrder, TwapSchedule } from "./twap";
|
|
4
6
|
export declare const protobufPackage = "ault.clob.v1";
|
|
@@ -17,6 +19,17 @@ export interface GenesisState {
|
|
|
17
19
|
twapSchedules: TwapScheduleEntry[];
|
|
18
20
|
/** Owner index entries: orderer -> order_id */
|
|
19
21
|
ordersByOrderer: OrdersByOrdererEntry[];
|
|
22
|
+
/**
|
|
23
|
+
* Conditional orders waiting for their trigger. The owner and trigger
|
|
24
|
+
* indexes are rebuilt from these records at import.
|
|
25
|
+
*/
|
|
26
|
+
conditionalOrders: ConditionalOrder[];
|
|
27
|
+
/**
|
|
28
|
+
* Group link edges. A conditional order targeted by an OTO edge, or
|
|
29
|
+
* OCO-linked to one that is, is dormant: it has no trigger index entry until
|
|
30
|
+
* its primary fills.
|
|
31
|
+
*/
|
|
32
|
+
orderLinks: OrderLink[];
|
|
20
33
|
}
|
|
21
34
|
export interface TwapScheduleEntry {
|
|
22
35
|
twapId: Uint8Array;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
export declare const protobufPackage = "ault.clob.v1";
|
|
3
|
+
/**
|
|
4
|
+
* OrderGroupType is the placement shape of a group. It is translated into
|
|
5
|
+
* OrderLink edges at placement and is not stored.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum OrderGroupType {
|
|
8
|
+
/** ORDER_GROUP_TYPE_UNSPECIFIED - UNSPECIFIED is not a valid group type. */
|
|
9
|
+
ORDER_GROUP_TYPE_UNSPECIFIED = 0,
|
|
10
|
+
/**
|
|
11
|
+
* ORDER_GROUP_TYPE_OCO - OCO: two legs placed on the same side and quantity; any fill or the
|
|
12
|
+
* trigger of either leg cancels the other.
|
|
13
|
+
*/
|
|
14
|
+
ORDER_GROUP_TYPE_OCO = 1,
|
|
15
|
+
/** ORDER_GROUP_TYPE_OTO - OTO: a primary whose fill wakes a dormant conditional secondary. */
|
|
16
|
+
ORDER_GROUP_TYPE_OTO = 2,
|
|
17
|
+
/** ORDER_GROUP_TYPE_OTOCO - OTOCO: a primary whose fill wakes a dormant OCO pair of conditionals. */
|
|
18
|
+
ORDER_GROUP_TYPE_OTOCO = 3,
|
|
19
|
+
UNRECOGNIZED = -1
|
|
20
|
+
}
|
|
21
|
+
export declare function orderGroupTypeFromJSON(object: any): OrderGroupType;
|
|
22
|
+
export declare function orderGroupTypeToJSON(object: OrderGroupType): string;
|
|
23
|
+
/** OrderLinkType is the relationship an OrderLink edge expresses. */
|
|
24
|
+
export declare enum OrderLinkType {
|
|
25
|
+
/** ORDER_LINK_TYPE_UNSPECIFIED - UNSPECIFIED is not a valid link type. */
|
|
26
|
+
ORDER_LINK_TYPE_UNSPECIFIED = 0,
|
|
27
|
+
/**
|
|
28
|
+
* ORDER_LINK_TYPE_OCO - OCO links two legs of which only one may fill. The edge is stored once
|
|
29
|
+
* and read from either leg.
|
|
30
|
+
*/
|
|
31
|
+
ORDER_LINK_TYPE_OCO = 1,
|
|
32
|
+
/** ORDER_LINK_TYPE_OTO - OTO links a primary to the dormant leg its fill wakes. */
|
|
33
|
+
ORDER_LINK_TYPE_OTO = 2,
|
|
34
|
+
UNRECOGNIZED = -1
|
|
35
|
+
}
|
|
36
|
+
export declare function orderLinkTypeFromJSON(object: any): OrderLinkType;
|
|
37
|
+
export declare function orderLinkTypeToJSON(object: OrderLinkType): string;
|
|
38
|
+
/**
|
|
39
|
+
* OrderLink is a directed edge order_id -> linked_order_id. An order has at
|
|
40
|
+
* most one outgoing and one incoming edge.
|
|
41
|
+
*/
|
|
42
|
+
export interface OrderLink {
|
|
43
|
+
orderId: Uint8Array;
|
|
44
|
+
linkedOrderId: Uint8Array;
|
|
45
|
+
linkType: OrderLinkType;
|
|
46
|
+
/**
|
|
47
|
+
* filled_quantity is what an OTO source filled under the ids it was
|
|
48
|
+
* price-replaced from; its close is judged on these fills plus its own.
|
|
49
|
+
*/
|
|
50
|
+
filledQuantity: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const OrderLink: MessageFns<OrderLink>;
|
|
53
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
54
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
55
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
56
|
+
} : Partial<T>;
|
|
57
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
58
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
59
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
60
|
+
} & {
|
|
61
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
62
|
+
};
|
|
63
|
+
export interface MessageFns<T> {
|
|
64
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
65
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
66
|
+
fromJSON(object: any): T;
|
|
67
|
+
toJSON(message: T): unknown;
|
|
68
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
69
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -3,6 +3,11 @@ import { Duration } from "../../../google/protobuf/duration";
|
|
|
3
3
|
export declare const protobufPackage = "ault.clob.v1";
|
|
4
4
|
export interface Params {
|
|
5
5
|
maxOrderPerAddress: bigint;
|
|
6
|
+
/**
|
|
7
|
+
* Deprecated: use the market module's min_order_quote_amount.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
6
11
|
minOrderQuoteAmount: string;
|
|
7
12
|
maxOrderLifespan: Duration | undefined;
|
|
8
13
|
maxOrderPriceRatio: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";
|
|
3
|
+
import { ConditionalOrder } from "./conditional";
|
|
3
4
|
import { FeeInfo } from "./fee";
|
|
4
5
|
import { Params } from "./params";
|
|
5
6
|
import { TwapOrder, TwapSchedule } from "./twap";
|
|
@@ -14,6 +15,7 @@ export interface QueryOrderByCloidRequest {
|
|
|
14
15
|
export interface QueryOrderResponse {
|
|
15
16
|
resting?: OrderResponse | undefined;
|
|
16
17
|
twap?: TwapOrderResult | undefined;
|
|
18
|
+
conditional?: ConditionalOrder | undefined;
|
|
17
19
|
}
|
|
18
20
|
export interface TwapOrderResult {
|
|
19
21
|
order: TwapOrder | undefined;
|
|
@@ -56,6 +58,18 @@ export interface QueryTwapOrdersResponse {
|
|
|
56
58
|
orders: TwapOrderResult[];
|
|
57
59
|
pagination: PageResponse | undefined;
|
|
58
60
|
}
|
|
61
|
+
export interface QueryConditionalOrdersRequest {
|
|
62
|
+
/**
|
|
63
|
+
* orderer is the account holding the orders: the wallet for spot, the
|
|
64
|
+
* margin or perpetual position account otherwise.
|
|
65
|
+
*/
|
|
66
|
+
orderer: string;
|
|
67
|
+
pagination: PageRequest | undefined;
|
|
68
|
+
}
|
|
69
|
+
export interface QueryConditionalOrdersResponse {
|
|
70
|
+
orders: ConditionalOrder[];
|
|
71
|
+
pagination: PageResponse | undefined;
|
|
72
|
+
}
|
|
59
73
|
export declare const QueryOrderRequest: MessageFns<QueryOrderRequest>;
|
|
60
74
|
export declare const QueryOrderByCloidRequest: MessageFns<QueryOrderByCloidRequest>;
|
|
61
75
|
export declare const QueryOrderResponse: MessageFns<QueryOrderResponse>;
|
|
@@ -67,6 +81,8 @@ export declare const QueryParamsResponse: MessageFns<QueryParamsResponse>;
|
|
|
67
81
|
export declare const OrderResponse: MessageFns<OrderResponse>;
|
|
68
82
|
export declare const QueryTwapOrdersRequest: MessageFns<QueryTwapOrdersRequest>;
|
|
69
83
|
export declare const QueryTwapOrdersResponse: MessageFns<QueryTwapOrdersResponse>;
|
|
84
|
+
export declare const QueryConditionalOrdersRequest: MessageFns<QueryConditionalOrdersRequest>;
|
|
85
|
+
export declare const QueryConditionalOrdersResponse: MessageFns<QueryConditionalOrdersResponse>;
|
|
70
86
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
71
87
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
72
88
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { Any } from "../../../google/protobuf/any";
|
|
2
3
|
import { FeeInfo } from "./fee";
|
|
3
4
|
export declare const protobufPackage = "ault.clob.v1";
|
|
4
5
|
/**
|
|
@@ -13,8 +14,9 @@ export interface TwapOrder {
|
|
|
13
14
|
marketId: Uint8Array;
|
|
14
15
|
isBuy: boolean;
|
|
15
16
|
/**
|
|
16
|
-
* total_size is
|
|
17
|
-
*
|
|
17
|
+
* total_size is base quantity for perpetual markets.
|
|
18
|
+
* Spot markets use quote amount for buys and base quantity for sells.
|
|
19
|
+
* Each slice prepares its own funds or margin when it executes.
|
|
18
20
|
*/
|
|
19
21
|
totalSize: string;
|
|
20
22
|
startTime: Date | undefined;
|
|
@@ -22,6 +24,7 @@ export interface TwapOrder {
|
|
|
22
24
|
worstPrice: string;
|
|
23
25
|
priceTolerance: string;
|
|
24
26
|
feeInfo: FeeInfo | undefined;
|
|
27
|
+
options: Any | undefined;
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* TwapSchedule is a TWAP order's mutable scheduling state, stored separately
|
|
@@ -36,8 +39,9 @@ export interface TwapSchedule {
|
|
|
36
39
|
*/
|
|
37
40
|
sliceIndex: number;
|
|
38
41
|
/**
|
|
39
|
-
* remaining_size
|
|
40
|
-
*
|
|
42
|
+
* remaining_size uses the same unit as total_size: base quantity for
|
|
43
|
+
* perpetuals; quote for spot buys and base for spot sells.
|
|
44
|
+
* Unfilled slices leave their size available to later slices.
|
|
41
45
|
*/
|
|
42
46
|
remainingSize: string;
|
|
43
47
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
3
3
|
import { Any } from "../../../google/protobuf/any";
|
|
4
|
+
import { Condition } from "./conditional";
|
|
5
|
+
import { OrderGroupType } from "./group";
|
|
4
6
|
import { Params } from "./params";
|
|
5
7
|
export declare const protobufPackage = "ault.clob.v1";
|
|
6
8
|
/** TimeInForce controls how long an order remains active. */
|
|
@@ -71,7 +73,10 @@ export interface MsgPlaceTwapOrder {
|
|
|
71
73
|
sender: string;
|
|
72
74
|
marketId: Uint8Array;
|
|
73
75
|
isBuy: boolean;
|
|
74
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* total_size is base quantity for perpetual markets.
|
|
78
|
+
* Spot markets use quote amount for buys and base quantity for sells.
|
|
79
|
+
*/
|
|
75
80
|
totalSize: string;
|
|
76
81
|
deadline: Date | undefined;
|
|
77
82
|
worstPrice: string;
|
|
@@ -85,6 +90,7 @@ export interface MsgPlaceTwapOrder {
|
|
|
85
90
|
builderFeeRate: string;
|
|
86
91
|
/** cloid is an optional client-supplied identifier for the TWAP order. */
|
|
87
92
|
cloid: Uint8Array;
|
|
93
|
+
options: Any | undefined;
|
|
88
94
|
}
|
|
89
95
|
export interface MsgPlaceTwapOrderResponse {
|
|
90
96
|
twapId: Uint8Array;
|
|
@@ -159,6 +165,79 @@ export interface MsgUpdateParams {
|
|
|
159
165
|
}
|
|
160
166
|
export interface MsgUpdateParamsResponse {
|
|
161
167
|
}
|
|
168
|
+
export interface MsgPlaceConditionalOrder {
|
|
169
|
+
sender: string;
|
|
170
|
+
condition: Condition | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* cloid is an optional client-supplied identifier for the conditional
|
|
173
|
+
* parent. It remains associated with the executable order after activation.
|
|
174
|
+
*/
|
|
175
|
+
cloid: Uint8Array;
|
|
176
|
+
limit?: MsgPlaceLimitOrder | undefined;
|
|
177
|
+
market?: MsgPlaceMarketOrder | undefined;
|
|
178
|
+
}
|
|
179
|
+
export interface MsgPlaceConditionalOrderResponse {
|
|
180
|
+
orderId: Uint8Array;
|
|
181
|
+
cloid: Uint8Array;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* ModifyConditionalOrder re-specifies a single pending conditional order in
|
|
185
|
+
* place. The order_id and cloid are preserved; the condition fully replaces
|
|
186
|
+
* the trigger, deadline, and executable payload.
|
|
187
|
+
*/
|
|
188
|
+
export interface ModifyConditionalOrder {
|
|
189
|
+
/** order_id is the conditional order's id or the sender's cloid for it. */
|
|
190
|
+
orderId: Uint8Array;
|
|
191
|
+
condition: Condition | undefined;
|
|
192
|
+
limit?: MsgPlaceLimitOrder | undefined;
|
|
193
|
+
market?: MsgPlaceMarketOrder | undefined;
|
|
194
|
+
}
|
|
195
|
+
export interface MsgModifyConditionalOrders {
|
|
196
|
+
sender: string;
|
|
197
|
+
orders: ModifyConditionalOrder[];
|
|
198
|
+
}
|
|
199
|
+
export interface MsgModifyConditionalOrdersResponse {
|
|
200
|
+
succeeded: ModifyConditionalOrderResult[];
|
|
201
|
+
failed: Uint8Array[];
|
|
202
|
+
}
|
|
203
|
+
export interface ModifyConditionalOrderResult {
|
|
204
|
+
orderId: Uint8Array;
|
|
205
|
+
cloid: Uint8Array;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* OrderLeg is one order of a group: a new order to place, or for the primary
|
|
209
|
+
* leg, an existing resting order with no fills.
|
|
210
|
+
*/
|
|
211
|
+
export interface OrderLeg {
|
|
212
|
+
limit?: MsgPlaceLimitOrder | undefined;
|
|
213
|
+
market?: MsgPlaceMarketOrder | undefined;
|
|
214
|
+
conditional?: MsgPlaceConditionalOrder | undefined;
|
|
215
|
+
/** existing_order_id is the order id or the sender's cloid for it. */
|
|
216
|
+
existingOrderId?: Uint8Array | undefined;
|
|
217
|
+
}
|
|
218
|
+
export interface MsgPlaceGroupOrder {
|
|
219
|
+
sender: string;
|
|
220
|
+
marketId: Uint8Array;
|
|
221
|
+
groupType: OrderGroupType;
|
|
222
|
+
/**
|
|
223
|
+
* primary is the OCO's first leg or the OTO/OTOCO entry. The legs are
|
|
224
|
+
* separate fields rather than a list: EIP-712 types a list by its first
|
|
225
|
+
* element, and legs differ in kind.
|
|
226
|
+
*/
|
|
227
|
+
primary: OrderLeg | undefined;
|
|
228
|
+
/** secondary is the OCO's second leg or the OTO/OTOCO's first exit. */
|
|
229
|
+
secondary: OrderLeg | undefined;
|
|
230
|
+
/** tertiary is the OTOCO's second exit; unset otherwise. */
|
|
231
|
+
tertiary: OrderLeg | undefined;
|
|
232
|
+
}
|
|
233
|
+
export interface MsgPlaceGroupOrderResponse {
|
|
234
|
+
/** legs are in request order. */
|
|
235
|
+
legs: GroupOrderLegResult[];
|
|
236
|
+
}
|
|
237
|
+
export interface GroupOrderLegResult {
|
|
238
|
+
orderId: Uint8Array;
|
|
239
|
+
cloid: Uint8Array;
|
|
240
|
+
}
|
|
162
241
|
export declare const MsgPlaceLimitOrder: MessageFns<MsgPlaceLimitOrder>;
|
|
163
242
|
export declare const MsgPlaceLimitOrderResponse: MessageFns<MsgPlaceLimitOrderResponse>;
|
|
164
243
|
export declare const MsgPlaceMarketOrder: MessageFns<MsgPlaceMarketOrder>;
|
|
@@ -176,6 +255,16 @@ export declare const MsgPlaceScaleOrderResponse: MessageFns<MsgPlaceScaleOrderRe
|
|
|
176
255
|
export declare const ScaleOrderResult: MessageFns<ScaleOrderResult>;
|
|
177
256
|
export declare const MsgUpdateParams: MessageFns<MsgUpdateParams>;
|
|
178
257
|
export declare const MsgUpdateParamsResponse: MessageFns<MsgUpdateParamsResponse>;
|
|
258
|
+
export declare const MsgPlaceConditionalOrder: MessageFns<MsgPlaceConditionalOrder>;
|
|
259
|
+
export declare const MsgPlaceConditionalOrderResponse: MessageFns<MsgPlaceConditionalOrderResponse>;
|
|
260
|
+
export declare const ModifyConditionalOrder: MessageFns<ModifyConditionalOrder>;
|
|
261
|
+
export declare const MsgModifyConditionalOrders: MessageFns<MsgModifyConditionalOrders>;
|
|
262
|
+
export declare const MsgModifyConditionalOrdersResponse: MessageFns<MsgModifyConditionalOrdersResponse>;
|
|
263
|
+
export declare const ModifyConditionalOrderResult: MessageFns<ModifyConditionalOrderResult>;
|
|
264
|
+
export declare const OrderLeg: MessageFns<OrderLeg>;
|
|
265
|
+
export declare const MsgPlaceGroupOrder: MessageFns<MsgPlaceGroupOrder>;
|
|
266
|
+
export declare const MsgPlaceGroupOrderResponse: MessageFns<MsgPlaceGroupOrderResponse>;
|
|
267
|
+
export declare const GroupOrderLegResult: MessageFns<GroupOrderLegResult>;
|
|
179
268
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
180
269
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
181
270
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -19,6 +19,8 @@ export interface Params {
|
|
|
19
19
|
withdrawCollateralOracleChecks: number;
|
|
20
20
|
/** Oracle checks applied when liquidating. */
|
|
21
21
|
liquidationOracleChecks: number;
|
|
22
|
+
/** Oracle checks applied when settling margin fills. */
|
|
23
|
+
marginSettlementOracleChecks: number;
|
|
22
24
|
}
|
|
23
25
|
export declare const Params: MessageFns<Params>;
|
|
24
26
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
@@ -1,49 +1,26 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
3
|
-
import { MarginOrderState
|
|
3
|
+
import { MarginOrderState } from "./margin";
|
|
4
4
|
import { Params } from "./params";
|
|
5
5
|
export declare const protobufPackage = "ault.margin.v1";
|
|
6
|
-
/**
|
|
7
|
-
* GenesisState defines the margin module's genesis state. It carries every one
|
|
8
|
-
* of the module's six collections, because all of them are consensus state
|
|
9
|
-
* and an export that dropped any of them would restore a chain that has
|
|
10
|
-
* forgotten which collateral is reserved, what it still owes a filled order, or
|
|
11
|
-
* which lending pool backs it.
|
|
12
|
-
*/
|
|
6
|
+
/** GenesisState defines the margin module's genesis state. */
|
|
13
7
|
export interface GenesisState {
|
|
14
8
|
/** params defines the module parameters at genesis. */
|
|
15
9
|
params: Params | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* margin_lending_pool_id is the x/lending pool that backs every margin
|
|
18
|
-
* account. It is set here rather than moved by MsgSetMarginLendingPool on the
|
|
19
|
-
* normal path, and cannot be validated at import: pool ids start at 0, so
|
|
20
|
-
* every value is syntactically legal, and existence is a question for
|
|
21
|
-
* x/lending, which need not be populated when this module's InitGenesis runs.
|
|
22
|
-
*/
|
|
23
|
-
marginLendingPoolId: bigint;
|
|
24
|
-
/**
|
|
25
|
-
* enabled_markets is the list of market ids enabled for margin trading. The
|
|
26
|
-
* collection is a key set, so the market id is the whole entry.
|
|
27
|
-
*/
|
|
10
|
+
/** enabled_markets is the list of market ids enabled for margin trading. */
|
|
28
11
|
enabledMarkets: Uint8Array[];
|
|
29
|
-
/**
|
|
30
|
-
* collaterals_in_order is the reservation ledger and the registration record:
|
|
31
|
-
* an entry with no coins carries the registration alone and must be exported.
|
|
32
|
-
*/
|
|
12
|
+
/** collaterals_in_order is the reservation ledger. */
|
|
33
13
|
collateralsInOrder: CollateralsInOrderEntry[];
|
|
34
14
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* to the export.
|
|
15
|
+
* margin_lending_pool_id is the x/lending pool that backs every margin
|
|
16
|
+
* account. It is set here or once by MsgInitializeMarginPool. It cannot be
|
|
17
|
+
* validated at import because x/lending need not be populated yet.
|
|
39
18
|
*/
|
|
40
|
-
|
|
19
|
+
marginLendingPoolId: bigint;
|
|
41
20
|
/**
|
|
42
21
|
* margin_order_states is the per-order funding record of every margin order
|
|
43
22
|
* that departs from the default, keyed by the account holding it and the
|
|
44
|
-
* order id.
|
|
45
|
-
* default, so an order that asked to repay at cancel would not, and one that
|
|
46
|
-
* borrowed would look as though it had not.
|
|
23
|
+
* order id.
|
|
47
24
|
*/
|
|
48
25
|
marginOrderStates: MarginOrderStateEntry[];
|
|
49
26
|
}
|
|
@@ -54,21 +31,7 @@ export interface CollateralsInOrderEntry {
|
|
|
54
31
|
/** coins is the collateral the account has committed to resting orders. */
|
|
55
32
|
coins: Coin[];
|
|
56
33
|
}
|
|
57
|
-
/**
|
|
58
|
-
* PendingSettlementEntry is one PendingSettlements record with its key. The key
|
|
59
|
-
* is the order id the proceeds belong to, which the record does not carry.
|
|
60
|
-
*/
|
|
61
|
-
export interface PendingSettlementEntry {
|
|
62
|
-
/** order_id is the x/clob order the proceeds came from. */
|
|
63
|
-
orderId: Uint8Array;
|
|
64
|
-
/** settlement is the proceeds awaiting credit. */
|
|
65
|
-
settlement: PendingSettlement | undefined;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* MarginOrderStateEntry is one MarginOrderStates record with its key. The key
|
|
69
|
-
* is a pair, the holding account and the order id, and the record carries
|
|
70
|
-
* neither.
|
|
71
|
-
*/
|
|
34
|
+
/** MarginOrderStateEntry is one MarginOrderStates record with its key. */
|
|
72
35
|
export interface MarginOrderStateEntry {
|
|
73
36
|
/** address is the margin account holding the order. */
|
|
74
37
|
address: string;
|
|
@@ -79,7 +42,6 @@ export interface MarginOrderStateEntry {
|
|
|
79
42
|
}
|
|
80
43
|
export declare const GenesisState: MessageFns<GenesisState>;
|
|
81
44
|
export declare const CollateralsInOrderEntry: MessageFns<CollateralsInOrderEntry>;
|
|
82
|
-
export declare const PendingSettlementEntry: MessageFns<PendingSettlementEntry>;
|
|
83
45
|
export declare const MarginOrderStateEntry: MessageFns<MarginOrderStateEntry>;
|
|
84
46
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
85
47
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
@@ -6,10 +6,8 @@ export declare const protobufPackage = "ault.margin.v1";
|
|
|
6
6
|
* order. It is packed into an x/clob place message's funding field; when that
|
|
7
7
|
* field is absent the order uses the normal bank-backed spot escrow path.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* through EIP-712. A oneof, or a nullable message field forced to emit, would
|
|
12
|
-
* render as JSON null and be rejected before signing.
|
|
9
|
+
* Keep the fields flat scalars: a oneof or nullable message field renders as
|
|
10
|
+
* JSON null and is rejected when signing through EIP-712.
|
|
13
11
|
*/
|
|
14
12
|
export interface MarginOptions {
|
|
15
13
|
/**
|
|
@@ -22,26 +20,14 @@ export interface MarginOptions {
|
|
|
22
20
|
* the account's uncommitted collateral to be borrowed from the lending pool.
|
|
23
21
|
*/
|
|
24
22
|
autoBorrow: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* AUTO_REPAY: apply this order's fill proceeds to same-denom debt. Leaving it
|
|
27
|
-
* unset keeps the liability, and so keeps the account's health lower and
|
|
28
|
-
* interest running on both sides, until something else repays it.
|
|
29
|
-
*/
|
|
23
|
+
/** auto_repay applies this order's fill proceeds to same-denom debt. */
|
|
30
24
|
autoRepay: boolean;
|
|
31
25
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* autoRepayAtCancel defaults to true, deliberately, so that a cancel does not
|
|
35
|
-
* silently unwind a borrow the user wanted to keep: frequent cancels and an
|
|
36
|
-
* oracle outage, during which borrowing is refused while repaying is not,
|
|
37
|
-
* both produce exactly that.
|
|
26
|
+
* auto_repay_at_cancel repays this order's borrow when its owner cancels or
|
|
27
|
+
* shrinks it, or a liquidation force-cancels it.
|
|
38
28
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* encoder then refuses the whole message with "field auto_repay_at_cancel
|
|
42
|
-
* within a oneof must have the amino.oneof_type_name option set", which makes
|
|
43
|
-
* every margin order unsignable through EIP-712, not only one setting the
|
|
44
|
-
* flag.
|
|
29
|
+
* Must stay a plain bool: proto3 optional becomes a synthetic oneof, which
|
|
30
|
+
* amino JSON rejects, making every margin order unsignable through EIP-712.
|
|
45
31
|
*/
|
|
46
32
|
autoRepayAtCancel: boolean;
|
|
47
33
|
}
|
|
@@ -53,62 +39,26 @@ export interface CollateralsInOrder {
|
|
|
53
39
|
coins: Coin[];
|
|
54
40
|
}
|
|
55
41
|
/**
|
|
56
|
-
* MarginOrderState is the per-order
|
|
57
|
-
*
|
|
58
|
-
* much the placement borrowed, which bounds what a cancel may repay. A missing
|
|
59
|
-
* row means {auto_repay: false, auto_repay_at_cancel: false, borrowed: 0}, so
|
|
60
|
-
* only an order departing from that default carries one.
|
|
42
|
+
* MarginOrderState is the per-order funding record. A missing row means the
|
|
43
|
+
* default of no auto repay and nothing borrowed.
|
|
61
44
|
*/
|
|
62
45
|
export interface MarginOrderState {
|
|
63
46
|
/** auto_repay applies the order's fill proceeds to same-denom debt. */
|
|
64
47
|
autoRepay: boolean;
|
|
65
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* auto_repay_at_cancel repays on an owner cancel or shrink, or a
|
|
50
|
+
* liquidation's forced cancel.
|
|
51
|
+
*/
|
|
66
52
|
autoRepayAtCancel: boolean;
|
|
67
53
|
/**
|
|
68
54
|
* borrowed is what this order still owes on the borrow its placement opened,
|
|
69
|
-
* and the cap a cancel or
|
|
70
|
-
* decrements it by what it actually cleared, so the same order cannot repay
|
|
71
|
-
* one borrow twice across successive shrinks.
|
|
55
|
+
* and the cap on what a cancel or shrink may repay.
|
|
72
56
|
*/
|
|
73
57
|
borrowed: Coin | undefined;
|
|
74
58
|
}
|
|
75
|
-
/**
|
|
76
|
-
* PendingSettlement records a margin order's fill proceeds that must be
|
|
77
|
-
* credited back as collateral after matching completes. Crediting is deferred
|
|
78
|
-
* to the EndBlocker so that every order in the block has first delivered its
|
|
79
|
-
* consumed pay into the market escrow, otherwise a margin maker settling before
|
|
80
|
-
* its margin taker would try to draw proceeds the escrow does not yet hold.
|
|
81
|
-
*/
|
|
82
|
-
export interface PendingSettlement {
|
|
83
|
-
/** escrow_address is the market escrow the proceeds are drawn from. */
|
|
84
|
-
escrowAddress: Uint8Array;
|
|
85
|
-
/** orderer is the margin account that receives the proceeds. */
|
|
86
|
-
orderer: Uint8Array;
|
|
87
|
-
/** payout is the fill proceeds to credit as collateral. */
|
|
88
|
-
payout: Coin | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* pool_id is the lending pool the fill was funded from, recorded rather than
|
|
91
|
-
* re-read at drain time. The two always agree on a running chain, where
|
|
92
|
-
* SetMarginLendingPool refuses to move away from a pool that still has an
|
|
93
|
-
* entry queued against it. A genesis import can carry these rows anyway, so
|
|
94
|
-
* the two can differ; reading the configured pool at drain time would then
|
|
95
|
-
* credit the proceeds into a pool that never received the consumed pay and
|
|
96
|
-
* repay debt there against a borrow taken in the old pool.
|
|
97
|
-
*/
|
|
98
|
-
poolId: bigint;
|
|
99
|
-
/**
|
|
100
|
-
* auto_repay is the placing order's flag, copied here at fill time. The
|
|
101
|
-
* per-order row it comes from is deleted by ReleaseOnClose when x/clob closes
|
|
102
|
-
* a fully filled order, which happens inside x/clob's EndBlocker, before
|
|
103
|
-
* x/margin's drains this queue; reading the row at drain time would therefore
|
|
104
|
-
* find nothing for exactly the orders that filled completely.
|
|
105
|
-
*/
|
|
106
|
-
autoRepay: boolean;
|
|
107
|
-
}
|
|
108
59
|
export declare const MarginOptions: MessageFns<MarginOptions>;
|
|
109
60
|
export declare const CollateralsInOrder: MessageFns<CollateralsInOrder>;
|
|
110
61
|
export declare const MarginOrderState: MessageFns<MarginOrderState>;
|
|
111
|
-
export declare const PendingSettlement: MessageFns<PendingSettlement>;
|
|
112
62
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
113
63
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
114
64
|
[K in keyof T]?: DeepPartial<T[K]>;
|