Backend overview
Backend for caching transmissions and helping the sdk work smoother with the Teleport Protocol. The backend periodically obtains data and cache it into redis, by applying one or more of the following methods:
- Polling from validator endpoints for new Transmissions, Signatures and Deliveries.
- Listening to events triggered by CCIP-related contracts.
It also exposes endopints for the Bridge SDK to:
- get claims for a certain receiver
- estimate delivery fee
Claims endpoint
Nexera Backend exposes an endpoint that looks like this
/{dAppId}/claims?targetChainId=...&receiver=...
{dAppId}
can be eithererc20
orerc721
receiver
is the address we are fetching the claims fortargetChainId
is the ABridge id of the target chain we are fetching claims for
The response is a list of claims, each with the following parameters
[
{
dAppId: ...,
transmissionId: ...,
transmissionBlock: ...,
transmissionTxHash: ...,
transmissionTxTimestamp: ...,
transmissionSender: ...,
transmissionReceiver: ...,
targetChainId: ...,
payload: ...,
parsedPayload: {...},
sourceChainId: ...,
signatures: [ ... ],
majorityReached: ...,
delivery: {
transmissionId: ...,
deliveryBlock: ...,
deliveryTxHash: ...,
deliveryTxTimestamp: ...
}
},
...
]
parsedPayload
contains a dApp-specific subset of parameters extracted from the payload forerc20
it looks like
parsedPayload: {
type: "erc20",
receiver: ...,
deliveryFee: {
type: "BigNumber",
hex: ...
}
}
for erc721
it looks like
parsedPayload: {
type: "erc721",
receiver: ...,
}
Delivery fee estimation endpoint
ABridge Backend's delivery estimation endpoint looks like this
/erc20/estimateDeliveryFee?sourceChainId=...&targetChainId=...&token=...&amount=...&sender=...&receiver=...
Currently only available for ERC20 Bridge.
token
is the address of the token being bridge - the backend need this to figure out of a new Wrapped Token will be deployed on claim, or one already exists.amount
is the ETH value to bridge, e.g.0.1337
sender
andreceiver
are the corresponding addresses.
On success, the response is:
{
fee: ...,
expiry: ...,
signature: ...
}
All three parameters should be passed to ERC20Bridge.egress, as DeliveryFeeData
, e.g. '[$fee, $expiry, $signature]'