@dzapio/sdk 2.0.51 → 2.0.53

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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import * as viem from 'viem';
2
- import { WalletCallReceipt as WalletCallReceipt$1, TypedDataDomain, Prettify, WalletClient, TransactionReceipt, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
3
1
  import { Signer } from 'ethers';
2
+ import * as viem from 'viem';
3
+ import { TypedDataDomain, TypedData, Prettify, WalletClient, TransactionReceipt, WalletCallReceipt as WalletCallReceipt$1, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
4
4
  import * as viemChains from 'viem/chains';
5
5
  import { Chain as Chain$2 } from 'viem/chains';
6
6
  import { ChainId } from '@bigmi/core';
@@ -101,8 +101,6 @@ declare const PermitTypes: {
101
101
 
102
102
  declare const SignatureExpiryInSecs = 1800;
103
103
 
104
- type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
105
-
106
104
  type Witness = {
107
105
  value: number;
108
106
  script: string;
@@ -155,6 +153,85 @@ declare const AllowanceTypes: {
155
153
  };
156
154
  type AllowanceType = (typeof AllowanceTypes)[keyof typeof AllowanceTypes];
157
155
 
156
+ declare const chainTypes: {
157
+ readonly evm: "evm";
158
+ readonly bvm: "bvm";
159
+ readonly svm: "svm";
160
+ readonly aptosvm: "aptosvm";
161
+ readonly cosmos: "cosmos";
162
+ readonly nearvm: "nearvm";
163
+ readonly starknetvm: "starknetvm";
164
+ readonly stellarvm: "stellarvm";
165
+ readonly suivm: "suivm";
166
+ readonly tonvm: "tonvm";
167
+ readonly tronvm: "tronvm";
168
+ };
169
+
170
+ declare const zapStepAction: {
171
+ readonly execute: "execute";
172
+ readonly approve: "approve";
173
+ };
174
+ declare const zapPreExecutionStepType: {
175
+ readonly sign: "sign";
176
+ };
177
+
178
+ type StepAction = keyof typeof zapStepAction;
179
+ type ZapPreExecutionStepType = keyof typeof zapPreExecutionStepType;
180
+ type ZapEvmTxnDetails = {
181
+ type: typeof chainTypes.evm;
182
+ txnId: HexString;
183
+ callData: HexString;
184
+ callTo: HexString;
185
+ value: string;
186
+ estimatedGas: string;
187
+ };
188
+ type ZapBvmTxnDetails = {
189
+ type: typeof chainTypes.bvm;
190
+ txnId: HexString;
191
+ data: string;
192
+ };
193
+ type SVMTxnDetails = {
194
+ type: typeof chainTypes.svm;
195
+ txnId: HexString;
196
+ data: string[];
197
+ blockhash?: {
198
+ blockhash: string;
199
+ lastValidBlockHeight: number;
200
+ };
201
+ estimatedGas: string;
202
+ isJitoTx?: boolean;
203
+ };
204
+ type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
205
+ type ZapTypedDataPayload = {
206
+ domain: TypedDataDomain;
207
+ types: TypedData;
208
+ primaryType: string;
209
+ message: Record<string, unknown>;
210
+ };
211
+ type ZapSignPreExecutionStep = {
212
+ id: string;
213
+ type: typeof zapPreExecutionStepType.sign;
214
+ data: ZapTypedDataPayload;
215
+ };
216
+ type ZapPreExecutionStep = ZapSignPreExecutionStep;
217
+ type ZapSignPreExecutionStepData = {
218
+ id: string;
219
+ type: typeof zapPreExecutionStepType.sign;
220
+ signature: HexString;
221
+ message: Record<string, unknown>;
222
+ };
223
+ type ZapPreExecutionResult = {
224
+ status: TxnStatus.success;
225
+ code: StatusCodes | number;
226
+ preExecutionStepsData: ZapPreExecutionStepData[];
227
+ } | DZapTransactionResponse;
228
+ type ZapPreExecutionStepData = ZapSignPreExecutionStepData;
229
+ type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
230
+ action: StepAction;
231
+ data: T;
232
+ };
233
+ type ZapStep = ZapTransactionStep;
234
+
158
235
  declare const zapFeeType: {
159
236
  readonly fee: "fee";
160
237
  readonly ata: "ata";
@@ -175,10 +252,13 @@ declare const zapPathAction: {
175
252
  readonly bridge: "bridge";
176
253
  readonly deposit: "deposit";
177
254
  readonly withdraw: "withdraw";
255
+ readonly borrow: "borrow";
178
256
  readonly stake: "stake";
179
257
  readonly unstake: "unstake";
180
258
  readonly increase: "increase";
181
259
  readonly harvest: "harvest";
260
+ readonly long: "long";
261
+ readonly short: "short";
182
262
  };
183
263
 
184
264
  type ZapRefundType = (typeof zapRefundType)[keyof typeof zapRefundType];
@@ -224,56 +304,6 @@ type ZapFee = ZapAsset & {
224
304
  type: ZapFeeType;
225
305
  };
226
306
 
227
- declare const chainTypes: {
228
- readonly evm: "evm";
229
- readonly bvm: "bvm";
230
- readonly svm: "svm";
231
- readonly aptosvm: "aptosvm";
232
- readonly cosmos: "cosmos";
233
- readonly nearvm: "nearvm";
234
- readonly starknetvm: "starknetvm";
235
- readonly stellarvm: "stellarvm";
236
- readonly suivm: "suivm";
237
- readonly tonvm: "tonvm";
238
- readonly tronvm: "tronvm";
239
- };
240
-
241
- declare const zapStepAction: {
242
- readonly execute: "execute";
243
- };
244
-
245
- type StepAction = keyof typeof zapStepAction;
246
- type ZapEvmTxnDetails = {
247
- type: typeof chainTypes.evm;
248
- txnId: HexString;
249
- callData: HexString;
250
- callTo: HexString;
251
- value: string;
252
- estimatedGas: string;
253
- };
254
- type ZapBvmTxnDetails = {
255
- type: typeof chainTypes.bvm;
256
- txnId: HexString;
257
- data: string;
258
- };
259
- type SVMTxnDetails = {
260
- type: typeof chainTypes.svm;
261
- txnId: HexString;
262
- data: string[];
263
- blockhash?: {
264
- blockhash: string;
265
- lastValidBlockHeight: number;
266
- };
267
- estimatedGas: string;
268
- isJitoTx?: boolean;
269
- };
270
- type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
271
- type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
272
- action: StepAction;
273
- data: T;
274
- };
275
- type ZapStep = ZapTransactionStep;
276
-
277
307
  type ZapRouteRequestPositionDetails = {
278
308
  nftId: string;
279
309
  };
@@ -298,6 +328,7 @@ type ZapBuildTxnResponse = {
298
328
  output: ZapOutput[];
299
329
  steps: ZapStep[];
300
330
  path: ZapPath[];
331
+ preExecutionSteps?: ZapPreExecutionStep[];
301
332
  };
302
333
  type ZapBuildTxnRequest = {
303
334
  srcToken: string;
@@ -310,6 +341,7 @@ type ZapBuildTxnRequest = {
310
341
  account: string;
311
342
  integrator?: ZapIntegratorConfig;
312
343
  permitData?: string;
344
+ preExecutionStepsData?: ZapPreExecutionStepData[];
313
345
  amount?: string;
314
346
  estimateGas?: boolean;
315
347
  positionDetails?: ZapRouteRequestPositionDetails;
@@ -328,9 +360,12 @@ type ZapBundleAction = {
328
360
  srcChainId: number;
329
361
  destToken?: string;
330
362
  destChainId?: number;
363
+ destAmount?: string;
331
364
  positionDetails?: ZapRouteRequestPositionDetails;
332
365
  poolDetails?: ZapRouteRequestPoolDetails;
333
366
  protocol?: string;
367
+ permitData?: HexString;
368
+ batchPermitData?: HexString;
334
369
  };
335
370
  type ZapBundleRequest = {
336
371
  actions: ZapBundleAction[];
@@ -343,6 +378,7 @@ type ZapBundleRequest = {
343
378
  integrator?: ZapIntegratorConfig;
344
379
  allowedDexes?: string[];
345
380
  allowedBridges?: string[];
381
+ preExecutionStepsData?: ZapPreExecutionStepData[];
346
382
  };
347
383
 
348
384
  type ZapPoolDetailsRequest = {
@@ -1021,6 +1057,49 @@ type BroadcastTxResponse = {
1021
1057
  message: string;
1022
1058
  };
1023
1059
 
1060
+ type ZapStepsResult = {
1061
+ status: TxnStatus.success;
1062
+ code: StatusCodes | number;
1063
+ txnHash?: string;
1064
+ } | DZapTransactionResponse;
1065
+
1066
+ type DecodeTransactionParameters = {
1067
+ txHash: string;
1068
+ chainId: number;
1069
+ rpcUrls?: string[];
1070
+ };
1071
+ type BaseDecodeTxnDataParams = {
1072
+ service: AvailableDZapServices;
1073
+ rpcUrls?: string[];
1074
+ };
1075
+ type DecodeTxnDataParamsByTxHash = BaseDecodeTxnDataParams & {
1076
+ txHash: string;
1077
+ };
1078
+ type DecodeTxnDataParamsByReceipt = BaseDecodeTxnDataParams & {
1079
+ receipt: TransactionReceipt;
1080
+ };
1081
+ type DecodeTxnDataParamsWithSwapInfo = BaseDecodeTxnDataParams & {
1082
+ eventSwapInfo: SwapInfo | SwapInfo[];
1083
+ txHash: string;
1084
+ };
1085
+ type DecodeTxnDataParams = DecodeTxnDataParamsByTxHash | DecodeTxnDataParamsByReceipt | DecodeTxnDataParamsWithSwapInfo;
1086
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1087
+ type DecodeTxnDataClientOptions = {
1088
+ chainId: number;
1089
+ };
1090
+ type DecodeTxnDataClientParams = Prettify<DecodeTxnDataParams & DecodeTxnDataClientOptions>;
1091
+ type DecodeTxnDataClientParamsWithoutService = Prettify<DistributiveOmit<DecodeTxnDataClientParams, 'service'>>;
1092
+ type SwapAmountsPatchResult = {
1093
+ swapInfo: SwapInfo | SwapInfo[];
1094
+ isAmountPatched: boolean;
1095
+ amountPatchError?: string;
1096
+ };
1097
+ type DecodeTxnDataResponse = SwapAmountsPatchResult & {
1098
+ swapFailPairs: string[];
1099
+ };
1100
+
1101
+ type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
1102
+
1024
1103
  type BatchCallParams = {
1025
1104
  to: HexString;
1026
1105
  data: HexString;
@@ -1952,14 +2031,7 @@ declare class DZapClient {
1952
2031
  walletClient: WalletClient;
1953
2032
  batchHash: HexString;
1954
2033
  }): Promise<WalletCallReceipt>;
1955
- decodeTxnData({ data, service, chainId }: {
1956
- data: TransactionReceipt;
1957
- service: AvailableDZapServices;
1958
- chainId: number;
1959
- }): Promise<{
1960
- swapFailPairs: string[];
1961
- swapInfo: SwapInfo | SwapInfo[];
1962
- }>;
2034
+ decodeTxnData(params: DecodeTxnDataClientParams): Promise<DecodeTxnDataResponse>;
1963
2035
  calculatePoints(request: CalculatePointsRequest): Promise<{
1964
2036
  points: number;
1965
2037
  }>;
@@ -2018,15 +2090,18 @@ declare class DZapClient {
2018
2090
  rpcUrls?: string[];
2019
2091
  service: AvailableDZapServices;
2020
2092
  }>): Promise<SignPermitResponse<T>>;
2021
- zap({ request, steps, signer, }: {
2093
+ zap({ request, steps, preExecutionSteps, signer, rpcUrls, }: {
2022
2094
  request: ZapBuildTxnRequest | ZapBundleRequest;
2023
2095
  signer: WalletClient | Signer;
2024
2096
  steps?: ZapTransactionStep[];
2025
- }): Promise<DZapTransactionResponse | {
2026
- status: TxnStatus.success;
2027
- code: StatusCodes | number;
2028
- txnHash: HexString;
2029
- }>;
2097
+ preExecutionSteps?: ZapPreExecutionStep[];
2098
+ rpcUrls?: string[];
2099
+ }): Promise<ZapStepsResult>;
2100
+ prepareZapPreExecutionData({ preExecutionSteps, signer, account, }: {
2101
+ preExecutionSteps?: ZapPreExecutionStep[];
2102
+ signer: WalletClient | Signer;
2103
+ account?: string;
2104
+ }): Promise<ZapPreExecutionResult>;
2030
2105
  buildZapTxn(request: ZapBuildTxnRequest): Promise<ZapBuildTxnResponse>;
2031
2106
  getZapQuote(request: ZapQuoteRequest): Promise<ZapQuoteResponse>;
2032
2107
  getZapBundleQuote(request: ZapBundleRequest): Promise<ZapQuoteResponse>;
@@ -2063,19 +2138,10 @@ declare const classifyAddress: (params: {
2063
2138
  rpcUrls?: string[];
2064
2139
  }) => Promise<AddressClassifyResult | null>;
2065
2140
 
2066
- declare class SwapInputDataDecoder {
2067
- private decodeSingleSwapData;
2068
- private decodeMultiSwapData;
2069
- private decodeBatchPermitSwapData;
2070
- private decodeGaslessExecuteMultiSwapData;
2071
- private decodeGaslessExecuteMultiSwapWithWitnessData;
2072
- private decodeGaslessExecuteSwapData;
2073
- private readonly swapFunctionSignatureWithInputTokenIndex;
2074
- updateSwapInfo: ({ data, eventSwapInfo, }: {
2075
- eventSwapInfo?: SwapInfo[] | SwapInfo;
2076
- data?: HexString;
2077
- }) => SwapInfo[] | SwapInfo | undefined;
2078
- }
2141
+ declare const patchSwapAmountsFromTx: ({ chainType, chainId, txHash, rpcUrls, eventSwapInfo, }: {
2142
+ chainType: string;
2143
+ eventSwapInfo: SwapInfo[] | SwapInfo;
2144
+ } & DecodeTransactionParameters) => Promise<SwapAmountsPatchResult>;
2079
2145
 
2080
2146
  declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
2081
2147
  chainId: number;
@@ -2805,4 +2871,4 @@ declare const robinhood: {
2805
2871
  declare const customViemChains: viemChains.Chain[];
2806
2872
  declare const viemChainsById: Record<number, viemChains.Chain>;
2807
2873
 
2808
- export { type AllowanceType, AllowanceTypes, type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type BtclnTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, type HyperLiquidTxData, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, type ProtocolAmountErrorDetails, type ProtocolAmountReason, type ProtocolErrorInfo, type ProtocolErrorType, type ProtocolRouteErrorDetails, type ProtocolRouteReason, type ProtocolSlippageErrorDetails, type ProtocolUnknownErrorDetails, type ProviderDetails, type PsbtInput, type PsbtOutput, type QuoteFilter, QuoteFilters, STATUS, type SVMTxnDetails, Services, type SignPermitResponse, type SignatureCallbackParams, SignatureExpiryInSecs, type SinglePermitCallbackParams, StatusCodes, type StepAction, type SvmTxData, type SwapInfo, SwapInputDataDecoder, type Token, type TokenInfo, type TokenPermitData, type TokenResponse, type TradeBuildTxnRequest, type TradeBuildTxnRequestData, type TradeBuildTxnResponse, type TradeGasBuildTxnResponse, type TradePath, type TradeQuotesRequest, type TradeQuotesRequestData, type TradeQuotesResponse, type TradeStatusResponse, type TradeStep, TxnStatus, type UnavailableRoutes, type ZapAsset, type ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapFeeType, type ZapIntegratorConfig, type ZapOutput, type ZapPath, type ZapPathAction, type ZapPathAsset, type ZapPool, type ZapPoolDetails, type ZapPoolDetailsRequest, type ZapPoolsRequest, type ZapPoolsResponse, type ZapPosition, type ZapPositionsRequest, type ZapPositionsResponse, type ZapProviders, type ZapQuoteRequest, type ZapQuoteResponse, type ZapRefund, type ZapRefundType, type ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, arcTestnet, arthera, astralisTestnet, bitcoinTestnet, bitlayer, checkEIP2612PermitSupport, citrea, classifyAddress, contractErrorActions, customViemChains, erc20Functions, extendViemChain, fiveIre, formatToken, getTokensPairKey, hemi, hyperEvm, hyperliquid, katana, merlin, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapRefundType, zapStepAction };
2874
+ export { type AllowanceType, AllowanceTypes, type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type BtclnTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type DecodeTxnDataClientParams, type DecodeTxnDataClientParamsWithoutService, type DecodeTxnDataResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, type HyperLiquidTxData, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, type ProtocolAmountErrorDetails, type ProtocolAmountReason, type ProtocolErrorInfo, type ProtocolErrorType, type ProtocolRouteErrorDetails, type ProtocolRouteReason, type ProtocolSlippageErrorDetails, type ProtocolUnknownErrorDetails, type ProviderDetails, type PsbtInput, type PsbtOutput, type QuoteFilter, QuoteFilters, STATUS, type SVMTxnDetails, Services, type SignPermitResponse, type SignatureCallbackParams, SignatureExpiryInSecs, type SinglePermitCallbackParams, StatusCodes, type StepAction, type SvmTxData, type SwapAmountsPatchResult, type SwapInfo, type Token, type TokenInfo, type TokenPermitData, type TokenResponse, type TradeBuildTxnRequest, type TradeBuildTxnRequestData, type TradeBuildTxnResponse, type TradeGasBuildTxnResponse, type TradePath, type TradeQuotesRequest, type TradeQuotesRequestData, type TradeQuotesResponse, type TradeStatusResponse, type TradeStep, TxnStatus, type UnavailableRoutes, type ZapAsset, type ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapFeeType, type ZapIntegratorConfig, type ZapOutput, type ZapPath, type ZapPathAction, type ZapPathAsset, type ZapPool, type ZapPoolDetails, type ZapPoolDetailsRequest, type ZapPoolsRequest, type ZapPoolsResponse, type ZapPosition, type ZapPositionsRequest, type ZapPositionsResponse, type ZapPreExecutionResult, type ZapPreExecutionStep, type ZapPreExecutionStepData, type ZapPreExecutionStepType, type ZapProviders, type ZapQuoteRequest, type ZapQuoteResponse, type ZapRefund, type ZapRefundType, type ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapSignPreExecutionStep, type ZapSignPreExecutionStepData, type ZapStatus, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapTypedDataPayload, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, arcTestnet, arthera, astralisTestnet, bitcoinTestnet, bitlayer, checkEIP2612PermitSupport, citrea, classifyAddress, contractErrorActions, customViemChains, erc20Functions, extendViemChain, fiveIre, formatToken, getTokensPairKey, hemi, hyperEvm, hyperliquid, katana, merlin, patchSwapAmountsFromTx, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapPreExecutionStepType, zapRefundType, zapStepAction };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as viem from 'viem';
2
- import { WalletCallReceipt as WalletCallReceipt$1, TypedDataDomain, Prettify, WalletClient, TransactionReceipt, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
3
1
  import { Signer } from 'ethers';
2
+ import * as viem from 'viem';
3
+ import { TypedDataDomain, TypedData, Prettify, WalletClient, TransactionReceipt, WalletCallReceipt as WalletCallReceipt$1, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
4
4
  import * as viemChains from 'viem/chains';
5
5
  import { Chain as Chain$2 } from 'viem/chains';
6
6
  import { ChainId } from '@bigmi/core';
@@ -101,8 +101,6 @@ declare const PermitTypes: {
101
101
 
102
102
  declare const SignatureExpiryInSecs = 1800;
103
103
 
104
- type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
105
-
106
104
  type Witness = {
107
105
  value: number;
108
106
  script: string;
@@ -155,6 +153,85 @@ declare const AllowanceTypes: {
155
153
  };
156
154
  type AllowanceType = (typeof AllowanceTypes)[keyof typeof AllowanceTypes];
157
155
 
156
+ declare const chainTypes: {
157
+ readonly evm: "evm";
158
+ readonly bvm: "bvm";
159
+ readonly svm: "svm";
160
+ readonly aptosvm: "aptosvm";
161
+ readonly cosmos: "cosmos";
162
+ readonly nearvm: "nearvm";
163
+ readonly starknetvm: "starknetvm";
164
+ readonly stellarvm: "stellarvm";
165
+ readonly suivm: "suivm";
166
+ readonly tonvm: "tonvm";
167
+ readonly tronvm: "tronvm";
168
+ };
169
+
170
+ declare const zapStepAction: {
171
+ readonly execute: "execute";
172
+ readonly approve: "approve";
173
+ };
174
+ declare const zapPreExecutionStepType: {
175
+ readonly sign: "sign";
176
+ };
177
+
178
+ type StepAction = keyof typeof zapStepAction;
179
+ type ZapPreExecutionStepType = keyof typeof zapPreExecutionStepType;
180
+ type ZapEvmTxnDetails = {
181
+ type: typeof chainTypes.evm;
182
+ txnId: HexString;
183
+ callData: HexString;
184
+ callTo: HexString;
185
+ value: string;
186
+ estimatedGas: string;
187
+ };
188
+ type ZapBvmTxnDetails = {
189
+ type: typeof chainTypes.bvm;
190
+ txnId: HexString;
191
+ data: string;
192
+ };
193
+ type SVMTxnDetails = {
194
+ type: typeof chainTypes.svm;
195
+ txnId: HexString;
196
+ data: string[];
197
+ blockhash?: {
198
+ blockhash: string;
199
+ lastValidBlockHeight: number;
200
+ };
201
+ estimatedGas: string;
202
+ isJitoTx?: boolean;
203
+ };
204
+ type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
205
+ type ZapTypedDataPayload = {
206
+ domain: TypedDataDomain;
207
+ types: TypedData;
208
+ primaryType: string;
209
+ message: Record<string, unknown>;
210
+ };
211
+ type ZapSignPreExecutionStep = {
212
+ id: string;
213
+ type: typeof zapPreExecutionStepType.sign;
214
+ data: ZapTypedDataPayload;
215
+ };
216
+ type ZapPreExecutionStep = ZapSignPreExecutionStep;
217
+ type ZapSignPreExecutionStepData = {
218
+ id: string;
219
+ type: typeof zapPreExecutionStepType.sign;
220
+ signature: HexString;
221
+ message: Record<string, unknown>;
222
+ };
223
+ type ZapPreExecutionResult = {
224
+ status: TxnStatus.success;
225
+ code: StatusCodes | number;
226
+ preExecutionStepsData: ZapPreExecutionStepData[];
227
+ } | DZapTransactionResponse;
228
+ type ZapPreExecutionStepData = ZapSignPreExecutionStepData;
229
+ type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
230
+ action: StepAction;
231
+ data: T;
232
+ };
233
+ type ZapStep = ZapTransactionStep;
234
+
158
235
  declare const zapFeeType: {
159
236
  readonly fee: "fee";
160
237
  readonly ata: "ata";
@@ -175,10 +252,13 @@ declare const zapPathAction: {
175
252
  readonly bridge: "bridge";
176
253
  readonly deposit: "deposit";
177
254
  readonly withdraw: "withdraw";
255
+ readonly borrow: "borrow";
178
256
  readonly stake: "stake";
179
257
  readonly unstake: "unstake";
180
258
  readonly increase: "increase";
181
259
  readonly harvest: "harvest";
260
+ readonly long: "long";
261
+ readonly short: "short";
182
262
  };
183
263
 
184
264
  type ZapRefundType = (typeof zapRefundType)[keyof typeof zapRefundType];
@@ -224,56 +304,6 @@ type ZapFee = ZapAsset & {
224
304
  type: ZapFeeType;
225
305
  };
226
306
 
227
- declare const chainTypes: {
228
- readonly evm: "evm";
229
- readonly bvm: "bvm";
230
- readonly svm: "svm";
231
- readonly aptosvm: "aptosvm";
232
- readonly cosmos: "cosmos";
233
- readonly nearvm: "nearvm";
234
- readonly starknetvm: "starknetvm";
235
- readonly stellarvm: "stellarvm";
236
- readonly suivm: "suivm";
237
- readonly tonvm: "tonvm";
238
- readonly tronvm: "tronvm";
239
- };
240
-
241
- declare const zapStepAction: {
242
- readonly execute: "execute";
243
- };
244
-
245
- type StepAction = keyof typeof zapStepAction;
246
- type ZapEvmTxnDetails = {
247
- type: typeof chainTypes.evm;
248
- txnId: HexString;
249
- callData: HexString;
250
- callTo: HexString;
251
- value: string;
252
- estimatedGas: string;
253
- };
254
- type ZapBvmTxnDetails = {
255
- type: typeof chainTypes.bvm;
256
- txnId: HexString;
257
- data: string;
258
- };
259
- type SVMTxnDetails = {
260
- type: typeof chainTypes.svm;
261
- txnId: HexString;
262
- data: string[];
263
- blockhash?: {
264
- blockhash: string;
265
- lastValidBlockHeight: number;
266
- };
267
- estimatedGas: string;
268
- isJitoTx?: boolean;
269
- };
270
- type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
271
- type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
272
- action: StepAction;
273
- data: T;
274
- };
275
- type ZapStep = ZapTransactionStep;
276
-
277
307
  type ZapRouteRequestPositionDetails = {
278
308
  nftId: string;
279
309
  };
@@ -298,6 +328,7 @@ type ZapBuildTxnResponse = {
298
328
  output: ZapOutput[];
299
329
  steps: ZapStep[];
300
330
  path: ZapPath[];
331
+ preExecutionSteps?: ZapPreExecutionStep[];
301
332
  };
302
333
  type ZapBuildTxnRequest = {
303
334
  srcToken: string;
@@ -310,6 +341,7 @@ type ZapBuildTxnRequest = {
310
341
  account: string;
311
342
  integrator?: ZapIntegratorConfig;
312
343
  permitData?: string;
344
+ preExecutionStepsData?: ZapPreExecutionStepData[];
313
345
  amount?: string;
314
346
  estimateGas?: boolean;
315
347
  positionDetails?: ZapRouteRequestPositionDetails;
@@ -328,9 +360,12 @@ type ZapBundleAction = {
328
360
  srcChainId: number;
329
361
  destToken?: string;
330
362
  destChainId?: number;
363
+ destAmount?: string;
331
364
  positionDetails?: ZapRouteRequestPositionDetails;
332
365
  poolDetails?: ZapRouteRequestPoolDetails;
333
366
  protocol?: string;
367
+ permitData?: HexString;
368
+ batchPermitData?: HexString;
334
369
  };
335
370
  type ZapBundleRequest = {
336
371
  actions: ZapBundleAction[];
@@ -343,6 +378,7 @@ type ZapBundleRequest = {
343
378
  integrator?: ZapIntegratorConfig;
344
379
  allowedDexes?: string[];
345
380
  allowedBridges?: string[];
381
+ preExecutionStepsData?: ZapPreExecutionStepData[];
346
382
  };
347
383
 
348
384
  type ZapPoolDetailsRequest = {
@@ -1021,6 +1057,49 @@ type BroadcastTxResponse = {
1021
1057
  message: string;
1022
1058
  };
1023
1059
 
1060
+ type ZapStepsResult = {
1061
+ status: TxnStatus.success;
1062
+ code: StatusCodes | number;
1063
+ txnHash?: string;
1064
+ } | DZapTransactionResponse;
1065
+
1066
+ type DecodeTransactionParameters = {
1067
+ txHash: string;
1068
+ chainId: number;
1069
+ rpcUrls?: string[];
1070
+ };
1071
+ type BaseDecodeTxnDataParams = {
1072
+ service: AvailableDZapServices;
1073
+ rpcUrls?: string[];
1074
+ };
1075
+ type DecodeTxnDataParamsByTxHash = BaseDecodeTxnDataParams & {
1076
+ txHash: string;
1077
+ };
1078
+ type DecodeTxnDataParamsByReceipt = BaseDecodeTxnDataParams & {
1079
+ receipt: TransactionReceipt;
1080
+ };
1081
+ type DecodeTxnDataParamsWithSwapInfo = BaseDecodeTxnDataParams & {
1082
+ eventSwapInfo: SwapInfo | SwapInfo[];
1083
+ txHash: string;
1084
+ };
1085
+ type DecodeTxnDataParams = DecodeTxnDataParamsByTxHash | DecodeTxnDataParamsByReceipt | DecodeTxnDataParamsWithSwapInfo;
1086
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1087
+ type DecodeTxnDataClientOptions = {
1088
+ chainId: number;
1089
+ };
1090
+ type DecodeTxnDataClientParams = Prettify<DecodeTxnDataParams & DecodeTxnDataClientOptions>;
1091
+ type DecodeTxnDataClientParamsWithoutService = Prettify<DistributiveOmit<DecodeTxnDataClientParams, 'service'>>;
1092
+ type SwapAmountsPatchResult = {
1093
+ swapInfo: SwapInfo | SwapInfo[];
1094
+ isAmountPatched: boolean;
1095
+ amountPatchError?: string;
1096
+ };
1097
+ type DecodeTxnDataResponse = SwapAmountsPatchResult & {
1098
+ swapFailPairs: string[];
1099
+ };
1100
+
1101
+ type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
1102
+
1024
1103
  type BatchCallParams = {
1025
1104
  to: HexString;
1026
1105
  data: HexString;
@@ -1952,14 +2031,7 @@ declare class DZapClient {
1952
2031
  walletClient: WalletClient;
1953
2032
  batchHash: HexString;
1954
2033
  }): Promise<WalletCallReceipt>;
1955
- decodeTxnData({ data, service, chainId }: {
1956
- data: TransactionReceipt;
1957
- service: AvailableDZapServices;
1958
- chainId: number;
1959
- }): Promise<{
1960
- swapFailPairs: string[];
1961
- swapInfo: SwapInfo | SwapInfo[];
1962
- }>;
2034
+ decodeTxnData(params: DecodeTxnDataClientParams): Promise<DecodeTxnDataResponse>;
1963
2035
  calculatePoints(request: CalculatePointsRequest): Promise<{
1964
2036
  points: number;
1965
2037
  }>;
@@ -2018,15 +2090,18 @@ declare class DZapClient {
2018
2090
  rpcUrls?: string[];
2019
2091
  service: AvailableDZapServices;
2020
2092
  }>): Promise<SignPermitResponse<T>>;
2021
- zap({ request, steps, signer, }: {
2093
+ zap({ request, steps, preExecutionSteps, signer, rpcUrls, }: {
2022
2094
  request: ZapBuildTxnRequest | ZapBundleRequest;
2023
2095
  signer: WalletClient | Signer;
2024
2096
  steps?: ZapTransactionStep[];
2025
- }): Promise<DZapTransactionResponse | {
2026
- status: TxnStatus.success;
2027
- code: StatusCodes | number;
2028
- txnHash: HexString;
2029
- }>;
2097
+ preExecutionSteps?: ZapPreExecutionStep[];
2098
+ rpcUrls?: string[];
2099
+ }): Promise<ZapStepsResult>;
2100
+ prepareZapPreExecutionData({ preExecutionSteps, signer, account, }: {
2101
+ preExecutionSteps?: ZapPreExecutionStep[];
2102
+ signer: WalletClient | Signer;
2103
+ account?: string;
2104
+ }): Promise<ZapPreExecutionResult>;
2030
2105
  buildZapTxn(request: ZapBuildTxnRequest): Promise<ZapBuildTxnResponse>;
2031
2106
  getZapQuote(request: ZapQuoteRequest): Promise<ZapQuoteResponse>;
2032
2107
  getZapBundleQuote(request: ZapBundleRequest): Promise<ZapQuoteResponse>;
@@ -2063,19 +2138,10 @@ declare const classifyAddress: (params: {
2063
2138
  rpcUrls?: string[];
2064
2139
  }) => Promise<AddressClassifyResult | null>;
2065
2140
 
2066
- declare class SwapInputDataDecoder {
2067
- private decodeSingleSwapData;
2068
- private decodeMultiSwapData;
2069
- private decodeBatchPermitSwapData;
2070
- private decodeGaslessExecuteMultiSwapData;
2071
- private decodeGaslessExecuteMultiSwapWithWitnessData;
2072
- private decodeGaslessExecuteSwapData;
2073
- private readonly swapFunctionSignatureWithInputTokenIndex;
2074
- updateSwapInfo: ({ data, eventSwapInfo, }: {
2075
- eventSwapInfo?: SwapInfo[] | SwapInfo;
2076
- data?: HexString;
2077
- }) => SwapInfo[] | SwapInfo | undefined;
2078
- }
2141
+ declare const patchSwapAmountsFromTx: ({ chainType, chainId, txHash, rpcUrls, eventSwapInfo, }: {
2142
+ chainType: string;
2143
+ eventSwapInfo: SwapInfo[] | SwapInfo;
2144
+ } & DecodeTransactionParameters) => Promise<SwapAmountsPatchResult>;
2079
2145
 
2080
2146
  declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
2081
2147
  chainId: number;
@@ -2805,4 +2871,4 @@ declare const robinhood: {
2805
2871
  declare const customViemChains: viemChains.Chain[];
2806
2872
  declare const viemChainsById: Record<number, viemChains.Chain>;
2807
2873
 
2808
- export { type AllowanceType, AllowanceTypes, type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type BtclnTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, type HyperLiquidTxData, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, type ProtocolAmountErrorDetails, type ProtocolAmountReason, type ProtocolErrorInfo, type ProtocolErrorType, type ProtocolRouteErrorDetails, type ProtocolRouteReason, type ProtocolSlippageErrorDetails, type ProtocolUnknownErrorDetails, type ProviderDetails, type PsbtInput, type PsbtOutput, type QuoteFilter, QuoteFilters, STATUS, type SVMTxnDetails, Services, type SignPermitResponse, type SignatureCallbackParams, SignatureExpiryInSecs, type SinglePermitCallbackParams, StatusCodes, type StepAction, type SvmTxData, type SwapInfo, SwapInputDataDecoder, type Token, type TokenInfo, type TokenPermitData, type TokenResponse, type TradeBuildTxnRequest, type TradeBuildTxnRequestData, type TradeBuildTxnResponse, type TradeGasBuildTxnResponse, type TradePath, type TradeQuotesRequest, type TradeQuotesRequestData, type TradeQuotesResponse, type TradeStatusResponse, type TradeStep, TxnStatus, type UnavailableRoutes, type ZapAsset, type ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapFeeType, type ZapIntegratorConfig, type ZapOutput, type ZapPath, type ZapPathAction, type ZapPathAsset, type ZapPool, type ZapPoolDetails, type ZapPoolDetailsRequest, type ZapPoolsRequest, type ZapPoolsResponse, type ZapPosition, type ZapPositionsRequest, type ZapPositionsResponse, type ZapProviders, type ZapQuoteRequest, type ZapQuoteResponse, type ZapRefund, type ZapRefundType, type ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, arcTestnet, arthera, astralisTestnet, bitcoinTestnet, bitlayer, checkEIP2612PermitSupport, citrea, classifyAddress, contractErrorActions, customViemChains, erc20Functions, extendViemChain, fiveIre, formatToken, getTokensPairKey, hemi, hyperEvm, hyperliquid, katana, merlin, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapRefundType, zapStepAction };
2874
+ export { type AllowanceType, AllowanceTypes, type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type BtclnTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type DecodeTxnDataClientParams, type DecodeTxnDataClientParamsWithoutService, type DecodeTxnDataResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, type HyperLiquidTxData, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, type ProtocolAmountErrorDetails, type ProtocolAmountReason, type ProtocolErrorInfo, type ProtocolErrorType, type ProtocolRouteErrorDetails, type ProtocolRouteReason, type ProtocolSlippageErrorDetails, type ProtocolUnknownErrorDetails, type ProviderDetails, type PsbtInput, type PsbtOutput, type QuoteFilter, QuoteFilters, STATUS, type SVMTxnDetails, Services, type SignPermitResponse, type SignatureCallbackParams, SignatureExpiryInSecs, type SinglePermitCallbackParams, StatusCodes, type StepAction, type SvmTxData, type SwapAmountsPatchResult, type SwapInfo, type Token, type TokenInfo, type TokenPermitData, type TokenResponse, type TradeBuildTxnRequest, type TradeBuildTxnRequestData, type TradeBuildTxnResponse, type TradeGasBuildTxnResponse, type TradePath, type TradeQuotesRequest, type TradeQuotesRequestData, type TradeQuotesResponse, type TradeStatusResponse, type TradeStep, TxnStatus, type UnavailableRoutes, type ZapAsset, type ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapFeeType, type ZapIntegratorConfig, type ZapOutput, type ZapPath, type ZapPathAction, type ZapPathAsset, type ZapPool, type ZapPoolDetails, type ZapPoolDetailsRequest, type ZapPoolsRequest, type ZapPoolsResponse, type ZapPosition, type ZapPositionsRequest, type ZapPositionsResponse, type ZapPreExecutionResult, type ZapPreExecutionStep, type ZapPreExecutionStepData, type ZapPreExecutionStepType, type ZapProviders, type ZapQuoteRequest, type ZapQuoteResponse, type ZapRefund, type ZapRefundType, type ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapSignPreExecutionStep, type ZapSignPreExecutionStepData, type ZapStatus, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapTypedDataPayload, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, arcTestnet, arthera, astralisTestnet, bitcoinTestnet, bitlayer, checkEIP2612PermitSupport, citrea, classifyAddress, contractErrorActions, customViemChains, erc20Functions, extendViemChain, fiveIre, formatToken, getTokensPairKey, hemi, hyperEvm, hyperliquid, katana, merlin, patchSwapAmountsFromTx, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapPreExecutionStepType, zapRefundType, zapStepAction };