@dzapio/sdk 2.0.38 → 2.0.39
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.d.mts +671 -669
- package/dist/index.d.ts +671 -669
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -153,782 +153,784 @@ declare const AllowanceTypes: {
|
|
|
153
153
|
};
|
|
154
154
|
type AllowanceType = (typeof AllowanceTypes)[keyof typeof AllowanceTypes];
|
|
155
155
|
|
|
156
|
-
declare
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
kind: AddressKind;
|
|
166
|
-
isNative: boolean;
|
|
167
|
-
isToken: boolean;
|
|
168
|
-
isContract: boolean;
|
|
169
|
-
address: string;
|
|
156
|
+
declare const zapPathAction: {
|
|
157
|
+
readonly swap: "swap";
|
|
158
|
+
readonly bridge: "bridge";
|
|
159
|
+
readonly deposit: "deposit";
|
|
160
|
+
readonly withdraw: "withdraw";
|
|
161
|
+
readonly stake: "stake";
|
|
162
|
+
readonly unstake: "unstake";
|
|
163
|
+
readonly increase: "increase";
|
|
164
|
+
readonly harvest: "harvest";
|
|
170
165
|
};
|
|
171
166
|
|
|
172
|
-
type
|
|
173
|
-
type
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
};
|
|
177
|
-
type NativeTokenInfo = {
|
|
178
|
-
contract: string;
|
|
167
|
+
type ZapPathAction = keyof typeof zapPathAction;
|
|
168
|
+
type ZapPathAsset = {
|
|
169
|
+
chainId: number;
|
|
170
|
+
address: HexString;
|
|
179
171
|
symbol: string;
|
|
172
|
+
logo: string;
|
|
180
173
|
decimals: number;
|
|
174
|
+
price: string;
|
|
175
|
+
type: string;
|
|
181
176
|
name: string;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
logo: string;
|
|
185
|
-
isErc20?: boolean;
|
|
186
|
-
};
|
|
187
|
-
declare const contractErrorActions: {
|
|
188
|
-
readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
|
|
189
|
-
readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
|
|
190
|
-
readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
|
|
191
|
-
};
|
|
192
|
-
type ContractErrorResponse = {
|
|
193
|
-
status: string;
|
|
194
|
-
txId: string;
|
|
195
|
-
code: number;
|
|
196
|
-
message: string;
|
|
197
|
-
error: unknown;
|
|
198
|
-
action: keyof typeof contractErrorActions;
|
|
199
|
-
details?: unknown;
|
|
177
|
+
provider?: ProviderDetails;
|
|
178
|
+
underlyingTokens?: ZapUnderlyingToken[];
|
|
200
179
|
};
|
|
201
|
-
type
|
|
202
|
-
|
|
180
|
+
type ZapPath = {
|
|
181
|
+
action: ZapPathAction;
|
|
182
|
+
protocol: ProviderDetails;
|
|
183
|
+
fee: ZapFee[];
|
|
184
|
+
estimatedDuration: number;
|
|
185
|
+
input: {
|
|
186
|
+
asset: ZapPathAsset;
|
|
203
187
|
amount: string;
|
|
204
|
-
|
|
205
|
-
decimals: number;
|
|
188
|
+
amountUSD: string;
|
|
206
189
|
}[];
|
|
207
|
-
|
|
190
|
+
output: {
|
|
191
|
+
asset: ZapPathAsset;
|
|
208
192
|
amount: string;
|
|
209
|
-
|
|
210
|
-
|
|
193
|
+
amountUSD: string;
|
|
194
|
+
minAmount: string;
|
|
211
195
|
}[];
|
|
212
|
-
providers: string[];
|
|
213
|
-
chainId: number;
|
|
214
|
-
account: string;
|
|
215
|
-
txType: 'swap' | 'bridge';
|
|
216
196
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
rpcProviders: ApiRpcResponse[];
|
|
231
|
-
pricingAvailable: boolean;
|
|
232
|
-
balanceAvailable: boolean;
|
|
233
|
-
supportedAs: {
|
|
234
|
-
source: boolean;
|
|
235
|
-
destination: boolean;
|
|
236
|
-
};
|
|
237
|
-
contracts?: Partial<{
|
|
238
|
-
router: string;
|
|
239
|
-
dca: string;
|
|
240
|
-
zap: string;
|
|
241
|
-
}>;
|
|
242
|
-
coingecko?: {
|
|
243
|
-
chainKey: string;
|
|
244
|
-
nativeTokenKey: string;
|
|
245
|
-
};
|
|
246
|
-
defiLlama?: {
|
|
247
|
-
chainKey: string;
|
|
248
|
-
nativeTokenKey: string;
|
|
249
|
-
};
|
|
250
|
-
disableMultiTxn: boolean;
|
|
251
|
-
isEnabled: boolean;
|
|
252
|
-
mainnet: boolean;
|
|
253
|
-
tags?: Tag[];
|
|
254
|
-
version?: ContractVersion;
|
|
197
|
+
|
|
198
|
+
declare const chainTypes: {
|
|
199
|
+
readonly evm: "evm";
|
|
200
|
+
readonly bvm: "bvm";
|
|
201
|
+
readonly svm: "svm";
|
|
202
|
+
readonly aptosvm: "aptosvm";
|
|
203
|
+
readonly cosmos: "cosmos";
|
|
204
|
+
readonly nearvm: "nearvm";
|
|
205
|
+
readonly starknetvm: "starknetvm";
|
|
206
|
+
readonly stellarvm: "stellarvm";
|
|
207
|
+
readonly suivm: "suivm";
|
|
208
|
+
readonly tonvm: "tonvm";
|
|
209
|
+
readonly tronvm: "tronvm";
|
|
255
210
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
|
|
211
|
+
|
|
212
|
+
declare const zapStepAction: {
|
|
213
|
+
readonly execute: "execute";
|
|
260
214
|
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
215
|
+
|
|
216
|
+
type StepAction = keyof typeof zapStepAction;
|
|
217
|
+
type ZapEvmTxnDetails = {
|
|
218
|
+
type: typeof chainTypes.evm;
|
|
219
|
+
txnId: HexString;
|
|
220
|
+
callData: HexString;
|
|
221
|
+
callTo: HexString;
|
|
222
|
+
value: string;
|
|
223
|
+
estimatedGas: string;
|
|
265
224
|
};
|
|
266
|
-
type
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
symbol: string;
|
|
271
|
-
logo?: string;
|
|
272
|
-
amount: string;
|
|
273
|
-
amountUSD: string;
|
|
274
|
-
included: boolean;
|
|
225
|
+
type ZapBvmTxnDetails = {
|
|
226
|
+
type: typeof chainTypes.bvm;
|
|
227
|
+
txnId: HexString;
|
|
228
|
+
data: string;
|
|
275
229
|
};
|
|
276
|
-
type
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
230
|
+
type SVMTxnDetails = {
|
|
231
|
+
type: typeof chainTypes.svm;
|
|
232
|
+
txnId: HexString;
|
|
233
|
+
data: string[];
|
|
234
|
+
blockhash?: {
|
|
235
|
+
blockhash: string;
|
|
236
|
+
lastValidBlockHeight: number;
|
|
237
|
+
};
|
|
238
|
+
estimatedGas: string;
|
|
239
|
+
isJitoTx?: boolean;
|
|
280
240
|
};
|
|
281
|
-
type
|
|
282
|
-
type
|
|
283
|
-
|
|
284
|
-
|
|
241
|
+
type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
|
|
242
|
+
type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
|
|
243
|
+
action: StepAction;
|
|
244
|
+
data: T;
|
|
285
245
|
};
|
|
286
|
-
type
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
data: TradeQuotesRequestData[];
|
|
291
|
-
disableEstimation?: boolean;
|
|
292
|
-
account?: string;
|
|
293
|
-
bridges?: ProtocolFilter;
|
|
294
|
-
dexes?: ProtocolFilter;
|
|
295
|
-
filter?: QuoteFilter;
|
|
296
|
-
timingStrategy?: Partial<{
|
|
297
|
-
minWaitTimeMs: number;
|
|
298
|
-
maxWaitTimeMs: number;
|
|
299
|
-
subsequentDelayMs: number;
|
|
300
|
-
preferredResultCount: number;
|
|
301
|
-
relaxMinSuccessOnDelay: boolean;
|
|
302
|
-
}>;
|
|
246
|
+
type ZapStep = ZapTransactionStep;
|
|
247
|
+
|
|
248
|
+
type ZapRouteRequestPositionDetails = {
|
|
249
|
+
nftId: string;
|
|
303
250
|
};
|
|
304
|
-
type
|
|
305
|
-
|
|
251
|
+
type ZapRouteRequestPoolDetails = {
|
|
252
|
+
lowerTick: number;
|
|
253
|
+
upperTick: number;
|
|
254
|
+
metadata?: unknown;
|
|
255
|
+
};
|
|
256
|
+
type ZapIntegratorConfig = {
|
|
257
|
+
id: string;
|
|
258
|
+
feeBps: number;
|
|
259
|
+
wallet: string;
|
|
260
|
+
};
|
|
261
|
+
type ZapBuildTxnResponse = {
|
|
262
|
+
approvalData: {
|
|
263
|
+
callTo: HexString;
|
|
264
|
+
approveTo: HexString;
|
|
265
|
+
amount: string;
|
|
266
|
+
}[];
|
|
267
|
+
dust: ZapPath['output'];
|
|
268
|
+
output: ZapPath['output'];
|
|
269
|
+
steps: ZapStep[];
|
|
270
|
+
path: ZapPath[];
|
|
271
|
+
};
|
|
272
|
+
type ZapBuildTxnRequest = {
|
|
306
273
|
srcToken: string;
|
|
307
|
-
|
|
274
|
+
srcChainId: number;
|
|
308
275
|
destToken: string;
|
|
309
|
-
|
|
310
|
-
|
|
276
|
+
destChainId: number;
|
|
277
|
+
recipient: string;
|
|
278
|
+
refundee: string;
|
|
311
279
|
slippage: number;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
280
|
+
account: string;
|
|
281
|
+
integrator?: ZapIntegratorConfig;
|
|
282
|
+
permitData?: string;
|
|
283
|
+
amount?: string;
|
|
284
|
+
estimateGas?: boolean;
|
|
285
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
286
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
287
|
+
allowedBridges?: string[];
|
|
288
|
+
allowedDexes?: string[];
|
|
320
289
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
srcAmount: string;
|
|
326
|
-
srcAmountUSD: string;
|
|
327
|
-
destToken: Token;
|
|
328
|
-
destAmount: string;
|
|
329
|
-
destAmountUSD: string;
|
|
330
|
-
fee: Fee;
|
|
290
|
+
|
|
291
|
+
type ZapBundleSrcToken = {
|
|
292
|
+
address: string;
|
|
293
|
+
amount?: string;
|
|
331
294
|
};
|
|
332
|
-
type
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
295
|
+
type ZapBundleAction = {
|
|
296
|
+
action: ZapPathAction;
|
|
297
|
+
srcToken: ZapBundleSrcToken | ZapBundleSrcToken[];
|
|
298
|
+
srcChainId: number;
|
|
299
|
+
destToken?: string;
|
|
300
|
+
destChainId?: number;
|
|
301
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
302
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
303
|
+
protocol?: string;
|
|
336
304
|
};
|
|
337
|
-
type
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
fee: Fee;
|
|
349
|
-
priceImpactPercent: string;
|
|
350
|
-
duration: string;
|
|
351
|
-
gasless: boolean;
|
|
352
|
-
steps: TradeStep[];
|
|
353
|
-
path: TradePath[];
|
|
354
|
-
tags?: Tag[];
|
|
355
|
-
additionalInfo?: AdditionalInfo;
|
|
305
|
+
type ZapBundleRequest = {
|
|
306
|
+
actions: ZapBundleAction[];
|
|
307
|
+
account: string;
|
|
308
|
+
recipient: string;
|
|
309
|
+
refundee: string;
|
|
310
|
+
slippage: number;
|
|
311
|
+
quotesOnly?: boolean;
|
|
312
|
+
estimateGas?: boolean;
|
|
313
|
+
integrator?: ZapIntegratorConfig;
|
|
314
|
+
allowedDexes?: string[];
|
|
315
|
+
allowedBridges?: string[];
|
|
356
316
|
};
|
|
357
|
-
|
|
358
|
-
|
|
317
|
+
|
|
318
|
+
type ZapPoolDetailsRequest = {
|
|
319
|
+
address: HexString;
|
|
320
|
+
chainId: number;
|
|
321
|
+
provider: string;
|
|
359
322
|
};
|
|
360
|
-
type
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
fastestSource?: string;
|
|
366
|
-
bestReturnSource: string;
|
|
367
|
-
questSource?: string;
|
|
368
|
-
quoteRates?: TradeQuotesByProviderId;
|
|
369
|
-
tokensWithoutPrice: Record<number, string[]>;
|
|
370
|
-
};
|
|
323
|
+
type ZapPoolsRequest = {
|
|
324
|
+
chainId: number;
|
|
325
|
+
provider: string;
|
|
326
|
+
limit?: number;
|
|
327
|
+
offset?: number;
|
|
371
328
|
};
|
|
372
|
-
type
|
|
373
|
-
|
|
329
|
+
type ZapPoolsResponse = {
|
|
330
|
+
pools: ZapPool[];
|
|
331
|
+
pages: number;
|
|
332
|
+
limit: number;
|
|
333
|
+
offset: number;
|
|
374
334
|
};
|
|
375
|
-
type
|
|
376
|
-
address:
|
|
377
|
-
decimals: number;
|
|
335
|
+
type ZapPool = {
|
|
336
|
+
address: string;
|
|
378
337
|
chainId: number;
|
|
379
|
-
|
|
338
|
+
name: string;
|
|
339
|
+
provider: string;
|
|
340
|
+
underlyingAssets: ZapUnderlyingToken[];
|
|
341
|
+
tvl: string;
|
|
342
|
+
apr: number;
|
|
343
|
+
metadata?: unknown;
|
|
380
344
|
symbol: string;
|
|
381
|
-
|
|
345
|
+
decimals: number;
|
|
382
346
|
};
|
|
383
|
-
type
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
permit2: {
|
|
391
|
-
supported: boolean;
|
|
347
|
+
type ZapPoolDetails = {
|
|
348
|
+
address: string;
|
|
349
|
+
slot0: {
|
|
350
|
+
sqrtPriceX96: string;
|
|
351
|
+
tick: number;
|
|
352
|
+
tickSpacing: number;
|
|
392
353
|
};
|
|
393
354
|
};
|
|
394
|
-
|
|
355
|
+
|
|
356
|
+
type ZapPositionsRequest = {
|
|
357
|
+
account: HexString;
|
|
395
358
|
chainId: number;
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
359
|
+
provider: string;
|
|
360
|
+
};
|
|
361
|
+
type ZapPosition = {
|
|
362
|
+
underlyingAssets: ZapUnderlyingTokenWithAmount[];
|
|
363
|
+
address: string;
|
|
364
|
+
apr: number;
|
|
365
|
+
name: string;
|
|
366
|
+
chainId: number;
|
|
367
|
+
provider: string;
|
|
368
|
+
amount: string;
|
|
369
|
+
amountUSD: string;
|
|
370
|
+
nftDetails?: {
|
|
371
|
+
id: string;
|
|
372
|
+
manager: HexString;
|
|
404
373
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
type TokenResponse = {
|
|
408
|
-
[key: string]: TokenInfo;
|
|
374
|
+
metadata?: unknown;
|
|
375
|
+
decimals: number;
|
|
409
376
|
};
|
|
410
|
-
type
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
fromChain: number;
|
|
414
|
-
gasless: boolean;
|
|
415
|
-
private?: boolean;
|
|
416
|
-
disableEstimation?: boolean;
|
|
417
|
-
data: TradeBuildTxnRequestData[];
|
|
418
|
-
hasPermit2ApprovalForAllTokens?: boolean;
|
|
419
|
-
publicKey?: string;
|
|
377
|
+
type ZapPositionsResponse = {
|
|
378
|
+
positions: ZapPosition[];
|
|
379
|
+
count: number;
|
|
420
380
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
destToken: string;
|
|
426
|
-
destDecimals?: number;
|
|
427
|
-
toChain: number;
|
|
428
|
-
protocol: string;
|
|
381
|
+
|
|
382
|
+
type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
|
|
383
|
+
type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
|
|
384
|
+
refundee: string;
|
|
429
385
|
recipient: string;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
386
|
+
account: string;
|
|
387
|
+
}>;
|
|
388
|
+
|
|
389
|
+
type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED' | 'REFUNDED';
|
|
390
|
+
type ZapStatusAsset = {
|
|
391
|
+
asset: ZapPathAsset;
|
|
392
|
+
amount: string;
|
|
393
|
+
amountUSD: string;
|
|
434
394
|
};
|
|
435
|
-
type
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
395
|
+
type ZapStatusStep = {
|
|
396
|
+
chainId: number;
|
|
397
|
+
hash?: string;
|
|
398
|
+
status: ZapStatus;
|
|
399
|
+
action: string;
|
|
400
|
+
protocol: ProviderDetails;
|
|
401
|
+
input: ZapStatusAsset[];
|
|
402
|
+
output: ZapStatusAsset[];
|
|
442
403
|
};
|
|
443
|
-
type
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
404
|
+
type ZapStatusResponse = {
|
|
405
|
+
status: ZapStatus;
|
|
406
|
+
account: string;
|
|
407
|
+
recipient: string;
|
|
408
|
+
input: ZapStatusAsset[];
|
|
409
|
+
output: ZapStatusAsset[];
|
|
410
|
+
steps: ZapStatusStep[];
|
|
411
|
+
timestamp: number;
|
|
412
|
+
completedAt: number;
|
|
449
413
|
};
|
|
450
|
-
type
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
blockhash?: string;
|
|
454
|
-
lastValidBlockHeight?: number;
|
|
414
|
+
type ZapStatusRequest = {
|
|
415
|
+
chainId: number;
|
|
416
|
+
txnHash: string;
|
|
455
417
|
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
418
|
+
|
|
419
|
+
type ZapProviders = Record<string, ProviderDetails>;
|
|
420
|
+
type ZapChains = {
|
|
421
|
+
[key: string]: {
|
|
422
|
+
name: string;
|
|
423
|
+
supportedProviders: string[];
|
|
424
|
+
};
|
|
462
425
|
};
|
|
463
|
-
type
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
426
|
+
type ZapFee = {
|
|
427
|
+
amount: string;
|
|
428
|
+
amountUSD: string;
|
|
429
|
+
asset: ZapPathAsset;
|
|
430
|
+
included: boolean;
|
|
467
431
|
};
|
|
468
|
-
type
|
|
469
|
-
type TxRequestData<T> = {
|
|
470
|
-
status: typeof STATUS.success;
|
|
471
|
-
txId: string;
|
|
432
|
+
type ZapUnderlyingToken = {
|
|
472
433
|
chainId: number;
|
|
473
|
-
|
|
434
|
+
address: HexString;
|
|
435
|
+
name?: string;
|
|
436
|
+
symbol: string;
|
|
437
|
+
decimals: number;
|
|
438
|
+
logo?: string | null;
|
|
474
439
|
};
|
|
475
|
-
type
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
private: boolean;
|
|
479
|
-
};
|
|
480
|
-
type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
|
|
481
|
-
data: string;
|
|
482
|
-
from: string;
|
|
483
|
-
to?: string;
|
|
484
|
-
value?: string;
|
|
485
|
-
gasLimit?: string;
|
|
486
|
-
svmTxData?: {
|
|
487
|
-
blockhash: string;
|
|
488
|
-
lastValidBlockHeight: number;
|
|
489
|
-
};
|
|
490
|
-
btcTxData?: {
|
|
491
|
-
inputs: PsbtInput[];
|
|
492
|
-
outputs: PsbtOutput[];
|
|
493
|
-
feeRate: number;
|
|
494
|
-
};
|
|
495
|
-
btclnTxData?: BtclnTxData;
|
|
496
|
-
additionalInfo: Record<string, Record<string, unknown>>;
|
|
497
|
-
updatedQuotes: Record<string, string>;
|
|
498
|
-
};
|
|
499
|
-
type BridgeGaslessTxData = {
|
|
500
|
-
executorFeesHash: HexString;
|
|
501
|
-
swapDataHash?: HexString;
|
|
502
|
-
adapterDataHash: HexString;
|
|
503
|
-
txType: typeof GaslessTxType.bridge;
|
|
504
|
-
value: string;
|
|
505
|
-
};
|
|
506
|
-
type SwapGaslessTxData = {
|
|
507
|
-
executorFeesHash: HexString;
|
|
508
|
-
swapDataHash: HexString;
|
|
509
|
-
txType: typeof GaslessTxType.swap;
|
|
510
|
-
value: string;
|
|
511
|
-
};
|
|
512
|
-
type GaslessTradeBuildTxnResponse = {
|
|
513
|
-
status: 'success';
|
|
514
|
-
txId: HexString;
|
|
515
|
-
transaction: BridgeGaslessTxData | SwapGaslessTxData;
|
|
516
|
-
quotes: Record<string, ParamQuotes>;
|
|
517
|
-
gasless: true;
|
|
518
|
-
onlySwapData: false;
|
|
440
|
+
type ZapUnderlyingTokenWithAmount = ZapUnderlyingToken & {
|
|
441
|
+
amount: string;
|
|
442
|
+
amountUSD: string;
|
|
519
443
|
};
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
444
|
+
|
|
445
|
+
declare enum AddressKind {
|
|
446
|
+
INVALID = "invalid",
|
|
447
|
+
NATIVE = "native",
|
|
448
|
+
TOKEN = "token",
|
|
449
|
+
CONTRACT = "contract",
|
|
450
|
+
WALLET = "wallet"
|
|
451
|
+
}
|
|
452
|
+
type AddressClassifyResult = {
|
|
453
|
+
valid: boolean;
|
|
454
|
+
kind: AddressKind;
|
|
455
|
+
isNative: boolean;
|
|
456
|
+
isToken: boolean;
|
|
457
|
+
isContract: boolean;
|
|
458
|
+
address: string;
|
|
531
459
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
returnToAmount: bigint;
|
|
460
|
+
|
|
461
|
+
type HexString = `0x${string}`;
|
|
462
|
+
type StatusResponse = keyof typeof STATUS_RESPONSE;
|
|
463
|
+
type ChainData = {
|
|
464
|
+
[key in number]: Chain;
|
|
538
465
|
};
|
|
539
|
-
type
|
|
466
|
+
type NativeTokenInfo = {
|
|
540
467
|
contract: string;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
asset: StatusAsset;
|
|
549
|
-
amount: string;
|
|
550
|
-
amountUSD: number;
|
|
551
|
-
txHash: string;
|
|
552
|
-
account: string;
|
|
553
|
-
};
|
|
554
|
-
type TxStatusForPair = {
|
|
555
|
-
source: TransactionInfo;
|
|
556
|
-
destination: TransactionInfo & {
|
|
557
|
-
timestamp?: number;
|
|
558
|
-
};
|
|
559
|
-
expected?: Omit<TransactionInfo, 'txHash' | 'status'>;
|
|
560
|
-
status: StatusResponse;
|
|
561
|
-
provider: ProviderDetails;
|
|
562
|
-
allowUserTxOnDestChain: boolean;
|
|
563
|
-
message?: string;
|
|
564
|
-
protocolExplorerLink?: string;
|
|
565
|
-
};
|
|
566
|
-
type TradeStatusResponse = {
|
|
567
|
-
status: StatusResponse;
|
|
568
|
-
gasless: boolean;
|
|
569
|
-
txHash: string;
|
|
570
|
-
chainId: number;
|
|
571
|
-
timestamp: number;
|
|
572
|
-
transactions: TxStatusForPair[];
|
|
468
|
+
symbol: string;
|
|
469
|
+
decimals: number;
|
|
470
|
+
name: string;
|
|
471
|
+
balance: string;
|
|
472
|
+
price?: string;
|
|
473
|
+
logo: string;
|
|
474
|
+
isErc20?: boolean;
|
|
573
475
|
};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
srcToken: HexString;
|
|
579
|
-
amount: string;
|
|
580
|
-
permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
|
|
476
|
+
declare const contractErrorActions: {
|
|
477
|
+
readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
|
|
478
|
+
readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
|
|
479
|
+
readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
|
|
581
480
|
};
|
|
582
|
-
type
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
481
|
+
type ContractErrorResponse = {
|
|
482
|
+
status: string;
|
|
483
|
+
txId: string;
|
|
484
|
+
code: number;
|
|
485
|
+
message: string;
|
|
486
|
+
error: unknown;
|
|
487
|
+
action: keyof typeof contractErrorActions;
|
|
488
|
+
details?: unknown;
|
|
589
489
|
};
|
|
590
|
-
type
|
|
591
|
-
|
|
592
|
-
chainId: number;
|
|
593
|
-
sender: HexString;
|
|
594
|
-
signer: WalletClient | Signer;
|
|
595
|
-
tokens: {
|
|
596
|
-
address: HexString;
|
|
597
|
-
permitData?: HexString;
|
|
490
|
+
type CalculatePointsRequest = {
|
|
491
|
+
srcTokens: {
|
|
598
492
|
amount: string;
|
|
599
|
-
|
|
493
|
+
address: string;
|
|
494
|
+
decimals: number;
|
|
600
495
|
}[];
|
|
601
|
-
|
|
602
|
-
rpcUrls: string[];
|
|
603
|
-
permitType: PermitMode;
|
|
604
|
-
isBatchPermitAllowed?: boolean;
|
|
605
|
-
signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
|
|
606
|
-
service: AvailableDZapServices;
|
|
607
|
-
contractVersion: ContractVersion;
|
|
608
|
-
};
|
|
609
|
-
type GasSignatureParams = SignatureParamsBase & {
|
|
610
|
-
gasless: false;
|
|
611
|
-
};
|
|
612
|
-
type SignPermitResponse = {
|
|
613
|
-
status: TxnStatus.success;
|
|
614
|
-
code: StatusCodes;
|
|
615
|
-
tokens: {
|
|
616
|
-
address: HexString;
|
|
617
|
-
permitData?: HexString;
|
|
496
|
+
destTokens: {
|
|
618
497
|
amount: string;
|
|
498
|
+
address: string;
|
|
499
|
+
decimals: number;
|
|
619
500
|
}[];
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
batchPermitData: HexString;
|
|
625
|
-
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
626
|
-
} | {
|
|
627
|
-
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
628
|
-
code: StatusCodes;
|
|
629
|
-
permitType: PermitMode;
|
|
501
|
+
providers: string[];
|
|
502
|
+
chainId: number;
|
|
503
|
+
account: string;
|
|
504
|
+
txType: 'swap' | 'bridge';
|
|
630
505
|
};
|
|
631
|
-
type
|
|
632
|
-
|
|
633
|
-
txId: string;
|
|
506
|
+
type Chain = {
|
|
507
|
+
coinKey: string;
|
|
634
508
|
chainId: number;
|
|
635
|
-
|
|
509
|
+
chainType: string;
|
|
510
|
+
name: string;
|
|
511
|
+
coin: string;
|
|
512
|
+
dcaContract: string;
|
|
513
|
+
swapBridgeContract: string;
|
|
514
|
+
logo: string;
|
|
515
|
+
tokenlistUrl?: string;
|
|
516
|
+
multicallAddress?: HexString;
|
|
517
|
+
blockExplorerUrl: string;
|
|
518
|
+
nativeToken: NativeTokenInfo;
|
|
519
|
+
rpcProviders: ApiRpcResponse[];
|
|
520
|
+
pricingAvailable: boolean;
|
|
521
|
+
balanceAvailable: boolean;
|
|
522
|
+
supportedAs: {
|
|
523
|
+
source: boolean;
|
|
524
|
+
destination: boolean;
|
|
525
|
+
};
|
|
526
|
+
contracts?: Partial<{
|
|
527
|
+
router: string;
|
|
528
|
+
dca: string;
|
|
529
|
+
zap: string;
|
|
530
|
+
}>;
|
|
531
|
+
coingecko?: {
|
|
532
|
+
chainKey: string;
|
|
533
|
+
nativeTokenKey: string;
|
|
534
|
+
};
|
|
535
|
+
defiLlama?: {
|
|
536
|
+
chainKey: string;
|
|
537
|
+
nativeTokenKey: string;
|
|
538
|
+
};
|
|
539
|
+
disableMultiTxn: boolean;
|
|
540
|
+
isEnabled: boolean;
|
|
541
|
+
mainnet: boolean;
|
|
542
|
+
tags?: Tag[];
|
|
543
|
+
version?: ContractVersion;
|
|
636
544
|
};
|
|
637
|
-
type
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
642
|
-
message: string;
|
|
545
|
+
type ApiRpcResponse = {
|
|
546
|
+
url: string;
|
|
547
|
+
keyRequired: boolean;
|
|
548
|
+
keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
|
|
643
549
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
readonly deposit: "deposit";
|
|
649
|
-
readonly withdraw: "withdraw";
|
|
650
|
-
readonly stake: "stake";
|
|
651
|
-
readonly unstake: "unstake";
|
|
652
|
-
readonly increase: "increase";
|
|
653
|
-
readonly harvest: "harvest";
|
|
550
|
+
type ProviderDetails = {
|
|
551
|
+
id: string;
|
|
552
|
+
name: string;
|
|
553
|
+
icon: string;
|
|
654
554
|
};
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
555
|
+
type FeeDetails = {
|
|
556
|
+
address: string;
|
|
557
|
+
decimals: number;
|
|
658
558
|
chainId: number;
|
|
659
|
-
address: HexString;
|
|
660
559
|
symbol: string;
|
|
661
|
-
logo
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
560
|
+
logo?: string;
|
|
561
|
+
amount: string;
|
|
562
|
+
amountUSD: string;
|
|
563
|
+
included: boolean;
|
|
564
|
+
};
|
|
565
|
+
type Fee = {
|
|
566
|
+
gasFee: FeeDetails[];
|
|
567
|
+
protocolFee: FeeDetails[];
|
|
568
|
+
providerFee: FeeDetails[];
|
|
569
|
+
};
|
|
570
|
+
type QuoteFilter = keyof typeof QuoteFilters;
|
|
571
|
+
type ProtocolFilter = {
|
|
572
|
+
allow?: string[];
|
|
573
|
+
deny?: string[];
|
|
574
|
+
};
|
|
575
|
+
type TradeQuotesRequest = {
|
|
576
|
+
fromChain: number;
|
|
577
|
+
gasless?: boolean;
|
|
578
|
+
private?: boolean;
|
|
579
|
+
data: TradeQuotesRequestData[];
|
|
580
|
+
disableEstimation?: boolean;
|
|
581
|
+
account?: string;
|
|
582
|
+
bridges?: ProtocolFilter;
|
|
583
|
+
dexes?: ProtocolFilter;
|
|
584
|
+
filter?: QuoteFilter;
|
|
585
|
+
timingStrategy?: Partial<{
|
|
586
|
+
minWaitTimeMs: number;
|
|
587
|
+
maxWaitTimeMs: number;
|
|
588
|
+
subsequentDelayMs: number;
|
|
589
|
+
preferredResultCount: number;
|
|
590
|
+
relaxMinSuccessOnDelay: boolean;
|
|
591
|
+
}>;
|
|
592
|
+
};
|
|
593
|
+
type TradeQuotesRequestData = {
|
|
594
|
+
amount: string;
|
|
595
|
+
srcToken: string;
|
|
596
|
+
srcDecimals?: number;
|
|
597
|
+
destToken: string;
|
|
598
|
+
destDecimals?: number;
|
|
599
|
+
toChain: number;
|
|
600
|
+
slippage: number;
|
|
601
|
+
selectedSource?: string;
|
|
668
602
|
};
|
|
669
|
-
type
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
asset: ZapPathAsset;
|
|
676
|
-
amount: string;
|
|
677
|
-
amountUSD: string;
|
|
678
|
-
}[];
|
|
679
|
-
output: {
|
|
680
|
-
asset: ZapPathAsset;
|
|
681
|
-
amount: string;
|
|
682
|
-
amountUSD: string;
|
|
683
|
-
minAmount: string;
|
|
684
|
-
}[];
|
|
603
|
+
type TradeStep = {
|
|
604
|
+
type: string;
|
|
605
|
+
exchange: {
|
|
606
|
+
logo: string;
|
|
607
|
+
name: string;
|
|
608
|
+
};
|
|
685
609
|
};
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
readonly suivm: "suivm";
|
|
697
|
-
readonly tonvm: "tonvm";
|
|
698
|
-
readonly tronvm: "tronvm";
|
|
610
|
+
type TradePath = {
|
|
611
|
+
type: string;
|
|
612
|
+
exchange: ProviderDetails;
|
|
613
|
+
srcToken: Token;
|
|
614
|
+
srcAmount: string;
|
|
615
|
+
srcAmountUSD: string;
|
|
616
|
+
destToken: Token;
|
|
617
|
+
destAmount: string;
|
|
618
|
+
destAmountUSD: string;
|
|
619
|
+
fee: Fee;
|
|
699
620
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
621
|
+
type Tag = {
|
|
622
|
+
title: string;
|
|
623
|
+
link?: string;
|
|
624
|
+
message?: string;
|
|
703
625
|
};
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
626
|
+
type TradeQuote = {
|
|
627
|
+
bridgeDetails?: ProviderDetails;
|
|
628
|
+
providerDetails: ProviderDetails;
|
|
629
|
+
srcAmount: string;
|
|
630
|
+
srcAmountUSD: string;
|
|
631
|
+
destAmount: string;
|
|
632
|
+
destAmountUSD: string;
|
|
633
|
+
minDestAmount: string;
|
|
634
|
+
swapPerUnit: string;
|
|
635
|
+
srcToken: Token;
|
|
636
|
+
destToken: Token;
|
|
637
|
+
fee: Fee;
|
|
638
|
+
priceImpactPercent: string;
|
|
639
|
+
duration: string;
|
|
640
|
+
gasless: boolean;
|
|
641
|
+
steps: TradeStep[];
|
|
642
|
+
path: TradePath[];
|
|
643
|
+
tags?: Tag[];
|
|
644
|
+
additionalInfo?: AdditionalInfo;
|
|
713
645
|
};
|
|
714
|
-
type
|
|
715
|
-
|
|
716
|
-
txnId: HexString;
|
|
717
|
-
data: string;
|
|
646
|
+
type TradeQuotesByProviderId = {
|
|
647
|
+
[providerAndBridge: string]: TradeQuote;
|
|
718
648
|
};
|
|
719
|
-
type
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
649
|
+
type TradeQuotesResponse = {
|
|
650
|
+
[pair: string]: {
|
|
651
|
+
status?: string;
|
|
652
|
+
message?: string;
|
|
653
|
+
recommendedSource: string;
|
|
654
|
+
fastestSource?: string;
|
|
655
|
+
bestReturnSource: string;
|
|
656
|
+
questSource?: string;
|
|
657
|
+
quoteRates?: TradeQuotesByProviderId;
|
|
658
|
+
tokensWithoutPrice: Record<number, string[]>;
|
|
726
659
|
};
|
|
727
|
-
estimatedGas: string;
|
|
728
|
-
isJitoTx?: boolean;
|
|
729
660
|
};
|
|
730
|
-
type
|
|
731
|
-
|
|
732
|
-
action: StepAction;
|
|
733
|
-
data: T;
|
|
661
|
+
type AdditionalInfo = {
|
|
662
|
+
[key: string]: unknown;
|
|
734
663
|
};
|
|
735
|
-
type
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
664
|
+
type Token = {
|
|
665
|
+
address: HexString;
|
|
666
|
+
decimals: number;
|
|
667
|
+
chainId: number;
|
|
668
|
+
logo: string;
|
|
669
|
+
symbol: string;
|
|
670
|
+
price?: string;
|
|
739
671
|
};
|
|
740
|
-
type
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
672
|
+
type TokenPermitData = {
|
|
673
|
+
eip2612: {
|
|
674
|
+
supported: boolean;
|
|
675
|
+
data?: {
|
|
676
|
+
domain?: TypedDataDomain;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
permit2: {
|
|
680
|
+
supported: boolean;
|
|
681
|
+
};
|
|
744
682
|
};
|
|
745
|
-
type
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
683
|
+
type TokenInfo = Prettify<Omit<NativeTokenInfo, 'isErc20'> & {
|
|
684
|
+
chainId: number;
|
|
685
|
+
balanceInUsd?: number | null;
|
|
686
|
+
isDisabledOnSwapBridge?: {
|
|
687
|
+
source: boolean;
|
|
688
|
+
destination: boolean;
|
|
689
|
+
};
|
|
690
|
+
isDisabledOnZap?: {
|
|
691
|
+
source: boolean;
|
|
692
|
+
destination: boolean;
|
|
693
|
+
};
|
|
694
|
+
permit?: TokenPermitData;
|
|
695
|
+
}>;
|
|
696
|
+
type TokenResponse = {
|
|
697
|
+
[key: string]: TokenInfo;
|
|
749
698
|
};
|
|
750
|
-
type
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
699
|
+
type TradeBuildTxnRequest = {
|
|
700
|
+
sender: HexString;
|
|
701
|
+
refundee: HexString;
|
|
702
|
+
fromChain: number;
|
|
703
|
+
gasless: boolean;
|
|
704
|
+
private?: boolean;
|
|
705
|
+
disableEstimation?: boolean;
|
|
706
|
+
data: TradeBuildTxnRequestData[];
|
|
707
|
+
hasPermit2ApprovalForAllTokens?: boolean;
|
|
708
|
+
publicKey?: string;
|
|
760
709
|
};
|
|
761
|
-
type
|
|
710
|
+
type TradeBuildTxnRequestData = {
|
|
711
|
+
amount: string;
|
|
762
712
|
srcToken: string;
|
|
763
|
-
|
|
713
|
+
srcDecimals?: number;
|
|
764
714
|
destToken: string;
|
|
765
|
-
|
|
715
|
+
destDecimals?: number;
|
|
716
|
+
toChain: number;
|
|
717
|
+
protocol: string;
|
|
766
718
|
recipient: string;
|
|
767
|
-
refundee: string;
|
|
768
719
|
slippage: number;
|
|
769
|
-
|
|
770
|
-
integrator?: ZapIntegratorConfig;
|
|
720
|
+
additionalInfo?: AdditionalInfo;
|
|
771
721
|
permitData?: string;
|
|
772
|
-
|
|
773
|
-
estimateGas?: boolean;
|
|
774
|
-
positionDetails?: ZapRouteRequestPositionDetails;
|
|
775
|
-
poolDetails?: ZapRouteRequestPoolDetails;
|
|
776
|
-
allowedBridges?: string[];
|
|
777
|
-
allowedDexes?: string[];
|
|
778
|
-
};
|
|
779
|
-
|
|
780
|
-
type ZapBundleSrcToken = {
|
|
781
|
-
address: string;
|
|
782
|
-
amount?: string;
|
|
722
|
+
permit?: TokenPermitData;
|
|
783
723
|
};
|
|
784
|
-
type
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
poolDetails?: ZapRouteRequestPoolDetails;
|
|
792
|
-
protocol?: string;
|
|
724
|
+
type ParamQuotes = {
|
|
725
|
+
additionalInfo?: Record<string, unknown>;
|
|
726
|
+
destAmount: string;
|
|
727
|
+
provider: string;
|
|
728
|
+
minDestAmount: string;
|
|
729
|
+
priceImpact?: string | null;
|
|
730
|
+
duration?: string;
|
|
793
731
|
};
|
|
794
|
-
type
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
quotesOnly?: boolean;
|
|
801
|
-
estimateGas?: boolean;
|
|
802
|
-
integrator?: ZapIntegratorConfig;
|
|
803
|
-
allowedDexes?: string[];
|
|
804
|
-
allowedBridges?: string[];
|
|
732
|
+
type EvmTxData = {
|
|
733
|
+
from: HexString;
|
|
734
|
+
data: HexString;
|
|
735
|
+
to: HexString;
|
|
736
|
+
value: string;
|
|
737
|
+
gasLimit: string;
|
|
805
738
|
};
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
739
|
+
type SvmTxData = {
|
|
740
|
+
from: string;
|
|
741
|
+
data: string;
|
|
742
|
+
blockhash?: string;
|
|
743
|
+
lastValidBlockHeight?: number;
|
|
811
744
|
};
|
|
812
|
-
type
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
745
|
+
type BtcTxData = {
|
|
746
|
+
from: string;
|
|
747
|
+
data: string;
|
|
748
|
+
inputs: PsbtInput[];
|
|
749
|
+
outputs: PsbtOutput[];
|
|
750
|
+
feeRate: number;
|
|
817
751
|
};
|
|
818
|
-
type
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
offset: number;
|
|
752
|
+
type BtclnTxData = {
|
|
753
|
+
paymentRequestType: 'bolt11';
|
|
754
|
+
paymentRequest: string;
|
|
755
|
+
paymentExpiry: number;
|
|
823
756
|
};
|
|
824
|
-
type
|
|
825
|
-
|
|
757
|
+
type TxData = EvmTxData | SvmTxData | BtcTxData | BtclnTxData;
|
|
758
|
+
type TxRequestData<T> = {
|
|
759
|
+
status: typeof STATUS.success;
|
|
760
|
+
txId: string;
|
|
826
761
|
chainId: number;
|
|
827
|
-
|
|
828
|
-
provider: string;
|
|
829
|
-
underlyingAssets: ZapUnderlyingToken[];
|
|
830
|
-
tvl: string;
|
|
831
|
-
apr: number;
|
|
832
|
-
metadata?: unknown;
|
|
833
|
-
symbol: string;
|
|
834
|
-
decimals: number;
|
|
762
|
+
transaction: T;
|
|
835
763
|
};
|
|
836
|
-
type
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
764
|
+
type TradeGasBuildTxnResponse<T = TxData> = TxRequestData<T> & {
|
|
765
|
+
quotes: Record<string, ParamQuotes>;
|
|
766
|
+
gasless: false;
|
|
767
|
+
private: boolean;
|
|
768
|
+
};
|
|
769
|
+
type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
|
|
770
|
+
data: string;
|
|
771
|
+
from: string;
|
|
772
|
+
to?: string;
|
|
773
|
+
value?: string;
|
|
774
|
+
gasLimit?: string;
|
|
775
|
+
svmTxData?: {
|
|
776
|
+
blockhash: string;
|
|
777
|
+
lastValidBlockHeight: number;
|
|
778
|
+
};
|
|
779
|
+
btcTxData?: {
|
|
780
|
+
inputs: PsbtInput[];
|
|
781
|
+
outputs: PsbtOutput[];
|
|
782
|
+
feeRate: number;
|
|
842
783
|
};
|
|
784
|
+
btclnTxData?: BtclnTxData;
|
|
785
|
+
additionalInfo: Record<string, Record<string, unknown>>;
|
|
786
|
+
updatedQuotes: Record<string, string>;
|
|
843
787
|
};
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
788
|
+
type BridgeGaslessTxData = {
|
|
789
|
+
executorFeesHash: HexString;
|
|
790
|
+
swapDataHash?: HexString;
|
|
791
|
+
adapterDataHash: HexString;
|
|
792
|
+
txType: typeof GaslessTxType.bridge;
|
|
793
|
+
value: string;
|
|
849
794
|
};
|
|
850
|
-
type
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
chainId: number;
|
|
856
|
-
provider: string;
|
|
857
|
-
amount: string;
|
|
858
|
-
amountUSD: string;
|
|
859
|
-
nftDetails?: {
|
|
860
|
-
id: string;
|
|
861
|
-
manager: HexString;
|
|
862
|
-
};
|
|
863
|
-
metadata?: unknown;
|
|
864
|
-
decimals: number;
|
|
795
|
+
type SwapGaslessTxData = {
|
|
796
|
+
executorFeesHash: HexString;
|
|
797
|
+
swapDataHash: HexString;
|
|
798
|
+
txType: typeof GaslessTxType.swap;
|
|
799
|
+
value: string;
|
|
865
800
|
};
|
|
866
|
-
type
|
|
867
|
-
|
|
868
|
-
|
|
801
|
+
type GaslessTradeBuildTxnResponse = {
|
|
802
|
+
status: 'success';
|
|
803
|
+
txId: HexString;
|
|
804
|
+
transaction: BridgeGaslessTxData | SwapGaslessTxData;
|
|
805
|
+
quotes: Record<string, ParamQuotes>;
|
|
806
|
+
gasless: true;
|
|
807
|
+
onlySwapData: false;
|
|
869
808
|
};
|
|
870
|
-
|
|
871
|
-
type
|
|
872
|
-
type
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
amount: string;
|
|
882
|
-
amountUSD: string;
|
|
809
|
+
type AvailableDZapServices = (typeof Services)[keyof typeof Services];
|
|
810
|
+
type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
|
|
811
|
+
type DZapTransactionResponse = {
|
|
812
|
+
status: TxnStatus;
|
|
813
|
+
errorMsg?: string;
|
|
814
|
+
code: StatusCodes | number;
|
|
815
|
+
action?: keyof typeof contractErrorActions;
|
|
816
|
+
txnHash?: HexString;
|
|
817
|
+
error?: unknown;
|
|
818
|
+
additionalInfo?: Record<string, unknown>;
|
|
819
|
+
updatedQuotes?: Record<string, string>;
|
|
883
820
|
};
|
|
884
|
-
type
|
|
821
|
+
type SwapInfo = {
|
|
822
|
+
dex: string;
|
|
823
|
+
fromToken: string;
|
|
824
|
+
fromAmount: bigint;
|
|
825
|
+
toToken: string;
|
|
826
|
+
returnToAmount: bigint;
|
|
827
|
+
};
|
|
828
|
+
type StatusAsset = {
|
|
829
|
+
contract: string;
|
|
885
830
|
chainId: number;
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
output: ZapStatusAsset[];
|
|
831
|
+
name?: string;
|
|
832
|
+
symbol?: string;
|
|
833
|
+
decimals?: number;
|
|
834
|
+
logo?: string | undefined;
|
|
835
|
+
underlyingTokens?: ZapUnderlyingToken[];
|
|
892
836
|
};
|
|
893
|
-
type
|
|
894
|
-
|
|
837
|
+
type TransactionInfo = {
|
|
838
|
+
asset: StatusAsset;
|
|
839
|
+
amount: string;
|
|
840
|
+
amountUSD: number;
|
|
841
|
+
txHash: string;
|
|
895
842
|
account: string;
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
843
|
+
};
|
|
844
|
+
type TxStatusForPair = {
|
|
845
|
+
source: TransactionInfo;
|
|
846
|
+
destination: TransactionInfo & {
|
|
847
|
+
timestamp?: number;
|
|
848
|
+
};
|
|
849
|
+
expected?: Omit<TransactionInfo, 'txHash' | 'status'>;
|
|
850
|
+
status: StatusResponse;
|
|
851
|
+
provider: ProviderDetails;
|
|
852
|
+
allowUserTxOnDestChain: boolean;
|
|
853
|
+
message?: string;
|
|
854
|
+
protocolExplorerLink?: string;
|
|
855
|
+
};
|
|
856
|
+
type TradeStatusResponse = {
|
|
857
|
+
status: StatusResponse;
|
|
858
|
+
gasless: boolean;
|
|
859
|
+
txHash: string;
|
|
860
|
+
chainId: number;
|
|
900
861
|
timestamp: number;
|
|
901
|
-
|
|
862
|
+
transactions: TxStatusForPair[];
|
|
863
|
+
type: 'swap' | 'bridge' | 'zap';
|
|
902
864
|
};
|
|
903
|
-
type
|
|
865
|
+
type PermitMode = keyof typeof PermitTypes;
|
|
866
|
+
type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
|
|
867
|
+
type SinglePermitCallbackParams = {
|
|
868
|
+
permitData: HexString;
|
|
869
|
+
srcToken: HexString;
|
|
870
|
+
amount: string;
|
|
871
|
+
permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
|
|
872
|
+
};
|
|
873
|
+
type BatchPermitCallbackParams = {
|
|
874
|
+
batchPermitData: HexString;
|
|
875
|
+
tokens: {
|
|
876
|
+
address: HexString;
|
|
877
|
+
amount: string;
|
|
878
|
+
}[];
|
|
879
|
+
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
880
|
+
};
|
|
881
|
+
type SignatureCallbackParams = SinglePermitCallbackParams | BatchPermitCallbackParams;
|
|
882
|
+
type SignatureParamsBase = {
|
|
904
883
|
chainId: number;
|
|
905
|
-
|
|
884
|
+
sender: HexString;
|
|
885
|
+
signer: WalletClient | Signer;
|
|
886
|
+
tokens: {
|
|
887
|
+
address: HexString;
|
|
888
|
+
permitData?: HexString;
|
|
889
|
+
amount: string;
|
|
890
|
+
permit?: TokenPermitData;
|
|
891
|
+
}[];
|
|
892
|
+
spender: HexString;
|
|
893
|
+
rpcUrls: string[];
|
|
894
|
+
permitType: PermitMode;
|
|
895
|
+
isBatchPermitAllowed?: boolean;
|
|
896
|
+
signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
|
|
897
|
+
service: AvailableDZapServices;
|
|
898
|
+
contractVersion: ContractVersion;
|
|
906
899
|
};
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
type ZapChains = {
|
|
910
|
-
[key: string]: {
|
|
911
|
-
name: string;
|
|
912
|
-
supportedProviders: string[];
|
|
913
|
-
};
|
|
900
|
+
type GasSignatureParams = SignatureParamsBase & {
|
|
901
|
+
gasless: false;
|
|
914
902
|
};
|
|
915
|
-
type
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
903
|
+
type SignPermitResponse = {
|
|
904
|
+
status: TxnStatus.success;
|
|
905
|
+
code: StatusCodes;
|
|
906
|
+
tokens: {
|
|
907
|
+
address: HexString;
|
|
908
|
+
permitData?: HexString;
|
|
909
|
+
amount: string;
|
|
910
|
+
}[];
|
|
911
|
+
permitType: PermitMode;
|
|
912
|
+
} | {
|
|
913
|
+
status: TxnStatus.success;
|
|
914
|
+
code: StatusCodes;
|
|
915
|
+
batchPermitData: HexString;
|
|
916
|
+
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
917
|
+
} | {
|
|
918
|
+
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
919
|
+
code: StatusCodes;
|
|
920
|
+
permitType: PermitMode;
|
|
920
921
|
};
|
|
921
|
-
type
|
|
922
|
+
type BroadcastTxData = string;
|
|
923
|
+
type BroadcastTxParams = {
|
|
924
|
+
txId: string;
|
|
922
925
|
chainId: number;
|
|
923
|
-
|
|
924
|
-
name?: string;
|
|
925
|
-
symbol: string;
|
|
926
|
-
decimals: number;
|
|
927
|
-
logo?: string | null;
|
|
926
|
+
txData: BroadcastTxData;
|
|
928
927
|
};
|
|
929
|
-
type
|
|
930
|
-
|
|
931
|
-
|
|
928
|
+
type BroadcastTxResponse = {
|
|
929
|
+
status: TxnStatus.success;
|
|
930
|
+
txnHash: string;
|
|
931
|
+
} | {
|
|
932
|
+
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
933
|
+
message: string;
|
|
932
934
|
};
|
|
933
935
|
|
|
934
936
|
type BatchCallParams = {
|