@dzapio/sdk 1.0.2 → 1.0.3

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 (53) hide show
  1. package/dist/api/index.d.ts +1 -1
  2. package/dist/artifacts/ERC20Permit.d.ts +1 -1
  3. package/dist/artifacts/default/DZapCoreV2Abi.d.ts +2 -0
  4. package/dist/artifacts/default/index.d.ts +2 -1
  5. package/dist/artifacts/index.d.ts +2 -2
  6. package/dist/config/index.d.ts +36 -0
  7. package/dist/constants/chains.d.ts +1 -0
  8. package/dist/constants/contract.d.ts +2 -2
  9. package/dist/constants/erc20.d.ts +3 -0
  10. package/dist/constants/index.d.ts +1 -0
  11. package/dist/constants/rpc.d.ts +1 -1
  12. package/dist/dZapClient/index.d.ts +27 -16
  13. package/dist/enums/index.d.ts +8 -0
  14. package/dist/index.d.ts +6 -3
  15. package/dist/index.js +1 -1
  16. package/dist/index.m.js +1 -1
  17. package/dist/index.umd.js +1 -1
  18. package/dist/service/price/index.d.ts +1 -1
  19. package/dist/service/price/provider/coingecko/index.d.ts +1 -1
  20. package/dist/service/price/provider/defiLlama/index.d.ts +1 -1
  21. package/dist/service/price/types/IPriceProvider.d.ts +1 -1
  22. package/dist/transactionHandlers/generic.d.ts +2 -2
  23. package/dist/transactionHandlers/permit.d.ts +10 -8
  24. package/dist/transactionHandlers/trade.d.ts +7 -2
  25. package/dist/transactionHandlers/zap.d.ts +3 -3
  26. package/dist/types/chains.d.ts +1 -1
  27. package/dist/types/contract.d.ts +1 -1
  28. package/dist/types/index.d.ts +12 -13
  29. package/dist/types/wallet.d.ts +2 -0
  30. package/dist/types/zap/index.d.ts +1 -1
  31. package/dist/types/zap/path.d.ts +1 -1
  32. package/dist/types/zap/pool.d.ts +2 -1
  33. package/dist/types/zap/status.d.ts +3 -0
  34. package/dist/types/zap/step.d.ts +1 -1
  35. package/dist/utils/amount.d.ts +4 -4
  36. package/dist/utils/axios.d.ts +1 -1
  37. package/dist/utils/eip-5792/batchApproveTokens.d.ts +21 -0
  38. package/dist/utils/eip-5792/index.d.ts +3 -0
  39. package/dist/utils/eip-5792/isBatchTxnSupportedByWallet.d.ts +6 -0
  40. package/dist/utils/eip-5792/sendBatchCalls.d.ts +10 -0
  41. package/dist/utils/eip-5792/waitForBatchTransactionReceipt.d.ts +4 -0
  42. package/dist/utils/encodeApproveCall.d.ts +6 -0
  43. package/dist/utils/erc20.d.ts +8 -6
  44. package/dist/utils/errors.d.ts +2 -1
  45. package/dist/utils/index.d.ts +2 -3
  46. package/dist/utils/multicall.d.ts +4 -2
  47. package/dist/utils/permit/permit2Methods.d.ts +6 -5
  48. package/dist/utils/permit/permitMethods.d.ts +17 -9
  49. package/dist/utils/signTypedData.d.ts +3 -3
  50. package/dist/utils/tokens.d.ts +2 -2
  51. package/dist/utils/updateQuotes.d.ts +2 -2
  52. package/package.json +17 -3
  53. package/dist/config.d.ts +0 -5
@@ -1,4 +1,4 @@
1
- import { ChainData } from 'src/types';
1
+ import { ChainData } from '../../types';
2
2
  import { PriceProvider } from './types/IPriceProvider';
3
3
  export declare class PriceService {
4
4
  private providers;
@@ -1,4 +1,4 @@
1
- import { ChainData } from 'src/types';
1
+ import { ChainData } from '../../../../types';
2
2
  import { IPriceProvider } from '../../types/IPriceProvider';
3
3
  export declare class CoingeckoPriceProvider implements IPriceProvider {
4
4
  id: "coingecko";
@@ -1,4 +1,4 @@
1
- import { ChainData } from 'src/types';
1
+ import { ChainData } from '../../../../types';
2
2
  import { IPriceProvider } from '../../types/IPriceProvider';
3
3
  export declare class DefiLlamaPriceProvider implements IPriceProvider {
4
4
  id: "defiLlama";
@@ -1,4 +1,4 @@
1
- import { ChainData } from 'src/types';
1
+ import { ChainData } from '../../../types';
2
2
  export declare const priceProviders: {
3
3
  readonly dZap: "dZap";
4
4
  readonly defiLlama: "defiLlama";
@@ -1,7 +1,7 @@
1
- import { StatusCodes, TxnStatus } from 'src/enums';
2
- import { HexString } from '../types';
3
1
  import { Signer } from 'ethers';
4
2
  import { WalletClient } from 'viem';
3
+ import { StatusCodes, TxnStatus } from '../enums';
4
+ import { HexString } from '../types';
5
5
  declare class GenericTxnHandler {
6
6
  static sendTransaction: ({ chainId, signer, from, to, data, value, }: {
7
7
  chainId: number;
@@ -1,9 +1,9 @@
1
- import { StatusCodes, TxnStatus } from 'src/enums';
2
- import { AvailableDZapServices, HexString, PermitMode } from 'src/types';
1
+ import { Signer } from 'ethers';
3
2
  import { WalletClient } from 'viem';
4
- import { Wallet } from 'ethers';
3
+ import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
4
+ import { AvailableDZapServices, HexString, PermitMode } from '../types';
5
5
  declare class PermitTxnHandler {
6
- static generatePermitDataForToken: ({ token, isFirstToken, oneToMany, totalSrcAmount, chainId, rpcUrls, sender, spender, permitType, signer, service, permitEIP2612DisabledTokens, }: {
6
+ static generatePermitDataForToken: ({ token, isFirstToken, oneToMany, totalSrcAmount, chainId, rpcUrls, sender, spender, permitType, signer, service, permitEIP2612DisabledTokens, contractVersion, }: {
7
7
  token: {
8
8
  address: HexString;
9
9
  amount: string;
@@ -16,16 +16,17 @@ declare class PermitTxnHandler {
16
16
  sender: HexString;
17
17
  spender: HexString;
18
18
  permitType: PermitMode;
19
- signer: WalletClient | Wallet;
19
+ signer: WalletClient | Signer;
20
20
  service: AvailableDZapServices;
21
21
  permitEIP2612DisabledTokens?: string[];
22
+ contractVersion: ContractVersion;
22
23
  }) => Promise<{
23
24
  status: TxnStatus;
24
25
  code: StatusCodes;
25
26
  permitData: HexString;
26
27
  permitType: PermitMode;
27
28
  }>;
28
- static signPermit: ({ chainId, tokens, rpcUrls, sender, signer, service, signatureCallback, spender, permitType, permitEIP2612DisabledTokens, }: {
29
+ static signPermit: ({ chainId, tokens, rpcUrls, sender, signer, service, signatureCallback, spender, permitType, permitEIP2612DisabledTokens, contractVersion, }: {
29
30
  chainId: number;
30
31
  sender: HexString;
31
32
  tokens: {
@@ -35,16 +36,17 @@ declare class PermitTxnHandler {
35
36
  }[];
36
37
  service: AvailableDZapServices;
37
38
  rpcUrls?: string[];
38
- signer: WalletClient | Wallet;
39
+ signer: WalletClient | Signer;
39
40
  signatureCallback?: ({ permitData, srcToken, amount, permitType, }: {
40
41
  permitData: HexString;
41
42
  srcToken: HexString;
42
- amount: bigint;
43
+ amount: string;
43
44
  permitType: PermitMode;
44
45
  }) => Promise<void>;
45
46
  spender: HexString;
46
47
  permitType: PermitMode;
47
48
  permitEIP2612DisabledTokens?: string[];
49
+ contractVersion: ContractVersion;
48
50
  }) => Promise<{
49
51
  status: TxnStatus;
50
52
  tokens: {
@@ -1,11 +1,16 @@
1
- import { TradeBuildTxnRequest, TradeBuildTxnResponse, DZapTransactionResponse } from '../types';
2
1
  import { Signer } from 'ethers';
3
2
  import { WalletClient } from 'viem';
3
+ import { DZapTransactionResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
4
4
  declare class TradeTxnHandler {
5
- static buildAndSendTransaction: ({ request, signer, txnData, }: {
5
+ private static sendTransaction;
6
+ private static sendTxnWithBatch;
7
+ static buildAndSendTransaction: ({ request, signer, txnData, multicallAddress, batchTransaction, rpcUrls, }: {
6
8
  request: TradeBuildTxnRequest;
7
9
  signer: Signer | WalletClient;
8
10
  txnData?: TradeBuildTxnResponse;
11
+ batchTransaction: boolean;
12
+ multicallAddress?: HexString;
13
+ rpcUrls?: string[];
9
14
  }) => Promise<DZapTransactionResponse>;
10
15
  }
11
16
  export default TradeTxnHandler;
@@ -1,9 +1,9 @@
1
1
  import { Signer } from 'ethers';
2
- import { StatusCodes, TxnStatus } from 'src/enums';
3
- import { DZapTransactionResponse, HexString } from 'src/types';
4
2
  import { WalletClient } from 'viem';
3
+ import { StatusCodes, TxnStatus } from '../enums';
4
+ import { DZapTransactionResponse, HexString } from '../types';
5
+ import { ZapBuildTxnRequest } from '../types/zap';
5
6
  import { ZapStep, ZapTxnDetails } from '../types/zap/step';
6
- import { ZapBuildTxnRequest } from 'src/types/zap';
7
7
  declare class ZapTxnHandler {
8
8
  static execute: ({ chainId, txnData, signer, }: {
9
9
  chainId: number;
@@ -1,2 +1,2 @@
1
- import { exclusiveChainIds } from 'src/constants/chains';
1
+ import { exclusiveChainIds } from '../constants/chains';
2
2
  export type ExclusiveChainIds = (typeof exclusiveChainIds)[keyof typeof exclusiveChainIds];
@@ -1,5 +1,5 @@
1
- import { Versions } from 'src/enums';
2
1
  import { AvailableDZapServices } from '.';
2
+ import { Versions } from '../enums';
3
3
  export type ContractConfig = {
4
4
  [serviceKey in AvailableDZapServices]: {
5
5
  [versionKey in Versions]?: {
@@ -1,8 +1,8 @@
1
- import { DZapAbis, OtherAbis, QuoteFilters, Services, STATUS_RESPONSE } from 'src/constants';
2
- import { AppEnv, StatusCodes, TxnStatus } from 'src/enums';
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';
3
5
  import { PsbtInput, PsbtOutput } from './btc';
4
- import { PermitTypes } from 'src/constants/permit';
5
- import { ApprovalModes } from 'src/constants/approval';
6
6
  export type HexString = `0x${string}`;
7
7
  export type ChainData = {
8
8
  [key in number]: Chain;
@@ -58,7 +58,7 @@ export type Chain = {
58
58
  swapBridgeContract: string;
59
59
  logo: string;
60
60
  tokenlistUrl?: string;
61
- multicallAddress: string;
61
+ multicallAddress?: HexString;
62
62
  blockExplorerUrl: string;
63
63
  nativeToken: NativeTokenInfo;
64
64
  rpcProviders: ApiRpcResponse[];
@@ -85,6 +85,7 @@ export type Chain = {
85
85
  isEnabled: boolean;
86
86
  mainnet: boolean;
87
87
  tags?: Tag[];
88
+ version?: ContractVersion;
88
89
  permitDisabledTokens?: DisabledPermitTokens;
89
90
  };
90
91
  export type ApiRpcResponse = {
@@ -114,20 +115,19 @@ export type Fee = {
114
115
  };
115
116
  export type QuoteFilter = keyof typeof QuoteFilters;
116
117
  export type TradeQuotesRequest = {
117
- integratorId: string;
118
118
  fromChain: number;
119
119
  data: TradeQuotesRequestData[];
120
120
  disableEstimation?: boolean;
121
121
  account?: string;
122
- allowedSources?: string[];
122
+ allowedProtocols?: string[];
123
123
  filter?: QuoteFilter;
124
124
  };
125
125
  export type TradeQuotesRequestData = {
126
126
  amount: string;
127
127
  srcToken: string;
128
- srcDecimals: number;
128
+ srcDecimals?: number;
129
129
  destToken: string;
130
- destDecimals: number;
130
+ destDecimals?: number;
131
131
  toChain: number;
132
132
  slippage: number;
133
133
  selectedSource?: string;
@@ -218,7 +218,6 @@ export type TokenResponse = {
218
218
  export type TradeBuildTxnRequest = {
219
219
  sender: HexString;
220
220
  refundee: HexString;
221
- integratorId: string;
222
221
  fromChain: number;
223
222
  disableEstimation?: boolean;
224
223
  data: TradeBuildTxnRequestData[];
@@ -227,11 +226,11 @@ export type TradeBuildTxnRequest = {
227
226
  export type TradeBuildTxnRequestData = {
228
227
  amount: string;
229
228
  srcToken: string;
230
- srcDecimals: number;
229
+ srcDecimals?: number;
231
230
  destToken: string;
232
- destDecimals: number;
231
+ destDecimals?: number;
233
232
  toChain: number;
234
- selectedRoute: string;
233
+ protocol: string;
235
234
  recipient: string;
236
235
  slippage: number;
237
236
  additionalInfo?: AdditionalInfo;
@@ -0,0 +1,2 @@
1
+ import { type WalletCallReceipt as _WalletCallReceipt } from 'viem';
2
+ export type WalletCallReceipt = _WalletCallReceipt<bigint, 'success' | 'reverted'>;
@@ -1,4 +1,4 @@
1
- import { HexString, ProviderDetails } from 'src/types';
1
+ import { HexString, ProviderDetails } from '../';
2
2
  import { ZapPathAsset } from './path';
3
3
  export type ZapProviders = Record<string, ProviderDetails>;
4
4
  export type ZapChains = {
@@ -1,5 +1,5 @@
1
- import { HexString, ProviderDetails } from 'src/types';
2
1
  import { ZapFee, ZapUnderlyingToken } from '.';
2
+ import { HexString, ProviderDetails } from '../..';
3
3
  import { zapPathAction } from '../../zap/constants/path';
4
4
  export type ZapPathAction = keyof typeof zapPathAction;
5
5
  export type ZapPathAsset = {
@@ -1,4 +1,5 @@
1
- import { HexString, ZapUnderlyingToken } from 'src';
1
+ import { ZapUnderlyingToken } from '.';
2
+ import { HexString } from '..';
2
3
  export type ZapPoolDetailsRequest = {
3
4
  address: HexString;
4
5
  chainId: number;
@@ -18,6 +18,9 @@ export type ZapStatusStep = {
18
18
  export type ZapStatusResponse = {
19
19
  status: ZapStatus;
20
20
  steps: ZapStatusStep[];
21
+ recipient: string;
22
+ timestamp: number;
23
+ completedAt: number;
21
24
  };
22
25
  export type ZapStatusRequest = {
23
26
  chainId: number;
@@ -1,4 +1,4 @@
1
- import { HexString } from 'src/types';
1
+ import { HexString } from '..';
2
2
  import { zapStepAction } from '../../zap/constants/step';
3
3
  export type StepAction = keyof typeof zapStepAction;
4
4
  export type ZapTxnDetails = {
@@ -1,4 +1,4 @@
1
- import { TradeQuote, Fee } from 'src/types';
1
+ import { Fee, TradeQuote } from '../types';
2
2
  export declare const calculateAmountUSD: (amountInWei: string, decimals: number, price: string) => string;
3
3
  export declare const calculateNetGasFeeUsd: (item: TradeQuote) => string;
4
4
  export declare const calculateNetAmountUsd: (item: TradeQuote) => string;
@@ -74,9 +74,9 @@ export declare const updatePath: (data: TradeQuote, tokensPrice: Record<number,
74
74
  srcAmountUSD: string;
75
75
  destAmountUSD: string;
76
76
  type: string;
77
- exchange: import("src/types").ProviderDetails;
78
- srcToken: import("src/types").Token;
77
+ exchange: import("../types").ProviderDetails;
78
+ srcToken: import("../types").Token;
79
79
  srcAmount: string;
80
- destToken: import("src/types").Token;
80
+ destToken: import("../types").Token;
81
81
  destAmount: string;
82
82
  }[];
@@ -1,5 +1,5 @@
1
1
  import { CancelToken, Method } from 'axios';
2
- import AxiosClient from 'src/axios';
2
+ import AxiosClient from '../axios';
3
3
  type Invoke = {
4
4
  endpoint: string;
5
5
  data?: any;
@@ -0,0 +1,21 @@
1
+ import { type WalletClient } from 'viem';
2
+ import { HexString } from '../../types';
3
+ import { BatchCallParams } from './sendBatchCalls';
4
+ export declare function generateApprovalBatchCalls({ tokens, chainId, sender, spender, multicallAddress, rpcUrls, }: {
5
+ tokens: Array<{
6
+ address: HexString;
7
+ amount: string;
8
+ }>;
9
+ chainId: number;
10
+ sender: HexString;
11
+ spender: HexString;
12
+ multicallAddress?: HexString;
13
+ rpcUrls?: string[];
14
+ }): Promise<BatchCallParams[]>;
15
+ export declare function batchApproveTokens(walletClient: WalletClient, tokens: Array<{
16
+ address: HexString;
17
+ amount: string;
18
+ }>, chainId: number, spender: HexString, sender: HexString, multicallAddress?: HexString, rpcUrls?: string[]): Promise<{
19
+ success: boolean;
20
+ batchId?: string;
21
+ }>;
@@ -0,0 +1,3 @@
1
+ export { batchApproveTokens } from './batchApproveTokens';
2
+ export { sendBatchCalls, type BatchCallParams } from './sendBatchCalls';
3
+ export { waitForBatchTransactionReceipt } from './waitForBatchTransactionReceipt';
@@ -0,0 +1,6 @@
1
+ import { Client } from 'viem';
2
+ export declare function isBatchTxnSupportedByWallet({ client, chainId, skipReady, }: {
3
+ client: Client;
4
+ chainId: number;
5
+ skipReady?: boolean;
6
+ }): Promise<boolean>;
@@ -0,0 +1,10 @@
1
+ import { WalletClient } from 'viem';
2
+ import { HexString } from '../../types';
3
+ export type BatchCallParams = {
4
+ to: HexString;
5
+ data: HexString;
6
+ value?: bigint;
7
+ };
8
+ export declare function sendBatchCalls(walletClient: WalletClient, calls: BatchCallParams[]): Promise<{
9
+ id: string;
10
+ } | null>;
@@ -0,0 +1,4 @@
1
+ import { type Client } from 'viem';
2
+ import { HexString } from '../../types';
3
+ import { WalletCallReceipt } from '../../types/wallet';
4
+ export declare const waitForBatchTransactionReceipt: (client: Client, batchHash: HexString) => Promise<WalletCallReceipt>;
@@ -0,0 +1,6 @@
1
+ import { Address } from 'viem';
2
+ import { HexString } from '../types';
3
+ export declare function encodeApproveCallData({ spender, amount }: {
4
+ spender: Address;
5
+ amount: bigint;
6
+ }): HexString;
@@ -1,14 +1,14 @@
1
1
  import { Signer } from 'ethers';
2
- import { StatusCodes, TxnStatus } from 'src/enums';
3
- import { ApprovalMode, HexString } from 'src/types';
4
2
  import { WalletClient } from 'viem';
3
+ import { StatusCodes, TxnStatus } from '../enums';
4
+ import { ApprovalMode, HexString } from '../types';
5
5
  export declare const approveToken: ({ chainId, signer, rpcUrls, mode, tokens, approvalTxnCallback, spender, }: {
6
6
  chainId: number;
7
7
  signer: WalletClient | Signer;
8
8
  mode: ApprovalMode;
9
9
  tokens: {
10
10
  address: HexString;
11
- amount: bigint;
11
+ amount: string;
12
12
  }[];
13
13
  rpcUrls?: string[];
14
14
  approvalTxnCallback?: ({ txnDetails, address, }: {
@@ -24,27 +24,29 @@ export declare const approveToken: ({ chainId, signer, rpcUrls, mode, tokens, ap
24
24
  status: TxnStatus;
25
25
  code: StatusCodes;
26
26
  }>;
27
- export declare const batchGetAllowances: ({ chainId, data, owner, rpcUrls, }: {
27
+ export declare const batchGetAllowances: ({ chainId, data, owner, multicallAddress, rpcUrls, }: {
28
28
  chainId: number;
29
29
  data: {
30
30
  token: HexString;
31
31
  spender: HexString;
32
32
  }[];
33
33
  owner: HexString;
34
+ multicallAddress?: HexString;
34
35
  rpcUrls?: string[];
35
36
  }) => Promise<{
36
37
  status: TxnStatus;
37
38
  code: StatusCodes;
38
39
  data: Record<string, bigint>;
39
40
  }>;
40
- export declare const getAllowance: ({ chainId, sender, tokens, rpcUrls, mode, spender, permitEIP2612DisabledTokens, }: {
41
+ export declare const getAllowance: ({ chainId, sender, tokens, rpcUrls, multicallAddress, mode, spender, permitEIP2612DisabledTokens, }: {
41
42
  chainId: number;
42
43
  sender: HexString;
43
44
  tokens: {
44
45
  address: HexString;
45
- amount: bigint;
46
+ amount: string;
46
47
  }[];
47
48
  spender: HexString;
49
+ multicallAddress?: HexString;
48
50
  rpcUrls?: string[];
49
51
  mode?: ApprovalMode;
50
52
  permitEIP2612DisabledTokens?: string[];
@@ -1,5 +1,5 @@
1
1
  import { AxiosError } from 'axios';
2
- import { StatusCodes, TxnStatus } from 'src/enums';
2
+ import { StatusCodes, TxnStatus } from '../enums';
3
3
  export declare const BRIDGE_ERRORS: {
4
4
  BridgeCallFailed: string;
5
5
  };
@@ -14,3 +14,4 @@ export declare const handleViemTransactionError: ({ error }: {
14
14
  errorMsg: any;
15
15
  code: StatusCodes;
16
16
  };
17
+ export declare const isAtomicReadyWalletRejectedUpgradeError: (e: any) => any;
@@ -1,7 +1,7 @@
1
- import { StatusCodes, TxnStatus } from 'src/enums';
2
1
  import { Abi, TransactionReceipt, WalletClient } from 'viem';
3
2
  import { AvailableDZapServices, Chain, HexString, OtherAvailableAbis, SwapInfo } from '../types';
4
3
  import { Signer } from 'ethers';
4
+ import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
5
5
  export declare const getPublicClient: ({ rpcUrls, chainId }: {
6
6
  rpcUrls: string[] | undefined;
7
7
  chainId: number;
@@ -3646,7 +3646,6 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
3646
3646
  uid?: undefined;
3647
3647
  } & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined>, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<import("viem").Chain, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined, import("viem").PublicRpcSchema, import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain>>) => client) => import("viem").Client<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined, import("viem").PublicRpcSchema, { [K in keyof client]: client[K]; } & import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain>>;
3648
3648
  };
3649
- export declare const isNativeCurrency: (contract: string) => boolean;
3650
3649
  export declare const getChecksumAddress: (address: string) => HexString;
3651
3650
  export declare const formatToken: <T extends HexString | string>(token: T, nativeTokenAddress?: T) => T;
3652
3651
  export declare function getTokensPairKey({ srcToken, destToken, srcChainId, destChainId, srcChainNativeAddress, destChainNativeAddress, }: {
@@ -3696,7 +3695,7 @@ export declare const getTrxId: (account: string) => `0x${string}`;
3696
3695
  export declare const estimateGasMultiplier: bigint;
3697
3696
  export declare const isTypeSigner: (variable: any) => variable is Signer;
3698
3697
  export declare const isDZapNativeToken: (srcToken: string) => srcToken is "0x0000000000000000000000000000000000000000";
3699
- export declare const getDZapAbi: (service: AvailableDZapServices) => Abi;
3698
+ export declare const getDZapAbi: (service: AvailableDZapServices, version: ContractVersion) => Abi;
3700
3699
  export declare const handleDecodeTxnData: (data: TransactionReceipt, service: AvailableDZapServices, chain: Chain) => {
3701
3700
  swapFailPairs: string[];
3702
3701
  swapInfo: SwapInfo | SwapInfo[];
@@ -1,9 +1,11 @@
1
- import { StatusCodes, TxnStatus } from 'src/enums';
2
1
  import { MulticallParameters } from 'viem';
3
- export declare const multicall: ({ chainId, contracts, rpcUrls, allowFailure, }: {
2
+ import { StatusCodes, TxnStatus } from '../enums';
3
+ import { HexString } from '../types';
4
+ export declare const multicall: ({ chainId, contracts, rpcUrls, multicallAddress, allowFailure, }: {
4
5
  chainId: number;
5
6
  contracts: MulticallParameters["contracts"];
6
7
  rpcUrls?: string[];
8
+ multicallAddress?: HexString;
7
9
  allowFailure?: boolean;
8
10
  }) => Promise<{
9
11
  status: TxnStatus;
@@ -1,9 +1,9 @@
1
- import { Wallet } from 'ethers';
2
- import { StatusCodes, TxnStatus } from 'src/enums';
3
- import { AvailableDZapServices, HexString } from 'src/types';
1
+ import { Signer } from 'ethers';
4
2
  import { WalletClient } from 'viem';
3
+ import { ContractVersion, StatusCodes, TxnStatus } from '../../enums';
4
+ import { AvailableDZapServices, HexString } from '../../types';
5
5
  export declare function getPermit2Address(chainId: number): HexString;
6
- export declare function getPermit2Signature({ chainId, spender, service, account, token, signer, rpcUrls, amount, sigDeadline, expiration, }: {
6
+ export declare function getPermit2Signature({ chainId, spender, service, account, token, signer, rpcUrls, amount, sigDeadline, expiration, contractVersion, }: {
7
7
  chainId: number;
8
8
  account: HexString;
9
9
  token: HexString;
@@ -12,8 +12,9 @@ export declare function getPermit2Signature({ chainId, spender, service, account
12
12
  rpcUrls?: string[];
13
13
  sigDeadline?: bigint;
14
14
  amount?: bigint;
15
- signer: WalletClient | Wallet;
15
+ signer: WalletClient | Signer;
16
16
  expiration?: bigint;
17
+ contractVersion: ContractVersion;
17
18
  }): Promise<{
18
19
  status: TxnStatus;
19
20
  permitData: `0x${string}`;
@@ -1,27 +1,35 @@
1
- import { Wallet } from 'ethers';
2
- import { StatusCodes, TxnStatus } from 'src/enums';
3
- import { HexString } from 'src/types';
1
+ import { Signer } from 'ethers';
4
2
  import { WalletClient } from 'viem';
5
- export declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, permitEIP2612DisabledTokens, }: {
3
+ import { ContractVersion, StatusCodes, TxnStatus } from '../../enums';
4
+ import { AvailableDZapServices, HexString } from '../../types';
5
+ export declare const eip2612DisabledChains: number[];
6
+ export declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, permitEIP2612DisabledTokens, owner, }: {
6
7
  address: HexString;
7
8
  chainId: number;
8
9
  rpcUrls?: string[];
9
10
  permitEIP2612DisabledTokens?: string[];
11
+ owner: HexString;
10
12
  }) => Promise<{
11
13
  supportsPermit: boolean;
12
- domainSeparator?: HexString;
13
- version?: string;
14
+ data?: {
15
+ version: string;
16
+ name: string;
17
+ nonce: bigint;
18
+ };
14
19
  }>;
15
- export declare const getEIP2612PermitSignature: ({ chainId, spender, account, token, signer, version, rpcUrls, amount, sigDeadline, }: {
20
+ export declare const getEIP2612PermitSignature: ({ chainId, spender, account, token, signer, version, amount, sigDeadline, contractVersion, service, name, nonce, }: {
16
21
  chainId: number;
17
22
  account: HexString;
18
23
  token: HexString;
19
24
  spender: HexString;
20
25
  version: string;
21
- rpcUrls?: string[];
22
26
  sigDeadline?: bigint;
23
27
  amount?: bigint;
24
- signer: WalletClient | Wallet;
28
+ signer: WalletClient | Signer;
29
+ contractVersion: ContractVersion;
30
+ service: AvailableDZapServices;
31
+ name: string;
32
+ nonce: bigint;
25
33
  }) => Promise<{
26
34
  status: TxnStatus;
27
35
  code: StatusCodes;
@@ -1,8 +1,8 @@
1
- import { TypedDataField, Wallet } from 'ethers';
1
+ import { Signer, TypedDataField } from 'ethers';
2
2
  import { TypedDataDomain, WalletClient } from 'viem';
3
- import { HexString } from 'src/types';
3
+ import { HexString } from '../types';
4
4
  export declare const signTypedData: ({ signer, domain, message, types, account, primaryType, }: {
5
- signer: WalletClient | Wallet;
5
+ signer: WalletClient | Signer;
6
6
  domain: TypedDataDomain;
7
7
  types: Record<string, Array<TypedDataField>>;
8
8
  message: Record<string, any>;
@@ -1,5 +1,5 @@
1
- import { PriceService } from 'src/service/price';
2
- import { ChainData, TokenInfo, TokenResponse } from 'src/types';
1
+ import { PriceService } from '../service/price';
2
+ import { ChainData, TokenInfo, TokenResponse } from '../types';
3
3
  export declare const isNativeCurrency: (address: string, chainConfig: ChainData) => boolean;
4
4
  export declare const sortByBalanceInUsd: (tokenEntries: [string, TokenInfo][]) => TokenResponse;
5
5
  export declare const updateTokenListPrices: (tokens: TokenResponse, chainId: number, chainConfig: ChainData, priceService: PriceService) => Promise<TokenResponse>;
@@ -1,3 +1,3 @@
1
- import { TradeQuotesRequest, TradeQuotesResponse, ChainData } from 'src/types';
2
- import { PriceService } from 'src/service/price';
1
+ import { PriceService } from '../service/price';
2
+ import { ChainData, TradeQuotesRequest, TradeQuotesResponse } from '../types';
3
3
  export declare const updateQuotes: (quotes: TradeQuotesResponse, request: TradeQuotesRequest, priceService: PriceService, chainConfig: ChainData) => Promise<TradeQuotesResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzapio/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A TypeScript/JavaScript SDK for interacting with the DZap protocol, providing utilities for DeFi operations including Swaps, Bridges, and Zaps.",
5
5
  "main": "dist/index.js",
6
6
  "source": "src/index.ts",
@@ -107,9 +107,23 @@
107
107
  "microbundle": {
108
108
  "entry": "src/index.ts",
109
109
  "output": "dist",
110
- "format": "esm,cjs,umd",
110
+ "format": "esm,cjs",
111
111
  "target": "node",
112
112
  "sourcemap": false,
113
- "generateTypes": true
113
+ "generateTypes": true,
114
+ "external": [
115
+ "ethers",
116
+ "viem",
117
+ "axios",
118
+ "decimal.js",
119
+ "node-cache"
120
+ ],
121
+ "globals": {
122
+ "ethers": "ethers",
123
+ "viem": "viem",
124
+ "axios": "axios",
125
+ "decimal.js": "decimal.js",
126
+ "node-cache": "node-cache"
127
+ }
114
128
  }
115
129
  }
package/dist/config.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare const appEnv: string;
2
- export declare const apiKey: string | undefined;
3
- export declare const versionPostfix = "v1/";
4
- export declare const getBaseUrl: () => string;
5
- export declare const getBaseZapUrl: () => string;