@gala-chain/launchpad-sdk 4.0.7-beta.1 → 4.0.7-beta.10
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/README.md +144 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +150 -0
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/bridge/BridgeService.d.ts +364 -0
- package/dist/src/bridge/BridgeService.d.ts.map +1 -0
- package/dist/src/bridge/GalaConnectClient.d.ts +164 -0
- package/dist/src/bridge/GalaConnectClient.d.ts.map +1 -0
- package/dist/src/bridge/constants/index.d.ts +7 -0
- package/dist/src/bridge/constants/index.d.ts.map +1 -0
- package/dist/src/bridge/constants/tokens.d.ts +181 -0
- package/dist/src/bridge/constants/tokens.d.ts.map +1 -0
- package/dist/src/bridge/index.d.ts +22 -0
- package/dist/src/bridge/index.d.ts.map +1 -0
- package/dist/src/bridge/strategies/BridgeStrategy.d.ts +160 -0
- package/dist/src/bridge/strategies/BridgeStrategy.d.ts.map +1 -0
- package/dist/src/bridge/strategies/EthereumBridgeStrategy.d.ts +198 -0
- package/dist/src/bridge/strategies/EthereumBridgeStrategy.d.ts.map +1 -0
- package/dist/src/bridge/strategies/SolanaBridgeStrategy.d.ts +207 -0
- package/dist/src/bridge/strategies/SolanaBridgeStrategy.d.ts.map +1 -0
- package/dist/src/bridge/strategies/index.d.ts +9 -0
- package/dist/src/bridge/strategies/index.d.ts.map +1 -0
- package/dist/src/bridge/types/bridge.dto.d.ts +618 -0
- package/dist/src/bridge/types/bridge.dto.d.ts.map +1 -0
- package/dist/src/bridge/types/eip712.d.ts +57 -0
- package/dist/src/bridge/types/eip712.d.ts.map +1 -0
- package/dist/src/bridge/types/index.d.ts +8 -0
- package/dist/src/bridge/types/index.d.ts.map +1 -0
- package/dist/src/bridge/utils/RateLimiter.d.ts +34 -0
- package/dist/src/bridge/utils/RateLimiter.d.ts.map +1 -0
- package/dist/src/bridge/utils/index.d.ts +9 -0
- package/dist/src/bridge/utils/index.d.ts.map +1 -0
- package/dist/src/bridge/utils/retry.d.ts +96 -0
- package/dist/src/bridge/utils/retry.d.ts.map +1 -0
- package/dist/src/bridge/utils/tokenMath.d.ts +39 -0
- package/dist/src/bridge/utils/tokenMath.d.ts.map +1 -0
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/constants/version.generated.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +19 -2
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ethereum Bridge Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements bridging between GalaChain and Ethereum networks.
|
|
5
|
+
* Handles ERC-20 approvals, EIP-712 signing, and bridge contract interactions.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseBridgeStrategy } from './BridgeStrategy.js';
|
|
8
|
+
import { GalaConnectClient } from '../GalaConnectClient.js';
|
|
9
|
+
import type { BridgeFeeEstimate, BridgeInParams, BridgeOutParams, BridgeStatus, BridgeTransaction, EthereumTokenConfig, ExternalNetwork } from '../types/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for Ethereum bridge strategy.
|
|
12
|
+
*/
|
|
13
|
+
export interface EthereumBridgeConfig {
|
|
14
|
+
/** GalaConnect API client */
|
|
15
|
+
galaConnectClient: GalaConnectClient;
|
|
16
|
+
/** GalaChain wallet address (eth|0x...) */
|
|
17
|
+
galaChainWalletAddress: string;
|
|
18
|
+
/** Ethereum private key for signing */
|
|
19
|
+
ethereumPrivateKey: string;
|
|
20
|
+
/** Ethereum RPC URL */
|
|
21
|
+
ethereumRpcUrl?: string;
|
|
22
|
+
/** Ethereum bridge contract address */
|
|
23
|
+
ethereumBridgeContract?: string;
|
|
24
|
+
/** Ethereum wallet address (derived from private key if not provided) */
|
|
25
|
+
ethereumWalletAddress?: string;
|
|
26
|
+
/** Token configurations */
|
|
27
|
+
tokenConfigs?: EthereumTokenConfig[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bridge strategy for GalaChain ↔ Ethereum transfers.
|
|
31
|
+
*
|
|
32
|
+
* Supports 6 tokens: GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const strategy = new EthereumBridgeStrategy({
|
|
37
|
+
* galaConnectClient,
|
|
38
|
+
* galaChainWalletAddress: 'eth|0x1234...',
|
|
39
|
+
* ethereumPrivateKey: '0xabcd...',
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Bridge out (GalaChain → Ethereum)
|
|
43
|
+
* const tx = await strategy.bridgeOut({
|
|
44
|
+
* tokenSymbol: 'GALA',
|
|
45
|
+
* amount: '100',
|
|
46
|
+
* destinationChain: 'Ethereum',
|
|
47
|
+
* recipientAddress: '0x5678...',
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare class EthereumBridgeStrategy extends BaseBridgeStrategy {
|
|
52
|
+
readonly network: ExternalNetwork;
|
|
53
|
+
private readonly galaConnectClient;
|
|
54
|
+
private readonly galaChainWalletAddress;
|
|
55
|
+
private readonly ethereumProvider;
|
|
56
|
+
private readonly ethereumWallet;
|
|
57
|
+
private readonly ethereumBridgeContract;
|
|
58
|
+
private readonly ethereumWalletAddress;
|
|
59
|
+
private readonly tokenConfigs;
|
|
60
|
+
private readonly tokenMetadataCache;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new Ethereum bridge strategy.
|
|
63
|
+
*
|
|
64
|
+
* @param config - Strategy configuration
|
|
65
|
+
* @throws Error if ethereumPrivateKey is invalid format
|
|
66
|
+
*/
|
|
67
|
+
constructor(config: EthereumBridgeConfig);
|
|
68
|
+
/**
|
|
69
|
+
* Estimate bridge fees for a transfer to Ethereum.
|
|
70
|
+
*
|
|
71
|
+
* @param tokenSymbol - Token symbol (e.g., 'GALA', 'GWETH')
|
|
72
|
+
* @param amount - Amount in decimal format
|
|
73
|
+
* @returns Fee estimate with breakdown
|
|
74
|
+
*/
|
|
75
|
+
estimateFee(tokenSymbol: string, _amount: string): Promise<BridgeFeeEstimate>;
|
|
76
|
+
/**
|
|
77
|
+
* Bridge tokens from GalaChain to Ethereum.
|
|
78
|
+
*
|
|
79
|
+
* @param params - Bridge out parameters
|
|
80
|
+
* @returns Transaction details
|
|
81
|
+
*/
|
|
82
|
+
bridgeOut(params: BridgeOutParams): Promise<BridgeTransaction>;
|
|
83
|
+
/**
|
|
84
|
+
* Bridge tokens from Ethereum to GalaChain.
|
|
85
|
+
*
|
|
86
|
+
* @param params - Bridge in parameters
|
|
87
|
+
* @returns Transaction details
|
|
88
|
+
*/
|
|
89
|
+
bridgeIn(params: BridgeInParams): Promise<BridgeTransaction>;
|
|
90
|
+
/**
|
|
91
|
+
* Get the current status of a bridge transaction.
|
|
92
|
+
*
|
|
93
|
+
* @param transactionHash - Transaction hash to check
|
|
94
|
+
* @returns Current status
|
|
95
|
+
*/
|
|
96
|
+
getStatus(transactionHash: string): Promise<BridgeStatus>;
|
|
97
|
+
/**
|
|
98
|
+
* Get list of supported tokens for Ethereum bridging.
|
|
99
|
+
*
|
|
100
|
+
* @returns Array of token symbols
|
|
101
|
+
*/
|
|
102
|
+
getSupportedTokens(): string[];
|
|
103
|
+
/**
|
|
104
|
+
* Check if a token is supported for Ethereum bridging.
|
|
105
|
+
*
|
|
106
|
+
* @param tokenSymbol - Token symbol to check
|
|
107
|
+
* @returns True if supported
|
|
108
|
+
*/
|
|
109
|
+
isTokenSupported(tokenSymbol: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Validate an Ethereum address.
|
|
112
|
+
*
|
|
113
|
+
* @param address - Address to validate
|
|
114
|
+
* @returns True if valid Ethereum address
|
|
115
|
+
*/
|
|
116
|
+
isValidAddress(address: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Get the configured Ethereum wallet address.
|
|
119
|
+
*
|
|
120
|
+
* @returns Ethereum wallet address (0x format)
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const address = strategy.getWalletAddress();
|
|
125
|
+
* console.log(`Wallet: ${address}`);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
getWalletAddress(): string;
|
|
129
|
+
/**
|
|
130
|
+
* Get ERC-20 token balance for an Ethereum address.
|
|
131
|
+
*
|
|
132
|
+
* @param tokenSymbol - Token symbol (e.g., 'GALA', 'GWETH', 'GUSDC')
|
|
133
|
+
* @param address - Optional Ethereum address (defaults to configured wallet)
|
|
134
|
+
* @returns Token balance as decimal string (e.g., "123.45678901")
|
|
135
|
+
* @throws Error if token not supported or address invalid
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const balance = await strategy.getEthereumTokenBalance('GALA');
|
|
140
|
+
* console.log(`Balance: ${balance} GALA`);
|
|
141
|
+
*
|
|
142
|
+
* // Check another address
|
|
143
|
+
* const otherBalance = await strategy.getEthereumTokenBalance('GUSDC', '0x1234...');
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
getEthereumTokenBalance(tokenSymbol: string, address?: string): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Get native ETH balance for an Ethereum address.
|
|
149
|
+
*
|
|
150
|
+
* @param address - Optional Ethereum address (defaults to configured wallet)
|
|
151
|
+
* @returns ETH balance as decimal string (18 decimals)
|
|
152
|
+
* @throws Error if address invalid
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const ethBalance = await strategy.getEthereumNativeBalance();
|
|
157
|
+
* console.log(`ETH Balance: ${ethBalance} ETH`);
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
getEthereumNativeBalance(address?: string): Promise<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Get token metadata from cache or API.
|
|
163
|
+
*/
|
|
164
|
+
private getTokenMetadata;
|
|
165
|
+
/**
|
|
166
|
+
* Build EIP-712 signed bridge out payload.
|
|
167
|
+
*/
|
|
168
|
+
private buildBridgeOutPayload;
|
|
169
|
+
/**
|
|
170
|
+
* Execute bridge deposit on Ethereum.
|
|
171
|
+
*/
|
|
172
|
+
private executeBridgeDeposit;
|
|
173
|
+
/**
|
|
174
|
+
* Bridge using ERC-20 Permit for gas-less approval.
|
|
175
|
+
*/
|
|
176
|
+
private bridgeWithPermit;
|
|
177
|
+
/**
|
|
178
|
+
* Bridge using traditional ERC-20 approval.
|
|
179
|
+
*/
|
|
180
|
+
private bridgeWithApproval;
|
|
181
|
+
/**
|
|
182
|
+
* Normalize fee response for deterministic signing.
|
|
183
|
+
*/
|
|
184
|
+
private normalizeDestinationChainTxFee;
|
|
185
|
+
/**
|
|
186
|
+
* Remove undefined values for deterministic JSON.
|
|
187
|
+
*/
|
|
188
|
+
private sanitizeObject;
|
|
189
|
+
/**
|
|
190
|
+
* Extract bridge request ID from response.
|
|
191
|
+
*/
|
|
192
|
+
private extractBridgeRequestId;
|
|
193
|
+
/**
|
|
194
|
+
* Delay helper.
|
|
195
|
+
*/
|
|
196
|
+
private delay;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=EthereumBridgeStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumBridgeStrategy.d.ts","sourceRoot":"","sources":["../../../../src/bridge/strategies/EthereumBridgeStrategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EA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;OAKG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6ElE;;;;;OAKG;IACG,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAoB/D;;;;OAIG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAI9B;;;;;OAKG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAI9C;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAQxC;;;;;;;;;;OAUG;IACH,gBAAgB,IAAI,MAAM;IAQ1B;;;;;;;;;;;;;;;;OAgBG;IACG,uBAAuB,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;IAiClB;;;;;;;;;;;;OAYG;IACG,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBjE;;OAEG;YACW,gBAAgB;IAoD9B;;OAEG;YACW,qBAAqB;IAwDnC;;OAEG;YACW,oBAAoB;IAsElC;;OAEG;YACW,gBAAgB;IAqD9B;;OAEG;YACW,kBAAkB;IA+BhC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IA2DtC;;OAEG;IACH,OAAO,CAAC,cAAc;IActB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;YACW,KAAK;CAGpB"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solana Bridge Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements bridging between GalaChain and Solana networks.
|
|
5
|
+
* Handles SPL token accounts, PDA derivation, and Solana program interactions.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseBridgeStrategy } from './BridgeStrategy.js';
|
|
8
|
+
import { GalaConnectClient } from '../GalaConnectClient.js';
|
|
9
|
+
import type { BridgeFeeEstimate, BridgeInParams, BridgeOutParams, BridgeStatus, BridgeTransaction, ExternalNetwork, SolanaTokenConfig } from '../types/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for Solana bridge strategy.
|
|
12
|
+
*/
|
|
13
|
+
export interface SolanaBridgeConfig {
|
|
14
|
+
/** GalaConnect API client */
|
|
15
|
+
galaConnectClient: GalaConnectClient;
|
|
16
|
+
/** GalaChain wallet address (eth|0x...) */
|
|
17
|
+
galaChainWalletAddress: string;
|
|
18
|
+
/** Ethereum private key for EIP-712 signing (GalaChain uses Ethereum signatures) */
|
|
19
|
+
ethereumPrivateKey: string;
|
|
20
|
+
/** Solana private key in base58 format */
|
|
21
|
+
solanaPrivateKeyBase58: string;
|
|
22
|
+
/** Solana RPC URL */
|
|
23
|
+
solanaRpcUrl?: string;
|
|
24
|
+
/** Solana bridge program ID */
|
|
25
|
+
solanaBridgeProgram?: string;
|
|
26
|
+
/** Token configurations */
|
|
27
|
+
tokenConfigs?: SolanaTokenConfig[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bridge strategy for GalaChain ↔ Solana transfers.
|
|
31
|
+
*
|
|
32
|
+
* Supports 2 tokens: GALA, GSOL
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const strategy = new SolanaBridgeStrategy({
|
|
37
|
+
* galaConnectClient,
|
|
38
|
+
* galaChainWalletAddress: 'eth|0x1234...',
|
|
39
|
+
* ethereumPrivateKey: '0xabcd...',
|
|
40
|
+
* solanaPrivateKeyBase58: 'base58EncodedKey...',
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Bridge out (GalaChain → Solana)
|
|
44
|
+
* const tx = await strategy.bridgeOut({
|
|
45
|
+
* tokenSymbol: 'GALA',
|
|
46
|
+
* amount: '100',
|
|
47
|
+
* destinationChain: 'Solana',
|
|
48
|
+
* recipientAddress: 'SolanaAddress...',
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class SolanaBridgeStrategy extends BaseBridgeStrategy {
|
|
53
|
+
readonly network: ExternalNetwork;
|
|
54
|
+
private readonly galaConnectClient;
|
|
55
|
+
private readonly galaChainWalletAddress;
|
|
56
|
+
private readonly ethereumWallet;
|
|
57
|
+
private readonly solanaConnection;
|
|
58
|
+
private readonly solanaKeypair;
|
|
59
|
+
private readonly solanaBridgeProgramId;
|
|
60
|
+
private readonly solanaBridgeTokenAuthority;
|
|
61
|
+
private readonly solanaBridgeConfigPda;
|
|
62
|
+
private readonly solanaNativeBridgePda;
|
|
63
|
+
private readonly solanaBridgeAccountCache;
|
|
64
|
+
private readonly tokenConfigs;
|
|
65
|
+
private readonly tokenMetadataCache;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new Solana bridge strategy.
|
|
68
|
+
*
|
|
69
|
+
* @param config - Strategy configuration
|
|
70
|
+
* @throws Error if ethereumPrivateKey or solanaPrivateKeyBase58 is invalid format
|
|
71
|
+
*/
|
|
72
|
+
constructor(config: SolanaBridgeConfig);
|
|
73
|
+
/**
|
|
74
|
+
* Estimate bridge fees for a transfer to Solana.
|
|
75
|
+
*
|
|
76
|
+
* @param tokenSymbol - Token symbol (e.g., 'GALA', 'GSOL')
|
|
77
|
+
* @param amount - Amount in decimal format
|
|
78
|
+
* @returns Fee estimate with breakdown
|
|
79
|
+
*/
|
|
80
|
+
estimateFee(tokenSymbol: string, _amount: string): Promise<BridgeFeeEstimate>;
|
|
81
|
+
/**
|
|
82
|
+
* Bridge tokens from GalaChain to Solana.
|
|
83
|
+
*
|
|
84
|
+
* @param params - Bridge out parameters
|
|
85
|
+
* @returns Transaction details
|
|
86
|
+
*/
|
|
87
|
+
bridgeOut(params: BridgeOutParams): Promise<BridgeTransaction>;
|
|
88
|
+
/**
|
|
89
|
+
* Bridge tokens from Solana to GalaChain.
|
|
90
|
+
*
|
|
91
|
+
* @param params - Bridge in parameters
|
|
92
|
+
* @returns Transaction details
|
|
93
|
+
*/
|
|
94
|
+
bridgeIn(params: BridgeInParams): Promise<BridgeTransaction>;
|
|
95
|
+
/**
|
|
96
|
+
* Get the current status of a bridge transaction.
|
|
97
|
+
*
|
|
98
|
+
* @param transactionHash - Transaction hash to check
|
|
99
|
+
* @returns Current status
|
|
100
|
+
*/
|
|
101
|
+
getStatus(transactionHash: string): Promise<BridgeStatus>;
|
|
102
|
+
/**
|
|
103
|
+
* Get list of supported tokens for Solana bridging.
|
|
104
|
+
*
|
|
105
|
+
* @returns Array of token symbols
|
|
106
|
+
*/
|
|
107
|
+
getSupportedTokens(): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Check if a token is supported for Solana bridging.
|
|
110
|
+
*
|
|
111
|
+
* @param tokenSymbol - Token symbol to check
|
|
112
|
+
* @returns True if supported
|
|
113
|
+
*/
|
|
114
|
+
isTokenSupported(tokenSymbol: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Validate a Solana address.
|
|
117
|
+
*
|
|
118
|
+
* @param address - Address to validate
|
|
119
|
+
* @returns True if valid Solana address
|
|
120
|
+
*/
|
|
121
|
+
isValidAddress(address: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Get the configured Solana wallet address.
|
|
124
|
+
*
|
|
125
|
+
* @returns Solana wallet address (base58 format)
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const address = strategy.getWalletAddress();
|
|
130
|
+
* console.log(`Wallet: ${address}`);
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
getWalletAddress(): string;
|
|
134
|
+
/**
|
|
135
|
+
* Get SPL token balance for a Solana address.
|
|
136
|
+
*
|
|
137
|
+
* @param tokenSymbol - Token symbol ('GALA' or 'GSOL')
|
|
138
|
+
* @param address - Optional Solana address (defaults to configured wallet)
|
|
139
|
+
* @returns Token balance as decimal string (returns "0" for zero balance)
|
|
140
|
+
* @throws Error if token not supported or address invalid
|
|
141
|
+
*
|
|
142
|
+
* @remarks
|
|
143
|
+
* If the token account does not exist, this method returns "0" rather than
|
|
144
|
+
* throwing an error, as non-existent accounts are equivalent to zero balance.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const balance = await strategy.getSolanaTokenBalance('GALA');
|
|
149
|
+
* console.log(`Balance: ${balance} GALA`);
|
|
150
|
+
*
|
|
151
|
+
* // Check another address
|
|
152
|
+
* const otherBalance = await strategy.getSolanaTokenBalance('GALA', 'SolanaAddress...');
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
getSolanaTokenBalance(tokenSymbol: string, address?: string): Promise<string>;
|
|
156
|
+
/**
|
|
157
|
+
* Get native SOL balance for a Solana address.
|
|
158
|
+
*
|
|
159
|
+
* @param address - Optional Solana address (defaults to configured wallet)
|
|
160
|
+
* @returns SOL balance as decimal string (9 decimals)
|
|
161
|
+
* @throws Error if address invalid
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const solBalance = await strategy.getSolanaNativeBalance();
|
|
166
|
+
* console.log(`SOL Balance: ${solBalance} SOL`);
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
getSolanaNativeBalance(address?: string): Promise<string>;
|
|
170
|
+
/**
|
|
171
|
+
* Get token metadata from cache or API.
|
|
172
|
+
*/
|
|
173
|
+
private getTokenMetadata;
|
|
174
|
+
/**
|
|
175
|
+
* Build EIP-712 signed bridge out payload.
|
|
176
|
+
*/
|
|
177
|
+
private buildBridgeOutPayload;
|
|
178
|
+
/**
|
|
179
|
+
* Execute Solana bridge out transaction.
|
|
180
|
+
*/
|
|
181
|
+
private executeSolanaBridgeOut;
|
|
182
|
+
/**
|
|
183
|
+
* Build instruction for native SOL bridging.
|
|
184
|
+
*/
|
|
185
|
+
private buildNativeBridgeInstruction;
|
|
186
|
+
/**
|
|
187
|
+
* Build instruction for SPL token bridging.
|
|
188
|
+
*/
|
|
189
|
+
private buildTokenBridgeInstruction;
|
|
190
|
+
/**
|
|
191
|
+
* Get cached Solana bridge accounts for a mint.
|
|
192
|
+
*/
|
|
193
|
+
private getSolanaBridgeAccounts;
|
|
194
|
+
/**
|
|
195
|
+
* Normalize fee response for deterministic signing.
|
|
196
|
+
*/
|
|
197
|
+
private normalizeDestinationChainTxFee;
|
|
198
|
+
/**
|
|
199
|
+
* Remove undefined values for deterministic JSON.
|
|
200
|
+
*/
|
|
201
|
+
private sanitizeObject;
|
|
202
|
+
/**
|
|
203
|
+
* Extract bridge request ID from response.
|
|
204
|
+
*/
|
|
205
|
+
private extractBridgeRequestId;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=SolanaBridgeStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolanaBridgeStrategy.d.ts","sourceRoot":"","sources":["../../../../src/bridge/strategies/SolanaBridgeStrategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EAEf,YAAY,EAEZ,iBAAiB,EAEjB,eAAe,EACf,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAa3B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,6BAA6B;IAC7B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,2CAA2C;IAC3C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oFAAoF;IACpF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0CAA0C;IAC1C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2BAA2B;IAC3B,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC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