@nktkas/hyperliquid 0.15.3 → 0.16.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 +11 -2
- package/esm/src/base.d.ts +1 -0
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/clients/event.d.ts +2 -0
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +2 -0
- package/esm/src/clients/public.d.ts +6 -6
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +237 -54
- package/esm/src/clients/wallet.d.ts +57 -6
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +225 -53
- package/esm/src/signing.d.ts +14 -4
- package/esm/src/signing.d.ts.map +1 -1
- package/esm/src/signing.js +5 -5
- package/esm/src/transports/http/http_transport.d.ts +25 -8
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +12 -6
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +1 -3
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.d.ts +1 -1
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +1 -5
- package/esm/src/types/exchange/requests.d.ts +120 -0
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +36 -18
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/src/base.d.ts +1 -0
- package/script/src/base.d.ts.map +1 -1
- package/script/src/clients/event.d.ts +2 -0
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +2 -0
- package/script/src/clients/public.d.ts +6 -6
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +237 -54
- package/script/src/clients/wallet.d.ts +57 -6
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +224 -52
- package/script/src/signing.d.ts +14 -4
- package/script/src/signing.d.ts.map +1 -1
- package/script/src/signing.js +5 -0
- package/script/src/transports/http/http_transport.d.ts +25 -8
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +12 -6
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +1 -3
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.d.ts +1 -1
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +1 -5
- package/script/src/types/exchange/requests.d.ts +120 -0
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +36 -18
- package/script/src/types/info/requests.d.ts.map +1 -1
|
@@ -59,6 +59,17 @@
|
|
|
59
59
|
* @typeParam W The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.io/v6/api/providers/#Signer)) used for signing transactions.
|
|
60
60
|
*/
|
|
61
61
|
class WalletClient {
|
|
62
|
+
/** Gets the next nonce for signing transactions. */
|
|
63
|
+
get _nonce() {
|
|
64
|
+
let nonce = Date.now();
|
|
65
|
+
if (nonce <= this._lastNonce) {
|
|
66
|
+
nonce = ++this._lastNonce;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this._lastNonce = nonce;
|
|
70
|
+
}
|
|
71
|
+
return nonce;
|
|
72
|
+
}
|
|
62
73
|
/**
|
|
63
74
|
* Initialises a new instance.
|
|
64
75
|
* @param args - The parameters for the client.
|
|
@@ -144,13 +155,43 @@
|
|
|
144
155
|
writable: true,
|
|
145
156
|
value: void 0
|
|
146
157
|
});
|
|
158
|
+
/** The last nonce used for signing transactions. */
|
|
159
|
+
Object.defineProperty(this, "_lastNonce", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
configurable: true,
|
|
162
|
+
writable: true,
|
|
163
|
+
value: 0
|
|
164
|
+
});
|
|
147
165
|
this.transport = args.transport;
|
|
148
166
|
this.wallet = args.wallet;
|
|
149
167
|
this.isTestnet = args.isTestnet ?? false;
|
|
150
168
|
this.defaultVaultAddress = args.defaultVaultAddress;
|
|
151
|
-
this.signatureChainId = args.signatureChainId ?? (
|
|
169
|
+
this.signatureChainId = args.signatureChainId ?? (async () => {
|
|
170
|
+
// Trying to get chain id of the wallet
|
|
171
|
+
if ((0, signing_js_1.isAbstractViemWalletClient)(this.wallet)) {
|
|
172
|
+
if ("getChainId" in this.wallet && typeof this.wallet.getChainId === "function") {
|
|
173
|
+
const chainId = await this.wallet.getChainId();
|
|
174
|
+
return `0x${chainId.toString(16)}`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if ((0, signing_js_1.isAbstractEthersSigner)(this.wallet) || (0, signing_js_1.isAbstractEthersV5Signer)(this.wallet)) {
|
|
178
|
+
if ("provider" in this.wallet &&
|
|
179
|
+
typeof this.wallet.provider === "object" && this.wallet.provider !== null &&
|
|
180
|
+
"getNetwork" in this.wallet.provider &&
|
|
181
|
+
typeof this.wallet.provider.getNetwork === "function") {
|
|
182
|
+
const network = await this.wallet.provider.getNetwork();
|
|
183
|
+
return `0x${network.chainId.toString(16)}`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if ((0, signing_js_1.isAbstractWindowEthereum)(this.wallet)) {
|
|
187
|
+
const [chainId] = await this.wallet.request({ method: "eth_chainId", params: [] });
|
|
188
|
+
return chainId;
|
|
189
|
+
}
|
|
190
|
+
// Trying to guess chain id based on isTestnet
|
|
191
|
+
return this.isTestnet ? "0x66eee" : "0xa4b1";
|
|
192
|
+
});
|
|
152
193
|
}
|
|
153
|
-
// ———————————————
|
|
194
|
+
// ——————————————— Exchange API ———————————————
|
|
154
195
|
/**
|
|
155
196
|
* Approve an agent to sign on behalf of the master or sub-accounts.
|
|
156
197
|
* @param args - The parameters for the request.
|
|
@@ -180,8 +221,10 @@
|
|
|
180
221
|
...args,
|
|
181
222
|
type: "approveAgent",
|
|
182
223
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
183
|
-
signatureChainId: this.signatureChainId
|
|
184
|
-
|
|
224
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
225
|
+
? this.signatureChainId
|
|
226
|
+
: await this.signatureChainId(),
|
|
227
|
+
nonce: args.nonce ?? this._nonce,
|
|
185
228
|
};
|
|
186
229
|
// Sign the action
|
|
187
230
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -233,8 +276,10 @@
|
|
|
233
276
|
...args,
|
|
234
277
|
type: "approveBuilderFee",
|
|
235
278
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
236
|
-
signatureChainId: this.signatureChainId
|
|
237
|
-
|
|
279
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
280
|
+
? this.signatureChainId
|
|
281
|
+
: await this.signatureChainId(),
|
|
282
|
+
nonce: args.nonce ?? this._nonce,
|
|
238
283
|
};
|
|
239
284
|
// Sign the action
|
|
240
285
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -296,7 +341,7 @@
|
|
|
296
341
|
*/
|
|
297
342
|
async batchModify(args, signal) {
|
|
298
343
|
// Destructure the parameters
|
|
299
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
344
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
300
345
|
// Construct an action
|
|
301
346
|
const action = {
|
|
302
347
|
type: "batchModify",
|
|
@@ -306,8 +351,8 @@
|
|
|
306
351
|
order: {
|
|
307
352
|
a: modify.order.a,
|
|
308
353
|
b: modify.order.b,
|
|
309
|
-
p: modify.order.p,
|
|
310
|
-
s: modify.order.s,
|
|
354
|
+
p: this._formatDecimal(modify.order.p),
|
|
355
|
+
s: this._formatDecimal(modify.order.s),
|
|
311
356
|
r: modify.order.r,
|
|
312
357
|
t: "limit" in modify.order.t
|
|
313
358
|
? {
|
|
@@ -318,7 +363,7 @@
|
|
|
318
363
|
: {
|
|
319
364
|
trigger: {
|
|
320
365
|
isMarket: modify.order.t.trigger.isMarket,
|
|
321
|
-
triggerPx: modify.order.t.trigger.triggerPx,
|
|
366
|
+
triggerPx: this._formatDecimal(modify.order.t.trigger.triggerPx),
|
|
322
367
|
tpsl: modify.order.t.trigger.tpsl,
|
|
323
368
|
},
|
|
324
369
|
},
|
|
@@ -372,7 +417,7 @@
|
|
|
372
417
|
*/
|
|
373
418
|
async cancel(args, signal) {
|
|
374
419
|
// Destructure the parameters
|
|
375
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
420
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
376
421
|
// Construct an action
|
|
377
422
|
const action = {
|
|
378
423
|
type: "cancel",
|
|
@@ -422,8 +467,10 @@
|
|
|
422
467
|
...args,
|
|
423
468
|
type: "cDeposit",
|
|
424
469
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
425
|
-
signatureChainId: this.signatureChainId
|
|
426
|
-
|
|
470
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
471
|
+
? this.signatureChainId
|
|
472
|
+
: await this.signatureChainId(),
|
|
473
|
+
nonce: args.nonce ?? this._nonce,
|
|
427
474
|
};
|
|
428
475
|
// Sign the action
|
|
429
476
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -467,7 +514,7 @@
|
|
|
467
514
|
*/
|
|
468
515
|
async claimRewards(args = {}, signal) {
|
|
469
516
|
// Destructure the parameters
|
|
470
|
-
const { nonce =
|
|
517
|
+
const { nonce = this._nonce, } = args;
|
|
471
518
|
// Construct an action
|
|
472
519
|
const sortedAction = { type: "claimRewards" };
|
|
473
520
|
// Sign the action
|
|
@@ -511,7 +558,7 @@
|
|
|
511
558
|
*/
|
|
512
559
|
async cancelByCloid(args, signal) {
|
|
513
560
|
// Destructure the parameters
|
|
514
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
561
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
515
562
|
// Construct an action
|
|
516
563
|
const action = {
|
|
517
564
|
type: "cancelByCloid",
|
|
@@ -561,8 +608,10 @@
|
|
|
561
608
|
...args,
|
|
562
609
|
type: "cWithdraw",
|
|
563
610
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
564
|
-
signatureChainId: this.signatureChainId
|
|
565
|
-
|
|
611
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
612
|
+
? this.signatureChainId
|
|
613
|
+
: await this.signatureChainId(),
|
|
614
|
+
nonce: args.nonce ?? this._nonce,
|
|
566
615
|
};
|
|
567
616
|
// Sign the action
|
|
568
617
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -606,7 +655,7 @@
|
|
|
606
655
|
*/
|
|
607
656
|
async evmUserModify(args, signal) {
|
|
608
657
|
// Destructure the parameters
|
|
609
|
-
const { nonce =
|
|
658
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
610
659
|
// Construct an action
|
|
611
660
|
const action = {
|
|
612
661
|
type: "evmUserModify",
|
|
@@ -648,7 +697,7 @@
|
|
|
648
697
|
*/
|
|
649
698
|
async createSubAccount(args, signal) {
|
|
650
699
|
// Destructure the parameters
|
|
651
|
-
const { nonce =
|
|
700
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
652
701
|
// Construct an action
|
|
653
702
|
const action = {
|
|
654
703
|
type: "createSubAccount",
|
|
@@ -694,7 +743,7 @@
|
|
|
694
743
|
*/
|
|
695
744
|
async createVault(args, signal) {
|
|
696
745
|
// Destructure the parameters
|
|
697
|
-
const { nonce =
|
|
746
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
698
747
|
// Construct an action
|
|
699
748
|
const action = {
|
|
700
749
|
type: "createVault",
|
|
@@ -754,7 +803,7 @@
|
|
|
754
803
|
*/
|
|
755
804
|
async modify(args, signal) {
|
|
756
805
|
// Destructure the parameters
|
|
757
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
806
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
758
807
|
// Construct an action
|
|
759
808
|
const action = {
|
|
760
809
|
type: "modify",
|
|
@@ -762,8 +811,8 @@
|
|
|
762
811
|
order: {
|
|
763
812
|
a: actionArgs.order.a,
|
|
764
813
|
b: actionArgs.order.b,
|
|
765
|
-
p: actionArgs.order.p,
|
|
766
|
-
s: actionArgs.order.s,
|
|
814
|
+
p: this._formatDecimal(actionArgs.order.p),
|
|
815
|
+
s: this._formatDecimal(actionArgs.order.s),
|
|
767
816
|
r: actionArgs.order.r,
|
|
768
817
|
t: "limit" in actionArgs.order.t
|
|
769
818
|
? {
|
|
@@ -774,7 +823,7 @@
|
|
|
774
823
|
: {
|
|
775
824
|
trigger: {
|
|
776
825
|
isMarket: actionArgs.order.t.trigger.isMarket,
|
|
777
|
-
triggerPx: actionArgs.order.t.trigger.triggerPx,
|
|
826
|
+
triggerPx: this._formatDecimal(actionArgs.order.t.trigger.triggerPx),
|
|
778
827
|
tpsl: actionArgs.order.t.trigger.tpsl,
|
|
779
828
|
},
|
|
780
829
|
},
|
|
@@ -835,7 +884,7 @@
|
|
|
835
884
|
*/
|
|
836
885
|
async order(args, signal) {
|
|
837
886
|
// Destructure the parameters
|
|
838
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
887
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
839
888
|
// Construct an action
|
|
840
889
|
const action = {
|
|
841
890
|
type: "order",
|
|
@@ -843,8 +892,8 @@
|
|
|
843
892
|
const sortedOrder = {
|
|
844
893
|
a: order.a,
|
|
845
894
|
b: order.b,
|
|
846
|
-
p: order.p,
|
|
847
|
-
s: order.s,
|
|
895
|
+
p: this._formatDecimal(order.p),
|
|
896
|
+
s: this._formatDecimal(order.s),
|
|
848
897
|
r: order.r,
|
|
849
898
|
t: "limit" in order.t
|
|
850
899
|
? {
|
|
@@ -855,7 +904,7 @@
|
|
|
855
904
|
: {
|
|
856
905
|
trigger: {
|
|
857
906
|
isMarket: order.t.trigger.isMarket,
|
|
858
|
-
triggerPx: order.t.trigger.triggerPx,
|
|
907
|
+
triggerPx: this._formatDecimal(order.t.trigger.triggerPx),
|
|
859
908
|
tpsl: order.t.trigger.tpsl,
|
|
860
909
|
},
|
|
861
910
|
},
|
|
@@ -912,7 +961,7 @@
|
|
|
912
961
|
*/
|
|
913
962
|
async scheduleCancel(args = {}, signal) {
|
|
914
963
|
// Destructure the parameters
|
|
915
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
964
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
916
965
|
// Construct an action
|
|
917
966
|
const action = {
|
|
918
967
|
type: "scheduleCancel",
|
|
@@ -957,7 +1006,7 @@
|
|
|
957
1006
|
*/
|
|
958
1007
|
async setDisplayName(args, signal) {
|
|
959
1008
|
// Destructure the parameters
|
|
960
|
-
const { nonce =
|
|
1009
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
961
1010
|
// Construct an action
|
|
962
1011
|
const action = {
|
|
963
1012
|
type: "setDisplayName",
|
|
@@ -999,7 +1048,7 @@
|
|
|
999
1048
|
*/
|
|
1000
1049
|
async setReferrer(args, signal) {
|
|
1001
1050
|
// Destructure the parameters
|
|
1002
|
-
const { nonce =
|
|
1051
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1003
1052
|
// Construct an action
|
|
1004
1053
|
const action = {
|
|
1005
1054
|
type: "setReferrer",
|
|
@@ -1019,6 +1068,110 @@
|
|
|
1019
1068
|
this._validateResponse(response);
|
|
1020
1069
|
return response;
|
|
1021
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Deploying HIP-1 and HIP-2 assets.
|
|
1073
|
+
* @param args - The parameters for the request.
|
|
1074
|
+
* @param signal - An optional abort signal.
|
|
1075
|
+
* @returns Successful response without specific data.
|
|
1076
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1077
|
+
* @untested
|
|
1078
|
+
*
|
|
1079
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
|
|
1080
|
+
* @example
|
|
1081
|
+
* ```ts
|
|
1082
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1083
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1084
|
+
*
|
|
1085
|
+
* const wallet = privateKeyToAccount("0x...");
|
|
1086
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1087
|
+
* const client = new hl.WalletClient({ wallet, transport });
|
|
1088
|
+
*
|
|
1089
|
+
* // Unknown what the successful response will be
|
|
1090
|
+
* const result = await client.spotDeploy({
|
|
1091
|
+
* registerToken2: {
|
|
1092
|
+
* spec: {
|
|
1093
|
+
* name: "TestToken",
|
|
1094
|
+
* szDecimals: 8,
|
|
1095
|
+
* weiDecimals: 8,
|
|
1096
|
+
* },
|
|
1097
|
+
* maxGas: 1000000,
|
|
1098
|
+
* fullName: "TestToken (TT)"
|
|
1099
|
+
* }
|
|
1100
|
+
* });
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
async spotDeploy(args, signal) {
|
|
1104
|
+
// Destructure the parameters
|
|
1105
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1106
|
+
// Construct an action
|
|
1107
|
+
let action;
|
|
1108
|
+
if ("registerToken2" in actionArgs) {
|
|
1109
|
+
action = {
|
|
1110
|
+
type: "spotDeploy",
|
|
1111
|
+
registerToken2: {
|
|
1112
|
+
spec: {
|
|
1113
|
+
name: actionArgs.registerToken2.spec.name,
|
|
1114
|
+
szDecimals: actionArgs.registerToken2.spec.szDecimals,
|
|
1115
|
+
weiDecimals: actionArgs.registerToken2.spec.weiDecimals,
|
|
1116
|
+
},
|
|
1117
|
+
maxGas: actionArgs.registerToken2.maxGas,
|
|
1118
|
+
fullName: actionArgs.registerToken2.fullName,
|
|
1119
|
+
},
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
else if ("userGenesis" in actionArgs) {
|
|
1123
|
+
action = {
|
|
1124
|
+
type: "spotDeploy",
|
|
1125
|
+
userGenesis: {
|
|
1126
|
+
token: actionArgs.userGenesis.token,
|
|
1127
|
+
userAndWei: actionArgs.userGenesis.userAndWei,
|
|
1128
|
+
existingTokenAndWei: actionArgs.userGenesis.existingTokenAndWei,
|
|
1129
|
+
},
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
else if ("genesis" in actionArgs) {
|
|
1133
|
+
action = {
|
|
1134
|
+
type: "spotDeploy",
|
|
1135
|
+
genesis: {
|
|
1136
|
+
token: actionArgs.genesis.token,
|
|
1137
|
+
maxSupply: actionArgs.genesis.maxSupply,
|
|
1138
|
+
},
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
else if ("registerSpot" in actionArgs) {
|
|
1142
|
+
action = {
|
|
1143
|
+
type: "spotDeploy",
|
|
1144
|
+
registerSpot: {
|
|
1145
|
+
tokens: actionArgs.registerSpot.tokens,
|
|
1146
|
+
},
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
action = {
|
|
1151
|
+
type: "spotDeploy",
|
|
1152
|
+
registerHyperliquidity: {
|
|
1153
|
+
spot: actionArgs.registerHyperliquidity.spot,
|
|
1154
|
+
startPx: actionArgs.registerHyperliquidity.startPx,
|
|
1155
|
+
orderSz: actionArgs.registerHyperliquidity.orderSz,
|
|
1156
|
+
nOrders: actionArgs.registerHyperliquidity.nOrders,
|
|
1157
|
+
nSeededLevels: actionArgs.registerHyperliquidity.nSeededLevels,
|
|
1158
|
+
},
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
// Sign the action
|
|
1162
|
+
const signature = await (0, signing_js_1.signL1Action)({
|
|
1163
|
+
wallet: this.wallet,
|
|
1164
|
+
action,
|
|
1165
|
+
nonce,
|
|
1166
|
+
isTestnet: this.isTestnet,
|
|
1167
|
+
});
|
|
1168
|
+
// Send a request
|
|
1169
|
+
const request = { action, signature, nonce };
|
|
1170
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1171
|
+
// Validate a response
|
|
1172
|
+
this._validateResponse(response);
|
|
1173
|
+
return response;
|
|
1174
|
+
}
|
|
1022
1175
|
/**
|
|
1023
1176
|
* Transfer a spot asset on L1 to another address.
|
|
1024
1177
|
* @param args - The parameters for the request.
|
|
@@ -1049,8 +1202,10 @@
|
|
|
1049
1202
|
...args,
|
|
1050
1203
|
type: "spotSend",
|
|
1051
1204
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
1052
|
-
signatureChainId: this.signatureChainId
|
|
1053
|
-
|
|
1205
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
1206
|
+
? this.signatureChainId
|
|
1207
|
+
: await this.signatureChainId(),
|
|
1208
|
+
time: args.time ?? this._nonce,
|
|
1054
1209
|
};
|
|
1055
1210
|
// Sign the action
|
|
1056
1211
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -1098,7 +1253,7 @@
|
|
|
1098
1253
|
*/
|
|
1099
1254
|
async spotUser(args, signal) {
|
|
1100
1255
|
// Destructure the parameters
|
|
1101
|
-
const { nonce =
|
|
1256
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1102
1257
|
// Construct an action
|
|
1103
1258
|
const action = {
|
|
1104
1259
|
type: "spotUser",
|
|
@@ -1147,7 +1302,7 @@
|
|
|
1147
1302
|
*/
|
|
1148
1303
|
async subAccountSpotTransfer(args, signal) {
|
|
1149
1304
|
// Destructure the parameters
|
|
1150
|
-
const { nonce =
|
|
1305
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1151
1306
|
// Construct an action
|
|
1152
1307
|
const action = {
|
|
1153
1308
|
type: "subAccountSpotTransfer",
|
|
@@ -1196,7 +1351,7 @@
|
|
|
1196
1351
|
*/
|
|
1197
1352
|
async subAccountTransfer(args, signal) {
|
|
1198
1353
|
// Destructure the parameters
|
|
1199
|
-
const { nonce =
|
|
1354
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1200
1355
|
// Construct an action
|
|
1201
1356
|
const action = {
|
|
1202
1357
|
type: "subAccountTransfer",
|
|
@@ -1248,8 +1403,10 @@
|
|
|
1248
1403
|
...args,
|
|
1249
1404
|
type: "tokenDelegate",
|
|
1250
1405
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
1251
|
-
signatureChainId: this.signatureChainId
|
|
1252
|
-
|
|
1406
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
1407
|
+
? this.signatureChainId
|
|
1408
|
+
: await this.signatureChainId(),
|
|
1409
|
+
nonce: args.nonce ?? this._nonce,
|
|
1253
1410
|
};
|
|
1254
1411
|
// Sign the action
|
|
1255
1412
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -1298,7 +1455,7 @@
|
|
|
1298
1455
|
*/
|
|
1299
1456
|
async twapCancel(args, signal) {
|
|
1300
1457
|
// Destructure the parameters
|
|
1301
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
1458
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
1302
1459
|
// Construct an action
|
|
1303
1460
|
const action = {
|
|
1304
1461
|
type: "twapCancel",
|
|
@@ -1349,14 +1506,14 @@
|
|
|
1349
1506
|
*/
|
|
1350
1507
|
async twapOrder(args, signal) {
|
|
1351
1508
|
// Destructure the parameters
|
|
1352
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
1509
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
1353
1510
|
// Construct an action
|
|
1354
1511
|
const action = {
|
|
1355
1512
|
type: "twapOrder",
|
|
1356
1513
|
twap: {
|
|
1357
1514
|
a: actionArgs.a,
|
|
1358
1515
|
b: actionArgs.b,
|
|
1359
|
-
s: actionArgs.s,
|
|
1516
|
+
s: this._formatDecimal(actionArgs.s),
|
|
1360
1517
|
r: actionArgs.r,
|
|
1361
1518
|
m: actionArgs.m,
|
|
1362
1519
|
t: actionArgs.t,
|
|
@@ -1403,7 +1560,7 @@
|
|
|
1403
1560
|
*/
|
|
1404
1561
|
async updateIsolatedMargin(args, signal) {
|
|
1405
1562
|
// Destructure the parameters
|
|
1406
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
1563
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
1407
1564
|
// Construct an action
|
|
1408
1565
|
const action = {
|
|
1409
1566
|
type: "updateIsolatedMargin",
|
|
@@ -1452,7 +1609,7 @@
|
|
|
1452
1609
|
*/
|
|
1453
1610
|
async updateLeverage(args, signal) {
|
|
1454
1611
|
// Destructure the parameters
|
|
1455
|
-
const { vaultAddress = this.defaultVaultAddress, nonce =
|
|
1612
|
+
const { vaultAddress = this.defaultVaultAddress, nonce = this._nonce, ...actionArgs } = args;
|
|
1456
1613
|
// Construct an action
|
|
1457
1614
|
const action = {
|
|
1458
1615
|
type: "updateLeverage",
|
|
@@ -1504,8 +1661,10 @@
|
|
|
1504
1661
|
...args,
|
|
1505
1662
|
type: "usdClassTransfer",
|
|
1506
1663
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
1507
|
-
signatureChainId: this.signatureChainId
|
|
1508
|
-
|
|
1664
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
1665
|
+
? this.signatureChainId
|
|
1666
|
+
: await this.signatureChainId(),
|
|
1667
|
+
nonce: args.nonce ?? this._nonce,
|
|
1509
1668
|
};
|
|
1510
1669
|
// Sign the action
|
|
1511
1670
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -1557,8 +1716,10 @@
|
|
|
1557
1716
|
...args,
|
|
1558
1717
|
type: "usdSend",
|
|
1559
1718
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
1560
|
-
signatureChainId: this.signatureChainId
|
|
1561
|
-
|
|
1719
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
1720
|
+
? this.signatureChainId
|
|
1721
|
+
: await this.signatureChainId(),
|
|
1722
|
+
time: args.time ?? this._nonce,
|
|
1562
1723
|
};
|
|
1563
1724
|
// Sign the action
|
|
1564
1725
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -1606,7 +1767,7 @@
|
|
|
1606
1767
|
*/
|
|
1607
1768
|
async vaultDistribute(args, signal) {
|
|
1608
1769
|
// Destructure the parameters
|
|
1609
|
-
const { nonce =
|
|
1770
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1610
1771
|
// Construct an action
|
|
1611
1772
|
const action = {
|
|
1612
1773
|
type: "vaultDistribute",
|
|
@@ -1653,7 +1814,7 @@
|
|
|
1653
1814
|
*/
|
|
1654
1815
|
async vaultModify(args, signal) {
|
|
1655
1816
|
// Destructure the parameters
|
|
1656
|
-
const { nonce =
|
|
1817
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1657
1818
|
// Construct an action
|
|
1658
1819
|
const action = {
|
|
1659
1820
|
type: "vaultModify",
|
|
@@ -1701,7 +1862,7 @@
|
|
|
1701
1862
|
*/
|
|
1702
1863
|
async vaultTransfer(args, signal) {
|
|
1703
1864
|
// Destructure the parameters
|
|
1704
|
-
const { nonce =
|
|
1865
|
+
const { nonce = this._nonce, ...actionArgs } = args;
|
|
1705
1866
|
// Construct an action
|
|
1706
1867
|
const action = {
|
|
1707
1868
|
type: "vaultTransfer",
|
|
@@ -1752,8 +1913,10 @@
|
|
|
1752
1913
|
...args,
|
|
1753
1914
|
type: "withdraw3",
|
|
1754
1915
|
hyperliquidChain: this.isTestnet ? "Testnet" : "Mainnet",
|
|
1755
|
-
signatureChainId: this.signatureChainId
|
|
1756
|
-
|
|
1916
|
+
signatureChainId: typeof this.signatureChainId === "string"
|
|
1917
|
+
? this.signatureChainId
|
|
1918
|
+
: await this.signatureChainId(),
|
|
1919
|
+
time: args.time ?? this._nonce,
|
|
1757
1920
|
};
|
|
1758
1921
|
// Sign the action
|
|
1759
1922
|
const signature = await (0, signing_js_1.signUserSignedAction)({
|
|
@@ -1776,6 +1939,15 @@
|
|
|
1776
1939
|
this._validateResponse(response);
|
|
1777
1940
|
return response;
|
|
1778
1941
|
}
|
|
1942
|
+
// ——————————————— Private methods ———————————————
|
|
1943
|
+
/** Formats a decimal number as a string, removing trailing zeros. */
|
|
1944
|
+
_formatDecimal(numStr) {
|
|
1945
|
+
if (!numStr.includes("."))
|
|
1946
|
+
return numStr;
|
|
1947
|
+
const [intPart, fracPart] = numStr.split(".");
|
|
1948
|
+
const newFrac = fracPart.replace(/0+$/, "");
|
|
1949
|
+
return newFrac ? `${intPart}.${newFrac}` : intPart;
|
|
1950
|
+
}
|
|
1779
1951
|
/** Validate a response from the API. */
|
|
1780
1952
|
_validateResponse(response) {
|
|
1781
1953
|
if (response.status === "err") {
|
package/script/src/signing.d.ts
CHANGED
|
@@ -70,10 +70,10 @@ export interface AbstractEthersV5Signer {
|
|
|
70
70
|
}
|
|
71
71
|
/** Abstract interface for a [window.ethereum](https://eips.ethereum.org/EIPS/eip-1193) object. */
|
|
72
72
|
export interface AbstractWindowEthereum {
|
|
73
|
-
request
|
|
74
|
-
method:
|
|
75
|
-
params:
|
|
76
|
-
})
|
|
73
|
+
request(args: {
|
|
74
|
+
method: any;
|
|
75
|
+
params: any;
|
|
76
|
+
}): Promise<any>;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Create a hash of the L1 action.
|
|
@@ -132,4 +132,14 @@ export declare function signUserSignedAction(args: {
|
|
|
132
132
|
s: Hex;
|
|
133
133
|
v: number;
|
|
134
134
|
}>;
|
|
135
|
+
/** Checks if the given value is an abstract viem wallet. */
|
|
136
|
+
export declare function isAbstractViemWalletClient(client: unknown): client is AbstractViemWalletClient;
|
|
137
|
+
/** Checks if the given value is an abstract extended viem wallet (e.g. privy `useSignTypedData`). */
|
|
138
|
+
export declare function isAbstractExtendedViemWalletClient(client: unknown): client is AbstractViemWalletClient;
|
|
139
|
+
/** Checks if the given value is an abstract ethers signer. */
|
|
140
|
+
export declare function isAbstractEthersSigner(client: unknown): client is AbstractEthersSigner;
|
|
141
|
+
/** Checks if the given value is an abstract ethers v5 signer. */
|
|
142
|
+
export declare function isAbstractEthersV5Signer(client: unknown): client is AbstractEthersV5Signer;
|
|
143
|
+
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
144
|
+
export declare function isAbstractWindowEthereum(client: unknown): client is AbstractWindowEthereum;
|
|
135
145
|
//# sourceMappingURL=signing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/src/signing.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAEpG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,YAAY,EAAE,GAAG,EAAE,CAAC;AACpB,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAEpC,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACrC,aAAa,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,iBAAiB,EAAE,GAAG,CAAC;SAC1B,CAAC;QACF,KAAK,EAAE;YACH,CAAC,GAAG,EAAE,MAAM,GAAG;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aAChB,EAAE,CAAC;SACP,CAAC;QACF,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EA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AA;CAAE,CAAC,CAYzC;AA6FD,4DAA4D;AAC5D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,wBAAwB,CAI9F;AAED,qGAAqG;AACrG,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,wBAAwB,CAItG;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,oBAAoB,CAItF;AAED,iEAAiE;AACjE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F;AAED,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F"}
|
package/script/src/signing.js
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
exports.createL1ActionHash = createL1ActionHash;
|
|
13
13
|
exports.signL1Action = signL1Action;
|
|
14
14
|
exports.signUserSignedAction = signUserSignedAction;
|
|
15
|
+
exports.isAbstractViemWalletClient = isAbstractViemWalletClient;
|
|
16
|
+
exports.isAbstractExtendedViemWalletClient = isAbstractExtendedViemWalletClient;
|
|
17
|
+
exports.isAbstractEthersSigner = isAbstractEthersSigner;
|
|
18
|
+
exports.isAbstractEthersV5Signer = isAbstractEthersV5Signer;
|
|
19
|
+
exports.isAbstractWindowEthereum = isAbstractWindowEthereum;
|
|
15
20
|
const sha3_js_1 = require("../deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js");
|
|
16
21
|
const encode_js_1 = require("../deps/jsr.io/@std/msgpack/1.0.3/encode.js");
|
|
17
22
|
const hex_js_1 = require("../deps/jsr.io/@std/encoding/1.0.7/hex.js");
|