Skip to content

feat(hypercore): support transfers from HyperEVM and HyperCore#481

Open
kiseln wants to merge 5 commits into
mainfrom
feat/hypercore-support
Open

feat(hypercore): support transfers from HyperEVM and HyperCore#481
kiseln wants to merge 5 commits into
mainfrom
feat/hypercore-support

Conversation

@kiseln

@kiseln kiseln commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two outbound source-chain paths that were previously unsupported:

  • HyperEVM as source — treated as a normal EVM chain; reuses the existing @omni-bridge/evm builder.
  • HyperCore (Hyperliquid L1) as source — new @omni-bridge/hypercore package that builds the EIP-712 sendToEvmWithData user-signed action posted to Hyperliquid's /exchange.

Changes

HyperEVM as EVM source

  • packages/core/src/config.ts: registers hlevm bridge address (0xf353b40fC144d1c6c5BCdda712fa6De833016aF9, same on mainnet+testnet) and chain ids 999/998.
  • packages/core/src/utils/address.ts: HyperEvm joins EvmChainKind and isEvmChain().
  • packages/core/src/bridge.ts: drops the two "not yet configured/supported" throws.
  • packages/evm/src/proof.ts: wires HyperEVM RPC URLs and viem chain definitions (hyperEvm, hyperliquidEvmTestnet).

@omni-bridge/hypercore (new package)

  • builder.ts: createHyperCoreBuilder({network}) + buildTransfer({spotToken, amount, recipient, ...}). Picks ACTION_TRANSFER (0x00) for HyperEVM recipients (pool release) or ACTION_INIT_TRANSFER (0x01) for any other chain (routes via OmniBridge.initTransfer). Optional hlBridgeToken / decimals / spotId overrides skip the /info lookup.
  • encoders.ts: ABI encoders for the two action data payloads.
  • typed-data.ts: EIP-712 domain + type list + precomputed digest for HyperliquidTransaction:SendToEvmWithData.
  • spot-meta.ts: resolves spot name → {spotId, hlBridgeToken, decimals} via /info { type: "spotMeta" }, memoized per session.
  • submit.ts: postExchangeAction() thin POST helper for /exchange.
  • format-amount.ts: bigint+decimals → Hyperliquid decimal-string format.

Wiring

  • @omni-bridge/sdk umbrella re-exports the new package; root tsconfig.json references it.

Technical details

  • No new OmniAddress prefix: HyperCore reuses hlevm: (matches the Rust SDK); source-side mechanism is selected by builder choice, not by address prefix.
  • signatureChainId defaults to 0x66eee to match the Hyperliquid Python SDK convention. Only its cross-chain uniqueness matters for replay protection; the value isn't tied to Arbitrum.
  • Decimals come from szDecimals + evmExtraWeiDecimals, the HyperEVM↔HyperCore linking invariant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kiseln kiseln requested review from a team as code owners May 28, 2026 17:24
@changeset-bot

changeset-bot Bot commented May 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c40335b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@omni-bridge/hypercore Minor
@omni-bridge/core Minor
@omni-bridge/evm Minor
@omni-bridge/sdk Minor
@omni-bridge/btc Minor
@omni-bridge/near Minor
@omni-bridge/solana Minor
@omni-bridge/starknet Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

kiseln and others added 2 commits May 28, 2026 14:25
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/core/tests/bridge.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds HyperEVM as a supported EVM source/destination path and introduces a new @omni-bridge/hypercore package for building and submitting Hyperliquid Core sendToEvmWithData actions.

Changes:

  • Registers HyperEVM bridge addresses, chain IDs, validation support, RPC/proof configuration, and EVM package docs.
  • Adds @omni-bridge/hypercore with builders, encoders, typed-data signing helpers, spot metadata lookup, submit helper, tests, README, and package wiring.
  • Updates SDK exports, TypeScript project references, lockfile, and changeset configuration.

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsconfig.json Adds the HyperCore package to project references.
packages/sdk/tsconfig.json Adds SDK project reference to HyperCore.
packages/sdk/src/index.ts Re-exports the HyperCore package from the umbrella SDK.
packages/sdk/package.json Adds HyperCore workspace dependency.
packages/hypercore/tsconfig.json Defines TypeScript config for the new package.
packages/hypercore/package.json Defines package metadata, exports, and dependencies.
packages/hypercore/README.md Documents HyperCore usage and helper APIs.
packages/hypercore/src/builder.ts Builds unsigned HyperCore transfer actions and typed data.
packages/hypercore/src/config.ts Adds Hyperliquid API URLs, chain IDs, and defaults.
packages/hypercore/src/encoders.ts Encodes HyperEVM release and bridge-init action payloads.
packages/hypercore/src/format-amount.ts Formats bigint amounts as Hyperliquid decimal strings.
packages/hypercore/src/index.ts Exposes the HyperCore public API.
packages/hypercore/src/spot-meta.ts Resolves and caches Hyperliquid spot metadata.
packages/hypercore/src/submit.ts Posts signed actions to Hyperliquid /exchange.
packages/hypercore/src/typed-data.ts Constructs EIP-712 typed data and signature helpers.
packages/hypercore/src/types.ts Defines action and exchange envelope types.
packages/hypercore/tests/builder.test.ts Tests transfer action construction and metadata caching.
packages/hypercore/tests/encoders.test.ts Tests action payload ABI encoding.
packages/hypercore/tests/format-amount.test.ts Tests amount formatting vectors and validation.
packages/hypercore/tests/typed-data.test.ts Tests typed-data digest behavior and signature recovery.
packages/evm/src/proof.ts Adds HyperEVM RPC URLs and viem chain configs.
packages/evm/README.md Documents HyperEVM support in the EVM builder.
packages/core/tests/bridge.test.ts Updates validation tests for HyperEVM support.
packages/core/src/utils/hyperliquid.ts Adds helper for inbound Hyperliquid transfer params.
packages/core/src/utils/address.ts Treats HyperEVM as an EVM-compatible chain.
packages/core/src/index.ts Exports Hyperliquid helper APIs.
packages/core/src/config.ts Registers HyperEVM addresses and chain IDs.
packages/core/src/bridge.ts Enables HyperEVM contract lookup and validation flow.
bun.lock Records new workspace package and dependency wiring.
.changeset/hypercore-support.md Adds release notes and package bumps.
.changeset/config.json Adds HyperCore to the fixed-version package group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

hyperliquidChain: HYPERLIQUID_CHAIN[this.network],
signatureChainId: this.signatureChainId,
token: spotInfo.spotId,
amount: formatAmount(params.amount, spotInfo.decimals),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added c40335b

destinationChainId: HYPEREVM_CHAIN_ID[this.network],
gasLimit,
data: data.hex,
nonce: currentMsNonce(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kiseln for sdk-rs it was fine (I even removed initial version with atomic and replaced with timestamp), because people won't call it that often, but for frontend where sdk-js is used, it's a bit more critical

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a millisecond level seems good enough for me. Also we can't really synchronize it across many front-end users

Comment on lines +1 to +7
export {
createHyperCoreBuilder,
type HyperCoreBuilder,
type HyperCoreBuilderConfig,
type HyperCoreTransferParams,
type HyperCoreUnsignedAction,
} from "./builder.js"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed c40335b

Comment thread packages/hypercore/src/spot-meta.ts Outdated
Comment thread packages/hypercore/src/spot-meta.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 33 changed files in this pull request and generated 4 comments.

Comment on lines +31 to +32
export { type PostExchangeActionOptions, postExchangeAction } from "./submit.js"
export {
Comment on lines +27 to +37
interface SpotMetaToken {
name: string
fullName?: string | null
szDecimals: number
weiDecimals: number
tokenId: string
evmContract?: {
address: string
evm_extra_wei_decimals: number
} | null
}
<ResponseField name="params" type="HyperCoreTransferParams" required>
<Expandable title="HyperCoreTransferParams">
<ResponseField name="spotId" type="string" required>
Hyperliquid spot identifier in the canonical `"NAME:0x<32hex>"` form (e.g. `"USDC:0x6d1e7cde53ba9467b783cb7c530ce054"`). Names alone are **not** accepted: Hyperliquid permits multiple tokens to share a `name`, so the 32-byte `tokenId` is the only unambiguous handle.
Comment on lines +90 to +91
// Hyperliquid helpers
export { buildHyperliquidTransferParams, HYPERLIQUID_MESSAGE } from "./utils/hyperliquid.js"
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.

3 participants