@gullylabs/bridge-sdk
v0.1.0
Published
Gully Bridge SDK: bridge users to and from Gully Chain through GullyBridgeRouter and earn an integrator fee on every transfer.
Maintainers
Readme
@gullylabs/bridge-sdk
Bridge your users to and from Gully Chain from your wallet, dapp, launchpad or bot through GullyBridgeRouter, and
earn a fee on every transfer. TypeScript, ESM + CJS with types, viem is the only (peer)
dependency.
| Network | Chain ids | Status |
|---|---|---|
| Testnet | Arbitrum Sepolia 421614 <-> Gully Chain Testnet 485590 | live since 2026-10-26, addresses built in (testnet) |
| Mainnet | Gully Chain mainnet | coming: not deployed, no addresses in this package |
npm install @gullylabs/bridge-sdk viemHow the fee works
amount = integratorFee (yours, 0 - 0.50%) + protocolFee (Gully, 0.10% today, hard cap 0.50%) + bridged amountYour fee is paid to your address in the same transaction, in the asset being bridged. There is nothing to claim and no balance held for you.
Quote (read-only, no key)
import { formatEther, parseEther } from 'viem'
import { createBridgeClient, ARBITRUM_SEPOLIA, GULLY_TESTNET } from '@gullylabs/bridge-sdk'
const gully = createBridgeClient({
integrator: '0xYourPayoutAddress', // receives your fee
integratorFeeBps: 25, // 0.25% (max 50)
// optional: Gully RPC (keyless and rate-limited; with a Gully RPC key use your project path)
rpcUrls: { [GULLY_TESTNET]: 'https://rpc.gullyrpc.xyz/gullychain/evm/485590' },
})
const { recommended } = await gully.quote({ from: ARBITRUM_SEPOLIA, to: GULLY_TESTNET, amount: parseEther('0.01') })
console.log(`you earn ${formatEther(recommended.integratorFee)} ETH, user receives ${formatEther(recommended.receiveAmount)} ${recommended.tokenOut.symbol}, ${recommended.etaLabel}`)Bridge
import { createWalletClient, custom } from 'viem'
import { arbitrumSepolia } from '@gullylabs/bridge-sdk'
const walletClient = createWalletClient({ chain: arbitrumSepolia, transport: custom(window.ethereum) })
const { hash, messageId } = await gully.bridge({ walletClient, quote: recommended })
const status = await gully.getStatus({ txHash: hash }) // 'pending' -> 'delivered'
const stats = await gully.getIntegratorStats('0xYourPayoutAddress') // transfers, volume, earned per chainSmart accounts (ERC-4337): gully.buildBridgeCalls(quote, { recipient }) returns the approve + bridge calls to batch in
one user operation. No code at all: bridgeWidgetUrl({ ref: '0xYourPayoutAddress', feeBps: 25 }) links to the hosted
bridge (https://testnet-bridge.gullychain.xyz) with you as the integrator, and bridgeWidgetIframe gives an embed.
Routes (testnet)
| Route id | From -> to | Bridge | User pays / receives | Time |
|---|---|---|---|---|
| fast-eth | Arbitrum Sepolia -> Gully Chain | Hyperlane warp route | ETH -> gETH | ~1 min |
| fast-eth | Gully Chain -> Arbitrum Sepolia | Hyperlane warp route | gETH (approve) -> ETH | ~1 min |
| canonical-eth | Arbitrum Sepolia -> Gully Chain | Arbitrum Nitro Inbox (retryable ticket) | ETH -> ETH | ~10 min |
| canonical-eth | Gully Chain -> Arbitrum Sepolia | ArbSys withdrawEth + Outbox claim | ETH -> ETH | challenge period + claimWithdrawal |
| Chain | GullyBridgeRouter |
|---|---|
| Arbitrum Sepolia (421614) | 0x5235a9183Af4C70f302c6Acd8D5d4A30F2de0Db9 |
| Gully Chain Testnet (485590) | 0x1F1968116a605a0D7486f2Fb132B4F0Ac74D6B29 |
API
const gully = createBridgeClient({ integrator, integratorFeeBps, rpcUrls?, publicClients?, network? })| Method | What it does |
|---|---|
| getRoutes({ from?, to?, kind? }) | the configured routes with on-chain routeId, router address, tokens in/out, ETA, needsClaim |
| quote({ from, to, amount, recipient?, integrator?, integratorFeeBps?, route?, refundTo? }) | { fast, canonical, recommended }: each a BridgeQuote with integratorFee, protocolFee, receiveAmount, bridgeFee (Hyperlane gas / retryable fees), exact value, tokenApproval, etaSeconds, etaLabel, and the contract params. Computed by the router's own quote() |
| bridge({ walletClient, quote, recipient?, account?, wait? }) | approves the token if needed (gETH out of Gully Chain), simulates and sends GullyBridgeRouter.bridge, waits for the receipt; returns hash, messageId, the decoded BridgeInitiated transfer |
| buildBridgeCalls(quote, { recipient, approve? }) | the approve + bridge calls for smart accounts / batching |
| getStatus({ txHash, chainId? } \| { messageId }) | pending / delivered for Hyperlane (with the delivery tx); pending / redeem-needed / delivered for canonical deposits (retryable ticket id and redeem tx); challenge-period / ready-to-claim / claimed for canonical withdrawals |
| claimWithdrawal({ walletClient, txHash }) | executes a confirmed canonical withdrawal on the Arbitrum Sepolia Outbox (proof from NodeInterface) |
| getIntegratorStats(address, { events? }) | per chain: transfers, volume and earned per token from the router's counters; with events: true every BridgeInitiated of yours |
Also exported: splitFees (the contract's fee math), toBytes32Recipient, routeIdOf, bridgeWidgetUrl /
bridgeWidgetIframe, the router ABI gullyBridgeRouterAbi, chain objects gullyTestnet / arbitrumSepolia, and the
arbitrum namespace (retryable fee estimate and id, withdrawal parsing, outbox proof).
Errors
Everything the SDK throws on purpose is a BridgeError with a stable code; router reverts are decoded into codes too:
UNSUPPORTED_CHAIN, UNSUPPORTED_ROUTE, INVALID_AMOUNT, INVALID_RECIPIENT, INTEGRATOR_FEE_TOO_HIGH,
INTEGRATOR_REQUIRED, PROTOCOL_FEE_CHANGED (re-quote), INSUFFICIENT_VALUE, INSUFFICIENT_BALANCE, ROUTER_PAUSED,
WRONG_WALLET_CHAIN, NO_ACCOUNT, NOT_A_BRIDGE_TX, NOT_FOUND, WITHDRAWAL_NOT_READY, WITHDRAWAL_ALREADY_CLAIMED,
CONTRACT_REVERT.
try { await gully.bridge({ walletClient, quote }) }
catch (e) { if (isBridgeError(e, 'PROTOCOL_FEE_CHANGED')) quote = (await gully.quote(params)).recommended }Links
Docs https://docs.gullychain.xyz · Bridge https://testnet-bridge.gullychain.xyz · Explorer https://testnet.gullyscan.xyz · News t.me/GullyChain · Discord · X @Gully_Labs
MIT licence. Built by Gully Labs.
