@gibs/bridge-client
Browser-side endpoints, cached viem public clients, token metadata reads and chain logo URLs for a Gibs Finance bridge interface. It has no framework dependency. It sits between
@gibs/bridge-sdk(which prices and builds transfers) and an application that renders them.
Install
- Run
npm install @gibs/bridge-client viem. importloads the ECMAScript module build (dist/).requireloads the CommonJS build (dist/cjs/).- React Native 0.77 or later: Metro's default configuration and the React Native jest preset load every entry point with no extra setup. Add no
resolveRequesthook and notransformIgnorePatternsfor these packages. - It needs no polyfill, not even for
URL: React Native 0.77's ownURLandURLSearchParamsare partial, and no entry point reads them. - It needs Node 20 or later, a modern browser, or React Native 0.77 or later under Hermes.
- viem is a peer dependency. The range is
>=2.35.0 <3. - Version note: 1.12.0 and older on npm are broken. Use 1.13.0 or later.
Entry points
@gibs/bridge-client/client:clientFromChain(chainId), a cached viem public client per chain.@gibs/bridge-client/endpoints: per-chain RPC endpoint lists with storage and subscription.@gibs/bridge-client/networks: the supported viem chains.@gibs/bridge-client/image: chain logo URLs.@gibs/bridge-client/token-metadata: token metadata reads and caching.@gibs/bridge-client/block-polling: how often to ask a chain for its latest block, once per block.@gibs/bridge-client/chain-read: allowance reads.@gibs/bridge-client/cache: theCacheclass.
Example
Rules
- Check
isSupportedEvmChain(chainId)first.clientFromChainthrows for a chain outside the supported list. clientFromChaintakes a chain id number. It is not the same function asclientFromChainin@gibs/common, which takes a viem chain and a list of URLs.- The client reads its URLs from the endpoint table. An empty entry for a chain falls back to the chain defaults. For the five bridge chains those defaults are
demoRpcUrlsForfrom@gibs/bridge-sdk/chains, which put the shared valve.cityvk_demokey first. They are for demos only: set your own endpoints withsetEndpointsin production, or pass your own viem clients to the readers. - A chain logo can come from gib.show or from Relay's CDN. Use
chainLogoUrl. Do not build the URL yourself. - This package reads. It never signs or broadcasts.
Links
- README
- @gibs/bridge-sdk llms.txt
- Gibs Finance llms.txt: the whole platform.