opentool 0.8.3 → 0.8.5

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.
@@ -93,6 +93,72 @@ declare function createL1ActionHash(args: {
93
93
  expiresAfter?: number | undefined;
94
94
  }): `0x${string}`;
95
95
 
96
+ declare class HyperliquidInfoClient {
97
+ private readonly environment;
98
+ constructor(environment?: HyperliquidEnvironment);
99
+ meta(): Promise<any>;
100
+ metaAndAssetCtxs(): Promise<any>;
101
+ spotMeta(): Promise<any>;
102
+ spotMetaAndAssetCtxs(): Promise<any>;
103
+ assetCtxs(): Promise<any>;
104
+ spotAssetCtxs(): Promise<any>;
105
+ openOrders(user: `0x${string}`): Promise<any>;
106
+ frontendOpenOrders(user: `0x${string}`): Promise<any>;
107
+ orderStatus(user: `0x${string}`, oid: number | string): Promise<any>;
108
+ historicalOrders(user: `0x${string}`): Promise<any>;
109
+ userFills(user: `0x${string}`): Promise<any>;
110
+ userFillsByTime(user: `0x${string}`, startTime: number, endTime: number): Promise<any>;
111
+ userRateLimit(user: `0x${string}`): Promise<any>;
112
+ preTransferCheck(user: `0x${string}`, source: `0x${string}`): Promise<any>;
113
+ spotClearinghouseState(user: `0x${string}`): Promise<any>;
114
+ }
115
+ declare function fetchHyperliquidMeta(environment?: HyperliquidEnvironment): Promise<any>;
116
+ declare function fetchHyperliquidMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
117
+ declare function fetchHyperliquidSpotMeta(environment?: HyperliquidEnvironment): Promise<any>;
118
+ declare function fetchHyperliquidSpotMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
119
+ declare function fetchHyperliquidAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
120
+ declare function fetchHyperliquidSpotAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
121
+ declare function fetchHyperliquidOpenOrders(params: {
122
+ environment?: HyperliquidEnvironment;
123
+ user: `0x${string}`;
124
+ }): Promise<any>;
125
+ declare function fetchHyperliquidFrontendOpenOrders(params: {
126
+ environment?: HyperliquidEnvironment;
127
+ user: `0x${string}`;
128
+ }): Promise<any>;
129
+ declare function fetchHyperliquidOrderStatus(params: {
130
+ environment?: HyperliquidEnvironment;
131
+ user: `0x${string}`;
132
+ oid: number | string;
133
+ }): Promise<any>;
134
+ declare function fetchHyperliquidHistoricalOrders(params: {
135
+ environment?: HyperliquidEnvironment;
136
+ user: `0x${string}`;
137
+ }): Promise<any>;
138
+ declare function fetchHyperliquidUserFills(params: {
139
+ environment?: HyperliquidEnvironment;
140
+ user: `0x${string}`;
141
+ }): Promise<any>;
142
+ declare function fetchHyperliquidUserFillsByTime(params: {
143
+ environment?: HyperliquidEnvironment;
144
+ user: `0x${string}`;
145
+ startTime: number;
146
+ endTime: number;
147
+ }): Promise<any>;
148
+ declare function fetchHyperliquidUserRateLimit(params: {
149
+ environment?: HyperliquidEnvironment;
150
+ user: `0x${string}`;
151
+ }): Promise<any>;
152
+ declare function fetchHyperliquidPreTransferCheck(params: {
153
+ environment?: HyperliquidEnvironment;
154
+ user: `0x${string}`;
155
+ source: `0x${string}`;
156
+ }): Promise<any>;
157
+ declare function fetchHyperliquidSpotClearinghouseState(params: {
158
+ environment?: HyperliquidEnvironment;
159
+ user: `0x${string}`;
160
+ }): Promise<any>;
161
+
96
162
  type CommonActionOptions = {
97
163
  environment?: HyperliquidEnvironment;
98
164
  vaultAddress?: `0x${string}` | undefined;
@@ -242,72 +308,6 @@ declare function sendHyperliquidSpot(options: {
242
308
  nonceSource?: NonceSource;
243
309
  }): Promise<HyperliquidExchangeResponse<unknown>>;
244
310
 
245
- declare class HyperliquidInfoClient {
246
- private readonly environment;
247
- constructor(environment?: HyperliquidEnvironment);
248
- meta(): Promise<any>;
249
- metaAndAssetCtxs(): Promise<any>;
250
- spotMeta(): Promise<any>;
251
- spotMetaAndAssetCtxs(): Promise<any>;
252
- assetCtxs(): Promise<any>;
253
- spotAssetCtxs(): Promise<any>;
254
- openOrders(user: `0x${string}`): Promise<any>;
255
- frontendOpenOrders(user: `0x${string}`): Promise<any>;
256
- orderStatus(user: `0x${string}`, oid: number | string): Promise<any>;
257
- historicalOrders(user: `0x${string}`): Promise<any>;
258
- userFills(user: `0x${string}`): Promise<any>;
259
- userFillsByTime(user: `0x${string}`, startTime: number, endTime: number): Promise<any>;
260
- userRateLimit(user: `0x${string}`): Promise<any>;
261
- preTransferCheck(user: `0x${string}`, source: `0x${string}`): Promise<any>;
262
- spotClearinghouseState(user: `0x${string}`): Promise<any>;
263
- }
264
- declare function fetchHyperliquidMeta(environment?: HyperliquidEnvironment): Promise<any>;
265
- declare function fetchHyperliquidMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
266
- declare function fetchHyperliquidSpotMeta(environment?: HyperliquidEnvironment): Promise<any>;
267
- declare function fetchHyperliquidSpotMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
268
- declare function fetchHyperliquidAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
269
- declare function fetchHyperliquidSpotAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
270
- declare function fetchHyperliquidOpenOrders(params: {
271
- environment?: HyperliquidEnvironment;
272
- user: `0x${string}`;
273
- }): Promise<any>;
274
- declare function fetchHyperliquidFrontendOpenOrders(params: {
275
- environment?: HyperliquidEnvironment;
276
- user: `0x${string}`;
277
- }): Promise<any>;
278
- declare function fetchHyperliquidOrderStatus(params: {
279
- environment?: HyperliquidEnvironment;
280
- user: `0x${string}`;
281
- oid: number | string;
282
- }): Promise<any>;
283
- declare function fetchHyperliquidHistoricalOrders(params: {
284
- environment?: HyperliquidEnvironment;
285
- user: `0x${string}`;
286
- }): Promise<any>;
287
- declare function fetchHyperliquidUserFills(params: {
288
- environment?: HyperliquidEnvironment;
289
- user: `0x${string}`;
290
- }): Promise<any>;
291
- declare function fetchHyperliquidUserFillsByTime(params: {
292
- environment?: HyperliquidEnvironment;
293
- user: `0x${string}`;
294
- startTime: number;
295
- endTime: number;
296
- }): Promise<any>;
297
- declare function fetchHyperliquidUserRateLimit(params: {
298
- environment?: HyperliquidEnvironment;
299
- user: `0x${string}`;
300
- }): Promise<any>;
301
- declare function fetchHyperliquidPreTransferCheck(params: {
302
- environment?: HyperliquidEnvironment;
303
- user: `0x${string}`;
304
- source: `0x${string}`;
305
- }): Promise<any>;
306
- declare function fetchHyperliquidSpotClearinghouseState(params: {
307
- environment?: HyperliquidEnvironment;
308
- user: `0x${string}`;
309
- }): Promise<any>;
310
-
311
311
  interface HyperliquidOrderOptions {
312
312
  wallet: WalletFullContext;
313
313
  orders: HyperliquidOrderIntent[];
@@ -406,6 +406,181 @@ function assertPositiveNumber(value, label) {
406
406
  }
407
407
  }
408
408
 
409
+ // src/adapters/hyperliquid/info.ts
410
+ async function postInfo(environment, payload) {
411
+ const baseUrl = API_BASES[environment];
412
+ const response = await fetch(`${baseUrl}/info`, {
413
+ method: "POST",
414
+ headers: { "content-type": "application/json" },
415
+ body: JSON.stringify(payload)
416
+ });
417
+ const data = await response.json().catch(() => null);
418
+ if (!response.ok) {
419
+ throw new HyperliquidApiError(
420
+ "Hyperliquid info request failed.",
421
+ data ?? { status: response.status }
422
+ );
423
+ }
424
+ return data;
425
+ }
426
+ var HyperliquidInfoClient = class {
427
+ constructor(environment = "mainnet") {
428
+ this.environment = environment;
429
+ }
430
+ meta() {
431
+ return fetchHyperliquidMeta(this.environment);
432
+ }
433
+ metaAndAssetCtxs() {
434
+ return fetchHyperliquidMetaAndAssetCtxs(this.environment);
435
+ }
436
+ spotMeta() {
437
+ return fetchHyperliquidSpotMeta(this.environment);
438
+ }
439
+ spotMetaAndAssetCtxs() {
440
+ return fetchHyperliquidSpotMetaAndAssetCtxs(this.environment);
441
+ }
442
+ assetCtxs() {
443
+ return fetchHyperliquidAssetCtxs(this.environment);
444
+ }
445
+ spotAssetCtxs() {
446
+ return fetchHyperliquidSpotAssetCtxs(this.environment);
447
+ }
448
+ openOrders(user) {
449
+ return fetchHyperliquidOpenOrders({ user, environment: this.environment });
450
+ }
451
+ frontendOpenOrders(user) {
452
+ return fetchHyperliquidFrontendOpenOrders({
453
+ user,
454
+ environment: this.environment
455
+ });
456
+ }
457
+ orderStatus(user, oid) {
458
+ return fetchHyperliquidOrderStatus({
459
+ user,
460
+ oid,
461
+ environment: this.environment
462
+ });
463
+ }
464
+ historicalOrders(user) {
465
+ return fetchHyperliquidHistoricalOrders({
466
+ user,
467
+ environment: this.environment
468
+ });
469
+ }
470
+ userFills(user) {
471
+ return fetchHyperliquidUserFills({ user, environment: this.environment });
472
+ }
473
+ userFillsByTime(user, startTime, endTime) {
474
+ return fetchHyperliquidUserFillsByTime({
475
+ user,
476
+ startTime,
477
+ endTime,
478
+ environment: this.environment
479
+ });
480
+ }
481
+ userRateLimit(user) {
482
+ return fetchHyperliquidUserRateLimit({
483
+ user,
484
+ environment: this.environment
485
+ });
486
+ }
487
+ preTransferCheck(user, source) {
488
+ return fetchHyperliquidPreTransferCheck({
489
+ user,
490
+ source,
491
+ environment: this.environment
492
+ });
493
+ }
494
+ spotClearinghouseState(user) {
495
+ return fetchHyperliquidSpotClearinghouseState({
496
+ user,
497
+ environment: this.environment
498
+ });
499
+ }
500
+ };
501
+ async function fetchHyperliquidMeta(environment = "mainnet") {
502
+ return postInfo(environment, { type: "meta" });
503
+ }
504
+ async function fetchHyperliquidMetaAndAssetCtxs(environment = "mainnet") {
505
+ return postInfo(environment, { type: "metaAndAssetCtxs" });
506
+ }
507
+ async function fetchHyperliquidSpotMeta(environment = "mainnet") {
508
+ return postInfo(environment, { type: "spotMeta" });
509
+ }
510
+ async function fetchHyperliquidSpotMetaAndAssetCtxs(environment = "mainnet") {
511
+ return postInfo(environment, { type: "spotMetaAndAssetCtxs" });
512
+ }
513
+ async function fetchHyperliquidAssetCtxs(environment = "mainnet") {
514
+ return postInfo(environment, { type: "assetCtxs" });
515
+ }
516
+ async function fetchHyperliquidSpotAssetCtxs(environment = "mainnet") {
517
+ return postInfo(environment, { type: "spotAssetCtxs" });
518
+ }
519
+ async function fetchHyperliquidOpenOrders(params) {
520
+ const env = params.environment ?? "mainnet";
521
+ return postInfo(env, { type: "openOrders", user: normalizeAddress(params.user) });
522
+ }
523
+ async function fetchHyperliquidFrontendOpenOrders(params) {
524
+ const env = params.environment ?? "mainnet";
525
+ return postInfo(env, {
526
+ type: "frontendOpenOrders",
527
+ user: normalizeAddress(params.user)
528
+ });
529
+ }
530
+ async function fetchHyperliquidOrderStatus(params) {
531
+ const env = params.environment ?? "mainnet";
532
+ return postInfo(env, {
533
+ type: "orderStatus",
534
+ user: normalizeAddress(params.user),
535
+ oid: params.oid
536
+ });
537
+ }
538
+ async function fetchHyperliquidHistoricalOrders(params) {
539
+ const env = params.environment ?? "mainnet";
540
+ return postInfo(env, {
541
+ type: "historicalOrders",
542
+ user: normalizeAddress(params.user)
543
+ });
544
+ }
545
+ async function fetchHyperliquidUserFills(params) {
546
+ const env = params.environment ?? "mainnet";
547
+ return postInfo(env, {
548
+ type: "userFills",
549
+ user: normalizeAddress(params.user)
550
+ });
551
+ }
552
+ async function fetchHyperliquidUserFillsByTime(params) {
553
+ const env = params.environment ?? "mainnet";
554
+ return postInfo(env, {
555
+ type: "userFillsByTime",
556
+ user: normalizeAddress(params.user),
557
+ startTime: params.startTime,
558
+ endTime: params.endTime
559
+ });
560
+ }
561
+ async function fetchHyperliquidUserRateLimit(params) {
562
+ const env = params.environment ?? "mainnet";
563
+ return postInfo(env, {
564
+ type: "userRateLimit",
565
+ user: normalizeAddress(params.user)
566
+ });
567
+ }
568
+ async function fetchHyperliquidPreTransferCheck(params) {
569
+ const env = params.environment ?? "mainnet";
570
+ return postInfo(env, {
571
+ type: "preTransferCheck",
572
+ user: normalizeAddress(params.user),
573
+ source: normalizeAddress(params.source)
574
+ });
575
+ }
576
+ async function fetchHyperliquidSpotClearinghouseState(params) {
577
+ const env = params.environment ?? "mainnet";
578
+ return postInfo(env, {
579
+ type: "spotClearinghouseState",
580
+ user: normalizeAddress(params.user)
581
+ });
582
+ }
583
+
409
584
  // src/adapters/hyperliquid/exchange.ts
410
585
  var HyperliquidExchangeClient = class {
411
586
  constructor(args) {
@@ -945,181 +1120,6 @@ async function postExchange(env, body) {
945
1120
  return json;
946
1121
  }
947
1122
 
948
- // src/adapters/hyperliquid/info.ts
949
- async function postInfo(environment, payload) {
950
- const baseUrl = API_BASES[environment];
951
- const response = await fetch(`${baseUrl}/info`, {
952
- method: "POST",
953
- headers: { "content-type": "application/json" },
954
- body: JSON.stringify(payload)
955
- });
956
- const data = await response.json().catch(() => null);
957
- if (!response.ok) {
958
- throw new HyperliquidApiError(
959
- "Hyperliquid info request failed.",
960
- data ?? { status: response.status }
961
- );
962
- }
963
- return data;
964
- }
965
- var HyperliquidInfoClient = class {
966
- constructor(environment = "mainnet") {
967
- this.environment = environment;
968
- }
969
- meta() {
970
- return fetchHyperliquidMeta(this.environment);
971
- }
972
- metaAndAssetCtxs() {
973
- return fetchHyperliquidMetaAndAssetCtxs(this.environment);
974
- }
975
- spotMeta() {
976
- return fetchHyperliquidSpotMeta(this.environment);
977
- }
978
- spotMetaAndAssetCtxs() {
979
- return fetchHyperliquidSpotMetaAndAssetCtxs(this.environment);
980
- }
981
- assetCtxs() {
982
- return fetchHyperliquidAssetCtxs(this.environment);
983
- }
984
- spotAssetCtxs() {
985
- return fetchHyperliquidSpotAssetCtxs(this.environment);
986
- }
987
- openOrders(user) {
988
- return fetchHyperliquidOpenOrders({ user, environment: this.environment });
989
- }
990
- frontendOpenOrders(user) {
991
- return fetchHyperliquidFrontendOpenOrders({
992
- user,
993
- environment: this.environment
994
- });
995
- }
996
- orderStatus(user, oid) {
997
- return fetchHyperliquidOrderStatus({
998
- user,
999
- oid,
1000
- environment: this.environment
1001
- });
1002
- }
1003
- historicalOrders(user) {
1004
- return fetchHyperliquidHistoricalOrders({
1005
- user,
1006
- environment: this.environment
1007
- });
1008
- }
1009
- userFills(user) {
1010
- return fetchHyperliquidUserFills({ user, environment: this.environment });
1011
- }
1012
- userFillsByTime(user, startTime, endTime) {
1013
- return fetchHyperliquidUserFillsByTime({
1014
- user,
1015
- startTime,
1016
- endTime,
1017
- environment: this.environment
1018
- });
1019
- }
1020
- userRateLimit(user) {
1021
- return fetchHyperliquidUserRateLimit({
1022
- user,
1023
- environment: this.environment
1024
- });
1025
- }
1026
- preTransferCheck(user, source) {
1027
- return fetchHyperliquidPreTransferCheck({
1028
- user,
1029
- source,
1030
- environment: this.environment
1031
- });
1032
- }
1033
- spotClearinghouseState(user) {
1034
- return fetchHyperliquidSpotClearinghouseState({
1035
- user,
1036
- environment: this.environment
1037
- });
1038
- }
1039
- };
1040
- async function fetchHyperliquidMeta(environment = "mainnet") {
1041
- return postInfo(environment, { type: "meta" });
1042
- }
1043
- async function fetchHyperliquidMetaAndAssetCtxs(environment = "mainnet") {
1044
- return postInfo(environment, { type: "metaAndAssetCtxs" });
1045
- }
1046
- async function fetchHyperliquidSpotMeta(environment = "mainnet") {
1047
- return postInfo(environment, { type: "spotMeta" });
1048
- }
1049
- async function fetchHyperliquidSpotMetaAndAssetCtxs(environment = "mainnet") {
1050
- return postInfo(environment, { type: "spotMetaAndAssetCtxs" });
1051
- }
1052
- async function fetchHyperliquidAssetCtxs(environment = "mainnet") {
1053
- return postInfo(environment, { type: "assetCtxs" });
1054
- }
1055
- async function fetchHyperliquidSpotAssetCtxs(environment = "mainnet") {
1056
- return postInfo(environment, { type: "spotAssetCtxs" });
1057
- }
1058
- async function fetchHyperliquidOpenOrders(params) {
1059
- const env = params.environment ?? "mainnet";
1060
- return postInfo(env, { type: "openOrders", user: normalizeAddress(params.user) });
1061
- }
1062
- async function fetchHyperliquidFrontendOpenOrders(params) {
1063
- const env = params.environment ?? "mainnet";
1064
- return postInfo(env, {
1065
- type: "frontendOpenOrders",
1066
- user: normalizeAddress(params.user)
1067
- });
1068
- }
1069
- async function fetchHyperliquidOrderStatus(params) {
1070
- const env = params.environment ?? "mainnet";
1071
- return postInfo(env, {
1072
- type: "orderStatus",
1073
- user: normalizeAddress(params.user),
1074
- oid: params.oid
1075
- });
1076
- }
1077
- async function fetchHyperliquidHistoricalOrders(params) {
1078
- const env = params.environment ?? "mainnet";
1079
- return postInfo(env, {
1080
- type: "historicalOrders",
1081
- user: normalizeAddress(params.user)
1082
- });
1083
- }
1084
- async function fetchHyperliquidUserFills(params) {
1085
- const env = params.environment ?? "mainnet";
1086
- return postInfo(env, {
1087
- type: "userFills",
1088
- user: normalizeAddress(params.user)
1089
- });
1090
- }
1091
- async function fetchHyperliquidUserFillsByTime(params) {
1092
- const env = params.environment ?? "mainnet";
1093
- return postInfo(env, {
1094
- type: "userFillsByTime",
1095
- user: normalizeAddress(params.user),
1096
- startTime: params.startTime,
1097
- endTime: params.endTime
1098
- });
1099
- }
1100
- async function fetchHyperliquidUserRateLimit(params) {
1101
- const env = params.environment ?? "mainnet";
1102
- return postInfo(env, {
1103
- type: "userRateLimit",
1104
- user: normalizeAddress(params.user)
1105
- });
1106
- }
1107
- async function fetchHyperliquidPreTransferCheck(params) {
1108
- const env = params.environment ?? "mainnet";
1109
- return postInfo(env, {
1110
- type: "preTransferCheck",
1111
- user: normalizeAddress(params.user),
1112
- source: normalizeAddress(params.source)
1113
- });
1114
- }
1115
- async function fetchHyperliquidSpotClearinghouseState(params) {
1116
- const env = params.environment ?? "mainnet";
1117
- return postInfo(env, {
1118
- type: "spotClearinghouseState",
1119
- user: normalizeAddress(params.user)
1120
- });
1121
- }
1122
-
1123
1123
  // src/adapters/hyperliquid/index.ts
1124
1124
  async function placeHyperliquidOrder(options) {
1125
1125
  const {