Repository navigation
Conversation
- 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
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
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/signerstake a viemLocalAccount, a viemWalletClientwith anaccount, or the existing ethers-style signer, which is detected by viem'stypefield (local/walletClient). Anything else behaves as before. The input is wrapped once at construction, so signing stays single path. Each call site passesprimaryTypeexplicitly. 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
HyperliquidSignerInputandViem*Liketypes, and a README/quickstart section (automation-tracker #128)customFetchoption (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()acceptstimeInForce: 'Gtc' | 'Ioc'as well as'GTC' | 'IOC', giving the same wire order (automation-tracker #130)RangeErrorand is never rounded (automation-tracker #26)getOrderStatus(): a numeric-string oid becomes a number, a cloid passes through, and anything else throws aRangeError(automation-tracker #84)getOrderBookandgetCandlesaccept HIP-4#<encoding>coins (automation-tracker #90)clientOrderId/cloidmust be0x+ 32 hex characters, checked before signing, with JSDoc (automation-tracker #107)setCancelAllAfter()throws whentimeis less than 5 s ahead. JSDoc for the modifyoidcloid form and for single-status batch errors (automation-tracker #110)destinationmust be a 40-hex address, and a blankbaseUrlfalls back to the default (automation-tracker #72)getOrderBook()returnsOrderBookResponse(no| null) and throws aRangeErrorfor an unknown coin or a missing book. JSDoc forspread,fastandn(automation-tracker #71)WebsocketClient.getActiveTopics(wsKey?)added. JSDoc: identical topics are merged, and oneunsubscribe()removes the topic for all callers (automation-tracker #111, partly)fastAssetCtxs. JSDoc says theallMidsWS feed is deprecated upstream (automation-tracker #117)SubmitUserOutcomeRequestis a typed union (automation-tracker #91)UserVaultDeposit.lockedUntilTimestamp(automation-tracker #80)getUserNonFundingLedgerUpdatesand the send methods (automation-tracker #106)Breaking changes
getOrderBook()throws instead of resolvingnull, and its return type no longer includesnull.SubmitUserOutcomeRequestis stricter, so loosely typed calls stop compiling.Not done
Checks
npm run lint,tsc --noEmit,npm run build,npm run test:types,npm run test:unit(189 pass),npm run test:packed: passllms.txtregenerated with the regex runnerFixes 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)