@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.
Files changed (3) hide show
  1. package/dist/index.d.mts +671 -669
  2. package/dist/index.d.ts +671 -669
  3. 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 enum AddressKind {
157
- INVALID = "invalid",
158
- NATIVE = "native",
159
- TOKEN = "token",
160
- CONTRACT = "contract",
161
- WALLET = "wallet"
162
- }
163
- type AddressClassifyResult = {
164
- valid: boolean;
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 HexString = `0x${string}`;
173
- type StatusResponse = keyof typeof STATUS_RESPONSE;
174
- type ChainData = {
175
- [key in number]: Chain;
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
- balance: string;
183
- price?: string;
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 CalculatePointsRequest = {
202
- srcTokens: {
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
- address: string;
205
- decimals: number;
188
+ amountUSD: string;
206
189
  }[];
207
- destTokens: {
190
+ output: {
191
+ asset: ZapPathAsset;
208
192
  amount: string;
209
- address: string;
210
- decimals: number;
193
+ amountUSD: string;
194
+ minAmount: string;
211
195
  }[];
212
- providers: string[];
213
- chainId: number;
214
- account: string;
215
- txType: 'swap' | 'bridge';
216
196
  };
217
- type Chain = {
218
- coinKey: string;
219
- chainId: number;
220
- chainType: string;
221
- name: string;
222
- coin: string;
223
- dcaContract: string;
224
- swapBridgeContract: string;
225
- logo: string;
226
- tokenlistUrl?: string;
227
- multicallAddress?: HexString;
228
- blockExplorerUrl: string;
229
- nativeToken: NativeTokenInfo;
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
- type ApiRpcResponse = {
257
- url: string;
258
- keyRequired: boolean;
259
- keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
211
+
212
+ declare const zapStepAction: {
213
+ readonly execute: "execute";
260
214
  };
261
- type ProviderDetails = {
262
- id: string;
263
- name: string;
264
- icon: string;
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 FeeDetails = {
267
- address: string;
268
- decimals: number;
269
- chainId: number;
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 Fee = {
277
- gasFee: FeeDetails[];
278
- protocolFee: FeeDetails[];
279
- providerFee: FeeDetails[];
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 QuoteFilter = keyof typeof QuoteFilters;
282
- type ProtocolFilter = {
283
- allow?: string[];
284
- deny?: string[];
241
+ type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
242
+ type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
243
+ action: StepAction;
244
+ data: T;
285
245
  };
286
- type TradeQuotesRequest = {
287
- fromChain: number;
288
- gasless?: boolean;
289
- private?: boolean;
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 TradeQuotesRequestData = {
305
- amount: string;
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
- srcDecimals?: number;
274
+ srcChainId: number;
308
275
  destToken: string;
309
- destDecimals?: number;
310
- toChain: number;
276
+ destChainId: number;
277
+ recipient: string;
278
+ refundee: string;
311
279
  slippage: number;
312
- selectedSource?: string;
313
- };
314
- type TradeStep = {
315
- type: string;
316
- exchange: {
317
- logo: string;
318
- name: string;
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
- type TradePath = {
322
- type: string;
323
- exchange: ProviderDetails;
324
- srcToken: Token;
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 Tag = {
333
- title: string;
334
- link?: string;
335
- message?: string;
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 TradeQuote = {
338
- bridgeDetails?: ProviderDetails;
339
- providerDetails: ProviderDetails;
340
- srcAmount: string;
341
- srcAmountUSD: string;
342
- destAmount: string;
343
- destAmountUSD: string;
344
- minDestAmount: string;
345
- swapPerUnit: string;
346
- srcToken: Token;
347
- destToken: Token;
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
- type TradeQuotesByProviderId = {
358
- [providerAndBridge: string]: TradeQuote;
317
+
318
+ type ZapPoolDetailsRequest = {
319
+ address: HexString;
320
+ chainId: number;
321
+ provider: string;
359
322
  };
360
- type TradeQuotesResponse = {
361
- [pair: string]: {
362
- status?: string;
363
- message?: string;
364
- recommendedSource: string;
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 AdditionalInfo = {
373
- [key: string]: unknown;
329
+ type ZapPoolsResponse = {
330
+ pools: ZapPool[];
331
+ pages: number;
332
+ limit: number;
333
+ offset: number;
374
334
  };
375
- type Token = {
376
- address: HexString;
377
- decimals: number;
335
+ type ZapPool = {
336
+ address: string;
378
337
  chainId: number;
379
- logo: string;
338
+ name: string;
339
+ provider: string;
340
+ underlyingAssets: ZapUnderlyingToken[];
341
+ tvl: string;
342
+ apr: number;
343
+ metadata?: unknown;
380
344
  symbol: string;
381
- price?: string;
345
+ decimals: number;
382
346
  };
383
- type TokenPermitData = {
384
- eip2612: {
385
- supported: boolean;
386
- data?: {
387
- domain?: TypedDataDomain;
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
- type TokenInfo = Prettify<Omit<NativeTokenInfo, 'isErc20'> & {
355
+
356
+ type ZapPositionsRequest = {
357
+ account: HexString;
395
358
  chainId: number;
396
- balanceInUsd?: number | null;
397
- isDisabledOnSwapBridge?: {
398
- source: boolean;
399
- destination: boolean;
400
- };
401
- isDisabledOnZap?: {
402
- source: boolean;
403
- destination: boolean;
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
- permit?: TokenPermitData;
406
- }>;
407
- type TokenResponse = {
408
- [key: string]: TokenInfo;
374
+ metadata?: unknown;
375
+ decimals: number;
409
376
  };
410
- type TradeBuildTxnRequest = {
411
- sender: HexString;
412
- refundee: HexString;
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
- type TradeBuildTxnRequestData = {
422
- amount: string;
423
- srcToken: string;
424
- srcDecimals?: number;
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
- slippage: number;
431
- additionalInfo?: AdditionalInfo;
432
- permitData?: string;
433
- permit?: TokenPermitData;
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 ParamQuotes = {
436
- additionalInfo?: Record<string, unknown>;
437
- destAmount: string;
438
- provider: string;
439
- minDestAmount: string;
440
- priceImpact?: string | null;
441
- duration?: string;
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 EvmTxData = {
444
- from: HexString;
445
- data: HexString;
446
- to: HexString;
447
- value: string;
448
- gasLimit: string;
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 SvmTxData = {
451
- from: string;
452
- data: string;
453
- blockhash?: string;
454
- lastValidBlockHeight?: number;
414
+ type ZapStatusRequest = {
415
+ chainId: number;
416
+ txnHash: string;
455
417
  };
456
- type BtcTxData = {
457
- from: string;
458
- data: string;
459
- inputs: PsbtInput[];
460
- outputs: PsbtOutput[];
461
- feeRate: number;
418
+
419
+ type ZapProviders = Record<string, ProviderDetails>;
420
+ type ZapChains = {
421
+ [key: string]: {
422
+ name: string;
423
+ supportedProviders: string[];
424
+ };
462
425
  };
463
- type BtclnTxData = {
464
- paymentRequestType: 'bolt11';
465
- paymentRequest: string;
466
- paymentExpiry: number;
426
+ type ZapFee = {
427
+ amount: string;
428
+ amountUSD: string;
429
+ asset: ZapPathAsset;
430
+ included: boolean;
467
431
  };
468
- type TxData = EvmTxData | SvmTxData | BtcTxData | BtclnTxData;
469
- type TxRequestData<T> = {
470
- status: typeof STATUS.success;
471
- txId: string;
432
+ type ZapUnderlyingToken = {
472
433
  chainId: number;
473
- transaction: T;
434
+ address: HexString;
435
+ name?: string;
436
+ symbol: string;
437
+ decimals: number;
438
+ logo?: string | null;
474
439
  };
475
- type TradeGasBuildTxnResponse<T = TxData> = TxRequestData<T> & {
476
- quotes: Record<string, ParamQuotes>;
477
- gasless: false;
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
- type AvailableDZapServices = (typeof Services)[keyof typeof Services];
521
- type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
522
- type DZapTransactionResponse = {
523
- status: TxnStatus;
524
- errorMsg?: string;
525
- code: StatusCodes | number;
526
- action?: keyof typeof contractErrorActions;
527
- txnHash?: HexString;
528
- error?: unknown;
529
- additionalInfo?: Record<string, unknown>;
530
- updatedQuotes?: Record<string, string>;
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
- type SwapInfo = {
533
- dex: string;
534
- fromToken: string;
535
- fromAmount: bigint;
536
- toToken: string;
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 StatusAsset = {
466
+ type NativeTokenInfo = {
540
467
  contract: string;
541
- chainId: number;
542
- name?: string;
543
- symbol?: string;
544
- decimals?: number;
545
- logo?: string | undefined;
546
- };
547
- type TransactionInfo = {
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
- type PermitMode = keyof typeof PermitTypes;
575
- type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
576
- type SinglePermitCallbackParams = {
577
- permitData: HexString;
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 BatchPermitCallbackParams = {
583
- batchPermitData: HexString;
584
- tokens: {
585
- address: HexString;
586
- amount: string;
587
- }[];
588
- permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
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 SignatureCallbackParams = SinglePermitCallbackParams | BatchPermitCallbackParams;
591
- type SignatureParamsBase = {
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
- permit?: TokenPermitData;
493
+ address: string;
494
+ decimals: number;
600
495
  }[];
601
- spender: HexString;
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
- permitType: PermitMode;
621
- } | {
622
- status: TxnStatus.success;
623
- code: StatusCodes;
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 BroadcastTxData = string;
632
- type BroadcastTxParams = {
633
- txId: string;
506
+ type Chain = {
507
+ coinKey: string;
634
508
  chainId: number;
635
- txData: BroadcastTxData;
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 BroadcastTxResponse = {
638
- status: TxnStatus.success;
639
- txnHash: string;
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
- declare const zapPathAction: {
646
- readonly swap: "swap";
647
- readonly bridge: "bridge";
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
- type ZapPathAction = keyof typeof zapPathAction;
657
- type ZapPathAsset = {
555
+ type FeeDetails = {
556
+ address: string;
557
+ decimals: number;
658
558
  chainId: number;
659
- address: HexString;
660
559
  symbol: string;
661
- logo: string;
662
- decimals: number;
663
- price: string;
664
- type: string;
665
- name: string;
666
- provider?: ProviderDetails;
667
- underlyingTokens?: ZapUnderlyingToken[];
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 ZapPath = {
670
- action: ZapPathAction;
671
- protocol: ProviderDetails;
672
- fee: ZapFee[];
673
- estimatedDuration: number;
674
- input: {
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
- declare const chainTypes: {
688
- readonly evm: "evm";
689
- readonly bvm: "bvm";
690
- readonly svm: "svm";
691
- readonly aptosvm: "aptosvm";
692
- readonly cosmos: "cosmos";
693
- readonly nearvm: "nearvm";
694
- readonly starknetvm: "starknetvm";
695
- readonly stellarvm: "stellarvm";
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
- declare const zapStepAction: {
702
- readonly execute: "execute";
621
+ type Tag = {
622
+ title: string;
623
+ link?: string;
624
+ message?: string;
703
625
  };
704
-
705
- type StepAction = keyof typeof zapStepAction;
706
- type ZapEvmTxnDetails = {
707
- type: typeof chainTypes.evm;
708
- txnId: HexString;
709
- callData: HexString;
710
- callTo: HexString;
711
- value: string;
712
- estimatedGas: string;
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 ZapBvmTxnDetails = {
715
- type: typeof chainTypes.bvm;
716
- txnId: HexString;
717
- data: string;
646
+ type TradeQuotesByProviderId = {
647
+ [providerAndBridge: string]: TradeQuote;
718
648
  };
719
- type SVMTxnDetails = {
720
- type: typeof chainTypes.svm;
721
- txnId: HexString;
722
- data: string[];
723
- blockhash?: {
724
- blockhash: string;
725
- lastValidBlockHeight: number;
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 ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
731
- type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
732
- action: StepAction;
733
- data: T;
661
+ type AdditionalInfo = {
662
+ [key: string]: unknown;
734
663
  };
735
- type ZapStep = ZapTransactionStep;
736
-
737
- type ZapRouteRequestPositionDetails = {
738
- nftId: string;
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 ZapRouteRequestPoolDetails = {
741
- lowerTick: number;
742
- upperTick: number;
743
- metadata?: unknown;
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 ZapIntegratorConfig = {
746
- id: string;
747
- feeBps: number;
748
- wallet: string;
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 ZapBuildTxnResponse = {
751
- approvalData: {
752
- callTo: HexString;
753
- approveTo: HexString;
754
- amount: string;
755
- }[];
756
- dust: ZapPath['output'];
757
- output: ZapPath['output'];
758
- steps: ZapStep[];
759
- path: ZapPath[];
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 ZapBuildTxnRequest = {
710
+ type TradeBuildTxnRequestData = {
711
+ amount: string;
762
712
  srcToken: string;
763
- srcChainId: number;
713
+ srcDecimals?: number;
764
714
  destToken: string;
765
- destChainId: number;
715
+ destDecimals?: number;
716
+ toChain: number;
717
+ protocol: string;
766
718
  recipient: string;
767
- refundee: string;
768
719
  slippage: number;
769
- account: string;
770
- integrator?: ZapIntegratorConfig;
720
+ additionalInfo?: AdditionalInfo;
771
721
  permitData?: string;
772
- amount?: string;
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 ZapBundleAction = {
785
- action: ZapPathAction;
786
- srcToken: ZapBundleSrcToken | ZapBundleSrcToken[];
787
- srcChainId: number;
788
- destToken?: string;
789
- destChainId?: number;
790
- positionDetails?: ZapRouteRequestPositionDetails;
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 ZapBundleRequest = {
795
- actions: ZapBundleAction[];
796
- account: string;
797
- recipient: string;
798
- refundee: string;
799
- slippage: number;
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
- type ZapPoolDetailsRequest = {
808
- address: HexString;
809
- chainId: number;
810
- provider: string;
739
+ type SvmTxData = {
740
+ from: string;
741
+ data: string;
742
+ blockhash?: string;
743
+ lastValidBlockHeight?: number;
811
744
  };
812
- type ZapPoolsRequest = {
813
- chainId: number;
814
- provider: string;
815
- limit?: number;
816
- offset?: number;
745
+ type BtcTxData = {
746
+ from: string;
747
+ data: string;
748
+ inputs: PsbtInput[];
749
+ outputs: PsbtOutput[];
750
+ feeRate: number;
817
751
  };
818
- type ZapPoolsResponse = {
819
- pools: ZapPool[];
820
- pages: number;
821
- limit: number;
822
- offset: number;
752
+ type BtclnTxData = {
753
+ paymentRequestType: 'bolt11';
754
+ paymentRequest: string;
755
+ paymentExpiry: number;
823
756
  };
824
- type ZapPool = {
825
- address: string;
757
+ type TxData = EvmTxData | SvmTxData | BtcTxData | BtclnTxData;
758
+ type TxRequestData<T> = {
759
+ status: typeof STATUS.success;
760
+ txId: string;
826
761
  chainId: number;
827
- name: string;
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 ZapPoolDetails = {
837
- address: string;
838
- slot0: {
839
- sqrtPriceX96: string;
840
- tick: number;
841
- tickSpacing: number;
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
- type ZapPositionsRequest = {
846
- account: HexString;
847
- chainId: number;
848
- provider: string;
788
+ type BridgeGaslessTxData = {
789
+ executorFeesHash: HexString;
790
+ swapDataHash?: HexString;
791
+ adapterDataHash: HexString;
792
+ txType: typeof GaslessTxType.bridge;
793
+ value: string;
849
794
  };
850
- type ZapPosition = {
851
- underlyingAssets: ZapUnderlyingTokenWithAmount[];
852
- address: string;
853
- apr: number;
854
- name: string;
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 ZapPositionsResponse = {
867
- positions: ZapPosition[];
868
- count: number;
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 ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
872
- type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
873
- refundee: string;
874
- recipient: string;
875
- account: string;
876
- }>;
877
-
878
- type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED' | 'REFUNDED';
879
- type ZapStatusAsset = {
880
- asset: ZapPathAsset;
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 ZapStatusStep = {
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
- hash?: string;
887
- status: ZapStatus;
888
- action: string;
889
- protocol: ProviderDetails;
890
- input: ZapStatusAsset[];
891
- output: ZapStatusAsset[];
831
+ name?: string;
832
+ symbol?: string;
833
+ decimals?: number;
834
+ logo?: string | undefined;
835
+ underlyingTokens?: ZapUnderlyingToken[];
892
836
  };
893
- type ZapStatusResponse = {
894
- status: ZapStatus;
837
+ type TransactionInfo = {
838
+ asset: StatusAsset;
839
+ amount: string;
840
+ amountUSD: number;
841
+ txHash: string;
895
842
  account: string;
896
- recipient: string;
897
- input: ZapStatusAsset[];
898
- output: ZapStatusAsset[];
899
- steps: ZapStatusStep[];
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
- completedAt: number;
862
+ transactions: TxStatusForPair[];
863
+ type: 'swap' | 'bridge' | 'zap';
902
864
  };
903
- type ZapStatusRequest = {
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
- txnHash: string;
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
- type ZapProviders = Record<string, ProviderDetails>;
909
- type ZapChains = {
910
- [key: string]: {
911
- name: string;
912
- supportedProviders: string[];
913
- };
900
+ type GasSignatureParams = SignatureParamsBase & {
901
+ gasless: false;
914
902
  };
915
- type ZapFee = {
916
- amount: string;
917
- amountUSD: string;
918
- asset: ZapPathAsset;
919
- included: boolean;
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 ZapUnderlyingToken = {
922
+ type BroadcastTxData = string;
923
+ type BroadcastTxParams = {
924
+ txId: string;
922
925
  chainId: number;
923
- address: HexString;
924
- name?: string;
925
- symbol: string;
926
- decimals: number;
927
- logo?: string | null;
926
+ txData: BroadcastTxData;
928
927
  };
929
- type ZapUnderlyingTokenWithAmount = ZapUnderlyingToken & {
930
- amount: string;
931
- amountUSD: string;
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 = {