BridgeKit class
Bridge Kit lets you perform cost estimates and crosschain transfers. You can also add event listeners for each bridging provider.constructor(config?)
Creates a new BridgeKit instance.TypeScript
| Name | Type | Description |
|---|---|---|
config | BridgeKitConfig | Optionally adds extra bridging providers |
TypeScript
BridgeKitConfig
Optionally adds extra bridging providers.TypeScript
| Name | Type | Description |
|---|---|---|
providers | BridgingProvider | Bridging providers to use in addition to CCTP (optional) |
CustomFeePolicy
Global configuration for collecting a transfer fee.TypeScript
| Name | Type | Description |
|---|---|---|
calculateFee | function | Lets you use the bridging params passed to calculate the fee you want to charge |
resolveFeeRecipientAddress | function | Lets you use both the blockchain on which the fee payout will occur and the bridging params to determine the recipient wallet address |
TypeScript
Methods
bridge(params: BridgeParams)
Executes crosschain transfers.TypeScript
| Name | Type | Description |
|---|---|---|
params | BridgeParams | Bridge transfer parameters |
BridgeResult
Usage example
TypeScript
estimate(params: BridgeParams)
Estimates costs before transferring.TypeScript
| Name | Type | Description |
|---|---|---|
params | BridgeParams | Bridge transfer parameters |
EstimateResult
Usage example
TypeScript
getSupportedChains()
Returns a list of available blockchains.TypeScript
ChainDefinition[] An array of blockchains, each object containing:
chain- String identifier of the blockchain, used in bridge parametersname- Human-readable name of the blockchain, used in UI displaystype- Blockchain typechainId- Network ID for EVM chains onlyusdcAddress- USDC token contract address on the chaincctp- CCTP configuration including domain ID and contract addresses
TypeScript
ChainDefinition[]:
TypeScript
on(action: string, handler: function)
Adds an event listener.TypeScript
| Name | Type | Description |
|---|---|---|
action | string | Event type or * for all events. Events are type-safe and defined by the providers. |
handler | function | Event handler |
void
Usage example
TypeScript
off(action: string, handler: function)
Removes an event listener.TypeScript
| Name | Type | Description |
|---|---|---|
action | string | Event type or * for all events. |
handler | function | Event handler |
void
Usage example
TypeScript
Method parameters
BridgeParams
Parameters to execute a crosschain bridge transfer.TypeScript
| Name | Type | Description |
|---|---|---|
from | AdapterContext | The source adapter and the specific chain on which the source address exists |
to | BridgeDestination | The destination adapter, the destination chain, and a recipient address (optional, if different than adapter’s default address) |
amount | string | The amount of tokens to transfer |
config | BridgeConfig | Configuration of transfer speed (optional) |
token | USDC | The type of token to transfer (optional, defaults to USDC if omitted) |
TypeScript
BridgeConfig
Configuration for transfer speed.TypeScript
| Name | Type | Description |
|---|---|---|
transferSpeed | FAST | SLOW | The speed of the transfer (optional, defaults to FAST if omitted) |
maxFee | string | FAST transfers only: the maximum fee per transfer, in the smallest token units. If less than the specified fee, the transfer speed switches to SLOW. |
customFee | CustomFee | A custom fee that you can add to the transfer |
TypeScript
AdapterContext
The adapter and its associated chain.TypeScript
| Name | Type | Description |
|---|---|---|
adapter | Adapter | The adapter instance that handles blockchain operations |
chain | ChainIdentifier | The identifier of the blockchain |
TypeScript
BridgeDestination
Specifies where tokens should be sent.TypeScript
| Type | Description |
|---|---|
AdapterContext | The adapter’s address on the destination chain |
BridgeDestinationWithAddress | Includes a specific recipient address used to override the default adapter’s address |
TypeScript
BridgeDestinationWithAddress
Specifies a recipient wallet address.TypeScript
| Name | Type | Description |
|---|---|---|
adapter | Adapter | The adapter |
chain | ChainIdentifier | The chain identifier |
recipientAddress | string | The recipient wallet address on the destination chain |
TypeScript
Method results
BridgeResult
Shows the transfer state, transaction step, source, and destination chain information, and the transfer amount. Returned by the bridge method.TypeScript
| Name | Type | Description |
|---|---|---|
amount | string | The amount of the transfer |
token | string | The token to transfer, defaults to USDC |
state | success | error | The state of the transfer |
config | BridgeConfig | The bridge configurations passed in the transfer |
source | object | Source chain information |
destination | object | Destination chain and address |
steps | BridgeStep[] | Array of transaction steps, each containing the transaction state and hash |
TypeScript
EstimateResult
Estimated costs of the transaction, returned by the estimate method.TypeScript
| Name | Type | Description |
|---|---|---|
gasFees | object | Gas costs for source and destination |
fees | object | Protocol and developer fees |
TypeScript