@gala-chain/launchpad-sdk 4.0.3 → 4.0.4-beta.1
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/EXAMPLES.md +96 -35
- package/README.md +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +750 -72
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/constants/version.generated.d.ts.map +1 -1
- package/dist/src/services/DexBackendClient.d.ts +139 -10
- package/dist/src/services/DexBackendClient.d.ts.map +1 -1
- package/dist/src/services/DexQuoteService.d.ts +181 -22
- package/dist/src/services/DexQuoteService.d.ts.map +1 -1
- package/dist/src/services/DexService.d.ts +274 -38
- package/dist/src/services/DexService.d.ts.map +1 -1
- package/dist/src/services/GSwapService.d.ts +555 -246
- package/dist/src/services/GSwapService.d.ts.map +1 -1
- package/dist/src/services/GalaChainGatewayClient.d.ts +139 -41
- package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -1
- package/dist/src/services/ImageService.d.ts +101 -12
- package/dist/src/services/ImageService.d.ts.map +1 -1
- package/dist/src/services/PoolCacheManager.d.ts +125 -31
- package/dist/src/services/PoolCacheManager.d.ts.map +1 -1
- package/dist/src/services/SignatureService.d.ts +35 -5
- package/dist/src/services/SignatureService.d.ts.map +1 -1
- package/dist/src/services/SwapEventQueue.d.ts +79 -10
- package/dist/src/services/SwapEventQueue.d.ts.map +1 -1
- package/dist/src/services/TokenClassKeyService.d.ts +56 -10
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -1
- package/dist/src/services/TokenMetadataService.d.ts +407 -31
- package/dist/src/services/TokenMetadataService.d.ts.map +1 -1
- package/dist/src/services/TradeService.d.ts +168 -6
- package/dist/src/services/TradeService.d.ts.map +1 -1
- package/dist/src/services/UserService.d.ts +117 -15
- package/dist/src/services/UserService.d.ts.map +1 -1
- package/package.json +12 -2
- package/API.md +0 -1475
|
@@ -874,17 +874,60 @@ export declare class LaunchpadSDK {
|
|
|
874
874
|
*/
|
|
875
875
|
calculateDexPoolQuoteExactAmount(options: CalculateDexPoolQuoteOptions, mode?: 'local' | 'external'): Promise<DexPoolQuoteResult>;
|
|
876
876
|
/**
|
|
877
|
-
*
|
|
877
|
+
* Fetch token ownership distribution with holder percentages
|
|
878
878
|
*
|
|
879
|
-
*
|
|
880
|
-
*
|
|
879
|
+
* Retrieves complete token holder distribution data including all wallet addresses,
|
|
880
|
+
* their token balances, and ownership percentages. This endpoint returns ALL holders
|
|
881
|
+
* in a single non-paginated response, making it perfect for distribution analysis,
|
|
882
|
+
* whale tracking, and supply health metrics.
|
|
883
|
+
*
|
|
884
|
+
* @category Token Information
|
|
885
|
+
* @param tokenName - Token name to fetch distribution for (e.g., 'anime', 'mytoken')
|
|
886
|
+
* @returns Promise with distribution data including holders array, total supply, and total holder count
|
|
887
|
+
* @throws {ValidationError} If tokenName is invalid or empty
|
|
888
|
+
* @throws {NetworkError} If API request fails
|
|
889
|
+
* @since 4.0.4-beta.0
|
|
890
|
+
*
|
|
891
|
+
* @example Basic distribution query
|
|
892
|
+
* ```typescript
|
|
893
|
+
* const distribution = await sdk.fetchTokenDistribution('anime');
|
|
894
|
+
* console.log(`Total holders: ${distribution.totalHolders}`);
|
|
895
|
+
* console.log(`Total supply: ${distribution.totalSupply}`);
|
|
896
|
+
* distribution.holders.forEach(holder => {
|
|
897
|
+
* console.log(`${holder.address}: ${holder.percentage}%`);
|
|
898
|
+
* });
|
|
899
|
+
* ```
|
|
900
|
+
*
|
|
901
|
+
* @example Whale analysis
|
|
902
|
+
* ```typescript
|
|
903
|
+
* const dist = await sdk.fetchTokenDistribution('mytoken');
|
|
904
|
+
* const whales = dist.holders.filter(h => h.percentage > 5);
|
|
905
|
+
* console.log(`Found ${whales.length} whales with >5% ownership`);
|
|
906
|
+
* ```
|
|
881
907
|
*/
|
|
882
908
|
fetchTokenDistribution(tokenName: string): Promise<import("./types/launchpad.dto").TokenDistributionResult>;
|
|
883
909
|
/**
|
|
884
|
-
* Fetch token badges
|
|
910
|
+
* Fetch token achievement badges and metadata
|
|
885
911
|
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
912
|
+
* Retrieves badge data for a token including achievement milestones, special recognitions,
|
|
913
|
+
* and platform-assigned attributes. Badges provide additional context about token
|
|
914
|
+
* performance, community engagement, and platform status.
|
|
915
|
+
*
|
|
916
|
+
* @category Token Information
|
|
917
|
+
* @param tokenName - Token name to fetch badges for (e.g., 'anime', 'mytoken')
|
|
918
|
+
* @returns Promise with badge data including badge types, timestamps, and metadata
|
|
919
|
+
* @throws {ValidationError} If tokenName is invalid or empty
|
|
920
|
+
* @throws {NetworkError} If API request fails
|
|
921
|
+
* @since 4.0.4-beta.0
|
|
922
|
+
*
|
|
923
|
+
* @example Fetch token badges
|
|
924
|
+
* ```typescript
|
|
925
|
+
* const badges = await sdk.fetchTokenBadges('anime');
|
|
926
|
+
* console.log(`Token has ${badges.length} badges`);
|
|
927
|
+
* badges.forEach(badge => {
|
|
928
|
+
* console.log(`Badge: ${badge.name} - ${badge.description}`);
|
|
929
|
+
* });
|
|
930
|
+
* ```
|
|
888
931
|
*/
|
|
889
932
|
fetchTokenBadges(tokenName: string): Promise<import("./types/launchpad.dto").TokenBadgesResult>;
|
|
890
933
|
/**
|
|
@@ -1342,24 +1385,136 @@ export declare class LaunchpadSDK {
|
|
|
1342
1385
|
*/
|
|
1343
1386
|
isTokenGraduated(tokenName: string): Promise<boolean>;
|
|
1344
1387
|
/**
|
|
1345
|
-
* Fetch volume data for
|
|
1388
|
+
* Fetch historical trading volume data for charting
|
|
1389
|
+
*
|
|
1390
|
+
* Retrieves time-series trading volume data for a specific token, perfect for
|
|
1391
|
+
* building volume charts, analyzing trading activity patterns, and monitoring
|
|
1392
|
+
* market engagement. Data is aggregated by time period with buy/sell breakdowns.
|
|
1393
|
+
*
|
|
1394
|
+
* @category Trading Data
|
|
1395
|
+
* @param options - Volume data options with required tokenName and optional time range
|
|
1396
|
+
* @param options.tokenName - Token name to fetch volume data for (required)
|
|
1397
|
+
* @param options.startDate - Start date for volume data range (optional)
|
|
1398
|
+
* @param options.endDate - End date for volume data range (optional)
|
|
1399
|
+
* @param options.interval - Time interval for aggregation (e.g., '1h', '1d', '1w') (optional)
|
|
1400
|
+
* @returns Promise with graph data containing timestamps, volume amounts, and trade counts
|
|
1401
|
+
* @throws {ValidationError} If tokenName is missing or invalid
|
|
1402
|
+
* @throws {NetworkError} If API request fails
|
|
1403
|
+
* @since 4.0.4-beta.0
|
|
1404
|
+
*
|
|
1405
|
+
* @example Fetch all-time volume
|
|
1406
|
+
* ```typescript
|
|
1407
|
+
* const volumeData = await sdk.fetchVolumeData({ tokenName: 'anime' });
|
|
1408
|
+
* console.log(`Total data points: ${volumeData.length}`);
|
|
1409
|
+
* volumeData.forEach(point => {
|
|
1410
|
+
* console.log(`${point.timestamp}: $${point.volume} volume`);
|
|
1411
|
+
* });
|
|
1412
|
+
* ```
|
|
1346
1413
|
*
|
|
1347
|
-
* @
|
|
1348
|
-
*
|
|
1414
|
+
* @example Fetch volume for date range
|
|
1415
|
+
* ```typescript
|
|
1416
|
+
* const volumeData = await sdk.fetchVolumeData({
|
|
1417
|
+
* tokenName: 'mytoken',
|
|
1418
|
+
* startDate: new Date('2024-01-01'),
|
|
1419
|
+
* endDate: new Date('2024-01-31')
|
|
1420
|
+
* });
|
|
1421
|
+
* console.log(`January volume: ${volumeData.reduce((sum, p) => sum + p.volume, 0)}`);
|
|
1422
|
+
* ```
|
|
1349
1423
|
*/
|
|
1350
1424
|
fetchVolumeData(options: FetchVolumeDataOptions): Promise<import("./types/launchpad.dto").GraphDataResult>;
|
|
1351
1425
|
/**
|
|
1352
|
-
* Fetch trade history with filters
|
|
1426
|
+
* Fetch trade history with optional filters and pagination
|
|
1353
1427
|
*
|
|
1428
|
+
* Retrieves paginated historical trades for a specific token from the Launchpad backend.
|
|
1429
|
+
* Supports filtering by trade type (buy/sell), wallet address, and time range for detailed
|
|
1430
|
+
* trade analysis and portfolio tracking.
|
|
1431
|
+
*
|
|
1432
|
+
* @category Trading Data
|
|
1354
1433
|
* @param options Trade fetching options with required tokenName
|
|
1355
|
-
* @
|
|
1434
|
+
* @param options.tokenName - Token name to fetch trades for (required)
|
|
1435
|
+
* @param options.page - Page number (1-based), defaults to 1
|
|
1436
|
+
* @param options.limit - Items per page, defaults to 20
|
|
1437
|
+
* @param options.type - Filter by trade type: 'buy' or 'sell' (optional)
|
|
1438
|
+
* @param options.address - Filter by wallet address (optional)
|
|
1439
|
+
* @param options.startDate - Filter trades after this date (optional)
|
|
1440
|
+
* @param options.endDate - Filter trades before this date (optional)
|
|
1441
|
+
* @returns Promise<TradesResult> Paginated trade history with metadata
|
|
1442
|
+
* @throws {ValidationError} If tokenName is not provided
|
|
1443
|
+
* @throws {NetworkError} If API request fails
|
|
1444
|
+
* @since 1.0.0
|
|
1445
|
+
*
|
|
1446
|
+
* @example Basic trade history
|
|
1447
|
+
* ```typescript
|
|
1448
|
+
* const trades = await sdk.fetchTrades({
|
|
1449
|
+
* tokenName: 'anime',
|
|
1450
|
+
* page: 1,
|
|
1451
|
+
* limit: 50
|
|
1452
|
+
* });
|
|
1453
|
+
* console.log(`Found ${trades.total} trades`);
|
|
1454
|
+
* trades.trades.forEach(trade => {
|
|
1455
|
+
* console.log(`${trade.type}: ${trade.amount} @ ${trade.price}`);
|
|
1456
|
+
* });
|
|
1457
|
+
* ```
|
|
1458
|
+
*
|
|
1459
|
+
* @example Filter by trade type
|
|
1460
|
+
* ```typescript
|
|
1461
|
+
* const buys = await sdk.fetchTrades({
|
|
1462
|
+
* tokenName: 'anime',
|
|
1463
|
+
* type: 'buy',
|
|
1464
|
+
* limit: 20
|
|
1465
|
+
* });
|
|
1466
|
+
* console.log(`Recent buy trades: ${buys.trades.length}`);
|
|
1467
|
+
* ```
|
|
1468
|
+
*
|
|
1469
|
+
* @example Filter by wallet and date range
|
|
1470
|
+
* ```typescript
|
|
1471
|
+
* const myTrades = await sdk.fetchTrades({
|
|
1472
|
+
* tokenName: 'anime',
|
|
1473
|
+
* address: sdk.getAddress(),
|
|
1474
|
+
* startDate: new Date('2025-01-01'),
|
|
1475
|
+
* endDate: new Date('2025-01-31')
|
|
1476
|
+
* });
|
|
1477
|
+
* console.log(`My January trades: ${myTrades.total}`);
|
|
1478
|
+
* ```
|
|
1356
1479
|
*/
|
|
1357
1480
|
fetchTrades(options: FetchTradesOptions): Promise<import("./types/trade.dto").TradesResult>;
|
|
1358
1481
|
/**
|
|
1359
|
-
* Fetch GALA balance for a
|
|
1482
|
+
* Fetch GALA token balance for a wallet address
|
|
1360
1483
|
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1484
|
+
* Retrieves the current GALA token balance for a specified wallet address or the authenticated
|
|
1485
|
+
* user's wallet if no address is provided. Returns complete balance information including
|
|
1486
|
+
* token quantity, token metadata, and collection details from GalaChain.
|
|
1487
|
+
*
|
|
1488
|
+
* **Supports both address formats:**
|
|
1489
|
+
* - Standard Ethereum format: `0x...` (64 hex characters after 0x prefix)
|
|
1490
|
+
* - Backend format: `eth|...` (full GalaChain address format)
|
|
1491
|
+
*
|
|
1492
|
+
* @category Main SDK
|
|
1493
|
+
* @param address - Optional wallet address in 0x... or eth|... format. Defaults to current SDK wallet address.
|
|
1494
|
+
* @returns Promise<GalaBalanceResult> Complete balance details including quantity and token metadata
|
|
1495
|
+
* @throws {ValidationError} If wallet is not configured and no address is provided
|
|
1496
|
+
* @throws {NetworkError} If GalaChain query fails or network connection is unavailable
|
|
1497
|
+
* @since 4.0.4-beta.0
|
|
1498
|
+
*
|
|
1499
|
+
* @example Fetch balance for authenticated wallet
|
|
1500
|
+
* ```typescript
|
|
1501
|
+
* const balance = await sdk.fetchGalaBalance();
|
|
1502
|
+
* console.log(`Your GALA balance: ${balance.quantity}`);
|
|
1503
|
+
* ```
|
|
1504
|
+
*
|
|
1505
|
+
* @example Fetch balance for specific address
|
|
1506
|
+
* ```typescript
|
|
1507
|
+
* const address = 'eth|742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0';
|
|
1508
|
+
* const balance = await sdk.fetchGalaBalance(address);
|
|
1509
|
+
* console.log(`Balance: ${balance.quantity} GALA`);
|
|
1510
|
+
* ```
|
|
1511
|
+
*
|
|
1512
|
+
* @example Fetch and format balance
|
|
1513
|
+
* ```typescript
|
|
1514
|
+
* const balance = await sdk.fetchGalaBalance();
|
|
1515
|
+
* const formattedBalance = (BigInt(balance.quantity) / BigInt(10 ** 8)).toString();
|
|
1516
|
+
* console.log(`GALA: ${formattedBalance}`);
|
|
1517
|
+
* ```
|
|
1363
1518
|
*/
|
|
1364
1519
|
fetchGalaBalance(address?: string): Promise<import("./types/user.dto").TokenBalanceResult | null>;
|
|
1365
1520
|
/**
|
|
@@ -1463,17 +1618,134 @@ export declare class LaunchpadSDK {
|
|
|
1463
1618
|
*/
|
|
1464
1619
|
fetchAvailableBalance(options: FetchTokenBalanceOptions): Promise<AvailableBalanceResult | null>;
|
|
1465
1620
|
/**
|
|
1466
|
-
* Calculate buy amount for a token purchase
|
|
1621
|
+
* Calculate buy amount for a token purchase with automatic mode selection
|
|
1622
|
+
*
|
|
1623
|
+
* Flexible calculation method that automatically routes to either local (instant, client-side)
|
|
1624
|
+
* or external (real-time, GalaChain) calculation based on available parameters. Defaults to
|
|
1625
|
+
* external calculation for guaranteed accuracy unless currentSupply is provided.
|
|
1626
|
+
*
|
|
1627
|
+
* Supports two calculation types:
|
|
1628
|
+
* - **type: 'native'** - Calculate tokens received for a given GALA amount
|
|
1629
|
+
* - **type: 'exact'** - Calculate GALA needed to buy a specific token amount
|
|
1630
|
+
*
|
|
1631
|
+
* @category Calculations
|
|
1632
|
+
* @param options Calculation options with required tokenName and amount
|
|
1633
|
+
* @param options.tokenName - Token name to calculate for (required)
|
|
1634
|
+
* @param options.amount - Amount to calculate (GALA or tokens depending on type)
|
|
1635
|
+
* @param options.type - 'native' (spending GALA) or 'exact' (buying tokens)
|
|
1636
|
+
* @param options.currentSupply - Current token supply for local calculation (optional, enables instant calculation)
|
|
1637
|
+
* @returns Promise<AmountCalculationResult> Calculated amount with fees breakdown
|
|
1638
|
+
* @throws {ValidationError} If tokenName or amount is invalid
|
|
1639
|
+
* @throws {NetworkError} If external calculation fails
|
|
1640
|
+
* @since 1.0.0
|
|
1641
|
+
*
|
|
1642
|
+
* @example Calculate tokens from GALA (external mode)
|
|
1643
|
+
* ```typescript
|
|
1644
|
+
* const result = await sdk.calculateBuyAmount({
|
|
1645
|
+
* tokenName: 'anime',
|
|
1646
|
+
* amount: '100', // 100 GALA
|
|
1647
|
+
* type: 'native'
|
|
1648
|
+
* });
|
|
1649
|
+
* console.log('Tokens you will receive:', result.amount);
|
|
1650
|
+
* console.log('Transaction fee:', result.transactionFee);
|
|
1651
|
+
* ```
|
|
1467
1652
|
*
|
|
1468
|
-
* @
|
|
1469
|
-
*
|
|
1653
|
+
* @example Calculate GALA needed for tokens (external mode)
|
|
1654
|
+
* ```typescript
|
|
1655
|
+
* const result = await sdk.calculateBuyAmount({
|
|
1656
|
+
* tokenName: 'anime',
|
|
1657
|
+
* amount: '1000', // 1000 tokens
|
|
1658
|
+
* type: 'exact'
|
|
1659
|
+
* });
|
|
1660
|
+
* console.log('GALA needed:', result.amount);
|
|
1661
|
+
* console.log('Total cost with fees:', result.totalCost);
|
|
1662
|
+
* ```
|
|
1663
|
+
*
|
|
1664
|
+
* @example Performance-optimized with local calculation
|
|
1665
|
+
* ```typescript
|
|
1666
|
+
* // Fetch supply once, reuse for multiple calculations
|
|
1667
|
+
* const poolDetails = await sdk.fetchPoolDetailsForCalculation('anime');
|
|
1668
|
+
*
|
|
1669
|
+
* const calc1 = await sdk.calculateBuyAmount({
|
|
1670
|
+
* tokenName: 'anime',
|
|
1671
|
+
* amount: '100',
|
|
1672
|
+
* type: 'native',
|
|
1673
|
+
* currentSupply: poolDetails.currentSupply // Enables instant local calculation
|
|
1674
|
+
* });
|
|
1675
|
+
*
|
|
1676
|
+
* const calc2 = await sdk.calculateBuyAmount({
|
|
1677
|
+
* tokenName: 'anime',
|
|
1678
|
+
* amount: '500',
|
|
1679
|
+
* type: 'native',
|
|
1680
|
+
* currentSupply: poolDetails.currentSupply // Reuse same supply
|
|
1681
|
+
* });
|
|
1682
|
+
* ```
|
|
1470
1683
|
*/
|
|
1471
1684
|
calculateBuyAmount(options: CalculateBuyAmountOptions): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
1472
1685
|
/**
|
|
1473
|
-
* Calculate sell amount for a token sale
|
|
1686
|
+
* Calculate sell amount for a token sale with automatic mode selection
|
|
1687
|
+
*
|
|
1688
|
+
* Flexible calculation method that automatically routes to either local (instant, client-side)
|
|
1689
|
+
* or external (real-time, GalaChain) calculation based on available parameters. Defaults to
|
|
1690
|
+
* external calculation for guaranteed accuracy unless currentSupply and RBC fees are provided.
|
|
1691
|
+
*
|
|
1692
|
+
* Supports two calculation types:
|
|
1693
|
+
* - **type: 'exact'** - Calculate GALA received for selling a specific token amount
|
|
1694
|
+
* - **type: 'native'** - Calculate tokens needed to receive a specific GALA amount
|
|
1695
|
+
*
|
|
1696
|
+
* Includes reverse bonding curve (RBC) fee calculation that scales with token supply.
|
|
1697
|
+
*
|
|
1698
|
+
* @category Calculations
|
|
1699
|
+
* @param options Calculation options with required tokenName and amount
|
|
1700
|
+
* @param options.tokenName - Token name to calculate for (required)
|
|
1701
|
+
* @param options.amount - Amount to calculate (tokens or GALA depending on type)
|
|
1702
|
+
* @param options.type - 'exact' (selling tokens) or 'native' (receiving GALA)
|
|
1703
|
+
* @param options.currentSupply - Current token supply for local calculation (optional)
|
|
1704
|
+
* @param options.reverseBondingCurveMaxFeeFactor - RBC max fee for local calculation (optional)
|
|
1705
|
+
* @param options.reverseBondingCurveMinFeeFactor - RBC min fee for local calculation (optional)
|
|
1706
|
+
* @returns Promise<AmountCalculationResult> Calculated amount with fees breakdown including RBC fee
|
|
1707
|
+
* @throws {ValidationError} If tokenName or amount is invalid
|
|
1708
|
+
* @throws {NetworkError} If external calculation fails
|
|
1709
|
+
* @since 1.0.0
|
|
1474
1710
|
*
|
|
1475
|
-
* @
|
|
1476
|
-
*
|
|
1711
|
+
* @example Calculate GALA from selling tokens (external mode)
|
|
1712
|
+
* ```typescript
|
|
1713
|
+
* const result = await sdk.calculateSellAmount({
|
|
1714
|
+
* tokenName: 'anime',
|
|
1715
|
+
* amount: '500', // 500 tokens
|
|
1716
|
+
* type: 'exact'
|
|
1717
|
+
* });
|
|
1718
|
+
* console.log('GALA you will receive:', result.amount);
|
|
1719
|
+
* console.log('Reverse bonding fee:', result.reverseBondingCurveFee);
|
|
1720
|
+
* console.log('Transaction fee:', result.transactionFee);
|
|
1721
|
+
* ```
|
|
1722
|
+
*
|
|
1723
|
+
* @example Calculate tokens needed for GALA (external mode)
|
|
1724
|
+
* ```typescript
|
|
1725
|
+
* const result = await sdk.calculateSellAmount({
|
|
1726
|
+
* tokenName: 'anime',
|
|
1727
|
+
* amount: '50', // 50 GALA desired
|
|
1728
|
+
* type: 'native'
|
|
1729
|
+
* });
|
|
1730
|
+
* console.log('Tokens to sell:', result.amount);
|
|
1731
|
+
* console.log('Total fees deducted:', result.totalFees);
|
|
1732
|
+
* ```
|
|
1733
|
+
*
|
|
1734
|
+
* @example Performance-optimized with local calculation
|
|
1735
|
+
* ```typescript
|
|
1736
|
+
* // Fetch pool details once, reuse for multiple calculations
|
|
1737
|
+
* const poolDetails = await sdk.fetchPoolDetailsForCalculation('anime');
|
|
1738
|
+
*
|
|
1739
|
+
* const calc1 = await sdk.calculateSellAmount({
|
|
1740
|
+
* tokenName: 'anime',
|
|
1741
|
+
* amount: '500',
|
|
1742
|
+
* type: 'exact',
|
|
1743
|
+
* currentSupply: poolDetails.currentSupply,
|
|
1744
|
+
* reverseBondingCurveMaxFeeFactor: poolDetails.reverseBondingCurveMaxFeeFactor,
|
|
1745
|
+
* reverseBondingCurveMinFeeFactor: poolDetails.reverseBondingCurveMinFeeFactor
|
|
1746
|
+
* });
|
|
1747
|
+
* // Instant local calculation - no network calls
|
|
1748
|
+
* ```
|
|
1477
1749
|
*/
|
|
1478
1750
|
calculateSellAmount(options: CalculateSellAmountOptions): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
1479
1751
|
/**
|
|
@@ -1665,35 +1937,151 @@ export declare class LaunchpadSDK {
|
|
|
1665
1937
|
*/
|
|
1666
1938
|
graduateToken(options: GraduateTokenOptions): Promise<TradeResult>;
|
|
1667
1939
|
/**
|
|
1668
|
-
* Calculate initial buy amount
|
|
1940
|
+
* Calculate initial buy amount for pre-mint token launches
|
|
1941
|
+
*
|
|
1942
|
+
* Calculates the number of tokens that will be received when purchasing during
|
|
1943
|
+
* the token launch pre-buy phase. This is used internally during token creation
|
|
1944
|
+
* with the preBuyQuantity parameter.
|
|
1945
|
+
*
|
|
1946
|
+
* The pre-mint phase uses the same exponential bonding curve formula but starts
|
|
1947
|
+
* from zero supply, providing the best possible price for early supporters.
|
|
1948
|
+
*
|
|
1949
|
+
* @category Calculations
|
|
1950
|
+
* @param nativeTokenQuantity Amount of GALA to spend during pre-buy (decimal string)
|
|
1951
|
+
* @returns Promise<PreMintCalculationResult> Calculated tokens with fee breakdown
|
|
1952
|
+
* @throws {ValidationError} If nativeTokenQuantity is invalid or negative
|
|
1953
|
+
* @throws {NetworkError} If API request fails
|
|
1954
|
+
* @since 1.0.0
|
|
1955
|
+
*
|
|
1956
|
+
* @example Calculate pre-buy tokens
|
|
1957
|
+
* ```typescript
|
|
1958
|
+
* const result = await sdk.calculateInitialBuyAmount('100');
|
|
1959
|
+
* console.log('Tokens from 100 GALA pre-buy:', result.amount);
|
|
1960
|
+
* console.log('Transaction fee:', result.transactionFee);
|
|
1961
|
+
* console.log('Starting supply:', result.currentSupply); // Should be "0"
|
|
1962
|
+
* ```
|
|
1669
1963
|
*
|
|
1670
|
-
* @
|
|
1671
|
-
*
|
|
1964
|
+
* @example Validate pre-buy before launch
|
|
1965
|
+
* ```typescript
|
|
1966
|
+
* // Check what you'll receive before launching token
|
|
1967
|
+
* const preBuyAmount = '50'; // 50 GALA
|
|
1968
|
+
* const calc = await sdk.calculateInitialBuyAmount(preBuyAmount);
|
|
1969
|
+
*
|
|
1970
|
+
* console.log(`Pre-buying with ${preBuyAmount} GALA will give you ${calc.amount} tokens`);
|
|
1971
|
+
*
|
|
1972
|
+
* // Now launch with this pre-buy amount
|
|
1973
|
+
* const launch = await sdk.launchToken({
|
|
1974
|
+
* tokenName: 'mytoken',
|
|
1975
|
+
* tokenSymbol: 'MTK',
|
|
1976
|
+
* tokenDescription: 'My token',
|
|
1977
|
+
* preBuyQuantity: preBuyAmount
|
|
1978
|
+
* });
|
|
1979
|
+
* ```
|
|
1672
1980
|
*/
|
|
1673
1981
|
calculateInitialBuyAmount(nativeTokenQuantity: string): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
1674
1982
|
/**
|
|
1675
|
-
* Buy tokens with confirmation
|
|
1983
|
+
* Buy tokens with blockchain confirmation and WebSocket monitoring
|
|
1984
|
+
*
|
|
1985
|
+
* Executes a buy order on the bonding curve and waits for GalaChain confirmation via WebSocket,
|
|
1986
|
+
* returning complete trade details including actual amounts traded, fees paid, and transaction metadata.
|
|
1987
|
+
*
|
|
1988
|
+
* **Slippage Protection:**
|
|
1989
|
+
* - Uses `expectedAmount` to protect against price changes during execution
|
|
1990
|
+
* - `slippageToleranceFactor` allows variance (e.g., 0.01 = 1% tolerance)
|
|
1991
|
+
* - Transaction fails if actual amount deviates beyond tolerance
|
|
1992
|
+
*
|
|
1993
|
+
* **Transaction Types:**
|
|
1994
|
+
* - **type: 'native'** - Spend exact GALA amount, receive variable tokens
|
|
1995
|
+
* - **type: 'exact'** - Buy exact token amount, spend variable GALA
|
|
1996
|
+
*
|
|
1997
|
+
* **WebSocket Confirmation:**
|
|
1998
|
+
* - Pre-connects WebSocket before submission to avoid race conditions
|
|
1999
|
+
* - Blocks until transaction confirmed on GalaChain
|
|
2000
|
+
* - Returns rich trade result with all transaction details
|
|
2001
|
+
*
|
|
2002
|
+
* @category Trading Actions
|
|
2003
|
+
* @param options Buy options with required tokenName, amount, and slippage protection
|
|
2004
|
+
* @param options.tokenName - Token name to buy (required)
|
|
2005
|
+
* @param options.amount - Amount to buy (GALA or tokens depending on type)
|
|
2006
|
+
* @param options.type - 'native' (spending GALA) or 'exact' (buying tokens)
|
|
2007
|
+
* @param options.expectedAmount - Expected output amount for slippage check (required)
|
|
2008
|
+
* @param options.slippageToleranceFactor - Slippage tolerance (0.01 = 1%), defaults to SDK config
|
|
2009
|
+
* @param options.maxAcceptableReverseBondingCurveFeeSlippageFactor - RBC fee slippage tolerance (optional)
|
|
2010
|
+
* @param options.privateKey - Override wallet private key for this transaction (optional)
|
|
2011
|
+
* @returns Promise<TradeResult> Complete trade result with amounts, fees, and blockchain metadata
|
|
2012
|
+
* @throws {ValidationError} If wallet not configured or parameters invalid
|
|
2013
|
+
* @throws {TransactionError} If transaction fails or no transaction ID returned
|
|
2014
|
+
* @throws {WebSocketError} If confirmation fails or times out
|
|
2015
|
+
* @throws {SlippageError} If price moves beyond tolerance
|
|
2016
|
+
* @since 1.0.0
|
|
1676
2017
|
*
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
2018
|
+
* @example Buy tokens with GALA (type: 'native')
|
|
2019
|
+
* ```typescript
|
|
2020
|
+
* // Step 1: Calculate expected output
|
|
2021
|
+
* const quote = await sdk.calculateBuyAmount({
|
|
2022
|
+
* tokenName: 'anime',
|
|
2023
|
+
* amount: '100', // 100 GALA
|
|
2024
|
+
* type: 'native'
|
|
2025
|
+
* });
|
|
1679
2026
|
*
|
|
1680
|
-
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
2027
|
+
* // Step 2: Execute buy with slippage protection
|
|
2028
|
+
* const result = await sdk.buy({
|
|
2029
|
+
* tokenName: 'anime',
|
|
2030
|
+
* amount: '100', // Spend 100 GALA
|
|
2031
|
+
* type: 'native',
|
|
2032
|
+
* expectedAmount: quote.amount, // Expected tokens from quote
|
|
2033
|
+
* slippageToleranceFactor: 0.01 // 1% slippage tolerance
|
|
2034
|
+
* });
|
|
1683
2035
|
*
|
|
1684
|
-
*
|
|
2036
|
+
* console.log('Spent GALA:', result.inputAmount);
|
|
2037
|
+
* console.log('Received tokens:', result.outputAmount);
|
|
2038
|
+
* console.log('Transaction fee:', result.transactionFee);
|
|
2039
|
+
* console.log('Total fees:', result.totalFees);
|
|
2040
|
+
* console.log('Block hash:', result.blockHash);
|
|
2041
|
+
* console.log('Transaction ID:', result.transactionId);
|
|
2042
|
+
* ```
|
|
2043
|
+
*
|
|
2044
|
+
* @example Buy exact token amount (type: 'exact')
|
|
1685
2045
|
* ```typescript
|
|
2046
|
+
* // Step 1: Calculate GALA cost
|
|
2047
|
+
* const quote = await sdk.calculateBuyAmount({
|
|
2048
|
+
* tokenName: 'anime',
|
|
2049
|
+
* amount: '1000', // 1000 tokens desired
|
|
2050
|
+
* type: 'exact'
|
|
2051
|
+
* });
|
|
2052
|
+
*
|
|
2053
|
+
* // Step 2: Execute buy
|
|
1686
2054
|
* const result = await sdk.buy({
|
|
1687
|
-
* tokenName: '
|
|
1688
|
-
* amount: '
|
|
1689
|
-
* type: '
|
|
1690
|
-
* expectedAmount:
|
|
1691
|
-
* slippageToleranceFactor: 0.
|
|
2055
|
+
* tokenName: 'anime',
|
|
2056
|
+
* amount: '1000', // Buy exactly 1000 tokens
|
|
2057
|
+
* type: 'exact',
|
|
2058
|
+
* expectedAmount: quote.amount, // Expected GALA cost from quote
|
|
2059
|
+
* slippageToleranceFactor: 0.02 // 2% slippage tolerance
|
|
1692
2060
|
* });
|
|
1693
2061
|
*
|
|
1694
|
-
* console.log('Bought tokens:', result.outputAmount);
|
|
2062
|
+
* console.log('Bought tokens:', result.outputAmount); // Should be ~1000
|
|
1695
2063
|
* console.log('Spent GALA:', result.inputAmount);
|
|
1696
|
-
*
|
|
2064
|
+
* ```
|
|
2065
|
+
*
|
|
2066
|
+
* @example Error handling with slippage
|
|
2067
|
+
* ```typescript
|
|
2068
|
+
* try {
|
|
2069
|
+
* const result = await sdk.buy({
|
|
2070
|
+
* tokenName: 'anime',
|
|
2071
|
+
* amount: '100',
|
|
2072
|
+
* type: 'native',
|
|
2073
|
+
* expectedAmount: '950',
|
|
2074
|
+
* slippageToleranceFactor: 0.01
|
|
2075
|
+
* });
|
|
2076
|
+
* console.log('Trade successful:', result.transactionId);
|
|
2077
|
+
* } catch (error) {
|
|
2078
|
+
* if (error instanceof SlippageError) {
|
|
2079
|
+
* console.error('Price moved too much:', error.message);
|
|
2080
|
+
* // Retry with fresh quote
|
|
2081
|
+
* } else {
|
|
2082
|
+
* console.error('Trade failed:', error);
|
|
2083
|
+
* }
|
|
2084
|
+
* }
|
|
1697
2085
|
* ```
|
|
1698
2086
|
*/
|
|
1699
2087
|
buy(options: BuyTokenOptions): Promise<TradeResult>;
|
|
@@ -1746,73 +2134,345 @@ export declare class LaunchpadSDK {
|
|
|
1746
2134
|
*/
|
|
1747
2135
|
getBundlerTransactionResult(transactionId: string): Promise<import("./types/common").ApiResponse<unknown>>;
|
|
1748
2136
|
/**
|
|
1749
|
-
* Launch a new token
|
|
2137
|
+
* Launch a new token with bonding curve trading
|
|
2138
|
+
*
|
|
2139
|
+
* Creates a new launchpad token with an automated bonding curve for initial price discovery
|
|
2140
|
+
* and liquidity. This method handles the complete token creation workflow including blockchain
|
|
2141
|
+
* submission, WebSocket monitoring, and confirmation waiting. Returns comprehensive launch
|
|
2142
|
+
* details after on-chain confirmation.
|
|
2143
|
+
*
|
|
2144
|
+
* **Process Flow:**
|
|
2145
|
+
* 1. Validates token data (name uniqueness, symbol format, etc.)
|
|
2146
|
+
* 2. Submits launch transaction to GalaChain
|
|
2147
|
+
* 3. Monitors transaction via WebSocket for real-time updates
|
|
2148
|
+
* 4. Waits for blockchain confirmation
|
|
2149
|
+
* 5. Returns complete token metadata including vault address
|
|
2150
|
+
*
|
|
2151
|
+
* **Important:** This is a write operation requiring wallet configuration.
|
|
2152
|
+
*
|
|
2153
|
+
* @category Token Creation
|
|
2154
|
+
* @param data - Token launch configuration
|
|
2155
|
+
* @param data.tokenName - Unique token name (3-20 lowercase alphanumeric, required)
|
|
2156
|
+
* @param data.tokenSymbol - Token symbol (3-6 characters, required)
|
|
2157
|
+
* @param data.tokenDescription - Token description (optional)
|
|
2158
|
+
* @param data.tokenImage - Image URL or path (optional)
|
|
2159
|
+
* @param data.preBuyQuantity - Initial token amount to purchase (optional, decimal format)
|
|
2160
|
+
* @param data.maxSupply - Maximum token supply (optional, defaults to 10,000,000)
|
|
2161
|
+
* @param data.bondingCurveFees - Bonding curve fee configuration (optional)
|
|
2162
|
+
* @param data.privateKey - Private key override for this operation (optional)
|
|
2163
|
+
* @returns Promise with complete token launch result including vault address, transaction ID, and metadata
|
|
2164
|
+
* @throws {ValidationError} If wallet not configured or token data invalid
|
|
2165
|
+
* @throws {WebSocketError} If transaction monitoring fails
|
|
2166
|
+
* @throws {TransactionFailedError} If blockchain transaction fails
|
|
2167
|
+
* @throws {NetworkError} If API request fails
|
|
2168
|
+
* @since 4.0.4-beta.0
|
|
1750
2169
|
*
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
2170
|
+
* @example Basic token launch
|
|
2171
|
+
* ```typescript
|
|
2172
|
+
* import { Wallet } from 'ethers';
|
|
2173
|
+
* import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
1754
2174
|
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1757
|
-
* @since 3.0.0 - Now returns TokenLaunchResult instead of transaction ID
|
|
2175
|
+
* const wallet = new Wallet(process.env.PRIVATE_KEY);
|
|
2176
|
+
* const sdk = new LaunchpadSDK({ wallet });
|
|
1758
2177
|
*
|
|
1759
|
-
* @example
|
|
1760
|
-
* ```typescript
|
|
1761
2178
|
* const result = await sdk.launchToken({
|
|
1762
2179
|
* tokenName: 'mytoken',
|
|
1763
2180
|
* tokenSymbol: 'MTK',
|
|
1764
|
-
* tokenDescription: 'My amazing token',
|
|
1765
|
-
* tokenImage: 'https://example.com/
|
|
1766
|
-
* preBuyQuantity: '100'
|
|
2181
|
+
* tokenDescription: 'My amazing token for the community',
|
|
2182
|
+
* tokenImage: 'https://example.com/token.png'
|
|
1767
2183
|
* });
|
|
1768
2184
|
*
|
|
1769
|
-
* console.log('Token
|
|
1770
|
-
* console.log('
|
|
1771
|
-
* console.log('
|
|
2185
|
+
* console.log('Token launched successfully!');
|
|
2186
|
+
* console.log('Token:', result.tokenName);
|
|
2187
|
+
* console.log('Symbol:', result.tokenSymbol);
|
|
2188
|
+
* console.log('Vault:', result.vaultAddress);
|
|
1772
2189
|
* console.log('Transaction:', result.transactionId);
|
|
2190
|
+
* console.log('Creator:', result.creatorAddress);
|
|
2191
|
+
* ```
|
|
2192
|
+
*
|
|
2193
|
+
* @example Launch with pre-buy and custom supply
|
|
2194
|
+
* ```typescript
|
|
2195
|
+
* const result = await sdk.launchToken({
|
|
2196
|
+
* tokenName: 'premium',
|
|
2197
|
+
* tokenSymbol: 'PREM',
|
|
2198
|
+
* tokenDescription: 'Premium features token',
|
|
2199
|
+
* tokenImage: 'https://example.com/premium.png',
|
|
2200
|
+
* preBuyQuantity: '1000', // Buy 1000 tokens immediately
|
|
2201
|
+
* maxSupply: '5000000' // Custom max supply of 5 million
|
|
2202
|
+
* });
|
|
2203
|
+
*
|
|
2204
|
+
* console.log(`Pre-bought ${result.preBuyQuantity} tokens`);
|
|
2205
|
+
* ```
|
|
2206
|
+
*
|
|
2207
|
+
* @example Launch with custom bonding curve fees
|
|
2208
|
+
* ```typescript
|
|
2209
|
+
* const result = await sdk.launchToken({
|
|
2210
|
+
* tokenName: 'custom',
|
|
2211
|
+
* tokenSymbol: 'CSTM',
|
|
2212
|
+
* tokenDescription: 'Custom fee structure',
|
|
2213
|
+
* bondingCurveFees: {
|
|
2214
|
+
* minFeePortion: '0.15', // 15% minimum fee
|
|
2215
|
+
* maxFeePortion: '0.45' // 45% maximum fee
|
|
2216
|
+
* }
|
|
2217
|
+
* });
|
|
2218
|
+
* ```
|
|
2219
|
+
*
|
|
2220
|
+
* @example Error handling
|
|
2221
|
+
* ```typescript
|
|
2222
|
+
* try {
|
|
2223
|
+
* const result = await sdk.launchToken({
|
|
2224
|
+
* tokenName: 'newtoken',
|
|
2225
|
+
* tokenSymbol: 'NEW',
|
|
2226
|
+
* tokenDescription: 'New project token'
|
|
2227
|
+
* });
|
|
2228
|
+
* console.log('Success!', result.transactionId);
|
|
2229
|
+
* } catch (error) {
|
|
2230
|
+
* if (error.code === 'WALLET_REQUIRED') {
|
|
2231
|
+
* console.error('Please configure wallet before launching token');
|
|
2232
|
+
* } else if (error.code === 'TOKEN_NAME_TAKEN') {
|
|
2233
|
+
* console.error('Token name already exists, choose another');
|
|
2234
|
+
* } else if (error.code === 'TRANSACTION_FAILED') {
|
|
2235
|
+
* console.error('Blockchain transaction failed:', error.message);
|
|
2236
|
+
* } else {
|
|
2237
|
+
* console.error('Launch failed:', error);
|
|
2238
|
+
* }
|
|
2239
|
+
* }
|
|
1773
2240
|
* ```
|
|
1774
2241
|
*/
|
|
1775
2242
|
launchToken(data: LaunchTokenData): Promise<TokenLaunchResult>;
|
|
1776
2243
|
/**
|
|
1777
|
-
* Upload
|
|
2244
|
+
* Upload a token image to the launchpad server
|
|
2245
|
+
*
|
|
2246
|
+
* Uploads an image file from the local filesystem for a specific token. The image is stored on the
|
|
2247
|
+
* launchpad server and can be displayed in the UI and API responses. Supports common image formats
|
|
2248
|
+
* (PNG, JPG, GIF) and automatically handles image validation and optimization.
|
|
2249
|
+
*
|
|
2250
|
+
* **Important:** This method is only available in Node.js environments (not in browsers).
|
|
2251
|
+
* Use for backend applications, build scripts, or CLI tools that manage token metadata.
|
|
2252
|
+
*
|
|
2253
|
+
* **Requires wallet configuration** for authentication. Use optional `privateKey` parameter
|
|
2254
|
+
* to override the default wallet for this operation.
|
|
2255
|
+
*
|
|
2256
|
+
* @category Main SDK
|
|
2257
|
+
* @param options - Image upload options with required tokenName and imagePath
|
|
2258
|
+
* @param options.tokenName - Token name to upload image for (3-20 lowercase alphanumeric)
|
|
2259
|
+
* @param options.imagePath - Absolute filesystem path to the image file (e.g., '/path/to/image.png')
|
|
2260
|
+
* @param options.privateKey - Optional private key override for this operation (format: 0x + 64 hex characters)
|
|
2261
|
+
* @returns Promise<string> URL where the image is hosted and can be accessed
|
|
2262
|
+
* @throws {ValidationError} If tokenName is invalid, imagePath doesn't exist, or wallet not configured
|
|
2263
|
+
* @throws {FileError} If image file cannot be read or is too large
|
|
2264
|
+
* @throws {NetworkError} If upload request fails
|
|
2265
|
+
* @since 4.0.4-beta.0
|
|
2266
|
+
*
|
|
2267
|
+
* @example Upload image from file
|
|
2268
|
+
* ```typescript
|
|
2269
|
+
* import path from 'path';
|
|
2270
|
+
*
|
|
2271
|
+
* const imageUrl = await sdk.uploadTokenImage({
|
|
2272
|
+
* tokenName: 'mytoken',
|
|
2273
|
+
* imagePath: path.join(process.cwd(), 'token-image.png')
|
|
2274
|
+
* });
|
|
2275
|
+
*
|
|
2276
|
+
* console.log(`Image uploaded: ${imageUrl}`);
|
|
2277
|
+
* ```
|
|
1778
2278
|
*
|
|
1779
|
-
* @
|
|
1780
|
-
*
|
|
2279
|
+
* @example Upload with private key override
|
|
2280
|
+
* ```typescript
|
|
2281
|
+
* const imageUrl = await sdk.uploadTokenImage({
|
|
2282
|
+
* tokenName: 'mytoken',
|
|
2283
|
+
* imagePath: '/absolute/path/to/image.png',
|
|
2284
|
+
* privateKey: process.env.ALTERNATIVE_PRIVATE_KEY
|
|
2285
|
+
* });
|
|
2286
|
+
* ```
|
|
1781
2287
|
*/
|
|
1782
2288
|
uploadTokenImage(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
1783
2289
|
/**
|
|
1784
|
-
* Check if token name is available
|
|
2290
|
+
* Check if a token name is available for use
|
|
1785
2291
|
*
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
2292
|
+
* Validates whether a token name is available to be registered on the platform.
|
|
2293
|
+
* Token names must be unique across the entire launchpad. Use this before
|
|
2294
|
+
* attempting to launch a token to prevent registration failures.
|
|
2295
|
+
*
|
|
2296
|
+
* @category Token Validation
|
|
2297
|
+
* @param tokenName - Token name to check availability for (3-20 lowercase alphanumeric characters)
|
|
2298
|
+
* @returns Promise resolving to true if name is available, false if already taken
|
|
2299
|
+
* @throws {ValidationError} If tokenName format is invalid
|
|
2300
|
+
* @throws {NetworkError} If API request fails
|
|
2301
|
+
* @since 4.0.4-beta.0
|
|
2302
|
+
*
|
|
2303
|
+
* @example Check name availability before launch
|
|
2304
|
+
* ```typescript
|
|
2305
|
+
* const isAvailable = await sdk.isTokenNameAvailable('mytoken');
|
|
2306
|
+
* if (isAvailable) {
|
|
2307
|
+
* console.log('Name is available!');
|
|
2308
|
+
* await sdk.launchToken({ tokenName: 'mytoken', ... });
|
|
2309
|
+
* } else {
|
|
2310
|
+
* console.log('Name already taken, choose another');
|
|
2311
|
+
* }
|
|
2312
|
+
* ```
|
|
1788
2313
|
*/
|
|
1789
2314
|
isTokenNameAvailable(tokenName: string): Promise<boolean>;
|
|
1790
2315
|
/**
|
|
1791
|
-
* Check if token symbol is available
|
|
2316
|
+
* Check if a token symbol is available for use
|
|
1792
2317
|
*
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
2318
|
+
* Validates whether a token symbol is available to be registered on the platform.
|
|
2319
|
+
* Token symbols must be unique across the entire launchpad. Use this before
|
|
2320
|
+
* attempting to launch a token to prevent registration failures.
|
|
2321
|
+
*
|
|
2322
|
+
* @category Token Validation
|
|
2323
|
+
* @param symbol - Token symbol to check availability for (typically 3-6 uppercase characters)
|
|
2324
|
+
* @returns Promise resolving to true if symbol is available, false if already taken
|
|
2325
|
+
* @throws {ValidationError} If symbol format is invalid
|
|
2326
|
+
* @throws {NetworkError} If API request fails
|
|
2327
|
+
* @since 4.0.4-beta.0
|
|
2328
|
+
*
|
|
2329
|
+
* @example Check symbol availability before launch
|
|
2330
|
+
* ```typescript
|
|
2331
|
+
* const isAvailable = await sdk.isTokenSymbolAvailable('MTK');
|
|
2332
|
+
* if (isAvailable) {
|
|
2333
|
+
* console.log('Symbol is available!');
|
|
2334
|
+
* await sdk.launchToken({ tokenSymbol: 'MTK', ... });
|
|
2335
|
+
* } else {
|
|
2336
|
+
* console.log('Symbol already taken, choose another');
|
|
2337
|
+
* }
|
|
2338
|
+
* ```
|
|
1795
2339
|
*/
|
|
1796
2340
|
isTokenSymbolAvailable(symbol: string): Promise<boolean>;
|
|
1797
2341
|
/**
|
|
1798
|
-
*
|
|
2342
|
+
* Fetch user profile information by wallet address
|
|
2343
|
+
*
|
|
2344
|
+
* Retrieves public profile metadata for a specific wallet address, including name,
|
|
2345
|
+
* profile image URL, and other user-provided information. Returns null if no profile
|
|
2346
|
+
* has been created for the address.
|
|
2347
|
+
*
|
|
2348
|
+
* **Supports both address formats:**
|
|
2349
|
+
* - Standard Ethereum format: `0x...` (64 hex characters after 0x prefix)
|
|
2350
|
+
* - Backend format: `eth|...` (full GalaChain address format)
|
|
2351
|
+
*
|
|
2352
|
+
* @category Main SDK
|
|
2353
|
+
* @param address - Optional wallet address in 0x... or eth|... format. Defaults to current SDK wallet address.
|
|
2354
|
+
* @returns Promise<UserProfile | null> User profile data with name, image, and metadata, or null if no profile exists
|
|
2355
|
+
* @throws {ValidationError} If wallet is not configured and no address is provided
|
|
2356
|
+
* @throws {NetworkError} If launchpad API request fails
|
|
2357
|
+
* @since 4.0.4-beta.0
|
|
1799
2358
|
*
|
|
1800
|
-
* @
|
|
1801
|
-
*
|
|
2359
|
+
* @example Fetch current user's profile
|
|
2360
|
+
* ```typescript
|
|
2361
|
+
* const profile = await sdk.fetchProfile();
|
|
2362
|
+
* if (profile) {
|
|
2363
|
+
* console.log(`User: ${profile.fullName}`);
|
|
2364
|
+
* console.log(`Image: ${profile.profileImage}`);
|
|
2365
|
+
* } else {
|
|
2366
|
+
* console.log('No profile created yet');
|
|
2367
|
+
* }
|
|
2368
|
+
* ```
|
|
2369
|
+
*
|
|
2370
|
+
* @example Fetch profile for specific address
|
|
2371
|
+
* ```typescript
|
|
2372
|
+
* const profile = await sdk.fetchProfile('eth|742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0');
|
|
2373
|
+
* console.log(`Profile owner: ${profile?.fullName}`);
|
|
2374
|
+
* ```
|
|
1802
2375
|
*/
|
|
1803
2376
|
fetchProfile(address?: string): Promise<any>;
|
|
1804
2377
|
/**
|
|
1805
|
-
* Update user profile information
|
|
2378
|
+
* Update user profile information for a wallet address
|
|
2379
|
+
*
|
|
2380
|
+
* Updates public profile metadata for a wallet, including display name and profile image.
|
|
2381
|
+
* Only the wallet owner can update their own profile. Changes take effect immediately after
|
|
2382
|
+
* successful submission to the launchpad server.
|
|
1806
2383
|
*
|
|
1807
|
-
*
|
|
2384
|
+
* **Requires wallet configuration** for authentication. Use optional `privateKey` parameter
|
|
2385
|
+
* to override the default wallet for this operation.
|
|
2386
|
+
*
|
|
2387
|
+
* @category Main SDK
|
|
2388
|
+
* @param data - Profile update data with wallet address and fields to update
|
|
2389
|
+
* @param data.address - Wallet address to update profile for (required, 0x... or eth|... format)
|
|
2390
|
+
* @param data.fullName - User's full name (optional, max 100 characters)
|
|
2391
|
+
* @param data.profileImage - Profile image URL (optional, can be empty string to clear)
|
|
2392
|
+
* @param data.privateKey - Optional private key override for this operation (format: 0x + 64 hex characters)
|
|
1808
2393
|
* @returns Promise<void> No return data - throws on failure
|
|
2394
|
+
* @throws {ValidationError} If address format is invalid, wallet not configured, or user is not authorized
|
|
2395
|
+
* @throws {NetworkError} If launchpad API request fails
|
|
2396
|
+
* @since 4.0.4-beta.0
|
|
2397
|
+
*
|
|
2398
|
+
* @example Update profile name and image
|
|
2399
|
+
* ```typescript
|
|
2400
|
+
* await sdk.updateProfile({
|
|
2401
|
+
* address: sdk.getAddress(),
|
|
2402
|
+
* fullName: 'John Crypto',
|
|
2403
|
+
* profileImage: 'https://example.com/profile-pic.png'
|
|
2404
|
+
* });
|
|
2405
|
+
*
|
|
2406
|
+
* console.log('Profile updated successfully!');
|
|
2407
|
+
* ```
|
|
2408
|
+
*
|
|
2409
|
+
* @example Update only name
|
|
2410
|
+
* ```typescript
|
|
2411
|
+
* await sdk.updateProfile({
|
|
2412
|
+
* address: sdk.getAddress(),
|
|
2413
|
+
* fullName: 'Jane Blockchain'
|
|
2414
|
+
* });
|
|
2415
|
+
* ```
|
|
2416
|
+
*
|
|
2417
|
+
* @example Clear profile image
|
|
2418
|
+
* ```typescript
|
|
2419
|
+
* await sdk.updateProfile({
|
|
2420
|
+
* address: sdk.getAddress(),
|
|
2421
|
+
* profileImage: '' // Clear image
|
|
2422
|
+
* });
|
|
2423
|
+
* ```
|
|
1809
2424
|
*/
|
|
1810
2425
|
updateProfile(data: UpdateProfileData): Promise<void>;
|
|
1811
2426
|
/**
|
|
1812
|
-
* Upload a profile image
|
|
2427
|
+
* Upload a profile image for a user wallet
|
|
2428
|
+
*
|
|
2429
|
+
* Uploads an image file from the local filesystem as a user's profile picture. The image is stored on the
|
|
2430
|
+
* launchpad server and displayed in user profiles and UI throughout the platform. Supports common image formats
|
|
2431
|
+
* (PNG, JPG, GIF) and automatically handles image validation and optimization.
|
|
2432
|
+
*
|
|
2433
|
+
* **Important:** This method is only available in Node.js environments (not in browsers).
|
|
2434
|
+
* Use for backend applications, build scripts, or CLI tools that manage user profiles.
|
|
2435
|
+
*
|
|
2436
|
+
* **Requires wallet configuration** for authentication. The wallet owner can only upload an image for their own profile.
|
|
2437
|
+
* Use optional `privateKey` parameter to override the default wallet for this operation.
|
|
2438
|
+
*
|
|
2439
|
+
* @category Main SDK
|
|
2440
|
+
* @param options - Profile image upload options
|
|
2441
|
+
* @param options.imagePath - Absolute filesystem path to the image file (e.g., '/path/to/profile-pic.png')
|
|
2442
|
+
* @param options.address - Optional wallet address for profile (0x... or eth|... format). Defaults to current SDK wallet address.
|
|
2443
|
+
* @param options.privateKey - Optional private key override for this operation (format: 0x + 64 hex characters)
|
|
2444
|
+
* @returns Promise<string> URL where the profile image is hosted and can be accessed
|
|
2445
|
+
* @throws {ValidationError} If imagePath doesn't exist, wallet not configured, or user is not authorized
|
|
2446
|
+
* @throws {FileError} If image file cannot be read or is too large
|
|
2447
|
+
* @throws {NetworkError} If upload request fails
|
|
2448
|
+
* @since 4.0.4-beta.0
|
|
2449
|
+
*
|
|
2450
|
+
* @example Upload profile image from file
|
|
2451
|
+
* ```typescript
|
|
2452
|
+
* import path from 'path';
|
|
2453
|
+
*
|
|
2454
|
+
* const imageUrl = await sdk.uploadProfileImage({
|
|
2455
|
+
* imagePath: path.join(process.cwd(), 'profile-picture.png')
|
|
2456
|
+
* });
|
|
1813
2457
|
*
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
2458
|
+
* console.log(`Profile image uploaded: ${imageUrl}`);
|
|
2459
|
+
* ```
|
|
2460
|
+
*
|
|
2461
|
+
* @example Upload image for specific address
|
|
2462
|
+
* ```typescript
|
|
2463
|
+
* const imageUrl = await sdk.uploadProfileImage({
|
|
2464
|
+
* imagePath: '/absolute/path/to/profile.png',
|
|
2465
|
+
* address: 'eth|742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0'
|
|
2466
|
+
* });
|
|
2467
|
+
* ```
|
|
2468
|
+
*
|
|
2469
|
+
* @example Upload with private key override
|
|
2470
|
+
* ```typescript
|
|
2471
|
+
* const imageUrl = await sdk.uploadProfileImage({
|
|
2472
|
+
* imagePath: '/absolute/path/to/profile.png',
|
|
2473
|
+
* privateKey: process.env.ALTERNATIVE_PRIVATE_KEY
|
|
2474
|
+
* });
|
|
2475
|
+
* ```
|
|
1816
2476
|
*/
|
|
1817
2477
|
uploadProfileImage(options: UploadProfileImageOptions): Promise<string>;
|
|
1818
2478
|
/**
|
|
@@ -2116,10 +2776,28 @@ export declare class LaunchpadSDK {
|
|
|
2116
2776
|
*/
|
|
2117
2777
|
unlockToken(data: UnlockTokenData): Promise<string>;
|
|
2118
2778
|
/**
|
|
2119
|
-
* Resolve
|
|
2779
|
+
* Resolve token name to its GalaChain vault address
|
|
2780
|
+
*
|
|
2781
|
+
* Performs a lookup to find the blockchain vault address associated with a token name.
|
|
2782
|
+
* Vault addresses are used internally for direct GalaChain API calls. This method is
|
|
2783
|
+
* useful for caching, optimization, or low-level blockchain operations.
|
|
2784
|
+
*
|
|
2785
|
+
* @category Token Resolution
|
|
2786
|
+
* @param tokenName - Token name to resolve (e.g., 'anime', 'mytoken')
|
|
2787
|
+
* @returns Promise resolving to vault address string, or null if token not found
|
|
2788
|
+
* @throws {NetworkError} If API request fails
|
|
2789
|
+
* @since 4.0.4-beta.0
|
|
2120
2790
|
*
|
|
2121
|
-
* @
|
|
2122
|
-
*
|
|
2791
|
+
* @example Resolve vault for direct API calls
|
|
2792
|
+
* ```typescript
|
|
2793
|
+
* const vaultAddress = await sdk.resolveVaultAddress('anime');
|
|
2794
|
+
* if (vaultAddress) {
|
|
2795
|
+
* console.log(`Vault address: ${vaultAddress}`);
|
|
2796
|
+
* // Use for direct GalaChain API calls or caching
|
|
2797
|
+
* } else {
|
|
2798
|
+
* console.log('Token not found');
|
|
2799
|
+
* }
|
|
2800
|
+
* ```
|
|
2123
2801
|
*/
|
|
2124
2802
|
resolveVaultAddress(tokenName: string): Promise<string | null>;
|
|
2125
2803
|
/**
|