@lifi/perps-types 0.1.1-alpha.2 → 0.1.1-alpha.22
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/package.json +40 -10
- package/providers/hyperliquid/package.json +3 -3
- package/providers/lighter/package.json +5 -0
- package/src/_cjs/{market.js → action.js} +1 -1
- package/src/_cjs/action.js.map +1 -0
- package/src/_cjs/{trading.js → asset.js} +1 -1
- package/src/_cjs/asset.js.map +1 -0
- package/src/_cjs/enums.js +78 -15
- package/src/_cjs/enums.js.map +1 -1
- package/src/_cjs/index.js +3 -4
- package/src/_cjs/index.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/assetId.js +11 -9
- package/src/_cjs/providers/hyperliquid/assetId.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/mappers/activity.js +66 -0
- package/src/_cjs/providers/hyperliquid/mappers/activity.js.map +1 -0
- package/src/_cjs/providers/hyperliquid/mappers/{market.js → asset.js} +9 -9
- package/src/_cjs/providers/hyperliquid/mappers/asset.js.map +1 -0
- package/src/_cjs/providers/hyperliquid/mappers/fill.js +64 -0
- package/src/_cjs/providers/hyperliquid/mappers/fill.js.map +1 -0
- package/src/_cjs/providers/hyperliquid/mappers/index.js +12 -7
- package/src/_cjs/providers/hyperliquid/mappers/index.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/mappers/order.js +59 -10
- package/src/_cjs/providers/hyperliquid/mappers/order.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/mappers/position.js +7 -5
- package/src/_cjs/providers/hyperliquid/mappers/position.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/mappers/shared.js +0 -10
- package/src/_cjs/providers/hyperliquid/mappers/shared.js.map +1 -1
- package/src/_cjs/providers/hyperliquid/types.js +14 -0
- package/src/_cjs/providers/hyperliquid/types.js.map +1 -1
- package/src/_cjs/{authorization.js → providers/lighter/apiTypes.js} +1 -1
- package/src/_cjs/providers/lighter/apiTypes.js.map +1 -0
- package/src/_cjs/providers/lighter/index.js +20 -0
- package/src/_cjs/providers/lighter/index.js.map +1 -0
- package/src/_cjs/providers/lighter/mappers/fill.js +28 -0
- package/src/_cjs/providers/lighter/mappers/fill.js.map +1 -0
- package/src/_cjs/providers/lighter/mappers/index.js +10 -0
- package/src/_cjs/providers/lighter/mappers/index.js.map +1 -0
- package/src/_cjs/providers/lighter/mappers/order.js +33 -0
- package/src/_cjs/providers/lighter/mappers/order.js.map +1 -0
- package/src/_cjs/providers/lighter/mappers/position.js +33 -0
- package/src/_cjs/providers/lighter/mappers/position.js.map +1 -0
- package/src/_cjs/providers/lighter/types.js +23 -0
- package/src/_cjs/providers/lighter/types.js.map +1 -0
- package/src/_cjs/{withdrawal.js → providers.js} +1 -1
- package/src/_cjs/providers.js.map +1 -0
- package/src/_esm/action.js +2 -0
- package/src/_esm/action.js.map +1 -0
- package/src/_esm/asset.js +2 -0
- package/src/_esm/asset.js.map +1 -0
- package/src/_esm/enums.js +77 -14
- package/src/_esm/enums.js.map +1 -1
- package/src/_esm/index.js +3 -4
- package/src/_esm/index.js.map +1 -1
- package/src/_esm/providers/hyperliquid/assetId.js +13 -11
- package/src/_esm/providers/hyperliquid/assetId.js.map +1 -1
- package/src/_esm/providers/hyperliquid/mappers/activity.js +69 -0
- package/src/_esm/providers/hyperliquid/mappers/activity.js.map +1 -0
- package/src/_esm/providers/hyperliquid/mappers/{market.js → asset.js} +7 -7
- package/src/_esm/providers/hyperliquid/mappers/asset.js.map +1 -0
- package/src/_esm/providers/hyperliquid/mappers/fill.js +62 -0
- package/src/_esm/providers/hyperliquid/mappers/fill.js.map +1 -0
- package/src/_esm/providers/hyperliquid/mappers/index.js +4 -4
- package/src/_esm/providers/hyperliquid/mappers/index.js.map +1 -1
- package/src/_esm/providers/hyperliquid/mappers/order.js +56 -9
- package/src/_esm/providers/hyperliquid/mappers/order.js.map +1 -1
- package/src/_esm/providers/hyperliquid/mappers/position.js +7 -5
- package/src/_esm/providers/hyperliquid/mappers/position.js.map +1 -1
- package/src/_esm/providers/hyperliquid/mappers/shared.js +1 -12
- package/src/_esm/providers/hyperliquid/mappers/shared.js.map +1 -1
- package/src/_esm/providers/hyperliquid/types.js +22 -2
- package/src/_esm/providers/hyperliquid/types.js.map +1 -1
- package/src/_esm/providers/lighter/apiTypes.js +5 -0
- package/src/_esm/providers/lighter/apiTypes.js.map +1 -0
- package/src/_esm/providers/lighter/index.js +4 -0
- package/src/_esm/providers/lighter/index.js.map +1 -0
- package/src/_esm/providers/lighter/mappers/fill.js +30 -0
- package/src/_esm/providers/lighter/mappers/fill.js.map +1 -0
- package/src/_esm/providers/lighter/mappers/index.js +4 -0
- package/src/_esm/providers/lighter/mappers/index.js.map +1 -0
- package/src/_esm/providers/lighter/mappers/order.js +34 -0
- package/src/_esm/providers/lighter/mappers/order.js.map +1 -0
- package/src/_esm/providers/lighter/mappers/position.js +34 -0
- package/src/_esm/providers/lighter/mappers/position.js.map +1 -0
- package/src/_esm/providers/lighter/types.js +30 -0
- package/src/_esm/providers/lighter/types.js.map +1 -0
- package/src/_esm/providers.js +2 -0
- package/src/_esm/providers.js.map +1 -0
- package/src/_types/account.d.ts +73 -18
- package/src/_types/account.d.ts.map +1 -1
- package/src/_types/action.d.ts +181 -0
- package/src/_types/action.d.ts.map +1 -0
- package/src/_types/{market.d.ts → asset.d.ts} +23 -34
- package/src/_types/asset.d.ts.map +1 -0
- package/src/_types/enums.d.ts +62 -5
- package/src/_types/enums.d.ts.map +1 -1
- package/src/_types/index.d.ts +3 -4
- package/src/_types/index.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/assetId.d.ts +8 -6
- package/src/_types/providers/hyperliquid/assetId.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/mappers/activity.d.ts +13 -0
- package/src/_types/providers/hyperliquid/mappers/activity.d.ts.map +1 -0
- package/src/_types/providers/hyperliquid/mappers/asset.d.ts +4 -0
- package/src/_types/providers/hyperliquid/mappers/asset.d.ts.map +1 -0
- package/src/_types/providers/hyperliquid/mappers/fill.d.ts +6 -0
- package/src/_types/providers/hyperliquid/mappers/fill.d.ts.map +1 -0
- package/src/_types/providers/hyperliquid/mappers/index.d.ts +4 -4
- package/src/_types/providers/hyperliquid/mappers/index.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/mappers/order.d.ts +8 -3
- package/src/_types/providers/hyperliquid/mappers/order.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/mappers/position.d.ts +1 -1
- package/src/_types/providers/hyperliquid/mappers/position.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/mappers/shared.d.ts +0 -6
- package/src/_types/providers/hyperliquid/mappers/shared.d.ts.map +1 -1
- package/src/_types/providers/hyperliquid/types.d.ts +63 -11
- package/src/_types/providers/hyperliquid/types.d.ts.map +1 -1
- package/src/_types/providers/lighter/apiTypes.d.ts +74 -0
- package/src/_types/providers/lighter/apiTypes.d.ts.map +1 -0
- package/src/_types/providers/lighter/index.d.ts +4 -0
- package/src/_types/providers/lighter/index.d.ts.map +1 -0
- package/src/_types/providers/lighter/mappers/fill.d.ts +10 -0
- package/src/_types/providers/lighter/mappers/fill.d.ts.map +1 -0
- package/src/_types/providers/lighter/mappers/index.d.ts +4 -0
- package/src/_types/providers/lighter/mappers/index.d.ts.map +1 -0
- package/src/_types/providers/lighter/mappers/order.d.ts +9 -0
- package/src/_types/providers/lighter/mappers/order.d.ts.map +1 -0
- package/src/_types/providers/lighter/mappers/position.d.ts +9 -0
- package/src/_types/providers/lighter/mappers/position.d.ts.map +1 -0
- package/src/_types/providers/lighter/types.d.ts +90 -0
- package/src/_types/providers/lighter/types.d.ts.map +1 -0
- package/src/_types/providers.d.ts +23 -0
- package/src/_types/providers.d.ts.map +1 -0
- package/src/_types/subscriptions.d.ts +24 -18
- package/src/_types/subscriptions.d.ts.map +1 -1
- package/src/_types/typedData.d.ts +13 -5
- package/src/_types/typedData.d.ts.map +1 -1
- package/src/account.ts +94 -18
- package/src/action.ts +246 -0
- package/src/asset.ts +88 -0
- package/src/enums.ts +72 -3
- package/src/index.ts +3 -4
- package/src/providers/hyperliquid/assetId.ts +18 -12
- package/src/providers/hyperliquid/mappers/activity.ts +94 -0
- package/src/providers/hyperliquid/mappers/{market.ts → asset.ts} +9 -12
- package/src/providers/hyperliquid/mappers/fill.ts +77 -0
- package/src/providers/hyperliquid/mappers/index.ts +10 -4
- package/src/providers/hyperliquid/mappers/order.ts +62 -15
- package/src/providers/hyperliquid/mappers/position.ts +7 -10
- package/src/providers/hyperliquid/mappers/shared.ts +0 -15
- package/src/providers/hyperliquid/types.ts +127 -20
- package/src/providers/lighter/apiTypes.ts +80 -0
- package/src/providers/lighter/index.ts +3 -0
- package/src/providers/lighter/mappers/fill.ts +45 -0
- package/src/providers/lighter/mappers/index.ts +3 -0
- package/src/providers/lighter/mappers/order.ts +37 -0
- package/src/providers/lighter/mappers/position.ts +43 -0
- package/src/providers/lighter/types.ts +115 -0
- package/src/providers.ts +26 -0
- package/src/subscriptions.ts +22 -20
- package/src/typedData.ts +15 -5
- package/src/_cjs/authorization.js.map +0 -1
- package/src/_cjs/market.js.map +0 -1
- package/src/_cjs/providers/hyperliquid/mappers/history.js +0 -22
- package/src/_cjs/providers/hyperliquid/mappers/history.js.map +0 -1
- package/src/_cjs/providers/hyperliquid/mappers/market.js.map +0 -1
- package/src/_cjs/trading.js.map +0 -1
- package/src/_cjs/withdrawal.js.map +0 -1
- package/src/_esm/authorization.js +0 -2
- package/src/_esm/authorization.js.map +0 -1
- package/src/_esm/market.js +0 -2
- package/src/_esm/market.js.map +0 -1
- package/src/_esm/providers/hyperliquid/mappers/history.js +0 -18
- package/src/_esm/providers/hyperliquid/mappers/history.js.map +0 -1
- package/src/_esm/providers/hyperliquid/mappers/market.js.map +0 -1
- package/src/_esm/trading.js +0 -2
- package/src/_esm/trading.js.map +0 -1
- package/src/_esm/withdrawal.js +0 -2
- package/src/_esm/withdrawal.js.map +0 -1
- package/src/_types/authorization.d.ts +0 -39
- package/src/_types/authorization.d.ts.map +0 -1
- package/src/_types/market.d.ts.map +0 -1
- package/src/_types/providers/hyperliquid/mappers/history.d.ts +0 -4
- package/src/_types/providers/hyperliquid/mappers/history.d.ts.map +0 -1
- package/src/_types/providers/hyperliquid/mappers/market.d.ts +0 -4
- package/src/_types/providers/hyperliquid/mappers/market.d.ts.map +0 -1
- package/src/_types/trading.d.ts +0 -82
- package/src/_types/trading.d.ts.map +0 -1
- package/src/_types/withdrawal.d.ts +0 -37
- package/src/_types/withdrawal.d.ts.map +0 -1
- package/src/authorization.ts +0 -46
- package/src/market.ts +0 -97
- package/src/providers/hyperliquid/mappers/history.ts +0 -25
- package/src/trading.ts +0 -99
- package/src/withdrawal.ts +0 -44
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { OrderType } from './enums.js';
|
|
2
|
+
import { type ActionType, type OrderSide, type OrderStatus, type TimeInForce, type TriggerCondition } from './enums.js';
|
|
3
|
+
import type { Address, Hex, PerpsTypedData } from './typedData.js';
|
|
4
|
+
import type { AssetIdentity, AssetDisplay } from './asset.js';
|
|
5
|
+
export interface Eip712ActionStep {
|
|
6
|
+
action: ActionType;
|
|
7
|
+
typedData: PerpsTypedData;
|
|
8
|
+
}
|
|
9
|
+
export interface WasmBlobActionStep {
|
|
10
|
+
action: ActionType;
|
|
11
|
+
wasmSignParams: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface EvmTxActionStep {
|
|
14
|
+
action: ActionType;
|
|
15
|
+
txParams: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export type ActionStep = Eip712ActionStep | WasmBlobActionStep | EvmTxActionStep;
|
|
18
|
+
export interface Eip712SignedActionStep {
|
|
19
|
+
action: ActionType;
|
|
20
|
+
typedData: PerpsTypedData;
|
|
21
|
+
signature: Hex;
|
|
22
|
+
}
|
|
23
|
+
export interface WasmBlobSignedActionStep {
|
|
24
|
+
action: ActionType;
|
|
25
|
+
wasmSignParams: Record<string, unknown>;
|
|
26
|
+
signedTx: {
|
|
27
|
+
txType: number;
|
|
28
|
+
txInfo: string;
|
|
29
|
+
txHash: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface EvmTxSignedActionStep {
|
|
33
|
+
action: ActionType;
|
|
34
|
+
txParams: Record<string, unknown>;
|
|
35
|
+
txHash: string;
|
|
36
|
+
}
|
|
37
|
+
export type SignedActionStep = Eip712SignedActionStep | WasmBlobSignedActionStep | EvmTxSignedActionStep;
|
|
38
|
+
export interface ActionResult {
|
|
39
|
+
action: ActionType;
|
|
40
|
+
success: boolean;
|
|
41
|
+
orderId?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface TriggerOrderInput {
|
|
45
|
+
triggerPrice: string;
|
|
46
|
+
limitPrice?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ModifyOrderInput {
|
|
49
|
+
id: string;
|
|
50
|
+
price?: string;
|
|
51
|
+
size?: string;
|
|
52
|
+
triggerPrice?: string;
|
|
53
|
+
limitPrice?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface Order {
|
|
56
|
+
orderId: string;
|
|
57
|
+
asset: AssetDisplay;
|
|
58
|
+
side: OrderSide;
|
|
59
|
+
type: OrderType;
|
|
60
|
+
price?: string;
|
|
61
|
+
originalSize: string;
|
|
62
|
+
remainingSize: string;
|
|
63
|
+
filledSize: string;
|
|
64
|
+
timeInForce?: TimeInForce;
|
|
65
|
+
expiresAt?: string;
|
|
66
|
+
reduceOnly?: boolean;
|
|
67
|
+
isTrigger?: boolean;
|
|
68
|
+
triggerPrice?: string;
|
|
69
|
+
triggerCondition?: TriggerCondition;
|
|
70
|
+
status: OrderStatus;
|
|
71
|
+
averagePrice?: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
}
|
|
75
|
+
export interface PlaceOrderParams {
|
|
76
|
+
asset: AssetIdentity;
|
|
77
|
+
side: OrderSide;
|
|
78
|
+
type?: OrderType;
|
|
79
|
+
size: string;
|
|
80
|
+
price?: string;
|
|
81
|
+
leverage?: number;
|
|
82
|
+
reduceOnly?: boolean;
|
|
83
|
+
timeInForce?: TimeInForce;
|
|
84
|
+
expiresAt?: string;
|
|
85
|
+
takeProfit?: TriggerOrderInput;
|
|
86
|
+
stopLoss?: TriggerOrderInput;
|
|
87
|
+
}
|
|
88
|
+
export interface PlaceTriggerOrderParams {
|
|
89
|
+
asset: AssetIdentity;
|
|
90
|
+
side: OrderSide;
|
|
91
|
+
takeProfit?: TriggerOrderInput;
|
|
92
|
+
stopLoss?: TriggerOrderInput;
|
|
93
|
+
}
|
|
94
|
+
export interface CancelOrderParams {
|
|
95
|
+
ids: string[];
|
|
96
|
+
}
|
|
97
|
+
export interface ModifyOrderParams {
|
|
98
|
+
modifications: ModifyOrderInput[];
|
|
99
|
+
}
|
|
100
|
+
export interface UpdateLeverageParams {
|
|
101
|
+
asset: AssetIdentity;
|
|
102
|
+
leverage: number;
|
|
103
|
+
}
|
|
104
|
+
export interface UpdatePositionMarginParams {
|
|
105
|
+
asset: AssetIdentity;
|
|
106
|
+
action: 'add' | 'remove';
|
|
107
|
+
amount: string;
|
|
108
|
+
}
|
|
109
|
+
export interface WithdrawalParams {
|
|
110
|
+
destination: Address;
|
|
111
|
+
amount: string;
|
|
112
|
+
}
|
|
113
|
+
export interface DepositParams {
|
|
114
|
+
/** Amount of the token to deposit (human-readable, e.g. "100.5"). */
|
|
115
|
+
amount: string;
|
|
116
|
+
/** ERC-20 token address on the source chain. */
|
|
117
|
+
tokenAddress: Address;
|
|
118
|
+
/** Chain ID of the source chain (e.g. 1 for Ethereum, 42161 for Arbitrum). */
|
|
119
|
+
chainId: number;
|
|
120
|
+
}
|
|
121
|
+
export interface ApproveAgentParams {
|
|
122
|
+
agentAddress: string;
|
|
123
|
+
agentTtlMs?: number;
|
|
124
|
+
}
|
|
125
|
+
export interface SetAbstractionParams {
|
|
126
|
+
abstraction?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface SendAssetParams {
|
|
129
|
+
collateral: string;
|
|
130
|
+
sourceDex: string;
|
|
131
|
+
destinationDex: string;
|
|
132
|
+
amount: string;
|
|
133
|
+
}
|
|
134
|
+
export interface CancelAllOrdersParams {
|
|
135
|
+
/** 0=immediate (cancel GTC), 1=scheduled, 2=abort scheduled */
|
|
136
|
+
timeInForce: number;
|
|
137
|
+
/** Unix timestamp in milliseconds (required for scheduled cancels) */
|
|
138
|
+
timestampMs?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface RegisterApiKeyParams {
|
|
141
|
+
/** The API key slot index to register (0-255). Reusing a fixed slot overwrites the old key. */
|
|
142
|
+
apiKeyIndex: number;
|
|
143
|
+
}
|
|
144
|
+
export interface ActionParamsMap {
|
|
145
|
+
[ActionType.APPROVE_AGENT]: ApproveAgentParams;
|
|
146
|
+
[ActionType.APPROVE_BUILDER_FEE]: Record<string, never>;
|
|
147
|
+
[ActionType.USER_SET_ABSTRACTION]: SetAbstractionParams;
|
|
148
|
+
[ActionType.AGENT_SET_ABSTRACTION]: SetAbstractionParams;
|
|
149
|
+
[ActionType.SEND_ASSET]: SendAssetParams;
|
|
150
|
+
[ActionType.WITHDRAWAL]: WithdrawalParams;
|
|
151
|
+
[ActionType.PLACE_ORDER]: PlaceOrderParams;
|
|
152
|
+
[ActionType.PLACE_TRIGGER_ORDER]: PlaceTriggerOrderParams;
|
|
153
|
+
[ActionType.CANCEL_ORDER]: CancelOrderParams;
|
|
154
|
+
[ActionType.CANCEL_ALL_ORDERS]: CancelAllOrdersParams;
|
|
155
|
+
[ActionType.MODIFY_ORDER]: ModifyOrderParams;
|
|
156
|
+
[ActionType.UPDATE_LEVERAGE]: UpdateLeverageParams;
|
|
157
|
+
[ActionType.UPDATE_POSITION_MARGIN]: UpdatePositionMarginParams;
|
|
158
|
+
[ActionType.REGISTER_API_KEY]: RegisterApiKeyParams;
|
|
159
|
+
[ActionType.DEPOSIT]: DepositParams;
|
|
160
|
+
}
|
|
161
|
+
export interface CreateActionRequest {
|
|
162
|
+
provider: string;
|
|
163
|
+
address: Address;
|
|
164
|
+
signerAddress?: Address;
|
|
165
|
+
action: ActionType;
|
|
166
|
+
params: ActionParamsMap[ActionType];
|
|
167
|
+
}
|
|
168
|
+
export interface CreateActionResponse {
|
|
169
|
+
actions: ActionStep[];
|
|
170
|
+
}
|
|
171
|
+
export interface ExecuteActionRequest {
|
|
172
|
+
provider: string;
|
|
173
|
+
address: Address;
|
|
174
|
+
signerAddress?: Address;
|
|
175
|
+
action: ActionType;
|
|
176
|
+
actions: SignedActionStep[];
|
|
177
|
+
}
|
|
178
|
+
export interface ExecuteActionResponse {
|
|
179
|
+
results: ActionResult[];
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAa7D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAA;IAClB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,UAAU,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,U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,47 +1,36 @@
|
|
|
1
|
-
export interface AuthorizationParam {
|
|
2
|
-
name: string;
|
|
3
|
-
type: 'string' | 'number' | 'boolean';
|
|
4
|
-
required: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface Authorization {
|
|
7
|
-
key: string;
|
|
8
|
-
name: string;
|
|
9
|
-
params?: AuthorizationParam[];
|
|
10
|
-
}
|
|
11
|
-
export interface Dex {
|
|
12
|
-
key: string;
|
|
13
|
-
name: string;
|
|
14
|
-
logoURI: string;
|
|
15
|
-
authorizations: Authorization[];
|
|
16
|
-
extraData?: Record<string, unknown>;
|
|
17
|
-
wsUrl?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface DexesResponse {
|
|
20
|
-
dexes: Dex[];
|
|
21
|
-
}
|
|
22
1
|
export interface FundingInfo {
|
|
23
2
|
rate: string;
|
|
24
3
|
nextFundingTime: number;
|
|
25
4
|
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
export interface AssetIdentity {
|
|
6
|
+
assetId: string;
|
|
7
|
+
market: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Asset extends AssetIdentity {
|
|
10
|
+
displaySymbol: string;
|
|
11
|
+
displayQuote: string | null;
|
|
12
|
+
displayName?: string;
|
|
29
13
|
logoURI: string;
|
|
30
|
-
assetId: number;
|
|
31
|
-
dex: string;
|
|
32
14
|
szDecimals: number;
|
|
33
15
|
maxLeverage: number;
|
|
34
16
|
onlyIsolated: boolean;
|
|
17
|
+
isMarginCollateral?: boolean;
|
|
35
18
|
funding: FundingInfo;
|
|
36
19
|
openInterest?: string;
|
|
37
20
|
volume24h?: string;
|
|
21
|
+
prevDayPrice?: string;
|
|
38
22
|
markPrice: string;
|
|
39
23
|
}
|
|
40
|
-
export
|
|
41
|
-
|
|
24
|
+
export type AssetDisplay = Pick<Asset, 'assetId' | 'market' | 'displaySymbol' | 'displayQuote'>;
|
|
25
|
+
export interface AssetPrice {
|
|
26
|
+
assetId: string;
|
|
27
|
+
price: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AssetsResponse {
|
|
30
|
+
assets: Asset[];
|
|
42
31
|
}
|
|
43
32
|
export interface PricesResponse {
|
|
44
|
-
prices:
|
|
33
|
+
prices: AssetPrice[];
|
|
45
34
|
}
|
|
46
35
|
export interface Candle {
|
|
47
36
|
t: number;
|
|
@@ -52,8 +41,8 @@ export interface Candle {
|
|
|
52
41
|
v: string;
|
|
53
42
|
}
|
|
54
43
|
export interface OhlcvResponse {
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
provider: string;
|
|
45
|
+
assetId: string;
|
|
57
46
|
interval: string;
|
|
58
47
|
candles: Candle[];
|
|
59
48
|
}
|
|
@@ -63,10 +52,10 @@ export interface OrderbookLevel {
|
|
|
63
52
|
size: string;
|
|
64
53
|
}
|
|
65
54
|
export interface OrderbookResponse {
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
provider: string;
|
|
56
|
+
assetId: string;
|
|
68
57
|
bids: OrderbookLevel[];
|
|
69
58
|
asks: OrderbookLevel[];
|
|
70
59
|
timestamp: number;
|
|
71
60
|
}
|
|
72
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=asset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../asset.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,KAAM,SAAQ,aAAa;IAC1C,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAA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M,CAAA;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
package/src/_types/enums.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare enum PerpsErrorCode {
|
|
|
4
4
|
ValidationError = 2002,
|
|
5
5
|
TimeoutError = 2003,
|
|
6
6
|
ThirdPartyError = 2004,
|
|
7
|
+
SDKError = 2005,
|
|
7
8
|
SignatureInvalid = 2010,
|
|
8
9
|
AgentUnauthorized = 2011,
|
|
9
10
|
ExchangeRejected = 2020,
|
|
@@ -24,7 +25,12 @@ export declare enum OrderSide {
|
|
|
24
25
|
}
|
|
25
26
|
export declare enum OrderType {
|
|
26
27
|
MARKET = "MARKET",
|
|
27
|
-
LIMIT = "LIMIT"
|
|
28
|
+
LIMIT = "LIMIT",
|
|
29
|
+
STOP_MARKET = "STOP_MARKET",
|
|
30
|
+
STOP_LIMIT = "STOP_LIMIT",
|
|
31
|
+
TAKE_PROFIT_MARKET = "TAKE_PROFIT_MARKET",
|
|
32
|
+
TAKE_PROFIT_LIMIT = "TAKE_PROFIT_LIMIT",
|
|
33
|
+
TRIGGER_ONLY = "TRIGGER_ONLY"
|
|
28
34
|
}
|
|
29
35
|
export declare enum PositionSide {
|
|
30
36
|
LONG = "LONG",
|
|
@@ -50,17 +56,28 @@ export declare enum OrderStatus {
|
|
|
50
56
|
EXPIRED = "EXPIRED",
|
|
51
57
|
TRIGGERED = "TRIGGERED"
|
|
52
58
|
}
|
|
53
|
-
export declare enum
|
|
59
|
+
export declare enum FillStatus {
|
|
54
60
|
FILLED = "FILLED",
|
|
55
61
|
PARTIALLY_FILLED = "PARTIALLY_FILLED",
|
|
56
62
|
CANCELLED = "CANCELLED",
|
|
57
63
|
REJECTED = "REJECTED"
|
|
58
64
|
}
|
|
59
|
-
export declare enum
|
|
60
|
-
|
|
65
|
+
export declare enum ActionType {
|
|
66
|
+
APPROVE_AGENT = "approveAgent",
|
|
67
|
+
APPROVE_BUILDER_FEE = "approveBuilderFee",
|
|
68
|
+
USER_SET_ABSTRACTION = "userSetAbstraction",
|
|
69
|
+
AGENT_SET_ABSTRACTION = "agentSetAbstraction",
|
|
70
|
+
SEND_ASSET = "sendAsset",
|
|
71
|
+
WITHDRAWAL = "withdrawal",
|
|
61
72
|
PLACE_ORDER = "placeOrder",
|
|
62
73
|
PLACE_TRIGGER_ORDER = "placeTriggerOrder",
|
|
63
|
-
CANCEL_ORDER = "cancelOrder"
|
|
74
|
+
CANCEL_ORDER = "cancelOrder",
|
|
75
|
+
CANCEL_ALL_ORDERS = "cancelAllOrders",
|
|
76
|
+
MODIFY_ORDER = "modifyOrder",
|
|
77
|
+
UPDATE_LEVERAGE = "updateLeverage",
|
|
78
|
+
UPDATE_POSITION_MARGIN = "updatePositionMargin",
|
|
79
|
+
REGISTER_API_KEY = "registerApiKey",
|
|
80
|
+
DEPOSIT = "deposit"
|
|
64
81
|
}
|
|
65
82
|
export declare enum TriggerCondition {
|
|
66
83
|
ABOVE = "ABOVE",
|
|
@@ -75,4 +92,44 @@ export declare enum TriggerOrderStatus {
|
|
|
75
92
|
TRIGGERED = "TRIGGERED",
|
|
76
93
|
CANCELLED = "CANCELLED"
|
|
77
94
|
}
|
|
95
|
+
export declare enum ActivityType {
|
|
96
|
+
DEPOSIT = "DEPOSIT",
|
|
97
|
+
WITHDRAWAL = "WITHDRAWAL",
|
|
98
|
+
LIQUIDATION = "LIQUIDATION",
|
|
99
|
+
FUNDING = "FUNDING"
|
|
100
|
+
}
|
|
101
|
+
export declare enum FillClassification {
|
|
102
|
+
OPENED_LONG = "Opened Long",
|
|
103
|
+
OPENED_SHORT = "Opened Short",
|
|
104
|
+
INCREASED_LONG = "Increased Long",
|
|
105
|
+
INCREASED_SHORT = "Increased Short",
|
|
106
|
+
REDUCED_LONG = "Reduced Long",
|
|
107
|
+
REDUCED_SHORT = "Reduced Short",
|
|
108
|
+
CLOSED_LONG = "Closed Long",
|
|
109
|
+
CLOSED_SHORT = "Closed Short",
|
|
110
|
+
SWITCHED_LONG = "Switched Long",
|
|
111
|
+
SWITCHED_SHORT = "Switched Short",
|
|
112
|
+
SPOT_BUY = "Spot Buy",
|
|
113
|
+
SPOT_SELL = "Spot Sell"
|
|
114
|
+
}
|
|
115
|
+
export declare enum LiquidationClassification {
|
|
116
|
+
LIQUIDATED = "Liquidated"
|
|
117
|
+
}
|
|
118
|
+
export declare enum FundingClassification {
|
|
119
|
+
FUNDING = "Funding"
|
|
120
|
+
}
|
|
121
|
+
export declare enum TransferClassification {
|
|
122
|
+
DEPOSIT = "Deposit",
|
|
123
|
+
WITHDRAWAL = "Withdrawal"
|
|
124
|
+
}
|
|
125
|
+
export type ActivityClassification = FillClassification | LiquidationClassification | FundingClassification | TransferClassification;
|
|
126
|
+
export declare enum PerpsSigner {
|
|
127
|
+
USER = "USER",
|
|
128
|
+
AGENT = "AGENT"
|
|
129
|
+
}
|
|
130
|
+
export declare enum SigningMethod {
|
|
131
|
+
EIP712 = "eip712",
|
|
132
|
+
WASM_BLOB = "wasmBlob",
|
|
133
|
+
EVM_TX = "evmTx"
|
|
134
|
+
}
|
|
78
135
|
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../enums.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IAExB,YAAY,OAAO;IACnB,WAAW,OAAO;IAClB,eAAe,OAAO;IACtB,YAAY,OAAO;IACnB,eAAe,OAAO;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../enums.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IAExB,YAAY,OAAO;IACnB,WAAW,OAAO;IAClB,eAAe,OAAO;IACtB,YAAY,OAAO;IACnB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BAAiB,oBAAoB;IACrC,YAAY,gBAAgB;IAC5B,eAAe,mBAAmB;IAClC,sBAAsB,yBAAyB;IAC/C,gBAAgB,mBAAmB;IACnC,OAAO,YAAY;CACpB;AAED,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,oBAAY,gBAAgB;IAC1B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;CACxB;AAED,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;CACpB;AAED,oBAAY,kBAAkB;IAC5B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAED,oBAAY,yBAAyB;IACnC,UAAU,eAAe;CAC1B;AAED,oBAAY,qBAAqB;IAC/B,OAAO,YAAY;CACpB;AAED,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,sBAAsB,GAC9B,kBAAkB,GAClB,yBAAyB,GACzB,qBAAqB,GACrB,sBAAsB,CAAA;AAE1B,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,SAAS,aAAa;IACtB,MAAM,UAAU;CACjB"}
|
package/src/_types/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './typedData.js';
|
|
2
2
|
export * from './enums.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './providers.js';
|
|
4
|
+
export * from './asset.js';
|
|
5
|
+
export * from './action.js';
|
|
5
6
|
export * from './account.js';
|
|
6
|
-
export * from './trading.js';
|
|
7
|
-
export * from './withdrawal.js';
|
|
8
7
|
export * from './errors.js';
|
|
9
8
|
export * from './subscriptions.js';
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
/** Spot asset IDs use the @pairIndex format (e.g. "@230"). */
|
|
2
|
+
export declare const assetIsSpot: (assetId: string) => boolean;
|
|
1
3
|
/**
|
|
2
|
-
* Calculate the asset ID for a given
|
|
4
|
+
* Calculate the asset ID for a given provider index and asset index.
|
|
3
5
|
*
|
|
4
|
-
* Main
|
|
5
|
-
* HIP-3
|
|
6
|
+
* Main provider (provider = ''): assetId = indexInProvider
|
|
7
|
+
* HIP-3 providers (provider = 'xyz'): assetId = 100_000 + perpDexIndex * 10_000 + indexInProvider
|
|
6
8
|
*/
|
|
7
|
-
export declare const calculateAssetId: (
|
|
9
|
+
export declare const calculateAssetId: (providerIndex: number, indexInProvider: number) => number;
|
|
8
10
|
/**
|
|
9
|
-
* Get the
|
|
11
|
+
* Get the provider index from the given list of provider names.
|
|
10
12
|
*/
|
|
11
|
-
export declare const
|
|
13
|
+
export declare const getProviderIndex: (provider: string, providerNames: string[]) => number;
|
|
12
14
|
//# sourceMappingURL=assetId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../providers/hyperliquid/assetId.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,
|
|
1
|
+
{"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../providers/hyperliquid/assetId.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,OAAkC,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,MAAM,EACrB,iBAAiB,MAAM,KACtB,MAKF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,eAAe,MAAM,EAAE,KACtB,MAMF,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActivityItem, FundingActivity } from '../../../account.js';
|
|
2
|
+
import type { HlLedgerUpdate, HlFundingUpdate } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Map a Hyperliquid non-funding ledger entry to an ActivityItem.
|
|
5
|
+
* Returns null for unsupported delta types (accountClassTransfer,
|
|
6
|
+
* internalTransfer, subAccountTransfer, spotTransfer).
|
|
7
|
+
*/
|
|
8
|
+
export declare const mapLedgerEntry: (entry: HlLedgerUpdate, providerKey: string) => ActivityItem | null;
|
|
9
|
+
/**
|
|
10
|
+
* Map a Hyperliquid funding entry to a FundingActivity.
|
|
11
|
+
*/
|
|
12
|
+
export declare const mapFundingActivity: (entry: HlFundingUpdate, providerKey: string) => FundingActivity;
|
|
13
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/activity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAIZ,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,cAAc,EACrB,aAAa,MAAM,KAClB,YAAY,GAAG,IAqDjB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,eAAe,EACtB,aAAa,MAAM,KAClB,eAcD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/asset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAI7D,eAAO,MAAM,QAAQ,GACnB,UAAU,cAAc,EACxB,UAAU,UAAU,KACnB,KAuBF,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FillClassification } from '../../../enums.js';
|
|
2
|
+
import type { Fill } from '../../../account.js';
|
|
3
|
+
import type { HlUserFill } from '../types.js';
|
|
4
|
+
export declare function classifyFillFromPosition(startPosition: string, side: string, sz: string): FillClassification;
|
|
5
|
+
export declare const mapFill: (fill: HlUserFill) => Fill;
|
|
6
|
+
//# sourceMappingURL=fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAInB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7C,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,kBAAkB,CAqCpB;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,KAAG,IAuBzC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { mapOpenOrder, mapOrder } from './order.js';
|
|
1
|
+
export { mapAsset } from './asset.js';
|
|
2
|
+
export { isTriggerType, mapOpenOrder, mapOrder, mapOrderType, mapTriggerOrder, } from './order.js';
|
|
4
3
|
export { mapPosition } from './position.js';
|
|
5
|
-
export {
|
|
4
|
+
export { classifyFillFromPosition, mapFill } from './fill.js';
|
|
5
|
+
export { mapLedgerEntry, mapFundingActivity } from './activity.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { OrderType } from '../../../enums.js';
|
|
2
|
+
import type { OpenOrder, TriggerOrder } from '../../../account.js';
|
|
3
|
+
import type { Order } from '../../../action.js';
|
|
3
4
|
import type { HlFrontendOpenOrder, HlOrderDetail } from '../types.js';
|
|
4
|
-
|
|
5
|
+
/** Map a Hyperliquid orderType string to the OrderType enum. */
|
|
6
|
+
export declare const mapOrderType: (orderType: string) => OrderType;
|
|
7
|
+
export declare const isTriggerType: (type: OrderType) => boolean;
|
|
8
|
+
export declare const mapOpenOrder: (o: HlFrontendOpenOrder) => OpenOrder;
|
|
9
|
+
export declare const mapTriggerOrder: (o: HlFrontendOpenOrder) => TriggerOrder;
|
|
5
10
|
export declare const mapOrder: (detail: HlOrderDetail) => Order;
|
|
6
11
|
//# sourceMappingURL=order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/order.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/order.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAEV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAErE,gEAAgE;AAChE,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,KAAG,SAehD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,KAAG,OAIjB,CAAA;AAE/B,eAAO,MAAM,YAAY,GAAI,GAAG,mBAAmB,KAAG,SAkBpD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,GAAG,mBAAmB,KAAG,YAmBxD,CAAA;AAoCD,eAAO,MAAM,QAAQ,GAAI,QAAQ,aAAa,KAAG,KA0BhD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Position } from '../../../account.js';
|
|
2
2
|
import type { HlAssetPosition } from '../types.js';
|
|
3
|
-
export declare const mapPosition: (ap: HlAssetPosition
|
|
3
|
+
export declare const mapPosition: (ap: HlAssetPosition) => Position;
|
|
4
4
|
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/position.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/position.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,WAAW,GAAI,IAAI,eAAe,KAAG,QA2BjD,CAAA"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Look up an asset ID by symbol, throwing if the symbol is unknown.
|
|
3
|
-
* Asset ID 0 is a valid Hyperliquid asset (BTC-PERP), so a fallback
|
|
4
|
-
* to 0 would silently corrupt data.
|
|
5
|
-
*/
|
|
6
|
-
export declare const resolveAssetIdFromLookup: (lookup: Map<string, number>, symbol: string) => number;
|
|
7
1
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../providers/hyperliquid/mappers/shared.ts"],"names":[],"mappings":""}
|