@gala-chain/launchpad-sdk 4.0.7-beta.3 → 4.0.7-beta.5
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 +343 -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 +612 -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/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +19 -2
package/README.md
CHANGED
|
@@ -73,6 +73,8 @@ console.log(pools.hasNext); // Computed convenience properties
|
|
|
73
73
|
- **User Operations**: Portfolio management, token balances, and account management
|
|
74
74
|
- **Comment System**: Post and retrieve comments on token pools
|
|
75
75
|
- **Price History**: Fetch historical price data for DEX tokens with pagination (Node.js only)
|
|
76
|
+
- **Cross-Chain Bridging**: Transfer tokens between GalaChain, Ethereum, and Solana with fee estimation
|
|
77
|
+
- **External Wallet Balances**: Query Ethereum and Solana wallet balances (single-token or full portfolio)
|
|
76
78
|
- **Comprehensive Validation**: Input validation and error handling for all operations
|
|
77
79
|
- **Multi-Environment Support**: Production, staging, and custom backend URLs
|
|
78
80
|
|
|
@@ -1232,6 +1234,106 @@ await sdk.unlockToken({
|
|
|
1232
1234
|
- **Escrow**: Third-party holds tokens until conditions met
|
|
1233
1235
|
- **Vesting**: Time-locked token releases with expiration
|
|
1234
1236
|
|
|
1237
|
+
## Cross-Chain Bridge Operations
|
|
1238
|
+
|
|
1239
|
+
The SDK provides comprehensive cross-chain bridging for GalaChain ↔ Ethereum and GalaChain ↔ Solana transfers.
|
|
1240
|
+
|
|
1241
|
+
### Configuration
|
|
1242
|
+
|
|
1243
|
+
```typescript
|
|
1244
|
+
import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
1245
|
+
|
|
1246
|
+
const sdk = new LaunchpadSDK({
|
|
1247
|
+
wallet: process.env.PRIVATE_KEY,
|
|
1248
|
+
// Bridge configuration (optional - enables bridge operations)
|
|
1249
|
+
ethereumPrivateKey: process.env.ETHEREUM_PRIVATE_KEY, // Required for Ethereum bridging
|
|
1250
|
+
solanaPrivateKey: process.env.SOLANA_PRIVATE_KEY, // Required for Solana bridging
|
|
1251
|
+
});
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
### Wallet Balance Queries
|
|
1255
|
+
|
|
1256
|
+
Query Ethereum and Solana wallet balances with two approaches:
|
|
1257
|
+
|
|
1258
|
+
**Single Token Queries (Fast - 1 RPC call)**
|
|
1259
|
+
```typescript
|
|
1260
|
+
// Single ERC-20 token balance
|
|
1261
|
+
const gala = await sdk.fetchEthereumWalletTokenBalance('GALA');
|
|
1262
|
+
// Returns: { symbol: 'GALA', quantity: '1234.56', decimals: 8, contractAddress: '0x...', isNative: false }
|
|
1263
|
+
|
|
1264
|
+
// Native ETH balance
|
|
1265
|
+
const eth = await sdk.fetchEthereumWalletNativeBalance();
|
|
1266
|
+
// Returns: { symbol: 'ETH', quantity: '0.5', decimals: 18, contractAddress: null, isNative: true }
|
|
1267
|
+
|
|
1268
|
+
// Single SPL token balance (Solana)
|
|
1269
|
+
const solGala = await sdk.fetchSolanaWalletTokenBalance('GALA');
|
|
1270
|
+
// Returns: { symbol: 'GALA', quantity: '789.01', decimals: 8, contractAddress: '...', isNative: false }
|
|
1271
|
+
|
|
1272
|
+
// Native SOL balance
|
|
1273
|
+
const sol = await sdk.fetchSolanaWalletNativeBalance();
|
|
1274
|
+
// Returns: { symbol: 'SOL', quantity: '2.5', decimals: 9, contractAddress: null, isNative: true }
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
**All Tokens Queries (Complete portfolio view)**
|
|
1278
|
+
```typescript
|
|
1279
|
+
// Ethereum: ETH + all supported ERC-20s (GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)
|
|
1280
|
+
const allEth = await sdk.fetchEthereumWalletAllBalances();
|
|
1281
|
+
console.log(allEth.native.quantity); // ETH balance
|
|
1282
|
+
console.log(allEth.tokens); // 6 ERC-20 balances
|
|
1283
|
+
console.log(allEth.address); // Wallet address
|
|
1284
|
+
console.log(allEth.timestamp); // Query timestamp
|
|
1285
|
+
|
|
1286
|
+
// Solana: SOL + all supported SPL tokens (GALA, GSOL)
|
|
1287
|
+
const allSol = await sdk.fetchSolanaWalletAllBalances();
|
|
1288
|
+
console.log(allSol.native.quantity); // SOL balance
|
|
1289
|
+
console.log(allSol.tokens); // 2 SPL balances
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
**When to use which:**
|
|
1293
|
+
- **Single-token queries**: Quick checks, performance-critical scenarios, frequent polling
|
|
1294
|
+
- **All-tokens queries**: Portfolio dashboards, wallet UIs, multi-token operations
|
|
1295
|
+
|
|
1296
|
+
### Bridge Operations
|
|
1297
|
+
|
|
1298
|
+
```typescript
|
|
1299
|
+
// Estimate fees before bridging
|
|
1300
|
+
const fee = await sdk.estimateBridgeFee({
|
|
1301
|
+
tokenSymbol: 'GALA',
|
|
1302
|
+
destinationChain: 'Ethereum',
|
|
1303
|
+
amount: '1000',
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
// Bridge OUT: GalaChain → Ethereum/Solana
|
|
1307
|
+
const result = await sdk.bridgeOut({
|
|
1308
|
+
tokenSymbol: 'GALA',
|
|
1309
|
+
amount: '1000',
|
|
1310
|
+
destinationChain: 'Ethereum',
|
|
1311
|
+
recipientAddress: '0x...',
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
// Bridge IN: Ethereum/Solana → GalaChain
|
|
1315
|
+
const result = await sdk.bridgeIn({
|
|
1316
|
+
tokenSymbol: 'GALA',
|
|
1317
|
+
amount: '1000',
|
|
1318
|
+
sourceChain: 'Ethereum',
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
// Check bridge status
|
|
1322
|
+
const status = await sdk.getBridgeStatus(result.transactionHash);
|
|
1323
|
+
```
|
|
1324
|
+
|
|
1325
|
+
### Supported Tokens
|
|
1326
|
+
|
|
1327
|
+
| Token | Symbol | Ethereum | Solana | Decimals |
|
|
1328
|
+
|-------|--------|----------|--------|----------|
|
|
1329
|
+
| GALA | GALA | ✅ | ✅ | 8 |
|
|
1330
|
+
| Wrapped ETH | GWETH | ✅ | - | 18 |
|
|
1331
|
+
| USD Coin | GUSDC | ✅ | - | 6 |
|
|
1332
|
+
| Tether USD | GUSDT | ✅ | - | 6 |
|
|
1333
|
+
| Wrapped TRON | GWTRX | ✅ | - | 6 |
|
|
1334
|
+
| Wrapped BTC | GWBTC | ✅ | - | 8 |
|
|
1335
|
+
| Wrapped SOL | GSOL | - | ✅ | 9 |
|
|
1336
|
+
|
|
1235
1337
|
## Multi-Wallet Support
|
|
1236
1338
|
|
|
1237
1339
|
The SDK supports **per-operation wallet overrides** for testing multi-wallet workflows without creating new SDK instances. This is ideal for:
|
|
@@ -2330,6 +2432,48 @@ uploadProfileImage(options): Promise<ImageUploadResult>
|
|
|
2330
2432
|
- `resolveVaultAddress(tokenName: string): Promise<string>`
|
|
2331
2433
|
- `cleanup(): void` - Cleanup resources
|
|
2332
2434
|
|
|
2435
|
+
### **Cross-Chain Bridge Operations**
|
|
2436
|
+
|
|
2437
|
+
```typescript
|
|
2438
|
+
// Bridge Configuration (requires ethereumPrivateKey and/or solanaPrivateKey)
|
|
2439
|
+
|
|
2440
|
+
// Wallet Balance Queries - Single Token (Fast - 1 RPC call)
|
|
2441
|
+
fetchEthereumWalletTokenBalance(symbol, address?): Promise<ExternalChainBalance>
|
|
2442
|
+
// Fetch single ERC-20 balance (GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)
|
|
2443
|
+
|
|
2444
|
+
fetchEthereumWalletNativeBalance(address?): Promise<ExternalChainBalance>
|
|
2445
|
+
// Fetch native ETH balance only
|
|
2446
|
+
|
|
2447
|
+
fetchSolanaWalletTokenBalance(symbol, address?): Promise<ExternalChainBalance>
|
|
2448
|
+
// Fetch single SPL token balance (GALA, GSOL)
|
|
2449
|
+
|
|
2450
|
+
fetchSolanaWalletNativeBalance(address?): Promise<ExternalChainBalance>
|
|
2451
|
+
// Fetch native SOL balance only
|
|
2452
|
+
|
|
2453
|
+
// Wallet Balance Queries - All Tokens (Complete Portfolio)
|
|
2454
|
+
fetchEthereumWalletAllBalances(address?): Promise<EthereumWalletBalanceResult>
|
|
2455
|
+
// Returns: { address, native, tokens[], timestamp } - ETH + 6 ERC-20s
|
|
2456
|
+
|
|
2457
|
+
fetchSolanaWalletAllBalances(address?): Promise<SolanaWalletBalanceResult>
|
|
2458
|
+
// Returns: { address, native, tokens[], timestamp } - SOL + 2 SPL tokens
|
|
2459
|
+
|
|
2460
|
+
// Bridge Operations
|
|
2461
|
+
estimateBridgeFee(options): Promise<BridgeFeeEstimate>
|
|
2462
|
+
// Estimate fees for bridging tokens
|
|
2463
|
+
|
|
2464
|
+
bridgeOut(options): Promise<BridgeResult>
|
|
2465
|
+
// Bridge tokens FROM GalaChain TO Ethereum/Solana
|
|
2466
|
+
|
|
2467
|
+
bridgeIn(options): Promise<BridgeResult>
|
|
2468
|
+
// Bridge tokens FROM Ethereum/Solana TO GalaChain
|
|
2469
|
+
|
|
2470
|
+
getBridgeStatus(transactionHash, chainHint?): Promise<BridgeStatus>
|
|
2471
|
+
// Check status of bridge transaction
|
|
2472
|
+
|
|
2473
|
+
getSupportedBridgeTokens(chain?): BridgeTokenInfo[]
|
|
2474
|
+
// List supported bridge tokens
|
|
2475
|
+
```
|
|
2476
|
+
|
|
2333
2477
|
## Configuration
|
|
2334
2478
|
|
|
2335
2479
|
### Constants
|