@dzapio/sdk 2.0.51 → 2.0.52

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,5 +1,5 @@
1
1
  import * as viem from 'viem';
2
- import { WalletCallReceipt as WalletCallReceipt$1, TypedDataDomain, Prettify, WalletClient, TransactionReceipt, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
2
+ import { TypedDataDomain, Prettify, WalletClient, TransactionReceipt, WalletCallReceipt as WalletCallReceipt$1, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
3
3
  import { Signer } from 'ethers';
4
4
  import * as viemChains from 'viem/chains';
5
5
  import { Chain as Chain$2 } from 'viem/chains';
@@ -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;
@@ -1021,6 +1019,43 @@ type BroadcastTxResponse = {
1021
1019
  message: string;
1022
1020
  };
1023
1021
 
1022
+ type DecodeTransactionParameters = {
1023
+ txHash: string;
1024
+ chainId: number;
1025
+ rpcUrls?: string[];
1026
+ };
1027
+ type BaseDecodeTxnDataParams = {
1028
+ service: AvailableDZapServices;
1029
+ rpcUrls?: string[];
1030
+ };
1031
+ type DecodeTxnDataParamsByTxHash = BaseDecodeTxnDataParams & {
1032
+ txHash: string;
1033
+ };
1034
+ type DecodeTxnDataParamsByReceipt = BaseDecodeTxnDataParams & {
1035
+ receipt: TransactionReceipt;
1036
+ };
1037
+ type DecodeTxnDataParamsWithSwapInfo = BaseDecodeTxnDataParams & {
1038
+ eventSwapInfo: SwapInfo | SwapInfo[];
1039
+ txHash: string;
1040
+ };
1041
+ type DecodeTxnDataParams = DecodeTxnDataParamsByTxHash | DecodeTxnDataParamsByReceipt | DecodeTxnDataParamsWithSwapInfo;
1042
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1043
+ type DecodeTxnDataClientOptions = {
1044
+ chainId: number;
1045
+ };
1046
+ type DecodeTxnDataClientParams = Prettify<DecodeTxnDataParams & DecodeTxnDataClientOptions>;
1047
+ type DecodeTxnDataClientParamsWithoutService = Prettify<DistributiveOmit<DecodeTxnDataClientParams, 'service'>>;
1048
+ type SwapAmountsPatchResult = {
1049
+ swapInfo: SwapInfo | SwapInfo[];
1050
+ isAmountPatched: boolean;
1051
+ amountPatchError?: string;
1052
+ };
1053
+ type DecodeTxnDataResponse = SwapAmountsPatchResult & {
1054
+ swapFailPairs: string[];
1055
+ };
1056
+
1057
+ type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
1058
+
1024
1059
  type BatchCallParams = {
1025
1060
  to: HexString;
1026
1061
  data: HexString;
@@ -1952,14 +1987,7 @@ declare class DZapClient {
1952
1987
  walletClient: WalletClient;
1953
1988
  batchHash: HexString;
1954
1989
  }): 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
- }>;
1990
+ decodeTxnData(params: DecodeTxnDataClientParams): Promise<DecodeTxnDataResponse>;
1963
1991
  calculatePoints(request: CalculatePointsRequest): Promise<{
1964
1992
  points: number;
1965
1993
  }>;
@@ -2063,19 +2091,10 @@ declare const classifyAddress: (params: {
2063
2091
  rpcUrls?: string[];
2064
2092
  }) => Promise<AddressClassifyResult | null>;
2065
2093
 
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
- }
2094
+ declare const patchSwapAmountsFromTx: ({ chainType, chainId, txHash, rpcUrls, eventSwapInfo, }: {
2095
+ chainType: string;
2096
+ eventSwapInfo: SwapInfo[] | SwapInfo;
2097
+ } & DecodeTransactionParameters) => Promise<SwapAmountsPatchResult>;
2079
2098
 
2080
2099
  declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
2081
2100
  chainId: number;
@@ -2805,4 +2824,4 @@ declare const robinhood: {
2805
2824
  declare const customViemChains: viemChains.Chain[];
2806
2825
  declare const viemChainsById: Record<number, viemChains.Chain>;
2807
2826
 
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 };
2827
+ 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 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, patchSwapAmountsFromTx, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapRefundType, zapStepAction };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as viem from 'viem';
2
- import { WalletCallReceipt as WalletCallReceipt$1, TypedDataDomain, Prettify, WalletClient, TransactionReceipt, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
2
+ import { TypedDataDomain, Prettify, WalletClient, TransactionReceipt, WalletCallReceipt as WalletCallReceipt$1, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
3
3
  import { Signer } from 'ethers';
4
4
  import * as viemChains from 'viem/chains';
5
5
  import { Chain as Chain$2 } from 'viem/chains';
@@ -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;
@@ -1021,6 +1019,43 @@ type BroadcastTxResponse = {
1021
1019
  message: string;
1022
1020
  };
1023
1021
 
1022
+ type DecodeTransactionParameters = {
1023
+ txHash: string;
1024
+ chainId: number;
1025
+ rpcUrls?: string[];
1026
+ };
1027
+ type BaseDecodeTxnDataParams = {
1028
+ service: AvailableDZapServices;
1029
+ rpcUrls?: string[];
1030
+ };
1031
+ type DecodeTxnDataParamsByTxHash = BaseDecodeTxnDataParams & {
1032
+ txHash: string;
1033
+ };
1034
+ type DecodeTxnDataParamsByReceipt = BaseDecodeTxnDataParams & {
1035
+ receipt: TransactionReceipt;
1036
+ };
1037
+ type DecodeTxnDataParamsWithSwapInfo = BaseDecodeTxnDataParams & {
1038
+ eventSwapInfo: SwapInfo | SwapInfo[];
1039
+ txHash: string;
1040
+ };
1041
+ type DecodeTxnDataParams = DecodeTxnDataParamsByTxHash | DecodeTxnDataParamsByReceipt | DecodeTxnDataParamsWithSwapInfo;
1042
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1043
+ type DecodeTxnDataClientOptions = {
1044
+ chainId: number;
1045
+ };
1046
+ type DecodeTxnDataClientParams = Prettify<DecodeTxnDataParams & DecodeTxnDataClientOptions>;
1047
+ type DecodeTxnDataClientParamsWithoutService = Prettify<DistributiveOmit<DecodeTxnDataClientParams, 'service'>>;
1048
+ type SwapAmountsPatchResult = {
1049
+ swapInfo: SwapInfo | SwapInfo[];
1050
+ isAmountPatched: boolean;
1051
+ amountPatchError?: string;
1052
+ };
1053
+ type DecodeTxnDataResponse = SwapAmountsPatchResult & {
1054
+ swapFailPairs: string[];
1055
+ };
1056
+
1057
+ type WalletCallReceipt = WalletCallReceipt$1<bigint, 'success' | 'reverted'>;
1058
+
1024
1059
  type BatchCallParams = {
1025
1060
  to: HexString;
1026
1061
  data: HexString;
@@ -1952,14 +1987,7 @@ declare class DZapClient {
1952
1987
  walletClient: WalletClient;
1953
1988
  batchHash: HexString;
1954
1989
  }): 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
- }>;
1990
+ decodeTxnData(params: DecodeTxnDataClientParams): Promise<DecodeTxnDataResponse>;
1963
1991
  calculatePoints(request: CalculatePointsRequest): Promise<{
1964
1992
  points: number;
1965
1993
  }>;
@@ -2063,19 +2091,10 @@ declare const classifyAddress: (params: {
2063
2091
  rpcUrls?: string[];
2064
2092
  }) => Promise<AddressClassifyResult | null>;
2065
2093
 
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
- }
2094
+ declare const patchSwapAmountsFromTx: ({ chainType, chainId, txHash, rpcUrls, eventSwapInfo, }: {
2095
+ chainType: string;
2096
+ eventSwapInfo: SwapInfo[] | SwapInfo;
2097
+ } & DecodeTransactionParameters) => Promise<SwapAmountsPatchResult>;
2079
2098
 
2080
2099
  declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, permit, }: {
2081
2100
  chainId: number;
@@ -2805,4 +2824,4 @@ declare const robinhood: {
2805
2824
  declare const customViemChains: viemChains.Chain[];
2806
2825
  declare const viemChainsById: Record<number, viemChains.Chain>;
2807
2826
 
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 };
2827
+ 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 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, patchSwapAmountsFromTx, pushTestnet, robinhood, stableChain, tempo, viemChainsById, zapFeeType, zapPathAction, zapRefundType, zapStepAction };