Skip to content

feat(v1.1.0): viem account and wallet client signers, optional native fetch transport, plus tracker fixes - #25

Open
JJ-Cro wants to merge 3 commits into
sieblyio:mainfrom
JJ-Cro:update30112026
Open

JJ-Cro wants to merge 3 commits into
sieblyio:mainfrom
JJ-Cro:update30112026

Conversation

@JJ-Cro

@JJ-Cro JJ-Cro commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

Signing now accepts viem accounts and wallet clients directly (automation-tracker #128, top priority), so apps built on Privy, Openfort, Magic, Dynamic or browser wallets need no adapter. Adds an optional native fetch transport for edge runtimes, local input checks before signing, and JSDoc, type and README fixes from the automation tracker.

#128 design

signer / signers take a viem LocalAccount, a viem WalletClient with an account, or the existing ethers-style signer, which is detected by viem's type field (local / walletClient). Anything else behaves as before. The input is wrapped once at construction, so signing stays single path. Each call site passes primaryType explicitly. The types are structural, so viem is not a dependency. Offline with viem 2.57.11, the signatures matched the private-key path byte for byte (L1 order, withdraw3, usdSend/spotSend, approveAgent, mainnet and testnet). viem 2.57.12 to 2.57.16 reject Hyperliquid's type names, and the README says so.

Changelog

  • viem account / wallet client signers, new HyperliquidSignerInput and Viem*Like types, and a README/quickstart section (automation-tracker #128)
  • customFetch option (opt-in) sends REST requests through a fetch-compatible function instead of axios. Nothing changes when it is unset. Binary and multipart bodies are rejected in fetch mode. Adds a README section (automation-tracker #124)
  • submitLimitOrder() accepts timeInForce: 'Gtc' | 'Ioc' as well as 'GTC' | 'IOC', giving the same wire order (automation-tracker #130)
  • Limit prices are checked against the tick rules before signing. A bad price throws a RangeError and is never rounded (automation-tracker #26)
  • getOrderStatus(): a numeric-string oid becomes a number, a cloid passes through, and anything else throws a RangeError (automation-tracker #84)
  • getOrderBook and getCandles accept HIP-4 #<encoding> coins (automation-tracker #90)
  • clientOrderId / cloid must be 0x + 32 hex characters, checked before signing, with JSDoc (automation-tracker #107)
  • setCancelAllAfter() throws when time is less than 5 s ahead. JSDoc for the modify oid cloid form and for single-status batch errors (automation-tracker #110)
  • Amounts must be positive decimal strings, destination must be a 40-hex address, and a blank baseUrl falls back to the default (automation-tracker #72)
  • getOrderBook() returns OrderBookResponse (no | null) and throws a RangeError for an unknown coin or a missing book. JSDoc for spread, fast and n (automation-tracker #71)
  • WebsocketClient.getActiveTopics(wsKey?) added. JSDoc: identical topics are merged, and one unsubscribe() removes the topic for all callers (automation-tracker #111, partly)
  • README and the examples lead with fastAssetCtxs. JSDoc says the allMids WS feed is deprecated upstream (automation-tracker #117)
  • SubmitUserOutcomeRequest is a typed union (automation-tracker #91)
  • UserVaultDeposit.lockedUntilTimestamp (automation-tracker #80)
  • Ledger delta union and JSDoc for getUserNonFundingLedgerUpdates and the send methods (automation-tracker #106)
  • README "Nonces" section (automation-tracker #70)
  • JSDoc for automation-tracker #73, #83, #92, #93, #95, #98, #104
  • Version 1.1.0

Breaking changes

  • getOrderBook() throws instead of resolving null, and its return type no longer includes null.
  • SubmitUserOutcomeRequest is stricter, so loosely typed calls stop compiling.
  • Invalid prices, cloids, amounts, destinations, cancel times and oids now throw locally instead of being sent.

Not done

  • #112: a lazy-load attempt broke subscription timing and was reverted, so the WS bundle size is unchanged.
  • #111 reference counting for subscriptions is not included, because it changes behaviour.

Checks

  • npm run lint, tsc --noEmit, npm run build, npm run test:types, npm run test:unit (189 pass), npm run test:packed: pass
  • Two existing unit test inputs were updated to valid values (a 32-hex cloid, and a cancel time more than 5 s ahead). No new tests.
  • Endpoint docs and llms.txt regenerated with the regex runner

Fixes automation-tracker: #128, #124, #130, #26, #84, #90, #107, #110, #72, #71, #117, #91, #80, #106, #70, #73, #83, #92, #93, #95, #98, #104
Partly addressed: #111 (no reference counting), #112 (not fixed, see above)

JJ-Cro and others added 3 commits December 1, 2026 11:42
- Normalize viem accounts and wallet clients, preserve ethers signing, accept multisig inputs, and document browser/embedded wallets without adding dependencies (automation-tracker #128).
- Accept native Gtc/Ioc helper aliases and validate known price precision without rounding (automation-tracker #130, #26).
- Validate cloids, order-status IDs, transfer amounts/destinations, schedule-cancel timing, and empty base URLs (automation-tracker #107, #84, #72, #110).
- Pass outcome coin names through metadata resolution and type outcome operations (automation-tracker #90, #91).
- Lead streaming examples with merged fastAssetCtxs snapshots/diffs; clarify books and spot context channels (automation-tracker #117, #71, #95).
- Expose copied active topics and document shared unsubscribe semantics; reference counting remains out of scope (automation-tracker #111).
- Document nonce coordination, account modes, user signing, subaccount units, vault unlock times, and history rows (automation-tracker #70, #73, #80, #83).
- Document metadata, outcome settlement, candle pagination, funding intervals, ledger variants, and thrown exchange errors (automation-tracker #93, #92, #98, #104, #106).
- Attempt and revert lazy WebSocket dependencies after subscription-timing and test-runner regressions; bundle reduction remains unresolved (automation-tracker #112).
- Bump only manifest versions to 1.1.0; adjust two existing invalid test inputs without adding cases; leave generated docs and workflows untouched.

Validation: lint, typecheck, type tests, 189 unit tests, build, packed ESM/CJS/browser smoke, and Prettier pass. Throwaway viem 2.57.11 checks compile real inputs and match 40 offline signatures across mainnet/testnet and ESM/CJS. Public-only esbuild bundle: 298961/106079 bytes minified/gzip before, 301904/107064 after; no #112 optimization retained.
- Restore decimalToScaledInteger, uint64ToBytes, and TypedDataDomain.chainId exactly from update30112026; retain Number() in the viem adapter (automation-tracker #128 follow-up).
- Add the shared CustomFetch, CustomFetchRequestInit, and CustomFetchResponse structural types and opt-in REST transport; axios remains the unchanged default (automation-tracker #124).
- Preserve HTTP/API error handling, propagate caller errors unchanged, apply supported timeout signals, and reject binary/multipart bodies before sending (automation-tracker #124).
- Forward customFetch through existing WebSocket REST metadata options without changing WebSocket transport behavior (automation-tracker #124).
- Document Edge runtimes / native fetch (optional); keep version 1.1.0 and dependencies unchanged (automation-tracker #124).

Validation: npm ci, lint, tsc --noEmit, build, test:types, all 189 existing unit tests, test:packed, Prettier, and git diff --check pass. No tests or specs added. Throwaway verification confirms native-fetch type compatibility without DOM, local ESM/CJS transport/error parity, identical live public POST /info results and HTTP 422 errors, and 40 matching viem 2.57.11 signatures after the upstream restoration. Hyperliquid Info reads use POST rather than GET; no signed requests were sent.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant