@gala-chain/launchpad-sdk 8.0.2 → 9.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +362 -0
- package/EXAMPLES.md +95 -681
- package/MIGRATING-TO-9.0.md +301 -0
- package/README.md +46 -17
- package/dist/LaunchpadSDK.d.ts +150 -419
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/api/LaunchpadAPI.d.ts +37 -43
- package/dist/api/LaunchpadAPI.d.ts.map +1 -1
- package/dist/auth/SessionAuthService.d.ts.map +1 -1
- package/dist/auth/SignatureAuth.d.ts +2 -2
- package/dist/auth/SignatureAuth.d.ts.map +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/config/environments.d.ts +7 -2
- package/dist/config/environments.d.ts.map +1 -1
- package/dist/constants/decimals.d.ts +0 -23
- package/dist/constants/decimals.d.ts.map +1 -1
- package/dist/constants/endpoints.d.ts +0 -7
- package/dist/constants/endpoints.d.ts.map +1 -1
- package/dist/constants/version.generated.d.ts +1 -1
- package/dist/constants/version.generated.d.ts.map +1 -1
- package/dist/helpers/sdk.d.ts.map +1 -1
- package/dist/index.browser.d.ts +11 -23
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.esm.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.node.d.ts +4 -5
- package/dist/index.node.d.ts.map +1 -1
- package/dist/launchpad/bundle-submission.d.ts +1 -9
- package/dist/launchpad/bundle-submission.d.ts.map +1 -1
- package/dist/launchpad/sell-fee-ceiling.d.ts +66 -0
- package/dist/launchpad/sell-fee-ceiling.d.ts.map +1 -0
- package/dist/launchpad/transport.d.ts +2 -1
- package/dist/launchpad/transport.d.ts.map +1 -1
- package/dist/launchpad/writes.d.ts +30 -2
- package/dist/launchpad/writes.d.ts.map +1 -1
- package/dist/native.cjs +1 -1
- package/dist/native.d.ts +3 -4
- package/dist/native.d.ts.map +1 -1
- package/dist/native.esm.js +1 -1
- package/dist/schemas/launchpad.d.ts +4 -4
- package/dist/schemas/launchpad.d.ts.map +1 -1
- package/dist/schemas/user.d.ts +0 -15
- package/dist/schemas/user.d.ts.map +1 -1
- package/dist/services/AbstractCacheService.d.ts +2 -2
- package/dist/services/BundleService.d.ts +9 -1
- package/dist/services/BundleService.d.ts.map +1 -1
- package/dist/services/GalaChainBalanceService.d.ts +17 -89
- package/dist/services/GalaChainBalanceService.d.ts.map +1 -1
- package/dist/services/GalaChainLockService.d.ts +19 -20
- package/dist/services/GalaChainLockService.d.ts.map +1 -1
- package/dist/services/GalaChainService.d.ts +28 -64
- package/dist/services/GalaChainService.d.ts.map +1 -1
- package/dist/services/GalaChainTokenService.d.ts +25 -53
- package/dist/services/GalaChainTokenService.d.ts.map +1 -1
- package/dist/services/GalaChainTransferService.d.ts +42 -41
- package/dist/services/GalaChainTransferService.d.ts.map +1 -1
- package/dist/services/LaunchpadPriceService.d.ts +66 -0
- package/dist/services/LaunchpadPriceService.d.ts.map +1 -0
- package/dist/services/NftCollectionService.d.ts +22 -6
- package/dist/services/NftCollectionService.d.ts.map +1 -1
- package/dist/services/TokenResolverService.d.ts +5 -5
- package/dist/services/TokenResolverService.d.ts.map +1 -1
- package/dist/services/TradingQuotesService.d.ts +3 -5
- package/dist/services/TradingQuotesService.d.ts.map +1 -1
- package/dist/services/gateway-transport.d.ts +32 -0
- package/dist/services/gateway-transport.d.ts.map +1 -0
- package/dist/services/gateway-writes.d.ts +83 -0
- package/dist/services/gateway-writes.d.ts.map +1 -0
- package/dist/signing/index.d.ts +2 -3
- package/dist/signing/index.d.ts.map +1 -1
- package/dist/signing/signers.d.ts +23 -11
- package/dist/signing/signers.d.ts.map +1 -1
- package/dist/signing/types.d.ts +7 -10
- package/dist/signing/types.d.ts.map +1 -1
- package/dist/types/burn.dto.d.ts +4 -2
- package/dist/types/burn.dto.d.ts.map +1 -1
- package/dist/types/common.d.ts +2 -23
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/dto.d.ts +0 -5
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/types/launchpad.dto.d.ts +0 -269
- package/dist/types/launchpad.dto.d.ts.map +1 -1
- package/dist/types/lock.dto.d.ts +12 -7
- package/dist/types/lock.dto.d.ts.map +1 -1
- package/dist/types/options.dto.d.ts +8 -34
- package/dist/types/options.dto.d.ts.map +1 -1
- package/dist/types/session-auth.dto.d.ts +2 -4
- package/dist/types/session-auth.dto.d.ts.map +1 -1
- package/dist/types/user.dto.d.ts +7 -62
- package/dist/types/user.dto.d.ts.map +1 -1
- package/dist/utils/address-formatter.d.ts +10 -2
- package/dist/utils/address-formatter.d.ts.map +1 -1
- package/dist/utils/agent-config.d.ts +9 -4
- package/dist/utils/agent-config.d.ts.map +1 -1
- package/dist/utils/auto-pagination.d.ts +6 -239
- package/dist/utils/auto-pagination.d.ts.map +1 -1
- package/dist/utils/bignumber-helpers.d.ts +3 -2
- package/dist/utils/bignumber-helpers.d.ts.map +1 -1
- package/dist/utils/delimiter-parser.d.ts +0 -13
- package/dist/utils/delimiter-parser.d.ts.map +1 -1
- package/dist/utils/error-patterns.d.ts +0 -47
- package/dist/utils/error-patterns.d.ts.map +1 -1
- package/dist/utils/error-wrapper.d.ts +5 -5
- package/dist/utils/errors.d.ts +0 -308
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/http.d.ts +15 -3
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/token-format-converter.d.ts +1 -1
- package/dist/utils/token-parser.d.ts +6 -127
- package/dist/utils/token-parser.d.ts.map +1 -1
- package/dist/utils/token-stringification.d.ts +7 -7
- package/dist/utils/token-stringification.d.ts.map +1 -1
- package/dist/utils/tokenNameNormalizer.d.ts +2 -2
- package/dist/utils/tokenNormalizer.d.ts +5 -29
- package/dist/utils/tokenNormalizer.d.ts.map +1 -1
- package/dist/utils/trade-quote.d.ts +32 -0
- package/dist/utils/trade-quote.d.ts.map +1 -0
- package/dist/utils/unique-key-generator.d.ts +7 -134
- package/dist/utils/unique-key-generator.d.ts.map +1 -1
- package/dist/utils/validation-helpers.d.ts +3 -5
- package/dist/utils/validation-helpers.d.ts.map +1 -1
- package/package.json +47 -87
- package/dist/api/dto/BurnTokensDto.d.ts +0 -77
- package/dist/api/dto/BurnTokensDto.d.ts.map +0 -1
- package/dist/api/dto/LockTokenDto.d.ts +0 -85
- package/dist/api/dto/LockTokenDto.d.ts.map +0 -1
- package/dist/api/dto/TransferTokenDto.d.ts +0 -64
- package/dist/api/dto/TransferTokenDto.d.ts.map +0 -1
- package/dist/api/dto/UnlockTokenDto.d.ts +0 -74
- package/dist/api/dto/UnlockTokenDto.d.ts.map +0 -1
- package/dist/bridge/BridgeService.d.ts +0 -484
- package/dist/bridge/BridgeService.d.ts.map +0 -1
- package/dist/bridge/GalaConnectClient.d.ts +0 -170
- package/dist/bridge/GalaConnectClient.d.ts.map +0 -1
- package/dist/bridge/constants/index.d.ts +0 -7
- package/dist/bridge/constants/index.d.ts.map +0 -1
- package/dist/bridge/constants/tokens.d.ts +0 -212
- package/dist/bridge/constants/tokens.d.ts.map +0 -1
- package/dist/bridge/index.d.ts +0 -24
- package/dist/bridge/index.d.ts.map +0 -1
- package/dist/bridge/public-types.d.ts +0 -2
- package/dist/bridge/public-types.d.ts.map +0 -1
- package/dist/bridge/strategies/BridgeStrategy.d.ts +0 -204
- package/dist/bridge/strategies/BridgeStrategy.d.ts.map +0 -1
- package/dist/bridge/strategies/EthereumBridgeStrategy.d.ts +0 -178
- package/dist/bridge/strategies/EthereumBridgeStrategy.d.ts.map +0 -1
- package/dist/bridge/strategies/SolanaBridgeStrategy.d.ts +0 -236
- package/dist/bridge/strategies/SolanaBridgeStrategy.d.ts.map +0 -1
- package/dist/bridge/types/bridge.dto.d.ts +0 -772
- package/dist/bridge/types/bridge.dto.d.ts.map +0 -1
- package/dist/bridge/types/bridgeable-token.dto.d.ts +0 -209
- package/dist/bridge/types/bridgeable-token.dto.d.ts.map +0 -1
- package/dist/bridge/types/eip712.d.ts +0 -66
- package/dist/bridge/types/eip712.d.ts.map +0 -1
- package/dist/bridge/types/index.d.ts +0 -8
- package/dist/bridge/types/index.d.ts.map +0 -1
- package/dist/bridge/utils/RateLimiter.d.ts +0 -34
- package/dist/bridge/utils/RateLimiter.d.ts.map +0 -1
- package/dist/bridge/utils/address-formatter.d.ts +0 -25
- package/dist/bridge/utils/address-formatter.d.ts.map +0 -1
- package/dist/bridge/utils/addressValidation.d.ts +0 -200
- package/dist/bridge/utils/addressValidation.d.ts.map +0 -1
- package/dist/bridge/utils/balanceHelpers.d.ts +0 -215
- package/dist/bridge/utils/balanceHelpers.d.ts.map +0 -1
- package/dist/bridge/utils/bridgeErrors.d.ts +0 -98
- package/dist/bridge/utils/bridgeErrors.d.ts.map +0 -1
- package/dist/bridge/utils/bridgeOutHelpers.d.ts +0 -68
- package/dist/bridge/utils/bridgeOutHelpers.d.ts.map +0 -1
- package/dist/bridge/utils/bridgePayload.d.ts +0 -98
- package/dist/bridge/utils/bridgePayload.d.ts.map +0 -1
- package/dist/bridge/utils/bridgeStatusParser.d.ts +0 -76
- package/dist/bridge/utils/bridgeStatusParser.d.ts.map +0 -1
- package/dist/bridge/utils/eip712Helpers.d.ts +0 -66
- package/dist/bridge/utils/eip712Helpers.d.ts.map +0 -1
- package/dist/bridge/utils/index.d.ts +0 -19
- package/dist/bridge/utils/index.d.ts.map +0 -1
- package/dist/bridge/utils/retry.d.ts +0 -112
- package/dist/bridge/utils/retry.d.ts.map +0 -1
- package/dist/bridge/utils/strategyDelegation.d.ts +0 -126
- package/dist/bridge/utils/strategyDelegation.d.ts.map +0 -1
- package/dist/bridge/utils/tokenIdUtils.d.ts +0 -86
- package/dist/bridge/utils/tokenIdUtils.d.ts.map +0 -1
- package/dist/bridge/utils/tokenMath.d.ts +0 -39
- package/dist/bridge/utils/tokenMath.d.ts.map +0 -1
- package/dist/bridge/utils/tokenMetadataResolver.d.ts +0 -97
- package/dist/bridge/utils/tokenMetadataResolver.d.ts.map +0 -1
- package/dist/helpers/wallet.d.ts +0 -151
- package/dist/helpers/wallet.d.ts.map +0 -1
- package/dist/react/WalletContext.d.ts +0 -60
- package/dist/react/WalletContext.d.ts.map +0 -1
- package/dist/react/index.d.ts +0 -65
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/types.d.ts +0 -76
- package/dist/react/types.d.ts.map +0 -1
- package/dist/react/useWallet.d.ts +0 -123
- package/dist/react/useWallet.d.ts.map +0 -1
- package/dist/react/useWalletConnection.d.ts +0 -89
- package/dist/react/useWalletConnection.d.ts.map +0 -1
- package/dist/react/useWalletDetection.d.ts +0 -81
- package/dist/react/useWalletDetection.d.ts.map +0 -1
- package/dist/react.cjs +0 -1
- package/dist/react.esm.js +0 -1
- package/dist/services/AbstractTokenFetchService.d.ts +0 -150
- package/dist/services/AbstractTokenFetchService.d.ts.map +0 -1
- package/dist/services/BatchedCacheService.d.ts +0 -133
- package/dist/services/BatchedCacheService.d.ts.map +0 -1
- package/dist/services/BridgeableTokenCache.d.ts +0 -120
- package/dist/services/BridgeableTokenCache.d.ts.map +0 -1
- package/dist/services/BridgeableTokenService.d.ts +0 -218
- package/dist/services/BridgeableTokenService.d.ts.map +0 -1
- package/dist/services/DexService.d.ts +0 -440
- package/dist/services/DexService.d.ts.map +0 -1
- package/dist/services/NetworkKeyedCacheService.d.ts +0 -185
- package/dist/services/NetworkKeyedCacheService.d.ts.map +0 -1
- package/dist/services/PriceHistoryService.d.ts +0 -209
- package/dist/services/PriceHistoryService.d.ts.map +0 -1
- package/dist/services/WrapService.d.ts +0 -171
- package/dist/services/WrapService.d.ts.map +0 -1
- package/dist/services/WrappableTokenCache.d.ts +0 -100
- package/dist/services/WrappableTokenCache.d.ts.map +0 -1
- package/dist/services/WrappableTokenService.d.ts +0 -130
- package/dist/services/WrappableTokenService.d.ts.map +0 -1
- package/dist/setup.d.ts +0 -8
- package/dist/setup.d.ts.map +0 -1
- package/dist/signing/eip712.d.ts +0 -13
- package/dist/signing/eip712.d.ts.map +0 -1
- package/dist/tokens/transfers.d.ts +0 -95
- package/dist/tokens/transfers.d.ts.map +0 -1
- package/dist/types/galachain-api.types.d.ts +0 -297
- package/dist/types/galachain-api.types.d.ts.map +0 -1
- package/dist/types/priceHistory.dto.d.ts +0 -134
- package/dist/types/priceHistory.dto.d.ts.map +0 -1
- package/dist/types/token.types.d.ts +0 -359
- package/dist/types/token.types.d.ts.map +0 -1
- package/dist/types/wrappable-token.dto.d.ts +0 -305
- package/dist/types/wrappable-token.dto.d.ts.map +0 -1
- package/dist/utils/crypto-compat.d.ts +0 -40
- package/dist/utils/crypto-compat.d.ts.map +0 -1
- package/dist/utils/load-env.d.ts +0 -31
- package/dist/utils/load-env.d.ts.map +0 -1
- package/dist/utils/token-instance-key.d.ts +0 -57
- package/dist/utils/token-instance-key.d.ts.map +0 -1
- package/dist/utils/wallet.d.ts +0 -166
- package/dist/utils/wallet.d.ts.map +0 -1
- package/dist/wallet/ExternalWalletProvider.d.ts +0 -90
- package/dist/wallet/ExternalWalletProvider.d.ts.map +0 -1
- package/dist/wallet/GalaWalletProvider.d.ts +0 -122
- package/dist/wallet/GalaWalletProvider.d.ts.map +0 -1
- package/dist/wallet/PrivateKeyProvider.d.ts +0 -90
- package/dist/wallet/PrivateKeyProvider.d.ts.map +0 -1
- package/dist/wallet/detection.d.ts +0 -107
- package/dist/wallet/detection.d.ts.map +0 -1
- package/dist/wallet/event-handlers.d.ts +0 -50
- package/dist/wallet/event-handlers.d.ts.map +0 -1
- package/dist/wallet/index.d.ts +0 -51
- package/dist/wallet/index.d.ts.map +0 -1
- package/dist/wallet/signing-operation.d.ts +0 -19
- package/dist/wallet/signing-operation.d.ts.map +0 -1
- package/dist/wallet/typed-data-helpers.d.ts +0 -68
- package/dist/wallet/typed-data-helpers.d.ts.map +0 -1
- package/dist/wallet/types.d.ts +0 -267
- package/dist/wallet/types.d.ts.map +0 -1
- package/dist/wallet/utils.d.ts +0 -117
- package/dist/wallet/utils.d.ts.map +0 -1
- package/dist/wallet.cjs +0 -1
- package/dist/wallet.esm.js +0 -1
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridge Service
|
|
3
|
-
*
|
|
4
|
-
* Main orchestrator for cross-chain bridging operations.
|
|
5
|
-
* Provides a unified API for bridging tokens between GalaChain and external chains.
|
|
6
|
-
*/
|
|
7
|
-
import type { BridgeableTokenService } from '../services/BridgeableTokenService.js';
|
|
8
|
-
import { type BridgeEnvironment } from './constants/index.js';
|
|
9
|
-
import type { BridgeConfig, BridgeFeeEstimate, BridgeInParams, BridgeOutParams, BridgeStatus, BridgeToken, BridgeTransaction, EstimateBridgeFeeParams, EthereumTransactionStatus, EthereumWalletBalanceResult, ExternalChainBalance, ExternalNetwork, SolanaTransactionStatus, SolanaWalletBalanceResult, WaitForBridgeOptions } from './types/index.js';
|
|
10
|
-
export type { BridgeEnvironment };
|
|
11
|
-
/**
|
|
12
|
-
* Extended bridge configuration with wallet keys.
|
|
13
|
-
*/
|
|
14
|
-
export interface BridgeServiceConfig extends BridgeConfig {
|
|
15
|
-
/** GalaChain wallet address (eth|0x...) */
|
|
16
|
-
galaChainWalletAddress: string;
|
|
17
|
-
/** Ethereum private key for signing (required for all operations) */
|
|
18
|
-
ethereumPrivateKey: string;
|
|
19
|
-
/** Environment - affects default RPC URLs (STAGE uses Sepolia, PROD uses mainnet) */
|
|
20
|
-
environment?: BridgeEnvironment;
|
|
21
|
-
/**
|
|
22
|
-
* Optional BridgeableTokenService for dynamic token resolution.
|
|
23
|
-
* If provided, tokenId-based operations will resolve symbols dynamically.
|
|
24
|
-
* If not provided, tokenId must match a known bridge token symbol.
|
|
25
|
-
*/
|
|
26
|
-
bridgeableTokenService?: BridgeableTokenService;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Bridge Service - Main entry point for cross-chain operations.
|
|
30
|
-
*
|
|
31
|
-
* Supports bridging between:
|
|
32
|
-
* - GalaChain ↔ Ethereum (6 tokens: GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)
|
|
33
|
-
* - GalaChain ↔ Solana (2 tokens: GALA, GSOL)
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const bridgeService = new BridgeService({
|
|
38
|
-
* // Uses GALACONNECT_PRODUCTION_URL by default
|
|
39
|
-
* galaChainWalletAddress: 'eth|0x1234...',
|
|
40
|
-
* ethereumPrivateKey: '0xabcd...',
|
|
41
|
-
* solanaPrivateKey: 'base58EncodedKey...',
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // Estimate bridge fees
|
|
45
|
-
* const fee = await bridgeService.estimateBridgeFee({
|
|
46
|
-
* tokenSymbol: 'GALA',
|
|
47
|
-
* destinationChain: 'Ethereum',
|
|
48
|
-
* amount: '100',
|
|
49
|
-
* });
|
|
50
|
-
*
|
|
51
|
-
* // Bridge out (GalaChain → Ethereum)
|
|
52
|
-
* const tx = await bridgeService.bridgeOut({
|
|
53
|
-
* tokenSymbol: 'GALA',
|
|
54
|
-
* amount: '100',
|
|
55
|
-
* destinationChain: 'Ethereum',
|
|
56
|
-
* recipientAddress: '0x5678...',
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* // Wait for completion
|
|
60
|
-
* const status = await bridgeService.waitForBridgeCompletion(tx.transactionHash);
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare class BridgeService {
|
|
64
|
-
private readonly config;
|
|
65
|
-
private readonly galaConnectClient;
|
|
66
|
-
private readonly strategies;
|
|
67
|
-
private readonly bridgeableTokenService?;
|
|
68
|
-
/**
|
|
69
|
-
* Normalize a GalaChain wallet address to the expected format.
|
|
70
|
-
*
|
|
71
|
-
* GalaChain expects: `eth|<checksummed-address-without-0x>`
|
|
72
|
-
*
|
|
73
|
-
* Accepts various formats:
|
|
74
|
-
* - `eth|0xa278...` → `eth|A278...` (removes 0x, checksums)
|
|
75
|
-
* - `eth|a278...` → `eth|A278...` (checksums)
|
|
76
|
-
* - `0xA278...` → `eth|A278...` (adds prefix, removes 0x)
|
|
77
|
-
*
|
|
78
|
-
* @param address - Wallet address in any supported format
|
|
79
|
-
* @returns Normalized address in GalaChain format
|
|
80
|
-
*/
|
|
81
|
-
private static normalizeGalaChainAddress;
|
|
82
|
-
/**
|
|
83
|
-
* Compute EIP-55 checksum for an address.
|
|
84
|
-
*
|
|
85
|
-
* @param address - Address without 0x prefix (40 hex chars)
|
|
86
|
-
* @returns Checksummed address (40 chars, mixed case)
|
|
87
|
-
*/
|
|
88
|
-
private static checksumAddress;
|
|
89
|
-
/**
|
|
90
|
-
* Creates a new Bridge Service.
|
|
91
|
-
*
|
|
92
|
-
* @param config - Service configuration
|
|
93
|
-
*/
|
|
94
|
-
constructor(config: BridgeServiceConfig);
|
|
95
|
-
/**
|
|
96
|
-
* Initialize bridge strategies for supported chains.
|
|
97
|
-
*/
|
|
98
|
-
private initializeStrategies;
|
|
99
|
-
/**
|
|
100
|
-
* Resolve a tokenId to its symbol using BridgeableTokenService.
|
|
101
|
-
*
|
|
102
|
-
* Parses the tokenId and looks up the corresponding token in the cache.
|
|
103
|
-
* The symbol comes from the authoritative DEX API, not derived from the tokenId.
|
|
104
|
-
*
|
|
105
|
-
* @param tokenId - Token identifier (string or TokenClassKey)
|
|
106
|
-
* @param network - Target network for bridging
|
|
107
|
-
* @returns Promise resolving to the token's symbol
|
|
108
|
-
* @throws Error if BridgeableTokenService is not configured
|
|
109
|
-
* @throws Error if token is not found or not bridgeable to the network
|
|
110
|
-
*/
|
|
111
|
-
private resolveTokenSymbol;
|
|
112
|
-
/**
|
|
113
|
-
* Estimate bridge fees for a transfer.
|
|
114
|
-
*
|
|
115
|
-
* @param params - Fee estimation parameters
|
|
116
|
-
* @returns Fee estimate with breakdown
|
|
117
|
-
*/
|
|
118
|
-
estimateBridgeFee(params: EstimateBridgeFeeParams): Promise<BridgeFeeEstimate>;
|
|
119
|
-
/**
|
|
120
|
-
* Bridge tokens out from GalaChain to an external chain.
|
|
121
|
-
*
|
|
122
|
-
* @param params - Bridge out parameters
|
|
123
|
-
* @returns Transaction details
|
|
124
|
-
*/
|
|
125
|
-
bridgeOut(params: BridgeOutParams): Promise<BridgeTransaction>;
|
|
126
|
-
/**
|
|
127
|
-
* Bridge tokens in from an external chain to GalaChain.
|
|
128
|
-
*
|
|
129
|
-
* @param params - Bridge in parameters
|
|
130
|
-
* @returns Transaction details
|
|
131
|
-
*/
|
|
132
|
-
bridgeIn(params: BridgeInParams): Promise<BridgeTransaction>;
|
|
133
|
-
/**
|
|
134
|
-
* Get the status of a bridge transaction.
|
|
135
|
-
*
|
|
136
|
-
* @param transactionHash - Transaction hash to check
|
|
137
|
-
* @param chain - Optional chain hint for faster lookup (if known)
|
|
138
|
-
* @returns Current status
|
|
139
|
-
*/
|
|
140
|
-
getBridgeStatus(transactionHash: string, chain?: ExternalNetwork): Promise<BridgeStatus>;
|
|
141
|
-
/**
|
|
142
|
-
* Wait for a bridge transaction to complete.
|
|
143
|
-
*
|
|
144
|
-
* @param transactionHash - Transaction hash to wait for
|
|
145
|
-
* @param options - Polling options
|
|
146
|
-
* @returns Final status when complete
|
|
147
|
-
*/
|
|
148
|
-
waitForBridgeCompletion(transactionHash: string, options?: WaitForBridgeOptions): Promise<BridgeStatus>;
|
|
149
|
-
/**
|
|
150
|
-
* Get list of all supported bridge tokens.
|
|
151
|
-
*
|
|
152
|
-
* @param chain - Optional chain to filter by
|
|
153
|
-
* @returns Array of supported tokens
|
|
154
|
-
*/
|
|
155
|
-
getSupportedBridgeTokens(chain?: ExternalNetwork): BridgeToken[];
|
|
156
|
-
/**
|
|
157
|
-
* Get list of supported external chains.
|
|
158
|
-
*
|
|
159
|
-
* @returns Array of chain names
|
|
160
|
-
*/
|
|
161
|
-
getSupportedBridgeChains(): ExternalNetwork[];
|
|
162
|
-
/**
|
|
163
|
-
* Check if a token is supported for bridging.
|
|
164
|
-
*
|
|
165
|
-
* @param tokenSymbol - Token symbol to check
|
|
166
|
-
* @param chain - Optional chain to check specifically
|
|
167
|
-
* @returns True if token is supported
|
|
168
|
-
*/
|
|
169
|
-
isTokenSupported(tokenSymbol: string, chain?: ExternalNetwork): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Validate an address for a specific chain.
|
|
172
|
-
*
|
|
173
|
-
* @param address - Address to validate
|
|
174
|
-
* @param chain - Target chain
|
|
175
|
-
* @returns True if address is valid
|
|
176
|
-
*/
|
|
177
|
-
isValidAddress(address: string, chain: ExternalNetwork): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Get ERC-20 token balance on Ethereum.
|
|
180
|
-
*
|
|
181
|
-
* @param tokenSymbol - Token symbol (e.g., 'GALA', 'GWETH', 'GUSDC')
|
|
182
|
-
* @param address - Optional Ethereum address (defaults to configured wallet)
|
|
183
|
-
* @returns Token balance as decimal string
|
|
184
|
-
* @throws Error if Ethereum bridge not configured or token not supported
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```typescript
|
|
188
|
-
* // Check wallet's GALA balance on Ethereum
|
|
189
|
-
* const balance = await bridge.getEthereumTokenBalance('GALA');
|
|
190
|
-
* console.log(`Ethereum GALA: ${balance}`);
|
|
191
|
-
*
|
|
192
|
-
* // Check specific address
|
|
193
|
-
* const otherBalance = await bridge.getEthereumTokenBalance('GUSDC', '0x1234...');
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
getEthereumTokenBalance(tokenSymbol: string, address?: string): Promise<string>;
|
|
197
|
-
/**
|
|
198
|
-
* Get native ETH balance on Ethereum.
|
|
199
|
-
*
|
|
200
|
-
* @param address - Optional Ethereum address (defaults to configured wallet)
|
|
201
|
-
* @returns ETH balance as decimal string (18 decimals)
|
|
202
|
-
* @throws Error if Ethereum bridge not configured
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```typescript
|
|
206
|
-
* // Check wallet's ETH balance (for gas fees)
|
|
207
|
-
* const ethBalance = await bridge.getEthereumNativeBalance();
|
|
208
|
-
* console.log(`ETH for gas: ${ethBalance}`);
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
getEthereumNativeBalance(address?: string): Promise<string>;
|
|
212
|
-
/**
|
|
213
|
-
* Get SPL token balance on Solana.
|
|
214
|
-
*
|
|
215
|
-
* @param tokenSymbol - Token symbol ('GALA' or 'GSOL')
|
|
216
|
-
* @param address - Optional Solana address (defaults to configured wallet)
|
|
217
|
-
* @returns Token balance as decimal string
|
|
218
|
-
* @throws Error if Solana bridge not configured or token not supported
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* ```typescript
|
|
222
|
-
* // Check wallet's GALA balance on Solana
|
|
223
|
-
* const balance = await bridge.getSolanaTokenBalance('GALA');
|
|
224
|
-
* console.log(`Solana GALA: ${balance}`);
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
getSolanaTokenBalance(tokenSymbol: string, address?: string): Promise<string>;
|
|
228
|
-
/**
|
|
229
|
-
* Get native SOL balance on Solana.
|
|
230
|
-
*
|
|
231
|
-
* @param address - Optional Solana address (defaults to configured wallet)
|
|
232
|
-
* @returns SOL balance as decimal string (9 decimals)
|
|
233
|
-
* @throws Error if Solana bridge not configured
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```typescript
|
|
237
|
-
* // Check wallet's SOL balance (for transaction fees)
|
|
238
|
-
* const solBalance = await bridge.getSolanaNativeBalance();
|
|
239
|
-
* console.log(`SOL for rent: ${solBalance}`);
|
|
240
|
-
* ```
|
|
241
|
-
*/
|
|
242
|
-
getSolanaNativeBalance(address?: string): Promise<string>;
|
|
243
|
-
/**
|
|
244
|
-
* Fetch a single ERC-20 token balance on Ethereum.
|
|
245
|
-
*
|
|
246
|
-
* Efficient method for checking a specific token balance (1 RPC call).
|
|
247
|
-
* Use `fetchEthereumWalletAllBalances()` for complete portfolio view.
|
|
248
|
-
*
|
|
249
|
-
* @param symbol - Token symbol (GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)
|
|
250
|
-
* @param address - Ethereum address (0x format). Defaults to configured wallet.
|
|
251
|
-
* @returns Single token balance with metadata
|
|
252
|
-
* @throws Error if Ethereum bridge not configured or invalid symbol
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
* ```typescript
|
|
256
|
-
* // Check GALA balance on Ethereum
|
|
257
|
-
* const gala = await bridgeService.fetchEthereumWalletTokenBalance('GALA');
|
|
258
|
-
* console.log(`GALA: ${gala.quantity}`);
|
|
259
|
-
*
|
|
260
|
-
* // Check specific address
|
|
261
|
-
* const gusdc = await bridgeService.fetchEthereumWalletTokenBalance('GUSDC', '0x1234...');
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
fetchEthereumWalletTokenBalance(symbol: string, address?: string): Promise<ExternalChainBalance>;
|
|
265
|
-
/**
|
|
266
|
-
* Fetch native ETH balance on Ethereum.
|
|
267
|
-
*
|
|
268
|
-
* Efficient method for checking ETH balance only (1 RPC call).
|
|
269
|
-
* Use `fetchEthereumWalletAllBalances()` for complete portfolio view.
|
|
270
|
-
*
|
|
271
|
-
* @param address - Ethereum address (0x format). Defaults to configured wallet.
|
|
272
|
-
* @returns Native ETH balance with metadata
|
|
273
|
-
* @throws Error if Ethereum bridge not configured
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* ```typescript
|
|
277
|
-
* // Check ETH balance (for gas fees)
|
|
278
|
-
* const eth = await bridgeService.fetchEthereumWalletNativeBalance();
|
|
279
|
-
* console.log(`ETH: ${eth.quantity}`);
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
282
|
-
fetchEthereumWalletNativeBalance(address?: string): Promise<ExternalChainBalance>;
|
|
283
|
-
/**
|
|
284
|
-
* Fetch a single SPL token balance on Solana.
|
|
285
|
-
*
|
|
286
|
-
* Efficient method for checking a specific token balance (1 RPC call).
|
|
287
|
-
* Use `fetchSolanaWalletAllBalances()` for complete portfolio view.
|
|
288
|
-
*
|
|
289
|
-
* @param symbol - Token symbol (GALA, GSOL)
|
|
290
|
-
* @param address - Solana address (base58 format). Defaults to configured wallet.
|
|
291
|
-
* @returns Single token balance with metadata
|
|
292
|
-
* @throws Error if Solana bridge not configured or invalid symbol
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
* ```typescript
|
|
296
|
-
* // Check GALA balance on Solana
|
|
297
|
-
* const gala = await bridgeService.fetchSolanaWalletTokenBalance('GALA');
|
|
298
|
-
* console.log(`GALA: ${gala.quantity}`);
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
301
|
-
fetchSolanaWalletTokenBalance(symbol: string, address?: string): Promise<ExternalChainBalance>;
|
|
302
|
-
/**
|
|
303
|
-
* Fetch native SOL balance on Solana.
|
|
304
|
-
*
|
|
305
|
-
* Efficient method for checking SOL balance only (1 RPC call).
|
|
306
|
-
* Use `fetchSolanaWalletAllBalances()` for complete portfolio view.
|
|
307
|
-
*
|
|
308
|
-
* @param address - Solana address (base58 format). Defaults to configured wallet.
|
|
309
|
-
* @returns Native SOL balance with metadata
|
|
310
|
-
* @throws Error if Solana bridge not configured
|
|
311
|
-
*
|
|
312
|
-
* @example
|
|
313
|
-
* ```typescript
|
|
314
|
-
* // Check SOL balance (for transaction fees)
|
|
315
|
-
* const sol = await bridgeService.fetchSolanaWalletNativeBalance();
|
|
316
|
-
* console.log(`SOL: ${sol.quantity}`);
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
319
|
-
fetchSolanaWalletNativeBalance(address?: string): Promise<ExternalChainBalance>;
|
|
320
|
-
/**
|
|
321
|
-
* Request SOL airdrop from Solana devnet faucet.
|
|
322
|
-
*
|
|
323
|
-
* Only available when connected to Solana devnet (STAGE environment).
|
|
324
|
-
* Will throw an error if RPC endpoint is not devnet or if Solana bridge is not configured.
|
|
325
|
-
*
|
|
326
|
-
* @param amount - Amount of SOL to request (default: 1, max: 2 per request)
|
|
327
|
-
* @param address - Optional recipient address (defaults to configured wallet)
|
|
328
|
-
* @returns Transaction signature
|
|
329
|
-
* @throws Error if not on devnet, Solana not configured, or airdrop fails
|
|
330
|
-
*
|
|
331
|
-
* @example
|
|
332
|
-
* ```typescript
|
|
333
|
-
* // Airdrop 1 SOL to configured wallet
|
|
334
|
-
* const signature = await bridgeService.requestSolanaDevnetAirdrop();
|
|
335
|
-
*
|
|
336
|
-
* // Airdrop 0.5 SOL to specific address
|
|
337
|
-
* const signature = await bridgeService.requestSolanaDevnetAirdrop(0.5, 'Address...');
|
|
338
|
-
* ```
|
|
339
|
-
*/
|
|
340
|
-
requestSolanaDevnetAirdrop(amount?: number, address?: string): Promise<string>;
|
|
341
|
-
/**
|
|
342
|
-
* Get the status of a Solana transaction by signature.
|
|
343
|
-
*
|
|
344
|
-
* This method queries the Solana RPC directly using getSignatureStatuses,
|
|
345
|
-
* which doesn't require WebSockets and works in Node.js environments.
|
|
346
|
-
* Use this to verify airdrop or bridge transactions after submission.
|
|
347
|
-
*
|
|
348
|
-
* @param signature - Base58-encoded Solana transaction signature (87-88 characters)
|
|
349
|
-
* @returns Transaction status including confirmation level and any errors
|
|
350
|
-
* @throws Error if Solana bridge not configured or signature format is invalid
|
|
351
|
-
*
|
|
352
|
-
* @example Basic usage
|
|
353
|
-
* ```typescript
|
|
354
|
-
* const signature = await bridgeService.requestSolanaDevnetAirdrop(1);
|
|
355
|
-
* // Wait a moment for transaction to propagate
|
|
356
|
-
* await new Promise(r => setTimeout(r, 2000));
|
|
357
|
-
* const status = await bridgeService.getSolanaTransactionStatus(signature);
|
|
358
|
-
* if (status.confirmed) {
|
|
359
|
-
* console.log(`Transaction confirmed at slot ${status.slot}`);
|
|
360
|
-
* }
|
|
361
|
-
* ```
|
|
362
|
-
*
|
|
363
|
-
* @example Polling pattern for confirmation
|
|
364
|
-
* ```typescript
|
|
365
|
-
* async function waitForConfirmation(signature: string, maxAttempts = 30) {
|
|
366
|
-
* for (let i = 0; i < maxAttempts; i++) {
|
|
367
|
-
* const status = await bridgeService.getSolanaTransactionStatus(signature);
|
|
368
|
-
* if (status.confirmed) return status;
|
|
369
|
-
* if (status.status === 'failed') throw new Error(status.error);
|
|
370
|
-
* await new Promise(r => setTimeout(r, 2000));
|
|
371
|
-
* }
|
|
372
|
-
* throw new Error('Transaction confirmation timeout');
|
|
373
|
-
* }
|
|
374
|
-
* ```
|
|
375
|
-
*/
|
|
376
|
-
getSolanaTransactionStatus(signature: string): Promise<SolanaTransactionStatus>;
|
|
377
|
-
/**
|
|
378
|
-
* Get the status of an Ethereum transaction by hash.
|
|
379
|
-
*
|
|
380
|
-
* Queries Ethereum RPC directly using `getTransactionReceipt()` and `getTransaction()`.
|
|
381
|
-
* Use this to verify if a bridge or any Ethereum transaction succeeded after submission.
|
|
382
|
-
*
|
|
383
|
-
* Status values:
|
|
384
|
-
* - `pending` - Transaction in mempool, not yet mined
|
|
385
|
-
* - `confirmed` - Mined with <12 confirmations
|
|
386
|
-
* - `finalized` - Mined with 12+ confirmations (practical finality)
|
|
387
|
-
* - `not_found` - Transaction hash not found on network
|
|
388
|
-
* - `failed` - Transaction mined but reverted
|
|
389
|
-
*
|
|
390
|
-
* **Performance:** Single synchronous RPC call sequence (no WebSocket required).
|
|
391
|
-
*
|
|
392
|
-
* @param transactionHash - Ethereum transaction hash (0x + 64 hex characters)
|
|
393
|
-
* @returns Transaction status with confirmation details
|
|
394
|
-
* @throws Error if Ethereum bridge not configured or hash format invalid
|
|
395
|
-
*
|
|
396
|
-
* @example Check bridge out status
|
|
397
|
-
* ```typescript
|
|
398
|
-
* const bridgeResult = await bridgeService.bridgeOut({
|
|
399
|
-
* tokenId: 'Token|Unit|GALA|...',
|
|
400
|
-
* amount: '100',
|
|
401
|
-
* destinationChain: 'Ethereum',
|
|
402
|
-
* recipientAddress: '0x1234...',
|
|
403
|
-
* });
|
|
404
|
-
*
|
|
405
|
-
* const status = await bridgeService.getEthereumTransactionStatus(bridgeResult.transactionHash);
|
|
406
|
-
* console.log(`Status: ${status.status}, Confirmations: ${status.confirmations}`);
|
|
407
|
-
* ```
|
|
408
|
-
*
|
|
409
|
-
* @example Polling pattern for finality
|
|
410
|
-
* ```typescript
|
|
411
|
-
* async function waitForFinality(txHash: string, maxAttempts = 30) {
|
|
412
|
-
* for (let i = 0; i < maxAttempts; i++) {
|
|
413
|
-
* const status = await bridgeService.getEthereumTransactionStatus(txHash);
|
|
414
|
-
* if (status.status === 'finalized') return status;
|
|
415
|
-
* if (status.status === 'failed') throw new Error(status.error);
|
|
416
|
-
* await new Promise(r => setTimeout(r, 15000)); // ~15s per block
|
|
417
|
-
* }
|
|
418
|
-
* throw new Error('Transaction finality timeout');
|
|
419
|
-
* }
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
getEthereumTransactionStatus(transactionHash: string): Promise<EthereumTransactionStatus>;
|
|
423
|
-
/**
|
|
424
|
-
* Fetch all supported token balances on Ethereum for a wallet.
|
|
425
|
-
*
|
|
426
|
-
* Returns native ETH balance plus all supported ERC-20 token balances:
|
|
427
|
-
* GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC
|
|
428
|
-
*
|
|
429
|
-
* For checking a single token, use `fetchEthereumWalletTokenBalance()` (more efficient).
|
|
430
|
-
*
|
|
431
|
-
* @param address - Ethereum address (0x format). Defaults to configured wallet.
|
|
432
|
-
* @returns Complete balance breakdown for all supported tokens
|
|
433
|
-
* @throws Error if Ethereum bridge not configured
|
|
434
|
-
*
|
|
435
|
-
* @example
|
|
436
|
-
* ```typescript
|
|
437
|
-
* // Get all Ethereum balances
|
|
438
|
-
* const result = await bridgeService.fetchEthereumWalletAllBalances();
|
|
439
|
-
* console.log(`ETH: ${result.native.quantity}`);
|
|
440
|
-
* for (const token of result.tokens) {
|
|
441
|
-
* console.log(`${token.symbol}: ${token.quantity}`);
|
|
442
|
-
* }
|
|
443
|
-
*
|
|
444
|
-
* // Check specific address
|
|
445
|
-
* const otherWallet = await bridgeService.fetchEthereumWalletAllBalances('0x1234...');
|
|
446
|
-
* ```
|
|
447
|
-
*/
|
|
448
|
-
fetchEthereumWalletAllBalances(address?: string): Promise<EthereumWalletBalanceResult>;
|
|
449
|
-
/**
|
|
450
|
-
* Fetch all supported token balances on Solana for a wallet.
|
|
451
|
-
*
|
|
452
|
-
* Returns native SOL balance plus all supported SPL token balances:
|
|
453
|
-
* GALA, GSOL
|
|
454
|
-
*
|
|
455
|
-
* For checking a single token, use `fetchSolanaWalletTokenBalance()` (more efficient).
|
|
456
|
-
*
|
|
457
|
-
* @param address - Solana address (base58 format). Defaults to configured wallet.
|
|
458
|
-
* @returns Complete balance breakdown for all supported tokens
|
|
459
|
-
* @throws Error if Solana bridge not configured
|
|
460
|
-
*
|
|
461
|
-
* @example
|
|
462
|
-
* ```typescript
|
|
463
|
-
* // Get all Solana balances
|
|
464
|
-
* const result = await bridgeService.fetchSolanaWalletAllBalances();
|
|
465
|
-
* console.log(`SOL: ${result.native.quantity}`);
|
|
466
|
-
* for (const token of result.tokens) {
|
|
467
|
-
* console.log(`${token.symbol}: ${token.quantity}`);
|
|
468
|
-
* }
|
|
469
|
-
*
|
|
470
|
-
* // Check specific address
|
|
471
|
-
* const otherWallet = await bridgeService.fetchSolanaWalletAllBalances('9WzDXw...');
|
|
472
|
-
* ```
|
|
473
|
-
*/
|
|
474
|
-
fetchSolanaWalletAllBalances(address?: string): Promise<SolanaWalletBalanceResult>;
|
|
475
|
-
/**
|
|
476
|
-
* Get the strategy for a specific chain.
|
|
477
|
-
*
|
|
478
|
-
* @param chain - Target chain
|
|
479
|
-
* @returns Bridge strategy
|
|
480
|
-
* @throws Error if chain is not supported
|
|
481
|
-
*/
|
|
482
|
-
private getStrategy;
|
|
483
|
-
}
|
|
484
|
-
//# sourceMappingURL=BridgeService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeService.d.ts","sourceRoot":"","sources":["../../src/bridge/BridgeService.ts"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
|
-
* GalaConnect Bridge Client
|
|
3
|
-
*
|
|
4
|
-
* HTTP client for GalaConnect Bridge API interactions.
|
|
5
|
-
* Handles authentication, rate limiting, and bridge-specific endpoints.
|
|
6
|
-
*
|
|
7
|
-
* Based on the proven implementation from bridge_round_trip repository.
|
|
8
|
-
*/
|
|
9
|
-
import type { BridgeConfigurationToken, BridgeFeeResponse, BridgeStatusResponse, BridgeTokenDescriptor, BridgeTokenOutResponse, BridgeTransactionRegistrationResponse, FetchBalancesResponse, GalaConnectConfig, RequestBridgeOutResponse } from './types/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* HTTP error from GalaConnect API.
|
|
12
|
-
*/
|
|
13
|
-
export declare class GalaConnectHttpError extends Error {
|
|
14
|
-
readonly status: number;
|
|
15
|
-
readonly path: string;
|
|
16
|
-
readonly responseBody: unknown;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new GalaConnect HTTP error.
|
|
19
|
-
*
|
|
20
|
-
* @param status - HTTP status code
|
|
21
|
-
* @param path - API endpoint path
|
|
22
|
-
* @param responseBody - Response body (may contain error details)
|
|
23
|
-
*/
|
|
24
|
-
constructor(status: number, path: string, responseBody: unknown);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* GalaConnect Bridge API Client.
|
|
28
|
-
*
|
|
29
|
-
* Provides type-safe access to the GalaConnect bridge endpoints:
|
|
30
|
-
* - Bridge configuration discovery
|
|
31
|
-
* - Fee estimation
|
|
32
|
-
* - Bridge out (GalaChain → External)
|
|
33
|
-
* - Bridge in (External → GalaChain)
|
|
34
|
-
* - Status tracking
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* const client = new GalaConnectClient({
|
|
39
|
-
* walletAddress: 'eth|0x1234...',
|
|
40
|
-
* // Uses GALACONNECT_PRODUCTION_URL by default
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* // Get supported tokens
|
|
44
|
-
* const tokens = await client.getBridgeConfigurations('GALA');
|
|
45
|
-
*
|
|
46
|
-
* // Estimate fees
|
|
47
|
-
* const fee = await client.fetchBridgeFee({
|
|
48
|
-
* chainId: '1',
|
|
49
|
-
* bridgeToken: { collection: 'GALA', category: 'Unit', type: 'none', additionalKey: 'none' }
|
|
50
|
-
* });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare class GalaConnectClient {
|
|
54
|
-
private readonly baseUrl;
|
|
55
|
-
private readonly galachainBaseUrl;
|
|
56
|
-
private readonly walletAddress;
|
|
57
|
-
private readonly rateLimiter;
|
|
58
|
-
private readonly defaultHeaders;
|
|
59
|
-
private readonly retryOptions;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a new GalaConnect client.
|
|
62
|
-
*
|
|
63
|
-
* @param config - Client configuration
|
|
64
|
-
*/
|
|
65
|
-
constructor(config: GalaConnectConfig);
|
|
66
|
-
/**
|
|
67
|
-
* Get the base URL for constructing status URLs.
|
|
68
|
-
*
|
|
69
|
-
* @returns The GalaConnect API base URL
|
|
70
|
-
*/
|
|
71
|
-
getBaseUrl(): string;
|
|
72
|
-
/**
|
|
73
|
-
* Get bridge configurations for tokens matching a prefix.
|
|
74
|
-
*
|
|
75
|
-
* Returns detailed token information including:
|
|
76
|
-
* - Token class key (collection, category, type, additionalKey)
|
|
77
|
-
* - Supported bridge routes
|
|
78
|
-
* - External network contract addresses
|
|
79
|
-
*
|
|
80
|
-
* @param searchPrefix - Token symbol prefix to search (e.g., 'GALA', 'GUS')
|
|
81
|
-
* @returns Array of matching token configurations
|
|
82
|
-
*/
|
|
83
|
-
getBridgeConfigurations(searchPrefix: string): Promise<BridgeConfigurationToken[]>;
|
|
84
|
-
/**
|
|
85
|
-
* Fetch bridge fee estimate for a token transfer.
|
|
86
|
-
*
|
|
87
|
-
* @param payload - Fee request parameters
|
|
88
|
-
* @returns Fee estimate with breakdown
|
|
89
|
-
*/
|
|
90
|
-
fetchBridgeFee(payload: {
|
|
91
|
-
chainId: string;
|
|
92
|
-
bridgeToken: BridgeTokenDescriptor;
|
|
93
|
-
}): Promise<BridgeFeeResponse>;
|
|
94
|
-
/**
|
|
95
|
-
* Request token bridge out (initiate GalaChain → External transfer).
|
|
96
|
-
*
|
|
97
|
-
* This is the first step in the bridge out process:
|
|
98
|
-
* 1. RequestBridgeOut - Lock tokens on GalaChain
|
|
99
|
-
* 2. BridgeTokenOut - Generate wormhole message
|
|
100
|
-
*
|
|
101
|
-
* @param payload - Bridge out request parameters
|
|
102
|
-
* @returns Response with transaction data
|
|
103
|
-
*/
|
|
104
|
-
requestBridgeOut(payload: Record<string, unknown>): Promise<RequestBridgeOutResponse>;
|
|
105
|
-
/**
|
|
106
|
-
* Execute bridge token out (generate wormhole message).
|
|
107
|
-
*
|
|
108
|
-
* This is the second step in the bridge out process.
|
|
109
|
-
* Called after RequestBridgeOut succeeds.
|
|
110
|
-
*
|
|
111
|
-
* @param payload - Bridge token out parameters
|
|
112
|
-
* @returns Response with wormhole message data
|
|
113
|
-
*/
|
|
114
|
-
bridgeTokenOut(payload: Record<string, unknown>): Promise<BridgeTokenOutResponse>;
|
|
115
|
-
/**
|
|
116
|
-
* Get the status of a bridge transaction.
|
|
117
|
-
*
|
|
118
|
-
* @param hash - Transaction hash to check
|
|
119
|
-
* @returns Current status with details
|
|
120
|
-
*/
|
|
121
|
-
getBridgeStatus(hash: string): Promise<BridgeStatusResponse>;
|
|
122
|
-
/**
|
|
123
|
-
* Register a bridge transaction (for External → GalaChain transfers).
|
|
124
|
-
*
|
|
125
|
-
* Called after depositing tokens to the bridge contract on the external chain.
|
|
126
|
-
* Notifies GalaConnect to process the inbound transfer.
|
|
127
|
-
*
|
|
128
|
-
* @param payload - Transaction registration data
|
|
129
|
-
* @returns Registration response
|
|
130
|
-
*/
|
|
131
|
-
registerBridgeTransaction(payload: Record<string, unknown>): Promise<BridgeTransactionRegistrationResponse>;
|
|
132
|
-
/**
|
|
133
|
-
* Fetch token balances for the wallet.
|
|
134
|
-
*
|
|
135
|
-
* @param channel - Token channel (default: 'asset')
|
|
136
|
-
* @returns Balance response with token holdings
|
|
137
|
-
*/
|
|
138
|
-
fetchBalances(channel?: string): Promise<FetchBalancesResponse>;
|
|
139
|
-
/**
|
|
140
|
-
* Make a POST request with JSON body.
|
|
141
|
-
*
|
|
142
|
-
* @param path - API endpoint path
|
|
143
|
-
* @param body - Request body
|
|
144
|
-
* @param options - Request options (baseUrl override, skipWalletHeader)
|
|
145
|
-
* @returns Parsed JSON response
|
|
146
|
-
*/
|
|
147
|
-
private postJson;
|
|
148
|
-
/**
|
|
149
|
-
* Make a rate-limited HTTP request with optional retry logic.
|
|
150
|
-
*
|
|
151
|
-
* Retry behavior (when enabled):
|
|
152
|
-
* - Retries on network errors (ECONNRESET, ETIMEDOUT, etc.)
|
|
153
|
-
* - Retries on server errors (5xx status codes)
|
|
154
|
-
* - Retries on rate limiting (429 Too Many Requests)
|
|
155
|
-
* - Uses exponential backoff with jitter
|
|
156
|
-
*
|
|
157
|
-
* @param url - Full URL to request
|
|
158
|
-
* @param init - Fetch init options
|
|
159
|
-
* @returns Fetch response
|
|
160
|
-
*/
|
|
161
|
-
private request;
|
|
162
|
-
/**
|
|
163
|
-
* Safely parse JSON from a response (for error handling).
|
|
164
|
-
*
|
|
165
|
-
* @param response - Fetch response
|
|
166
|
-
* @returns Parsed JSON or raw text
|
|
167
|
-
*/
|
|
168
|
-
private safeParseJson;
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=GalaConnectClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GalaConnectClient.d.ts","sourceRoot":"","sources":["../../src/bridge/GalaConnectClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qCAAqC,EACrC,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,kBA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