@gibs/bridge-indexer
A reader for the Gibs Finance bridge indexer. It gives you the transfer archive, delivery receipts and live crossing status as data. It only reads. It never signs, broadcasts or renders.
Install
- Run
npm install @gibs/bridge-indexer 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, or React Native 0.77 or later under Hermes.
- viem is a peer dependency. The range is
>=2.35.0 <3. - Version note: 1.13.0 is the first version on npm.
- The package ships
schema.graphql, a snapshot of the indexer schema.
Entry points
@gibs/bridge-indexer: everything below.@gibs/bridge-indexer/endpoint:setIndexerEndpoint,indexerEndpoint,indexerClient,DEFAULT_INDEXER_ENDPOINT.@gibs/bridge-indexer/transfers:fetchBridgeTransactions,buildBridgeFilter,fetchDeliveredMessageHashes.@gibs/bridge-indexer/bridge-status: the status names (SUBMITTEDtoDELIVERED).@gibs/bridge-indexer/live-status:liveBridgeStatusStageOne,liveBridgeStatusStageTwo.@gibs/bridge-indexer/graphql: generated GraphQL types.
Endpoint
The default endpoint is https://next-indexer.gibs.finance. Importing the
package has no side effects. The client is created on first use. Call
setIndexerEndpoint before the first query to read another indexer.
The indexer serves GraphQL at / and /graphql. GET /version returns the
indexer version, the schema name and the git commit.
Production https://indexer.gibs.finance can lag the schema. If a query
fails there with an unknown field, use the next indexer.
Read a wallet's transfers
filterMode is 'pending' (the default), 'completed' or 'all'. A
transaction hash, message id or message hash in hash overrides the address.
Each transfer carries delivery { amount }. It is what the destination
omnibridge released. On a crossing with a fee director, that value reached the
delivery router before the router took its fee. To get what the recipient
received, subtract directedDeliveryFee from @gibs/bridge-sdk/settings.
One transfer's status in one call
fetchTransferStatus takes the transaction that started a transfer. It
returns one state from the bridge's state table, whether anybody can release
it now, the destination transaction, and the aggregator's own answer.
- States:
sent,confirmed-not-final,validators-confirming,ready-delivery-service,ready-your-turn,delivered,entry-reached,stranded,failed,unknown. claimableis true in both ready states. An attached delivery service can still never come.- Without
originClient, a transaction the indexer has not recorded isunknown. With it, the answer issentorconfirmed-not-final. - A route that starts off an aggregator needs
aggregator:{ provider: 'lifi' },{ provider: 'relay', requestId, apiKey }or{ provider: 'near-intents', depositAddress }. A chain the bridge does not cross throws without it. - Pass your own
fetchandendpointif you need them. The endpoint defaults toindexerEndpoint(). - It works around every defect in the list below. You do not have to.
Rules you must not break
- Known production defects. A batched re-index will fix them. Until then, work around them.
- Five relations are always
null. Do not read them:AMBBridge.validatorContract,Omnibridge.ambBridge,Omnibridge.validatorContract,UserRequest.destinationAMBBridge,UserRequest.destinationOmnibridge. - The join from a request to its
CompletionorDeliveryworks in one direction only. QueryCompletionorDeliverybymessageHash. - A message for a native pathway records the ERC-20 omnibridge, not the native one.
- Read
delivered(a boolean on the request). Do not readdelivery. Thedeliveryrelation can benullfor a request that landed. - Hex filters are lowercase. A checksummed address in a
whereclause matches nothing. Lowercase every address and hash first. FeeUpdate.feeis a rate scaled by1e18.10n ** 18nis one hundred percent.UserRequest.feeAmountis the fee actually taken, in base units of the origin token.nullmeans no fee log was seen.BigIntfields arrive as decimal strings.
Links
- README
- Indexer GraphQL
- Gibs Finance llms.txt: the whole platform.