@gala-chain/launchpad-sdk 0.4.0

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +628 -0
  3. package/dist/LaunchpadSDK.d.ts +573 -0
  4. package/dist/LaunchpadSDK.d.ts.map +1 -0
  5. package/dist/api/CommentAPI.d.ts +119 -0
  6. package/dist/api/CommentAPI.d.ts.map +1 -0
  7. package/dist/api/LaunchpadAPI.d.ts +440 -0
  8. package/dist/api/LaunchpadAPI.d.ts.map +1 -0
  9. package/dist/api/TradeAPI.d.ts +164 -0
  10. package/dist/api/TradeAPI.d.ts.map +1 -0
  11. package/dist/api/Trading.d.ts +176 -0
  12. package/dist/api/Trading.d.ts.map +1 -0
  13. package/dist/api/UserAPI.d.ts +426 -0
  14. package/dist/api/UserAPI.d.ts.map +1 -0
  15. package/dist/api/WebSocketAPI.d.ts +156 -0
  16. package/dist/api/WebSocketAPI.d.ts.map +1 -0
  17. package/dist/api/dto/BondingCurveDTOs.d.ts +142 -0
  18. package/dist/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  19. package/dist/api/services/BundleService.d.ts +105 -0
  20. package/dist/api/services/BundleService.d.ts.map +1 -0
  21. package/dist/api/services/SignatureService.d.ts +71 -0
  22. package/dist/api/services/SignatureService.d.ts.map +1 -0
  23. package/dist/api/services/TokenClassKeyService.d.ts +116 -0
  24. package/dist/api/services/TokenClassKeyService.d.ts.map +1 -0
  25. package/dist/api/services/WebSocketManager.d.ts +99 -0
  26. package/dist/api/services/WebSocketManager.d.ts.map +1 -0
  27. package/dist/api/services/WebSocketService.d.ts +66 -0
  28. package/dist/api/services/WebSocketService.d.ts.map +1 -0
  29. package/dist/auth/SignatureAuth.d.ts +92 -0
  30. package/dist/auth/SignatureAuth.d.ts.map +1 -0
  31. package/dist/auth/types.d.ts +41 -0
  32. package/dist/auth/types.d.ts.map +1 -0
  33. package/dist/helpers/sdk.d.ts +75 -0
  34. package/dist/helpers/sdk.d.ts.map +1 -0
  35. package/dist/helpers/wallet.d.ts +60 -0
  36. package/dist/helpers/wallet.d.ts.map +1 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.d.ts +49 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.esm.js +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/types/comment.dto.d.ts +160 -0
  43. package/dist/types/comment.dto.d.ts.map +1 -0
  44. package/dist/types/common.d.ts +108 -0
  45. package/dist/types/common.d.ts.map +1 -0
  46. package/dist/types/dto.d.ts +145 -0
  47. package/dist/types/dto.d.ts.map +1 -0
  48. package/dist/types/launchpad.dto.d.ts +517 -0
  49. package/dist/types/launchpad.dto.d.ts.map +1 -0
  50. package/dist/types/launchpad.validation.d.ts +40 -0
  51. package/dist/types/launchpad.validation.d.ts.map +1 -0
  52. package/dist/types/trade.dto.d.ts +446 -0
  53. package/dist/types/trade.dto.d.ts.map +1 -0
  54. package/dist/types/user.dto.d.ts +330 -0
  55. package/dist/types/user.dto.d.ts.map +1 -0
  56. package/dist/utils/VaultCache.d.ts +73 -0
  57. package/dist/utils/VaultCache.d.ts.map +1 -0
  58. package/dist/utils/adapters.d.ts +111 -0
  59. package/dist/utils/adapters.d.ts.map +1 -0
  60. package/dist/utils/agent-config.d.ts +206 -0
  61. package/dist/utils/agent-config.d.ts.map +1 -0
  62. package/dist/utils/http.d.ts +85 -0
  63. package/dist/utils/http.d.ts.map +1 -0
  64. package/dist/utils/multipart.d.ts +60 -0
  65. package/dist/utils/multipart.d.ts.map +1 -0
  66. package/dist/utils/precision-math.d.ts +37 -0
  67. package/dist/utils/precision-math.d.ts.map +1 -0
  68. package/dist/utils/validation.d.ts +131 -0
  69. package/dist/utils/validation.d.ts.map +1 -0
  70. package/dist/utils/wallet.d.ts +174 -0
  71. package/dist/utils/wallet.d.ts.map +1 -0
  72. package/package.json +151 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * WebSocket API Controller
3
+ *
4
+ * This controller provides WebSocket-based real-time transaction monitoring
5
+ * for bundle transactions submitted to the bundle backend.
6
+ *
7
+ * @category API Controllers
8
+ * @since 2.0.0
9
+ */
10
+ import { TransactionStatus, WebSocketConfig } from './services/WebSocketService';
11
+ /**
12
+ * WebSocket API Controller for Real-time Transaction Monitoring
13
+ */
14
+ export declare class WebSocketAPI {
15
+ private wsService;
16
+ private config;
17
+ private debug;
18
+ constructor(wsConfig: WebSocketConfig, debug?: boolean);
19
+ /**
20
+ * Initialize WebSocket connection using singleton manager
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * await sdk.websocket.connect();
25
+ * ```
26
+ */
27
+ connect(): Promise<void>;
28
+ /**
29
+ * Monitor a transaction for completion
30
+ *
31
+ * @param transactionId Bundle transaction ID
32
+ * @param callback Status update callback
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * await sdk.websocket.monitorTransaction(txId, (status) => {
37
+ * console.log(`Transaction ${status.transactionId}: ${status.status}`);
38
+ * if (status.status === 'completed') {
39
+ * console.log('Transaction completed!');
40
+ * }
41
+ * });
42
+ * ```
43
+ */
44
+ monitorTransaction(transactionId: string, callback: (status: TransactionStatus) => void): Promise<void>;
45
+ /**
46
+ * Wait for transaction completion (Promise-based)
47
+ *
48
+ * @param transactionId Bundle transaction ID
49
+ * @returns Promise that resolves when transaction completes
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * try {
54
+ * const result = await sdk.websocket.waitForTransaction(txId);
55
+ * console.log('Transaction completed:', result);
56
+ * } catch (error) {
57
+ * console.error('Transaction failed:', error);
58
+ * }
59
+ * ```
60
+ */
61
+ waitForTransaction(transactionId: string): Promise<TransactionStatus>;
62
+ /**
63
+ * Monitor multiple transactions
64
+ *
65
+ * @param transactionIds Array of transaction IDs
66
+ * @param callback Status update callback
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * await sdk.websocket.monitorTransactions([buyTxId, sellTxId], (status) => {
71
+ * console.log(`${status.transactionId}: ${status.status}`);
72
+ * });
73
+ * ```
74
+ */
75
+ monitorTransactions(transactionIds: string[], callback: (status: TransactionStatus) => void): Promise<void>;
76
+ /**
77
+ * Wait for all transactions to complete
78
+ *
79
+ * @param transactionIds Array of transaction IDs
80
+ * @returns Promise that resolves when all transactions complete
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const results = await sdk.websocket.waitForTransactions([buyTxId, sellTxId]);
85
+ * console.log('All transactions completed:', results);
86
+ * ```
87
+ */
88
+ waitForTransactions(transactionIds: string[]): Promise<TransactionStatus[]>;
89
+ /**
90
+ * Release reference to WebSocket connection
91
+ *
92
+ * Uses reference counting - connection is only closed when all
93
+ * SDK instances have released their references.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * sdk.websocket.disconnect();
98
+ * ```
99
+ */
100
+ disconnect(): void;
101
+ /**
102
+ * Check connection status
103
+ *
104
+ * @returns True if WebSocket is connected
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * if (sdk.websocket.isConnected()) {
109
+ * console.log('WebSocket is ready');
110
+ * }
111
+ * ```
112
+ */
113
+ isConnected(): boolean;
114
+ /**
115
+ * Get connection information for debugging
116
+ *
117
+ * @returns Array of connection info objects
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * const connections = sdk.websocket.getConnectionInfo();
122
+ * console.log('Active connections:', connections);
123
+ * ```
124
+ */
125
+ getConnectionInfo(): Array<{
126
+ url: string;
127
+ referenceCount: number;
128
+ isConnected: boolean;
129
+ }>;
130
+ /**
131
+ * Check if this instance has an active reference to a WebSocket connection
132
+ *
133
+ * @returns True if this instance has a WebSocket service reference
134
+ */
135
+ hasActiveReference(): boolean;
136
+ /**
137
+ * Cleanup all WebSocket connections (static method)
138
+ *
139
+ * Forces disconnection of all managed connections across all SDK instances.
140
+ * Useful for application shutdown or testing cleanup.
141
+ *
142
+ * @param debug Enable debug logging
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * WebSocketAPI.cleanupAll();
147
+ * ```
148
+ */
149
+ static cleanupAll(debug?: boolean): void;
150
+ /**
151
+ * Ensure WebSocket is connected
152
+ */
153
+ private ensureConnected;
154
+ }
155
+ export type { TransactionStatus } from './services/WebSocketService';
156
+ //# sourceMappingURL=WebSocketAPI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketAPI.d.ts","sourceRoot":"","sources":["../../src/api/WebSocketAPI.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAoB,iBAAiB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnG;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAU;gBAEX,QAAQ,EAAE,eAAe,EAAE,KAAK,GAAE,OAAe;IAK7D;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B;;;;;;;;;;;;;;;OAeG;IACG,kBAAkB,CACtB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,GAC5C,OAAO,CAAC,IAAI,CAAC;IAKhB;;;;;;;;;;;;;;;OAeG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAK3E;;;;;;;;;;;;OAYG;IACG,mBAAmB,CACvB,cAAc,EAAE,MAAM,EAAE,EACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,GAC5C,OAAO,CAAC,IAAI,CAAC;IAkBhB;;;;;;;;;;;OAWG;IACG,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAkCjF;;;;;;;;;;OAUG;IACH,UAAU,IAAI,IAAI;IAQlB;;;;;;;;;;;OAWG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;;;;OAUG;IACH,iBAAiB,IAAI,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IAIzF;;;;OAIG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAI/C;;OAEG;YACW,eAAe;CAK9B;AAED,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Bonding Curve DTOs for Launchpad Trading Operations
3
+ *
4
+ * These DTOs extend ChainCallDTO from @gala-chain/connect and provide
5
+ * properly structured data transfer objects for bonding curve trading.
6
+ * Each DTO matches the exact format expected by the launchpad backend.
7
+ *
8
+ * ## DTO Structure:
9
+ * All DTOs inherit from ChainCallDTO which provides:
10
+ * - EIP-712 signature support
11
+ * - Proper serialization format
12
+ * - Type validation
13
+ * - Compatibility with @gala-chain/connect ecosystem
14
+ *
15
+ * ## Trading Operations:
16
+ * - BuyNativeDto: Buy tokens with exact GALA amount
17
+ * - BuyExactDto: Buy exact amount of tokens
18
+ * - SellExactDto: Sell exact amount of tokens
19
+ * - SellNativeDto: Sell tokens for exact GALA amount
20
+ *
21
+ * @category DTOs
22
+ * @since 2.0.0
23
+ */
24
+ import { ChainCallDTO } from '@gala-chain/connect';
25
+ /**
26
+ * Base interface for extra fees configuration
27
+ */
28
+ export interface IExtraFeesDTO {
29
+ maxAcceptableReverseBondingCurveFee: string;
30
+ }
31
+ /**
32
+ * DTO for buying tokens with exact native (GALA) amount
33
+ * Corresponds to BuyWithNative method on the backend
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const dto = new BuyNativeDto(
38
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad',
39
+ * '100.5',
40
+ * '1342612.26269649' // Expected tokens based on bonding curve
41
+ * );
42
+ * ```
43
+ */
44
+ export declare class BuyNativeDto extends ChainCallDTO {
45
+ readonly vaultAddress: string;
46
+ readonly nativeTokenQuantity: string;
47
+ readonly expectedToken: string;
48
+ readonly extraFees: IExtraFeesDTO;
49
+ uniqueKey?: string;
50
+ constructor(vaultAddress: string, nativeTokenQuantity: string, expectedToken?: string, extraFees?: IExtraFeesDTO);
51
+ }
52
+ /**
53
+ * DTO for buying exact amount of tokens
54
+ * Corresponds to BuyExactToken method on the backend
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const dto = new BuyExactDto(
59
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad',
60
+ * '50.0',
61
+ * { maxAcceptableReverseBondingCurveFee: '0.1' }
62
+ * );
63
+ * ```
64
+ */
65
+ export declare class BuyExactDto extends ChainCallDTO {
66
+ readonly vaultAddress: string;
67
+ readonly tokenQuantity: string;
68
+ readonly expectedGala: string;
69
+ readonly extraFees: IExtraFeesDTO;
70
+ uniqueKey?: string;
71
+ constructor(vaultAddress: string, tokenQuantity: string, expectedGala: string, extraFees?: IExtraFeesDTO);
72
+ }
73
+ /**
74
+ * DTO for selling exact amount of tokens
75
+ * Corresponds to SellExactToken method on the backend
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const dto = new SellExactDto(
80
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad',
81
+ * '25.0',
82
+ * { maxAcceptableReverseBondingCurveFee: '0.05' }
83
+ * );
84
+ * ```
85
+ */
86
+ export declare class SellExactDto extends ChainCallDTO {
87
+ readonly vaultAddress: string;
88
+ readonly tokenQuantity: string;
89
+ readonly extraFees: IExtraFeesDTO;
90
+ uniqueKey?: string;
91
+ constructor(vaultAddress: string, tokenQuantity: string, extraFees?: IExtraFeesDTO);
92
+ }
93
+ /**
94
+ * DTO for selling tokens to receive exact native (GALA) amount
95
+ * Corresponds to SellWithNative method on the backend
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const dto = new SellNativeDto(
100
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad',
101
+ * '10.0'
102
+ * );
103
+ * ```
104
+ */
105
+ export declare class SellNativeDto extends ChainCallDTO {
106
+ readonly vaultAddress: string;
107
+ readonly nativeTokenQuantity: string;
108
+ readonly expectedTokens: string;
109
+ uniqueKey?: string;
110
+ constructor(vaultAddress: string, nativeTokenQuantity: string, expectedTokens: string);
111
+ }
112
+ /**
113
+ * Namespace export for convenient access to all bonding curve DTOs
114
+ */
115
+ export declare const BondingCurveDTOs: {
116
+ readonly BuyNativeDto: typeof BuyNativeDto;
117
+ readonly BuyExactDto: typeof BuyExactDto;
118
+ readonly SellExactDto: typeof SellExactDto;
119
+ readonly SellNativeDto: typeof SellNativeDto;
120
+ };
121
+ /**
122
+ * Type definitions for DTO parameters
123
+ */
124
+ export type BuyNativeDtoParams = {
125
+ vaultAddress: string;
126
+ nativeTokenQuantity: string;
127
+ };
128
+ export type BuyExactDtoParams = {
129
+ vaultAddress: string;
130
+ tokenQuantity: string;
131
+ extraFees?: IExtraFeesDTO;
132
+ };
133
+ export type SellExactDtoParams = {
134
+ vaultAddress: string;
135
+ tokenQuantity: string;
136
+ extraFees?: IExtraFeesDTO;
137
+ };
138
+ export type SellNativeDtoParams = {
139
+ vaultAddress: string;
140
+ nativeTokenQuantity: string;
141
+ };
142
+ //# sourceMappingURL=BondingCurveDTOs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BondingCurveDTOs.d.ts","sourceRoot":"","sources":["../../../src/api/dto/BondingCurveDTOs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC,EAAE,MAAM,CAAC;CAC7C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,SAAS,EAAE,aAAa,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGxB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,MAAM,EAC3B,aAAa,GAAE,MAAY,EAC3B,SAAS,GAAE,aAA4D;CAQ1E;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,SAAS,EAAE,aAAa,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,aAA4D;CAQ1E;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,SAAS,EAAE,aAAa,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,aAA4D;CAO1E;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,SAAgB,cAAc,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEd,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAMtF;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Bundle Service for Transaction Processing
3
+ *
4
+ * This service handles bundle transaction submission to the launchpad
5
+ * backend. It formats the request data in the exact structure expected
6
+ * by the bundle API and provides proper error handling.
7
+ *
8
+ * ## Bundle Transaction Format:
9
+ * ```json
10
+ * {
11
+ * "signedDto": {
12
+ * // Signed DTO with signature, types, domain
13
+ * },
14
+ * "stringsInstructions": [
15
+ * // Array of resource tracking strings
16
+ * ],
17
+ * "method": "BuyWithNative" | "BuyExactToken" | "SellExactToken" | "SellWithNative"
18
+ * }
19
+ * ```
20
+ *
21
+ * ## Response Handling:
22
+ * - Success: Returns transaction ID for WebSocket monitoring
23
+ * - Error: Provides detailed error messages for debugging
24
+ *
25
+ * @category Services
26
+ * @since 2.0.0
27
+ */
28
+ import { HttpClient } from '../../utils/http';
29
+ import type { ApiResponse } from '../../types/common';
30
+ /**
31
+ * Bundle transaction data structure
32
+ */
33
+ export interface BundleTransactionData {
34
+ signedDto: any;
35
+ stringsInstructions: string[];
36
+ method: string;
37
+ }
38
+ /**
39
+ * Service for handling bundle transaction submission
40
+ */
41
+ export declare class BundleService {
42
+ private httpClient;
43
+ private debug;
44
+ private readonly bundleEndpoint;
45
+ constructor(httpClient: HttpClient, debug?: boolean);
46
+ /**
47
+ * Submit a bundle transaction to the backend
48
+ *
49
+ * @param bundleData - Complete bundle transaction data
50
+ * @returns API response with transaction ID or error
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const bundleData = {
55
+ * signedDto: signedPayload,
56
+ * stringsInstructions: [
57
+ * '$service$Token$Unit$ANIME$none$launchpad',
58
+ * '$tokenBalance$Token$Unit$ANIME$none$vaultAddress',
59
+ * // ... more strings
60
+ * ],
61
+ * method: 'BuyWithNative'
62
+ * };
63
+ *
64
+ * const response = await bundleService.submitTransaction(bundleData);
65
+ * ```
66
+ */
67
+ submitTransaction(bundleData: BundleTransactionData): Promise<ApiResponse>;
68
+ /**
69
+ * Validate bundle transaction data
70
+ */
71
+ private validateBundleData;
72
+ /**
73
+ * Format bundle request for API submission
74
+ */
75
+ private formatBundleRequest;
76
+ /**
77
+ * Handle bundle API response
78
+ */
79
+ private handleBundleResponse;
80
+ /**
81
+ * Format error message for consistent error handling
82
+ */
83
+ private formatErrorMessage;
84
+ /**
85
+ * Get bundle transaction status
86
+ *
87
+ * @param transactionId - Transaction ID returned from submitTransaction
88
+ * @returns Transaction status information
89
+ */
90
+ getTransactionStatus(transactionId: string): Promise<ApiResponse>;
91
+ /**
92
+ * Cancel a pending bundle transaction
93
+ *
94
+ * @param transactionId - Transaction ID to cancel
95
+ * @returns Cancellation result
96
+ */
97
+ cancelTransaction(transactionId: string): Promise<ApiResponse>;
98
+ /**
99
+ * Get bundle service health status
100
+ *
101
+ * @returns Service health information
102
+ */
103
+ getHealthStatus(): Promise<ApiResponse>;
104
+ }
105
+ //# sourceMappingURL=BundleService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BundleService.d.ts","sourceRoot":"","sources":["../../../src/api/services/BundleService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,GAAG,CAAC;IACf,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;;GAEG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,KAAK;IAJf,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAa;gBAGlC,UAAU,EAAE,UAAU,EACtB,KAAK,GAAE,OAAe;IAGhC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,iBAAiB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAmDhF;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiD1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA0B5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;OAKG;IACG,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiCvE;;;;;OAKG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiCpE;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC;CA4B9C"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * EIP-712 Signature Service for Bonding Curve Transactions
3
+ *
4
+ * This service handles EIP-712 signature generation for all wallet types
5
+ * supported by the Gala ecosystem. It replicates the exact signature
6
+ * generation process used in the frontend to ensure compatibility.
7
+ *
8
+ * ## Supported Wallets:
9
+ * - MetaMask (signTypedData)
10
+ * - TrustWallet (signMessage with serialization)
11
+ * - GalaWallet (custom implementation)
12
+ *
13
+ * ## Key Features:
14
+ * - Dynamic EIP-712 type generation
15
+ * - Personal sign prefix calculation
16
+ * - Wallet-specific signature handling
17
+ * - Full compatibility with frontend implementation
18
+ *
19
+ * @category Services
20
+ * @since 2.0.0
21
+ */
22
+ /**
23
+ * Wallet preference enumeration
24
+ */
25
+ export declare enum WalletPreference {
26
+ METAMASK = 0,
27
+ TRUST_WALLET = 1,
28
+ GALA_WALLET = 2
29
+ }
30
+ /**
31
+ * Service for handling EIP-712 signatures for bonding curve operations
32
+ */
33
+ export declare class SignatureService {
34
+ private walletProvider;
35
+ private debug;
36
+ constructor(walletProvider: any, debug?: boolean);
37
+ /**
38
+ * Sign a DTO using EIP-712 with the appropriate wallet method
39
+ *
40
+ * @param dto - The DTO to sign (extends ChainCallDTO)
41
+ * @param methodName - The method name for type generation
42
+ * @param walletAddress - The user's wallet address
43
+ * @param walletPreference - Wallet type preference
44
+ * @returns Signed payload ready for bundle submission
45
+ */
46
+ signDTO(dto: any, methodName: string, walletAddress: string, walletPreference?: WalletPreference): Promise<any>;
47
+ /**
48
+ * Sign with MetaMask/ethers.js using signTypedData
49
+ */
50
+ private signWithMetaMask;
51
+ /**
52
+ * Sign with TrustWallet using signMessage
53
+ */
54
+ private signWithTrustWallet;
55
+ /**
56
+ * Sign with GalaWallet using custom implementation
57
+ * Falls back to MetaMask signing in non-browser environments
58
+ */
59
+ private signWithGalaWallet;
60
+ /**
61
+ * Generate EIP-712 types from DTO structure
62
+ * Dynamically creates type definitions based on DTO fields
63
+ * EXACTLY matches frontend implementation from readWriteUtils.ts
64
+ */
65
+ private generateEIP712Types;
66
+ /**
67
+ * Detect wallet preference from provider
68
+ */
69
+ detectWalletPreference(): WalletPreference;
70
+ }
71
+ //# sourceMappingURL=SignatureService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignatureService.d.ts","sourceRoot":"","sources":["../../../src/api/services/SignatureService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAyBH;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,QAAQ,IAAI;IACZ,YAAY,IAAI;IAChB,WAAW,IAAI;CAChB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,KAAK;gBADL,cAAc,EAAE,GAAG,EACnB,KAAK,GAAE,OAAe;IAGhC;;;;;;;;OAQG;IACG,OAAO,CACX,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,gBAAgB,GAAE,gBAA4C,GAC7D,OAAO,CAAC,GAAG,CAAC;IA4Df;;OAEG;YACW,gBAAgB;IA4B9B;;OAEG;YACW,mBAAmB;IAoBjC;;;OAGG;YACW,kBAAkB;IA8ChC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAyE3B;;OAEG;IACH,sBAAsB,IAAI,gBAAgB;CAmB3C"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * TokenClassKey Service for String Instructions Generation
3
+ *
4
+ * This service handles the generation of stringsInstructions arrays
5
+ * for bundle transactions. It creates the proper resource tracking
6
+ * strings that match the exact format used by the frontend.
7
+ *
8
+ * ## String Instructions Format:
9
+ * 1. launchPadSalePreBuy: $service$[tokenKey]$launchpad
10
+ * 2. memetokenBalancePool: $tokenBalance$[tokenKey]$[vaultAddress]
11
+ * 3. memetokenBalanceUser: $tokenBalance$[tokenKey]$[vaultAddress]
12
+ * 4. poolNativeBalance: $tokenBalance$[galaKey]$[vaultAddress]
13
+ * 5. userNativeBalance: $tokenBalance$[galaKey]$[vaultAddress]
14
+ *
15
+ * ## TokenClassKey Structure:
16
+ * - collection: 'Token' (for launchpad tokens) or 'GALA' (for native)
17
+ * - category: 'Unit'
18
+ * - type: Token symbol or 'none'
19
+ * - additionalKey: 'none'
20
+ *
21
+ * @category Services
22
+ * @since 2.0.0
23
+ */
24
+ import { TokenClassKey } from '@gala-chain/api';
25
+ /**
26
+ * Service for generating TokenClassKey and stringsInstructions
27
+ */
28
+ export declare class TokenClassKeyService {
29
+ private debug;
30
+ constructor(debug?: boolean);
31
+ /**
32
+ * Generate stringsInstructions array for a vault address
33
+ *
34
+ * Creates the 5-element array required for bundle transactions:
35
+ * [launchPadSalePreBuy, memetokenBalancePool, memetokenBalanceUser, poolNativeBalance, userNativeBalance]
36
+ *
37
+ * @param vaultAddress - Vault address in format: service|Token$Unit$SYMBOL$eth:address$launchpad
38
+ * @returns Array of strings for resource tracking
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const instructions = service.generateStringsInstructions(
43
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad'
44
+ * );
45
+ * // Returns:
46
+ * // [
47
+ * // '$service$Token$Unit$ANIME$none$launchpad',
48
+ * // '$tokenBalance$Token$Unit$ANIME$none$service|Token$Unit$ANIME$eth:1234567890$launchpad',
49
+ * // '$tokenBalance$Token$Unit$ANIME$none$service|Token$Unit$ANIME$eth:1234567890$launchpad',
50
+ * // '$tokenBalance$GALA$Unit$none$none$service|Token$Unit$ANIME$eth:1234567890$launchpad',
51
+ * // '$tokenBalance$GALA$Unit$none$none$service|Token$Unit$ANIME$eth:1234567890$launchpad'
52
+ * // ]
53
+ * ```
54
+ */
55
+ generateStringsInstructions(vaultAddress: string): string[];
56
+ /**
57
+ * Create TokenClassKey instance for a token
58
+ * CRITICAL: Uses lowercase token symbol to match frontend format
59
+ *
60
+ * @param tokenSymbol - Token symbol (e.g., 'ANIME', 'CLAUDE') - will be converted to lowercase
61
+ * @returns TokenClassKey instance with lowercase symbol
62
+ * @note This standardizes on lowercase internally regardless of input casing
63
+ */
64
+ createTokenInstance(tokenSymbol: string): TokenClassKey;
65
+ /**
66
+ * Create TokenClassKey instance for GALA (native token)
67
+ *
68
+ * @returns TokenClassKey instance for GALA
69
+ */
70
+ createGalaInstance(): TokenClassKey;
71
+ /**
72
+ * Extract token symbol from vault address
73
+ *
74
+ * @param vaultAddress - Vault address in format: service|Token$Unit$SYMBOL$eth:address$launchpad
75
+ * @returns Token symbol
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const symbol = service.extractTokenSymbolFromVault(
80
+ * 'service|Token$Unit$ANIME$eth:1234567890$launchpad'
81
+ * );
82
+ * // Returns: 'ANIME'
83
+ * ```
84
+ */
85
+ extractTokenSymbolFromVault(vaultAddress: string): string;
86
+ /**
87
+ * Validate vault address format
88
+ *
89
+ * @param vaultAddress - Vault address to validate
90
+ * @returns true if valid, throws error if invalid
91
+ */
92
+ validateVaultAddress(vaultAddress: string): boolean;
93
+ /**
94
+ * Generate TokenClassKey string representation
95
+ *
96
+ * @param collection - Collection name
97
+ * @param category - Category name
98
+ * @param type - Type name
99
+ * @param additionalKey - Additional key
100
+ * @returns String key in format: collection$category$type$additionalKey
101
+ */
102
+ generateTokenClassKeyString(collection: string, category: string, type: string, additionalKey: string): string;
103
+ /**
104
+ * Parse TokenClassKey from string representation
105
+ *
106
+ * @param stringKey - String key in format: collection$category$type$additionalKey
107
+ * @returns Parsed TokenClassKey components
108
+ */
109
+ parseTokenClassKeyString(stringKey: string): {
110
+ collection: string;
111
+ category: string;
112
+ type: string;
113
+ additionalKey: string;
114
+ };
115
+ }
116
+ //# sourceMappingURL=TokenClassKeyService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenClassKeyService.d.ts","sourceRoot":"","sources":["../../../src/api/services/TokenClassKeyService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,KAAK;gBAAL,KAAK,GAAE,OAAe;IAE1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE;IA0C3D;;;;;;;OAOG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa;IAkBvD;;;;OAIG;IACH,kBAAkB,IAAI,aAAa;IAgBnC;;;;;;;;;;;;;OAaG;IACH,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IA4BzD;;;;;OAKG;IACH,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAkCnD;;;;;;;;OAQG;IACH,2BAA2B,CACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB,MAAM;IAIT;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG;QAC3C,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;KACvB;CAaF"}