Skip to main content

Class: SolanaBridgeStrategy

GalaChain core SDK 1.0.0-rc.8


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

Class: SolanaBridgeStrategy

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

Bridge strategy for GalaChain ↔ Solana transfers.

Supports 2 tokens: GALA, GSOL

Extends​

Constructors​

Constructor​

new SolanaBridgeStrategy(config): SolanaBridgeStrategy

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

Creates a new Solana bridge strategy.

Parameters​

config​

SolanaBridgeConfig

Strategy configuration

Returns​

SolanaBridgeStrategy

Throws​

GalaSDKError INVALID_PRIVATE_KEY if a key is invalid (nothing of it is shown); INVALID_BRIDGE_OPTION (the option) for an RPC URL that is not http(s) or a bridge program that is not a Solana public key

Overrides​

ConfiguredBridgeStrategy<SolanaTokenConfig>.constructor

Properties​

network​

readonly network: ExternalNetwork

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

Overrides​

ConfiguredBridgeStrategy.network

Methods​

bridgeIn()​

bridgeIn(params): Promise<BridgeTransaction>

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

Bridge tokens from Solana to GalaChain.

Parameters​

params​

BridgeInParams

Bridge in parameters

Returns​

Promise<BridgeTransaction>

Transaction details

Throws​

GalaSDKError before the deposit is sent: the input's refusal (INVALID_PRIVATE_KEY for a bad sourcePrivateKey), UNSUPPORTED_BRIDGE_TOKEN, BRIDGE_CHAIN_READ_FAILED; once it is being sent: BRIDGE_DEPOSIT_OUTCOME_UNKNOWN

Overrides​

ConfiguredBridgeStrategy.bridgeIn


bridgeOut()​

bridgeOut(params): Promise<BridgeTransaction>

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

Bridge tokens from GalaChain to Solana.

Parameters​

params​

BridgeOutParams

Bridge out parameters

Returns​

Promise<BridgeTransaction>

Transaction details

Overrides​

ConfiguredBridgeStrategy.bridgeOut


estimateFee()​

estimateFee(tokenSymbol): Promise<BridgeFeeEstimate>

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

Estimate bridge fees for a transfer to Solana.

Parameters​

tokenSymbol​

string

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

Returns​

Promise<BridgeFeeEstimate>

Fee estimate with breakdown (it does not depend on the amount)

Overrides​

ConfiguredBridgeStrategy.estimateFee


getSolanaNativeBalance()​

getSolanaNativeBalance(address?): Promise<string>

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

Get native SOL balance for a Solana address.

Parameters​

address?​

string

Optional Solana address (defaults to configured wallet)

Returns​

Promise<string>

SOL balance as decimal string (9 decimals)

Throws​

GalaSDKError INVALID_WALLET_ADDRESS if address invalid


getSolanaTokenBalance()​

getSolanaTokenBalance(tokenSymbol, address?): Promise<string>

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

Get SPL token balance for a Solana address (native SOL for a native token).

Parameters​

tokenSymbol​

string

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

address?​

string

Optional Solana address (defaults to configured wallet)

Returns​

Promise<string>

Token balance as decimal string ("0" when the address has no token account)

Throws​

GalaSDKError UNSUPPORTED_BRIDGE_TOKEN, INVALID_WALLET_ADDRESS, BRIDGE_CHAIN_READ_FAILED (the failure as cause)


getSolanaTransactionStatus()​

getSolanaTransactionStatus(signature): Promise<SolanaTransactionStatus>

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

Get the status of a Solana transaction by signature.

Parameters​

signature​

string

Transaction signature (base58)

Returns​

Promise<SolanaTransactionStatus>

Transaction status

Throws​

GalaSDKError INVALID_TRANSACTION_HASH if the signature is not 80 to 90 base58 characters


getStatus()​

getStatus(transactionHash): Promise<BridgeStatus>

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

Get the current status of a bridge transaction.

Parameters​

transactionHash​

string

Transaction hash to check.

Returns​

Promise<BridgeStatus>

Current bridge status.

Inherited from​

ConfiguredBridgeStrategy.getStatus


getSupportedTokens()​

getSupportedTokens(): string[]

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

Get the configured symbols supported by this strategy.

Returns​

string[]

Supported token symbols.

Inherited from​

ConfiguredBridgeStrategy.getSupportedTokens


getWalletAddress()​

getWalletAddress(): string

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

Get the configured Solana wallet address.

Returns​

string

Solana wallet address (base58)


isTokenSupported()​

isTokenSupported(tokenSymbol): boolean

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

Check whether a token symbol is configured for this strategy.

Parameters​

tokenSymbol​

string

Token symbol to check.

Returns​

boolean

True when the token is configured.

Inherited from​

ConfiguredBridgeStrategy.isTokenSupported


isValidAddress()​

isValidAddress(address): boolean

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

Validate a Solana address.

Parameters​

address​

string

Address to validate

Returns​

boolean

True if a valid Solana public key

Overrides​

ConfiguredBridgeStrategy.isValidAddress


requestDevnetAirdrop()​

requestDevnetAirdrop(amount?, address?): Promise<string>

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

Request a devnet SOL airdrop (devnet RPC only).

Does not wait for confirmation; returns the airdrop signature.

Parameters​

amount?​

number

SOL to request (0.00001 to 2)

address?​

string

Optional recipient (defaults to configured wallet)

Returns​

Promise<string>

Airdrop transaction signature

Throws​

GalaSDKError INVALID_BRIDGE_OPTION (airdropAmount out of range, solanaRpcUrl not devnet), INVALID_WALLET_ADDRESS


waitForCompletion()​

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

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

Default implementation of waitForCompletion with polling.

Strategies can override this if they have chain-specific event subscription capabilities.

Parameters​

transactionHash​

string

options?​

WaitOptions

Returns​

Promise<BridgeStatus>

Inherited from​

ConfiguredBridgeStrategy.waitForCompletion