@gala-chain/launchpad-sdk 3.3.3 → 3.3.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/CHANGELOG.md +37 -0
- package/dist/LaunchpadSDK.d.ts +1 -1
- package/dist/constants/decimals.d.ts +63 -0
- package/dist/constants/decimals.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/number-utils.d.ts +43 -6
- package/dist/utils/number-utils.d.ts.map +1 -1
- package/dist/utils/precision-math.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,43 @@ All notable changes to the Gala Launchpad SDK will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [3.3.4] - 2025-10-01
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Launchpad token precision loss in trading DTOs** - Fixed critical bug truncating tokens to 8 decimals
|
|
11
|
+
- `formatForDTO()` now accepts optional `decimals` parameter (defaults to 18)
|
|
12
|
+
- Added `formatGalaForDTO()` helper for GALA amounts (8 decimals - GalaChain requirement)
|
|
13
|
+
- Added `formatLaunchpadTokenForDTO()` helper for launchpad tokens (18 decimals - full precision)
|
|
14
|
+
- Updated all BondingCurveDTOs to use context-aware formatting:
|
|
15
|
+
- `nativeTokenQuantity` (GALA) → Uses `formatGalaForDTO()` (8 decimals)
|
|
16
|
+
- `expectedToken` (Launchpad token) → Uses `formatLaunchpadTokenForDTO()` (18 decimals)
|
|
17
|
+
- `tokenQuantity` (Launchpad token) → Uses `formatLaunchpadTokenForDTO()` (18 decimals)
|
|
18
|
+
- `expectedNativeToken` (GALA) → Uses `formatGalaForDTO()` (8 decimals)
|
|
19
|
+
- Prevents precision loss when trading high-precision launchpad tokens
|
|
20
|
+
- GALA amounts still correctly limited to 8 decimals (GalaChain transaction requirement)
|
|
21
|
+
- Example: Token amount `1000.123456789012345678` now preserved at full 18 decimals instead of truncated to `1000.12345679`
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- **Decimal Constants** - Token decimal precision constants for type-safe operations
|
|
25
|
+
- `GALA_DECIMALS = 8` - GALA token decimal places (GalaChain standard)
|
|
26
|
+
- `LAUNCHPAD_TOKEN_DECIMALS = 18` - Launchpad token decimal places (ERC-20 standard)
|
|
27
|
+
- `GALA_TOKEN_CLASS_KEY` - GALA token identifier for GalaChain operations
|
|
28
|
+
- Import: `import { GALA_DECIMALS, LAUNCHPAD_TOKEN_DECIMALS } from '@gala-chain/launchpad-sdk'`
|
|
29
|
+
- Provides single source of truth for decimal specifications
|
|
30
|
+
- Prevents hardcoded magic numbers across SDK
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **precision-math.ts** - Now uses `LAUNCHPAD_TOKEN_DECIMALS` constant instead of hardcoded 18
|
|
34
|
+
- Improves code maintainability and clarity
|
|
35
|
+
- Self-documenting code intent
|
|
36
|
+
|
|
37
|
+
### Benefits
|
|
38
|
+
- ✅ Full precision for launchpad tokens (18 decimals) - no more truncation
|
|
39
|
+
- ✅ Correct precision limits for GALA (8 decimals) - prevents transaction failures
|
|
40
|
+
- ✅ Type-safe decimal constants via const assertions
|
|
41
|
+
- ✅ Context-aware formatting prevents precision bugs
|
|
42
|
+
- ✅ Single source of truth for token specifications
|
|
43
|
+
|
|
7
44
|
## [3.3.3] - 2025-10-01
|
|
8
45
|
|
|
9
46
|
### Fixed
|
package/dist/LaunchpadSDK.d.ts
CHANGED
|
@@ -601,7 +601,7 @@ export declare class LaunchpadSDK {
|
|
|
601
601
|
* Update user profile information
|
|
602
602
|
*
|
|
603
603
|
* @param data Profile update data
|
|
604
|
-
* @returns Promise<
|
|
604
|
+
* @returns Promise<void> No return data - throws on failure
|
|
605
605
|
*/
|
|
606
606
|
updateProfile(data: UpdateProfileData): Promise<void>;
|
|
607
607
|
/**
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token decimal precision constants for GalaChain
|
|
3
|
+
*
|
|
4
|
+
* These constants define the decimal places for different token types
|
|
5
|
+
* used in the Gala Launchpad ecosystem. Following EIP-20 standard.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @category Constants
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* GALA token decimal places (EIP-20 standard)
|
|
12
|
+
*
|
|
13
|
+
* GALA uses 8 decimal places for all operations. This is a GalaChain
|
|
14
|
+
* requirement - transactions with more than 8 decimal places will fail.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { GALA_DECIMALS } from '@gala-chain/launchpad-sdk';
|
|
19
|
+
*
|
|
20
|
+
* console.log(`GALA has ${GALA_DECIMALS} decimals`); // 8
|
|
21
|
+
* const maxPrecision = parseFloat(galaAmount).toFixed(GALA_DECIMALS);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const GALA_DECIMALS: 8;
|
|
25
|
+
/**
|
|
26
|
+
* Launchpad token decimal places (EIP-20 standard)
|
|
27
|
+
*
|
|
28
|
+
* All tokens created via the Gala Launchpad use 18 decimal places,
|
|
29
|
+
* following the standard ERC-20 convention.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { LAUNCHPAD_TOKEN_DECIMALS } from '@gala-chain/launchpad-sdk';
|
|
34
|
+
*
|
|
35
|
+
* console.log(`Launchpad tokens have ${LAUNCHPAD_TOKEN_DECIMALS} decimals`); // 18
|
|
36
|
+
* const maxPrecision = parseFloat(tokenAmount).toFixed(LAUNCHPAD_TOKEN_DECIMALS);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const LAUNCHPAD_TOKEN_DECIMALS: 18;
|
|
40
|
+
/**
|
|
41
|
+
* GALA token class key for GalaChain operations
|
|
42
|
+
*
|
|
43
|
+
* This is the standard token identifier for GALA on GalaChain.
|
|
44
|
+
* Used for balance queries, transfers, and other token operations.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* import { GALA_TOKEN_CLASS_KEY } from '@gala-chain/launchpad-sdk';
|
|
49
|
+
*
|
|
50
|
+
* const galaBalance = await galaChainService.fetchTokenBalance({
|
|
51
|
+
* owner: walletAddress,
|
|
52
|
+
* ...GALA_TOKEN_CLASS_KEY,
|
|
53
|
+
* instance: "0"
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare const GALA_TOKEN_CLASS_KEY: {
|
|
58
|
+
readonly collection: "GALA";
|
|
59
|
+
readonly category: "Unit";
|
|
60
|
+
readonly type: "none";
|
|
61
|
+
readonly additionalKey: "none";
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=decimals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decimals.d.ts","sourceRoot":"","sources":["../../src/constants/decimals.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAG,CAAU,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,EAAG,EAAW,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC"}
|