6. Claim a transfer

A crossing out of PulseChain with delivery off ends in the ready-your-turn state. The user then claims the tokens on the destination chain, and pays the gas there.

Read the record

fetchClaimRecords in @gibs/bridge-indexer returns the bridge requests a claim is built from, oldest first, in the shape buildClaimTransaction takes:

const records = await fetchClaimRecords({ source: { chainId: 369, txHash } });
// or: fetchClaimRecords({ messageHash })

It asks for exactly the claim fields plus messageHash. It lowercases every hash, reads delivered as a flag, and never asks for a relation that the indexer leaves null. It makes no RPC read and writes no log. It takes fetch, endpoint and signal, like fetchTransferStatus. An empty list means that the indexer has not recorded the request yet.

It is a separate call, not a field of fetchTransferStatus, for three reasons:

  • You poll the status often, and signatures and encodedData are large.
  • One transaction can start several requests. The status reports the slowest, but a claim is per request.
  • A claim can start from a message hash, as in a history list, with no status call at all.

Build the claim

buildClaimTransaction in @gibs/bridge-sdk/claims takes the record and a via choice: { kind: 'direct' } or { kind: 'router', destinationRouter, courier }. Take both from the pathway. validator is the deprecated spelling of courier (same address); when you pass both, courier wins. To pick the router a transfer was actually sent to, call resolveReleaseTarget({ encodedData, bridgeKey, isProd }): a message names its own router, and a transfer sent before a router switch names the old one. It returns { kind: 'claim', transaction }, where the transaction is a PlannedTx of kind claim on the destination chain. Or it returns a typed refusal:

RefusalMeaningWhat your app does
wrong-typeThe request is not a signature request. The validators execute it themselves.Nothing to claim.
already-deliveredThe release already ran.Show "delivered".
not-signed-yetThe validators have not finished.Wait, then ask again.
signatures-incompleteThe indexer stored fewer signatures than the bridge needs. Carries stored and needed.Stop. Waiting does not fix it. Report it to Gibs Finance.
malformed-requestA field has the wrong shape. Carries field.Stop. Report it.

See the submitSignature case for the cause of signatures-incomplete.