@nktkas/hyperliquid 0.14.0 → 0.15.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/CONTRIBUTING.md +4 -7
- package/README.md +9 -26
- package/esm/src/base.d.ts +1 -1
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +30 -30
- package/esm/src/transports/http/http_transport.d.ts +1 -3
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +7 -12
- 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 +4 -1
- package/package.json +1 -1
- package/script/src/base.d.ts +1 -1
- package/script/src/base.d.ts.map +1 -1
- package/script/src/clients/wallet.js +30 -30
- package/script/src/transports/http/http_transport.d.ts +1 -3
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +7 -12
- 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 +4 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -40,20 +40,17 @@ git push origin feature/your-feature-name
|
|
|
40
40
|
- **Create a Pull Request**: Go to the original repository and click on "New Pull Request". Select your branch and
|
|
41
41
|
submit the pull request.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
#### Coding Guidelines
|
|
44
44
|
|
|
45
45
|
- **TypeScript**: Ensure your code passes TypeScript compilation without errors.
|
|
46
|
-
- **Style**: Follow
|
|
46
|
+
- **Style**: Follow Deno formatting convention ([deno fmt](https://docs.deno.com/runtime/reference/cli/fmt/)) and code
|
|
47
|
+
style ([deno lint](https://docs.deno.com/runtime/reference/cli/lint/)).
|
|
47
48
|
- **Dependencies**: Avoid adding unnecessary dependencies.
|
|
48
49
|
- **Docs**: Update or add JSDoc comments where appropriate.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
#### Testing
|
|
51
52
|
|
|
52
53
|
Before submitting your pull request:
|
|
53
54
|
|
|
54
55
|
- Run existing tests to ensure nothing breaks.
|
|
55
56
|
- If you add new features, consider adding tests for them.
|
|
56
|
-
|
|
57
|
-
### License
|
|
58
|
-
|
|
59
|
-
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/README.md
CHANGED
|
@@ -410,7 +410,7 @@ class HttpTransport {
|
|
|
410
410
|
onResponse?: (response: Response) => MaybePromise<Response | void | null | undefined>; // A callback after response is received
|
|
411
411
|
});
|
|
412
412
|
|
|
413
|
-
request(endpoint: "info" | "
|
|
413
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
414
414
|
}
|
|
415
415
|
```
|
|
416
416
|
|
|
@@ -436,7 +436,7 @@ class WebSocketTransport {
|
|
|
436
436
|
};
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
request(endpoint: "info" | "
|
|
439
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
440
440
|
subscribe(
|
|
441
441
|
channel: string,
|
|
442
442
|
payload: unknown,
|
|
@@ -480,17 +480,17 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
480
480
|
const wallet = privateKeyToAccount("0x..."); // Change to your private key
|
|
481
481
|
|
|
482
482
|
// The CancelRequest["action"] type ensures that we collect the correct cancel request action
|
|
483
|
-
const action: CancelRequest["action"] = {
|
|
483
|
+
const action: CancelRequest["action"] = {
|
|
484
|
+
type: "cancel",
|
|
485
|
+
cancels: [
|
|
486
|
+
{ a: 0, o: 12345 },
|
|
487
|
+
],
|
|
488
|
+
};
|
|
484
489
|
const nonce = Date.now();
|
|
485
490
|
|
|
486
491
|
// —————————— Signing ——————————
|
|
487
492
|
|
|
488
|
-
const signature = await signL1Action({
|
|
489
|
-
wallet,
|
|
490
|
-
action: sortedAction,
|
|
491
|
-
nonce,
|
|
492
|
-
isTestnet: true,
|
|
493
|
-
});
|
|
493
|
+
const signature = await signL1Action({ wallet, action, nonce, isTestnet: true });
|
|
494
494
|
|
|
495
495
|
// —————————— Request ——————————
|
|
496
496
|
|
|
@@ -572,23 +572,6 @@ const body = await response.json() as SuccessResponse | ErrorResponse;
|
|
|
572
572
|
console.log("Agent approval response:", body);
|
|
573
573
|
```
|
|
574
574
|
|
|
575
|
-
## Versioning Policy
|
|
576
|
-
|
|
577
|
-
This library follows a [stricter version](https://github.com/semver/semver/pull/923) of
|
|
578
|
-
[Semantic Versioning](https://semver.org/) for its releases.
|
|
579
|
-
|
|
580
|
-
> [!IMPORTANT]
|
|
581
|
-
> To avoid rapid increase in the main version of the SDK due to changes in Hyperliquid API types, such changes are
|
|
582
|
-
> reflected in updates to the patch version of this SDK.
|
|
583
|
-
|
|
584
|
-
## CI/CD and Release
|
|
585
|
-
|
|
586
|
-
Before publishing a new version of the SDK, tests are always run in
|
|
587
|
-
[Github Actions](https://github.com/nktkas/hyperliquid/actions). Only if all tests pass successfully, the process of
|
|
588
|
-
publishing the package takes place.
|
|
589
|
-
|
|
590
|
-
For more details, see our [CI/CD configuration files](./.github/workflows/).
|
|
591
|
-
|
|
592
575
|
## Contributing
|
|
593
576
|
|
|
594
577
|
Contributions are welcome! Please see the [CONTRIBUTING](./CONTRIBUTING.md) file for guidelines on how to contribute to
|
package/esm/src/base.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface IRequestTransport {
|
|
|
15
15
|
* @param signal - An ptional abort signal.
|
|
16
16
|
* @returns A promise that resolves with parsed JSON response body.
|
|
17
17
|
*/
|
|
18
|
-
request(endpoint: "info" | "
|
|
18
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Interface representing an event subscription transport.
|
package/esm/src/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/src/base.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,OAAO,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/src/base.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,OAAO,CACH,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;;;;OAOG;IACH,SAAS,CACL,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5B;AAED,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC3B,OAAO,CAAC,EAAE,MAAM;CAI/B;AAED,mDAAmD;AACnD,qBAAa,cAAe,SAAQ,gBAAgB;gBACpC,OAAO,CAAC,EAAE,MAAM;CAI/B"}
|
|
@@ -189,7 +189,7 @@ export class WalletClient {
|
|
|
189
189
|
});
|
|
190
190
|
// Send a request
|
|
191
191
|
const request = { action, signature, nonce: action.nonce };
|
|
192
|
-
const response = await this.transport.request("
|
|
192
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
193
193
|
// Validate a response
|
|
194
194
|
this._validateResponse(response);
|
|
195
195
|
return response;
|
|
@@ -242,7 +242,7 @@ export class WalletClient {
|
|
|
242
242
|
});
|
|
243
243
|
// Send a request
|
|
244
244
|
const request = { action, signature, nonce: action.nonce };
|
|
245
|
-
const response = await this.transport.request("
|
|
245
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
246
246
|
// Validate a response
|
|
247
247
|
this._validateResponse(response);
|
|
248
248
|
return response;
|
|
@@ -330,7 +330,7 @@ export class WalletClient {
|
|
|
330
330
|
});
|
|
331
331
|
// Send a request
|
|
332
332
|
const request = { action, signature, nonce, vaultAddress };
|
|
333
|
-
const response = await this.transport.request("
|
|
333
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
334
334
|
// Validate a response
|
|
335
335
|
this._validateResponse(response);
|
|
336
336
|
return response;
|
|
@@ -381,7 +381,7 @@ export class WalletClient {
|
|
|
381
381
|
});
|
|
382
382
|
// Send a request
|
|
383
383
|
const request = { action, signature, nonce, vaultAddress };
|
|
384
|
-
const response = await this.transport.request("
|
|
384
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
385
385
|
// Validate a response
|
|
386
386
|
this._validateResponse(response);
|
|
387
387
|
return response;
|
|
@@ -430,7 +430,7 @@ export class WalletClient {
|
|
|
430
430
|
});
|
|
431
431
|
// Send a request
|
|
432
432
|
const request = { action, signature, nonce: action.nonce };
|
|
433
|
-
const response = await this.transport.request("
|
|
433
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
434
434
|
// Validate a response
|
|
435
435
|
this._validateResponse(response);
|
|
436
436
|
return response;
|
|
@@ -469,7 +469,7 @@ export class WalletClient {
|
|
|
469
469
|
});
|
|
470
470
|
// Send a request
|
|
471
471
|
const request = { action: sortedAction, signature, nonce };
|
|
472
|
-
const response = await this.transport.request("
|
|
472
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
473
473
|
// Validate a response
|
|
474
474
|
this._validateResponse(response);
|
|
475
475
|
return response;
|
|
@@ -520,7 +520,7 @@ export class WalletClient {
|
|
|
520
520
|
});
|
|
521
521
|
// Send a request
|
|
522
522
|
const request = { action, signature, nonce, vaultAddress };
|
|
523
|
-
const response = await this.transport.request("
|
|
523
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
524
524
|
// Validate a response
|
|
525
525
|
this._validateResponse(response);
|
|
526
526
|
return response;
|
|
@@ -569,7 +569,7 @@ export class WalletClient {
|
|
|
569
569
|
});
|
|
570
570
|
// Send a request
|
|
571
571
|
const request = { action, signature, nonce: action.nonce };
|
|
572
|
-
const response = await this.transport.request("
|
|
572
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
573
573
|
// Validate a response
|
|
574
574
|
this._validateResponse(response);
|
|
575
575
|
return response;
|
|
@@ -611,7 +611,7 @@ export class WalletClient {
|
|
|
611
611
|
});
|
|
612
612
|
// Send a request
|
|
613
613
|
const request = { action, signature, nonce };
|
|
614
|
-
const response = await this.transport.request("
|
|
614
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
615
615
|
// Validate a response
|
|
616
616
|
this._validateResponse(response);
|
|
617
617
|
return response;
|
|
@@ -653,7 +653,7 @@ export class WalletClient {
|
|
|
653
653
|
});
|
|
654
654
|
// Send a request
|
|
655
655
|
const request = { action, signature, nonce };
|
|
656
|
-
const response = await this.transport.request("
|
|
656
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
657
657
|
// Validate a response
|
|
658
658
|
this._validateResponse(response);
|
|
659
659
|
return response;
|
|
@@ -734,7 +734,7 @@ export class WalletClient {
|
|
|
734
734
|
});
|
|
735
735
|
// Send a request
|
|
736
736
|
const request = { action, signature, nonce, vaultAddress };
|
|
737
|
-
const response = await this.transport.request("
|
|
737
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
738
738
|
// Validate a response
|
|
739
739
|
this._validateResponse(response);
|
|
740
740
|
return response;
|
|
@@ -826,7 +826,7 @@ export class WalletClient {
|
|
|
826
826
|
});
|
|
827
827
|
// Send a request
|
|
828
828
|
const request = { action, signature, nonce, vaultAddress };
|
|
829
|
-
const response = await this.transport.request("
|
|
829
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
830
830
|
// Validate a response
|
|
831
831
|
this._validateResponse(response);
|
|
832
832
|
return response;
|
|
@@ -871,7 +871,7 @@ export class WalletClient {
|
|
|
871
871
|
});
|
|
872
872
|
// Send a request
|
|
873
873
|
const request = { action, signature, nonce, vaultAddress };
|
|
874
|
-
const response = await this.transport.request("
|
|
874
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
875
875
|
// Validate a response
|
|
876
876
|
this._validateResponse(response);
|
|
877
877
|
return response;
|
|
@@ -913,7 +913,7 @@ export class WalletClient {
|
|
|
913
913
|
});
|
|
914
914
|
// Send a request
|
|
915
915
|
const request = { action, signature, nonce };
|
|
916
|
-
const response = await this.transport.request("
|
|
916
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
917
917
|
// Validate a response
|
|
918
918
|
this._validateResponse(response);
|
|
919
919
|
return response;
|
|
@@ -955,7 +955,7 @@ export class WalletClient {
|
|
|
955
955
|
});
|
|
956
956
|
// Send a request
|
|
957
957
|
const request = { action, signature, nonce };
|
|
958
|
-
const response = await this.transport.request("
|
|
958
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
959
959
|
// Validate a response
|
|
960
960
|
this._validateResponse(response);
|
|
961
961
|
return response;
|
|
@@ -1010,7 +1010,7 @@ export class WalletClient {
|
|
|
1010
1010
|
});
|
|
1011
1011
|
// Send a request
|
|
1012
1012
|
const request = { action, signature, nonce: action.time };
|
|
1013
|
-
const response = await this.transport.request("
|
|
1013
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1014
1014
|
// Validate a response
|
|
1015
1015
|
this._validateResponse(response);
|
|
1016
1016
|
return response;
|
|
@@ -1056,7 +1056,7 @@ export class WalletClient {
|
|
|
1056
1056
|
});
|
|
1057
1057
|
// Send a request
|
|
1058
1058
|
const request = { action, signature, nonce };
|
|
1059
|
-
const response = await this.transport.request("
|
|
1059
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1060
1060
|
// Validate a response
|
|
1061
1061
|
this._validateResponse(response);
|
|
1062
1062
|
return response;
|
|
@@ -1106,7 +1106,7 @@ export class WalletClient {
|
|
|
1106
1106
|
});
|
|
1107
1107
|
// Send a request
|
|
1108
1108
|
const request = { action, signature, nonce };
|
|
1109
|
-
const response = await this.transport.request("
|
|
1109
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1110
1110
|
// Validate a response
|
|
1111
1111
|
this._validateResponse(response);
|
|
1112
1112
|
return response;
|
|
@@ -1154,7 +1154,7 @@ export class WalletClient {
|
|
|
1154
1154
|
});
|
|
1155
1155
|
// Send a request
|
|
1156
1156
|
const request = { action, signature, nonce };
|
|
1157
|
-
const response = await this.transport.request("
|
|
1157
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1158
1158
|
// Validate a response
|
|
1159
1159
|
this._validateResponse(response);
|
|
1160
1160
|
return response;
|
|
@@ -1209,7 +1209,7 @@ export class WalletClient {
|
|
|
1209
1209
|
});
|
|
1210
1210
|
// Send a request
|
|
1211
1211
|
const request = { action, signature, nonce: action.nonce };
|
|
1212
|
-
const response = await this.transport.request("
|
|
1212
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1213
1213
|
// Validate a response
|
|
1214
1214
|
this._validateResponse(response);
|
|
1215
1215
|
return response;
|
|
@@ -1256,7 +1256,7 @@ export class WalletClient {
|
|
|
1256
1256
|
});
|
|
1257
1257
|
// Send a request
|
|
1258
1258
|
const request = { action, signature, nonce, vaultAddress };
|
|
1259
|
-
const response = await this.transport.request("
|
|
1259
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1260
1260
|
// Validate a response
|
|
1261
1261
|
this._validateResponse(response);
|
|
1262
1262
|
return response;
|
|
@@ -1313,7 +1313,7 @@ export class WalletClient {
|
|
|
1313
1313
|
});
|
|
1314
1314
|
// Send a request
|
|
1315
1315
|
const request = { action, signature, nonce, vaultAddress };
|
|
1316
|
-
const response = await this.transport.request("
|
|
1316
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1317
1317
|
// Validate a response
|
|
1318
1318
|
this._validateResponse(response);
|
|
1319
1319
|
return response;
|
|
@@ -1362,7 +1362,7 @@ export class WalletClient {
|
|
|
1362
1362
|
});
|
|
1363
1363
|
// Send a request
|
|
1364
1364
|
const request = { action, signature, nonce, vaultAddress };
|
|
1365
|
-
const response = await this.transport.request("
|
|
1365
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1366
1366
|
// Validate a response
|
|
1367
1367
|
this._validateResponse(response);
|
|
1368
1368
|
return response;
|
|
@@ -1411,7 +1411,7 @@ export class WalletClient {
|
|
|
1411
1411
|
});
|
|
1412
1412
|
// Send a request
|
|
1413
1413
|
const request = { action, signature, nonce, vaultAddress };
|
|
1414
|
-
const response = await this.transport.request("
|
|
1414
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1415
1415
|
// Validate a response
|
|
1416
1416
|
this._validateResponse(response);
|
|
1417
1417
|
return response;
|
|
@@ -1464,7 +1464,7 @@ export class WalletClient {
|
|
|
1464
1464
|
});
|
|
1465
1465
|
// Send a request
|
|
1466
1466
|
const request = { action, signature, nonce: action.nonce };
|
|
1467
|
-
const response = await this.transport.request("
|
|
1467
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1468
1468
|
// Validate a response
|
|
1469
1469
|
this._validateResponse(response);
|
|
1470
1470
|
return response;
|
|
@@ -1517,7 +1517,7 @@ export class WalletClient {
|
|
|
1517
1517
|
});
|
|
1518
1518
|
// Send a request
|
|
1519
1519
|
const request = { action, signature, nonce: action.time };
|
|
1520
|
-
const response = await this.transport.request("
|
|
1520
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1521
1521
|
// Validate a response
|
|
1522
1522
|
this._validateResponse(response);
|
|
1523
1523
|
return response;
|
|
@@ -1563,7 +1563,7 @@ export class WalletClient {
|
|
|
1563
1563
|
});
|
|
1564
1564
|
// Send a request
|
|
1565
1565
|
const request = { action, signature, nonce };
|
|
1566
|
-
const response = await this.transport.request("
|
|
1566
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1567
1567
|
// Validate a response
|
|
1568
1568
|
this._validateResponse(response);
|
|
1569
1569
|
return response;
|
|
@@ -1611,7 +1611,7 @@ export class WalletClient {
|
|
|
1611
1611
|
});
|
|
1612
1612
|
// Send a request
|
|
1613
1613
|
const request = { action, signature, nonce };
|
|
1614
|
-
const response = await this.transport.request("
|
|
1614
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1615
1615
|
// Validate a response
|
|
1616
1616
|
this._validateResponse(response);
|
|
1617
1617
|
return response;
|
|
@@ -1659,7 +1659,7 @@ export class WalletClient {
|
|
|
1659
1659
|
});
|
|
1660
1660
|
// Send a request
|
|
1661
1661
|
const request = { action, signature, nonce };
|
|
1662
|
-
const response = await this.transport.request("
|
|
1662
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1663
1663
|
// Validate a response
|
|
1664
1664
|
this._validateResponse(response);
|
|
1665
1665
|
return response;
|
|
@@ -1712,7 +1712,7 @@ export class WalletClient {
|
|
|
1712
1712
|
});
|
|
1713
1713
|
// Send a request
|
|
1714
1714
|
const request = { action, signature, nonce: action.time };
|
|
1715
|
-
const response = await this.transport.request("
|
|
1715
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1716
1716
|
// Validate a response
|
|
1717
1717
|
this._validateResponse(response);
|
|
1718
1718
|
return response;
|
|
@@ -56,8 +56,6 @@ export declare class HttpTransport implements IRequestTransport, HttpTransportOp
|
|
|
56
56
|
fetchOptions: Omit<RequestInit, "body" | "method">;
|
|
57
57
|
onRequest?: (request: Request) => MaybePromise<Request | void | null | undefined>;
|
|
58
58
|
onResponse?: (response: Response) => MaybePromise<Response | void | null | undefined>;
|
|
59
|
-
/** Mapping of endpoint types to their API paths. */
|
|
60
|
-
protected _endpointPaths: Record<"info" | "action" | "explorer", string>;
|
|
61
59
|
/**
|
|
62
60
|
* Creates a new HTTP transport instance.
|
|
63
61
|
* @param options - Configuration options for the HTTP transport layer.
|
|
@@ -72,7 +70,7 @@ export declare class HttpTransport implements IRequestTransport, HttpTransportOp
|
|
|
72
70
|
* @throws {HttpRequestError} - Thrown when an HTTP response is deemed invalid.
|
|
73
71
|
* @throws May throw {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch#exceptions | fetch errors}.
|
|
74
72
|
*/
|
|
75
|
-
request(endpoint: "info" | "
|
|
73
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
76
74
|
}
|
|
77
75
|
export {};
|
|
78
76
|
//# sourceMappingURL=http_transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/http/http_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvE,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAM7B,QAAQ,EAAE,QAAQ;IAAS,YAAY,CAAC,EAAE,MAAM;IALnE;;;;OAIG;gBACgB,QAAQ,EAAE,QAAQ,EAAS,YAAY,CAAC,EAAE,MAAM,YAAA;CAOtE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,2IAA2I;IAC3I,YAAY,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IAEpD;;;;OAIG;IACH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0
|
|
71
71
|
});
|
|
72
|
-
/** Mapping of endpoint types to their API paths. */
|
|
73
|
-
Object.defineProperty(this, "_endpointPaths", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: {
|
|
78
|
-
info: "/info",
|
|
79
|
-
action: "/exchange",
|
|
80
|
-
explorer: "/explorer",
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
72
|
this.url = options?.url ?? "https://api.hyperliquid.xyz";
|
|
84
73
|
this.timeout = options?.timeout === undefined ? 10_000 : options.timeout;
|
|
85
74
|
this.fetchOptions = options?.fetchOptions ?? {};
|
|
@@ -97,7 +86,13 @@ export class HttpTransport {
|
|
|
97
86
|
*/
|
|
98
87
|
async request(endpoint, payload, signal) {
|
|
99
88
|
// Construct a Request
|
|
100
|
-
const url = new URL(
|
|
89
|
+
const url = new URL(endpoint, this.url);
|
|
90
|
+
// FIXME: Temporary hack: replace `api.hyperliquid-testnet.xyz/explorer` with `rpc.hyperliquid-testnet.xyz/explorer`
|
|
91
|
+
// until the new rpc url becomes the standard for mainnet.
|
|
92
|
+
// Maybe after that should split the url property into api and rpc variants.
|
|
93
|
+
if (url.hostname === "api.hyperliquid-testnet.xyz" && url.pathname === "/explorer") {
|
|
94
|
+
url.hostname = "rpc.hyperliquid-testnet.xyz";
|
|
95
|
+
}
|
|
101
96
|
const init = mergeRequestInit({
|
|
102
97
|
body: JSON.stringify(payload),
|
|
103
98
|
headers: {
|
|
@@ -83,7 +83,7 @@ export declare class WebSocketTransport implements IRequestTransport, ISubscript
|
|
|
83
83
|
* @throws {WebSocketRequestError} - An error that occurs when a WebSocket request fails.
|
|
84
84
|
* @note Explorer requests are not supported in the Hyperliquid WebSocket API.
|
|
85
85
|
*/
|
|
86
|
-
request(type: "info" | "
|
|
86
|
+
request(type: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
87
87
|
/**
|
|
88
88
|
* Subscribes to a Hyperliquid event channel.
|
|
89
89
|
* @param channel - The event channel to listen to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAExG,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACtC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACR;;;;WAIG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,kFAAkF;AAClF,qBAAa,kBAAmB,YAAW,iBAAiB,EAAE,sBAAsB;IAChF,qDAAqD;IACrD,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhD,iDAAiD;IACjD,SAAS,CAAC,YAAY,EAAE,0BAA0B,CAAC;IAEnD,6CAA6C;IAC7C,SAAS,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAE5C;;;;;OAKG;IACH,SAAS,CAAC,cAAc,EAAE,GAAG,CACzB,MAAM,EACN;QACI,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACrF,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;KACpC,CACJ,CAAa;IAEd;;;OAGG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE;QAChB;;;WAGG;QACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACpC,CAAC;IAEF,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAEvC;;;OAGG;gBACS,OAAO,CAAC,EAAE,yBAAyB;IAuC/C;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAExG,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACtC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,E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C,IAAI,EAAE,WAAW,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,YAAY,CAAC;IAgExB;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB1C;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB1C,wDAAwD;IACxD,SAAS,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS;CAK9G"}
|
|
@@ -112,7 +112,10 @@ export class WebSocketTransport {
|
|
|
112
112
|
}
|
|
113
113
|
// Send the request and wait for a response
|
|
114
114
|
const combinedSignal = this._combineTimeoutWithSignal(this.timeout, signal);
|
|
115
|
-
return this._wsRequester.request("post", {
|
|
115
|
+
return this._wsRequester.request("post", {
|
|
116
|
+
type: type === "exchange" ? "action" : type,
|
|
117
|
+
payload,
|
|
118
|
+
}, combinedSignal);
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
121
|
* Subscribes to a Hyperliquid event channel.
|
package/package.json
CHANGED
package/script/src/base.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface IRequestTransport {
|
|
|
15
15
|
* @param signal - An ptional abort signal.
|
|
16
16
|
* @returns A promise that resolves with parsed JSON response body.
|
|
17
17
|
*/
|
|
18
|
-
request(endpoint: "info" | "
|
|
18
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Interface representing an event subscription transport.
|
package/script/src/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/src/base.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,OAAO,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/src/base.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,OAAO,CACH,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;;;;OAOG;IACH,SAAS,CACL,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5B;AAED,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC3B,OAAO,CAAC,EAAE,MAAM;CAI/B;AAED,mDAAmD;AACnD,qBAAa,cAAe,SAAQ,gBAAgB;gBACpC,OAAO,CAAC,EAAE,MAAM;CAI/B"}
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
});
|
|
203
203
|
// Send a request
|
|
204
204
|
const request = { action, signature, nonce: action.nonce };
|
|
205
|
-
const response = await this.transport.request("
|
|
205
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
206
206
|
// Validate a response
|
|
207
207
|
this._validateResponse(response);
|
|
208
208
|
return response;
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
});
|
|
256
256
|
// Send a request
|
|
257
257
|
const request = { action, signature, nonce: action.nonce };
|
|
258
|
-
const response = await this.transport.request("
|
|
258
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
259
259
|
// Validate a response
|
|
260
260
|
this._validateResponse(response);
|
|
261
261
|
return response;
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
});
|
|
344
344
|
// Send a request
|
|
345
345
|
const request = { action, signature, nonce, vaultAddress };
|
|
346
|
-
const response = await this.transport.request("
|
|
346
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
347
347
|
// Validate a response
|
|
348
348
|
this._validateResponse(response);
|
|
349
349
|
return response;
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
});
|
|
395
395
|
// Send a request
|
|
396
396
|
const request = { action, signature, nonce, vaultAddress };
|
|
397
|
-
const response = await this.transport.request("
|
|
397
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
398
398
|
// Validate a response
|
|
399
399
|
this._validateResponse(response);
|
|
400
400
|
return response;
|
|
@@ -443,7 +443,7 @@
|
|
|
443
443
|
});
|
|
444
444
|
// Send a request
|
|
445
445
|
const request = { action, signature, nonce: action.nonce };
|
|
446
|
-
const response = await this.transport.request("
|
|
446
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
447
447
|
// Validate a response
|
|
448
448
|
this._validateResponse(response);
|
|
449
449
|
return response;
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
});
|
|
483
483
|
// Send a request
|
|
484
484
|
const request = { action: sortedAction, signature, nonce };
|
|
485
|
-
const response = await this.transport.request("
|
|
485
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
486
486
|
// Validate a response
|
|
487
487
|
this._validateResponse(response);
|
|
488
488
|
return response;
|
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
});
|
|
534
534
|
// Send a request
|
|
535
535
|
const request = { action, signature, nonce, vaultAddress };
|
|
536
|
-
const response = await this.transport.request("
|
|
536
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
537
537
|
// Validate a response
|
|
538
538
|
this._validateResponse(response);
|
|
539
539
|
return response;
|
|
@@ -582,7 +582,7 @@
|
|
|
582
582
|
});
|
|
583
583
|
// Send a request
|
|
584
584
|
const request = { action, signature, nonce: action.nonce };
|
|
585
|
-
const response = await this.transport.request("
|
|
585
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
586
586
|
// Validate a response
|
|
587
587
|
this._validateResponse(response);
|
|
588
588
|
return response;
|
|
@@ -624,7 +624,7 @@
|
|
|
624
624
|
});
|
|
625
625
|
// Send a request
|
|
626
626
|
const request = { action, signature, nonce };
|
|
627
|
-
const response = await this.transport.request("
|
|
627
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
628
628
|
// Validate a response
|
|
629
629
|
this._validateResponse(response);
|
|
630
630
|
return response;
|
|
@@ -666,7 +666,7 @@
|
|
|
666
666
|
});
|
|
667
667
|
// Send a request
|
|
668
668
|
const request = { action, signature, nonce };
|
|
669
|
-
const response = await this.transport.request("
|
|
669
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
670
670
|
// Validate a response
|
|
671
671
|
this._validateResponse(response);
|
|
672
672
|
return response;
|
|
@@ -747,7 +747,7 @@
|
|
|
747
747
|
});
|
|
748
748
|
// Send a request
|
|
749
749
|
const request = { action, signature, nonce, vaultAddress };
|
|
750
|
-
const response = await this.transport.request("
|
|
750
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
751
751
|
// Validate a response
|
|
752
752
|
this._validateResponse(response);
|
|
753
753
|
return response;
|
|
@@ -839,7 +839,7 @@
|
|
|
839
839
|
});
|
|
840
840
|
// Send a request
|
|
841
841
|
const request = { action, signature, nonce, vaultAddress };
|
|
842
|
-
const response = await this.transport.request("
|
|
842
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
843
843
|
// Validate a response
|
|
844
844
|
this._validateResponse(response);
|
|
845
845
|
return response;
|
|
@@ -884,7 +884,7 @@
|
|
|
884
884
|
});
|
|
885
885
|
// Send a request
|
|
886
886
|
const request = { action, signature, nonce, vaultAddress };
|
|
887
|
-
const response = await this.transport.request("
|
|
887
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
888
888
|
// Validate a response
|
|
889
889
|
this._validateResponse(response);
|
|
890
890
|
return response;
|
|
@@ -926,7 +926,7 @@
|
|
|
926
926
|
});
|
|
927
927
|
// Send a request
|
|
928
928
|
const request = { action, signature, nonce };
|
|
929
|
-
const response = await this.transport.request("
|
|
929
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
930
930
|
// Validate a response
|
|
931
931
|
this._validateResponse(response);
|
|
932
932
|
return response;
|
|
@@ -968,7 +968,7 @@
|
|
|
968
968
|
});
|
|
969
969
|
// Send a request
|
|
970
970
|
const request = { action, signature, nonce };
|
|
971
|
-
const response = await this.transport.request("
|
|
971
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
972
972
|
// Validate a response
|
|
973
973
|
this._validateResponse(response);
|
|
974
974
|
return response;
|
|
@@ -1023,7 +1023,7 @@
|
|
|
1023
1023
|
});
|
|
1024
1024
|
// Send a request
|
|
1025
1025
|
const request = { action, signature, nonce: action.time };
|
|
1026
|
-
const response = await this.transport.request("
|
|
1026
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1027
1027
|
// Validate a response
|
|
1028
1028
|
this._validateResponse(response);
|
|
1029
1029
|
return response;
|
|
@@ -1069,7 +1069,7 @@
|
|
|
1069
1069
|
});
|
|
1070
1070
|
// Send a request
|
|
1071
1071
|
const request = { action, signature, nonce };
|
|
1072
|
-
const response = await this.transport.request("
|
|
1072
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1073
1073
|
// Validate a response
|
|
1074
1074
|
this._validateResponse(response);
|
|
1075
1075
|
return response;
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
});
|
|
1120
1120
|
// Send a request
|
|
1121
1121
|
const request = { action, signature, nonce };
|
|
1122
|
-
const response = await this.transport.request("
|
|
1122
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1123
1123
|
// Validate a response
|
|
1124
1124
|
this._validateResponse(response);
|
|
1125
1125
|
return response;
|
|
@@ -1167,7 +1167,7 @@
|
|
|
1167
1167
|
});
|
|
1168
1168
|
// Send a request
|
|
1169
1169
|
const request = { action, signature, nonce };
|
|
1170
|
-
const response = await this.transport.request("
|
|
1170
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1171
1171
|
// Validate a response
|
|
1172
1172
|
this._validateResponse(response);
|
|
1173
1173
|
return response;
|
|
@@ -1222,7 +1222,7 @@
|
|
|
1222
1222
|
});
|
|
1223
1223
|
// Send a request
|
|
1224
1224
|
const request = { action, signature, nonce: action.nonce };
|
|
1225
|
-
const response = await this.transport.request("
|
|
1225
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1226
1226
|
// Validate a response
|
|
1227
1227
|
this._validateResponse(response);
|
|
1228
1228
|
return response;
|
|
@@ -1269,7 +1269,7 @@
|
|
|
1269
1269
|
});
|
|
1270
1270
|
// Send a request
|
|
1271
1271
|
const request = { action, signature, nonce, vaultAddress };
|
|
1272
|
-
const response = await this.transport.request("
|
|
1272
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1273
1273
|
// Validate a response
|
|
1274
1274
|
this._validateResponse(response);
|
|
1275
1275
|
return response;
|
|
@@ -1326,7 +1326,7 @@
|
|
|
1326
1326
|
});
|
|
1327
1327
|
// Send a request
|
|
1328
1328
|
const request = { action, signature, nonce, vaultAddress };
|
|
1329
|
-
const response = await this.transport.request("
|
|
1329
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1330
1330
|
// Validate a response
|
|
1331
1331
|
this._validateResponse(response);
|
|
1332
1332
|
return response;
|
|
@@ -1375,7 +1375,7 @@
|
|
|
1375
1375
|
});
|
|
1376
1376
|
// Send a request
|
|
1377
1377
|
const request = { action, signature, nonce, vaultAddress };
|
|
1378
|
-
const response = await this.transport.request("
|
|
1378
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1379
1379
|
// Validate a response
|
|
1380
1380
|
this._validateResponse(response);
|
|
1381
1381
|
return response;
|
|
@@ -1424,7 +1424,7 @@
|
|
|
1424
1424
|
});
|
|
1425
1425
|
// Send a request
|
|
1426
1426
|
const request = { action, signature, nonce, vaultAddress };
|
|
1427
|
-
const response = await this.transport.request("
|
|
1427
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1428
1428
|
// Validate a response
|
|
1429
1429
|
this._validateResponse(response);
|
|
1430
1430
|
return response;
|
|
@@ -1477,7 +1477,7 @@
|
|
|
1477
1477
|
});
|
|
1478
1478
|
// Send a request
|
|
1479
1479
|
const request = { action, signature, nonce: action.nonce };
|
|
1480
|
-
const response = await this.transport.request("
|
|
1480
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1481
1481
|
// Validate a response
|
|
1482
1482
|
this._validateResponse(response);
|
|
1483
1483
|
return response;
|
|
@@ -1530,7 +1530,7 @@
|
|
|
1530
1530
|
});
|
|
1531
1531
|
// Send a request
|
|
1532
1532
|
const request = { action, signature, nonce: action.time };
|
|
1533
|
-
const response = await this.transport.request("
|
|
1533
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1534
1534
|
// Validate a response
|
|
1535
1535
|
this._validateResponse(response);
|
|
1536
1536
|
return response;
|
|
@@ -1576,7 +1576,7 @@
|
|
|
1576
1576
|
});
|
|
1577
1577
|
// Send a request
|
|
1578
1578
|
const request = { action, signature, nonce };
|
|
1579
|
-
const response = await this.transport.request("
|
|
1579
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1580
1580
|
// Validate a response
|
|
1581
1581
|
this._validateResponse(response);
|
|
1582
1582
|
return response;
|
|
@@ -1624,7 +1624,7 @@
|
|
|
1624
1624
|
});
|
|
1625
1625
|
// Send a request
|
|
1626
1626
|
const request = { action, signature, nonce };
|
|
1627
|
-
const response = await this.transport.request("
|
|
1627
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1628
1628
|
// Validate a response
|
|
1629
1629
|
this._validateResponse(response);
|
|
1630
1630
|
return response;
|
|
@@ -1672,7 +1672,7 @@
|
|
|
1672
1672
|
});
|
|
1673
1673
|
// Send a request
|
|
1674
1674
|
const request = { action, signature, nonce };
|
|
1675
|
-
const response = await this.transport.request("
|
|
1675
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1676
1676
|
// Validate a response
|
|
1677
1677
|
this._validateResponse(response);
|
|
1678
1678
|
return response;
|
|
@@ -1725,7 +1725,7 @@
|
|
|
1725
1725
|
});
|
|
1726
1726
|
// Send a request
|
|
1727
1727
|
const request = { action, signature, nonce: action.time };
|
|
1728
|
-
const response = await this.transport.request("
|
|
1728
|
+
const response = await this.transport.request("exchange", request, signal);
|
|
1729
1729
|
// Validate a response
|
|
1730
1730
|
this._validateResponse(response);
|
|
1731
1731
|
return response;
|
|
@@ -56,8 +56,6 @@ export declare class HttpTransport implements IRequestTransport, HttpTransportOp
|
|
|
56
56
|
fetchOptions: Omit<RequestInit, "body" | "method">;
|
|
57
57
|
onRequest?: (request: Request) => MaybePromise<Request | void | null | undefined>;
|
|
58
58
|
onResponse?: (response: Response) => MaybePromise<Response | void | null | undefined>;
|
|
59
|
-
/** Mapping of endpoint types to their API paths. */
|
|
60
|
-
protected _endpointPaths: Record<"info" | "action" | "explorer", string>;
|
|
61
59
|
/**
|
|
62
60
|
* Creates a new HTTP transport instance.
|
|
63
61
|
* @param options - Configuration options for the HTTP transport layer.
|
|
@@ -72,7 +70,7 @@ export declare class HttpTransport implements IRequestTransport, HttpTransportOp
|
|
|
72
70
|
* @throws {HttpRequestError} - Thrown when an HTTP response is deemed invalid.
|
|
73
71
|
* @throws May throw {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch#exceptions | fetch errors}.
|
|
74
72
|
*/
|
|
75
|
-
request(endpoint: "info" | "
|
|
73
|
+
request(endpoint: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
76
74
|
}
|
|
77
75
|
export {};
|
|
78
76
|
//# sourceMappingURL=http_transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/http/http_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvE,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAM7B,QAAQ,EAAE,QAAQ;IAAS,YAAY,CAAC,EAAE,MAAM;IALnE;;;;OAIG;gBACgB,QAAQ,EAAE,QAAQ,EAAS,YAAY,CAAC,EAAE,MAAM,YAAA;CAOtE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,2IAA2I;IAC3I,YAAY,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IAEpD;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,YAAY,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAElF;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,YAAY,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACzF;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,iBAAiB,EAAE,oBAAoB;IACzE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,IAAI,CA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AAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACzF;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,iBAAiB,EAAE,oBAAoB;IACzE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,YAAY,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAClF,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,YAAY,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAEtF;;;OAGG;gBACS,OAAO,CAAC,EAAE,oBAAoB;IAQ1C;;;;;;;;OAQG;IACG,OAAO,CACT,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC;CAqDtB"}
|
|
@@ -82,17 +82,6 @@
|
|
|
82
82
|
writable: true,
|
|
83
83
|
value: void 0
|
|
84
84
|
});
|
|
85
|
-
/** Mapping of endpoint types to their API paths. */
|
|
86
|
-
Object.defineProperty(this, "_endpointPaths", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
configurable: true,
|
|
89
|
-
writable: true,
|
|
90
|
-
value: {
|
|
91
|
-
info: "/info",
|
|
92
|
-
action: "/exchange",
|
|
93
|
-
explorer: "/explorer",
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
85
|
this.url = options?.url ?? "https://api.hyperliquid.xyz";
|
|
97
86
|
this.timeout = options?.timeout === undefined ? 10_000 : options.timeout;
|
|
98
87
|
this.fetchOptions = options?.fetchOptions ?? {};
|
|
@@ -110,7 +99,13 @@
|
|
|
110
99
|
*/
|
|
111
100
|
async request(endpoint, payload, signal) {
|
|
112
101
|
// Construct a Request
|
|
113
|
-
const url = new URL(
|
|
102
|
+
const url = new URL(endpoint, this.url);
|
|
103
|
+
// FIXME: Temporary hack: replace `api.hyperliquid-testnet.xyz/explorer` with `rpc.hyperliquid-testnet.xyz/explorer`
|
|
104
|
+
// until the new rpc url becomes the standard for mainnet.
|
|
105
|
+
// Maybe after that should split the url property into api and rpc variants.
|
|
106
|
+
if (url.hostname === "api.hyperliquid-testnet.xyz" && url.pathname === "/explorer") {
|
|
107
|
+
url.hostname = "rpc.hyperliquid-testnet.xyz";
|
|
108
|
+
}
|
|
114
109
|
const init = mergeRequestInit({
|
|
115
110
|
body: JSON.stringify(payload),
|
|
116
111
|
headers: {
|
|
@@ -83,7 +83,7 @@ export declare class WebSocketTransport implements IRequestTransport, ISubscript
|
|
|
83
83
|
* @throws {WebSocketRequestError} - An error that occurs when a WebSocket request fails.
|
|
84
84
|
* @note Explorer requests are not supported in the Hyperliquid WebSocket API.
|
|
85
85
|
*/
|
|
86
|
-
request(type: "info" | "
|
|
86
|
+
request(type: "info" | "exchange" | "explorer", payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
87
87
|
/**
|
|
88
88
|
* Subscribes to a Hyperliquid event channel.
|
|
89
89
|
* @param channel - The event channel to listen to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,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S,OAAO,CAAC,EAAE,yBAAyB;IAuC/C;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAExG,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACtC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACR;;;;WAIG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,kFAAkF;AAClF,qBAAa,kBAAmB,YAAW,iBAAiB,EAAE,sBAAsB;IAChF,qDAAqD;IACrD,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhD,iDAAiD;IACjD,SAAS,CAAC,YAAY,EAAE,0BAA0B,CAAC;IAEnD,6CAA6C;IAC7C,SAAS,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAE5C;;;;;OAKG;IACH,SAAS,CAAC,cAAc,EAAE,GAAG,CACzB,M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
|
}
|
|
125
125
|
// Send the request and wait for a response
|
|
126
126
|
const combinedSignal = this._combineTimeoutWithSignal(this.timeout, signal);
|
|
127
|
-
return this._wsRequester.request("post", {
|
|
127
|
+
return this._wsRequester.request("post", {
|
|
128
|
+
type: type === "exchange" ? "action" : type,
|
|
129
|
+
payload,
|
|
130
|
+
}, combinedSignal);
|
|
128
131
|
}
|
|
129
132
|
/**
|
|
130
133
|
* Subscribes to a Hyperliquid event channel.
|