@gala-chain/launchpad-sdk 3.3.3 → 3.3.4
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/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
|
@@ -37,21 +37,58 @@ export declare function isValidNumberString(value: string | number | null | unde
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function safeParseWithContext(value: string | number | null | undefined, context: string, fallback: number): number;
|
|
39
39
|
/**
|
|
40
|
-
* Format a number string for DTO validation with
|
|
40
|
+
* Format a number string for DTO validation with specified decimal precision limit
|
|
41
41
|
*
|
|
42
42
|
* This prevents DTO validation errors caused by excessive floating-point precision
|
|
43
43
|
* and ensures numbers are in the correct format (fixed notation, no trailing zeros).
|
|
44
44
|
*
|
|
45
45
|
* @param num - Number string to format
|
|
46
|
+
* @param decimals - Maximum decimal places (default: 18 for launchpad tokens)
|
|
47
|
+
* @returns Formatted string with maximum specified decimal places
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // GALA transactions (8 decimals max)
|
|
52
|
+
* formatForDTO('100.123456789', GALA_DECIMALS) // '100.12345679'
|
|
53
|
+
*
|
|
54
|
+
* // Launchpad tokens (18 decimals max)
|
|
55
|
+
* formatForDTO('0.000000000000000123', LAUNCHPAD_TOKEN_DECIMALS) // '0.000000000000000123'
|
|
56
|
+
*
|
|
57
|
+
* // Default uses launchpad token precision
|
|
58
|
+
* formatForDTO('123.456') // '123.456'
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function formatForDTO(num: string, decimals?: number): string;
|
|
62
|
+
/**
|
|
63
|
+
* Format a GALA amount for DTO validation (8 decimal limit)
|
|
64
|
+
*
|
|
65
|
+
* GALA tokens use 8 decimal places on GalaChain. Transactions with more
|
|
66
|
+
* than 8 decimals will fail, so this function enforces the limit.
|
|
67
|
+
*
|
|
68
|
+
* @param num - GALA amount as string
|
|
46
69
|
* @returns Formatted string with maximum 8 decimal places
|
|
47
70
|
*
|
|
48
71
|
* @example
|
|
49
72
|
* ```typescript
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
73
|
+
* formatGalaForDTO('100.123456789') // '100.12345679'
|
|
74
|
+
* formatGalaForDTO('0.00000001') // '0.00000001'
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function formatGalaForDTO(num: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* Format a launchpad token amount for DTO validation (18 decimal limit)
|
|
80
|
+
*
|
|
81
|
+
* Launchpad tokens use 18 decimal places following ERC-20 standard.
|
|
82
|
+
* This function ensures full precision is maintained for token amounts.
|
|
83
|
+
*
|
|
84
|
+
* @param num - Token amount as string
|
|
85
|
+
* @returns Formatted string with maximum 18 decimal places
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* formatLaunchpadTokenForDTO('1000.123456789012345678') // '1000.123456789012345678'
|
|
90
|
+
* formatLaunchpadTokenForDTO('0.000000000000000001') // '0.000000000000000001'
|
|
54
91
|
* ```
|
|
55
92
|
*/
|
|
56
|
-
export declare function
|
|
93
|
+
export declare function formatLaunchpadTokenForDTO(num: string): string;
|
|
57
94
|
//# sourceMappingURL=number-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-utils.d.ts","sourceRoot":"","sources":["../../src/utils/number-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"number-utils.d.ts","sourceRoot":"","sources":["../../src/utils/number-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,QAAQ,EAAE,MAAM,GACf,MAAM,CAuBR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,QAAQ,EAAE,MAAM,GACf,MAAM,CAmBR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GACxC,OAAO,CAWT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CA0BR;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAiC,GAAG,MAAM,CAO7F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision-math.d.ts","sourceRoot":"","sources":["../../src/utils/precision-math.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"precision-math.d.ts","sourceRoot":"","sources":["../../src/utils/precision-math.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,OAAO,GAChB,MAAM,CA6BR;AAkFD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAcpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuBrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad-sdk",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|