@gala-chain/launchpad-sdk 0.4.3 → 3.0.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/README.md +351 -77
- package/dist/examples/complete-sdk-demo.d.ts +22 -0
- package/dist/examples/complete-sdk-demo.d.ts.map +1 -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 +755 -0
- package/dist/src/LaunchpadSDK.d.ts.map +1 -0
- package/dist/{api → src/api}/LaunchpadAPI.d.ts +105 -67
- package/dist/src/api/LaunchpadAPI.d.ts.map +1 -0
- package/dist/{api → src/api}/dto/BondingCurveDTOs.d.ts +8 -5
- package/dist/src/api/dto/BondingCurveDTOs.d.ts.map +1 -0
- package/dist/src/api/dto/TransferTokenDto.d.ts +76 -0
- package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -0
- package/dist/src/auth/SignatureAuth.d.ts.map +1 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/config/environments.d.ts +45 -0
- package/dist/src/config/environments.d.ts.map +1 -0
- package/dist/{helpers → src/helpers}/sdk.d.ts +23 -13
- package/dist/src/helpers/sdk.d.ts.map +1 -0
- package/dist/src/helpers/wallet.d.ts.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/services/BundleService.d.ts +197 -0
- package/dist/src/services/BundleService.d.ts.map +1 -0
- package/dist/src/services/DexService.d.ts +84 -0
- package/dist/src/services/DexService.d.ts.map +1 -0
- package/dist/src/services/GalaChainService.d.ts +254 -0
- package/dist/src/services/GalaChainService.d.ts.map +1 -0
- package/dist/src/services/LaunchpadService.d.ts +479 -0
- package/dist/src/services/LaunchpadService.d.ts.map +1 -0
- package/dist/src/services/SignatureService.d.ts.map +1 -0
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -0
- package/dist/src/services/TokenResolverService.d.ts +154 -0
- package/dist/src/services/TokenResolverService.d.ts.map +1 -0
- package/dist/src/services/WebSocketManager.d.ts.map +1 -0
- package/dist/{api → src}/services/WebSocketService.d.ts +4 -1
- package/dist/src/services/WebSocketService.d.ts.map +1 -0
- package/dist/{types → src/types}/comment.dto.d.ts +14 -5
- package/dist/src/types/comment.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/common.d.ts +36 -1
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/{types → src/types}/dto.d.ts +19 -0
- package/dist/src/types/dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.dto.d.ts +216 -30
- package/dist/src/types/launchpad.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.validation.d.ts +8 -8
- package/dist/src/types/launchpad.validation.d.ts.map +1 -0
- package/dist/src/types/options.dto.d.ts +281 -0
- package/dist/src/types/options.dto.d.ts.map +1 -0
- package/dist/src/types/result.types.d.ts +120 -0
- package/dist/src/types/result.types.d.ts.map +1 -0
- package/dist/{types → src/types}/trade.dto.d.ts +46 -19
- package/dist/src/types/trade.dto.d.ts.map +1 -0
- package/dist/src/types/transfer.dto.d.ts +161 -0
- package/dist/src/types/transfer.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/user.dto.d.ts +98 -38
- package/dist/src/types/user.dto.d.ts.map +1 -0
- package/dist/src/types/websocket.types.d.ts +82 -0
- package/dist/src/types/websocket.types.d.ts.map +1 -0
- package/dist/src/utils/Logger.d.ts +136 -0
- package/dist/src/utils/Logger.d.ts.map +1 -0
- package/dist/src/utils/SignatureHelper.d.ts +77 -0
- package/dist/src/utils/SignatureHelper.d.ts.map +1 -0
- package/dist/src/utils/adapters.d.ts.map +1 -0
- package/dist/src/utils/agent-config.d.ts.map +1 -0
- package/dist/src/utils/date-utils.d.ts +39 -0
- package/dist/src/utils/date-utils.d.ts.map +1 -0
- package/dist/src/utils/http.d.ts.map +1 -0
- package/dist/src/utils/multipart.d.ts.map +1 -0
- package/dist/src/utils/number-utils.d.ts +57 -0
- package/dist/src/utils/number-utils.d.ts.map +1 -0
- package/dist/src/utils/precision-math.d.ts.map +1 -0
- package/dist/src/utils/slippage-utils.d.ts +70 -0
- package/dist/src/utils/slippage-utils.d.ts.map +1 -0
- package/dist/src/utils/tokenNormalizer.d.ts +111 -0
- package/dist/src/utils/tokenNormalizer.d.ts.map +1 -0
- package/dist/{utils → src/utils}/validation.d.ts +4 -4
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/{utils → src/utils}/wallet.d.ts +2 -2
- package/dist/src/utils/wallet.d.ts.map +1 -0
- package/package.json +10 -13
- package/dist/LaunchpadSDK.d.ts +0 -573
- package/dist/LaunchpadSDK.d.ts.map +0 -1
- package/dist/api/CommentAPI.d.ts +0 -119
- package/dist/api/CommentAPI.d.ts.map +0 -1
- package/dist/api/LaunchpadAPI.d.ts.map +0 -1
- package/dist/api/TradeAPI.d.ts +0 -164
- package/dist/api/TradeAPI.d.ts.map +0 -1
- package/dist/api/Trading.d.ts +0 -176
- package/dist/api/Trading.d.ts.map +0 -1
- package/dist/api/UserAPI.d.ts +0 -426
- package/dist/api/UserAPI.d.ts.map +0 -1
- package/dist/api/WebSocketAPI.d.ts +0 -156
- package/dist/api/WebSocketAPI.d.ts.map +0 -1
- package/dist/api/dto/BondingCurveDTOs.d.ts.map +0 -1
- package/dist/api/services/BundleService.d.ts +0 -105
- package/dist/api/services/BundleService.d.ts.map +0 -1
- package/dist/api/services/SignatureService.d.ts.map +0 -1
- package/dist/api/services/TokenClassKeyService.d.ts.map +0 -1
- package/dist/api/services/WebSocketManager.d.ts.map +0 -1
- package/dist/api/services/WebSocketService.d.ts.map +0 -1
- package/dist/auth/SignatureAuth.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/helpers/sdk.d.ts.map +0 -1
- package/dist/helpers/wallet.d.ts.map +0 -1
- package/dist/index.d.ts +0 -49
- package/dist/index.d.ts.map +0 -1
- package/dist/types/comment.dto.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/dto.d.ts.map +0 -1
- package/dist/types/launchpad.dto.d.ts.map +0 -1
- package/dist/types/launchpad.validation.d.ts.map +0 -1
- package/dist/types/trade.dto.d.ts.map +0 -1
- package/dist/types/user.dto.d.ts.map +0 -1
- package/dist/utils/VaultCache.d.ts +0 -73
- package/dist/utils/VaultCache.d.ts.map +0 -1
- package/dist/utils/adapters.d.ts.map +0 -1
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/http.d.ts.map +0 -1
- package/dist/utils/multipart.d.ts.map +0 -1
- package/dist/utils/precision-math.d.ts.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/wallet.d.ts.map +0 -1
- /package/dist/{auth → src/auth}/SignatureAuth.d.ts +0 -0
- /package/dist/{auth → src/auth}/types.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/wallet.d.ts +0 -0
- /package/dist/{api → src}/services/SignatureService.d.ts +0 -0
- /package/dist/{api → src}/services/TokenClassKeyService.d.ts +0 -0
- /package/dist/{api → src}/services/WebSocketManager.d.ts +0 -0
- /package/dist/{utils → src/utils}/adapters.d.ts +0 -0
- /package/dist/{utils → src/utils}/agent-config.d.ts +0 -0
- /package/dist/{utils → src/utils}/http.d.ts +0 -0
- /package/dist/{utils → src/utils}/multipart.d.ts +0 -0
- /package/dist/{utils → src/utils}/precision-math.d.ts +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export interface EIP712Domain {
|
|
3
|
+
name: string;
|
|
4
|
+
chainId?: number;
|
|
5
|
+
verifyingContract?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface EIP712Types {
|
|
9
|
+
[key: string]: Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface SignedPayload {
|
|
15
|
+
signature: string;
|
|
16
|
+
domain: EIP712Domain;
|
|
17
|
+
types: EIP712Types;
|
|
18
|
+
signerPublicKey?: string;
|
|
19
|
+
prefix?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Helper class for EIP-712 structured data signing
|
|
23
|
+
* Used for GalaChain transaction signatures
|
|
24
|
+
*/
|
|
25
|
+
export declare class SignatureHelper {
|
|
26
|
+
private wallet;
|
|
27
|
+
constructor(wallet: ethers.Wallet);
|
|
28
|
+
/**
|
|
29
|
+
* Generate a unique key for idempotency
|
|
30
|
+
*/
|
|
31
|
+
static generateUniqueKey(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Sign a TransferToken payload using EIP-712
|
|
34
|
+
*/
|
|
35
|
+
signTransferToken(payload: {
|
|
36
|
+
from: string;
|
|
37
|
+
to: string;
|
|
38
|
+
quantity: string;
|
|
39
|
+
tokenInstance: {
|
|
40
|
+
collection: string;
|
|
41
|
+
category: string;
|
|
42
|
+
type: string;
|
|
43
|
+
additionalKey: string;
|
|
44
|
+
instance: string;
|
|
45
|
+
};
|
|
46
|
+
uniqueKey: string;
|
|
47
|
+
}): Promise<SignedPayload>;
|
|
48
|
+
/**
|
|
49
|
+
* Convert Ethereum address to GalaChain wallet format
|
|
50
|
+
*/
|
|
51
|
+
static toGalaChainAddress(address: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Convert GalaChain wallet format to Ethereum address
|
|
54
|
+
*/
|
|
55
|
+
static fromGalaChainAddress(galaAddress: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Create token instance for GALA transfers
|
|
58
|
+
*/
|
|
59
|
+
static createGALATokenInstance(): {
|
|
60
|
+
collection: string;
|
|
61
|
+
category: string;
|
|
62
|
+
type: string;
|
|
63
|
+
additionalKey: string;
|
|
64
|
+
instance: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Create token instance from token class key
|
|
68
|
+
*/
|
|
69
|
+
static createTokenInstanceFromClassKey(tokenClassKey: string): {
|
|
70
|
+
collection: string;
|
|
71
|
+
category: string;
|
|
72
|
+
type: string;
|
|
73
|
+
additionalKey: string;
|
|
74
|
+
instance: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=SignatureHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignatureHelper.d.ts","sourceRoot":"","sources":["../../../src/utils/SignatureHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,MAAM,CAAC,MAAM;IAIjC;;OAEG;IACH,MAAM,CAAC,iBAAiB,IAAI,MAAM;IAMlC;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE;QAC/B,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE;YACb,UAAU,EAAE,MAAM,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC;Y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AAC,MAAM,CAAC,iBAAiB;IAQhC,OAAO,CAAC,MAAM,CAAC,WAAW;IAoB1B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAWhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAahC,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAuBtC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date parsing utilities for safe type conversion
|
|
3
|
+
*
|
|
4
|
+
* These utilities provide safe date parsing with fallback handling
|
|
5
|
+
* to prevent runtime errors from malformed date strings.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Safely parse a date string to a Date object with fallback
|
|
9
|
+
*
|
|
10
|
+
* @param dateString - ISO date string from backend
|
|
11
|
+
* @param fallback - Fallback date if parsing fails (defaults to current date)
|
|
12
|
+
* @returns Valid Date object
|
|
13
|
+
*/
|
|
14
|
+
export declare function safeParseDate(dateString: string | Date | null | undefined, fallback?: Date): Date;
|
|
15
|
+
/**
|
|
16
|
+
* Safely parse multiple date strings to Date objects
|
|
17
|
+
*
|
|
18
|
+
* @param dateStrings - Array of ISO date strings
|
|
19
|
+
* @param fallback - Fallback date for any parsing failures
|
|
20
|
+
* @returns Array of valid Date objects
|
|
21
|
+
*/
|
|
22
|
+
export declare function safeParseDates(dateStrings: (string | Date | null | undefined)[], fallback?: Date): Date[];
|
|
23
|
+
/**
|
|
24
|
+
* Validate if a string is a valid date format before parsing
|
|
25
|
+
*
|
|
26
|
+
* @param dateString - String to validate
|
|
27
|
+
* @returns True if the string represents a valid date
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidDateString(dateString: string | Date | null | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Parse date with validation and detailed error context
|
|
32
|
+
*
|
|
33
|
+
* @param dateString - Date string to parse
|
|
34
|
+
* @param context - Context information for debugging (e.g., 'user.createdAt')
|
|
35
|
+
* @param fallback - Fallback date if parsing fails
|
|
36
|
+
* @returns Valid Date object with debug information
|
|
37
|
+
*/
|
|
38
|
+
export declare function safeParseWithContext(dateString: string | Date | null | undefined, context: string, fallback?: Date): Date;
|
|
39
|
+
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/date-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAC5C,QAAQ,CAAC,EAAE,IAAI,GACd,IAAI,CA2BN;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EACjD,QAAQ,CAAC,EAAE,IAAI,GACd,IAAI,EAAE,CAER;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAiBT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAC5C,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,IAAI,GACd,IAAI,CAiCN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/utils/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,Q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B,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAmKN;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASzD;AA0BD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,QAAQ,CAiBV;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CA0CnD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAuB9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numeric parsing utilities for safe type conversion
|
|
3
|
+
*
|
|
4
|
+
* These utilities provide safe number parsing with fallback handling
|
|
5
|
+
* to prevent silent failures in string-to-number conversions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Safely parse a string to a number with fallback
|
|
9
|
+
*
|
|
10
|
+
* @param value - String value to parse
|
|
11
|
+
* @param fallback - Fallback number if parsing fails
|
|
12
|
+
* @returns Valid number
|
|
13
|
+
*/
|
|
14
|
+
export declare function safeParseNumber(value: string | number | null | undefined, fallback: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Safely parse an integer with validation
|
|
17
|
+
*
|
|
18
|
+
* @param value - String or number to parse as integer
|
|
19
|
+
* @param fallback - Fallback integer if parsing fails
|
|
20
|
+
* @returns Valid integer
|
|
21
|
+
*/
|
|
22
|
+
export declare function safeParseInt(value: string | number | null | undefined, fallback: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Validate if a value can be safely converted to a number
|
|
25
|
+
*
|
|
26
|
+
* @param value - Value to validate
|
|
27
|
+
* @returns True if the value can be converted to a valid number
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidNumberString(value: string | number | null | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Parse number with validation and detailed error context
|
|
32
|
+
*
|
|
33
|
+
* @param value - Value to parse
|
|
34
|
+
* @param context - Context information for debugging (e.g., 'pagination.page')
|
|
35
|
+
* @param fallback - Fallback number if parsing fails
|
|
36
|
+
* @returns Valid number with debug information
|
|
37
|
+
*/
|
|
38
|
+
export declare function safeParseWithContext(value: string | number | null | undefined, context: string, fallback: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Format a number string for DTO validation with 8-decimal precision limit
|
|
41
|
+
*
|
|
42
|
+
* This prevents DTO validation errors caused by excessive floating-point precision
|
|
43
|
+
* and ensures numbers are in the correct format (fixed notation, no trailing zeros).
|
|
44
|
+
*
|
|
45
|
+
* @param num - Number string to format
|
|
46
|
+
* @returns Formatted string with maximum 8 decimal places
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* formatForDTO('0.000000047499999999999995') // '0.00000005'
|
|
51
|
+
* formatForDTO('123.456789123456789') // '123.45678912'
|
|
52
|
+
* formatForDTO('0') // '0'
|
|
53
|
+
* formatForDTO('100.0000') // '100'
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatForDTO(num: string): string;
|
|
57
|
+
//# sourceMappingURL=number-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/number-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,wBAAgB,eAAe,CA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|
2
|
+
* Slippage tolerance utilities for trading operations
|
|
3
|
+
*
|
|
4
|
+
* Provides precise slippage calculations for buy and sell operations to protect
|
|
5
|
+
* against price movement between quote calculation and transaction execution.
|
|
6
|
+
*
|
|
7
|
+
* @category Utilities
|
|
8
|
+
* @since 2.0.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Operation types for slippage calculation
|
|
12
|
+
*/
|
|
13
|
+
export type SlippageOperationType = 'buy-native' | 'buy-exact' | 'sell-exact' | 'sell-native';
|
|
14
|
+
/**
|
|
15
|
+
* Apply slippage tolerance to an expected amount for trading operations
|
|
16
|
+
*
|
|
17
|
+
* Slippage tolerance protects against price movement by adjusting the minimum/maximum
|
|
18
|
+
* acceptable amounts in the direction that favors the user:
|
|
19
|
+
*
|
|
20
|
+
* **Buy Operations:**
|
|
21
|
+
* - buy-native: Reduce minimum tokens expected (accept receiving less)
|
|
22
|
+
* - buy-exact: Increase maximum GALA cost (accept paying more)
|
|
23
|
+
*
|
|
24
|
+
* **Sell Operations:**
|
|
25
|
+
* - sell-exact: Reduce minimum GALA expected (accept receiving less)
|
|
26
|
+
* - sell-native: Increase maximum tokens to sell (accept selling more)
|
|
27
|
+
*
|
|
28
|
+
* @param expectedAmount The calculated expected amount from bonding curve
|
|
29
|
+
* @param slippageToleranceFactor Slippage tolerance as decimal (e.g., 0.05 = 5%)
|
|
30
|
+
* @param operationType The specific trading operation type
|
|
31
|
+
* @returns Adjusted amount with slippage protection applied
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Buy native: Accept receiving 5% fewer tokens
|
|
36
|
+
* const protectedTokens = applySlippageTolerance("1000", 0.05, "buy-native");
|
|
37
|
+
* // Returns "950" (5% less tokens acceptable)
|
|
38
|
+
*
|
|
39
|
+
* // Buy exact: Accept paying 5% more GALA
|
|
40
|
+
* const protectedGala = applySlippageTolerance("100", 0.05, "buy-exact");
|
|
41
|
+
* // Returns "105" (5% more GALA acceptable)
|
|
42
|
+
*
|
|
43
|
+
* // Sell exact: Accept receiving 5% less GALA
|
|
44
|
+
* const protectedGala = applySlippageTolerance("100", 0.05, "sell-exact");
|
|
45
|
+
* // Returns "95" (5% less GALA acceptable)
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @throws {Error} If slippageToleranceFactor is negative or greater than 1
|
|
49
|
+
* @throws {Error} If expectedAmount is not a valid number
|
|
50
|
+
*/
|
|
51
|
+
export declare function applySlippageTolerance(expectedAmount: string, slippageToleranceFactor: number, operationType: SlippageOperationType): string;
|
|
52
|
+
/**
|
|
53
|
+
* Calculate the effective slippage percentage between two amounts
|
|
54
|
+
*
|
|
55
|
+
* Useful for debugging and logging to show the actual slippage applied.
|
|
56
|
+
*
|
|
57
|
+
* @param originalAmount The original expected amount
|
|
58
|
+
* @param adjustedAmount The slippage-adjusted amount
|
|
59
|
+
* @returns The effective slippage percentage as a decimal (e.g., 0.05 = 5%)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const original = "1000";
|
|
64
|
+
* const adjusted = "950";
|
|
65
|
+
* const slippage = calculateEffectiveSlippage(original, adjusted);
|
|
66
|
+
* console.log(`Applied ${slippage * 100}% slippage`); // "Applied 5% slippage"
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function calculateEffectiveSlippage(originalAmount: string, adjustedAmount: string): number;
|
|
70
|
+
//# sourceMappingURL=slippage-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slippage-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/slippage-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,qBAAqB,GACnC,MAAM,CAuDR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GACrB,MAAM,CAYR"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Normalization Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for normalizing different token identifier formats
|
|
5
|
+
* into a consistent TokenInstanceKey format that can be used with GalaChain APIs.
|
|
6
|
+
*/
|
|
7
|
+
import { TokenId, TokenClassKey, TokenInstanceKey } from '../types/common';
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes any token identifier format to TokenInstanceKey
|
|
10
|
+
*
|
|
11
|
+
* Accepts:
|
|
12
|
+
* - String format: "collection|category|type|additionalKey" or "collection|category|type|additionalKey|instance"
|
|
13
|
+
* - TokenClassKey object: { collection, category, type, additionalKey }
|
|
14
|
+
* - TokenInstanceKey object: { collection, category, type, additionalKey, instance }
|
|
15
|
+
*
|
|
16
|
+
* @param tokenId Token identifier in any supported format
|
|
17
|
+
* @returns TokenInstanceKey with instance defaulted to "0" if not provided
|
|
18
|
+
* @throws ValidationError if the format is invalid
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // String format (no instance)
|
|
23
|
+
* const result1 = normalizeToTokenInstanceKey("GALA|Unit|none|none");
|
|
24
|
+
* // → { collection: "GALA", category: "Unit", type: "none", additionalKey: "none", instance: "0" }
|
|
25
|
+
*
|
|
26
|
+
* // String format (with instance)
|
|
27
|
+
* const result2 = normalizeToTokenInstanceKey("Token|Unit|UNI|eth:address|1");
|
|
28
|
+
* // → { collection: "Token", category: "Unit", type: "UNI", additionalKey: "eth:address", instance: "1" }
|
|
29
|
+
*
|
|
30
|
+
* // TokenClassKey object
|
|
31
|
+
* const tokenClass = { collection: "Token", category: "Unit", type: "UNI", additionalKey: "eth:address" };
|
|
32
|
+
* const result3 = normalizeToTokenInstanceKey(tokenClass);
|
|
33
|
+
* // → { collection: "Token", category: "Unit", type: "UNI", additionalKey: "eth:address", instance: "0" }
|
|
34
|
+
*
|
|
35
|
+
* // TokenInstanceKey object (already normalized)
|
|
36
|
+
* const tokenInstance = { collection: "GALA", category: "Unit", type: "none", additionalKey: "none", instance: "0" };
|
|
37
|
+
* const result4 = normalizeToTokenInstanceKey(tokenInstance);
|
|
38
|
+
* // → Same object returned
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function normalizeToTokenInstanceKey(tokenId: TokenId): TokenInstanceKey;
|
|
42
|
+
/**
|
|
43
|
+
* Type guard to check if a TokenId is a TokenInstanceKey object
|
|
44
|
+
*
|
|
45
|
+
* @param tokenId Token identifier to check
|
|
46
|
+
* @returns True if tokenId is a TokenInstanceKey object
|
|
47
|
+
*/
|
|
48
|
+
export declare function isTokenInstanceKey(tokenId: TokenId): tokenId is TokenInstanceKey;
|
|
49
|
+
/**
|
|
50
|
+
* Type guard to check if a TokenId is a TokenClassKey object
|
|
51
|
+
*
|
|
52
|
+
* @param tokenId Token identifier to check
|
|
53
|
+
* @returns True if tokenId is a TokenClassKey object (no instance field)
|
|
54
|
+
*/
|
|
55
|
+
export declare function isTokenClassKey(tokenId: TokenId): tokenId is TokenClassKey;
|
|
56
|
+
/**
|
|
57
|
+
* Type guard to check if a TokenId is a string
|
|
58
|
+
*
|
|
59
|
+
* @param tokenId Token identifier to check
|
|
60
|
+
* @returns True if tokenId is a string
|
|
61
|
+
*/
|
|
62
|
+
export declare function isTokenIdString(tokenId: TokenId): tokenId is string;
|
|
63
|
+
/**
|
|
64
|
+
* Converts a TokenInstanceKey to pipe-separated string format
|
|
65
|
+
*
|
|
66
|
+
* @param tokenInstance TokenInstanceKey to convert
|
|
67
|
+
* @returns String in format "collection|category|type|additionalKey|instance"
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const tokenInstance = {
|
|
72
|
+
* collection: "GALA",
|
|
73
|
+
* category: "Unit",
|
|
74
|
+
* type: "none",
|
|
75
|
+
* additionalKey: "none",
|
|
76
|
+
* instance: "0"
|
|
77
|
+
* };
|
|
78
|
+
*
|
|
79
|
+
* const result = tokenInstanceKeyToString(tokenInstance);
|
|
80
|
+
* // → "GALA|Unit|none|none|0"
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function tokenInstanceKeyToString(tokenInstance: TokenInstanceKey): string;
|
|
84
|
+
/**
|
|
85
|
+
* Converts a TokenClassKey to pipe-separated string format (without instance)
|
|
86
|
+
*
|
|
87
|
+
* @param tokenClass TokenClassKey to convert
|
|
88
|
+
* @returns String in format "collection|category|type|additionalKey"
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const tokenClass = {
|
|
93
|
+
* collection: "Token",
|
|
94
|
+
* category: "Unit",
|
|
95
|
+
* type: "UNI",
|
|
96
|
+
* additionalKey: "eth:9401b171307bE656f00F9e18DF756643FD3a91dE"
|
|
97
|
+
* };
|
|
98
|
+
*
|
|
99
|
+
* const result = tokenClassKeyToString(tokenClass);
|
|
100
|
+
* // → "Token|Unit|UNI|eth:9401b171307bE656f00F9e18DF756643FD3a91dE"
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function tokenClassKeyToString(tokenClass: TokenClassKey): string;
|
|
104
|
+
/**
|
|
105
|
+
* Validates that a TokenId has all required fields
|
|
106
|
+
*
|
|
107
|
+
* @param tokenId Token identifier to validate
|
|
108
|
+
* @throws ValidationError if validation fails
|
|
109
|
+
*/
|
|
110
|
+
export declare function validateTokenId(tokenId: TokenId): void;
|
|
111
|
+
//# sourceMappingURL=tokenNormalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenNormalizer.d.ts","sourceRoot":"","sources":["../../../src/utils/tokenNormalizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CA2D9E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAKhF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,aAAa,CAI1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,MAAM,CAEnE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM,CAEhF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CActD"}
|
|
@@ -65,7 +65,7 @@ export declare function validateGetAmountOptions(options: GetAmountOptions): voi
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function validateGetGraphOptions(options: GetGraphOptions): void;
|
|
67
67
|
/**
|
|
68
|
-
* Validates create pool data (supports both CreatePoolData and
|
|
68
|
+
* Validates create pool data (supports both CreatePoolData and LaunchTokenData formats)
|
|
69
69
|
*
|
|
70
70
|
* @param data Pool creation data to validate
|
|
71
71
|
* @throws ValidationError if validation fails
|
|
@@ -86,12 +86,12 @@ export declare function toBackendAddressFormat(ethereumAddress: string): Address
|
|
|
86
86
|
*/
|
|
87
87
|
export declare function fromBackendAddressFormat(backendAddress: string): string;
|
|
88
88
|
/**
|
|
89
|
-
* Validates
|
|
89
|
+
* Validates launch token data (for bundle backend)
|
|
90
90
|
*
|
|
91
|
-
* @param data
|
|
91
|
+
* @param data Token launch data to validate
|
|
92
92
|
* @throws ValidationError if validation fails
|
|
93
93
|
*/
|
|
94
|
-
export declare function
|
|
94
|
+
export declare function validateLaunchTokenData(data: any): void;
|
|
95
95
|
export declare function isValidEthereumAddress(address: string): boolean;
|
|
96
96
|
export declare function isValidAddressFormat(address: string): address is AddressFormat;
|
|
97
97
|
export declare function formatAddressForBackend(address: EthereumAddress): AddressFormat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IAG/B,KAAK,CAAC,EAAE,MAAM;IACd,IAAI,CAAC,EAAE,MAAM;gBAFpB,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,EAAE,MAAM,YAAA,EACd,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAgCzD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CA4BlE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAkB,GAC5B,IAAI,CAkBN;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAqCxD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|
25
|
-
* import {
|
|
25
|
+
* import { createWallet } from '@gala-chain/launchpad-sdk';
|
|
26
26
|
*
|
|
27
27
|
* // Generate a new wallet
|
|
28
|
-
* const newWallet =
|
|
28
|
+
* const newWallet = createWallet();
|
|
29
29
|
* console.log('Address:', newWallet.address);
|
|
30
30
|
* console.log('Gala Address:', newWallet.galaAddress);
|
|
31
31
|
* console.log('Mnemonic:', newWallet.mnemonic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,QAAQ,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAK;IAC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,cAAc,IAAI,eAAe;IAyCxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe;IAa1D;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,eAAe;IAwCzE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAY7C;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAiBrD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAUvD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAYnD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,uBAAuB,CAAC,KAAK,GAAE,MAAU,GAAG,eAAe,EAAE;IA0BpE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,eAAe,EACvB,gBAAgB,GAAE,OAAe,GAChC,MAAM;CAyBV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "3.0.1",
|
|
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",
|
|
@@ -36,19 +36,11 @@
|
|
|
36
36
|
"test:watch": "jest --watch",
|
|
37
37
|
"test:coverage": "jest --coverage",
|
|
38
38
|
"test:ci": "jest --coverage --ci --watchAll=false",
|
|
39
|
-
"
|
|
40
|
-
"test:integration": "jest --selectProjects integration",
|
|
41
|
-
"test:live": "tsx examples/trading/test-real-api-comprehensive.ts",
|
|
42
|
-
"test:live:help": "echo 'Live API Testing requires .env file with: WALLET_PRIVATE_KEY=your_test_wallet_private_key'",
|
|
43
|
-
"test:all": "npm run test:unit && npm run test:integration",
|
|
44
|
-
"test:trading": "tsx examples/trading/test-5-buys-5-sells.ts",
|
|
45
|
-
"test:websocket": "tsx examples/trading/test-websocket-monitoring.ts",
|
|
46
|
-
"demo": "tsx examples/demo-showcase.ts",
|
|
39
|
+
"demo": "tsx examples/complete-sdk-demo.ts",
|
|
47
40
|
"lint": "eslint src --ext .ts,.tsx --fix",
|
|
48
41
|
"lint:check": "eslint src --ext .ts,.tsx",
|
|
49
42
|
"typecheck": "tsc --noEmit",
|
|
50
43
|
"typecheck:watch": "tsc --noEmit --watch",
|
|
51
|
-
"typecheck:examples": "tsc --project tsconfig.examples.json --noEmit",
|
|
52
44
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
53
45
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
54
46
|
"prepublishOnly": "npm run build",
|
|
@@ -96,7 +88,12 @@
|
|
|
96
88
|
"bonding-curve",
|
|
97
89
|
"token-creation",
|
|
98
90
|
"portfolio",
|
|
99
|
-
"comments"
|
|
91
|
+
"comments",
|
|
92
|
+
"mcp",
|
|
93
|
+
"ai-agent",
|
|
94
|
+
"automation",
|
|
95
|
+
"agent-sdk",
|
|
96
|
+
"model-context-protocol"
|
|
100
97
|
],
|
|
101
98
|
"author": {
|
|
102
99
|
"name": "Gala Launchpad Team",
|
|
@@ -127,13 +124,13 @@
|
|
|
127
124
|
"not ie 11"
|
|
128
125
|
],
|
|
129
126
|
"dependencies": {
|
|
130
|
-
"@gala-chain/api": "^
|
|
127
|
+
"@gala-chain/api": "^2.4.3",
|
|
131
128
|
"@gala-chain/connect": "^2.4.3",
|
|
132
129
|
"@types/uuid": "^10.0.0",
|
|
133
130
|
"axios": "^1.12.2",
|
|
134
131
|
"bignumber.js": "^9.1.2",
|
|
135
132
|
"crypto-js": "^4.2.0",
|
|
136
|
-
"dotenv": "^17.2.
|
|
133
|
+
"dotenv": "^17.2.3",
|
|
137
134
|
"ethers": "^6.15.0",
|
|
138
135
|
"socket.io-client": "^4.8.1",
|
|
139
136
|
"uuid": "^13.0.0"
|