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
| Parameter | Type | Description |
|---|---|---|
config | GalaConnectConfig | Client 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
gala connect client config http requestor wallet address invalid timeout request ms bridge option base url galachain requests per second
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
| Parameter | Type | Description |
|---|---|---|
payload | Record<string, unknown> | Bridge token out parameters |
Returns
Promise<BridgeTokenOutResponse>
Response with wormhole message data
bridge token out response
fetchBalances()
fetchBalances(
channel?):Promise<FetchBalancesResponse>
Fetch token balances for the wallet.
Parameters
| Parameter | Type | Description |
|---|---|---|
channel? | string | Token channel (default: 'asset') |
Returns
Promise<FetchBalancesResponse>
Balance response with token holdings
fetch balances response
fetchBridgeFee()
fetchBridgeFee(
payload):Promise<BridgeFeeResponse>
Fetch bridge fee estimate for a token transfer.
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | { bridgeToken: BridgeTokenDescriptor; chainId: string; } | Fee request parameters |
payload.bridgeToken | BridgeTokenDescriptor | - |
payload.chainId | string | - |
Returns
Promise<BridgeFeeResponse>
Fee estimate with breakdown
fetch bridge fee response token descriptor chain id
getBaseUrl()
getBaseUrl():
string
Get the base URL for constructing status URLs.
Returns
string
The GalaConnect API base URL
get 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
| Parameter | Type | Description |
|---|---|---|
searchPrefix | string | Token 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)
get bridge configurations search prefix configuration token read response invalid
getBridgeStatus()
getBridgeStatus(
hash):Promise<BridgeStatusResponse>
Get the status of a bridge transaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | Transaction hash to check |
Returns
Promise<BridgeStatusResponse>
Current status with details
get bridge status response
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
| Parameter | Type | Description |
|---|---|---|
payload | Record<string, unknown> | Transaction registration data |
Returns
Promise<BridgeTransactionRegistrationResponse>
Registration response
register bridge transaction 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
| Parameter | Type | Description |
|---|---|---|
config | { method: "GET"; params: Record<string, string | number | boolean>; url: string; } | The path and its query |
config.method | "GET" | - |
config.params | Record<string, string | number | boolean> | - |
config.url | string | - |
Returns
Promise<T>
The parsed JSON answer (undefined for an empty one)
base url dex api reader galaconnect http error transport request timeout bridge read response invalid
requestBridgeOut()
requestBridgeOut(
payload):Promise<RequestBridgeOutResponse>
Request token bridge out (initiate GalaChain → External transfer).
This is the first step in the bridge out process:
- RequestBridgeOut - Lock tokens on GalaChain
- BridgeTokenOut - Generate wormhole message
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | Record<string, unknown> | Bridge out request parameters |
Returns
Promise<RequestBridgeOutResponse>
Response with transaction data
request bridge out response