@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,11 @@
1
+ import { TradeBuildTxnRequest, TradeBuildTxnResponse, DZapTransactionResponse } from '../types';
2
+ import { Signer } from 'ethers';
3
+ import { WalletClient } from 'viem';
4
+ declare class TradeTxnHandler {
5
+ static buildAndSendTransaction: ({ request, signer, txnData, }: {
6
+ request: TradeBuildTxnRequest;
7
+ signer: Signer | WalletClient;
8
+ txnData?: TradeBuildTxnResponse;
9
+ }) => Promise<DZapTransactionResponse>;
10
+ }
11
+ export default TradeTxnHandler;
@@ -0,0 +1,37 @@
1
+ import { Signer } from 'ethers';
2
+ import { StatusCodes, TxnStatus } from 'src/enums';
3
+ import { DZapTransactionResponse, HexString } from 'src/types';
4
+ import { WalletClient } from 'viem';
5
+ import { ZapStep, ZapTxnDetails } from '../types/zap/step';
6
+ import { ZapBuildTxnRequest } from 'src/types/zap';
7
+ declare class ZapTxnHandler {
8
+ static execute: ({ chainId, txnData, signer, }: {
9
+ chainId: number;
10
+ txnData: ZapTxnDetails;
11
+ signer: Signer | WalletClient;
12
+ }) => Promise<DZapTransactionResponse>;
13
+ static approve: ({ chainId, data, signer }: {
14
+ chainId: number;
15
+ data: ZapTxnDetails;
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;
@@ -0,0 +1,6 @@
1
+ import { AxiosRequestConfig, CancelToken } from 'axios';
2
+ export type ExtendedAxiosRequestConfig = {
3
+ shouldRetry?: boolean;
4
+ retryCount?: number;
5
+ cancelToken?: CancelToken;
6
+ } & AxiosRequestConfig;
@@ -0,0 +1,45 @@
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 {};
@@ -0,0 +1,2 @@
1
+ import { exclusiveChainIds } from 'src/constants/chains';
2
+ export type ExclusiveChainIds = (typeof exclusiveChainIds)[keyof typeof exclusiveChainIds];
@@ -0,0 +1,14 @@
1
+ import { Versions } from 'src/enums';
2
+ import { AvailableDZapServices } from '.';
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
+ };
@@ -0,0 +1,6 @@
1
+ export declare const EIP2612Types: {
2
+ Permit: {
3
+ name: string;
4
+ type: string;
5
+ }[];
6
+ };
@@ -0,0 +1,317 @@
1
+ import { DZapAbis, OtherAbis, QuoteFilters, Services, STATUS_RESPONSE } from 'src/constants';
2
+ import { AppEnv, StatusCodes, TxnStatus } from 'src/enums';
3
+ import { PsbtInput, PsbtOutput } from './btc';
4
+ import { PermitTypes } from 'src/constants/permit';
5
+ import { ApprovalModes } from 'src/constants/approval';
6
+ export type HexString = `0x${string}`;
7
+ export type ChainData = {
8
+ [key in number]: Chain;
9
+ };
10
+ export type NativeTokenInfo = {
11
+ contract: string;
12
+ symbol: string;
13
+ decimals: number;
14
+ name: string;
15
+ balance: string;
16
+ price?: string;
17
+ };
18
+ export declare const contractErrorActions: {
19
+ readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
20
+ readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
21
+ readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
22
+ };
23
+ export type ContractErrorResponse = {
24
+ status: string;
25
+ txId: string;
26
+ code: number;
27
+ message: string;
28
+ error: unknown;
29
+ action: keyof typeof contractErrorActions;
30
+ details?: unknown;
31
+ };
32
+ export type CalculatePointsRequest = {
33
+ srcTokens: {
34
+ amount: string;
35
+ address: string;
36
+ decimals: number;
37
+ }[];
38
+ destTokens: {
39
+ amount: string;
40
+ address: string;
41
+ decimals: number;
42
+ }[];
43
+ providers: string[];
44
+ chainId: number;
45
+ account: string;
46
+ txType: 'swap' | 'bridge';
47
+ };
48
+ export type DisabledPermitTokens = {
49
+ eip2612: string[];
50
+ };
51
+ export type Chain = {
52
+ coinKey: string;
53
+ chainId: number;
54
+ chainType: string;
55
+ name: string;
56
+ coin: string;
57
+ dcaContract: string;
58
+ swapBridgeContract: string;
59
+ logo: string;
60
+ tokenlistUrl?: string;
61
+ multicallAddress: string;
62
+ blockExplorerUrl: string;
63
+ nativeToken: NativeTokenInfo;
64
+ rpcProviders: ApiRpcResponse[];
65
+ pricingAvailable: boolean;
66
+ balanceAvailable: boolean;
67
+ supportedAs: {
68
+ source: boolean;
69
+ destination: boolean;
70
+ };
71
+ contracts?: Partial<{
72
+ router: string;
73
+ dca: string;
74
+ zap: string;
75
+ }>;
76
+ coingecko?: {
77
+ chainKey: string;
78
+ nativeTokenKey: string;
79
+ };
80
+ defiLlama?: {
81
+ chainKey: string;
82
+ nativeTokenKey: string;
83
+ };
84
+ disableMultiTxn: boolean;
85
+ isEnabled: boolean;
86
+ mainnet: boolean;
87
+ tags?: Tag[];
88
+ permitDisabledTokens?: DisabledPermitTokens;
89
+ };
90
+ export type ApiRpcResponse = {
91
+ url: string;
92
+ keyRequired: boolean;
93
+ keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
94
+ };
95
+ export type ProviderDetails = {
96
+ id: string;
97
+ name: string;
98
+ icon: string;
99
+ };
100
+ export type FeeDetails = {
101
+ address: string;
102
+ decimals: number;
103
+ chainId: number;
104
+ symbol: string;
105
+ logo?: string;
106
+ amount: string;
107
+ amountUSD: string;
108
+ included: boolean;
109
+ };
110
+ export type Fee = {
111
+ gasFee: FeeDetails[];
112
+ protocolFee: FeeDetails[];
113
+ providerFee: FeeDetails[];
114
+ };
115
+ export type QuoteFilter = keyof typeof QuoteFilters;
116
+ export type TradeQuotesRequest = {
117
+ integratorId: string;
118
+ fromChain: number;
119
+ data: TradeQuotesRequestData[];
120
+ disableEstimation?: boolean;
121
+ account?: string;
122
+ allowedSources?: string[];
123
+ filter?: QuoteFilter;
124
+ };
125
+ export type TradeQuotesRequestData = {
126
+ amount: string;
127
+ srcToken: string;
128
+ srcDecimals: number;
129
+ destToken: string;
130
+ destDecimals: number;
131
+ toChain: number;
132
+ slippage: number;
133
+ selectedSource?: string;
134
+ };
135
+ export type TradeStep = {
136
+ type: string;
137
+ exchange: {
138
+ logo: string;
139
+ name: string;
140
+ };
141
+ };
142
+ export type TradePath = {
143
+ type: string;
144
+ exchange: ProviderDetails;
145
+ srcToken: Token;
146
+ srcAmount: string;
147
+ srcAmountUSD: string;
148
+ destToken: Token;
149
+ destAmount: string;
150
+ destAmountUSD: string;
151
+ fee: Fee;
152
+ };
153
+ export type Tag = {
154
+ title: string;
155
+ link?: string;
156
+ message?: string;
157
+ };
158
+ export type TradeQuote = {
159
+ bridgeDetails?: ProviderDetails;
160
+ providerDetails: ProviderDetails;
161
+ srcAmount: string;
162
+ srcAmountUSD: string;
163
+ destAmount: string;
164
+ destAmountUSD: string;
165
+ minDestAmount: string;
166
+ swapPerUnit: string;
167
+ srcToken: Token;
168
+ destToken: Token;
169
+ fee: Fee;
170
+ priceImpactPercent: string;
171
+ duration: string;
172
+ steps: TradeStep[];
173
+ path: TradePath[];
174
+ tags?: Tag[];
175
+ additionalInfo?: AdditionalInfo;
176
+ };
177
+ export type TradeQuotesByProviderId = {
178
+ [providerAndBridge: string]: TradeQuote;
179
+ };
180
+ export type TradeQuotesResponse = {
181
+ [pair: string]: {
182
+ status?: string;
183
+ message?: string;
184
+ recommendedSource: string;
185
+ fastestSource?: string;
186
+ bestReturnSource: string;
187
+ questSource?: string;
188
+ quoteRates?: TradeQuotesByProviderId;
189
+ tokensWithoutPrice: Record<number, string[]>;
190
+ };
191
+ };
192
+ export type AdditionalInfo = {
193
+ [key: string]: unknown;
194
+ };
195
+ export type Token = {
196
+ address: HexString;
197
+ decimals: number;
198
+ chainId: number;
199
+ logo: string;
200
+ symbol: string;
201
+ price?: string;
202
+ };
203
+ export type TokenInfo = NativeTokenInfo & {
204
+ chainId: number;
205
+ balanceInUsd?: number | null;
206
+ isDisabledOnSwapBridge?: {
207
+ source: boolean;
208
+ destination: boolean;
209
+ };
210
+ isDisabledOnZap?: {
211
+ source: boolean;
212
+ destination: boolean;
213
+ };
214
+ };
215
+ export type TokenResponse = {
216
+ [key: string]: TokenInfo;
217
+ };
218
+ export type TradeBuildTxnRequest = {
219
+ sender: HexString;
220
+ refundee: HexString;
221
+ integratorId: string;
222
+ fromChain: number;
223
+ disableEstimation?: boolean;
224
+ data: TradeBuildTxnRequestData[];
225
+ publicKey?: string;
226
+ };
227
+ export type TradeBuildTxnRequestData = {
228
+ amount: string;
229
+ srcToken: string;
230
+ srcDecimals: number;
231
+ destToken: string;
232
+ destDecimals: number;
233
+ toChain: number;
234
+ selectedRoute: string;
235
+ recipient: string;
236
+ slippage: number;
237
+ additionalInfo?: AdditionalInfo;
238
+ permitData?: string;
239
+ };
240
+ export type ExecuteTxnData = {
241
+ data: HexString;
242
+ to: HexString;
243
+ from: HexString;
244
+ chainId: number;
245
+ value: string;
246
+ gasLimit: string;
247
+ };
248
+ export type TradeBuildTxnResponse = ExecuteTxnData & {
249
+ additionalInfo?: AdditionalInfo;
250
+ btcTxData?: {
251
+ inputs: PsbtInput[];
252
+ outputs: PsbtOutput[];
253
+ feeRate: number;
254
+ };
255
+ svmTxData?: {
256
+ blockhash: string;
257
+ lastValidBlockHeight: number;
258
+ };
259
+ updatedQuotes: Record<string, string>;
260
+ };
261
+ export type AvailableDZapServices = (typeof Services)[keyof typeof Services];
262
+ export type DZapAvailableAbis = (typeof DZapAbis)[keyof typeof DZapAbis];
263
+ export type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
264
+ export type AppEnvType = `${AppEnv}`;
265
+ export type DZapTransactionResponse = {
266
+ status: TxnStatus;
267
+ errorMsg?: string;
268
+ code: StatusCodes | number;
269
+ action?: keyof typeof contractErrorActions;
270
+ txnHash?: HexString;
271
+ error?: unknown;
272
+ additionalInfo?: Record<string, unknown>;
273
+ updatedQuotes?: Record<string, string>;
274
+ };
275
+ export type SwapInfo = {
276
+ dex: string;
277
+ fromToken: string;
278
+ fromAmount: bigint;
279
+ toToken: string;
280
+ returnToAmount: bigint;
281
+ };
282
+ export type PartialStatusData = {
283
+ receiveToken?: string;
284
+ receiveAmount?: string;
285
+ receiveAmountUSD?: string;
286
+ };
287
+ export type RefundStatusData = {
288
+ refundTxHash?: string;
289
+ refundToken?: string;
290
+ refundAmount?: string;
291
+ refundAmountUSD?: string;
292
+ refundTimeStamp?: string;
293
+ };
294
+ export type TradeStatusResponseData = PartialStatusData & RefundStatusData & {
295
+ srcChainId: number;
296
+ srcToken: string;
297
+ srcAmount: string;
298
+ srcAmountUSD: string;
299
+ srcTxHash: string;
300
+ destChainId: number;
301
+ destToken: string;
302
+ destAmount: string;
303
+ destAmountUSD: string;
304
+ destTxHash: string;
305
+ account: string;
306
+ recipient: string;
307
+ provider: string;
308
+ allowUserTxOnDestChain: boolean;
309
+ status: keyof typeof STATUS_RESPONSE;
310
+ outputToken?: string;
311
+ refundTxHash?: string;
312
+ };
313
+ export type TradeStatusResponse = {
314
+ [pair: string]: TradeStatusResponseData;
315
+ };
316
+ export type PermitMode = keyof typeof PermitTypes;
317
+ export type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
@@ -0,0 +1,65 @@
1
+ import { HexString, ProviderDetails } from 'src/types';
2
+ import { ZapPath, ZapPathAsset } from './path';
3
+ import { ZapStep } from './step';
4
+ export type ZapBuildTxnResponse = {
5
+ amountOut: string;
6
+ approvalData: {
7
+ callTo: HexString;
8
+ approveTo: HexString;
9
+ amount: string;
10
+ } | null;
11
+ steps: ZapStep[];
12
+ path: ZapPath[];
13
+ };
14
+ export type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
15
+ export type ZapBuildTxnRequest = {
16
+ srcToken: HexString;
17
+ srcChainId: number;
18
+ destToken: HexString;
19
+ destChainId: number;
20
+ recipient: HexString;
21
+ refundee: HexString;
22
+ slippage: number;
23
+ account: HexString;
24
+ permitData?: HexString;
25
+ amount?: string;
26
+ estimateGas?: boolean;
27
+ positionDetails?: ZapRouteRequestPositionDetails;
28
+ poolDetails?: ZapRouteRequestPoolDetails;
29
+ allowedBridges?: string[];
30
+ allowedDexes?: string[];
31
+ };
32
+ export type ZapQuoteRequest = ZapBuildTxnRequest;
33
+ export type ZapRouteRequestPositionDetails = {
34
+ nftId: string;
35
+ };
36
+ export type ZapRouteRequestPoolDetails = {
37
+ lowerTick: number;
38
+ upperTick: number;
39
+ metadata?: unknown;
40
+ };
41
+ export type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED';
42
+ export type ZapStatusAsset = {
43
+ asset: ZapPathAsset;
44
+ amount: string;
45
+ amountUSD: string;
46
+ };
47
+ export type ZapStatusStep = {
48
+ chainId: number;
49
+ hash?: string;
50
+ status: ZapStatus;
51
+ action: string;
52
+ protocol: ProviderDetails;
53
+ input: ZapStatusAsset[];
54
+ output: ZapStatusAsset[];
55
+ };
56
+ export type ZapStatusResponse = {
57
+ status: ZapStatus;
58
+ steps: ZapStatusStep[];
59
+ };
60
+ export type ZapStatusRequest = {
61
+ chainId: number;
62
+ txnHash: string;
63
+ };
64
+ export * from './path';
65
+ export * from './step';
@@ -0,0 +1,36 @@
1
+ import { HexString, ProviderDetails } from 'src/types';
2
+ import { zapPathAction } from '../../zap/constants/path';
3
+ export type ZapPathAction = keyof typeof zapPathAction;
4
+ export type ZapPathAsset = {
5
+ chainId: number;
6
+ address: HexString;
7
+ symbol: string;
8
+ logo: string;
9
+ decimals: number;
10
+ price: string;
11
+ type: string;
12
+ name: string;
13
+ };
14
+ export type ZapFee = {
15
+ amount: string;
16
+ amountUSD: string;
17
+ asset: ZapPathAsset;
18
+ included: boolean;
19
+ };
20
+ export type ZapPath = {
21
+ action: ZapPathAction;
22
+ protocol: ProviderDetails;
23
+ fee: ZapFee[];
24
+ estimatedDuration: number;
25
+ input: {
26
+ asset: ZapPathAsset;
27
+ amount: string;
28
+ amountUSD: string;
29
+ }[];
30
+ output: {
31
+ asset: ZapPathAsset;
32
+ amount: string;
33
+ amountUSD: string;
34
+ dust?: boolean;
35
+ }[];
36
+ };
@@ -0,0 +1,15 @@
1
+ import { HexString } from 'src/types';
2
+ import { zapStepAction } from '../../zap/constants/step';
3
+ export type StepAction = keyof typeof zapStepAction;
4
+ export type ZapTxnDetails = {
5
+ txnId: HexString;
6
+ callData: HexString;
7
+ callTo: HexString;
8
+ value: string;
9
+ estimatedGas: string;
10
+ };
11
+ export type ZapTransactionStep = {
12
+ action: StepAction;
13
+ data: ZapTxnDetails;
14
+ };
15
+ export type ZapStep = ZapTransactionStep;
@@ -0,0 +1,82 @@
1
+ import { TradeQuote, Fee } from 'src/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("src/types").ProviderDetails;
78
+ srcToken: import("src/types").Token;
79
+ srcAmount: string;
80
+ destToken: import("src/types").Token;
81
+ destAmount: string;
82
+ }[];
@@ -0,0 +1,13 @@
1
+ import { CancelToken, Method } from 'axios';
2
+ import AxiosClient from 'src/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 {};
@@ -0,0 +1,2 @@
1
+ import * as viemChains from 'viem/chains';
2
+ export declare const viemChainsById: Record<number, viemChains.Chain>;
@@ -0,0 +1 @@
1
+ export declare const generateDeadline: (expiryInSecs: number) => bigint;