@gala-chain/launchpad-sdk 3.31.2 → 4.0.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.
- package/API.md +524 -4
- package/CHANGELOG.md +92 -0
- package/EXAMPLES.md +845 -0
- package/README.md +421 -14
- package/dist/LaunchpadSDK.d.ts +435 -18
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/api/LaunchpadAPI.d.ts.map +1 -1
- package/dist/constants/version.generated.d.ts +1 -1
- package/dist/constants/version.generated.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/services/CommentService.d.ts.map +1 -1
- package/dist/services/DexBackendClient.d.ts +46 -0
- package/dist/services/DexBackendClient.d.ts.map +1 -0
- package/dist/services/DexPoolService.d.ts +54 -12
- package/dist/services/DexPoolService.d.ts.map +1 -1
- package/dist/services/DexQuoteService.d.ts +288 -0
- package/dist/services/DexQuoteService.d.ts.map +1 -0
- package/dist/services/GSwapService.d.ts +468 -38
- package/dist/services/GSwapService.d.ts.map +1 -1
- package/dist/services/GalaChainGatewayClient.d.ts +89 -0
- package/dist/services/GalaChainGatewayClient.d.ts.map +1 -0
- package/dist/services/GalaChainService.d.ts +26 -0
- package/dist/services/GalaChainService.d.ts.map +1 -1
- package/dist/services/PoolStateManager.d.ts +176 -0
- package/dist/services/PoolStateManager.d.ts.map +1 -0
- package/dist/services/SignatureService.d.ts +13 -35
- package/dist/services/SignatureService.d.ts.map +1 -1
- package/dist/services/WebSocketService.d.ts +98 -0
- package/dist/services/WebSocketService.d.ts.map +1 -1
- package/dist/services/__mocks__/logger.mock.d.ts +17 -0
- package/dist/services/__mocks__/logger.mock.d.ts.map +1 -0
- package/dist/types/common.d.ts +2 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/composite-pool.dto.d.ts +103 -0
- package/dist/types/composite-pool.dto.d.ts.map +1 -0
- package/dist/types/dex-pool.dto.d.ts +56 -5
- package/dist/types/dex-pool.dto.d.ts.map +1 -1
- package/dist/types/dto.d.ts +6 -6
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/types/eip712-types.d.ts +140 -0
- package/dist/types/eip712-types.d.ts.map +1 -0
- package/dist/types/galachain-api.types.d.ts +206 -0
- package/dist/types/galachain-api.types.d.ts.map +1 -0
- package/dist/types/gswap-responses.types.d.ts +366 -0
- package/dist/types/gswap-responses.types.d.ts.map +1 -0
- package/dist/types/gswap.dto.d.ts +58 -3
- package/dist/types/gswap.dto.d.ts.map +1 -1
- package/dist/types/launchpad.dto.d.ts +57 -0
- package/dist/types/launchpad.dto.d.ts.map +1 -1
- package/dist/types/pool-state-delta.dto.d.ts +246 -0
- package/dist/types/pool-state-delta.dto.d.ts.map +1 -0
- package/dist/types/pool-state-manager-config.dto.d.ts +103 -0
- package/dist/types/pool-state-manager-config.dto.d.ts.map +1 -0
- package/dist/utils/auto-pagination.d.ts +74 -0
- package/dist/utils/auto-pagination.d.ts.map +1 -1
- package/dist/utils/bignumber-helpers.d.ts +75 -3
- package/dist/utils/bignumber-helpers.d.ts.map +1 -1
- package/dist/utils/bignumber-pool-cache.d.ts +169 -0
- package/dist/utils/bignumber-pool-cache.d.ts.map +1 -0
- package/dist/utils/composite-pool-converter.d.ts +121 -0
- package/dist/utils/composite-pool-converter.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +86 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/load-env.d.ts +31 -0
- package/dist/utils/load-env.d.ts.map +1 -0
- package/dist/utils/pool-pair-parser.d.ts +55 -0
- package/dist/utils/pool-pair-parser.d.ts.map +1 -0
- package/dist/utils/pool-state-validator.d.ts +207 -0
- package/dist/utils/pool-state-validator.d.ts.map +1 -0
- package/dist/utils/position-filters.d.ts +253 -0
- package/dist/utils/position-filters.d.ts.map +1 -0
- package/dist/utils/swap-delta-calculator.d.ts +231 -0
- package/dist/utils/swap-delta-calculator.d.ts.map +1 -0
- package/dist/utils/tick-crossing-handler.d.ts +250 -0
- package/dist/utils/tick-crossing-handler.d.ts.map +1 -0
- package/dist/utils/token-format-converter.d.ts +10 -3
- package/dist/utils/token-format-converter.d.ts.map +1 -1
- package/dist/utils/token-parser.d.ts +235 -0
- package/dist/utils/token-parser.d.ts.map +1 -0
- package/dist/utils/transfer-validation.d.ts.map +1 -1
- package/package.json +36 -15
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composite Pool Data Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Complete pool state required for offline DEX quote calculations.
|
|
5
|
+
* Integrates @gala-chain/dex types with SDK patterns.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { TokenBalance } from '@gala-chain/api';
|
|
10
|
+
import type { Pool, TickData, CompositePoolDto } from '@gala-chain/dex';
|
|
11
|
+
/**
|
|
12
|
+
* Options for fetching composite pool data
|
|
13
|
+
* @category DEX Pools
|
|
14
|
+
*/
|
|
15
|
+
export interface FetchCompositePoolDataOptions {
|
|
16
|
+
/** First token in the pair */
|
|
17
|
+
token0: string;
|
|
18
|
+
/** Second token in the pair */
|
|
19
|
+
token1: string;
|
|
20
|
+
/** Fee tier (500 = 0.05%, 3000 = 0.30%, 10000 = 1.00%) */
|
|
21
|
+
fee: number;
|
|
22
|
+
/** Optional: Use GalaChain mainnet (default) or custom gateway URL */
|
|
23
|
+
gatewayBaseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Composite pool data result
|
|
27
|
+
* Contains complete pool state for offline calculations
|
|
28
|
+
* @category DEX Pools
|
|
29
|
+
*/
|
|
30
|
+
export interface CompositePoolDataResult {
|
|
31
|
+
/** Pool instance with liquidity and price data */
|
|
32
|
+
pool: Pool;
|
|
33
|
+
/** Tick data map for liquidity calculations */
|
|
34
|
+
tickDataMap: Record<string, TickData>;
|
|
35
|
+
/** Token0 balance in the pool */
|
|
36
|
+
token0Balance: TokenBalance;
|
|
37
|
+
/** Token1 balance in the pool */
|
|
38
|
+
token1Balance: TokenBalance;
|
|
39
|
+
/** Token0 decimal precision */
|
|
40
|
+
token0Decimals: number;
|
|
41
|
+
/** Token1 decimal precision */
|
|
42
|
+
token1Decimals: number;
|
|
43
|
+
/** Raw CompositePoolDto for advanced usage */
|
|
44
|
+
compositePoolDto: CompositePoolDto;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for DEX pool quote calculations
|
|
48
|
+
*
|
|
49
|
+
* REQUIRED: Composite pool data must be fetched first via fetchCompositePoolData()
|
|
50
|
+
* This enables true offline quote calculations using local bonding curve math.
|
|
51
|
+
*
|
|
52
|
+
* @category DEX Quotes
|
|
53
|
+
*/
|
|
54
|
+
export interface CalculateDexPoolQuoteOptions {
|
|
55
|
+
/**
|
|
56
|
+
* REQUIRED: Pre-fetched composite pool data from fetchCompositePoolData()
|
|
57
|
+
*
|
|
58
|
+
* This contains the complete pool state needed for local offline quote calculations.
|
|
59
|
+
* Composite data is fetched separately and reused for multiple quote calculations.
|
|
60
|
+
*/
|
|
61
|
+
compositePoolData: CompositePoolDataResult;
|
|
62
|
+
/** Token to trade from (full pipe-delimited format: "GALA|Unit|none|none") */
|
|
63
|
+
fromToken: string;
|
|
64
|
+
/** Token to trade to (full pipe-delimited format: "Token|Unit|SYMBOL|additionalKey") */
|
|
65
|
+
toToken: string;
|
|
66
|
+
/** Amount to trade (in token base units) */
|
|
67
|
+
amount: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* DEX pool quote calculation result
|
|
71
|
+
* @category DEX Quotes
|
|
72
|
+
*/
|
|
73
|
+
export interface DexPoolQuoteResult {
|
|
74
|
+
/** Input amount (tokens spent) */
|
|
75
|
+
amount0: string;
|
|
76
|
+
/** Output amount (tokens received) */
|
|
77
|
+
amount1: string;
|
|
78
|
+
/** Square root price before swap */
|
|
79
|
+
currentSqrtPrice: string;
|
|
80
|
+
/** Square root price after swap */
|
|
81
|
+
newSqrtPrice: string;
|
|
82
|
+
/** Price impact percentage (optional) */
|
|
83
|
+
priceImpact?: string;
|
|
84
|
+
/** Execution price (output per unit input) (optional) */
|
|
85
|
+
executionPrice?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Raw response from GalaChain GetCompositePool API
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export interface GetCompositePoolResponse {
|
|
92
|
+
Status: number;
|
|
93
|
+
Message: string;
|
|
94
|
+
Data: {
|
|
95
|
+
pool: any;
|
|
96
|
+
tickDataMap: Record<string, any>;
|
|
97
|
+
token0Balance: any;
|
|
98
|
+
token1Balance: any;
|
|
99
|
+
token0Decimals: number;
|
|
100
|
+
token1Decimals: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=composite-pool.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composite-pool.dto.d.ts","sourceRoot":"","sources":["../../src/types/composite-pool.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IAEZ,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,kDAAkD;IAClD,IAAI,EAAE,IAAI,CAAC;IAEX,+C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 -7,9 +7,10 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* Complete DEX pool data structure (
|
|
10
|
+
* Complete DEX pool data structure (21 fields from backend + optional pricing)
|
|
11
11
|
*
|
|
12
12
|
* Represents a single liquidity pool on the GalaSwap DEX with full metrics.
|
|
13
|
+
* Pricing fields are optional and populated via quote-based enrichment when requested.
|
|
13
14
|
*/
|
|
14
15
|
export interface DexPoolData {
|
|
15
16
|
/** Pool identifier (e.g., "GALA|Unit|none|none/GUSDC|Unit|none|none/10000") */
|
|
@@ -24,10 +25,6 @@ export interface DexPoolData {
|
|
|
24
25
|
token0Image: string;
|
|
25
26
|
/** Second token image URL */
|
|
26
27
|
token1Image: string;
|
|
27
|
-
/** First token price in terms of second token */
|
|
28
|
-
token0Price: string;
|
|
29
|
-
/** Second token price in terms of first token */
|
|
30
|
-
token1Price: string;
|
|
31
28
|
/** Human-readable pool name (e.g., "GALA/GUSDC") */
|
|
32
29
|
poolName: string;
|
|
33
30
|
/** Fee tier as percentage string (e.g., "0.3", "1") */
|
|
@@ -52,6 +49,24 @@ export interface DexPoolData {
|
|
|
52
49
|
dayPerTvl: number;
|
|
53
50
|
/** 1-day APR percentage (calculated from fees) */
|
|
54
51
|
apr1d: number;
|
|
52
|
+
/**
|
|
53
|
+
* First token price in USD (optional, quote-based enrichment)
|
|
54
|
+
*
|
|
55
|
+
* Derived from `getSwapQuoteExactInput(token0, 'GUSDC', '1')` when `withPrices: true`.
|
|
56
|
+
* Not populated by default - use withPrices option to enable.
|
|
57
|
+
*
|
|
58
|
+
* @optional
|
|
59
|
+
*/
|
|
60
|
+
token0Price?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Second token price in USD (optional, quote-based enrichment)
|
|
63
|
+
*
|
|
64
|
+
* Derived from `getSwapQuoteExactInput(token1, 'GUSDC', '1')` when `withPrices: true`.
|
|
65
|
+
* Not populated by default - use withPrices option to enable.
|
|
66
|
+
*
|
|
67
|
+
* @optional
|
|
68
|
+
*/
|
|
69
|
+
token1Price?: string;
|
|
55
70
|
}
|
|
56
71
|
/**
|
|
57
72
|
* Backend-validated sort field options
|
|
@@ -135,6 +150,41 @@ export interface FetchDexPoolsOptions {
|
|
|
135
150
|
* @optional
|
|
136
151
|
*/
|
|
137
152
|
limit?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Enrich pools with real-time token pricing via quote-based enrichment
|
|
155
|
+
*
|
|
156
|
+
* When enabled, each pool is enriched with `token0Price` and `token1Price` fields
|
|
157
|
+
* derived from `getSwapQuoteExactInput(token, 'GUSDC', '1')` to determine USD prices.
|
|
158
|
+
*
|
|
159
|
+
* Pricing is done in parallel with configurable concurrency (default: 5).
|
|
160
|
+
* Failed pricing requests degrade gracefully - pools without prices still include
|
|
161
|
+
* all other metrics (TVL, volume, APR).
|
|
162
|
+
*
|
|
163
|
+
* Default: false (no pricing enrichment)
|
|
164
|
+
*
|
|
165
|
+
* Performance overhead:
|
|
166
|
+
* - 20 pools: ~200-500ms additional
|
|
167
|
+
* - 100 pools: ~1-2 seconds additional
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Fetch pools with pricing
|
|
172
|
+
* const result = await sdk.fetchDexPools({
|
|
173
|
+
* sortBy: 'tvl',
|
|
174
|
+
* limit: 20,
|
|
175
|
+
* withPrices: true // Enable quote-based pricing enrichment
|
|
176
|
+
* });
|
|
177
|
+
*
|
|
178
|
+
* result.pools.forEach(pool => {
|
|
179
|
+
* const token0Price = pool.token0Price || 'N/A';
|
|
180
|
+
* const token1Price = pool.token1Price || 'N/A';
|
|
181
|
+
* console.log(`${pool.poolName}: ${token0Price} / ${token1Price}`);
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @optional
|
|
186
|
+
*/
|
|
187
|
+
withPrices?: boolean;
|
|
138
188
|
}
|
|
139
189
|
/**
|
|
140
190
|
* Clean result for paginated DEX pool queries
|
|
@@ -171,4 +221,5 @@ export interface DexPoolsResult {
|
|
|
171
221
|
/** Whether there are pages before current */
|
|
172
222
|
hasPrevious: boolean;
|
|
173
223
|
}
|
|
224
|
+
export type { FetchCompositePoolDataOptions, CompositePoolDataResult, CalculateDexPoolQuoteOptions, DexPoolQuoteResult, GetCompositePoolResponse, } from './composite-pool.dto';
|
|
174
225
|
//# sourceMappingURL=dex-pool.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dex-pool.dto.d.ts","sourceRoot":"","sources":["../../src/types/dex-pool.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH
|
|
1
|
+
{"version":3,"file":"dex-pool.dto.d.ts","sourceRoot":"","sources":["../../src/types/dex-pool.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IAEf,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IAEpB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IAEjB,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;IAEZ,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAElB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAElB,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IAErB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IAErB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IAEZ,iCAAiC;IACjC,QAA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AAO,CAAC;CACtB;AAGD,YAAY,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
|
package/dist/types/dto.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export declare class CreateSaleDto extends ChainCallDTO {
|
|
|
16
16
|
readonly tokenDescription: string;
|
|
17
17
|
readonly tokenImage: string;
|
|
18
18
|
readonly preBuyQuantity: string;
|
|
19
|
-
readonly websiteUrl
|
|
20
|
-
readonly telegramUrl
|
|
21
|
-
readonly twitterUrl
|
|
19
|
+
readonly websiteUrl?: string;
|
|
20
|
+
readonly telegramUrl?: string;
|
|
21
|
+
readonly twitterUrl?: string;
|
|
22
22
|
readonly tokenCategory: string;
|
|
23
23
|
readonly tokenCollection: string;
|
|
24
24
|
readonly reverseBondingCurveConfiguration?: {
|
|
@@ -32,9 +32,9 @@ export declare class CreateSaleDto extends ChainCallDTO {
|
|
|
32
32
|
tokenDescription: string;
|
|
33
33
|
tokenImage: string;
|
|
34
34
|
preBuyQuantity: string;
|
|
35
|
-
websiteUrl
|
|
36
|
-
telegramUrl
|
|
37
|
-
twitterUrl
|
|
35
|
+
websiteUrl?: string;
|
|
36
|
+
telegramUrl?: string;
|
|
37
|
+
twitterUrl?: string;
|
|
38
38
|
tokenCategory: string;
|
|
39
39
|
tokenCollection: string;
|
|
40
40
|
reverseBondingCurveConfiguration?: {
|
package/dist/types/dto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../src/types/dto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,SAAgB,SAAS,EAAE,MAAM,CAA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AC;CACH;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAmBxF;AAMD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized EIP-712 Type Definitions for Bundler Operations
|
|
3
|
+
*
|
|
4
|
+
* These type definitions are used for EIP-712 signing with ethers.js for all bundler operations.
|
|
5
|
+
* They are manually defined (not auto-generated) because SigningClient auto-generation incorrectly
|
|
6
|
+
* uses uint256 for ALL numeric fields, which rejects negative tick values. These definitions
|
|
7
|
+
* use int256 for tick values to properly support negative ticks.
|
|
8
|
+
*
|
|
9
|
+
* EIP-712 Specification: https://eips.ethereum.org/EIPS/eip-712
|
|
10
|
+
* GalaChain Bundler Documentation: https://docs.galachain.com/bundler/signing (when available)
|
|
11
|
+
* GalaChain API Reference: https://docs.galachain.com/bundler/api
|
|
12
|
+
*
|
|
13
|
+
* Integration Points:
|
|
14
|
+
* - Used by GSwapService.sendAddLiquidityToBundler()
|
|
15
|
+
* - Used by GSwapService.sendRemoveLiquidityToBundler()
|
|
16
|
+
* - Used by GSwapService.sendCollectPositionFeesToBundler()
|
|
17
|
+
* - Used by GSwapService.sendSwapToBundler()
|
|
18
|
+
*
|
|
19
|
+
* Key Design Decisions:
|
|
20
|
+
* - Token field order (additionalKey, category, collection, type) must be consistent across all types
|
|
21
|
+
* to ensure proper token identification in bundler state locking
|
|
22
|
+
* - All tick boundaries (tickLower, tickUpper) use int256 to support negative Uniswap V3 ticks
|
|
23
|
+
* (UQ64.96 encoding requires int256, not uint256)
|
|
24
|
+
* - String amounts (not numeric) to preserve decimal precision across JavaScript/Solidity boundary
|
|
25
|
+
* - Unique domain configuration: { name: 'ethereum', chainId: 1 } for GalaChain compatibility
|
|
26
|
+
* - All operations require prefix field added by calculatePersonalSignPrefix() for bundler validation
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* EIP-712 types for AddLiquidity operation
|
|
30
|
+
*
|
|
31
|
+
* Used when creating a new liquidity position with price or tick boundaries.
|
|
32
|
+
* Creates a concentrated liquidity position in a Uniswap V3 pool.
|
|
33
|
+
*
|
|
34
|
+
* Reference: GalaChain Bundler API - AddLiquidity
|
|
35
|
+
* See: https://docs.galachain.com/bundler/api (when available)
|
|
36
|
+
*/
|
|
37
|
+
export declare const ADD_LIQUIDITY_EIP712_TYPES: {
|
|
38
|
+
AddLiquidity: {
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
}[];
|
|
42
|
+
token0: {
|
|
43
|
+
name: string;
|
|
44
|
+
type: string;
|
|
45
|
+
}[];
|
|
46
|
+
token1: {
|
|
47
|
+
name: string;
|
|
48
|
+
type: string;
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* EIP-712 types for RemoveLiquidity operation
|
|
53
|
+
*
|
|
54
|
+
* Used when closing a liquidity position and withdrawing tokens.
|
|
55
|
+
* Removes liquidity from a Uniswap V3 position and returns the underlying tokens.
|
|
56
|
+
*
|
|
57
|
+
* Reference: GalaChain Bundler API - RemoveLiquidity
|
|
58
|
+
* See: https://docs.galachain.com/bundler/api (when available)
|
|
59
|
+
*/
|
|
60
|
+
export declare const REMOVE_LIQUIDITY_EIP712_TYPES: {
|
|
61
|
+
RemoveLiquidity: {
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
}[];
|
|
65
|
+
token0: {
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
}[];
|
|
69
|
+
token1: {
|
|
70
|
+
name: string;
|
|
71
|
+
type: string;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* EIP-712 types for CollectPositionFees operation
|
|
76
|
+
*
|
|
77
|
+
* Used when collecting accumulated trading fees from a liquidity position.
|
|
78
|
+
* Extracts protocol fees earned by the position during trades without modifying liquidity.
|
|
79
|
+
*
|
|
80
|
+
* Reference: GalaChain Bundler API - CollectPositionFees
|
|
81
|
+
* See: https://docs.galachain.com/bundler/api (when available)
|
|
82
|
+
*/
|
|
83
|
+
export declare const COLLECT_FEES_EIP712_TYPES: {
|
|
84
|
+
CollectPositionFees: {
|
|
85
|
+
name: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}[];
|
|
88
|
+
token0: {
|
|
89
|
+
name: string;
|
|
90
|
+
type: string;
|
|
91
|
+
}[];
|
|
92
|
+
token1: {
|
|
93
|
+
name: string;
|
|
94
|
+
type: string;
|
|
95
|
+
}[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* EIP-712 types for Swap operation
|
|
99
|
+
*
|
|
100
|
+
* Used when swapping tokens on GalaSwap DEX.
|
|
101
|
+
* Executes a token swap on a Uniswap V3 pool with slippage protection.
|
|
102
|
+
*
|
|
103
|
+
* Reference: GalaChain Bundler API - Swap
|
|
104
|
+
* See: https://docs.galachain.com/bundler/api (when available)
|
|
105
|
+
*/
|
|
106
|
+
export declare const SWAP_EIP712_TYPES: {
|
|
107
|
+
Swap: {
|
|
108
|
+
name: string;
|
|
109
|
+
type: string;
|
|
110
|
+
}[];
|
|
111
|
+
token0: {
|
|
112
|
+
name: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}[];
|
|
115
|
+
token1: {
|
|
116
|
+
name: string;
|
|
117
|
+
type: string;
|
|
118
|
+
}[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Standard EIP-712 domain configuration
|
|
122
|
+
*
|
|
123
|
+
* Used consistently across all bundler operations for signature validation.
|
|
124
|
+
* Domain identifies the signing context (application name and chain).
|
|
125
|
+
*
|
|
126
|
+
* Configuration:
|
|
127
|
+
* - name: 'ethereum' - Identifies as Ethereum domain (GalaChain convention)
|
|
128
|
+
* - chainId: 1 - References Ethereum mainnet chainId (GalaChain signing context)
|
|
129
|
+
*
|
|
130
|
+
* This domain ensures that signatures cannot be replayed across different networks
|
|
131
|
+
* or applications. All bundler operations must use this exact domain.
|
|
132
|
+
*
|
|
133
|
+
* Reference: EIP-712 Domain Separator
|
|
134
|
+
* See: https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator
|
|
135
|
+
*/
|
|
136
|
+
export declare const EIP712_DOMAIN: {
|
|
137
|
+
name: string;
|
|
138
|
+
chainId: number;
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=eip712-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712-types.d.ts","sourceRoot":"","sources":["../../src/types/eip712-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CA2BtC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;CAyBzC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;CAwBrC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAwB7B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa;;;CAAmC,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GalaChain Gateway and DEX Backend API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive, fully-typed definitions for all API responses from:
|
|
5
|
+
* - GalaChain Gateway (DEX contract endpoints)
|
|
6
|
+
* - DEX Backend API
|
|
7
|
+
*
|
|
8
|
+
* Zero `any` types, complete type safety across all API operations.
|
|
9
|
+
*/
|
|
10
|
+
import BigNumber from 'bignumber.js';
|
|
11
|
+
/**
|
|
12
|
+
* GalaChain Gateway response wrapper
|
|
13
|
+
* All Gateway responses wrap the actual data in this structure
|
|
14
|
+
*/
|
|
15
|
+
export interface GalaChainGatewayResponse<T> {
|
|
16
|
+
Data: T;
|
|
17
|
+
Status: number;
|
|
18
|
+
Message?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Token class key structure used in API responses
|
|
22
|
+
*/
|
|
23
|
+
export interface TokenClassKey {
|
|
24
|
+
collection: string;
|
|
25
|
+
category: string;
|
|
26
|
+
type: string;
|
|
27
|
+
additionalKey: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Pool data from GetPoolData endpoint
|
|
31
|
+
* Complete Uniswap V3 pool state including tick, liquidity, fees
|
|
32
|
+
*/
|
|
33
|
+
export interface GalaChainPoolData {
|
|
34
|
+
token0: TokenClassKey;
|
|
35
|
+
token1: TokenClassKey;
|
|
36
|
+
fee: number;
|
|
37
|
+
tickSpacing: number;
|
|
38
|
+
liquidity: string;
|
|
39
|
+
sqrtPriceX96: string;
|
|
40
|
+
tick: number;
|
|
41
|
+
feeGrowthGlobal0X128: string;
|
|
42
|
+
feeGrowthGlobal1X128: string;
|
|
43
|
+
maxLiquidityPerTick?: string;
|
|
44
|
+
observations?: Array<{
|
|
45
|
+
blockTimestamp: number;
|
|
46
|
+
tickCumulative: number;
|
|
47
|
+
secondsPerLiquidityCumulativeX128: string;
|
|
48
|
+
initialized: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
currentPrice?: string;
|
|
51
|
+
token0Decimals?: number;
|
|
52
|
+
token1Decimals?: number;
|
|
53
|
+
initialized?: boolean;
|
|
54
|
+
poolAddress?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Individual position data from GetPositions endpoint
|
|
58
|
+
* Represents a concentrated liquidity position in a pool
|
|
59
|
+
*/
|
|
60
|
+
export interface GalaChainPosition {
|
|
61
|
+
positionId: string;
|
|
62
|
+
owner: string;
|
|
63
|
+
token0: TokenClassKey;
|
|
64
|
+
token1: TokenClassKey;
|
|
65
|
+
fee: number;
|
|
66
|
+
tickLower: number;
|
|
67
|
+
tickUpper: number;
|
|
68
|
+
liquidity: string;
|
|
69
|
+
feeGrowthInside0LastX128: string;
|
|
70
|
+
feeGrowthInside1LastX128: string;
|
|
71
|
+
tokensOwed0: string;
|
|
72
|
+
tokensOwed1: string;
|
|
73
|
+
amount0?: string;
|
|
74
|
+
amount1?: string;
|
|
75
|
+
feeAmount0?: string;
|
|
76
|
+
feeAmount1?: string;
|
|
77
|
+
createdAt?: number;
|
|
78
|
+
updatedAt?: number;
|
|
79
|
+
operator?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Response from GetPositions endpoint
|
|
83
|
+
* Can return multiple positions for a wallet/criteria
|
|
84
|
+
*/
|
|
85
|
+
export interface GalaChainGetPositionsResponse {
|
|
86
|
+
positions: GalaChainPosition[];
|
|
87
|
+
count: number;
|
|
88
|
+
totalLiquidity?: string;
|
|
89
|
+
totalValue?: string;
|
|
90
|
+
nextBookMark?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Estimated amounts when removing liquidity
|
|
94
|
+
* From GetRemoveLiquidityEstimation endpoint
|
|
95
|
+
*/
|
|
96
|
+
export interface GalaChainRemoveLiquidityEstimation {
|
|
97
|
+
amount0: string;
|
|
98
|
+
amount1: string;
|
|
99
|
+
fee0: string;
|
|
100
|
+
fee1: string;
|
|
101
|
+
liquidity: string;
|
|
102
|
+
tickLower: number;
|
|
103
|
+
tickUpper: number;
|
|
104
|
+
currentPrice?: string;
|
|
105
|
+
token0Symbol?: string;
|
|
106
|
+
token1Symbol?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* User asset from DEX Backend API
|
|
110
|
+
* Represents a token in a user's wallet on the DEX
|
|
111
|
+
*/
|
|
112
|
+
export interface DexBackendUserAsset {
|
|
113
|
+
tokenId: TokenClassKey | string;
|
|
114
|
+
symbol: string;
|
|
115
|
+
name: string;
|
|
116
|
+
decimals: number;
|
|
117
|
+
balance: string | BigNumber;
|
|
118
|
+
contractAddress?: string;
|
|
119
|
+
imageUrl?: string;
|
|
120
|
+
verified?: boolean;
|
|
121
|
+
trading?: boolean;
|
|
122
|
+
walletAddress?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Response from DEX Backend getUserAssets endpoint
|
|
126
|
+
* List of all tokens user holds on the DEX
|
|
127
|
+
*/
|
|
128
|
+
export interface DexBackendUserAssetsResponse {
|
|
129
|
+
tokens: DexBackendUserAsset[];
|
|
130
|
+
count: number;
|
|
131
|
+
totalValue?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Request to GetPoolData endpoint
|
|
135
|
+
*/
|
|
136
|
+
export interface GalaChainGetPoolDataRequest {
|
|
137
|
+
tokenA: TokenClassKey | string;
|
|
138
|
+
tokenB: TokenClassKey | string;
|
|
139
|
+
feeTier: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Request to GetPositions endpoint
|
|
143
|
+
* Multiple query filters supported
|
|
144
|
+
*/
|
|
145
|
+
export interface GalaChainGetPositionsRequest {
|
|
146
|
+
owner?: string;
|
|
147
|
+
tokenA?: TokenClassKey | string;
|
|
148
|
+
tokenB?: TokenClassKey | string;
|
|
149
|
+
feeTier?: number;
|
|
150
|
+
positionId?: string;
|
|
151
|
+
limit?: number;
|
|
152
|
+
bookmark?: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Request to GetRemoveLiquidityEstimation endpoint
|
|
156
|
+
*/
|
|
157
|
+
export interface GalaChainGetRemoveLiquidityEstimationRequest {
|
|
158
|
+
tokenA: TokenClassKey | string;
|
|
159
|
+
tokenB: TokenClassKey | string;
|
|
160
|
+
fee: number;
|
|
161
|
+
tickLower: number;
|
|
162
|
+
tickUpper: number;
|
|
163
|
+
liquidity: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Request to DEX Backend getUserAssets endpoint
|
|
167
|
+
*/
|
|
168
|
+
export interface DexBackendGetUserAssetsRequest {
|
|
169
|
+
walletAddress: string;
|
|
170
|
+
limit?: number;
|
|
171
|
+
offset?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Standard API error response
|
|
175
|
+
*/
|
|
176
|
+
export interface ApiErrorResponse {
|
|
177
|
+
Status: number;
|
|
178
|
+
Message: string;
|
|
179
|
+
Data?: Record<string, unknown>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Parsed error with context
|
|
183
|
+
*/
|
|
184
|
+
export declare class ApiError extends Error {
|
|
185
|
+
readonly status: number;
|
|
186
|
+
readonly message: string;
|
|
187
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
188
|
+
constructor(status: number, message: string, details?: Record<string, unknown> | undefined);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Check if value is a TokenClassKey
|
|
192
|
+
*/
|
|
193
|
+
export declare function isTokenClassKey(value: unknown): value is TokenClassKey;
|
|
194
|
+
/**
|
|
195
|
+
* Check if value is a GalaChainPoolData response
|
|
196
|
+
*/
|
|
197
|
+
export declare function isGalaChainPoolData(value: unknown): value is GalaChainPoolData;
|
|
198
|
+
/**
|
|
199
|
+
* Check if value is a GalaChainPosition
|
|
200
|
+
*/
|
|
201
|
+
export declare function isGalaChainPosition(value: unknown): value is GalaChainPosition;
|
|
202
|
+
/**
|
|
203
|
+
* Check if value is a DexBackendUserAsset
|
|
204
|
+
*/
|
|
205
|
+
export declare function isDexBackendUserAsset(value: unknown): value is DexBackendUserAsset;
|
|
206
|
+
//# sourceMappingURL=galachain-api.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"galachain-api.types.d.ts","sourceRoot":"","sources":["../../src/types/galachain-api.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAMD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEhC,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IAGtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IAGpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAG7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,iCAAiC,EAAE,MAAM,CAAC;QAC1C,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC,CAAC;IAGH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD;;;GAGG;AACH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