Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/api/exchange/_methods/reserveRequestWeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as v from "@valibot/valibot";
// API Schemas
// ============================================================

import { Hex, UnsignedInteger } from "../../_schemas.ts";
import { Address, Hex, UnsignedInteger } from "../../_schemas.ts";

/**
* Reserve additional rate-limited actions for a fee.
Expand All @@ -18,6 +18,8 @@ export const ReserveRequestWeightRequest = /* @__PURE__ */ (() => {
type: v.literal("reserveRequestWeight"),
/** Amount of request weight to reserve. */
weight: v.pipe(UnsignedInteger, v.maxValue(1844674407370955)), // Truncated max uint64 / 1000
/** Address of an existing user to reserve the weight for. */
destination: v.optional(Address),
}),
/** Nonce (timestamp in ms) used to prevent replay attacks. */
nonce: UnsignedInteger,
Expand Down
3 changes: 3 additions & 0 deletions tests/api/exchange/reserveRequestWeight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ runTest({
name: "reserveRequestWeight",
codeTestFn: async (_t, exchClient) => {
const params: ReserveRequestWeightParameters[] = [
// no destination
{ weight: 1 },
// destination
{ weight: 1, destination: "0xe019d6167e7e324aed003d94098496b6d986ab05" },
];

const data = await Promise.all(params.map((p) => exchClient.reserveRequestWeight(p)));
Expand Down