bridge/classes/EthereumBridgeStrategy.md
Bridge strategy for GalaChain ↔ Ethereum transfers.
Supports 6 tokens: GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC
Extends
ConfiguredBridgeStrategy<EthereumTokenConfig>
configured bridge strategy ethereum token config
Constructors
Constructor
new EthereumBridgeStrategy(
config):EthereumBridgeStrategy
Creates a new Ethereum bridge strategy.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | EthereumBridgeConfig | Strategy configuration |
Returns
EthereumBridgeStrategy
Throws
GalaSDKError INVALID_PRIVATE_KEY if ethereumPrivateKey is not 0x and 64 hex digits;
INVALID_BRIDGE_OPTION (the option) for a bridge contract or wallet address that is not an
Ethereum address (the contract is required), or an RPC URL that is not http(s)
Overrides
ConfiguredBridgeStrategy<EthereumTokenConfig>.constructor
ethereum bridge strategy config invalid private key option configured token
Properties
| Property | Modifier | Type | Default value | Description | Overrides |
|---|---|---|---|---|---|
network | readonly | ExternalNetwork | undefined | - | ConfiguredBridgeStrategy.network |
ETHEREUM_FINALITY_THRESHOLD | static readonly | 12 | 12 | Ethereum finality threshold (number of confirmations). 12+ confirmations is the practical finality threshold for Ethereum mainnet. | - |
external network configured bridge strategy ethereum finality threshold
Methods
bridgeIn()
bridgeIn(
params):Promise<BridgeTransaction>
Bridge tokens from Ethereum to GalaChain.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | BridgeInParams | Bridge in parameters |
Returns
Promise<BridgeTransaction>
Transaction details
Throws
GalaSDKError before the deposit is sent: the input's refusal, BRIDGE_CHAIN_READ_FAILED,
INSUFFICIENT_BRIDGE_BALANCE; once it is being sent: BRIDGE_DEPOSIT_OUTCOME_UNKNOWN
Overrides
ConfiguredBridgeStrategy.bridgeIn
bridge in transaction params chain read failed insufficient balance deposit outcome unknown configured strategy
bridgeOut()
bridgeOut(
params):Promise<BridgeTransaction>
Bridge tokens from GalaChain to Ethereum.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | BridgeOutParams | Bridge out parameters |
Returns
Promise<BridgeTransaction>
Transaction details
Overrides
ConfiguredBridgeStrategy.bridgeOut
bridge out transaction params configured strategy
estimateFee()
estimateFee(
tokenSymbol):Promise<BridgeFeeEstimate>
Estimate bridge fees for a transfer to Ethereum.
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenSymbol | string | Token symbol (e.g., 'GALA', 'GWETH') |
Returns
Promise<BridgeFeeEstimate>
Fee estimate with breakdown (it does not depend on the amount)
Overrides
ConfiguredBridgeStrategy.estimateFee
estimate fee token symbol bridge configured strategy
getEthereumNativeBalance()
getEthereumNativeBalance(
address?):Promise<string>
Get native ETH balance for an Ethereum address.
Parameters
| Parameter | Type | Description |
|---|---|---|
address? | string | Optional Ethereum address (defaults to configured wallet) |
Returns
Promise<string>
ETH balance as decimal string (18 decimals)
Throws
GalaSDKError INVALID_WALLET_ADDRESS if address invalid
get ethereum native balance invalid wallet address
getEthereumTokenBalance()
getEthereumTokenBalance(
tokenSymbol,address?):Promise<string>
Get ERC-20 token balance for an Ethereum address.
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenSymbol | string | Token symbol (e.g., 'GALA', 'GWETH', 'GUSDC') |
address? | string | Optional Ethereum address (defaults to configured wallet) |
Returns
Promise<string>
Token balance as decimal string (e.g., "123.45678901")
Throws
GalaSDKError UNSUPPORTED_BRIDGE_TOKEN, INVALID_WALLET_ADDRESS,
BRIDGE_CHAIN_READ_FAILED
get ethereum token balance symbol unsupported bridge invalid wallet address chain read failed
getEthereumTransactionStatus()
getEthereumTransactionStatus(
transactionHash):Promise<EthereumTransactionStatus>
Get the status of an Ethereum transaction by hash.
Queries Ethereum RPC directly using getTransactionReceipt() and getTransaction(). An RPC
failure is answered as not_found with the failure in error.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionHash | string | Ethereum transaction hash (0x-prefixed, 64 hex characters) |
Returns
Promise<EthereumTransactionStatus>
Transaction status with confirmation details
Throws
GalaSDKError INVALID_TRANSACTION_HASH if hash format is invalid
get ethereum transaction status hash receipt not found invalid
getStatus()
getStatus(
transactionHash):Promise<BridgeStatus>
Get the current status of a bridge transaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionHash | string | Transaction hash to check. |
Returns
Promise<BridgeStatus>
Current bridge status.
Inherited from
ConfiguredBridgeStrategy.getStatus
get status transaction hash bridge configured strategy
getSupportedTokens()
getSupportedTokens():
string[]
Get the configured symbols supported by this strategy.
Returns
string[]
Supported token symbols.
Inherited from
ConfiguredBridgeStrategy.getSupportedTokens
get supported tokens configured bridge strategy
getWalletAddress()
getWalletAddress():
string
Get the configured Ethereum wallet address.
Returns
string
Ethereum wallet address (0x format)
get wallet address
isTokenSupported()
isTokenSupported(
tokenSymbol):boolean
Check whether a token symbol is configured for this strategy.
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenSymbol | string | Token symbol to check. |
Returns
boolean
True when the token is configured.
Inherited from
ConfiguredBridgeStrategy.isTokenSupported
is token supported symbol configured bridge strategy
isValidAddress()
isValidAddress(
address):boolean
Validate an Ethereum address.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | string | Address to validate |
Returns
boolean
True if 0x and 40 hex digits
Overrides
ConfiguredBridgeStrategy.isValidAddress
is valid address configured 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>
Inherited from
ConfiguredBridgeStrategy.waitForCompletion
wait for completion transaction hash bridge status options configured strategy