@dzapio/sdk 2.0.14 → 2.0.16

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 +16305 -2
  4. package/dist/index.mjs +16261 -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 -35
  22. package/dist/chains/definitions/fiveIre.d.ts +0 -35
  23. package/dist/chains/definitions/hyperEvm.d.ts +0 -35
  24. package/dist/chains/definitions/hyperliquid.d.ts +0 -35
  25. package/dist/chains/definitions/pushTestnet.d.ts +0 -35
  26. package/dist/chains/definitions/stable.d.ts +0 -36
  27. package/dist/chains/index.d.ts +0 -179
  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 -4566
  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 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- export declare class CacheProvider {
2
- private static _instance;
3
- private readonly client;
4
- private constructor();
5
- static get instance(): CacheProvider;
6
- static set<T>(key: string, value: T, ttl?: number): void;
7
- static get<T>(key: string): T | undefined;
8
- static delete(key: string): number;
9
- static flush(): void;
10
- }
@@ -1,2 +0,0 @@
1
- export declare const TOKENS_PRICE_EXPIRY: number;
2
- export declare const getTokensPriceCacheKey: (chainId: number) => string;
@@ -1,16 +0,0 @@
1
- import { ChainData } from '../../types';
2
- import { PriceProvider } from './types/IPriceProvider';
3
- export declare class PriceService {
4
- private providers;
5
- constructor();
6
- private initailizeProviders;
7
- getPrices({ chainId, tokenAddresses, chainConfig, allowedSources, notAllowSources, }: {
8
- chainId: number;
9
- tokenAddresses: string[];
10
- chainConfig: ChainData | null;
11
- allowedSources?: PriceProvider[];
12
- notAllowSources?: PriceProvider[];
13
- }): Promise<Record<string, string | null>>;
14
- private getValidProviders;
15
- private updateTokensPrice;
16
- }
@@ -1,6 +0,0 @@
1
- export declare const coingeckoConfig: {
2
- urls: {
3
- nativeTokenPrice: (chainKey: string) => string;
4
- ecr20TokenPrice: (contractAddress: string, chainKey: string) => string;
5
- };
6
- };
@@ -1,9 +0,0 @@
1
- import { ChainData } from '../../../../types';
2
- import { IPriceProvider } from '../../types/IPriceProvider';
3
- export declare class CoingeckoPriceProvider implements IPriceProvider {
4
- id: "coingecko";
5
- requiresChainConfig: boolean;
6
- private fetchNativePrice;
7
- private fetchERC20Prices;
8
- fetchPrices: (chainId: number, tokenAddresses: string[], chainConfig: ChainData) => Promise<Record<string, string | null>>;
9
- }
@@ -1,3 +0,0 @@
1
- export declare const defiLlamaConfig: {
2
- url: (tokens: string[]) => string;
3
- };
@@ -1,9 +0,0 @@
1
- import { ChainData } from '../../../../types';
2
- import { IPriceProvider } from '../../types/IPriceProvider';
3
- export declare class DefiLlamaPriceProvider implements IPriceProvider {
4
- id: "defiLlama";
5
- requiresChainConfig: boolean;
6
- private preProcess;
7
- private postProcess;
8
- fetchPrices: (chainId: number, tokenAddresses: string[], chainConfig: ChainData) => Promise<Record<string, string | null>>;
9
- }
@@ -1,11 +0,0 @@
1
- export type DefiLlamaCoin = {
2
- price: number;
3
- symbol: string;
4
- timestamp: number;
5
- confidence: number;
6
- };
7
- export type DefiLlamaResponse = {
8
- coins: {
9
- [key: string]: DefiLlamaCoin;
10
- };
11
- };
@@ -1,6 +0,0 @@
1
- import { IPriceProvider } from '../../types/IPriceProvider';
2
- export declare class DZapPriceProvider implements IPriceProvider {
3
- id: "dZap";
4
- requiresChainConfig: boolean;
5
- fetchPrices: (chainId: number, tokenAddresses: string[]) => Promise<Record<string, string | null>>;
6
- }
@@ -1,14 +0,0 @@
1
- import { ChainData } from '../../../types';
2
- export declare const priceProviders: {
3
- readonly dZap: "dZap";
4
- readonly defiLlama: "defiLlama";
5
- readonly coingecko: "coingecko";
6
- };
7
- export type PriceProvider = (typeof priceProviders)[keyof typeof priceProviders];
8
- export type IPriceProvider = {
9
- id: PriceProvider;
10
- requiresChainConfig: boolean;
11
- fetchPrices(chainId: number, tokenAddresses: string[], chainConfig: ChainData | null): Promise<Record<string, string | null>>;
12
- allowedSources?: PriceProvider[];
13
- notAllowedSources?: PriceProvider[];
14
- };
@@ -1,24 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { WalletClient } from 'viem';
3
- import { StatusCodes, TxnStatus } from '../enums';
4
- import { HexString } from '../types';
5
- declare class GenericTxnHandler {
6
- static sendTransaction: ({ chainId, signer, from, to, data, value, }: {
7
- chainId: number;
8
- signer: Signer | WalletClient;
9
- from: HexString;
10
- to: HexString;
11
- data: HexString;
12
- value: string;
13
- }) => Promise<{
14
- status: TxnStatus;
15
- error: any;
16
- errorMsg: any;
17
- code: StatusCodes;
18
- } | {
19
- status: TxnStatus;
20
- code: StatusCodes;
21
- txnHash: HexString;
22
- }>;
23
- }
24
- export default GenericTxnHandler;
@@ -1,61 +0,0 @@
1
- import { PermitTypes } from '../constants/permit';
2
- import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
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);
22
- declare class PermitTxnHandler {
23
- static generateBatchPermitDataForTokens: (params: BatchPermitParams) => Promise<BatchPermitResponse>;
24
- static generatePermitDataForToken: (params: PermitDataParams) => Promise<PermitResponse>;
25
- static signGaslessUserIntent: (signPermitReq: GaslessSignatureParams) => Promise<{
26
- status: TxnStatus;
27
- code: StatusCodes;
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;
42
- }>;
43
- static v1PermitSupport: ({ contractVersion, service }: {
44
- contractVersion: ContractVersion;
45
- service: AvailableDZapServices;
46
- }) => boolean;
47
- static shouldUseBatchPermit: ({ permitType, isBatchPermitAllowed, tokens, oneToMany, contractVersion, service, }: {
48
- permitType: PermitMode;
49
- isBatchPermitAllowed?: boolean;
50
- tokens: {
51
- address: HexString;
52
- permitData?: HexString | undefined;
53
- amount: string;
54
- }[];
55
- oneToMany: boolean;
56
- contractVersion: ContractVersion;
57
- service: AvailableDZapServices;
58
- }) => boolean;
59
- static signPermit: (signPermitReq: GasSignatureParams) => Promise<SignPermitResponse>;
60
- }
61
- export default PermitTxnHandler;
@@ -1,26 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { WalletClient } from 'viem';
3
- import { TxnStatus } from '../enums';
4
- import { DZapTransactionResponse, GaslessTradeBuildTxnResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
5
- declare class TradeTxnHandler {
6
- private static sendTransaction;
7
- private static sendTxnWithBatch;
8
- private static sendHyperLiquidTransaction;
9
- static buildAndSendTransaction: ({ request, signer, txnData, multicallAddress, batchTransaction, rpcUrls, }: {
10
- request: TradeBuildTxnRequest;
11
- signer: Signer | WalletClient;
12
- txnData?: TradeBuildTxnResponse;
13
- batchTransaction: boolean;
14
- multicallAddress?: HexString;
15
- rpcUrls?: string[];
16
- }) => Promise<DZapTransactionResponse>;
17
- static buildGaslessTxAndSignPermit: ({ request, signer, rpcUrls, spender, txnData, txnStatusCallback, }: {
18
- request: TradeBuildTxnRequest;
19
- signer: Signer | WalletClient;
20
- rpcUrls: string[];
21
- spender: HexString;
22
- txnData?: GaslessTradeBuildTxnResponse;
23
- txnStatusCallback?: (status: TxnStatus) => void;
24
- }) => Promise<DZapTransactionResponse>;
25
- }
26
- export default TradeTxnHandler;
@@ -1,37 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { WalletClient } from 'viem';
3
- import { StatusCodes, TxnStatus } from '../enums';
4
- import { DZapTransactionResponse, HexString } from '../types';
5
- import { ZapBuildTxnRequest } from '../types/zap';
6
- import { ZapStep, ZapEvmTxnDetails } from '../types/zap/step';
7
- declare class ZapTxnHandler {
8
- static execute: ({ chainId, txnData, signer, }: {
9
- chainId: number;
10
- txnData: ZapEvmTxnDetails;
11
- signer: Signer | WalletClient;
12
- }) => Promise<DZapTransactionResponse>;
13
- static approve: ({ chainId, data, signer }: {
14
- chainId: number;
15
- data: ZapEvmTxnDetails;
16
- signer: Signer | WalletClient;
17
- }) => Promise<{
18
- status: TxnStatus;
19
- error: any;
20
- errorMsg: any;
21
- code: StatusCodes;
22
- } | {
23
- status: TxnStatus;
24
- code: StatusCodes;
25
- txnHash: HexString;
26
- }>;
27
- static zap: ({ request, steps, signer, }: {
28
- request: ZapBuildTxnRequest;
29
- steps?: ZapStep[];
30
- signer: Signer | WalletClient;
31
- }) => Promise<{
32
- status: TxnStatus.success;
33
- code: StatusCodes | number;
34
- txnHash: HexString;
35
- } | DZapTransactionResponse>;
36
- }
37
- export default ZapTxnHandler;
@@ -1,6 +0,0 @@
1
- import { AxiosRequestConfig, CancelToken } from 'axios';
2
- export type ExtendedAxiosRequestConfig = {
3
- shouldRetry?: boolean;
4
- retryCount?: number;
5
- cancelToken?: CancelToken;
6
- } & AxiosRequestConfig;
@@ -1,45 +0,0 @@
1
- export type Witness = {
2
- value: number;
3
- script: string;
4
- };
5
- type PsbtInputP2PKH = {
6
- scriptType: 'p2pkh';
7
- nonWitnessUtxo: Buffer;
8
- redeemScript?: never;
9
- };
10
- type PsbtInputP2SH = {
11
- scriptType: 'p2sh';
12
- witnessUtxo: Witness;
13
- redeemScript: Buffer;
14
- redeemScriptArgumentByteLengths?: number[];
15
- };
16
- type PsbtInputP2WPKH = {
17
- scriptType: 'p2wpkh';
18
- witnessUtxo: Witness;
19
- redeemScript?: never;
20
- };
21
- type PsbtInputP2WSH = {
22
- scriptType: 'p2wsh';
23
- witnessUtxo: Witness;
24
- witnessScript: Buffer;
25
- };
26
- type PsbtInputP2TR = {
27
- scriptType: 'p2tr';
28
- witnessUtxo: Witness;
29
- tapInternalKey: Buffer;
30
- };
31
- export type PsbtInput = {
32
- hash: string;
33
- index: number;
34
- sequence: number;
35
- value: number;
36
- } & (PsbtInputP2PKH | PsbtInputP2SH | PsbtInputP2WPKH | PsbtInputP2TR | PsbtInputP2WSH);
37
- export type PsbtOutput = {
38
- address: string;
39
- script?: Buffer;
40
- value: number;
41
- } | {
42
- script: string;
43
- value: number;
44
- };
45
- export {};
@@ -1,3 +0,0 @@
1
- import { chainTypes, exclusiveChainIds } from '../constants/chains';
2
- export type ExclusiveChainIds = (typeof exclusiveChainIds)[keyof typeof exclusiveChainIds];
3
- export type ChainType = keyof typeof chainTypes;
@@ -1,14 +0,0 @@
1
- import { AvailableDZapServices } from '.';
2
- import { Versions } from '../enums';
3
- export type ContractConfig = {
4
- [serviceKey in AvailableDZapServices]: {
5
- [versionKey in Versions]?: {
6
- address: ContractAddress;
7
- abi: string;
8
- };
9
- };
10
- };
11
- export type ContractAddress = {
12
- otherChains: string;
13
- zkSync: string;
14
- };
@@ -1,24 +0,0 @@
1
- export declare const EIP2612DefaultTypes: {
2
- Permit: {
3
- name: string;
4
- type: string;
5
- }[];
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
- };