feat(exchange): support always_place (a) on modify / batchModify#145
Merged
Conversation
Hyperliquid added an optional action-level `a` (always_place) boolean to the
`modify` and `batchModify` actions (HL API channel msgs 325 + 327). Per the
exchange-endpoint docs:
- `a: true` places the resulting order even if the cancel did not succeed.
- `a: false` requires a non-trigger order with TIF Alo, or a non-executable
GTC order, and must be omitted entirely (actions hashed with `a: false`
are rejected).
Without it, a modify targeting a trigger (TP/SL) order is rejected, and the
field can't be added by callers because `canonicalize` rejects keys absent
from the schema. This adds `a: v.optional(v.boolean())` as the last entry of
both action schemas (so canonical key order matches HL's `{type, oid, order, a}`),
with JSDoc, and adds an always-place sample to each method's test for schema
coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nktkas
approved these changes
Jun 17, 2026
Owner
|
Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the optional action-level
a(always_place) boolean to themodifyandbatchModifyaction schemas, per the Hyperliquid exchange-endpoint docs.Why
Hyperliquid added
always_placetomodify/batchModify(announced in the HL API channel, messages 325 + 327). Per the docs:a: trueplaces the resulting order even if the cancel did not succeed.a: falserequires the new order to be non-trigger with TIFAlo, or a non-executableGtcorder, and must be omitted when false — "actions hashed witha: falsewill be rejected."Once HL enforces the new semantics, a
modifythat targets a trigger order (TP/SL) is rejected unless the action carriesa: true. Today the SDK has no way to send it: the field isn't in the schema, socanonicalizethrowsKey "a" exists in data but not in schema(and it's part of the signed L1 action, so it can't be injected after signing).What
a: v.optional(v.boolean())as the last entry of themodifyandbatchModifyaction objects, socanonicalizeorders it to match HL's documented wire layout{ type, oid, order, a }/{ type, batchModify… modifies, a }. Making itv.optional(and never serializingfalse) preserves the omit-when-false rule, since absent optionals are dropped before hashing.modify/batchModifytests soschemaCoverageexercises the new optional field.Testing
deno task checkpasses (fmt, lint incl. the valibot plugins, type check, jsdoc-sync, export-sync). The live-API test cases require a funded testnet key (per CONTRIBUTING), so I couldn't run the network portion locally — the added samples seta: trueon a trigger modify and should exercise the new path under your CI.Reference