• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nktkas / hyperliquid / 19405103680

16 Nov 2025 11:46AM UTC coverage: 94.726% (-0.6%) from 95.329%
19405103680

push

github

nktkas
test(info): adapt command execution for Deno and Node.js environments

368 of 581 branches covered (63.34%)

Branch coverage included in aggregate %.

11667 of 12124 relevant lines covered (96.23%)

951.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.72
/src/api/exchange/evmUserModify.ts
1
import * as v from "valibot";
353✔
2
import { type DeepImmutable, parser, UnsignedInteger } from "../_base.ts";
353✔
3
import {
353✔
4
  type ExchangeRequestConfig,
5
  executeL1Action,
353✔
6
  type ExtractRequestAction,
7
  type ExtractRequestOptions,
8
  type MultiSignRequestConfig,
9
  Signature,
353✔
10
} from "./_base/mod.ts";
353✔
11

12
// -------------------- Schemas --------------------
13

14
/**
15
 * Configure block type for EVM transactions.
16
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
17
 */
18
export const EvmUserModifyRequest = /* @__PURE__ */ (() => {
353✔
19
  return v.pipe(
598✔
20
    v.object({
598✔
21
      /** Action to perform. */
22
      action: v.pipe(
598✔
23
        v.object({
598✔
24
          /** Type of action. */
25
          type: v.pipe(
598✔
26
            v.literal("evmUserModify"),
598✔
27
            v.description("Type of action."),
598✔
28
          ),
29
          /** `true` for large blocks, `false` for small blocks. */
30
          usingBigBlocks: v.pipe(
598✔
31
            v.boolean(),
598✔
32
            v.description("`true` for large blocks, `false` for small blocks."),
598✔
33
          ),
34
        }),
598✔
35
        v.description("Action to perform."),
598✔
36
      ),
37
      /** Unique request identifier (current timestamp in ms). */
38
      nonce: v.pipe(
598✔
39
        UnsignedInteger,
598✔
40
        v.description("Unique request identifier (current timestamp in ms)."),
598✔
41
      ),
42
      /** Cryptographic signature. */
43
      signature: v.pipe(
598✔
44
        Signature,
598✔
45
        v.description("Cryptographic signature."),
598✔
46
      ),
47
      /** Expiration time of the action. */
48
      expiresAfter: v.pipe(
598✔
49
        v.optional(UnsignedInteger),
598✔
50
        v.description("Expiration time of the action."),
598✔
51
      ),
52
    }),
598✔
53
    v.description("Configure block type for EVM transactions."),
598✔
54
  );
55
})();
353✔
56
export type EvmUserModifyRequest = v.InferOutput<typeof EvmUserModifyRequest>;
57

58
import { SuccessResponse } from "./_base/mod.ts";
353✔
59
export { SuccessResponse };
353✔
60

61
// -------------------- Function --------------------
62

63
/** Action parameters for the {@linkcode evmUserModify} function. */
64
export type EvmUserModifyParameters = ExtractRequestAction<v.InferInput<typeof EvmUserModifyRequest>>;
65
/** Request options for the {@linkcode evmUserModify} function. */
66
export type EvmUserModifyOptions = ExtractRequestOptions<v.InferInput<typeof EvmUserModifyRequest>>;
67

68
/**
69
 * Configure block type for EVM transactions.
70
 * @param config - General configuration for Exchange API requests.
71
 * @param params - Parameters specific to the API request.
72
 * @param opts - Request execution options.
73
 * @returns Successful response without specific data.
74
 *
75
 * @throws {ApiRequestError} When the API returns an unsuccessful response.
76
 * @throws {TransportError} When the transport layer throws an error.
77
 *
78
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
79
 * @example
80
 * ```ts
81
 * import { HttpTransport } from "@nktkas/hyperliquid";
82
 * import { evmUserModify } from "@nktkas/hyperliquid/api/exchange";
83
 * import { privateKeyToAccount } from "npm:viem/accounts";
84
 *
85
 * const wallet = privateKeyToAccount("0x..."); // viem or ethers
86
 * const transport = new HttpTransport(); // or `WebSocketTransport`
87
 *
88
 * await evmUserModify(
89
 *   { transport, wallet },
90
 *   { usingBigBlocks: true },
91
 * );
92
 * ```
93
 */
94
export async function evmUserModify(
353✔
95
  config: ExchangeRequestConfig | MultiSignRequestConfig,
353✔
96
  params: DeepImmutable<EvmUserModifyParameters>,
353✔
97
  opts?: EvmUserModifyOptions,
353✔
98
): Promise<SuccessResponse> {
99
  const request = parser(EvmUserModifyRequest)({
356✔
100
    action: {
356✔
101
      type: "evmUserModify",
356✔
102
      ...params,
356✔
103
    },
356✔
104
    nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
356✔
105
    signature: { // Placeholder; actual signature generated in `executeL1Action`
356✔
106
      r: "0x0000000000000000000000000000000000000000000000000000000000000000",
356✔
107
      s: "0x0000000000000000000000000000000000000000000000000000000000000000",
356✔
108
      v: 27,
356✔
109
    },
356✔
110
    expiresAfter: typeof config.defaultExpiresAfter === "number"
×
111
      ? config.defaultExpiresAfter
×
112
      : await config.defaultExpiresAfter?.(),
×
113
  });
356✔
114
  return await executeL1Action(config, request, opts?.signal);
×
115
}
356✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc