bridge/classes/BaseBridgeStrategy.md
Base class providing common functionality for bridge strategies.
Concrete strategies extend this class and implement chain-specific logic.
Implements
bridge strategy
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
network | abstract readonly | ExternalNetwork | The external network this strategy handles. |
external network
Methods
bridgeIn()
abstractbridgeIn(params):Promise<BridgeTransaction>
Bridge tokens IN from external chain to GalaChain.
Flow:
- Approve bridge contract (if needed)
- Deposit tokens to bridge contract
- Register the deposit with GalaConnect
- Receive native tokens on GalaChain
Parameters
| Parameter | Type | Description |
|---|---|---|
params | BridgeInParams | Bridge in parameters |
Returns
Promise<BridgeTransaction>
Transaction details with tracking info
Implementation of
bridge in transaction params strategy
bridgeOut()
abstractbridgeOut(params):Promise<BridgeTransaction>
Bridge tokens OUT from GalaChain to external chain.
Flow:
- Lock tokens on GalaChain (via GalaConnect)
- Wait for bridge confirmation
- Receive wrapped tokens on external chain
Parameters
| Parameter | Type | Description |
|---|---|---|
params | BridgeOutParams | Bridge out parameters |
Returns
Promise<BridgeTransaction>
Transaction details with tracking info
Implementation of
bridge out transaction params strategy
estimateFee()
abstractestimateFee(tokenSymbol):Promise<BridgeFeeEstimate>
Estimate bridge fees for a transfer (a per-transfer cost: it does not depend on the amount).
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenSymbol | string | Token symbol (e.g., 'GALA', 'GUSDC') |
Returns
Promise<BridgeFeeEstimate>
Fee estimate with breakdown
Implementation of
estimate fee token symbol bridge strategy
getStatus()
abstractgetStatus(transactionHash):Promise<BridgeStatus>
Get the current status of a bridge transaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionHash | string | The bridge transaction hash |
Returns
Promise<BridgeStatus>
Current status with details
Implementation of
get status transaction hash bridge strategy
getSupportedTokens()
abstractgetSupportedTokens():string[]
Get the list of supported tokens for this chain.
Returns
string[]
Array of token symbols supported by this bridge
Implementation of
BridgeStrategy.getSupportedTokens
get supported tokens bridge strategy
isTokenSupported()
abstractisTokenSupported(tokenSymbol):boolean
Check if a specific token is supported for bridging.
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenSymbol | string | Token symbol to check |
Returns
boolean
True if token can be bridged
Implementation of
BridgeStrategy.isTokenSupported
is token supported symbol bridge strategy
isValidAddress()
abstractisValidAddress(address):boolean
Validate a recipient address for the external chain.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | string | Address to validate |
Returns
boolean
True if address is valid for this chain
Implementation of
is valid address bridge strategy
waitForCompletion()
waitForCompletion(
transactionHash,options?):Promise<BridgeStatus>
Default implementation of waitForCompletion with polling.
Strategies can override this if they have chain-specific event subscription capabilities.
Parameters
| Parameter | Type |
|---|---|
transactionHash | string |
options? | WaitOptions |
Returns
Promise<BridgeStatus>
Implementation of
BridgeStrategy.waitForCompletion
wait for completion transaction hash bridge status options strategy