Skip to main content

Interface: BridgeStrategy

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / bridge / BridgeStrategy

Interface: BridgeStrategy

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1635

Strategy interface for chain-specific bridge operations.

The Bridge SDK uses the Strategy pattern to abstract chain-specific logic:

  • EthereumBridgeStrategy: Handles ERC-20 approvals, ethers.js signing
  • SolanaBridgeStrategy: Handles SPL token accounts, @solana/web3.js signing

Each strategy encapsulates:

  • Fee estimation for the target chain
  • Outbound transfers (GalaChain → External)
  • Inbound transfers (External → GalaChain)
  • Status polling and transaction tracking

Properties​

network​

readonly network: ExternalNetwork

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1639

The external network this strategy handles.

Methods​

bridgeIn()​

bridgeIn(params): Promise<BridgeTransaction>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1671

Bridge tokens IN from external chain to GalaChain.

Flow:

  1. Approve bridge contract (if needed)
  2. Deposit tokens to bridge contract
  3. Register the deposit with GalaConnect
  4. Receive native tokens on GalaChain

Parameters​

params​

BridgeInParams

Bridge in parameters

Returns​

Promise<BridgeTransaction>

Transaction details with tracking info


bridgeOut()​

bridgeOut(params): Promise<BridgeTransaction>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1658

Bridge tokens OUT from GalaChain to external chain.

Flow:

  1. Lock tokens on GalaChain (via GalaConnect)
  2. Wait for bridge confirmation
  3. Receive wrapped tokens on external chain

Parameters​

params​

BridgeOutParams

Bridge out parameters

Returns​

Promise<BridgeTransaction>

Transaction details with tracking info


estimateFee()​

estimateFee(tokenSymbol): Promise<BridgeFeeEstimate>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1646

Estimate bridge fees for a transfer (a per-transfer cost: it does not depend on the amount).

Parameters​

tokenSymbol​

string

Token symbol (e.g., 'GALA', 'GUSDC')

Returns​

Promise<BridgeFeeEstimate>

Fee estimate with breakdown


getStatus()​

getStatus(transactionHash): Promise<BridgeStatus>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1678

Get the current status of a bridge transaction.

Parameters​

transactionHash​

string

The bridge transaction hash

Returns​

Promise<BridgeStatus>

Current status with details


getSupportedTokens()​

getSupportedTokens(): string[]

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1697

Get the list of supported tokens for this chain.

Returns​

string[]

Array of token symbols supported by this bridge


isTokenSupported()​

isTokenSupported(tokenSymbol): boolean

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1704

Check if a specific token is supported for bridging.

Parameters​

tokenSymbol​

string

Token symbol to check

Returns​

boolean

True if token can be bridged


isValidAddress()​

isValidAddress(address): boolean

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1711

Validate a recipient address for the external chain.

Parameters​

address​

string

Address to validate

Returns​

boolean

True if address is valid for this chain


waitForCompletion()​

waitForCompletion(transactionHash, options?): Promise<BridgeStatus>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:1691

Wait for a bridge transaction to complete.

Polls the transaction status until it reaches a terminal state (completed or failed) or the timeout is reached.

Parameters​

transactionHash​

string

The bridge transaction hash

options?​

WaitOptions

Polling options

Returns​

Promise<BridgeStatus>

Final status when complete

Throws​

GalaSDKError BRIDGE_STATUS_TIMEOUT if the timeout is reached first; INVALID_BRIDGE_OPTION for a poll interval or timeout that is not a finite number, 0 or more