@dzapio/sdk 1.0.1

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 (79) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +21 -0
  3. package/README.md +355 -0
  4. package/dist/api/index.d.ts +19 -0
  5. package/dist/artifacts/ERC20Permit.d.ts +336 -0
  6. package/dist/artifacts/Permit2.d.ts +700 -0
  7. package/dist/artifacts/default/DZapCoreAbi.d.ts +2 -0
  8. package/dist/artifacts/default/DZapDcaAbi.d.ts +2 -0
  9. package/dist/artifacts/default/Permit2Abi.d.ts +70 -0
  10. package/dist/artifacts/default/erc20Abi.d.ts +165 -0
  11. package/dist/artifacts/default/index.d.ts +5 -0
  12. package/dist/artifacts/index.d.ts +2 -0
  13. package/dist/artifacts/staging/DZapCoreSwapAbi.d.ts +2 -0
  14. package/dist/artifacts/staging/index.d.ts +2 -0
  15. package/dist/axios/baseClient.d.ts +2 -0
  16. package/dist/axios/index.d.ts +8 -0
  17. package/dist/config.d.ts +16 -0
  18. package/dist/constants/address.d.ts +13 -0
  19. package/dist/constants/approval.d.ts +5 -0
  20. package/dist/constants/axios.d.ts +2 -0
  21. package/dist/constants/chains.d.ts +16 -0
  22. package/dist/constants/contract.d.ts +6 -0
  23. package/dist/constants/erc20.d.ts +22 -0
  24. package/dist/constants/httpMethods.d.ts +2 -0
  25. package/dist/constants/index.d.ts +43 -0
  26. package/dist/constants/permit.d.ts +5 -0
  27. package/dist/constants/permit2.d.ts +2 -0
  28. package/dist/constants/rpc.d.ts +2 -0
  29. package/dist/constants/urlConstants.d.ts +13 -0
  30. package/dist/dZapClient/index.d.ts +383 -0
  31. package/dist/enums/index.d.ts +36 -0
  32. package/dist/index.d.ts +15 -0
  33. package/dist/index.js +2 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/index.m.js +2 -0
  36. package/dist/index.m.js.map +1 -0
  37. package/dist/index.umd.js +2 -0
  38. package/dist/index.umd.js.map +1 -0
  39. package/dist/service/cache/cacheProvider.d.ts +10 -0
  40. package/dist/service/cache/constant.d.ts +2 -0
  41. package/dist/service/price/index.d.ts +16 -0
  42. package/dist/service/price/provider/coingecko/config.d.ts +6 -0
  43. package/dist/service/price/provider/coingecko/index.d.ts +9 -0
  44. package/dist/service/price/provider/defiLlama/config.d.ts +3 -0
  45. package/dist/service/price/provider/defiLlama/index.d.ts +9 -0
  46. package/dist/service/price/provider/defiLlama/types.d.ts +11 -0
  47. package/dist/service/price/provider/dzap/index.d.ts +6 -0
  48. package/dist/service/price/types/IPriceProvider.d.ts +14 -0
  49. package/dist/transactionHandlers/generic.d.ts +24 -0
  50. package/dist/transactionHandlers/permit.d.ts +58 -0
  51. package/dist/transactionHandlers/trade.d.ts +11 -0
  52. package/dist/transactionHandlers/zap.d.ts +37 -0
  53. package/dist/types/axiosClient.d.ts +6 -0
  54. package/dist/types/btc.d.ts +45 -0
  55. package/dist/types/chains.d.ts +2 -0
  56. package/dist/types/contract.d.ts +14 -0
  57. package/dist/types/eip-2612.d.ts +6 -0
  58. package/dist/types/index.d.ts +317 -0
  59. package/dist/types/zap/index.d.ts +65 -0
  60. package/dist/types/zap/path.d.ts +36 -0
  61. package/dist/types/zap/step.d.ts +15 -0
  62. package/dist/utils/amount.d.ts +82 -0
  63. package/dist/utils/axios.d.ts +13 -0
  64. package/dist/utils/chains.d.ts +2 -0
  65. package/dist/utils/date.d.ts +1 -0
  66. package/dist/utils/erc20.d.ts +61 -0
  67. package/dist/utils/errors.d.ts +16 -0
  68. package/dist/utils/index.d.ts +3940 -0
  69. package/dist/utils/multicall.d.ts +12 -0
  70. package/dist/utils/permit/permit2Methods.d.ts +32 -0
  71. package/dist/utils/permit/permitMethods.d.ts +29 -0
  72. package/dist/utils/signTypedData.d.ts +11 -0
  73. package/dist/utils/tokens.d.ts +7 -0
  74. package/dist/utils/updateQuotes.d.ts +3 -0
  75. package/dist/zap/constants/index.d.ts +2 -0
  76. package/dist/zap/constants/path.d.ts +8 -0
  77. package/dist/zap/constants/step.d.ts +3 -0
  78. package/dist/zap/constants/urls.d.ts +3 -0
  79. package/package.json +115 -0
@@ -0,0 +1,70 @@
1
+ export declare const abi: ({
2
+ inputs: {
3
+ internalType: string;
4
+ name: string;
5
+ type: string;
6
+ }[];
7
+ name: string;
8
+ type: string;
9
+ anonymous?: undefined;
10
+ outputs?: undefined;
11
+ stateMutability?: undefined;
12
+ } | {
13
+ anonymous: boolean;
14
+ inputs: {
15
+ indexed: boolean;
16
+ internalType: string;
17
+ name: string;
18
+ type: string;
19
+ }[];
20
+ name: string;
21
+ type: string;
22
+ outputs?: undefined;
23
+ stateMutability?: undefined;
24
+ } | {
25
+ inputs: {
26
+ internalType: string;
27
+ name: string;
28
+ type: string;
29
+ }[];
30
+ name: string;
31
+ outputs: {
32
+ internalType: string;
33
+ name: string;
34
+ type: string;
35
+ }[];
36
+ stateMutability: string;
37
+ type: string;
38
+ anonymous?: undefined;
39
+ } | {
40
+ inputs: ({
41
+ internalType: string;
42
+ name: string;
43
+ type: string;
44
+ components?: undefined;
45
+ } | {
46
+ components: ({
47
+ components: {
48
+ internalType: string;
49
+ name: string;
50
+ type: string;
51
+ }[];
52
+ internalType: string;
53
+ name: string;
54
+ type: string;
55
+ } | {
56
+ internalType: string;
57
+ name: string;
58
+ type: string;
59
+ components?: undefined;
60
+ })[];
61
+ internalType: string;
62
+ name: string;
63
+ type: string;
64
+ })[];
65
+ name: string;
66
+ outputs: never[];
67
+ stateMutability: string;
68
+ type: string;
69
+ anonymous?: undefined;
70
+ })[];
@@ -0,0 +1,165 @@
1
+ export declare const abi: readonly [{
2
+ readonly constant: true;
3
+ readonly inputs: readonly [];
4
+ readonly name: "name";
5
+ readonly outputs: readonly [{
6
+ readonly name: "";
7
+ readonly type: "string";
8
+ }];
9
+ readonly payable: false;
10
+ readonly stateMutability: "view";
11
+ readonly type: "function";
12
+ }, {
13
+ readonly constant: false;
14
+ readonly inputs: readonly [{
15
+ readonly name: "_spender";
16
+ readonly type: "address";
17
+ }, {
18
+ readonly name: "_value";
19
+ readonly type: "uint256";
20
+ }];
21
+ readonly name: "approve";
22
+ readonly outputs: readonly [];
23
+ readonly payable: false;
24
+ readonly stateMutability: "nonpayable";
25
+ readonly type: "function";
26
+ }, {
27
+ readonly constant: true;
28
+ readonly inputs: readonly [];
29
+ readonly name: "totalSupply";
30
+ readonly outputs: readonly [{
31
+ readonly name: "";
32
+ readonly type: "uint256";
33
+ }];
34
+ readonly payable: false;
35
+ readonly stateMutability: "view";
36
+ readonly type: "function";
37
+ }, {
38
+ readonly constant: false;
39
+ readonly inputs: readonly [{
40
+ readonly name: "_from";
41
+ readonly type: "address";
42
+ }, {
43
+ readonly name: "_to";
44
+ readonly type: "address";
45
+ }, {
46
+ readonly name: "_value";
47
+ readonly type: "uint256";
48
+ }];
49
+ readonly name: "transferFrom";
50
+ readonly outputs: readonly [{
51
+ readonly name: "";
52
+ readonly type: "bool";
53
+ }];
54
+ readonly payable: false;
55
+ readonly stateMutability: "nonpayable";
56
+ readonly type: "function";
57
+ }, {
58
+ readonly constant: true;
59
+ readonly inputs: readonly [];
60
+ readonly name: "decimals";
61
+ readonly outputs: readonly [{
62
+ readonly name: "";
63
+ readonly type: "uint8";
64
+ }];
65
+ readonly payable: false;
66
+ readonly stateMutability: "view";
67
+ readonly type: "function";
68
+ }, {
69
+ readonly constant: true;
70
+ readonly inputs: readonly [{
71
+ readonly name: "_owner";
72
+ readonly type: "address";
73
+ }];
74
+ readonly name: "balanceOf";
75
+ readonly outputs: readonly [{
76
+ readonly name: "balance";
77
+ readonly type: "uint256";
78
+ }];
79
+ readonly payable: false;
80
+ readonly stateMutability: "view";
81
+ readonly type: "function";
82
+ }, {
83
+ readonly constant: true;
84
+ readonly inputs: readonly [];
85
+ readonly name: "symbol";
86
+ readonly outputs: readonly [{
87
+ readonly name: "";
88
+ readonly type: "string";
89
+ }];
90
+ readonly payable: false;
91
+ readonly stateMutability: "view";
92
+ readonly type: "function";
93
+ }, {
94
+ readonly constant: false;
95
+ readonly inputs: readonly [{
96
+ readonly name: "_to";
97
+ readonly type: "address";
98
+ }, {
99
+ readonly name: "_value";
100
+ readonly type: "uint256";
101
+ }];
102
+ readonly name: "transfer";
103
+ readonly outputs: readonly [{
104
+ readonly name: "";
105
+ readonly type: "bool";
106
+ }];
107
+ readonly payable: false;
108
+ readonly stateMutability: "nonpayable";
109
+ readonly type: "function";
110
+ }, {
111
+ readonly constant: true;
112
+ readonly inputs: readonly [{
113
+ readonly name: "_owner";
114
+ readonly type: "address";
115
+ }, {
116
+ readonly name: "_spender";
117
+ readonly type: "address";
118
+ }];
119
+ readonly name: "allowance";
120
+ readonly outputs: readonly [{
121
+ readonly name: "";
122
+ readonly type: "uint256";
123
+ }];
124
+ readonly payable: false;
125
+ readonly stateMutability: "view";
126
+ readonly type: "function";
127
+ }, {
128
+ readonly payable: true;
129
+ readonly stateMutability: "payable";
130
+ readonly type: "fallback";
131
+ }, {
132
+ readonly anonymous: false;
133
+ readonly inputs: readonly [{
134
+ readonly indexed: true;
135
+ readonly name: "owner";
136
+ readonly type: "address";
137
+ }, {
138
+ readonly indexed: true;
139
+ readonly name: "spender";
140
+ readonly type: "address";
141
+ }, {
142
+ readonly indexed: false;
143
+ readonly name: "value";
144
+ readonly type: "uint256";
145
+ }];
146
+ readonly name: "Approval";
147
+ readonly type: "event";
148
+ }, {
149
+ readonly anonymous: false;
150
+ readonly inputs: readonly [{
151
+ readonly indexed: true;
152
+ readonly name: "from";
153
+ readonly type: "address";
154
+ }, {
155
+ readonly indexed: true;
156
+ readonly name: "to";
157
+ readonly type: "address";
158
+ }, {
159
+ readonly indexed: false;
160
+ readonly name: "value";
161
+ readonly type: "uint256";
162
+ }];
163
+ readonly name: "Transfer";
164
+ readonly type: "event";
165
+ }];
@@ -0,0 +1,5 @@
1
+ import { abi as dZapCoreAbi } from './DZapCoreAbi';
2
+ import { abi as dZapDcaAbi } from './DZapDcaAbi';
3
+ import { abi as permit2Abi } from './Permit2Abi';
4
+ import { abi as erc20Abi } from './erc20Abi';
5
+ export { dZapCoreAbi, dZapDcaAbi, permit2Abi, erc20Abi };
@@ -0,0 +1,2 @@
1
+ import { dZapCoreAbi, dZapDcaAbi, permit2Abi, erc20Abi } from './default';
2
+ export { dZapCoreAbi, dZapDcaAbi, permit2Abi, erc20Abi };
@@ -0,0 +1,2 @@
1
+ import { Abi } from 'viem';
2
+ export declare const abi: Abi;
@@ -0,0 +1,2 @@
1
+ import { abi as dZapCoreAbi } from './DZapCoreSwapAbi';
2
+ export { dZapCoreAbi };
@@ -0,0 +1,2 @@
1
+ export declare const baseApiClient: import("axios").AxiosInstance;
2
+ export declare const baseZapApiClient: import("axios").AxiosInstance;
@@ -0,0 +1,8 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ declare class AxiosClient {
3
+ private static instances;
4
+ private axiosInstance;
5
+ private constructor();
6
+ static getInstance(baseURL: string): AxiosInstance;
7
+ }
8
+ export default AxiosClient;
@@ -0,0 +1,16 @@
1
+ import { Abi } from 'viem';
2
+ export declare const appEnv: string;
3
+ export declare const versionPostfix = "v1/";
4
+ export declare const getBaseUrl: () => string;
5
+ export declare const getBaseZapUrl: () => string;
6
+ export type DeFiContract = {
7
+ [key: string]: {
8
+ abi: Abi;
9
+ [key: number]: string;
10
+ };
11
+ };
12
+ export declare const batchSwapIntegrators: {
13
+ [key: string]: {
14
+ contract: string;
15
+ };
16
+ };
@@ -0,0 +1,13 @@
1
+ export declare const zeroAddress = "0x0000000000000000000000000000000000000000";
2
+ export declare const eFormatNativeTokenLowerCase = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
3
+ export declare const eFormatNativeToken = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
4
+ export declare const zkNativeToken = "0x000000000000000000000000000000000000800A";
5
+ export declare const solanaNativeToken = "11111111111111111111111111111111";
6
+ export declare const solanaWNativeToken = "So11111111111111111111111111111111111111112";
7
+ export declare const unmarshalDeadAddress = "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000";
8
+ export declare const tonNativeToken = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
9
+ export declare const artheraNativeToken = "0x000000000000000000000000000000000000aA09";
10
+ export declare const suiNativeToken = "0x2::sui::SUI";
11
+ export declare const aptosNativeToken = "0x1::aptos_coin::AptosCoin";
12
+ export declare const celoNativeToken = "0x471EcE3750Da237f93B8E339c536989b8978a438";
13
+ export declare const nativeTokens: string[];
@@ -0,0 +1,5 @@
1
+ export declare const ApprovalModes: {
2
+ readonly Default: "Default";
3
+ readonly Permit2: "Permit2";
4
+ readonly AutoPermit: "AutoPermit";
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const MAX_RETRY_ATTEMPTS = 2;
2
+ export declare const RETRY_DELAY_MS = 500;
@@ -0,0 +1,16 @@
1
+ export declare const exclusiveChainIds: {
2
+ zkSync: number;
3
+ arthera: number;
4
+ gnosis: number;
5
+ kaia: number;
6
+ bounceBit: number;
7
+ biFrost: number;
8
+ flare: number;
9
+ iotaEvm: number;
10
+ opbnb: number;
11
+ zkFair: number;
12
+ bahamut: number;
13
+ immutableZkevm: number;
14
+ abstract: number;
15
+ lens: number;
16
+ };
@@ -0,0 +1,6 @@
1
+ import { HexString } from 'src/types';
2
+ import { ExclusiveChainIds } from 'src/types/chains';
3
+ export declare const exclusivePermit2Addresses: {
4
+ [key: ExclusiveChainIds]: HexString;
5
+ };
6
+ export declare const DEFAULT_PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
@@ -0,0 +1,22 @@
1
+ export declare const erc20PermitFunctions: {
2
+ readonly nonces: "nonces";
3
+ readonly version: "version";
4
+ readonly PERMIT_TYPEHASH: "PERMIT_TYPEHASH";
5
+ readonly allowance: "allowance";
6
+ };
7
+ export declare const erc20Functions: {
8
+ readonly name: "name";
9
+ readonly allowance: "allowance";
10
+ readonly approve: "approve";
11
+ readonly transfer: "transfer";
12
+ readonly transferFrom: "transferFrom";
13
+ readonly balanceOf: "balanceOf";
14
+ readonly decimals: "decimals";
15
+ readonly symbol: "symbol";
16
+ };
17
+ export declare const eip2612PermitFunctions: {
18
+ readonly permit: "permit";
19
+ readonly nonces: "nonces";
20
+ readonly DOMAIN_SEPARATOR: "DOMAIN_SEPARATOR";
21
+ readonly version: "version";
22
+ };
@@ -0,0 +1,2 @@
1
+ export declare const GET = "get";
2
+ export declare const POST = "post";
@@ -0,0 +1,43 @@
1
+ export declare const STATUS: {
2
+ pending: string;
3
+ inProgress: string;
4
+ success: string;
5
+ rejected: string;
6
+ error: string;
7
+ };
8
+ export declare const ERRORS: {
9
+ NOT_FOUND: string;
10
+ };
11
+ export declare const DZapAbis: {
12
+ readonly dZapCoreAbi: "dZapCoreAbi";
13
+ readonly dZapDcaAbi: "dZapDcaAbi";
14
+ };
15
+ export declare const OtherAbis: {
16
+ readonly permit2: "permit2";
17
+ readonly erc20: "erc20";
18
+ };
19
+ export declare const Services: {
20
+ readonly trade: "trade";
21
+ readonly dca: "dca";
22
+ readonly zap: "zap";
23
+ };
24
+ export declare const QuoteFilters: {
25
+ readonly fastest: "fastest";
26
+ readonly best: "best";
27
+ readonly all: "all";
28
+ };
29
+ export declare const HISTORICAL_BLOCK = 10;
30
+ export declare const NATIVE_TOKEN_DECIMAL = 18;
31
+ export declare const NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
32
+ export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
33
+ export declare const dZapNativeTokenFormat = "0x0000000000000000000000000000000000000000";
34
+ export declare const PERMIT_TYPEHASH_CONST = "0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9";
35
+ export declare const DEFAULT_PERMIT_DATA: `0x${string}`;
36
+ export declare const DEFAULT_PERMIT2_DATA: `0x${string}`;
37
+ export declare const STATUS_RESPONSE: {
38
+ readonly COMPLETED: "COMPLETED";
39
+ readonly FAILED: "FAILED";
40
+ readonly PENDING: "PENDING";
41
+ readonly PARTIAL_SUCCESS: "PARTIAL_SUCCESS";
42
+ readonly REFUNDED: "REFUNDED";
43
+ };
@@ -0,0 +1,5 @@
1
+ export declare const PermitTypes: {
2
+ readonly EIP2612Permit: "EIP2612Permit";
3
+ readonly Permit2: "Permit2";
4
+ readonly AutoPermit: "AutoPermit";
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const SignatureExpiryInSecs = 1800;
2
+ export declare const DEFAULT_PERMIT_VERSION = "1";
@@ -0,0 +1,2 @@
1
+ export declare const RPC_RETRY_DELAY = 500;
2
+ export declare const RPC_BATCHING_WAIT_TIME = 100;
@@ -0,0 +1,13 @@
1
+ export declare const BATCH_SWAP_QUOTE_URL = "swap/quote";
2
+ export declare const BATCH_SWAP_BUILD_TX_URL = "swap/buildTx";
3
+ export declare const BRIDGE_QUOTE_URL = "bridge/quote";
4
+ export declare const BRIDGE_BUILD_TX_URL = "bridge/buildTx";
5
+ export declare const QUOTES_URL = "/quotes";
6
+ export declare const BUILD_TX_URL = "/buildTx";
7
+ export declare const GET_ALL_CHAINS_URL = "chains";
8
+ export declare const GET_ALL_TOKENS_URL = "token/tokens";
9
+ export declare const GET_TOKEN_DETAILS_URL = "token/details";
10
+ export declare const GET_TOKEN_PRICE = "token/price";
11
+ export declare const GET_STATUS = "/status";
12
+ export declare const GET_BALANCES = "token/balance-of";
13
+ export declare const CALCULATE_POINTS_URL = "user/calculatePoints";