@nktkas/hyperliquid 0.23.1 → 0.24.1
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/CONTRIBUTING.md +3 -2
- package/README.md +178 -194
- package/esm/mod.d.ts +2 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/base.d.ts +0 -5
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/clients/exchange.d.ts +485 -392
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +517 -912
- package/esm/src/clients/info.d.ts +249 -203
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +258 -368
- package/esm/src/clients/multiSign.d.ts +14 -1184
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +37 -2004
- package/esm/src/clients/subscription.d.ts +101 -99
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +107 -152
- package/esm/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/esm/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/ethers.js +1 -1
- package/esm/src/signing/_signTypedData/mod.d.ts +12 -12
- package/esm/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/mod.js +52 -24
- package/esm/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/esm/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/private_key.js +40 -19
- package/esm/src/signing/_signTypedData/viem.d.ts +27 -6
- package/esm/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/viem.js +1 -1
- package/esm/src/signing/_sorter.d.ts +18 -19
- package/esm/src/signing/_sorter.d.ts.map +1 -1
- package/esm/src/signing/_sorter.js +57 -59
- package/esm/src/signing/mod.d.ts +179 -129
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +184 -132
- package/esm/src/transports/base.d.ts +2 -1
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.d.ts +3 -2
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +4 -4
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/esm/src/transports/websocket/_websocket_async_request.js +17 -21
- package/esm/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +6 -6
- package/esm/src/types/exchange/requests.d.ts +547 -306
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/exchange/responses.d.ts +105 -25
- package/esm/src/types/exchange/responses.d.ts.map +1 -1
- package/esm/src/types/explorer/requests.d.ts +3 -3
- package/esm/src/types/explorer/requests.d.ts.map +1 -1
- package/esm/src/types/explorer/responses.d.ts +1 -1
- package/esm/src/types/explorer/responses.d.ts.map +1 -1
- package/esm/src/types/info/accounts.d.ts +405 -98
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +131 -35
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/markets.d.ts +29 -8
- package/esm/src/types/info/markets.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +64 -17
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +126 -51
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/info/validators.d.ts +44 -14
- package/esm/src/types/info/validators.d.ts.map +1 -1
- package/esm/src/types/info/vaults.d.ts +25 -10
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +1 -1
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/subscriptions/requests.d.ts +21 -66
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/esm/src/types/subscriptions/responses.d.ts +46 -55
- package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
- package/package.json +2 -3
- package/script/mod.d.ts +2 -1
- package/script/mod.d.ts.map +1 -1
- package/script/src/base.d.ts +0 -5
- package/script/src/base.d.ts.map +1 -1
- package/script/src/clients/exchange.d.ts +485 -392
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +516 -911
- package/script/src/clients/info.d.ts +249 -203
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +258 -368
- package/script/src/clients/multiSign.d.ts +14 -1184
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +38 -2005
- package/script/src/clients/subscription.d.ts +101 -99
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +107 -152
- package/script/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/script/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/ethers.js +2 -2
- package/script/src/signing/_signTypedData/mod.d.ts +12 -12
- package/script/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/mod.js +51 -26
- package/script/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/script/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/private_key.js +40 -18
- package/script/src/signing/_signTypedData/viem.d.ts +27 -6
- package/script/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/viem.js +2 -2
- package/script/src/signing/_sorter.d.ts +18 -19
- package/script/src/signing/_sorter.d.ts.map +1 -1
- package/script/src/signing/_sorter.js +57 -59
- package/script/src/signing/mod.d.ts +179 -129
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +187 -150
- package/script/src/transports/base.d.ts +2 -1
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.d.ts +3 -2
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +4 -4
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/script/src/transports/websocket/_websocket_async_request.js +17 -21
- package/script/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +6 -6
- package/script/src/types/exchange/requests.d.ts +547 -306
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/exchange/responses.d.ts +105 -25
- package/script/src/types/exchange/responses.d.ts.map +1 -1
- package/script/src/types/explorer/requests.d.ts +3 -3
- package/script/src/types/explorer/requests.d.ts.map +1 -1
- package/script/src/types/explorer/responses.d.ts +1 -1
- package/script/src/types/explorer/responses.d.ts.map +1 -1
- package/script/src/types/info/accounts.d.ts +405 -98
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +131 -35
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/markets.d.ts +29 -8
- package/script/src/types/info/markets.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +64 -17
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +126 -51
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/info/validators.d.ts +44 -14
- package/script/src/types/info/validators.d.ts.map +1 -1
- package/script/src/types/info/vaults.d.ts +25 -10
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +1 -1
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/subscriptions/requests.d.ts +21 -66
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/script/src/types/subscriptions/responses.d.ts +46 -55
- package/script/src/types/subscriptions/responses.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/window.d.ts +0 -29
- package/esm/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/window.js +0 -30
- package/script/src/signing/_signTypedData/window.d.ts +0 -29
- package/script/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/window.js +0 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex } from "
|
|
1
|
+
import type { Hex } from "../mod.js";
|
|
2
2
|
import type { BlockDetails } from "../explorer/responses.js";
|
|
3
3
|
import type { FundingUpdate, PerpsClearinghouseState, SpotClearinghouseState, UserFundingUpdate, UserNonFundingLedgerUpdate } from "../info/accounts.js";
|
|
4
4
|
import type { AllMids, PerpsAssetCtx, PerpsMeta, SpotAssetCtx } from "../info/assets.js";
|
|
@@ -10,33 +10,6 @@ export interface WsActiveAssetCtx {
|
|
|
10
10
|
/** Context information for the perpetual asset. */
|
|
11
11
|
ctx: PerpsAssetCtx;
|
|
12
12
|
}
|
|
13
|
-
/** Active asset trading data. */
|
|
14
|
-
export interface WsActiveAssetData {
|
|
15
|
-
/** User's address. */
|
|
16
|
-
user: Hex;
|
|
17
|
-
/** Asset symbol (e.g., BTC). */
|
|
18
|
-
coin: string;
|
|
19
|
-
/** Leverage configuration. */
|
|
20
|
-
leverage: {
|
|
21
|
-
/** Leverage type. */
|
|
22
|
-
type: "isolated";
|
|
23
|
-
/** Leverage value used. */
|
|
24
|
-
value: number;
|
|
25
|
-
/** Amount of USD used (1 = 1$). */
|
|
26
|
-
rawUsd: string;
|
|
27
|
-
} | {
|
|
28
|
-
/** Leverage type. */
|
|
29
|
-
type: "cross";
|
|
30
|
-
/** Leverage value used. */
|
|
31
|
-
value: number;
|
|
32
|
-
};
|
|
33
|
-
/** Maximum trade size range [min, max]. */
|
|
34
|
-
maxTradeSzs: [string, string];
|
|
35
|
-
/** Available to trade range [min, max]. */
|
|
36
|
-
availableToTrade: [string, string];
|
|
37
|
-
/** Mark price. */
|
|
38
|
-
markPx: string;
|
|
39
|
-
}
|
|
40
13
|
/** Active spot asset context. */
|
|
41
14
|
export interface WsActiveSpotAssetCtx {
|
|
42
15
|
/** Asset symbol (e.g., BTC). */
|
|
@@ -60,7 +33,7 @@ export interface WsBbo {
|
|
|
60
33
|
}
|
|
61
34
|
/** Block details. */
|
|
62
35
|
export type WsBlockDetails = Omit<BlockDetails, "txs">;
|
|
63
|
-
/** User
|
|
36
|
+
/** User notifications. */
|
|
64
37
|
export interface WsNotification {
|
|
65
38
|
/** Notification content. */
|
|
66
39
|
notification: string;
|
|
@@ -71,9 +44,15 @@ export interface WsTrade {
|
|
|
71
44
|
coin: string;
|
|
72
45
|
/** Trade side ("B" = Bid/Buy, "A" = Ask/Sell). */
|
|
73
46
|
side: "B" | "A";
|
|
74
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Trade price.
|
|
49
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
50
|
+
*/
|
|
75
51
|
px: string;
|
|
76
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Trade size.
|
|
54
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
55
|
+
*/
|
|
77
56
|
sz: string;
|
|
78
57
|
/** Trade timestamp (in ms since epoch). */
|
|
79
58
|
time: number;
|
|
@@ -84,19 +63,19 @@ export interface WsTrade {
|
|
|
84
63
|
/** Addresses of users involved in the trade [Maker, Taker]. */
|
|
85
64
|
users: [Hex, Hex];
|
|
86
65
|
}
|
|
87
|
-
/** User
|
|
66
|
+
/** User event. */
|
|
88
67
|
export type WsUserEvent = WsUserEventFill | WsUserEventFunding | WsUserEventLiquidation | WsUserEventNonUserCancel | WsUserEventTwapHistory | WsUserEventTwapSliceFills;
|
|
89
|
-
/** User
|
|
68
|
+
/** User fill event. */
|
|
90
69
|
export interface WsUserEventFill {
|
|
91
70
|
/** Array of trade fills. */
|
|
92
71
|
fills: Fill[];
|
|
93
72
|
}
|
|
94
|
-
/** User
|
|
73
|
+
/** User funding event. */
|
|
95
74
|
export interface WsUserEventFunding {
|
|
96
75
|
/** Funding update details. */
|
|
97
76
|
funding: Omit<FundingUpdate, "type">;
|
|
98
77
|
}
|
|
99
|
-
/** User
|
|
78
|
+
/** User liquidation event. */
|
|
100
79
|
export interface WsUserEventLiquidation {
|
|
101
80
|
/** Liquidation event details. */
|
|
102
81
|
liquidation: {
|
|
@@ -106,9 +85,15 @@ export interface WsUserEventLiquidation {
|
|
|
106
85
|
liquidator: Hex;
|
|
107
86
|
/** Address of the liquidated user. */
|
|
108
87
|
liquidated_user: Hex;
|
|
109
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Notional position size that was liquidated.
|
|
90
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
91
|
+
*/
|
|
110
92
|
liquidated_ntl_pos: string;
|
|
111
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Account value at time of liquidation.
|
|
95
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
96
|
+
*/
|
|
112
97
|
liquidated_account_value: string;
|
|
113
98
|
};
|
|
114
99
|
}
|
|
@@ -122,55 +107,55 @@ export interface WsUserEventNonUserCancel {
|
|
|
122
107
|
oid: number;
|
|
123
108
|
}[];
|
|
124
109
|
}
|
|
125
|
-
/** User
|
|
110
|
+
/** User TWAP history event. */
|
|
126
111
|
export interface WsUserEventTwapHistory {
|
|
127
112
|
/** Array of historical TWAP fills. */
|
|
128
113
|
twapHistory: TwapHistory[];
|
|
129
114
|
}
|
|
130
|
-
/** User
|
|
115
|
+
/** User TWAP slice fills event. */
|
|
131
116
|
export interface WsUserEventTwapSliceFills {
|
|
132
117
|
/** Array of TWAP slice fills. */
|
|
133
118
|
twapSliceFills: TwapSliceFill[];
|
|
134
119
|
}
|
|
135
|
-
/** User
|
|
120
|
+
/** User fills. */
|
|
136
121
|
export interface WsUserFills {
|
|
137
|
-
/** User
|
|
122
|
+
/** User address. */
|
|
138
123
|
user: Hex;
|
|
139
124
|
/** Array of fill events. */
|
|
140
125
|
fills: Fill[];
|
|
141
126
|
/** Whether this is an initial snapshot. */
|
|
142
127
|
isSnapshot?: true;
|
|
143
128
|
}
|
|
144
|
-
/** User
|
|
129
|
+
/** User fundings. */
|
|
145
130
|
export interface WsUserFundings {
|
|
146
|
-
/** User
|
|
131
|
+
/** User address. */
|
|
147
132
|
user: Hex;
|
|
148
133
|
/** Array of funding events. */
|
|
149
134
|
fundings: (Omit<FundingUpdate, "type"> & Pick<UserFundingUpdate, "time">)[];
|
|
150
135
|
/** Whether this is an initial snapshot. */
|
|
151
136
|
isSnapshot?: true;
|
|
152
137
|
}
|
|
153
|
-
/** User
|
|
138
|
+
/** User non-funding ledger updates. */
|
|
154
139
|
export interface WsUserNonFundingLedgerUpdates {
|
|
155
|
-
/** User
|
|
140
|
+
/** User address. */
|
|
156
141
|
user: Hex;
|
|
157
142
|
/** Array of non-funding ledger updates. */
|
|
158
143
|
nonFundingLedgerUpdates: UserNonFundingLedgerUpdate[];
|
|
159
144
|
/** Whether this is an initial snapshot. */
|
|
160
145
|
isSnapshot?: true;
|
|
161
146
|
}
|
|
162
|
-
/** User
|
|
147
|
+
/** User TWAP history. */
|
|
163
148
|
export interface WsUserTwapHistory {
|
|
164
|
-
/** User
|
|
149
|
+
/** User address. */
|
|
165
150
|
user: Hex;
|
|
166
151
|
/** Array of historical TWAP fills. */
|
|
167
152
|
history: TwapHistory[];
|
|
168
153
|
/** Whether this is an initial snapshot. */
|
|
169
154
|
isSnapshot?: true;
|
|
170
155
|
}
|
|
171
|
-
/** User
|
|
156
|
+
/** User TWAP slice fills. */
|
|
172
157
|
export interface WsUserTwapSliceFills {
|
|
173
|
-
/** User
|
|
158
|
+
/** User address. */
|
|
174
159
|
user: Hex;
|
|
175
160
|
/** Array of TWAP slice fills. */
|
|
176
161
|
twapSliceFills: TwapSliceFill[];
|
|
@@ -188,15 +173,21 @@ export interface WsWebData2 {
|
|
|
188
173
|
/** Name of the vault. */
|
|
189
174
|
name: string;
|
|
190
175
|
}[];
|
|
191
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Total equity in vaults.
|
|
178
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
179
|
+
*/
|
|
192
180
|
totalVaultEquity: string;
|
|
193
|
-
/** User
|
|
181
|
+
/** User open orders with frontend information. */
|
|
194
182
|
openOrders: FrontendOrder[];
|
|
195
|
-
/** Agent
|
|
183
|
+
/** Agent address if one exists. */
|
|
196
184
|
agentAddress: Hex | null;
|
|
197
185
|
/** Timestamp until which the agent is valid. */
|
|
198
186
|
agentValidUntil: number | null;
|
|
199
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Cumulative ledger value.
|
|
189
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
190
|
+
*/
|
|
200
191
|
cumLedger: string;
|
|
201
192
|
/** Metadata for perpetual assets. */
|
|
202
193
|
meta: PerpsMeta;
|
|
@@ -206,12 +197,12 @@ export interface WsWebData2 {
|
|
|
206
197
|
serverTime: number;
|
|
207
198
|
/** Whether this account is a vault. */
|
|
208
199
|
isVault: boolean;
|
|
209
|
-
/** User
|
|
200
|
+
/** User address. */
|
|
210
201
|
user: Hex;
|
|
211
202
|
/** TWAP states. */
|
|
212
203
|
twapStates: [number, TwapState][];
|
|
213
204
|
/** Account summary for spot trading. */
|
|
214
|
-
spotState
|
|
205
|
+
spotState?: SpotClearinghouseState;
|
|
215
206
|
/** Context information for spot assets. */
|
|
216
207
|
spotAssetCtxs: SpotAssetCtx[];
|
|
217
208
|
/** Whether the user has opted out of spot dusting. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACR,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE/G,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC7B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,GAAG,EAAE,aAAa,CAAC;CACtB;AAED,iCAAiC;AACjC,MAAM,WAAW,oBAAoB;IACjC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,GAAG,EAAE,YAAY,CAAC;CACrB;AAED,iCAAiC;AACjC,MAAM,WAAW,SAAS;IACtB,6CAA6C;IAC7C,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,0BAA0B;AAC1B,MAAM,WAAW,KAAK;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,C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2CAA2C;IAC3C,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,IAAI,CAAC;IAC3B,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Hex } from "../../base.js";
|
|
2
|
-
/** Abstract interface for a [window.ethereum](https://eips.ethereum.org/EIPS/eip-1193) object. */
|
|
3
|
-
export interface AbstractWindowEthereum {
|
|
4
|
-
request(args: {
|
|
5
|
-
method: any;
|
|
6
|
-
params: any;
|
|
7
|
-
}): Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
/** Signs typed data using `window.ethereum` (EIP-1193) with `eth_signTypedData_v4` (EIP-712). */
|
|
10
|
-
export declare function signTypedDataWithWindowEthereum(args: {
|
|
11
|
-
ethereum: AbstractWindowEthereum;
|
|
12
|
-
domain: {
|
|
13
|
-
name: string;
|
|
14
|
-
version: string;
|
|
15
|
-
chainId: number;
|
|
16
|
-
verifyingContract: Hex;
|
|
17
|
-
};
|
|
18
|
-
types: {
|
|
19
|
-
[key: string]: {
|
|
20
|
-
name: string;
|
|
21
|
-
type: string;
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
24
|
-
primaryType: string;
|
|
25
|
-
message: Record<string, unknown>;
|
|
26
|
-
}): Promise<Hex>;
|
|
27
|
-
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
28
|
-
export declare function isAbstractWindowEthereum(client: unknown): client is AbstractWindowEthereum;
|
|
29
|
-
//# sourceMappingURL=window.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IAEnC,OAAO,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7D;AAED,iGAAiG;AACjG,wBAAsB,+BAA+B,CAAC,IAAI,EAAE;IACxD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,GAAG,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YACX,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,GAAG,CAAC,CAwBf;AAED,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** Signs typed data using `window.ethereum` (EIP-1193) with `eth_signTypedData_v4` (EIP-712). */
|
|
2
|
-
export async function signTypedDataWithWindowEthereum(args) {
|
|
3
|
-
const { ethereum, domain, types, primaryType, message } = args;
|
|
4
|
-
const accounts = await ethereum.request({ method: "eth_requestAccounts", params: [] });
|
|
5
|
-
if (!Array.isArray(accounts) || accounts.length === 0) {
|
|
6
|
-
throw new Error("No Ethereum accounts available");
|
|
7
|
-
}
|
|
8
|
-
const from = accounts[0];
|
|
9
|
-
const dataToSign = JSON.stringify({
|
|
10
|
-
domain,
|
|
11
|
-
types: {
|
|
12
|
-
EIP712Domain: [
|
|
13
|
-
{ name: "name", type: "string" },
|
|
14
|
-
{ name: "version", type: "string" },
|
|
15
|
-
{ name: "chainId", type: "uint256" },
|
|
16
|
-
{ name: "verifyingContract", type: "address" },
|
|
17
|
-
],
|
|
18
|
-
...types,
|
|
19
|
-
},
|
|
20
|
-
primaryType,
|
|
21
|
-
message,
|
|
22
|
-
});
|
|
23
|
-
return await ethereum.request({ method: "eth_signTypedData_v4", params: [from, dataToSign] });
|
|
24
|
-
}
|
|
25
|
-
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
26
|
-
export function isAbstractWindowEthereum(client) {
|
|
27
|
-
return typeof client === "object" && client !== null &&
|
|
28
|
-
"request" in client && typeof client.request === "function" &&
|
|
29
|
-
client.request.length >= 1;
|
|
30
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Hex } from "../../base.js";
|
|
2
|
-
/** Abstract interface for a [window.ethereum](https://eips.ethereum.org/EIPS/eip-1193) object. */
|
|
3
|
-
export interface AbstractWindowEthereum {
|
|
4
|
-
request(args: {
|
|
5
|
-
method: any;
|
|
6
|
-
params: any;
|
|
7
|
-
}): Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
/** Signs typed data using `window.ethereum` (EIP-1193) with `eth_signTypedData_v4` (EIP-712). */
|
|
10
|
-
export declare function signTypedDataWithWindowEthereum(args: {
|
|
11
|
-
ethereum: AbstractWindowEthereum;
|
|
12
|
-
domain: {
|
|
13
|
-
name: string;
|
|
14
|
-
version: string;
|
|
15
|
-
chainId: number;
|
|
16
|
-
verifyingContract: Hex;
|
|
17
|
-
};
|
|
18
|
-
types: {
|
|
19
|
-
[key: string]: {
|
|
20
|
-
name: string;
|
|
21
|
-
type: string;
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
24
|
-
primaryType: string;
|
|
25
|
-
message: Record<string, unknown>;
|
|
26
|
-
}): Promise<Hex>;
|
|
27
|
-
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
28
|
-
export declare function isAbstractWindowEthereum(client: unknown): client is AbstractWindowEthereum;
|
|
29
|
-
//# sourceMappingURL=window.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IAEnC,OAAO,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7D;AAED,iGAAiG;AACjG,wBAAsB,+BAA+B,CAAC,IAAI,EAAE;IACxD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,GAAG,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YACX,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,GAAG,CAAC,CAwBf;AAED,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.signTypedDataWithWindowEthereum = signTypedDataWithWindowEthereum;
|
|
4
|
-
exports.isAbstractWindowEthereum = isAbstractWindowEthereum;
|
|
5
|
-
/** Signs typed data using `window.ethereum` (EIP-1193) with `eth_signTypedData_v4` (EIP-712). */
|
|
6
|
-
async function signTypedDataWithWindowEthereum(args) {
|
|
7
|
-
const { ethereum, domain, types, primaryType, message } = args;
|
|
8
|
-
const accounts = await ethereum.request({ method: "eth_requestAccounts", params: [] });
|
|
9
|
-
if (!Array.isArray(accounts) || accounts.length === 0) {
|
|
10
|
-
throw new Error("No Ethereum accounts available");
|
|
11
|
-
}
|
|
12
|
-
const from = accounts[0];
|
|
13
|
-
const dataToSign = JSON.stringify({
|
|
14
|
-
domain,
|
|
15
|
-
types: {
|
|
16
|
-
EIP712Domain: [
|
|
17
|
-
{ name: "name", type: "string" },
|
|
18
|
-
{ name: "version", type: "string" },
|
|
19
|
-
{ name: "chainId", type: "uint256" },
|
|
20
|
-
{ name: "verifyingContract", type: "address" },
|
|
21
|
-
],
|
|
22
|
-
...types,
|
|
23
|
-
},
|
|
24
|
-
primaryType,
|
|
25
|
-
message,
|
|
26
|
-
});
|
|
27
|
-
return await ethereum.request({ method: "eth_signTypedData_v4", params: [from, dataToSign] });
|
|
28
|
-
}
|
|
29
|
-
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
30
|
-
function isAbstractWindowEthereum(client) {
|
|
31
|
-
return typeof client === "object" && client !== null &&
|
|
32
|
-
"request" in client && typeof client.request === "function" &&
|
|
33
|
-
client.request.length >= 1;
|
|
34
|
-
}
|