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

nktkas / hyperliquid / 19514753888

19 Nov 2025 08:02PM UTC coverage: 94.811% (+0.1%) from 94.685%
19514753888

push

github

nktkas
ci: remove environment for test job

364 of 583 branches covered (62.44%)

Branch coverage included in aggregate %.

12208 of 12677 relevant lines covered (96.3%)

964.38 hits per line

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

88.52
/src/api/exchange/evmUserModify.ts
1
import * as v from "valibot";
357✔
2

3
// ============================================================
4
// API Schemas
5
// ============================================================
6

7
import { UnsignedInteger } from "../_base.ts";
357✔
8
import { ErrorResponse, Signature, SuccessResponse } from "./_base/mod.ts";
357✔
9

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

54
/**
55
 * Successful response without specific data or error response.
56
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
57
 */
58
export const EvmUserModifyResponse = /* @__PURE__ */ (() => {
357✔
59
  return v.pipe(
605✔
60
    v.union([SuccessResponse, ErrorResponse]),
2,420✔
61
    v.description("Successful response without specific data or error response."),
605✔
62
  );
63
})();
357✔
64
export type EvmUserModifyResponse = v.InferOutput<typeof EvmUserModifyResponse>;
65

66
// ============================================================
67
// Execution Logic
68
// ============================================================
69

70
import { type DeepImmutable, parser } from "../_base.ts";
357✔
71
import {
357✔
72
  type ExchangeRequestConfig,
73
  type ExcludeErrorResponse,
74
  executeL1Action,
357✔
75
  type ExtractRequestAction,
76
  type ExtractRequestOptions,
77
  type MultiSignRequestConfig,
78
} from "./_base/mod.ts";
357✔
79

80
/** Action parameters for the {@linkcode evmUserModify} function. */
81
export type EvmUserModifyParameters = ExtractRequestAction<v.InferInput<typeof EvmUserModifyRequest>>;
82

83
/** Request options for the {@linkcode evmUserModify} function. */
84
export type EvmUserModifyOptions = ExtractRequestOptions<v.InferInput<typeof EvmUserModifyRequest>>;
85

86
/** Successful variant of {@linkcode EvmUserModifyResponse} without errors. */
87
export type EvmUserModifySuccessResponse = ExcludeErrorResponse<EvmUserModifyResponse>;
88

89
/**
90
 * Configure block type for EVM transactions.
91
 * @param config - General configuration for Exchange API requests.
92
 * @param params - Parameters specific to the API request.
93
 * @param opts - Request execution options.
94
 * @returns Successful response without specific data.
95
 *
96
 * @throws {ApiRequestError} When the API returns an unsuccessful response.
97
 * @throws {TransportError} When the transport layer throws an error.
98
 *
99
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
100
 * @example
101
 * ```ts
102
 * import { HttpTransport } from "@nktkas/hyperliquid";
103
 * import { evmUserModify } from "@nktkas/hyperliquid/api/exchange";
104
 * import { privateKeyToAccount } from "viem/accounts";
105
 *
106
 * const wallet = privateKeyToAccount("0x..."); // viem or ethers
107
 * const transport = new HttpTransport(); // or `WebSocketTransport`
108
 *
109
 * await evmUserModify(
110
 *   { transport, wallet },
111
 *   { usingBigBlocks: true },
112
 * );
113
 * ```
114
 */
115
export async function evmUserModify(
357✔
116
  config: ExchangeRequestConfig | MultiSignRequestConfig,
357✔
117
  params: DeepImmutable<EvmUserModifyParameters>,
357✔
118
  opts?: EvmUserModifyOptions,
357✔
119
): Promise<EvmUserModifySuccessResponse> {
120
  const request = parser(EvmUserModifyRequest)({
360✔
121
    action: {
360✔
122
      type: "evmUserModify",
360✔
123
      ...params,
360✔
124
    },
360✔
125
    nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
360✔
126
    signature: { // Placeholder; actual signature generated in `executeL1Action`
360✔
127
      r: "0x0000000000000000000000000000000000000000000000000000000000000000",
360✔
128
      s: "0x0000000000000000000000000000000000000000000000000000000000000000",
360✔
129
      v: 27,
360✔
130
    },
360✔
131
    expiresAfter: typeof config.defaultExpiresAfter === "number"
×
132
      ? config.defaultExpiresAfter
×
133
      : await config.defaultExpiresAfter?.(),
×
134
  });
360✔
135
  return await executeL1Action(config, request, opts?.signal);
×
136
}
360✔
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