@dzapio/sdk 2.0.15 → 2.0.17

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 (108) hide show
  1. package/dist/{dZapClient/index.d.ts → index.d.mts} +912 -12
  2. package/dist/index.d.ts +1919 -17
  3. package/dist/index.js +16331 -2
  4. package/dist/index.mjs +16287 -0
  5. package/package.json +13 -31
  6. package/dist/api/index.d.ts +0 -31
  7. package/dist/artifacts/ERC20Permit.d.ts +0 -374
  8. package/dist/artifacts/Permit2.d.ts +0 -700
  9. package/dist/artifacts/Permit2Proxy.d.ts +0 -416
  10. package/dist/artifacts/default/DZapCoreAbi.d.ts +0 -2
  11. package/dist/artifacts/default/DZapCoreV2Abi.d.ts +0 -2
  12. package/dist/artifacts/default/DZapDcaAbi.d.ts +0 -2
  13. package/dist/artifacts/default/Permit2Abi.d.ts +0 -700
  14. package/dist/artifacts/default/erc20Abi.d.ts +0 -165
  15. package/dist/artifacts/default/index.d.ts +0 -6
  16. package/dist/artifacts/index.d.ts +0 -2
  17. package/dist/artifacts/staging/DZapCoreSwapAbi.d.ts +0 -2
  18. package/dist/artifacts/staging/index.d.ts +0 -2
  19. package/dist/axios/baseClient.d.ts +0 -2
  20. package/dist/axios/index.d.ts +0 -8
  21. package/dist/chains/definitions/arthera.d.ts +0 -44
  22. package/dist/chains/definitions/fiveIre.d.ts +0 -44
  23. package/dist/chains/definitions/hyperEvm.d.ts +0 -44
  24. package/dist/chains/definitions/hyperliquid.d.ts +0 -44
  25. package/dist/chains/definitions/pushTestnet.d.ts +0 -44
  26. package/dist/chains/definitions/stable.d.ts +0 -45
  27. package/dist/chains/index.d.ts +0 -268
  28. package/dist/config/index.d.ts +0 -36
  29. package/dist/constants/address.d.ts +0 -13
  30. package/dist/constants/approval.d.ts +0 -7
  31. package/dist/constants/axios.d.ts +0 -2
  32. package/dist/constants/chains.d.ts +0 -32
  33. package/dist/constants/contract.d.ts +0 -6
  34. package/dist/constants/erc20.d.ts +0 -25
  35. package/dist/constants/httpMethods.d.ts +0 -2
  36. package/dist/constants/index.d.ts +0 -48
  37. package/dist/constants/permit.d.ts +0 -29
  38. package/dist/constants/permit2.d.ts +0 -2
  39. package/dist/constants/rpc.d.ts +0 -2
  40. package/dist/constants/urlConstants.d.ts +0 -16
  41. package/dist/enums/index.d.ts +0 -47
  42. package/dist/index.js.map +0 -1
  43. package/dist/index.m.js +0 -2
  44. package/dist/index.m.js.map +0 -1
  45. package/dist/index.umd.js +0 -2
  46. package/dist/index.umd.js.map +0 -1
  47. package/dist/service/cache/cacheProvider.d.ts +0 -10
  48. package/dist/service/cache/constant.d.ts +0 -2
  49. package/dist/service/price/index.d.ts +0 -16
  50. package/dist/service/price/provider/coingecko/config.d.ts +0 -6
  51. package/dist/service/price/provider/coingecko/index.d.ts +0 -9
  52. package/dist/service/price/provider/defiLlama/config.d.ts +0 -3
  53. package/dist/service/price/provider/defiLlama/index.d.ts +0 -9
  54. package/dist/service/price/provider/defiLlama/types.d.ts +0 -11
  55. package/dist/service/price/provider/dzap/index.d.ts +0 -6
  56. package/dist/service/price/types/IPriceProvider.d.ts +0 -14
  57. package/dist/transactionHandlers/generic.d.ts +0 -24
  58. package/dist/transactionHandlers/permit.d.ts +0 -61
  59. package/dist/transactionHandlers/trade.d.ts +0 -26
  60. package/dist/transactionHandlers/zap.d.ts +0 -37
  61. package/dist/types/axiosClient.d.ts +0 -6
  62. package/dist/types/btc.d.ts +0 -45
  63. package/dist/types/chains.d.ts +0 -3
  64. package/dist/types/contract.d.ts +0 -14
  65. package/dist/types/eip-2612.d.ts +0 -24
  66. package/dist/types/index.d.ts +0 -497
  67. package/dist/types/permit.d.ts +0 -191
  68. package/dist/types/wallet.d.ts +0 -2
  69. package/dist/types/zap/broadcast.d.ts +0 -15
  70. package/dist/types/zap/build.d.ts +0 -44
  71. package/dist/types/zap/index.d.ts +0 -34
  72. package/dist/types/zap/path.d.ts +0 -33
  73. package/dist/types/zap/pool.d.ts +0 -39
  74. package/dist/types/zap/position.d.ts +0 -27
  75. package/dist/types/zap/quote.d.ts +0 -7
  76. package/dist/types/zap/status.d.ts +0 -28
  77. package/dist/types/zap/step.d.ts +0 -30
  78. package/dist/utils/amount.d.ts +0 -82
  79. package/dist/utils/axios.d.ts +0 -13
  80. package/dist/utils/date.d.ts +0 -1
  81. package/dist/utils/decoder/swap/abis.d.ts +0 -643
  82. package/dist/utils/decoder/swap/inputDataDecoder.d.ts +0 -14
  83. package/dist/utils/eip-2612/eip2612Permit.d.ts +0 -23
  84. package/dist/utils/eip-5792/batchApproveTokens.d.ts +0 -21
  85. package/dist/utils/eip-5792/index.d.ts +0 -3
  86. package/dist/utils/eip-5792/isBatchTxnSupportedByWallet.d.ts +0 -6
  87. package/dist/utils/eip-5792/sendBatchCalls.d.ts +0 -10
  88. package/dist/utils/eip-5792/waitForBatchTransactionReceipt.d.ts +0 -4
  89. package/dist/utils/encodeApproveCall.d.ts +0 -6
  90. package/dist/utils/erc20.d.ts +0 -65
  91. package/dist/utils/errors.d.ts +0 -17
  92. package/dist/utils/index.d.ts +0 -4562
  93. package/dist/utils/multicall.d.ts +0 -14
  94. package/dist/utils/permit2/domain.d.ts +0 -2
  95. package/dist/utils/permit2/index.d.ts +0 -4
  96. package/dist/utils/permit2/nonce.d.ts +0 -15
  97. package/dist/utils/permit2/permitData.d.ts +0 -23
  98. package/dist/utils/permit2/values.d.ts +0 -54
  99. package/dist/utils/permit2/witnessData.d.ts +0 -4
  100. package/dist/utils/signIntent/custom.d.ts +0 -11
  101. package/dist/utils/signIntent/gasless.d.ts +0 -12
  102. package/dist/utils/signTypedData.d.ts +0 -11
  103. package/dist/utils/tokens.d.ts +0 -8
  104. package/dist/utils/updateQuotes.d.ts +0 -3
  105. package/dist/zap/constants/index.d.ts +0 -2
  106. package/dist/zap/constants/path.d.ts +0 -8
  107. package/dist/zap/constants/step.d.ts +0 -3
  108. package/dist/zap/constants/urls.d.ts +0 -13
@@ -1,9 +1,868 @@
1
+ import * as viem from 'viem';
2
+ import { WalletCallReceipt as WalletCallReceipt$1, TypedDataDomain, Prettify, WalletClient, TransactionReceipt } from 'viem';
1
3
  import { Signer } from 'ethers';
2
- import { Prettify, TransactionReceipt, WalletClient } from 'viem';
3
- import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
4
- import { ApprovalMode, AvailableDZapServices, BroadcastTxParams, BroadcastTxResponse, CalculatePointsRequest, ChainData, EvmTxData, GasSignatureParams, GaslessTradeBuildTxnResponse, HexString, OtherAvailableAbis, PermitMode, SignPermitResponse, TokenInfo, TokenResponse, TradeBuildTxnRequest, TradeBuildTxnResponse, TradeQuotesRequest, TradeQuotesResponse, TradeStatusResponse } from '../types';
5
- import { ZapBuildTxnRequest, ZapBuildTxnResponse, ZapChains, ZapPoolDetails, ZapPoolDetailsRequest, ZapPoolsRequest, ZapPoolsResponse, ZapPositionsRequest, ZapPositionsResponse, ZapProviders, ZapQuoteRequest, ZapQuoteResponse, ZapStatusRequest, ZapStatusResponse, ZapTransactionStep } from '../types/zap';
6
- import { BatchCallParams } from '../utils/eip-5792';
4
+
5
+ declare const STATUS: {
6
+ pending: string;
7
+ inProgress: string;
8
+ success: string;
9
+ rejected: string;
10
+ error: string;
11
+ };
12
+ declare const OtherAbis: {
13
+ readonly permit2: "permit2";
14
+ readonly erc20: "erc20";
15
+ };
16
+ declare const Services: {
17
+ readonly trade: "trade";
18
+ readonly dca: "dca";
19
+ readonly zap: "zap";
20
+ };
21
+ declare const GaslessTxType: {
22
+ readonly swap: "swap";
23
+ readonly bridge: "bridge";
24
+ };
25
+ declare const QuoteFilters: {
26
+ readonly fastest: "fastest";
27
+ readonly best: "best";
28
+ readonly all: "all";
29
+ };
30
+ declare const STATUS_RESPONSE: {
31
+ readonly COMPLETED: "COMPLETED";
32
+ readonly FAILED: "FAILED";
33
+ readonly PENDING: "PENDING";
34
+ readonly PARTIAL: "PARTIAL";
35
+ readonly REFUNDED: "REFUNDED";
36
+ };
37
+
38
+ declare const ApprovalModes: {
39
+ readonly Default: "Default";
40
+ readonly PermitSingle: "PermitSingle";
41
+ readonly PermitWitnessTransferFrom: "PermitWitnessTransferFrom";
42
+ readonly PermitBatchWitnessTransferFrom: "PermitBatchWitnessTransferFrom";
43
+ readonly AutoPermit: "AutoPermit";
44
+ };
45
+
46
+ declare const erc20Functions: {
47
+ readonly name: "name";
48
+ readonly allowance: "allowance";
49
+ readonly approve: "approve";
50
+ readonly transfer: "transfer";
51
+ readonly transferFrom: "transferFrom";
52
+ readonly balanceOf: "balanceOf";
53
+ readonly decimals: "decimals";
54
+ readonly symbol: "symbol";
55
+ readonly version: "version";
56
+ readonly nonces: "nonces";
57
+ readonly domainSeparator: "DOMAIN_SEPARATOR";
58
+ };
59
+
60
+ declare enum DZapPermitMode {
61
+ PERMIT = 0,
62
+ PERMIT2_APPROVE = 1,
63
+ PERMIT2_WITNESS_TRANSFER = 2,
64
+ BATCH_PERMIT2_WITNESS_TRANSFER = 3
65
+ }
66
+ declare enum ContractVersion {
67
+ v1 = "v1",
68
+ v2 = "v2"
69
+ }
70
+ declare enum TxnStatus {
71
+ mining = "mining",
72
+ success = "success",
73
+ rejected = "rejected",
74
+ error = "error",
75
+ reverted = "reverted",
76
+ pendingWalletConfirmation = "pendingWalletConfirmation",
77
+ partialSuccess = "partialSuccess",
78
+ waitingForExecution = "waitingForExecution"
79
+ }
80
+ declare enum StatusCodes {
81
+ UserRejectedRequest = 4001,
82
+ Success = 200,
83
+ FunctionNotFound = 32771,
84
+ Error = 500,
85
+ WalletRPCFailure = 429,
86
+ SimulationFailure = 417,
87
+ ContractExecutionError = -500
88
+ }
89
+
90
+ declare const PermitTypes: {
91
+ readonly PermitSingle: "PermitSingle";
92
+ readonly PermitWitnessTransferFrom: "PermitWitnessTransferFrom";
93
+ readonly PermitBatchWitnessTransferFrom: "PermitBatchWitnessTransferFrom";
94
+ readonly EIP2612Permit: "EIP2612Permit";
95
+ readonly AutoPermit: "AutoPermit";
96
+ };
97
+
98
+ declare const SignatureExpiryInSecs = 1800;
99
+
100
+ type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
101
+
102
+ type Witness = {
103
+ value: number;
104
+ script: string;
105
+ };
106
+ type PsbtInputP2PKH = {
107
+ scriptType: 'p2pkh';
108
+ nonWitnessUtxo: Buffer;
109
+ redeemScript?: never;
110
+ };
111
+ type PsbtInputP2SH = {
112
+ scriptType: 'p2sh';
113
+ witnessUtxo: Witness;
114
+ redeemScript: Buffer;
115
+ redeemScriptArgumentByteLengths?: number[];
116
+ };
117
+ type PsbtInputP2WPKH = {
118
+ scriptType: 'p2wpkh';
119
+ witnessUtxo: Witness;
120
+ redeemScript?: never;
121
+ };
122
+ type PsbtInputP2WSH = {
123
+ scriptType: 'p2wsh';
124
+ witnessUtxo: Witness;
125
+ witnessScript: Buffer;
126
+ };
127
+ type PsbtInputP2TR = {
128
+ scriptType: 'p2tr';
129
+ witnessUtxo: Witness;
130
+ tapInternalKey: Buffer;
131
+ };
132
+ type PsbtInput = {
133
+ hash: string;
134
+ index: number;
135
+ sequence: number;
136
+ value: number;
137
+ } & (PsbtInputP2PKH | PsbtInputP2SH | PsbtInputP2WPKH | PsbtInputP2TR | PsbtInputP2WSH);
138
+ type PsbtOutput = {
139
+ address: string;
140
+ script?: Buffer;
141
+ value: number;
142
+ } | {
143
+ script: string;
144
+ value: number;
145
+ };
146
+
147
+ type HexString = `0x${string}`;
148
+ type StatusResponse = keyof typeof STATUS_RESPONSE;
149
+ type ChainData = {
150
+ [key in number]: Chain;
151
+ };
152
+ type NativeTokenInfo = {
153
+ contract: string;
154
+ symbol: string;
155
+ decimals: number;
156
+ name: string;
157
+ balance: string;
158
+ price?: string;
159
+ logo: string;
160
+ };
161
+ declare const contractErrorActions: {
162
+ readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
163
+ readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
164
+ readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
165
+ };
166
+ type ContractErrorResponse = {
167
+ status: string;
168
+ txId: string;
169
+ code: number;
170
+ message: string;
171
+ error: unknown;
172
+ action: keyof typeof contractErrorActions;
173
+ details?: unknown;
174
+ };
175
+ type CalculatePointsRequest = {
176
+ srcTokens: {
177
+ amount: string;
178
+ address: string;
179
+ decimals: number;
180
+ }[];
181
+ destTokens: {
182
+ amount: string;
183
+ address: string;
184
+ decimals: number;
185
+ }[];
186
+ providers: string[];
187
+ chainId: number;
188
+ account: string;
189
+ txType: 'swap' | 'bridge';
190
+ };
191
+ type Chain = {
192
+ coinKey: string;
193
+ chainId: number;
194
+ chainType: string;
195
+ name: string;
196
+ coin: string;
197
+ dcaContract: string;
198
+ swapBridgeContract: string;
199
+ logo: string;
200
+ tokenlistUrl?: string;
201
+ multicallAddress?: HexString;
202
+ blockExplorerUrl: string;
203
+ nativeToken: NativeTokenInfo;
204
+ rpcProviders: ApiRpcResponse[];
205
+ pricingAvailable: boolean;
206
+ balanceAvailable: boolean;
207
+ supportedAs: {
208
+ source: boolean;
209
+ destination: boolean;
210
+ };
211
+ contracts?: Partial<{
212
+ router: string;
213
+ dca: string;
214
+ zap: string;
215
+ }>;
216
+ coingecko?: {
217
+ chainKey: string;
218
+ nativeTokenKey: string;
219
+ };
220
+ defiLlama?: {
221
+ chainKey: string;
222
+ nativeTokenKey: string;
223
+ };
224
+ disableMultiTxn: boolean;
225
+ isEnabled: boolean;
226
+ mainnet: boolean;
227
+ tags?: Tag[];
228
+ version?: ContractVersion;
229
+ };
230
+ type ApiRpcResponse = {
231
+ url: string;
232
+ keyRequired: boolean;
233
+ keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
234
+ };
235
+ type ProviderDetails = {
236
+ id: string;
237
+ name: string;
238
+ icon: string;
239
+ };
240
+ type FeeDetails = {
241
+ address: string;
242
+ decimals: number;
243
+ chainId: number;
244
+ symbol: string;
245
+ logo?: string;
246
+ amount: string;
247
+ amountUSD: string;
248
+ included: boolean;
249
+ };
250
+ type Fee = {
251
+ gasFee: FeeDetails[];
252
+ protocolFee: FeeDetails[];
253
+ providerFee: FeeDetails[];
254
+ };
255
+ type QuoteFilter = keyof typeof QuoteFilters;
256
+ type ProtocolFilter = {
257
+ allow?: string[];
258
+ deny?: string[];
259
+ };
260
+ type TradeQuotesRequest = {
261
+ fromChain: number;
262
+ gasless?: boolean;
263
+ data: TradeQuotesRequestData[];
264
+ disableEstimation?: boolean;
265
+ account?: string;
266
+ bridges?: ProtocolFilter;
267
+ dexes?: ProtocolFilter;
268
+ filter?: QuoteFilter;
269
+ timingStrategy?: Partial<{
270
+ minWaitTimeMs: number;
271
+ maxWaitTimeMs: number;
272
+ subsequentDelayMs: number;
273
+ preferredResultCount: number;
274
+ relaxMinSuccessOnDelay: boolean;
275
+ }>;
276
+ };
277
+ type TradeQuotesRequestData = {
278
+ amount: string;
279
+ srcToken: string;
280
+ srcDecimals?: number;
281
+ destToken: string;
282
+ destDecimals?: number;
283
+ toChain: number;
284
+ slippage: number;
285
+ selectedSource?: string;
286
+ };
287
+ type TradeStep = {
288
+ type: string;
289
+ exchange: {
290
+ logo: string;
291
+ name: string;
292
+ };
293
+ };
294
+ type TradePath = {
295
+ type: string;
296
+ exchange: ProviderDetails;
297
+ srcToken: Token;
298
+ srcAmount: string;
299
+ srcAmountUSD: string;
300
+ destToken: Token;
301
+ destAmount: string;
302
+ destAmountUSD: string;
303
+ fee: Fee;
304
+ };
305
+ type Tag = {
306
+ title: string;
307
+ link?: string;
308
+ message?: string;
309
+ };
310
+ type TradeQuote = {
311
+ bridgeDetails?: ProviderDetails;
312
+ providerDetails: ProviderDetails;
313
+ srcAmount: string;
314
+ srcAmountUSD: string;
315
+ destAmount: string;
316
+ destAmountUSD: string;
317
+ minDestAmount: string;
318
+ swapPerUnit: string;
319
+ srcToken: Token;
320
+ destToken: Token;
321
+ fee: Fee;
322
+ priceImpactPercent: string;
323
+ duration: string;
324
+ gasless: boolean;
325
+ steps: TradeStep[];
326
+ path: TradePath[];
327
+ tags?: Tag[];
328
+ additionalInfo?: AdditionalInfo;
329
+ };
330
+ type TradeQuotesByProviderId = {
331
+ [providerAndBridge: string]: TradeQuote;
332
+ };
333
+ type TradeQuotesResponse = {
334
+ [pair: string]: {
335
+ status?: string;
336
+ message?: string;
337
+ recommendedSource: string;
338
+ fastestSource?: string;
339
+ bestReturnSource: string;
340
+ questSource?: string;
341
+ quoteRates?: TradeQuotesByProviderId;
342
+ tokensWithoutPrice: Record<number, string[]>;
343
+ };
344
+ };
345
+ type AdditionalInfo = {
346
+ [key: string]: unknown;
347
+ };
348
+ type Token = {
349
+ address: HexString;
350
+ decimals: number;
351
+ chainId: number;
352
+ logo: string;
353
+ symbol: string;
354
+ price?: string;
355
+ };
356
+ type TokenPermitData = {
357
+ eip2612: {
358
+ supported: boolean;
359
+ data?: {
360
+ domain?: TypedDataDomain;
361
+ };
362
+ };
363
+ permit2: {
364
+ supported: boolean;
365
+ };
366
+ };
367
+ type TokenInfo = Prettify<NativeTokenInfo & {
368
+ chainId: number;
369
+ balanceInUsd?: number | null;
370
+ isDisabledOnSwapBridge?: {
371
+ source: boolean;
372
+ destination: boolean;
373
+ };
374
+ isDisabledOnZap?: {
375
+ source: boolean;
376
+ destination: boolean;
377
+ };
378
+ permit?: TokenPermitData;
379
+ }>;
380
+ type TokenResponse = {
381
+ [key: string]: TokenInfo;
382
+ };
383
+ type TradeBuildTxnRequest = {
384
+ sender: HexString;
385
+ refundee: HexString;
386
+ fromChain: number;
387
+ gasless: boolean;
388
+ disableEstimation?: boolean;
389
+ data: TradeBuildTxnRequestData[];
390
+ hasPermit2ApprovalForAllTokens?: boolean;
391
+ publicKey?: string;
392
+ };
393
+ type TradeBuildTxnRequestData = {
394
+ amount: string;
395
+ srcToken: string;
396
+ srcDecimals?: number;
397
+ destToken: string;
398
+ destDecimals?: number;
399
+ toChain: number;
400
+ protocol: string;
401
+ recipient: string;
402
+ slippage: number;
403
+ additionalInfo?: AdditionalInfo;
404
+ permitData?: string;
405
+ permit?: TokenPermitData;
406
+ };
407
+ type ParamQuotes = {
408
+ additionalInfo?: Record<string, unknown>;
409
+ destAmount: string;
410
+ provider: string;
411
+ minDestAmount: string;
412
+ };
413
+ type EvmTxData = {
414
+ from: HexString;
415
+ data: HexString;
416
+ to: HexString;
417
+ value: string;
418
+ gasLimit: string;
419
+ };
420
+ type SvmTxData = {
421
+ from: string;
422
+ data: string;
423
+ blockhash?: string;
424
+ lastValidBlockHeight?: number;
425
+ };
426
+ type BtcTxData = {
427
+ from: string;
428
+ data: string;
429
+ inputs: PsbtInput[];
430
+ outputs: PsbtOutput[];
431
+ feeRate: number;
432
+ };
433
+ type TxData = EvmTxData | SvmTxData | BtcTxData;
434
+ type TxRequestData<T> = {
435
+ status: typeof STATUS.success;
436
+ txId: string;
437
+ chainId: number;
438
+ transaction: T;
439
+ };
440
+ type TradeGasBuildTxnResponse<T = TxData> = TxRequestData<T> & {
441
+ quotes: Record<string, ParamQuotes>;
442
+ gasless: false;
443
+ };
444
+ type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
445
+ data: string;
446
+ from: string;
447
+ to?: string;
448
+ value?: string;
449
+ gasLimit?: string;
450
+ svmTxData?: {
451
+ blockhash: string;
452
+ lastValidBlockHeight: number;
453
+ };
454
+ btcTxData?: {
455
+ inputs: PsbtInput[];
456
+ outputs: PsbtOutput[];
457
+ feeRate: number;
458
+ };
459
+ additionalInfo: Record<string, Record<string, unknown>>;
460
+ updatedQuotes: Record<string, string>;
461
+ };
462
+ type BridgeGaslessTxData = {
463
+ executorFeesHash: HexString;
464
+ swapDataHash?: HexString;
465
+ adapterDataHash: HexString;
466
+ txType: typeof GaslessTxType.bridge;
467
+ value: string;
468
+ };
469
+ type SwapGaslessTxData = {
470
+ executorFeesHash: HexString;
471
+ swapDataHash: HexString;
472
+ txType: typeof GaslessTxType.swap;
473
+ value: string;
474
+ };
475
+ type GaslessTradeBuildTxnResponse = {
476
+ status: 'success';
477
+ txId: HexString;
478
+ transaction: BridgeGaslessTxData | SwapGaslessTxData;
479
+ quotes: Record<string, ParamQuotes>;
480
+ gasless: true;
481
+ onlySwapData: false;
482
+ };
483
+ type AvailableDZapServices = (typeof Services)[keyof typeof Services];
484
+ type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
485
+ type DZapTransactionResponse = {
486
+ status: TxnStatus;
487
+ errorMsg?: string;
488
+ code: StatusCodes | number;
489
+ action?: keyof typeof contractErrorActions;
490
+ txnHash?: HexString;
491
+ error?: unknown;
492
+ additionalInfo?: Record<string, unknown>;
493
+ updatedQuotes?: Record<string, string>;
494
+ };
495
+ type SwapInfo = {
496
+ dex: string;
497
+ fromToken: string;
498
+ fromAmount: bigint;
499
+ toToken: string;
500
+ returnToAmount: bigint;
501
+ };
502
+ type StatusAsset = {
503
+ contract: string;
504
+ chainId: number;
505
+ name?: string;
506
+ symbol?: string;
507
+ decimals?: number;
508
+ logo?: string | undefined;
509
+ };
510
+ type TransactionInfo = {
511
+ asset: StatusAsset;
512
+ amount: string;
513
+ amountUSD: number;
514
+ txHash: string;
515
+ account: string;
516
+ };
517
+ type TxStatusForPair = {
518
+ source: TransactionInfo;
519
+ destination: TransactionInfo & {
520
+ timestamp?: number;
521
+ };
522
+ expected?: Omit<TransactionInfo, 'txHash' | 'status'>;
523
+ status: StatusResponse;
524
+ provider: ProviderDetails;
525
+ allowUserTxOnDestChain: boolean;
526
+ message?: string;
527
+ protocolExplorerLink?: string;
528
+ };
529
+ type TradeStatusResponse = {
530
+ status: StatusResponse;
531
+ gasless: boolean;
532
+ txHash: string;
533
+ chainId: number;
534
+ timestamp: number;
535
+ transactions: TxStatusForPair[];
536
+ };
537
+ type PermitMode = keyof typeof PermitTypes;
538
+ type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
539
+ type SinglePermitCallbackParams = {
540
+ permitData: HexString;
541
+ srcToken: HexString;
542
+ amount: string;
543
+ permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
544
+ };
545
+ type BatchPermitCallbackParams = {
546
+ batchPermitData: HexString;
547
+ tokens: {
548
+ address: HexString;
549
+ amount: string;
550
+ }[];
551
+ permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
552
+ };
553
+ type SignatureCallbackParams = SinglePermitCallbackParams | BatchPermitCallbackParams;
554
+ type SignatureParamsBase = {
555
+ chainId: number;
556
+ sender: HexString;
557
+ signer: WalletClient | Signer;
558
+ tokens: {
559
+ address: HexString;
560
+ permitData?: HexString;
561
+ amount: string;
562
+ permit?: TokenPermitData;
563
+ }[];
564
+ spender: HexString;
565
+ rpcUrls: string[];
566
+ permitType: PermitMode;
567
+ isBatchPermitAllowed?: boolean;
568
+ signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
569
+ service: AvailableDZapServices;
570
+ contractVersion: ContractVersion;
571
+ };
572
+ type GasSignatureParams = SignatureParamsBase & {
573
+ gasless: false;
574
+ };
575
+ type SignPermitResponse = {
576
+ status: TxnStatus.success;
577
+ code: StatusCodes;
578
+ tokens: {
579
+ address: HexString;
580
+ permitData?: HexString;
581
+ amount: string;
582
+ }[];
583
+ permitType: PermitMode;
584
+ } | {
585
+ status: TxnStatus.success;
586
+ code: StatusCodes;
587
+ batchPermitData: HexString;
588
+ permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
589
+ } | {
590
+ status: Exclude<TxnStatus, typeof TxnStatus.success>;
591
+ code: StatusCodes;
592
+ permitType: PermitMode;
593
+ };
594
+ type BroadcastTxData = string;
595
+ type BroadcastTxParams = {
596
+ txId: string;
597
+ chainId: number;
598
+ txData: BroadcastTxData;
599
+ };
600
+ type BroadcastTxResponse = {
601
+ status: TxnStatus.success;
602
+ txnHash: string;
603
+ } | {
604
+ status: Exclude<TxnStatus, typeof TxnStatus.success>;
605
+ message: string;
606
+ };
607
+
608
+ declare const zapPathAction: {
609
+ readonly swap: "swap";
610
+ readonly bridge: "bridge";
611
+ readonly deposit: "deposit";
612
+ readonly withdraw: "withdraw";
613
+ readonly stake: "stake";
614
+ readonly unstake: "unstake";
615
+ };
616
+
617
+ type ZapPathAction = keyof typeof zapPathAction;
618
+ type ZapPathAsset = {
619
+ chainId: number;
620
+ address: HexString;
621
+ symbol: string;
622
+ logo: string;
623
+ decimals: number;
624
+ price: string;
625
+ type: string;
626
+ name: string;
627
+ provider?: ProviderDetails;
628
+ underlyingTokens?: ZapUnderlyingToken[];
629
+ };
630
+ type ZapPath = {
631
+ action: ZapPathAction;
632
+ protocol: ProviderDetails;
633
+ fee: ZapFee[];
634
+ estimatedDuration: number;
635
+ input: {
636
+ asset: ZapPathAsset;
637
+ amount: string;
638
+ amountUSD: string;
639
+ }[];
640
+ output: {
641
+ asset: ZapPathAsset;
642
+ amount: string;
643
+ amountUSD: string;
644
+ dust?: boolean;
645
+ }[];
646
+ };
647
+
648
+ declare const chainTypes: {
649
+ readonly evm: "evm";
650
+ readonly bvm: "bvm";
651
+ readonly svm: "svm";
652
+ readonly aptosvm: "aptosvm";
653
+ readonly cosmos: "cosmos";
654
+ readonly nearvm: "nearvm";
655
+ readonly starknetvm: "starknetvm";
656
+ readonly stellarvm: "stellarvm";
657
+ readonly suivm: "suivm";
658
+ readonly tonvm: "tonvm";
659
+ readonly tronvm: "tronvm";
660
+ };
661
+
662
+ declare const zapStepAction: {
663
+ readonly execute: "execute";
664
+ };
665
+
666
+ type StepAction = keyof typeof zapStepAction;
667
+ type ZapEvmTxnDetails = {
668
+ type: typeof chainTypes.evm;
669
+ txnId: HexString;
670
+ callData: HexString;
671
+ callTo: HexString;
672
+ value: string;
673
+ estimatedGas: string;
674
+ };
675
+ type ZapBvmTxnDetails = {
676
+ type: typeof chainTypes.bvm;
677
+ txnId: HexString;
678
+ data: string;
679
+ };
680
+ type SVMTxnDetails = {
681
+ type: typeof chainTypes.svm;
682
+ txnId: HexString;
683
+ data: string[];
684
+ estimatedGas: string;
685
+ isJitoTx?: boolean;
686
+ };
687
+ type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
688
+ type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
689
+ action: StepAction;
690
+ data: T;
691
+ };
692
+ type ZapStep = ZapTransactionStep;
693
+
694
+ type ZapRouteRequestPositionDetails = {
695
+ nftId: string;
696
+ };
697
+ type ZapRouteRequestPoolDetails = {
698
+ lowerTick: number;
699
+ upperTick: number;
700
+ metadata?: unknown;
701
+ };
702
+ type ZapIntegratorConfig = {
703
+ id: string;
704
+ feeBps: number;
705
+ wallet: string;
706
+ };
707
+ type ZapBuildTxnResponse = {
708
+ amountOut: string;
709
+ approvalData: {
710
+ callTo: HexString;
711
+ approveTo: HexString;
712
+ amount: string;
713
+ } | null;
714
+ steps: ZapStep[];
715
+ path: ZapPath[];
716
+ };
717
+ type ZapBuildTxnRequest = {
718
+ srcToken: string;
719
+ srcChainId: number;
720
+ destToken: string;
721
+ destChainId: number;
722
+ recipient: string;
723
+ refundee: string;
724
+ slippage: number;
725
+ account: string;
726
+ integrator?: ZapIntegratorConfig;
727
+ permitData?: string;
728
+ amount?: string;
729
+ estimateGas?: boolean;
730
+ positionDetails?: ZapRouteRequestPositionDetails;
731
+ poolDetails?: ZapRouteRequestPoolDetails;
732
+ allowedBridges?: string[];
733
+ allowedDexes?: string[];
734
+ };
735
+
736
+ type ZapPoolDetailsRequest = {
737
+ address: HexString;
738
+ chainId: number;
739
+ provider: string;
740
+ };
741
+ type ZapPoolsRequest = {
742
+ chainId: number;
743
+ provider: string;
744
+ limit?: number;
745
+ offset?: number;
746
+ };
747
+ type ZapPoolsResponse = {
748
+ pools: ZapPool[];
749
+ pages: number;
750
+ limit: number;
751
+ offset: number;
752
+ };
753
+ type ZapPool = {
754
+ address: string;
755
+ chainId: number;
756
+ name: string;
757
+ provider: string;
758
+ underlyingAssets: ZapUnderlyingToken[];
759
+ tvl: string;
760
+ apr: number;
761
+ metadata?: unknown;
762
+ symbol: string;
763
+ decimals: number;
764
+ };
765
+ type ZapPoolDetails = {
766
+ address: string;
767
+ slot0: {
768
+ sqrtPriceX96: string;
769
+ tick: number;
770
+ tickSpacing: number;
771
+ };
772
+ };
773
+
774
+ type ZapPositionsRequest = {
775
+ account: HexString;
776
+ chainId: number;
777
+ provider: string;
778
+ };
779
+ type ZapPosition = {
780
+ underlyingAssets: ZapUnderlyingTokenWithAmount[];
781
+ address: string;
782
+ apr: number;
783
+ name: string;
784
+ chainId: number;
785
+ provider: string;
786
+ amount: string;
787
+ amountUSD: string;
788
+ nftDetails?: {
789
+ id: string;
790
+ manager: HexString;
791
+ };
792
+ metadata?: unknown;
793
+ decimals: number;
794
+ };
795
+ type ZapPositionsResponse = {
796
+ positions: ZapPosition[];
797
+ count: number;
798
+ };
799
+
800
+ type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
801
+ type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
802
+ refundee: string;
803
+ recipient: string;
804
+ account: string;
805
+ }>;
806
+
807
+ type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED' | 'REFUNDED';
808
+ type ZapStatusAsset = {
809
+ asset: ZapPathAsset;
810
+ amount: string;
811
+ amountUSD: string;
812
+ };
813
+ type ZapStatusStep = {
814
+ chainId: number;
815
+ hash?: string;
816
+ status: ZapStatus;
817
+ action: string;
818
+ protocol: ProviderDetails;
819
+ input: ZapStatusAsset[];
820
+ output: ZapStatusAsset[];
821
+ };
822
+ type ZapStatusResponse = {
823
+ status: ZapStatus;
824
+ steps: ZapStatusStep[];
825
+ recipient: string;
826
+ timestamp: number;
827
+ completedAt: number;
828
+ };
829
+ type ZapStatusRequest = {
830
+ chainId: number;
831
+ txnHash: string;
832
+ };
833
+
834
+ type ZapProviders = Record<string, ProviderDetails>;
835
+ type ZapChains = {
836
+ [key: string]: {
837
+ name: string;
838
+ supportedProviders: string[];
839
+ };
840
+ };
841
+ type ZapFee = {
842
+ amount: string;
843
+ amountUSD: string;
844
+ asset: ZapPathAsset;
845
+ included: boolean;
846
+ };
847
+ type ZapUnderlyingToken = {
848
+ chainId: number;
849
+ address: HexString;
850
+ name?: string;
851
+ symbol: string;
852
+ decimals: number;
853
+ logo?: string | null;
854
+ };
855
+ type ZapUnderlyingTokenWithAmount = ZapUnderlyingToken & {
856
+ amount: string;
857
+ amountUSD: string;
858
+ };
859
+
860
+ type BatchCallParams = {
861
+ to: HexString;
862
+ data: HexString;
863
+ value?: bigint;
864
+ };
865
+
7
866
  declare class DZapClient {
8
867
  private static instance;
9
868
  private cancelTokenSource;
@@ -12,7 +871,7 @@ declare class DZapClient {
12
871
  private constructor();
13
872
  static getInstance(apiKey?: string, rpcUrlsByChainId?: Record<number, string[]>): DZapClient;
14
873
  static getChainConfig(): Promise<ChainData>;
15
- static getDZapAbi(service: AvailableDZapServices, version: ContractVersion): import("viem").Abi;
874
+ static getDZapAbi(service: AvailableDZapServices, version: ContractVersion): viem.Abi;
16
875
  static getOtherAbi: (name: OtherAvailableAbis) => readonly [{
17
876
  readonly inputs: readonly [{
18
877
  readonly internalType: "uint256";
@@ -898,13 +1757,13 @@ declare class DZapClient {
898
1757
  txnData?: TradeBuildTxnResponse;
899
1758
  batchTransaction?: boolean;
900
1759
  rpcUrls?: string[];
901
- }): Promise<import("../types").DZapTransactionResponse>;
1760
+ }): Promise<DZapTransactionResponse>;
902
1761
  tradeGasless({ request, signer, txnData, txnStatusCallback, }: {
903
1762
  request: TradeBuildTxnRequest;
904
1763
  signer: Signer | WalletClient;
905
1764
  txnData?: GaslessTradeBuildTxnResponse;
906
1765
  txnStatusCallback?: (status: TxnStatus) => void;
907
- }): Promise<import("../types").DZapTransactionResponse>;
1766
+ }): Promise<DZapTransactionResponse>;
908
1767
  sendTransaction({ chainId, signer, txnData }: {
909
1768
  chainId: number;
910
1769
  signer: Signer | WalletClient;
@@ -922,14 +1781,14 @@ declare class DZapClient {
922
1781
  waitForBatchTransactionReceipt({ walletClient, batchHash }: {
923
1782
  walletClient: WalletClient;
924
1783
  batchHash: HexString;
925
- }): Promise<import("../types/wallet").WalletCallReceipt>;
1784
+ }): Promise<WalletCallReceipt>;
926
1785
  decodeTxnData({ data, service, chainId }: {
927
1786
  data: TransactionReceipt;
928
1787
  service: AvailableDZapServices;
929
1788
  chainId: number;
930
1789
  }): Promise<{
931
1790
  swapFailPairs: string[];
932
- swapInfo: import("../types").SwapInfo | import("../types").SwapInfo[];
1791
+ swapInfo: SwapInfo | SwapInfo[];
933
1792
  }>;
934
1793
  calculatePoints(request: CalculatePointsRequest): Promise<{
935
1794
  points: number;
@@ -993,7 +1852,7 @@ declare class DZapClient {
993
1852
  request: ZapBuildTxnRequest;
994
1853
  signer: WalletClient | Signer;
995
1854
  steps?: ZapTransactionStep[];
996
- }): Promise<import("../types").DZapTransactionResponse | {
1855
+ }): Promise<DZapTransactionResponse | {
997
1856
  status: TxnStatus.success;
998
1857
  code: StatusCodes | number;
999
1858
  txnHash: HexString;
@@ -1016,4 +1875,45 @@ declare class DZapClient {
1016
1875
  broadcastTradeTx(request: BroadcastTxParams): Promise<BroadcastTxResponse>;
1017
1876
  broadcastZapTx(request: BroadcastTxParams): Promise<BroadcastTxResponse>;
1018
1877
  }
1019
- export default DZapClient;
1878
+
1879
+ declare function getTokensPairKey({ srcToken, destToken, srcChainId, destChainId, srcChainNativeAddress, destChainNativeAddress, }: {
1880
+ srcToken: string;
1881
+ destToken: string;
1882
+ srcChainId: number;
1883
+ destChainId: number;
1884
+ srcChainNativeAddress?: string;
1885
+ destChainNativeAddress?: string;
1886
+ }): string;
1887
+
1888
+ declare class SwapInputDataDecoder {
1889
+ private decodeSingleSwapData;
1890
+ private decodeMultiSwapData;
1891
+ private decodeBatchPermitSwapData;
1892
+ private decodeGaslessExecuteMultiSwapData;
1893
+ private decodeGaslessExecuteMultiSwapWithWitnessData;
1894
+ private decodeGaslessExecuteSwapData;
1895
+ private readonly swapFunctionSignatureWithInputTokenIndex;
1896
+ updateSwapInfo: ({ data, eventSwapInfo, }: {
1897
+ eventSwapInfo?: SwapInfo[] | SwapInfo;
1898
+ data?: HexString;
1899
+ }) => SwapInfo[] | SwapInfo | undefined;
1900
+ }
1901
+
1902
+ declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
1903
+ chainId: number;
1904
+ address: HexString;
1905
+ rpcUrls?: string[];
1906
+ owner: HexString;
1907
+ permit?: TokenPermitData;
1908
+ }) => Promise<{
1909
+ supportsPermit: boolean;
1910
+ data?: {
1911
+ version: string;
1912
+ name: string;
1913
+ nonce: bigint;
1914
+ };
1915
+ }>;
1916
+
1917
+ declare const formatToken: <T extends HexString | string = string>(token: T, nativeTokenAddress?: T) => T;
1918
+
1919
+ export { type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, type ProviderDetails, type PsbtInput, type PsbtOutput, type QuoteFilter, QuoteFilters, STATUS, type SVMTxnDetails, Services, type SignPermitResponse, type SignatureCallbackParams, SignatureExpiryInSecs, type SinglePermitCallbackParams, StatusCodes, type StepAction, type SvmTxData, type SwapInfo, SwapInputDataDecoder, type Token, type TokenInfo, type TokenPermitData, type TokenResponse, type TradeBuildTxnRequest, type TradeBuildTxnRequestData, type TradeBuildTxnResponse, type TradeGasBuildTxnResponse, type TradePath, type TradeQuotesRequest, type TradeQuotesRequestData, type TradeQuotesResponse, type TradeStatusResponse, type TradeStep, TxnStatus, type ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapIntegratorConfig, type ZapPath, type ZapPathAction, type ZapPathAsset, type ZapPool, type ZapPoolDetails, type ZapPoolDetailsRequest, type ZapPoolsRequest, type ZapPoolsResponse, type ZapPosition, type ZapPositionsRequest, type ZapPositionsResponse, type ZapProviders, type ZapQuoteRequest, type ZapQuoteResponse, type ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusAsset, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };