2. Install and set up

Packages

npm install @gibs/quotes @gibs/bridge-sdk @gibs/bridge-indexer viem

@gibs/quotes pulls in @gibs/bridge-sdk, @gibs/common and @gibs/abis. @gibs/bridge-indexer pulls in @gibs/bridge-client and graphql-request. Every package needs Node 20 or later when it runs on Node.

viem

The peer range is >=2.35.0 <3. The packages are tested against exactly 2.35.0, the floor. Keep one copy of viem in your bundle.

Module formats

Every package ships two builds: ECMAScript modules in dist/ and CommonJS in dist/cjs/. The exports map has react-native, import and require conditions. Any bundler that reads exports picks the right build.

React Native 0.77

The packages work in React Native 0.77 and later with no Metro setting. They are tested in a React Native 0.77.3 app with viem 2.35.0 and the template's own metro.config.js, babel.config.js and jest.config.js. Every public entry point is bundled for iOS and Android, compiled with the Hermes compiler, and loaded under jest.

Metro in React Native 0.77 ignores exports. So every package also ships one folder per subpath, such as @gibs/bridge-sdk/execution/package.json. Its main and react-native fields point at the CommonJS build. You import the subpath as usual.

You do not need:

  • a resolveRequest hook in metro.config.js;
  • transformIgnorePatterns in your jest configuration. The React Native jest preset loads the CommonJS build untransformed;
  • unstable_enablePackageExports. Do not turn it on for these packages. They do not need it, and it can break other libraries in your app, such as web3.js.

React Native's own URL is enough

You need no URL polyfill. React Native 0.77's own URL supports only href and toString(). Its other getters throw "not implemented", and its searchParams is always empty. Its URLSearchParams can only append and serialize. No package reads either class. The packages build and read request addresses with @gibs/common/url, which needs only encodeURIComponent and decodeURIComponent.

The tests load every public entry point under React Native's own URL and URLSearchParams. If your app installs a URL polyfill for other code, the packages still work.

TON

TON is The Open Network. Most wallets never load its code:

  • @gibs/bridge-sdk/ton-connect needs no TON library and no Buffer.
  • @gibs/bridge-sdk/ton needs @ton/core, a global Buffer and expo-crypto. Install buffer and set globalThis.Buffer before the import. Without expo-crypto, Metro cannot bundle it.
  • npm still installs @ton/core and @ton/crypto, because they are regular dependencies of @gibs/bridge-sdk. Metro bundles them only when you import @gibs/bridge-sdk/ton.

A wallet that bridges only between Ethereum-style chains never pays for TON.

Using WalletConnect, ethers or web3.js

The packages read the chain through viem clients, so viem stays installed. Your app can still sign, wait for receipts and read allowances with another library. Each adapter file holds that code for one library, and the examples compile all four:

npm install @reown/appkit @reown/appkit-adapter-wagmi wagmi @wagmi/core # WalletConnect
npm install ethers # ethers 6
npm install web3 # web3.js 4

Examples A and B take the signer and a ChainAccess from any of these files. On the docs site, a menu above each code sample switches every sample to your library.

Import narrow subpaths

Metro does not drop unused exports. Import @gibs/bridge-sdk/execution, not @gibs/bridge-sdk. See the bundle-size note.