Skip to main content

bridge/classes/GalaConnectClient.md

GalaConnect API client

Handles all HTTP communication with the GalaConnect bridge API.

Constructors​

Constructor​

new GalaConnectClient(config): GalaConnectClient

Creates a new GalaConnect client.

Parameters​

ParameterTypeDescription
configGalaConnectConfigClient configuration (httpRequestor defaults to the global fetch). walletAddress is sent (the X-Wallet-Address header, the gateway balance read's owner) in the gateway's spelling: an Ethereum account in any form as eth|<checksummed>, a client| alias as written; '' is a client with no wallet (the public token lists).

Returns​

GalaConnectClient

Throws​

GalaSDKError INVALID_TIMEOUT for a requestTimeoutMs that is not a positive number of milliseconds or Infinity; INVALID_BRIDGE_OPTION (baseUrl, galachainBaseUrl) for a URL that is not http(s); (requestsPerSecond) for a rate that is not above zero; INVALID_WALLET_ADDRESS (walletAddress) for a wallet address that is no user reference

Methods​

bridgeTokenOut()​

bridgeTokenOut(payload): Promise<BridgeTokenOutResponse>

Execute bridge token out (generate wormhole message).

This is the second step in the bridge out process. Called after RequestBridgeOut succeeds.

Parameters​

ParameterTypeDescription
payloadRecord<string, unknown>Bridge token out parameters

Returns​

Promise<BridgeTokenOutResponse>

Response with wormhole message data


fetchBalances()​

fetchBalances(channel?): Promise<FetchBalancesResponse>

Fetch token balances for the wallet.

Parameters​

ParameterTypeDescription
channel?stringToken channel (default: 'asset')

Returns​

Promise<FetchBalancesResponse>

Balance response with token holdings


fetchBridgeFee()​

fetchBridgeFee(payload): Promise<BridgeFeeResponse>

Fetch bridge fee estimate for a token transfer.

Parameters​

ParameterTypeDescription
payload{ bridgeToken: BridgeTokenDescriptor; chainId: string; }Fee request parameters
payload.bridgeTokenBridgeTokenDescriptor-
payload.chainIdstring-

Returns​

Promise<BridgeFeeResponse>

Fee estimate with breakdown


getBaseUrl()​

getBaseUrl(): string

Get the base URL for constructing status URLs.

Returns​

string

The GalaConnect API base URL


getBridgeConfigurations()​

getBridgeConfigurations(searchPrefix): Promise<BridgeConfigurationToken[]>

Get bridge configurations for tokens matching a prefix.

Returns detailed token information including:

  • Token class key (collection, category, type, additionalKey)
  • Supported bridge routes
  • External network contract addresses

Parameters​

ParameterTypeDescription
searchPrefixstringToken symbol prefix to search (e.g., 'GALA', 'GUS')

Returns​

Promise<BridgeConfigurationToken[]>

Array of matching token configurations

Throws​

GalaSDKError BRIDGE_READ_RESPONSE_INVALID unless the answer has data.tokens (an array)


getBridgeStatus()​

getBridgeStatus(hash): Promise<BridgeStatusResponse>

Get the status of a bridge transaction.

Parameters​

ParameterTypeDescription
hashstringTransaction hash to check

Returns​

Promise<BridgeStatusResponse>

Current status with details


registerBridgeTransaction()​

registerBridgeTransaction(payload): Promise<BridgeTransactionRegistrationResponse>

Register a bridge transaction (for External → GalaChain transfers).

Called after depositing tokens to the bridge contract on the external chain. Notifies GalaConnect to process the inbound transfer.

Parameters​

ParameterTypeDescription
payloadRecord<string, unknown>Transaction registration data

Returns​

Promise<BridgeTransactionRegistrationResponse>

Registration response


request()​

request<T>(config): Promise<T>

A GET of the DEX API platform (baseUrl): url with params as its query, the JSON answer (a DexApiReader, which the token services read the token lists through). A read: a failure is GALACONNECT_HTTP_ERROR, TRANSPORT_ERROR, REQUEST_TIMEOUT or, for an answer that is not JSON, BRIDGE_READ_RESPONSE_INVALID, each with write: false.

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
config{ method: "GET"; params: Record<string, string | number | boolean>; url: string; }The path and its query
config.method"GET"-
config.paramsRecord<string, string | number | boolean>-
config.urlstring-

Returns​

Promise<T>

The parsed JSON answer (undefined for an empty one)


requestBridgeOut()​

requestBridgeOut(payload): Promise<RequestBridgeOutResponse>

Request token bridge out (initiate GalaChain → External transfer).

This is the first step in the bridge out process:

  1. RequestBridgeOut - Lock tokens on GalaChain
  2. BridgeTokenOut - Generate wormhole message

Parameters​

ParameterTypeDescription
payloadRecord<string, unknown>Bridge out request parameters

Returns​

Promise<RequestBridgeOutResponse>

Response with transaction data