CoreWriter Integration

The CoreWriter flow extends the standard bridge integration to deliver funds directly into HyperCore (Hyperliquid spot) or into HyperEVM tokens in one step. It builds on the Bridge Integration flow, adding CoreWriter-specific parameters and constraints.

Base URL: https://bridge-ag-api.hyperflow.fun/v1 — mainnet only. Full parameter documentation in the OpenAPI spec.

1

Get your partner code

Before initiating CoreWriter bridge transactions, obtain a unique partner code (e.g. lifi) from the HyperFlow team:

2

Generate a quote

Call /quote as in the base bridge flow, with these CoreWriter-specific rules:

  • fromChain must always be hyperevm.
  • toChain must be hypercore or hyperevm:
    • If toChain = "hypercore", toToken must be a token id retrieved from the Hyperliquid Spot Metadata API:

      $curl --location 'https://api.hyperliquid.xyz/info' \
      > --header 'Content-Type: application/json' \
      > --data '{ "type": "spotMeta" }'
    • If toChain = "hyperevm", the amount must be worth at least $100 (based on the source token value) for quotes to be returned.

  • source must include your partner code.

Example 1 — bridge 10 HYPE from hyperevm → hypercore:

1const params = {
2 fromChain: "hyperevm",
3 fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
4 toChain: "hypercore",
5 toToken: "0x0d01dc56dcaaca66ad901c959b4011ec",
6 amount: "10000000000000000000",
7 protocols: "kyberswap,hyperflow,wrapnative,hypercorespot,hypercore,layerzero,hyperunit,gaszip,relay,mayan",
8 sender: "0xf89d7b9c864f589bbF53a82105107622B35EaA40",
9 receiver: "0xf89d7b9c864f589bbF53a82105107622B35EaA40",
10 slippage: "100",
11 source: "lifi"
12};

Example 2 — bridge 10 HYPE to USD₮0 (USDT0) on HyperEVM (similar to a swap):

1const params = {
2 fromChain: "hyperevm",
3 fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
4 toChain: "hyperevm",
5 toToken: "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
6 amount: "10000000000000000000",
7 protocols: "kyberswap,hyperflow,wrapnative,hypercorespot,hypercore,layerzero,hyperunit,gaszip,relay,mayan",
8 sender: "0xf89d7b9c864f589bbF53a82105107622B35EaA40",
9 receiver: "0xf89d7b9c864f589bbF53a82105107622B35EaA40",
10 slippage: "100",
11 source: "lifi"
12};

The response includes a requestId required for the next step. It expires after 30 seconds.

3

Assemble the transaction

Identical to the base bridge flow — request encoded transaction data from /encode with the requestId:

1const txData = await fetch(`${api}/encode`, {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 requestId: quote.requestId,
6 quoteIdx: selectedQuoteIndex,
7 }),
8}).then((r) => r.json());

/encode returns the transaction under data (fields to, value, data — see the Bridge Integration for the full response shape). Since CoreWriter flows always start from HyperEVM, submit on the HyperEVM RPC.

4

Submit the transaction

Submit on-chain with any EOA wallet or contract execution method:

1const provider = new ethers.JsonRpcProvider("https://rpc.hyperliquid.xyz/evm"); // HyperEVM
2const wallet = new ethers.Wallet(process.env.PRV_KEY, provider);
3const txRes = await wallet.sendTransaction(txData.data); // { to, value, data }
4console.log("tx_hash:", txRes.hash);
5const receipt = await txRes.wait();
6console.log("mined_block:", receipt.blockNumber);
5

Check the bridge status

Track progress via /hyperbridge/orders?src_tx=<tx_hash>:

1const status = await fetch(`${api}/hyperbridge/orders?src_tx=${txRes.hash}`).then((r) => r.json());
2if (status.orders.length > 0) console.log("order state:", status.orders[0].state);

The state field:

StateMeaning
doneThe full amount was delivered as dstToken on dstChain
refundedThe user receives up to two tokens covering the full value; refunds land on Hyperliquid regardless of dstChain
pendingThe bridge is still in progress
failedThe transaction failed — wait for a retry or contact the HyperFlow team

Need help?