@dzapio/sdk 1.0.3 → 2.0.2

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 (43) hide show
  1. package/dist/api/index.d.ts +3 -1
  2. package/dist/artifacts/ERC20Permit.d.ts +38 -0
  3. package/dist/artifacts/Permit2Proxy.d.ts +416 -0
  4. package/dist/artifacts/default/Permit2Abi.d.ts +700 -70
  5. package/dist/chains/definitions/arthera.d.ts +35 -0
  6. package/dist/chains/definitions/fiveIre.d.ts +35 -0
  7. package/dist/chains/definitions/hyperEvm.d.ts +35 -0
  8. package/dist/chains/definitions/hyperliquid.d.ts +35 -0
  9. package/dist/chains/index.d.ts +143 -0
  10. package/dist/constants/address.d.ts +0 -1
  11. package/dist/constants/approval.d.ts +3 -1
  12. package/dist/constants/chains.d.ts +1 -0
  13. package/dist/constants/index.d.ts +4 -0
  14. package/dist/constants/permit.d.ts +25 -1
  15. package/dist/constants/urlConstants.d.ts +2 -0
  16. package/dist/dZapClient/index.d.ts +717 -103
  17. package/dist/enums/index.d.ts +7 -5
  18. package/dist/index.d.ts +7 -9
  19. package/dist/index.js +1 -1
  20. package/dist/index.m.js +1 -1
  21. package/dist/index.umd.js +1 -1
  22. package/dist/transactionHandlers/permit.d.ts +48 -47
  23. package/dist/transactionHandlers/trade.d.ts +9 -1
  24. package/dist/types/eip-2612.d.ts +19 -1
  25. package/dist/types/index.d.ts +182 -16
  26. package/dist/types/permit.d.ts +191 -0
  27. package/dist/types/zap/build.d.ts +6 -6
  28. package/dist/types/zap/quote.d.ts +5 -1
  29. package/dist/utils/eip-2612/eip2612Permit.d.ts +23 -0
  30. package/dist/utils/erc20.d.ts +17 -15
  31. package/dist/utils/index.d.ts +734 -104
  32. package/dist/utils/permit2/domain.d.ts +2 -0
  33. package/dist/utils/permit2/index.d.ts +4 -0
  34. package/dist/utils/permit2/nonce.d.ts +15 -0
  35. package/dist/utils/permit2/permitData.d.ts +23 -0
  36. package/dist/utils/permit2/values.d.ts +54 -0
  37. package/dist/utils/permit2/witnessData.d.ts +4 -0
  38. package/dist/utils/signIntent/custom.d.ts +11 -0
  39. package/dist/utils/signIntent/gasless.d.ts +12 -0
  40. package/package.json +12 -2
  41. package/dist/utils/chains.d.ts +0 -2
  42. package/dist/utils/permit/permit2Methods.d.ts +0 -33
  43. package/dist/utils/permit/permitMethods.d.ts +0 -37
@@ -1,60 +1,61 @@
1
- import { Signer } from 'ethers';
2
- import { WalletClient } from 'viem';
1
+ import { PermitTypes } from '../constants/permit';
3
2
  import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
4
- import { AvailableDZapServices, HexString, PermitMode } from '../types';
3
+ import { AvailableDZapServices, GaslessSignatureParams, GasSignatureParams, HexString, PermitMode, SignPermitResponse } from '../types';
4
+ import { BatchPermitResponse, GaslessBridgeParams, GaslessSwapParams, PermitParams, PermitResponse, TokenWithPermitData } from '../types/permit';
5
+ type BasePermitDataParams = {
6
+ oneToMany: boolean;
7
+ token: TokenWithPermitData;
8
+ totalSrcAmount: bigint;
9
+ permitType: PermitMode;
10
+ firstTokenNonce?: bigint;
11
+ } & Omit<PermitParams, 'permitType'>;
12
+ type PermitDataParams = BasePermitDataParams & ({
13
+ gasless: false;
14
+ } | GaslessSwapParams | GaslessBridgeParams);
15
+ type BaseBatchPermitParams = {
16
+ tokens: TokenWithPermitData[];
17
+ permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
18
+ } & Omit<PermitParams, 'permitType'>;
19
+ type BatchPermitParams = BaseBatchPermitParams & ({
20
+ gasless: false;
21
+ } | GaslessSwapParams | GaslessBridgeParams);
5
22
  declare class PermitTxnHandler {
6
- static generatePermitDataForToken: ({ token, isFirstToken, oneToMany, totalSrcAmount, chainId, rpcUrls, sender, spender, permitType, signer, service, permitEIP2612DisabledTokens, contractVersion, }: {
7
- token: {
8
- address: HexString;
9
- amount: string;
10
- };
11
- isFirstToken: boolean;
12
- oneToMany: boolean;
13
- totalSrcAmount: bigint;
14
- chainId: number;
15
- rpcUrls?: string[];
16
- sender: HexString;
17
- spender: HexString;
18
- permitType: PermitMode;
19
- signer: WalletClient | Signer;
20
- service: AvailableDZapServices;
21
- permitEIP2612DisabledTokens?: string[];
22
- contractVersion: ContractVersion;
23
- }) => Promise<{
23
+ static generateBatchPermitDataForTokens: (params: BatchPermitParams) => Promise<BatchPermitResponse>;
24
+ static generatePermitDataForToken: (params: PermitDataParams) => Promise<PermitResponse>;
25
+ static signGaslessUserIntent: (signPermitReq: GaslessSignatureParams) => Promise<{
24
26
  status: TxnStatus;
25
27
  code: StatusCodes;
26
- permitData: HexString;
27
- permitType: PermitMode;
28
+ data: {
29
+ type: "EIP2612Permit";
30
+ signature: HexString;
31
+ nonce: bigint;
32
+ deadline: bigint;
33
+ batchPermitData?: undefined;
34
+ } | undefined;
35
+ } | {
36
+ status: TxnStatus;
37
+ code: StatusCodes;
38
+ data: {
39
+ type: "PermitSingle" | "PermitWitnessTransferFrom" | "PermitBatchWitnessTransferFrom";
40
+ batchPermitData: `0x${string}`;
41
+ } | undefined;
28
42
  }>;
29
- static signPermit: ({ chainId, tokens, rpcUrls, sender, signer, service, signatureCallback, spender, permitType, permitEIP2612DisabledTokens, contractVersion, }: {
30
- chainId: number;
31
- sender: HexString;
32
- tokens: {
33
- address: HexString;
34
- permitData?: HexString;
35
- amount: string;
36
- }[];
43
+ static v1PermitSupport: ({ contractVersion, service }: {
44
+ contractVersion: ContractVersion;
37
45
  service: AvailableDZapServices;
38
- rpcUrls?: string[];
39
- signer: WalletClient | Signer;
40
- signatureCallback?: ({ permitData, srcToken, amount, permitType, }: {
41
- permitData: HexString;
42
- srcToken: HexString;
43
- amount: string;
44
- permitType: PermitMode;
45
- }) => Promise<void>;
46
- spender: HexString;
46
+ }) => boolean;
47
+ static shouldUseBatchPermit: ({ permitType, isBatchPermitAllowed, tokens, oneToMany, contractVersion, service, }: {
47
48
  permitType: PermitMode;
48
- permitEIP2612DisabledTokens?: string[];
49
- contractVersion: ContractVersion;
50
- }) => Promise<{
51
- status: TxnStatus;
49
+ isBatchPermitAllowed?: boolean;
52
50
  tokens: {
53
51
  address: HexString;
54
- permitData?: HexString;
52
+ permitData?: HexString | undefined;
55
53
  amount: string;
56
54
  }[];
57
- code: StatusCodes;
58
- }>;
55
+ oneToMany: boolean;
56
+ contractVersion: ContractVersion;
57
+ service: AvailableDZapServices;
58
+ }) => boolean;
59
+ static signPermit: (signPermitReq: GasSignatureParams) => Promise<SignPermitResponse>;
59
60
  }
60
61
  export default PermitTxnHandler;
@@ -1,9 +1,10 @@
1
1
  import { Signer } from 'ethers';
2
2
  import { WalletClient } from 'viem';
3
- import { DZapTransactionResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
3
+ import { DZapTransactionResponse, GaslessTradeBuildTxnResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
4
4
  declare class TradeTxnHandler {
5
5
  private static sendTransaction;
6
6
  private static sendTxnWithBatch;
7
+ private static sendHyperLiquidTransaction;
7
8
  static buildAndSendTransaction: ({ request, signer, txnData, multicallAddress, batchTransaction, rpcUrls, }: {
8
9
  request: TradeBuildTxnRequest;
9
10
  signer: Signer | WalletClient;
@@ -12,5 +13,12 @@ declare class TradeTxnHandler {
12
13
  multicallAddress?: HexString;
13
14
  rpcUrls?: string[];
14
15
  }) => Promise<DZapTransactionResponse>;
16
+ static buildGaslessTxAndSignPermit: ({ request, signer, rpcUrls, spender, txnData, }: {
17
+ request: TradeBuildTxnRequest;
18
+ signer: Signer | WalletClient;
19
+ rpcUrls: string[];
20
+ spender: HexString;
21
+ txnData?: GaslessTradeBuildTxnResponse;
22
+ }) => Promise<DZapTransactionResponse>;
15
23
  }
16
24
  export default TradeTxnHandler;
@@ -1,6 +1,24 @@
1
- export declare const EIP2612Types: {
1
+ export declare const EIP2612DefaultTypes: {
2
2
  Permit: {
3
3
  name: string;
4
4
  type: string;
5
5
  }[];
6
6
  };
7
+ export declare const DzapUserIntentSwapTypes: {
8
+ SignedGasLessSwapData: {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ };
13
+ export declare const DzapUserIntentBridgeTypes: {
14
+ SignedGasLessBridgeData: {
15
+ name: string;
16
+ type: string;
17
+ }[];
18
+ };
19
+ export declare const DzapUserIntentSwapBridgeTypes: {
20
+ SignedGasLessSwapBridgeData: {
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ };
@@ -1,8 +1,11 @@
1
- import { DZapAbis, OtherAbis, QuoteFilters, Services, STATUS_RESPONSE } from '../constants';
2
- import { ApprovalModes } from '../constants/approval';
3
- import { PermitTypes } from '../constants/permit';
4
- import { AppEnv, ContractVersion, StatusCodes, TxnStatus } from '../enums';
1
+ import { Signer } from 'ethers';
2
+ import { Prettify, TypedDataDomain, WalletClient } from 'viem';
3
+ import { DZapAbis, GaslessTxType, OtherAbis, QuoteFilters, Services, STATUS, STATUS_RESPONSE } from './../constants';
4
+ import { ApprovalModes } from './../constants/approval';
5
+ import { PermitTypes } from './../constants/permit';
6
+ import { AppEnv, ContractVersion, StatusCodes, TxnStatus } from './../enums';
5
7
  import { PsbtInput, PsbtOutput } from './btc';
8
+ import { GaslessBridgeParams, GaslessSwapParams } from './permit';
6
9
  export type HexString = `0x${string}`;
7
10
  export type ChainData = {
8
11
  [key in number]: Chain;
@@ -14,6 +17,7 @@ export type NativeTokenInfo = {
14
17
  name: string;
15
18
  balance: string;
16
19
  price?: string;
20
+ logo: string;
17
21
  };
18
22
  export declare const contractErrorActions: {
19
23
  readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
@@ -86,7 +90,6 @@ export type Chain = {
86
90
  mainnet: boolean;
87
91
  tags?: Tag[];
88
92
  version?: ContractVersion;
89
- permitDisabledTokens?: DisabledPermitTokens;
90
93
  };
91
94
  export type ApiRpcResponse = {
92
95
  url: string;
@@ -116,11 +119,18 @@ export type Fee = {
116
119
  export type QuoteFilter = keyof typeof QuoteFilters;
117
120
  export type TradeQuotesRequest = {
118
121
  fromChain: number;
122
+ gasless?: boolean;
119
123
  data: TradeQuotesRequestData[];
120
124
  disableEstimation?: boolean;
121
125
  account?: string;
122
126
  allowedProtocols?: string[];
123
127
  filter?: QuoteFilter;
128
+ timingStrategy?: Partial<{
129
+ minWaitTimeMs: number;
130
+ maxWaitTimeMs: number;
131
+ subsequentDelayMs: number;
132
+ preferredResultCount: number;
133
+ }>;
124
134
  };
125
135
  export type TradeQuotesRequestData = {
126
136
  amount: string;
@@ -169,6 +179,7 @@ export type TradeQuote = {
169
179
  fee: Fee;
170
180
  priceImpactPercent: string;
171
181
  duration: string;
182
+ gasless: boolean;
172
183
  steps: TradeStep[];
173
184
  path: TradePath[];
174
185
  tags?: Tag[];
@@ -200,7 +211,18 @@ export type Token = {
200
211
  symbol: string;
201
212
  price?: string;
202
213
  };
203
- export type TokenInfo = NativeTokenInfo & {
214
+ export type TokenPermitData = {
215
+ eip2612: {
216
+ supported: boolean;
217
+ data?: {
218
+ domain?: TypedDataDomain;
219
+ };
220
+ };
221
+ permit2: {
222
+ supported: boolean;
223
+ };
224
+ };
225
+ export type TokenInfo = Prettify<NativeTokenInfo & {
204
226
  chainId: number;
205
227
  balanceInUsd?: number | null;
206
228
  isDisabledOnSwapBridge?: {
@@ -211,7 +233,8 @@ export type TokenInfo = NativeTokenInfo & {
211
233
  source: boolean;
212
234
  destination: boolean;
213
235
  };
214
- };
236
+ permit?: TokenPermitData;
237
+ }>;
215
238
  export type TokenResponse = {
216
239
  [key: string]: TokenInfo;
217
240
  };
@@ -219,8 +242,10 @@ export type TradeBuildTxnRequest = {
219
242
  sender: HexString;
220
243
  refundee: HexString;
221
244
  fromChain: number;
245
+ gasless: boolean;
222
246
  disableEstimation?: boolean;
223
247
  data: TradeBuildTxnRequestData[];
248
+ hasPermit2ApprovalForAllTokens?: boolean;
224
249
  publicKey?: string;
225
250
  };
226
251
  export type TradeBuildTxnRequestData = {
@@ -235,28 +260,85 @@ export type TradeBuildTxnRequestData = {
235
260
  slippage: number;
236
261
  additionalInfo?: AdditionalInfo;
237
262
  permitData?: string;
263
+ permit?: TokenPermitData;
238
264
  };
239
- export type ExecuteTxnData = {
265
+ export type ParamQuotes = {
266
+ additionalInfo?: Record<string, unknown>;
267
+ destAmount: string;
268
+ provider: string;
269
+ minDestAmount: string;
270
+ };
271
+ export type EvmTxData = {
272
+ from: HexString;
240
273
  data: HexString;
241
274
  to: HexString;
242
- from: HexString;
243
- chainId: number;
244
275
  value: string;
245
276
  gasLimit: string;
246
277
  };
247
- export type TradeBuildTxnResponse = ExecuteTxnData & {
248
- additionalInfo?: AdditionalInfo;
278
+ export type SvmTxData = {
279
+ from: string;
280
+ data: string;
281
+ blockhash?: string;
282
+ lastValidBlockHeight?: number;
283
+ };
284
+ export type BtcTxData = {
285
+ from: string;
286
+ data: string;
287
+ inputs: PsbtInput[];
288
+ outputs: PsbtOutput[];
289
+ feeRate: number;
290
+ };
291
+ export type TxData = EvmTxData | SvmTxData | BtcTxData;
292
+ export type TxRequestData<T> = {
293
+ status: typeof STATUS.success;
294
+ txId: string;
295
+ chainId: number;
296
+ transaction: T;
297
+ };
298
+ export type TradeGasBuildTxnResponse<T = TxData> = TxRequestData<T> & {
299
+ quotes: Record<string, ParamQuotes>;
300
+ gasless: false;
301
+ };
302
+ export type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
303
+ data: string;
304
+ from: string;
305
+ to?: string;
306
+ value?: string;
307
+ gasLimit?: string;
308
+ svmTxData?: {
309
+ blockhash: string;
310
+ lastValidBlockHeight: number;
311
+ };
249
312
  btcTxData?: {
250
313
  inputs: PsbtInput[];
251
314
  outputs: PsbtOutput[];
252
315
  feeRate: number;
253
316
  };
254
- svmTxData?: {
255
- blockhash: string;
256
- lastValidBlockHeight: number;
257
- };
317
+ additionalInfo: Record<string, Record<string, unknown>>;
258
318
  updatedQuotes: Record<string, string>;
259
319
  };
320
+ export type GaslessTxTypes = keyof typeof GaslessTxType;
321
+ type BridgeGaslessTxData = {
322
+ executorFeesHash: HexString;
323
+ swapDataHash?: HexString;
324
+ adapterDataHash: HexString;
325
+ txType: typeof GaslessTxType.bridge;
326
+ value: string;
327
+ };
328
+ type SwapGaslessTxData = {
329
+ executorFeesHash: HexString;
330
+ swapDataHash: HexString;
331
+ txType: typeof GaslessTxType.swap;
332
+ value: string;
333
+ };
334
+ export type GaslessTradeBuildTxnResponse = {
335
+ status: 'success';
336
+ txId: HexString;
337
+ transaction: BridgeGaslessTxData | SwapGaslessTxData;
338
+ quotes: Record<string, ParamQuotes>;
339
+ gasless: true;
340
+ onlySwapData: false;
341
+ };
260
342
  export type AvailableDZapServices = (typeof Services)[keyof typeof Services];
261
343
  export type DZapAvailableAbis = (typeof DZapAbis)[keyof typeof DZapAbis];
262
344
  export type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
@@ -312,5 +394,89 @@ export type TradeStatusResponseData = PartialStatusData & RefundStatusData & {
312
394
  export type TradeStatusResponse = {
313
395
  [pair: string]: TradeStatusResponseData;
314
396
  };
397
+ export type EIP2612GaslessExecuteTxParams = {
398
+ permitData: {
399
+ token: HexString;
400
+ amount: string;
401
+ permit: HexString;
402
+ }[];
403
+ gaslessIntentSignature: HexString;
404
+ gaslessIntentDeadline: string;
405
+ gaslessIntentNonce: string;
406
+ };
407
+ export type BatchGaslessExecuteTxParams = {
408
+ batchPermitData: HexString;
409
+ };
410
+ export type GaslessExecuteTxParams = {
411
+ chainId: number;
412
+ txId: HexString;
413
+ permit: EIP2612GaslessExecuteTxParams | BatchGaslessExecuteTxParams;
414
+ };
315
415
  export type PermitMode = keyof typeof PermitTypes;
316
416
  export type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
417
+ export type SinglePermitCallbackParams = {
418
+ permitData: HexString;
419
+ srcToken: HexString;
420
+ amount: string;
421
+ permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
422
+ };
423
+ export type BatchPermitCallbackParams = {
424
+ batchPermitData: HexString;
425
+ tokens: {
426
+ address: HexString;
427
+ amount: string;
428
+ }[];
429
+ permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
430
+ };
431
+ export type SignatureCallbackParams = SinglePermitCallbackParams | BatchPermitCallbackParams;
432
+ export type SignatureParamsBase = {
433
+ chainId: number;
434
+ sender: HexString;
435
+ signer: WalletClient | Signer;
436
+ tokens: {
437
+ address: HexString;
438
+ permitData?: HexString;
439
+ amount: string;
440
+ permit?: TokenPermitData;
441
+ }[];
442
+ spender: HexString;
443
+ rpcUrls: string[];
444
+ permitType: PermitMode;
445
+ isBatchPermitAllowed?: boolean;
446
+ signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
447
+ service: AvailableDZapServices;
448
+ contractVersion: ContractVersion;
449
+ };
450
+ export type GasSignatureParams = SignatureParamsBase & {
451
+ gasless: false;
452
+ };
453
+ export type GaslessSignatureParams = ((SignatureParamsBase & GaslessBridgeParams) | (SignatureParamsBase & GaslessSwapParams)) & {
454
+ gasless: true;
455
+ };
456
+ export type SignatureParams = GasSignatureParams | GaslessSignatureParams;
457
+ export type SignPermitResponse = {
458
+ status: TxnStatus.success;
459
+ code: StatusCodes;
460
+ tokens: {
461
+ address: HexString;
462
+ permitData?: HexString;
463
+ amount: string;
464
+ }[];
465
+ permitType: PermitMode;
466
+ } | {
467
+ status: TxnStatus.success;
468
+ code: StatusCodes;
469
+ batchPermitData: HexString;
470
+ permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
471
+ } | {
472
+ status: Exclude<TxnStatus, typeof TxnStatus.success>;
473
+ code: StatusCodes;
474
+ permitType: PermitMode;
475
+ };
476
+ export type BroadcastTxData = string;
477
+ export type BroadcastTxParams = {
478
+ txId: string;
479
+ chainId: number;
480
+ txData: BroadcastTxData;
481
+ };
482
+ export {};
@@ -0,0 +1,191 @@
1
+ import { Signer, TypedDataField } from 'ethers';
2
+ import { HexString, PermitMode, StatusCodes, TxnStatus } from '..';
3
+ import { GaslessTxType } from '../constants';
4
+ import { permit2PrimaryType } from '../constants/permit';
5
+ import { ContractVersion } from '../enums';
6
+ import { Address, TypedDataDomain, WalletClient } from 'viem';
7
+ import { AvailableDZapServices, TokenPermitData } from '.';
8
+ export declare const defaultWitnessType: {
9
+ typeName: string;
10
+ type: {
11
+ DZapTransferWitness: {
12
+ name: string;
13
+ type: string;
14
+ }[];
15
+ };
16
+ };
17
+ export declare const swapGaslessWitnessType: {
18
+ typeName: string;
19
+ type: {
20
+ DZapSwapWitness: {
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ };
25
+ };
26
+ export declare const bridgeGaslessWitnessType: {
27
+ typeName: string;
28
+ type: {
29
+ DZapBridgeWitness: {
30
+ name: string;
31
+ type: string;
32
+ }[];
33
+ };
34
+ };
35
+ export declare const BatchPermitAbiParams: readonly [{
36
+ readonly name: "permit";
37
+ readonly type: "tuple";
38
+ readonly components: readonly [{
39
+ readonly name: "permitted";
40
+ readonly type: "tuple[]";
41
+ readonly components: readonly [{
42
+ readonly name: "token";
43
+ readonly type: "address";
44
+ }, {
45
+ readonly name: "amount";
46
+ readonly type: "uint256";
47
+ }];
48
+ }, {
49
+ readonly name: "nonce";
50
+ readonly type: "uint256";
51
+ }, {
52
+ readonly name: "deadline";
53
+ readonly type: "uint256";
54
+ }];
55
+ }, {
56
+ readonly name: "permitSignature";
57
+ readonly type: "bytes";
58
+ }];
59
+ type BaseToken = {
60
+ address: HexString;
61
+ amount: string;
62
+ };
63
+ export type TokenWithIndex = {
64
+ index: number;
65
+ } & BaseToken;
66
+ type TokenPermissions = {
67
+ token: Address;
68
+ amount: bigint;
69
+ };
70
+ export type TokenWithPermitData = {
71
+ index: number;
72
+ address: HexString;
73
+ amount: string;
74
+ permit?: TokenPermitData;
75
+ };
76
+ export type Permit2PrimaryType = (typeof permit2PrimaryType)[keyof typeof permit2PrimaryType];
77
+ type GaslessBaseParams = {
78
+ gasless: true;
79
+ txId: HexString;
80
+ executorFeesHash: HexString;
81
+ };
82
+ export type GaslessSwapParams = {
83
+ txType: typeof GaslessTxType.swap;
84
+ swapDataHash: HexString;
85
+ } & GaslessBaseParams;
86
+ export type GaslessBridgeParams = {
87
+ txType: typeof GaslessTxType.bridge;
88
+ adapterDataHash: HexString;
89
+ swapDataHash?: HexString;
90
+ } & GaslessBaseParams;
91
+ export type BasePermitParams = {
92
+ chainId: number;
93
+ account: HexString;
94
+ spender: HexString;
95
+ rpcUrls?: string[];
96
+ deadline?: bigint;
97
+ signer: WalletClient | Signer;
98
+ contractVersion: ContractVersion;
99
+ service: AvailableDZapServices;
100
+ };
101
+ type Permit2612BaseParams = {
102
+ token: TokenWithPermitData;
103
+ version: string;
104
+ sigDeadline?: bigint;
105
+ name: string;
106
+ nonce: bigint;
107
+ } & BasePermitParams;
108
+ export type DefaultPermit2612Params = {
109
+ gasless: false;
110
+ } & Permit2612BaseParams;
111
+ type GaslessSwapPermit2612Params = BasePermitParams & GaslessSwapParams;
112
+ type GaslessBridgePermit2612Params = BasePermitParams & GaslessBridgeParams;
113
+ export type Gasless2612PermitParams = GaslessSwapPermit2612Params | GaslessBridgePermit2612Params;
114
+ export type CustomTypedDataParams = {
115
+ account: HexString;
116
+ signer: WalletClient | Signer;
117
+ domain: TypedDataDomain;
118
+ types: Record<string, Array<TypedDataField>>;
119
+ message: Record<string, any>;
120
+ primaryType: string;
121
+ };
122
+ export type Permit2612Params = DefaultPermit2612Params | Gasless2612PermitParams;
123
+ export type BasePermit2Params = {
124
+ tokens: TokenWithPermitData[];
125
+ expiration?: bigint;
126
+ permitType: Permit2PrimaryType;
127
+ firstTokenNonce?: bigint;
128
+ } & BasePermitParams;
129
+ type DefaultPermit2Params = {
130
+ gasless: false;
131
+ } & BasePermit2Params;
132
+ type GaslessSwapPermit2Params = BasePermit2Params & GaslessSwapParams;
133
+ type GaslessBridgePermit2Params = BasePermit2Params & GaslessBridgeParams;
134
+ export type Permit2Params = DefaultPermit2Params | GaslessSwapPermit2Params | GaslessBridgePermit2Params;
135
+ export type PermitParams = Permit2612Params | Permit2Params;
136
+ export type BasePermitResponse = {
137
+ status: TxnStatus;
138
+ code: StatusCodes;
139
+ permitData?: HexString;
140
+ nonce?: bigint;
141
+ };
142
+ export type PermitResponse = {
143
+ permitType: PermitMode;
144
+ } & BasePermitResponse;
145
+ export type BatchPermitResponse = {
146
+ permitType: typeof permit2PrimaryType.PermitBatchWitnessTransferFrom;
147
+ } & BasePermitResponse;
148
+ type BaseWitnessStructure<T, N extends string, TType> = {
149
+ witness: T;
150
+ witnessTypeName: N;
151
+ witnessType: TType;
152
+ };
153
+ type GaslessWitnessData = {
154
+ txId: HexString;
155
+ user: HexString;
156
+ executorFeesHash: HexString;
157
+ swapDataHash: HexString;
158
+ };
159
+ type BridgeWitnessData = {
160
+ adapterDataHash: HexString;
161
+ } & GaslessWitnessData;
162
+ export type DefaultWitnessData = BaseWitnessStructure<{
163
+ owner: HexString;
164
+ recipient: HexString;
165
+ }, typeof defaultWitnessType.typeName, typeof defaultWitnessType.type>;
166
+ export type SwapGaslessWitnessData = BaseWitnessStructure<GaslessWitnessData, typeof swapGaslessWitnessType.typeName, typeof swapGaslessWitnessType.type>;
167
+ export type BridgeGaslessWitnessData = BaseWitnessStructure<BridgeWitnessData, typeof bridgeGaslessWitnessType.typeName, typeof bridgeGaslessWitnessType.type>;
168
+ export type WitnessData = DefaultWitnessData | SwapGaslessWitnessData | BridgeGaslessWitnessData;
169
+ export type PermitSingleValues = {
170
+ details: {
171
+ token: Address;
172
+ amount: bigint;
173
+ expiration: bigint;
174
+ nonce: number;
175
+ };
176
+ spender: Address;
177
+ sigDeadline: bigint;
178
+ };
179
+ export type PermitTransferFromValues = {
180
+ permitted: TokenPermissions;
181
+ spender: Address;
182
+ nonce: bigint;
183
+ deadline: bigint;
184
+ };
185
+ export type PermitBatchTransferFromValues = {
186
+ permitted: TokenPermissions[];
187
+ spender: Address;
188
+ nonce: bigint;
189
+ deadline: bigint;
190
+ };
191
+ export {};
@@ -20,15 +20,15 @@ export type ZapBuildTxnResponse = {
20
20
  path: ZapPath[];
21
21
  };
22
22
  export type ZapBuildTxnRequest = {
23
- srcToken: HexString;
23
+ srcToken: string;
24
24
  srcChainId: number;
25
- destToken: HexString;
25
+ destToken: string;
26
26
  destChainId: number;
27
- recipient: HexString;
28
- refundee: HexString;
27
+ recipient: string;
28
+ refundee: string;
29
29
  slippage: number;
30
- account: HexString;
31
- permitData?: HexString;
30
+ account: string;
31
+ permitData?: string;
32
32
  amount?: string;
33
33
  estimateGas?: boolean;
34
34
  positionDetails?: ZapRouteRequestPositionDetails;
@@ -1,3 +1,7 @@
1
1
  import { ZapBuildTxnResponse, ZapBuildTxnRequest } from './build';
2
2
  export type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
3
- export type ZapQuoteRequest = ZapBuildTxnRequest;
3
+ export type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
4
+ refundee: string;
5
+ recipient: string;
6
+ account: string;
7
+ }>;
@@ -0,0 +1,23 @@
1
+ import { StatusCodes, TxnStatus } from '../../enums';
2
+ import { HexString, TokenPermitData } from '../../types';
3
+ import { DefaultPermit2612Params } from '../../types/permit';
4
+ export declare const eip2612DisabledChains: number[];
5
+ export declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
6
+ chainId: number;
7
+ address: HexString;
8
+ rpcUrls?: string[];
9
+ owner: HexString;
10
+ permit?: TokenPermitData;
11
+ }) => Promise<{
12
+ supportsPermit: boolean;
13
+ data?: {
14
+ version: string;
15
+ name: string;
16
+ nonce: bigint;
17
+ };
18
+ }>;
19
+ export declare const getEIP2612PermitSignature: (params: DefaultPermit2612Params) => Promise<{
20
+ status: TxnStatus;
21
+ code: StatusCodes;
22
+ permitData?: HexString;
23
+ }>;