@gala-chain/launchpad-sdk 4.0.17-beta.8 → 4.0.17-beta.9
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/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +127 -94
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/bridge/constants/tokens.d.ts +31 -1
- package/dist/src/bridge/constants/tokens.d.ts.map +1 -1
- package/dist/src/bridge/types/bridgeable-token.dto.d.ts +0 -34
- package/dist/src/bridge/types/bridgeable-token.dto.d.ts.map +1 -1
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/services/BridgeableTokenService.d.ts +1 -65
- package/dist/src/services/BridgeableTokenService.d.ts.map +1 -1
- package/dist/src/services/WrapService.d.ts +153 -0
- package/dist/src/services/WrapService.d.ts.map +1 -0
- package/dist/src/services/WrappableTokenService.d.ts +1 -61
- package/dist/src/services/WrappableTokenService.d.ts.map +1 -1
- package/dist/src/types/wrappable-token.dto.d.ts +110 -20
- package/dist/src/types/wrappable-token.dto.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WrapService - Cross-channel token wrapping/unwrapping
|
|
3
|
+
*
|
|
4
|
+
* Handles internal GalaChain channel bridges:
|
|
5
|
+
* - Wrap: MUSIC (music channel) → GMUSIC (asset channel)
|
|
6
|
+
* - Unwrap: GMUSIC (asset channel) → MUSIC (music channel)
|
|
7
|
+
*
|
|
8
|
+
* This is different from external bridges (Ethereum/Solana) - wrap/unwrap
|
|
9
|
+
* operates entirely within GalaChain across different channels.
|
|
10
|
+
*
|
|
11
|
+
* @category Services
|
|
12
|
+
* @since 4.0.18
|
|
13
|
+
*/
|
|
14
|
+
import type { WrappableTokenService } from './WrappableTokenService.js';
|
|
15
|
+
import type { SignatureHelper } from '../utils/SignatureHelper.js';
|
|
16
|
+
import type { HttpClient } from '../utils/http.js';
|
|
17
|
+
import { Logger } from '../utils/Logger.js';
|
|
18
|
+
import type { TokenId } from '../types/common.js';
|
|
19
|
+
import type { WrapTokenOptions, UnwrapTokenOptions, WrapUnwrapResult, WrapUnwrapFeeEstimate, WrapUnwrapStatusResult } from '../types/wrappable-token.dto.js';
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for WrapService
|
|
22
|
+
*/
|
|
23
|
+
export interface WrapServiceConfig {
|
|
24
|
+
/** HTTP client for GalaChain gateway */
|
|
25
|
+
http: HttpClient;
|
|
26
|
+
/** WrappableTokenService for token metadata */
|
|
27
|
+
wrappableTokenService: WrappableTokenService;
|
|
28
|
+
/** SignatureHelper for signing transactions */
|
|
29
|
+
signatureHelper?: SignatureHelper;
|
|
30
|
+
/** GalaChain gateway base URL - unused when using HttpClient (has its own baseUrl) */
|
|
31
|
+
galaChainBaseUrl?: string;
|
|
32
|
+
/** Wallet address (for sender) */
|
|
33
|
+
walletAddress?: string;
|
|
34
|
+
/** Logger instance */
|
|
35
|
+
logger?: Logger;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* WrapService - Cross-channel token wrapping/unwrapping
|
|
39
|
+
*
|
|
40
|
+
* Provides methods to wrap tokens from their native channel to the asset channel
|
|
41
|
+
* (e.g., MUSIC → GMUSIC) and unwrap them back (GMUSIC → MUSIC).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Wrap MUSIC to GMUSIC for DEX trading
|
|
46
|
+
* const wrapResult = await wrapService.wrapToken({
|
|
47
|
+
* tokenId: 'MUSIC',
|
|
48
|
+
* amount: '100',
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Unwrap GMUSIC back to MUSIC
|
|
52
|
+
* const unwrapResult = await wrapService.unwrapToken({
|
|
53
|
+
* tokenId: 'GMUSIC',
|
|
54
|
+
* amount: '50',
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare class WrapService {
|
|
59
|
+
private readonly http;
|
|
60
|
+
private readonly wrappableTokenService;
|
|
61
|
+
private readonly signatureHelper;
|
|
62
|
+
private readonly walletAddress;
|
|
63
|
+
private readonly logger;
|
|
64
|
+
constructor(config: WrapServiceConfig);
|
|
65
|
+
/**
|
|
66
|
+
* Wrap a token to its asset-channel counterpart
|
|
67
|
+
*
|
|
68
|
+
* Transfers a token from its native channel to the asset channel.
|
|
69
|
+
* Example: MUSIC (music channel) → GMUSIC (asset channel)
|
|
70
|
+
*
|
|
71
|
+
* @param options - Wrap options including tokenId and amount
|
|
72
|
+
* @returns Promise<WrapUnwrapResult> - Transaction result
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const result = await wrapService.wrapToken({
|
|
77
|
+
* tokenId: 'MUSIC',
|
|
78
|
+
* amount: '100',
|
|
79
|
+
* });
|
|
80
|
+
* console.log(`Wrapped ${result.amount} ${result.fromToken} → ${result.toToken}`);
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @throws {ValidationError} If token is not wrappable or already on asset channel
|
|
84
|
+
*/
|
|
85
|
+
wrapToken(options: WrapTokenOptions): Promise<WrapUnwrapResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Unwrap a token back to its native channel
|
|
88
|
+
*
|
|
89
|
+
* Transfers a token from the asset channel back to its native channel.
|
|
90
|
+
* Example: GMUSIC (asset channel) → MUSIC (music channel)
|
|
91
|
+
*
|
|
92
|
+
* @param options - Unwrap options including tokenId and amount
|
|
93
|
+
* @returns Promise<WrapUnwrapResult> - Transaction result
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const result = await wrapService.unwrapToken({
|
|
98
|
+
* tokenId: 'GMUSIC',
|
|
99
|
+
* amount: '50',
|
|
100
|
+
* });
|
|
101
|
+
* console.log(`Unwrapped ${result.amount} ${result.fromToken} → ${result.toToken}`);
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @throws {ValidationError} If token is not unwrappable or not on asset channel
|
|
105
|
+
*/
|
|
106
|
+
unwrapToken(options: UnwrapTokenOptions): Promise<WrapUnwrapResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Estimate fees for a wrap operation
|
|
109
|
+
*
|
|
110
|
+
* @param tokenId - Token to wrap
|
|
111
|
+
* @param amount - Amount to wrap
|
|
112
|
+
* @returns Promise<WrapUnwrapFeeEstimate> - Fee estimate
|
|
113
|
+
*/
|
|
114
|
+
estimateWrapFee(tokenId: TokenId, _amount: string): Promise<WrapUnwrapFeeEstimate>;
|
|
115
|
+
/**
|
|
116
|
+
* Estimate fees for an unwrap operation
|
|
117
|
+
*
|
|
118
|
+
* @param tokenId - Token to unwrap
|
|
119
|
+
* @param amount - Amount to unwrap
|
|
120
|
+
* @returns Promise<WrapUnwrapFeeEstimate> - Fee estimate
|
|
121
|
+
*/
|
|
122
|
+
estimateUnwrapFee(tokenId: TokenId, _amount: string): Promise<WrapUnwrapFeeEstimate>;
|
|
123
|
+
/**
|
|
124
|
+
* Get status of a wrap/unwrap transaction
|
|
125
|
+
*
|
|
126
|
+
* Uses the same GetBridgeStatus endpoint as external bridges.
|
|
127
|
+
*
|
|
128
|
+
* @param transactionId - Transaction ID to check
|
|
129
|
+
* @returns Promise<WrapUnwrapStatusResult> - Current status
|
|
130
|
+
*/
|
|
131
|
+
getWrapStatus(transactionId: string): Promise<WrapUnwrapStatusResult>;
|
|
132
|
+
/**
|
|
133
|
+
* Execute a cross-channel bridge (wrap or unwrap)
|
|
134
|
+
*/
|
|
135
|
+
private executeChannelBridge;
|
|
136
|
+
/**
|
|
137
|
+
* Determine channel routing for wrap/unwrap operation
|
|
138
|
+
*/
|
|
139
|
+
private determineChannelRouting;
|
|
140
|
+
/**
|
|
141
|
+
* Convert decimal amount to chain amount (multiply by 10^decimals)
|
|
142
|
+
*/
|
|
143
|
+
private toChainAmount;
|
|
144
|
+
/**
|
|
145
|
+
* Validate that a wallet is available for signing
|
|
146
|
+
*/
|
|
147
|
+
private requireWallet;
|
|
148
|
+
/**
|
|
149
|
+
* Format tokenId for error messages
|
|
150
|
+
*/
|
|
151
|
+
private formatTokenId;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=WrapService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrapService.d.ts","sourceRoot":"","sources":["../../../src/services/WrapService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,iCAAiC,CAAC;AAkBzC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,IAAI,EAAE,UAAU,CAAC;IACjB,+CAA+C;IAC/C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,+CAA+C;IAC/C,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAcD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAwB;IAC9D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAE,iBAAiB;IAYrC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgDrE;;;;;;;;;;;;;;;;;;;OAmBG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgDzE;;;;;;OAMG;IACG,eAAe,CACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;IA8BjC;;;;;;OAMG;IACG,iBAAiB,CACrB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;IA8BjC;;;;;;;OAOG;IACG,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAmB3E;;OAEG;YACW,oBAAoB;IA8FlC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA8B/B;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,aAAa;IAUrB;;OAEG;IACH,OAAO,CAAC,aAAa;CAMtB"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { HttpClient } from '../utils/http.js';
|
|
22
22
|
import type { TokenId } from '../types/common.js';
|
|
23
|
-
import type { WrappableToken, FetchWrappableTokensOptions, FetchWrappableTokensResult,
|
|
23
|
+
import type { WrappableToken, FetchWrappableTokensOptions, FetchWrappableTokensResult, IsTokenWrappableResult, WrappableTokenCacheStats } from '../types/wrappable-token.dto.js';
|
|
24
24
|
/**
|
|
25
25
|
* WrappableTokenService
|
|
26
26
|
*
|
|
@@ -132,65 +132,5 @@ export declare class WrappableTokenService {
|
|
|
132
132
|
* @returns Array of transformed wrappable tokens
|
|
133
133
|
*/
|
|
134
134
|
private transformTokens;
|
|
135
|
-
/**
|
|
136
|
-
* Transform API response tokens to SDK format WITH balance
|
|
137
|
-
*
|
|
138
|
-
* @param apiTokens - Raw API response tokens (with balance data)
|
|
139
|
-
* @returns Array of transformed wrappable tokens with balance
|
|
140
|
-
*/
|
|
141
|
-
private transformTokensWithBalance;
|
|
142
|
-
/**
|
|
143
|
-
* Fetch wrappable tokens WITH balance data (paginated)
|
|
144
|
-
*
|
|
145
|
-
* Returns tokens with balance data for the specified wallet address.
|
|
146
|
-
* Preheats the metadata cache while returning user-specific balance data.
|
|
147
|
-
*
|
|
148
|
-
* **Note:** Balance data is never cached (user-specific). Metadata is cached.
|
|
149
|
-
*
|
|
150
|
-
* @param address - Wallet address to get balances for (e.g., "eth|0x...")
|
|
151
|
-
* @param options - Fetch options including offset and limit
|
|
152
|
-
* @returns Promise resolving to fetch result with tokens and balances
|
|
153
|
-
* @throws NetworkError if API request fails
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* const result = await service.fetchWrappableTokenBalances(
|
|
158
|
-
* 'eth|0x1234...',
|
|
159
|
-
* { limit: 20 }
|
|
160
|
-
* );
|
|
161
|
-
* for (const token of result.tokens) {
|
|
162
|
-
* console.log(`${token.symbol}: ${token.balance}`);
|
|
163
|
-
* if (token.wrapCounterpart) {
|
|
164
|
-
* console.log(` Wrap to: ${token.wrapCounterpart.symbol}`);
|
|
165
|
-
* }
|
|
166
|
-
* }
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
fetchWrappableTokenBalances(address: string, options?: FetchWrappableTokenBalancesOptions): Promise<FetchWrappableTokenBalancesResult>;
|
|
170
|
-
/**
|
|
171
|
-
* Fetch ALL wrappable tokens WITH balance data (auto-pagination)
|
|
172
|
-
*
|
|
173
|
-
* Returns all tokens with balance data for the specified wallet address.
|
|
174
|
-
* Automatically handles pagination. Preheats the metadata cache.
|
|
175
|
-
*
|
|
176
|
-
* **Note:** Balance data is never cached (user-specific). Metadata is cached.
|
|
177
|
-
*
|
|
178
|
-
* @param address - Wallet address to get balances for (e.g., "eth|0x...")
|
|
179
|
-
* @returns Promise resolving to fetch result with all tokens and balances
|
|
180
|
-
* @throws NetworkError if API request fails
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* const result = await service.fetchAllWrappableTokenBalances('eth|0x1234...');
|
|
185
|
-
* console.log(`Total wrappable tokens: ${result.tokenCount}`);
|
|
186
|
-
*
|
|
187
|
-
* // Find tokens with non-zero balance
|
|
188
|
-
* const tokensWithBalance = result.tokens.filter(t => t.balance !== '0');
|
|
189
|
-
* for (const token of tokensWithBalance) {
|
|
190
|
-
* console.log(`${token.symbol}: ${token.balance}`);
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
fetchAllWrappableTokenBalances(address: string): Promise<FetchWrappableTokenBalancesResult>;
|
|
195
135
|
}
|
|
196
136
|
//# sourceMappingURL=WrappableTokenService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WrappableTokenService.d.ts","sourceRoot":"","sources":["../../../src/services/WrappableTokenService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAM9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,
|
|
1
|
+
{"version":3,"file":"WrappableTokenService.d.ts","sourceRoot":"","sources":["../../../src/services/WrappableTokenService.ts"],"names":[],"mappings":"AAAA;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
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Options for wrapping a token (e.g., MUSIC → GMUSIC)
|
|
183
183
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
184
|
+
* Wrapping transfers a token from its native channel to the asset channel,
|
|
185
|
+
* converting it to its wrapped counterpart. This is required for tokens
|
|
186
|
+
* like MUSIC to be traded on the DEX.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const result = await sdk.wrapToken({
|
|
191
|
+
* tokenId: 'MUSIC',
|
|
192
|
+
* amount: '100.5',
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
186
195
|
*/
|
|
187
|
-
export interface
|
|
188
|
-
/**
|
|
189
|
-
|
|
196
|
+
export interface WrapTokenOptions {
|
|
197
|
+
/**
|
|
198
|
+
* Token to wrap (source token on native channel).
|
|
199
|
+
*
|
|
200
|
+
* Accepts:
|
|
201
|
+
* - Symbol: "MUSIC"
|
|
202
|
+
* - Pipe-delimited: "$MUSIC|Unit|none|none"
|
|
203
|
+
* - TokenClassKey object: { collection: '$MUSIC', ... }
|
|
204
|
+
*/
|
|
205
|
+
tokenId: TokenId;
|
|
206
|
+
/** Amount to wrap (decimal string, e.g., "100.5") */
|
|
207
|
+
amount: string;
|
|
208
|
+
/** Optional recipient address (defaults to sender) */
|
|
209
|
+
recipient?: string;
|
|
210
|
+
/** Optional memo for the transaction */
|
|
211
|
+
memo?: string;
|
|
190
212
|
}
|
|
191
213
|
/**
|
|
192
|
-
* Options for
|
|
214
|
+
* Options for unwrapping a token (e.g., GMUSIC → MUSIC)
|
|
215
|
+
*
|
|
216
|
+
* Unwrapping transfers a token from the asset channel back to its native
|
|
217
|
+
* channel, converting it from the wrapped version to the original.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const result = await sdk.unwrapToken({
|
|
222
|
+
* tokenId: 'GMUSIC',
|
|
223
|
+
* amount: '50',
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
193
226
|
*/
|
|
194
|
-
export interface
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
227
|
+
export interface UnwrapTokenOptions {
|
|
228
|
+
/**
|
|
229
|
+
* Token to unwrap (wrapped token on asset channel).
|
|
230
|
+
*
|
|
231
|
+
* Accepts:
|
|
232
|
+
* - Symbol: "GMUSIC"
|
|
233
|
+
* - Pipe-delimited: "$GMUSIC|Unit|none|none"
|
|
234
|
+
* - TokenClassKey object: { collection: '$GMUSIC', ... }
|
|
235
|
+
*/
|
|
236
|
+
tokenId: TokenId;
|
|
237
|
+
/** Amount to unwrap (decimal string, e.g., "50") */
|
|
238
|
+
amount: string;
|
|
239
|
+
/** Optional recipient address (defaults to sender) */
|
|
240
|
+
recipient?: string;
|
|
241
|
+
/** Optional memo for the transaction */
|
|
242
|
+
memo?: string;
|
|
199
243
|
}
|
|
200
244
|
/**
|
|
201
|
-
* Result of
|
|
245
|
+
* Result of a wrap or unwrap operation
|
|
202
246
|
*/
|
|
203
|
-
export interface
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
|
|
247
|
+
export interface WrapUnwrapResult {
|
|
248
|
+
/** Whether the operation succeeded */
|
|
249
|
+
success: boolean;
|
|
250
|
+
/** Transaction hash/ID for tracking */
|
|
251
|
+
transactionId?: string;
|
|
252
|
+
/** Source token symbol (e.g., "MUSIC" for wrap, "GMUSIC" for unwrap) */
|
|
253
|
+
fromToken: string;
|
|
254
|
+
/** Destination token symbol (e.g., "GMUSIC" for wrap, "MUSIC" for unwrap) */
|
|
255
|
+
toToken: string;
|
|
256
|
+
/** Amount transferred (decimal string) */
|
|
257
|
+
amount: string;
|
|
258
|
+
/** Source channel name (e.g., "music", "asset") */
|
|
259
|
+
fromChannel: string;
|
|
260
|
+
/** Destination channel name (e.g., "asset", "music") */
|
|
261
|
+
toChannel: string;
|
|
262
|
+
/** Fee paid for the operation (if any) */
|
|
263
|
+
fee?: string;
|
|
264
|
+
/** Timestamp when the operation completed (epoch ms) */
|
|
265
|
+
completedAt?: number;
|
|
266
|
+
/** Error message if operation failed */
|
|
267
|
+
error?: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Fee estimation for wrap/unwrap operations
|
|
271
|
+
*
|
|
272
|
+
* Wrap and unwrap operations may have different fee authorization types:
|
|
273
|
+
* - Wrap (→ asset): Uses `cross_channel_authorization` on source channel
|
|
274
|
+
* - Unwrap (→ native): Uses `automatic` authorization on asset channel
|
|
275
|
+
*/
|
|
276
|
+
export interface WrapUnwrapFeeEstimate {
|
|
277
|
+
/** Estimated fee amount (decimal string) */
|
|
278
|
+
fee: string;
|
|
279
|
+
/** Fee token symbol (usually "GALA") */
|
|
280
|
+
feeToken: string;
|
|
281
|
+
/** Fee authorization type used by the backend */
|
|
282
|
+
authorizationType: 'cross_channel_authorization' | 'automatic';
|
|
283
|
+
/** Channel where the fee is authorized/charged */
|
|
284
|
+
feeChannel: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Status of a wrap/unwrap operation
|
|
288
|
+
*/
|
|
289
|
+
export type WrapUnwrapStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
290
|
+
/**
|
|
291
|
+
* Extended result with status polling information
|
|
292
|
+
*/
|
|
293
|
+
export interface WrapUnwrapStatusResult extends WrapUnwrapResult {
|
|
294
|
+
/** Current status of the operation */
|
|
295
|
+
status: WrapUnwrapStatus;
|
|
296
|
+
/** Number of confirmations (if applicable) */
|
|
297
|
+
confirmations?: number;
|
|
298
|
+
/** Estimated time remaining in ms (if available) */
|
|
299
|
+
estimatedTimeRemainingMs?: number;
|
|
210
300
|
}
|
|
211
301
|
//# sourceMappingURL=wrappable-token.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrappable-token.dto.d.ts","sourceRoot":"","sources":["../../../src/types/wrapp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AC;IAChB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,gCAAgC;IAChC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;OASG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAMD
|
|
1
|
+
{"version":3,"file":"wrappable-token.dto.d.ts","sourceRoot":"","sources":["../../../src/types/wrappable-token.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,0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AAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,iBAAiB,EAAE,6BAA6B,GAAG,WAAW,CAAC;IAC/D,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,YAAY,GACZ,WAAW,GACX,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,sCAAsC;IACtC,MAAM,EAAE,gBAAgB,CAAC;IACzB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad-sdk",
|
|
3
|
-
"version": "4.0.17-beta.
|
|
3
|
+
"version": "4.0.17-beta.9",
|
|
4
4
|
"description": "TypeScript SDK for Gala Launchpad Backend API - 100+ public methods with 373+ fully documented APIs supporting optional wallet (read-only and full-access modes). Production-ready DeFi token launchpad integration with AgentConfig setup, GalaChain trading, GSwap DEX integration, price history, token creation, DEX pool discovery, WebSocket event watchers, and comprehensive user operations. Multi-format output (ESM, CJS, UMD).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -117,6 +117,9 @@
|
|
|
117
117
|
"demo:bridge:balances": "tsx examples/bridge/wallet-balances.ts",
|
|
118
118
|
"demo:bridge:bridgeable": "tsx examples/bridge/bridgeable-tokens.ts",
|
|
119
119
|
"demo:bridge:tx-status": "tsx examples/bridge/transaction-status.ts",
|
|
120
|
+
"demo:wrap": "tsx examples/bridge/wrap-unwrap.ts",
|
|
121
|
+
"demo:wrap:discovery": "tsx examples/bridge/wrap-discovery.ts",
|
|
122
|
+
"demo:wrap:fees": "tsx examples/bridge/wrap-fee-estimation.ts",
|
|
120
123
|
"test:demos:core": "npm run demo && npm run demo:read-only && npm run demo:authenticated && npm run demo:privatekey-override",
|
|
121
124
|
"test:demos:dex": "npm run demo:dex:pools && npm run demo:dex:pricing && npm run demo:dex:quotes && npm run demo:dex && npm run demo:dex:roundtrip",
|
|
122
125
|
"test:demos:liquidity": "npm run demo:liquidity:all",
|