@dzapio/sdk 2.0.7 → 2.0.9

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 (225) hide show
  1. package/dist/api/index.d.ts +2 -1
  2. package/dist/dZapClient/index.d.ts +2 -1
  3. package/dist/enums/index.d.ts +2 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.m.js +1 -1
  6. package/dist/index.umd.js +1 -1
  7. package/dist/transactionHandlers/trade.d.ts +3 -1
  8. package/dist/types/zap/broadcast.d.ts +15 -0
  9. package/dist/utils/index.d.ts +0 -2
  10. package/package.json +1 -1
  11. package/dist/examples/chain-utils.d.ts +0 -1
  12. package/dist/examples/chain-utils.js +0 -20
  13. package/dist/examples/permit-utils.d.ts +0 -1
  14. package/dist/examples/permit-utils.js +0 -90
  15. package/dist/examples/token-utils.d.ts +0 -1
  16. package/dist/examples/token-utils.js +0 -41
  17. package/dist/examples/trade-operations.d.ts +0 -1
  18. package/dist/examples/trade-operations.js +0 -89
  19. package/dist/examples/zap-operations.d.ts +0 -1
  20. package/dist/examples/zap-operations.js +0 -69
  21. package/dist/src/api/index.d.ts +0 -27
  22. package/dist/src/api/index.js +0 -146
  23. package/dist/src/artifacts/ERC20Permit.d.ts +0 -374
  24. package/dist/src/artifacts/ERC20Permit.js +0 -469
  25. package/dist/src/artifacts/Permit2.d.ts +0 -700
  26. package/dist/src/artifacts/Permit2.js +0 -904
  27. package/dist/src/artifacts/Permit2Proxy.d.ts +0 -416
  28. package/dist/src/artifacts/Permit2Proxy.js +0 -206
  29. package/dist/src/artifacts/default/DZapCoreAbi.d.ts +0 -2
  30. package/dist/src/artifacts/default/DZapCoreAbi.js +0 -3079
  31. package/dist/src/artifacts/default/DZapCoreV2Abi.d.ts +0 -2
  32. package/dist/src/artifacts/default/DZapCoreV2Abi.js +0 -3719
  33. package/dist/src/artifacts/default/DZapDcaAbi.d.ts +0 -2
  34. package/dist/src/artifacts/default/DZapDcaAbi.js +0 -1829
  35. package/dist/src/artifacts/default/Permit2Abi.d.ts +0 -700
  36. package/dist/src/artifacts/default/Permit2Abi.js +0 -904
  37. package/dist/src/artifacts/default/erc20Abi.d.ts +0 -165
  38. package/dist/src/artifacts/default/erc20Abi.js +0 -220
  39. package/dist/src/artifacts/default/index.d.ts +0 -6
  40. package/dist/src/artifacts/default/index.js +0 -13
  41. package/dist/src/artifacts/index.d.ts +0 -2
  42. package/dist/src/artifacts/index.js +0 -9
  43. package/dist/src/artifacts/staging/DZapCoreSwapAbi.d.ts +0 -2
  44. package/dist/src/artifacts/staging/DZapCoreSwapAbi.js +0 -3079
  45. package/dist/src/artifacts/staging/index.d.ts +0 -2
  46. package/dist/src/artifacts/staging/index.js +0 -5
  47. package/dist/src/axios/baseClient.d.ts +0 -2
  48. package/dist/src/axios/baseClient.js +0 -7
  49. package/dist/src/axios/index.d.ts +0 -8
  50. package/dist/src/axios/index.js +0 -34
  51. package/dist/src/chains/definitions/arthera.d.ts +0 -35
  52. package/dist/src/chains/definitions/arthera.js +0 -28
  53. package/dist/src/chains/definitions/fiveIre.d.ts +0 -35
  54. package/dist/src/chains/definitions/fiveIre.js +0 -28
  55. package/dist/src/chains/definitions/hyperEvm.d.ts +0 -35
  56. package/dist/src/chains/definitions/hyperEvm.js +0 -26
  57. package/dist/src/chains/definitions/hyperliquid.d.ts +0 -35
  58. package/dist/src/chains/definitions/hyperliquid.js +0 -26
  59. package/dist/src/chains/definitions/stable.d.ts +0 -36
  60. package/dist/src/chains/definitions/stable.js +0 -31
  61. package/dist/src/chains/index.d.ts +0 -179
  62. package/dist/src/chains/index.js +0 -24
  63. package/dist/src/config/index.d.ts +0 -36
  64. package/dist/src/config/index.js +0 -59
  65. package/dist/src/constants/address.d.ts +0 -13
  66. package/dist/src/constants/address.js +0 -29
  67. package/dist/src/constants/approval.d.ts +0 -7
  68. package/dist/src/constants/approval.js +0 -17
  69. package/dist/src/constants/axios.d.ts +0 -2
  70. package/dist/src/constants/axios.js +0 -5
  71. package/dist/src/constants/chains.d.ts +0 -31
  72. package/dist/src/constants/chains.js +0 -34
  73. package/dist/src/constants/contract.d.ts +0 -6
  74. package/dist/src/constants/contract.js +0 -18
  75. package/dist/src/constants/erc20.d.ts +0 -25
  76. package/dist/src/constants/erc20.js +0 -28
  77. package/dist/src/constants/httpMethods.d.ts +0 -2
  78. package/dist/src/constants/httpMethods.js +0 -5
  79. package/dist/src/constants/index.d.ts +0 -48
  80. package/dist/src/constants/index.js +0 -53
  81. package/dist/src/constants/permit.d.ts +0 -29
  82. package/dist/src/constants/permit.js +0 -33
  83. package/dist/src/constants/permit2.d.ts +0 -2
  84. package/dist/src/constants/permit2.js +0 -5
  85. package/dist/src/constants/rpc.d.ts +0 -2
  86. package/dist/src/constants/rpc.js +0 -5
  87. package/dist/src/constants/urlConstants.d.ts +0 -15
  88. package/dist/src/constants/urlConstants.js +0 -18
  89. package/dist/src/dZapClient/index.d.ts +0 -1015
  90. package/dist/src/dZapClient/index.js +0 -255
  91. package/dist/src/enums/index.d.ts +0 -46
  92. package/dist/src/enums/index.js +0 -57
  93. package/dist/src/index.d.ts +0 -17
  94. package/dist/src/index.js +0 -48
  95. package/dist/src/service/cache/cacheProvider.d.ts +0 -10
  96. package/dist/src/service/cache/cacheProvider.js +0 -72
  97. package/dist/src/service/cache/constant.d.ts +0 -2
  98. package/dist/src/service/cache/constant.js +0 -6
  99. package/dist/src/service/price/index.d.ts +0 -16
  100. package/dist/src/service/price/index.js +0 -80
  101. package/dist/src/service/price/provider/coingecko/config.d.ts +0 -6
  102. package/dist/src/service/price/provider/coingecko/config.js +0 -9
  103. package/dist/src/service/price/provider/coingecko/index.d.ts +0 -9
  104. package/dist/src/service/price/provider/coingecko/index.js +0 -66
  105. package/dist/src/service/price/provider/defiLlama/config.d.ts +0 -3
  106. package/dist/src/service/price/provider/defiLlama/config.js +0 -6
  107. package/dist/src/service/price/provider/defiLlama/index.d.ts +0 -9
  108. package/dist/src/service/price/provider/defiLlama/index.js +0 -60
  109. package/dist/src/service/price/provider/defiLlama/types.d.ts +0 -11
  110. package/dist/src/service/price/provider/defiLlama/types.js +0 -2
  111. package/dist/src/service/price/provider/dzap/index.d.ts +0 -6
  112. package/dist/src/service/price/provider/dzap/index.js +0 -22
  113. package/dist/src/service/price/types/IPriceProvider.d.ts +0 -14
  114. package/dist/src/service/price/types/IPriceProvider.js +0 -8
  115. package/dist/src/transactionHandlers/generic.d.ts +0 -24
  116. package/dist/src/transactionHandlers/generic.js +0 -48
  117. package/dist/src/transactionHandlers/permit.d.ts +0 -61
  118. package/dist/src/transactionHandlers/permit.js +0 -177
  119. package/dist/src/transactionHandlers/trade.d.ts +0 -24
  120. package/dist/src/transactionHandlers/trade.js +0 -263
  121. package/dist/src/transactionHandlers/zap.d.ts +0 -37
  122. package/dist/src/transactionHandlers/zap.js +0 -135
  123. package/dist/src/types/axiosClient.d.ts +0 -6
  124. package/dist/src/types/axiosClient.js +0 -2
  125. package/dist/src/types/btc.d.ts +0 -45
  126. package/dist/src/types/btc.js +0 -2
  127. package/dist/src/types/chains.d.ts +0 -3
  128. package/dist/src/types/chains.js +0 -2
  129. package/dist/src/types/contract.d.ts +0 -14
  130. package/dist/src/types/contract.js +0 -2
  131. package/dist/src/types/eip-2612.d.ts +0 -24
  132. package/dist/src/types/eip-2612.js +0 -58
  133. package/dist/src/types/index.d.ts +0 -489
  134. package/dist/src/types/index.js +0 -8
  135. package/dist/src/types/permit.d.ts +0 -191
  136. package/dist/src/types/permit.js +0 -54
  137. package/dist/src/types/wallet.d.ts +0 -2
  138. package/dist/src/types/wallet.js +0 -2
  139. package/dist/src/types/zap/build.d.ts +0 -44
  140. package/dist/src/types/zap/build.js +0 -2
  141. package/dist/src/types/zap/index.d.ts +0 -34
  142. package/dist/src/types/zap/index.js +0 -23
  143. package/dist/src/types/zap/path.d.ts +0 -33
  144. package/dist/src/types/zap/path.js +0 -2
  145. package/dist/src/types/zap/pool.d.ts +0 -39
  146. package/dist/src/types/zap/pool.js +0 -2
  147. package/dist/src/types/zap/position.d.ts +0 -27
  148. package/dist/src/types/zap/position.js +0 -2
  149. package/dist/src/types/zap/quote.d.ts +0 -7
  150. package/dist/src/types/zap/quote.js +0 -2
  151. package/dist/src/types/zap/status.d.ts +0 -28
  152. package/dist/src/types/zap/status.js +0 -2
  153. package/dist/src/types/zap/step.d.ts +0 -23
  154. package/dist/src/types/zap/step.js +0 -2
  155. package/dist/src/utils/amount.d.ts +0 -82
  156. package/dist/src/utils/amount.js +0 -71
  157. package/dist/src/utils/axios.d.ts +0 -13
  158. package/dist/src/utils/axios.js +0 -42
  159. package/dist/src/utils/date.d.ts +0 -1
  160. package/dist/src/utils/date.js +0 -8
  161. package/dist/src/utils/decoder/swap/abis.d.ts +0 -643
  162. package/dist/src/utils/decoder/swap/abis.js +0 -831
  163. package/dist/src/utils/decoder/swap/inputDataDecoder.d.ts +0 -14
  164. package/dist/src/utils/decoder/swap/inputDataDecoder.js +0 -124
  165. package/dist/src/utils/eip-2612/eip2612Permit.d.ts +0 -23
  166. package/dist/src/utils/eip-2612/eip2612Permit.js +0 -121
  167. package/dist/src/utils/eip-5792/batchApproveTokens.d.ts +0 -21
  168. package/dist/src/utils/eip-5792/batchApproveTokens.js +0 -49
  169. package/dist/src/utils/eip-5792/index.d.ts +0 -3
  170. package/dist/src/utils/eip-5792/index.js +0 -9
  171. package/dist/src/utils/eip-5792/isBatchTxnSupportedByWallet.d.ts +0 -6
  172. package/dist/src/utils/eip-5792/isBatchTxnSupportedByWallet.js +0 -22
  173. package/dist/src/utils/eip-5792/sendBatchCalls.d.ts +0 -10
  174. package/dist/src/utils/eip-5792/sendBatchCalls.js +0 -25
  175. package/dist/src/utils/eip-5792/waitForBatchTransactionReceipt.d.ts +0 -4
  176. package/dist/src/utils/eip-5792/waitForBatchTransactionReceipt.js +0 -26
  177. package/dist/src/utils/encodeApproveCall.d.ts +0 -6
  178. package/dist/src/utils/encodeApproveCall.js +0 -13
  179. package/dist/src/utils/erc20.d.ts +0 -65
  180. package/dist/src/utils/erc20.js +0 -153
  181. package/dist/src/utils/errors.d.ts +0 -17
  182. package/dist/src/utils/errors.js +0 -78
  183. package/dist/src/utils/index.d.ts +0 -4566
  184. package/dist/src/utils/index.js +0 -196
  185. package/dist/src/utils/multicall.d.ts +0 -14
  186. package/dist/src/utils/multicall.js +0 -25
  187. package/dist/src/utils/permit2/domain.d.ts +0 -2
  188. package/dist/src/utils/permit2/domain.js +0 -11
  189. package/dist/src/utils/permit2/index.d.ts +0 -4
  190. package/dist/src/utils/permit2/index.js +0 -97
  191. package/dist/src/utils/permit2/nonce.d.ts +0 -15
  192. package/dist/src/utils/permit2/nonce.js +0 -61
  193. package/dist/src/utils/permit2/permitData.d.ts +0 -23
  194. package/dist/src/utils/permit2/permitData.js +0 -85
  195. package/dist/src/utils/permit2/values.d.ts +0 -54
  196. package/dist/src/utils/permit2/values.js +0 -88
  197. package/dist/src/utils/permit2/witnessData.d.ts +0 -4
  198. package/dist/src/utils/permit2/witnessData.js +0 -48
  199. package/dist/src/utils/signIntent/custom.d.ts +0 -11
  200. package/dist/src/utils/signIntent/custom.js +0 -31
  201. package/dist/src/utils/signIntent/gasless.d.ts +0 -12
  202. package/dist/src/utils/signIntent/gasless.js +0 -101
  203. package/dist/src/utils/signTypedData.d.ts +0 -11
  204. package/dist/src/utils/signTypedData.js +0 -21
  205. package/dist/src/utils/tokens.d.ts +0 -8
  206. package/dist/src/utils/tokens.js +0 -73
  207. package/dist/src/utils/updateQuotes.d.ts +0 -3
  208. package/dist/src/utils/updateQuotes.js +0 -69
  209. package/dist/src/zap/constants/index.d.ts +0 -2
  210. package/dist/src/zap/constants/index.js +0 -18
  211. package/dist/src/zap/constants/path.d.ts +0 -8
  212. package/dist/src/zap/constants/path.js +0 -11
  213. package/dist/src/zap/constants/step.d.ts +0 -3
  214. package/dist/src/zap/constants/step.js +0 -6
  215. package/dist/src/zap/constants/urls.d.ts +0 -13
  216. package/dist/src/zap/constants/urls.js +0 -16
  217. package/dist/test/build.test.d.ts +0 -1
  218. package/dist/test/build.test.js +0 -65
  219. package/dist/test/permit/permit2Nonce.test.d.ts +0 -2
  220. package/dist/test/permit/permit2Nonce.test.js +0 -96
  221. package/dist/test/quotes.test.d.ts +0 -1
  222. package/dist/test/quotes.test.js +0 -59
  223. package/dist/test/status.test.d.ts +0 -1
  224. package/dist/test/status.test.js +0 -37
  225. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BatchPermitAbiParams = exports.bridgeGaslessWitnessType = exports.swapGaslessWitnessType = exports.defaultWitnessType = void 0;
4
- exports.defaultWitnessType = {
5
- typeName: 'DZapTransferWitness',
6
- type: {
7
- DZapTransferWitness: [
8
- { name: 'owner', type: 'address' },
9
- { name: 'recipient', type: 'address' },
10
- ],
11
- },
12
- };
13
- exports.swapGaslessWitnessType = {
14
- typeName: 'DZapSwapWitness',
15
- type: {
16
- DZapSwapWitness: [
17
- { name: 'txId', type: 'bytes32' },
18
- { name: 'user', type: 'address' },
19
- { name: 'executorFeesHash', type: 'bytes32' },
20
- { name: 'swapDataHash', type: 'bytes32' },
21
- ],
22
- },
23
- };
24
- exports.bridgeGaslessWitnessType = {
25
- typeName: 'DZapBridgeWitness',
26
- type: {
27
- DZapBridgeWitness: [
28
- { name: 'txId', type: 'bytes32' },
29
- { name: 'user', type: 'address' },
30
- { name: 'executorFeesHash', type: 'bytes32' },
31
- { name: 'swapDataHash', type: 'bytes32' },
32
- { name: 'adapterDataHash', type: 'bytes32' },
33
- ],
34
- },
35
- };
36
- exports.BatchPermitAbiParams = [
37
- {
38
- name: 'permit',
39
- type: 'tuple',
40
- components: [
41
- {
42
- name: 'permitted',
43
- type: 'tuple[]',
44
- components: [
45
- { name: 'token', type: 'address' },
46
- { name: 'amount', type: 'uint256' },
47
- ],
48
- },
49
- { name: 'nonce', type: 'uint256' },
50
- { name: 'deadline', type: 'uint256' },
51
- ],
52
- },
53
- { name: 'permitSignature', type: 'bytes' },
54
- ];
@@ -1,2 +0,0 @@
1
- import { type WalletCallReceipt as _WalletCallReceipt } from 'viem';
2
- export type WalletCallReceipt = _WalletCallReceipt<bigint, 'success' | 'reverted'>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,44 +0,0 @@
1
- import { HexString } from '..';
2
- import { ZapPath } from './path';
3
- import { ZapStep } from './step';
4
- export type ZapRouteRequestPositionDetails = {
5
- nftId: string;
6
- };
7
- export type ZapRouteRequestPoolDetails = {
8
- lowerTick: number;
9
- upperTick: number;
10
- metadata?: unknown;
11
- };
12
- export type ZapIntegratorConfig = {
13
- id: string;
14
- feeBps: number;
15
- wallet: string;
16
- };
17
- export type ZapBuildTxnResponse = {
18
- amountOut: string;
19
- approvalData: {
20
- callTo: HexString;
21
- approveTo: HexString;
22
- amount: string;
23
- } | null;
24
- steps: ZapStep[];
25
- path: ZapPath[];
26
- };
27
- export type ZapBuildTxnRequest = {
28
- srcToken: string;
29
- srcChainId: number;
30
- destToken: string;
31
- destChainId: number;
32
- recipient: string;
33
- refundee: string;
34
- slippage: number;
35
- account: string;
36
- integrator?: ZapIntegratorConfig;
37
- permitData?: string;
38
- amount?: string;
39
- estimateGas?: boolean;
40
- positionDetails?: ZapRouteRequestPositionDetails;
41
- poolDetails?: ZapRouteRequestPoolDetails;
42
- allowedBridges?: string[];
43
- allowedDexes?: string[];
44
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,34 +0,0 @@
1
- import { HexString, ProviderDetails } from '../';
2
- import { ZapPathAsset } from './path';
3
- export type ZapProviders = Record<string, ProviderDetails>;
4
- export type ZapChains = {
5
- [key: string]: {
6
- name: string;
7
- supportedProviders: string[];
8
- };
9
- };
10
- export type ZapFee = {
11
- amount: string;
12
- amountUSD: string;
13
- asset: ZapPathAsset;
14
- included: boolean;
15
- };
16
- export type ZapUnderlyingToken = {
17
- chainId: number;
18
- address: HexString;
19
- name?: string;
20
- symbol: string;
21
- decimals: number;
22
- logo?: string | null;
23
- };
24
- export type ZapUnderlyingTokenWithAmount = ZapUnderlyingToken & {
25
- amount: string;
26
- amountUSD: string;
27
- };
28
- export * from './build';
29
- export * from './path';
30
- export * from './pool';
31
- export * from './position';
32
- export * from './quote';
33
- export * from './status';
34
- export * from './step';
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./build"), exports);
18
- __exportStar(require("./path"), exports);
19
- __exportStar(require("./pool"), exports);
20
- __exportStar(require("./position"), exports);
21
- __exportStar(require("./quote"), exports);
22
- __exportStar(require("./status"), exports);
23
- __exportStar(require("./step"), exports);
@@ -1,33 +0,0 @@
1
- import { ZapFee, ZapUnderlyingToken } from '.';
2
- import { HexString, ProviderDetails } from '../..';
3
- import { zapPathAction } from '../../zap/constants/path';
4
- export type ZapPathAction = keyof typeof zapPathAction;
5
- export type ZapPathAsset = {
6
- chainId: number;
7
- address: HexString;
8
- symbol: string;
9
- logo: string;
10
- decimals: number;
11
- price: string;
12
- type: string;
13
- name: string;
14
- provider?: ProviderDetails;
15
- underlyingTokens?: ZapUnderlyingToken[];
16
- };
17
- export type ZapPath = {
18
- action: ZapPathAction;
19
- protocol: ProviderDetails;
20
- fee: ZapFee[];
21
- estimatedDuration: number;
22
- input: {
23
- asset: ZapPathAsset;
24
- amount: string;
25
- amountUSD: string;
26
- }[];
27
- output: {
28
- asset: ZapPathAsset;
29
- amount: string;
30
- amountUSD: string;
31
- dust?: boolean;
32
- }[];
33
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,39 +0,0 @@
1
- import { ZapUnderlyingToken } from '.';
2
- import { HexString } from '..';
3
- export type ZapPoolDetailsRequest = {
4
- address: HexString;
5
- chainId: number;
6
- provider: string;
7
- };
8
- export type ZapPoolsRequest = {
9
- chainId: number;
10
- provider: string;
11
- limit?: number;
12
- offset?: number;
13
- };
14
- export type ZapPoolsResponse = {
15
- pools: ZapPool[];
16
- pages: number;
17
- limit: number;
18
- offset: number;
19
- };
20
- export type ZapPool = {
21
- address: string;
22
- chainId: number;
23
- name: string;
24
- provider: string;
25
- underlyingAssets: ZapUnderlyingToken[];
26
- tvl: string;
27
- apr: number;
28
- metadata?: unknown;
29
- symbol: string;
30
- decimals: number;
31
- };
32
- export type ZapPoolDetails = {
33
- address: string;
34
- slot0: {
35
- sqrtPriceX96: string;
36
- tick: number;
37
- tickSpacing: number;
38
- };
39
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,27 +0,0 @@
1
- import { ZapUnderlyingTokenWithAmount } from '.';
2
- import { HexString } from '..';
3
- export type ZapPositionsRequest = {
4
- account: HexString;
5
- chainId: number;
6
- provider: string;
7
- };
8
- export type ZapPosition = {
9
- underlyingAssets: ZapUnderlyingTokenWithAmount[];
10
- address: string;
11
- apr: number;
12
- name: string;
13
- chainId: number;
14
- provider: string;
15
- amount: string;
16
- amountUSD: string;
17
- nftDetails?: {
18
- id: string;
19
- manager: HexString;
20
- };
21
- metadata?: unknown;
22
- decimals: number;
23
- };
24
- export type ZapPositionsResponse = {
25
- positions: ZapPosition[];
26
- count: number;
27
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { ZapBuildTxnResponse, ZapBuildTxnRequest } from './build';
2
- export type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
3
- export type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
4
- refundee: string;
5
- recipient: string;
6
- account: string;
7
- }>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,28 +0,0 @@
1
- import { ProviderDetails } from '..';
2
- import { ZapPathAsset } from './path';
3
- export type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED';
4
- export type ZapStatusAsset = {
5
- asset: ZapPathAsset;
6
- amount: string;
7
- amountUSD: string;
8
- };
9
- export type ZapStatusStep = {
10
- chainId: number;
11
- hash?: string;
12
- status: ZapStatus;
13
- action: string;
14
- protocol: ProviderDetails;
15
- input: ZapStatusAsset[];
16
- output: ZapStatusAsset[];
17
- };
18
- export type ZapStatusResponse = {
19
- status: ZapStatus;
20
- steps: ZapStatusStep[];
21
- recipient: string;
22
- timestamp: number;
23
- completedAt: number;
24
- };
25
- export type ZapStatusRequest = {
26
- chainId: number;
27
- txnHash: string;
28
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,23 +0,0 @@
1
- import { HexString } from '..';
2
- import { chainTypes } from '../../constants/chains';
3
- import { zapStepAction } from '../../zap/constants/step';
4
- export type StepAction = keyof typeof zapStepAction;
5
- export type ZapEvmTxnDetails = {
6
- type: typeof chainTypes.evm;
7
- txnId: HexString;
8
- callData: HexString;
9
- callTo: HexString;
10
- value: string;
11
- estimatedGas: string;
12
- };
13
- export type ZapBvmTxnDetails = {
14
- type: typeof chainTypes.bvm;
15
- txnId: HexString;
16
- data: string;
17
- };
18
- export type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails;
19
- export type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
20
- action: StepAction;
21
- data: T;
22
- };
23
- export type ZapStep = ZapTransactionStep;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,82 +0,0 @@
1
- import { Fee, TradeQuote } from '../types';
2
- export declare const calculateAmountUSD: (amountInWei: string, decimals: number, price: string) => string;
3
- export declare const calculateNetGasFeeUsd: (item: TradeQuote) => string;
4
- export declare const calculateNetAmountUsd: (item: TradeQuote) => string;
5
- export declare const calculateNetGasFee: (item: TradeQuote) => bigint;
6
- export declare const updateFee: (fee: Fee, tokensPrice: Record<number, Record<string, string | null>>) => {
7
- isUpdated: boolean;
8
- fee: {
9
- gasFee: {
10
- amountUSD: string;
11
- address: string;
12
- decimals: number;
13
- chainId: number;
14
- symbol: string;
15
- logo?: string;
16
- amount: string;
17
- included: boolean;
18
- }[];
19
- providerFee: {
20
- amountUSD: string;
21
- address: string;
22
- decimals: number;
23
- chainId: number;
24
- symbol: string;
25
- logo?: string;
26
- amount: string;
27
- included: boolean;
28
- }[];
29
- protocolFee: {
30
- amountUSD: string;
31
- address: string;
32
- decimals: number;
33
- chainId: number;
34
- symbol: string;
35
- logo?: string;
36
- amount: string;
37
- included: boolean;
38
- }[];
39
- };
40
- };
41
- export declare const updatePath: (data: TradeQuote, tokensPrice: Record<number, Record<string, string | null>>) => {
42
- fee: {
43
- gasFee: {
44
- amountUSD: string;
45
- address: string;
46
- decimals: number;
47
- chainId: number;
48
- symbol: string;
49
- logo?: string;
50
- amount: string;
51
- included: boolean;
52
- }[];
53
- providerFee: {
54
- amountUSD: string;
55
- address: string;
56
- decimals: number;
57
- chainId: number;
58
- symbol: string;
59
- logo?: string;
60
- amount: string;
61
- included: boolean;
62
- }[];
63
- protocolFee: {
64
- amountUSD: string;
65
- address: string;
66
- decimals: number;
67
- chainId: number;
68
- symbol: string;
69
- logo?: string;
70
- amount: string;
71
- included: boolean;
72
- }[];
73
- };
74
- srcAmountUSD: string;
75
- destAmountUSD: string;
76
- type: string;
77
- exchange: import("../types").ProviderDetails;
78
- srcToken: import("../types").Token;
79
- srcAmount: string;
80
- destToken: import("../types").Token;
81
- destAmount: string;
82
- }[];
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePath = exports.updateFee = exports.calculateNetGasFee = exports.calculateNetAmountUsd = exports.calculateNetGasFeeUsd = exports.calculateAmountUSD = void 0;
4
- const decimal_js_1 = require("decimal.js");
5
- const viem_1 = require("viem");
6
- const calculateAmountUSD = (amountInWei, decimals, price) => {
7
- return decimals ? new decimal_js_1.default((0, viem_1.formatUnits)(BigInt(amountInWei), decimals)).mul(price || 0).toFixed(5) : '0';
8
- };
9
- exports.calculateAmountUSD = calculateAmountUSD;
10
- const calculateNetGasFeeUsd = (item) => {
11
- const totalGas = item.fee.gasFee.reduce((acc, fee) => {
12
- if (!fee.included) {
13
- const feeAmount = fee.amountUSD || '0';
14
- return acc.plus(feeAmount);
15
- }
16
- return acc;
17
- }, new decimal_js_1.default(0));
18
- return totalGas.toFixed(5);
19
- };
20
- exports.calculateNetGasFeeUsd = calculateNetGasFeeUsd;
21
- const calculateNetAmountUsd = (item) => {
22
- let feeUSD = new decimal_js_1.default((0, exports.calculateNetGasFeeUsd)(item));
23
- item.fee.providerFee.forEach((fee) => {
24
- if (!fee.included) {
25
- feeUSD = feeUSD.plus(new decimal_js_1.default(fee.amountUSD || '0'));
26
- }
27
- });
28
- return new decimal_js_1.default(item.destAmountUSD || '0').minus(feeUSD).toFixed(5);
29
- };
30
- exports.calculateNetAmountUsd = calculateNetAmountUsd;
31
- const calculateNetGasFee = (item) => {
32
- const totalGas = item.fee.gasFee.reduce((acc, fee) => {
33
- if (!fee.included) {
34
- const feeAmount = BigInt(fee.amount || '0');
35
- return acc + feeAmount;
36
- }
37
- return acc;
38
- }, BigInt(0));
39
- return totalGas;
40
- };
41
- exports.calculateNetGasFee = calculateNetGasFee;
42
- const updateFee = (fee, tokensPrice) => {
43
- let isUpdated = false;
44
- const updateAmountUSD = (feeItem, chainId, address, amount, decimals) => {
45
- var _a;
46
- const price = ((_a = tokensPrice[chainId]) === null || _a === void 0 ? void 0 : _a[address]) || '0';
47
- if (!feeItem.amountUSD || parseFloat(feeItem.amountUSD) === 0) {
48
- isUpdated = feeItem.included === false;
49
- return (0, exports.calculateAmountUSD)(amount, decimals, price);
50
- }
51
- return feeItem.amountUSD;
52
- };
53
- const updateFeeItems = (feeItems) => feeItems.map((feeItem) => (Object.assign(Object.assign({}, feeItem), { amountUSD: updateAmountUSD(feeItem, feeItem.chainId, feeItem.address, feeItem.amount, feeItem.decimals) })));
54
- const updateFees = {
55
- gasFee: updateFeeItems(fee.gasFee),
56
- providerFee: updateFeeItems(fee.providerFee),
57
- protocolFee: updateFeeItems(fee.protocolFee),
58
- };
59
- return {
60
- isUpdated: isUpdated,
61
- fee: updateFees,
62
- };
63
- };
64
- exports.updateFee = updateFee;
65
- const updatePath = (data, tokensPrice) => {
66
- return data.path.map((path) => {
67
- const { fee } = (0, exports.updateFee)(path.fee, tokensPrice);
68
- return Object.assign(Object.assign({}, path), { fee, srcAmountUSD: data.srcAmountUSD, destAmountUSD: data.destAmountUSD });
69
- });
70
- };
71
- exports.updatePath = updatePath;
@@ -1,13 +0,0 @@
1
- import { CancelToken, Method } from 'axios';
2
- import AxiosClient from '../axios';
3
- type Invoke = {
4
- endpoint: string;
5
- data?: any;
6
- method?: Method;
7
- cancelToken?: CancelToken;
8
- shouldRetry?: boolean;
9
- baseClient?: AxiosClient;
10
- };
11
- export declare const invoke: ({ endpoint, data, method, cancelToken, shouldRetry }: Invoke) => Promise<any>;
12
- export declare const invokeZap: ({ endpoint, data, method, cancelToken, shouldRetry }: Invoke) => Promise<any>;
13
- export {};
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invokeZap = exports.invoke = void 0;
4
- const baseClient_1 = require("../axios/baseClient");
5
- const httpMethods_1 = require("../constants/httpMethods");
6
- const config_1 = require("../config");
7
- const invoke = async ({ endpoint, data, method = httpMethods_1.POST, cancelToken, shouldRetry = false }) => {
8
- const apiKey = config_1.config.getApiKey();
9
- const axiosConfig = {
10
- method,
11
- url: endpoint,
12
- data: method === httpMethods_1.GET ? undefined : data,
13
- params: method === httpMethods_1.GET ? data : undefined,
14
- headers: Object.assign({ 'Content-Type': 'application/json' }, (apiKey ? { 'x-api-key': apiKey } : {})),
15
- cancelToken,
16
- shouldRetry,
17
- };
18
- return (0, baseClient_1.baseApiClient)(axiosConfig)
19
- .then((res) => res.data)
20
- .catch((error) => {
21
- return Promise.reject(error);
22
- });
23
- };
24
- exports.invoke = invoke;
25
- const invokeZap = async ({ endpoint, data, method = httpMethods_1.POST, cancelToken, shouldRetry = false }) => {
26
- const apiKey = config_1.config.getApiKey();
27
- const axiosConfig = {
28
- method,
29
- url: endpoint,
30
- data: method === httpMethods_1.GET ? undefined : data,
31
- params: method === httpMethods_1.GET ? data : undefined,
32
- headers: Object.assign({ 'Content-Type': 'application/json' }, (apiKey ? { 'x-api-key': apiKey } : {})),
33
- cancelToken,
34
- shouldRetry,
35
- };
36
- return (0, baseClient_1.baseZapApiClient)(axiosConfig)
37
- .then((res) => res.data)
38
- .catch((error) => {
39
- return Promise.reject(error);
40
- });
41
- };
42
- exports.invokeZap = invokeZap;
@@ -1 +0,0 @@
1
- export declare const generateDeadline: (expiryInSecs: number) => bigint;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateDeadline = void 0;
4
- const generateDeadline = (expiryInSecs) => {
5
- const currentTime = Math.floor(Date.now() / 1000);
6
- return BigInt(currentTime + expiryInSecs);
7
- };
8
- exports.generateDeadline = generateDeadline;