@gibs/abis

Contract interfaces for the Gibs Finance bridge, as viem-ready constants. Each export is an ABI built with viem's parseAbi. Pass it to readContract, writeContract or getContract and viem infers the types.

Install

  • Run npm install @gibs/abis viem.
  • It runs on Node 20 or later, in browsers, and in React Native under Hermes.
  • import loads the ECMAScript module build (dist/). require loads the CommonJS build (dist/cjs/).
  • React Native 0.77 or later: Metro's default configuration and the React Native jest preset load it with no extra setup. Add no resolveRequest hook and no transformIgnorePatterns. The react-native condition gives an import statement the ECMAScript module build and a require call the CommonJS build.
  • viem is a peer dependency. The range is >=2.35.0 <3.
  • Version note: 1.12.0 and older on npm are broken. 1.13.0 is the first usable version.

Entry point

The package has one entry point, @gibs/abis. It exports inputBridge, erc677, outputRouter, outputBridge, feeManager, nativeRouter, univ2Router, courierRouter and related constants.

import { createPublicClient, http, type Address } from 'viem'
import { mainnet } from 'viem/chains'
import { inputBridge } from '@gibs/abis'

const client = createPublicClient({ chain: mainnet, transport: http() })

/** Reads the smallest amount of a token the bridge accepts in one transfer. */
export const minimumPerTransfer = (bridge: Address, token: Address) =>
  client.readContract({
    address: bridge,
    abi: inputBridge,
    functionName: 'minPerTx',
    args: [token],
  })

Rules

  • The ABIs hold only the functions and events the bridge interface uses. They are not full contract ABIs, except courierRouter, the full ABI of the courier-era delivery router (Ethereum 0xF700E0C1fD235719738CCa1cDeF6f41bFaef163c, 0x76B357071BB2D0EDE364365D3a4e2055ceB0ee02): isCourier, processed, recover, the delivery entry's outcome (0 delivered, 1 recovered, 2 already handled, 3 relayed for another recipient), DeliveryRecovered and named errors.
  • Some bridges take an extra sender-origin argument. Use the *ExtraInput ABIs (inputBridgeExtraInput, erc677ExtraInput) for those.
  • An ABI does not give you addresses. Read addresses from @gibs/bridge-sdk/config (pathway).