@dzapio/sdk 2.0.24 → 2.0.25
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 +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +65 -5
- package/dist/index.mjs +65 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -613,6 +613,8 @@ declare const zapPathAction: {
|
|
|
613
613
|
readonly withdraw: "withdraw";
|
|
614
614
|
readonly stake: "stake";
|
|
615
615
|
readonly unstake: "unstake";
|
|
616
|
+
readonly increase: "increase";
|
|
617
|
+
readonly harvest: "harvest";
|
|
616
618
|
};
|
|
617
619
|
|
|
618
620
|
type ZapPathAction = keyof typeof zapPathAction;
|
|
@@ -734,6 +736,33 @@ type ZapBuildTxnRequest = {
|
|
|
734
736
|
allowedDexes?: string[];
|
|
735
737
|
};
|
|
736
738
|
|
|
739
|
+
type ZapBundleSrcToken = {
|
|
740
|
+
address: string;
|
|
741
|
+
amount?: string;
|
|
742
|
+
};
|
|
743
|
+
type ZapBundleAction = {
|
|
744
|
+
action: ZapPathAction;
|
|
745
|
+
srcToken: ZapBundleSrcToken | ZapBundleSrcToken[];
|
|
746
|
+
srcChainId: number;
|
|
747
|
+
destToken?: string;
|
|
748
|
+
destChainId?: number;
|
|
749
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
750
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
751
|
+
protocol?: string;
|
|
752
|
+
};
|
|
753
|
+
type ZapBundleRequest = {
|
|
754
|
+
actions: ZapBundleAction[];
|
|
755
|
+
account: string;
|
|
756
|
+
recipient: string;
|
|
757
|
+
refundee: string;
|
|
758
|
+
slippage: number;
|
|
759
|
+
quotesOnly?: boolean;
|
|
760
|
+
estimateGas?: boolean;
|
|
761
|
+
integrator?: ZapIntegratorConfig;
|
|
762
|
+
allowedDexes?: string[];
|
|
763
|
+
allowedBridges?: string[];
|
|
764
|
+
};
|
|
765
|
+
|
|
737
766
|
type ZapPoolDetailsRequest = {
|
|
738
767
|
address: HexString;
|
|
739
768
|
chainId: number;
|
|
@@ -1850,8 +1879,8 @@ declare class DZapClient {
|
|
|
1850
1879
|
rpcUrls?: string[];
|
|
1851
1880
|
service: AvailableDZapServices;
|
|
1852
1881
|
}>): Promise<SignPermitResponse>;
|
|
1853
|
-
zap({ request, steps, signer }: {
|
|
1854
|
-
request: ZapBuildTxnRequest;
|
|
1882
|
+
zap({ request, steps, signer, }: {
|
|
1883
|
+
request: ZapBuildTxnRequest | ZapBundleRequest;
|
|
1855
1884
|
signer: WalletClient | Signer;
|
|
1856
1885
|
steps?: ZapTransactionStep[];
|
|
1857
1886
|
}): Promise<DZapTransactionResponse | {
|
|
@@ -1861,6 +1890,8 @@ declare class DZapClient {
|
|
|
1861
1890
|
}>;
|
|
1862
1891
|
buildZapTxn(request: ZapBuildTxnRequest): Promise<ZapBuildTxnResponse>;
|
|
1863
1892
|
getZapQuote(request: ZapQuoteRequest): Promise<ZapQuoteResponse>;
|
|
1893
|
+
getZapBundleQuote(request: ZapBundleRequest): Promise<ZapQuoteResponse>;
|
|
1894
|
+
buildZapBundleTx(request: ZapBundleRequest): Promise<ZapBuildTxnResponse>;
|
|
1864
1895
|
getZapTxnStatus(request: ZapStatusRequest): Promise<ZapStatusResponse>;
|
|
1865
1896
|
getBalances(chainId: number, account: string): Promise<TokenResponse>;
|
|
1866
1897
|
sendBatchCalls({ walletClient, calls }: {
|
|
@@ -1918,4 +1949,4 @@ declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, pe
|
|
|
1918
1949
|
|
|
1919
1950
|
declare const formatToken: <T extends HexString | string = string>(token: T, nativeTokenAddress?: T) => T;
|
|
1920
1951
|
|
|
1921
|
-
export { type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, 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 ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapIntegratorConfig, 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 ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusAsset, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };
|
|
1952
|
+
export { type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, 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 ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapIntegratorConfig, 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 ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusAsset, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };
|
package/dist/index.d.ts
CHANGED
|
@@ -613,6 +613,8 @@ declare const zapPathAction: {
|
|
|
613
613
|
readonly withdraw: "withdraw";
|
|
614
614
|
readonly stake: "stake";
|
|
615
615
|
readonly unstake: "unstake";
|
|
616
|
+
readonly increase: "increase";
|
|
617
|
+
readonly harvest: "harvest";
|
|
616
618
|
};
|
|
617
619
|
|
|
618
620
|
type ZapPathAction = keyof typeof zapPathAction;
|
|
@@ -734,6 +736,33 @@ type ZapBuildTxnRequest = {
|
|
|
734
736
|
allowedDexes?: string[];
|
|
735
737
|
};
|
|
736
738
|
|
|
739
|
+
type ZapBundleSrcToken = {
|
|
740
|
+
address: string;
|
|
741
|
+
amount?: string;
|
|
742
|
+
};
|
|
743
|
+
type ZapBundleAction = {
|
|
744
|
+
action: ZapPathAction;
|
|
745
|
+
srcToken: ZapBundleSrcToken | ZapBundleSrcToken[];
|
|
746
|
+
srcChainId: number;
|
|
747
|
+
destToken?: string;
|
|
748
|
+
destChainId?: number;
|
|
749
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
750
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
751
|
+
protocol?: string;
|
|
752
|
+
};
|
|
753
|
+
type ZapBundleRequest = {
|
|
754
|
+
actions: ZapBundleAction[];
|
|
755
|
+
account: string;
|
|
756
|
+
recipient: string;
|
|
757
|
+
refundee: string;
|
|
758
|
+
slippage: number;
|
|
759
|
+
quotesOnly?: boolean;
|
|
760
|
+
estimateGas?: boolean;
|
|
761
|
+
integrator?: ZapIntegratorConfig;
|
|
762
|
+
allowedDexes?: string[];
|
|
763
|
+
allowedBridges?: string[];
|
|
764
|
+
};
|
|
765
|
+
|
|
737
766
|
type ZapPoolDetailsRequest = {
|
|
738
767
|
address: HexString;
|
|
739
768
|
chainId: number;
|
|
@@ -1850,8 +1879,8 @@ declare class DZapClient {
|
|
|
1850
1879
|
rpcUrls?: string[];
|
|
1851
1880
|
service: AvailableDZapServices;
|
|
1852
1881
|
}>): Promise<SignPermitResponse>;
|
|
1853
|
-
zap({ request, steps, signer }: {
|
|
1854
|
-
request: ZapBuildTxnRequest;
|
|
1882
|
+
zap({ request, steps, signer, }: {
|
|
1883
|
+
request: ZapBuildTxnRequest | ZapBundleRequest;
|
|
1855
1884
|
signer: WalletClient | Signer;
|
|
1856
1885
|
steps?: ZapTransactionStep[];
|
|
1857
1886
|
}): Promise<DZapTransactionResponse | {
|
|
@@ -1861,6 +1890,8 @@ declare class DZapClient {
|
|
|
1861
1890
|
}>;
|
|
1862
1891
|
buildZapTxn(request: ZapBuildTxnRequest): Promise<ZapBuildTxnResponse>;
|
|
1863
1892
|
getZapQuote(request: ZapQuoteRequest): Promise<ZapQuoteResponse>;
|
|
1893
|
+
getZapBundleQuote(request: ZapBundleRequest): Promise<ZapQuoteResponse>;
|
|
1894
|
+
buildZapBundleTx(request: ZapBundleRequest): Promise<ZapBuildTxnResponse>;
|
|
1864
1895
|
getZapTxnStatus(request: ZapStatusRequest): Promise<ZapStatusResponse>;
|
|
1865
1896
|
getBalances(chainId: number, account: string): Promise<TokenResponse>;
|
|
1866
1897
|
sendBatchCalls({ walletClient, calls }: {
|
|
@@ -1918,4 +1949,4 @@ declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, owner, pe
|
|
|
1918
1949
|
|
|
1919
1950
|
declare const formatToken: <T extends HexString | string = string>(token: T, nativeTokenAddress?: T) => T;
|
|
1920
1951
|
|
|
1921
|
-
export { type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, 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 ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapIntegratorConfig, 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 ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusAsset, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };
|
|
1952
|
+
export { type ApiRpcResponse, type ApprovalMode, ApprovalModes, type BatchPermitCallbackParams, type BtcTxData, type Chain, type ChainData, type ContractErrorResponse, DZapClient, DZapPermitMode, type DZapTransactionResponse, type EvmTxData, type Fee, type FeeDetails, type GaslessTradeBuildTxnResponse, type HexString, OtherAbis, type ParamQuotes, type PermitMode, PermitTypes, 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 ZapBuildTxnRequest, type ZapBuildTxnResponse, type ZapBundleAction, type ZapBundleRequest, type ZapBundleSrcToken, type ZapBvmTxnDetails, type ZapChains, type ZapEvmTxnDetails, type ZapFee, type ZapIntegratorConfig, 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 ZapRouteRequestPoolDetails, type ZapRouteRequestPositionDetails, type ZapStatus, type ZapStatusAsset, type ZapStatusRequest, type ZapStatusResponse, type ZapStatusStep, type ZapStep, type ZapTransactionStep, type ZapTxnDetails, type ZapUnderlyingToken, type ZapUnderlyingTokenWithAmount, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };
|
package/dist/index.js
CHANGED
|
@@ -341,7 +341,11 @@ var ZAP_ENDPOINTS = {
|
|
|
341
341
|
positions: "/user/positions",
|
|
342
342
|
buildTx: "/buildTx",
|
|
343
343
|
quote: "/quote",
|
|
344
|
-
broadcast: "/broadcast"
|
|
344
|
+
broadcast: "/broadcast",
|
|
345
|
+
bundle: {
|
|
346
|
+
quote: "/bundle/quote",
|
|
347
|
+
buildTx: "/bundle/buildTx"
|
|
348
|
+
}
|
|
345
349
|
};
|
|
346
350
|
|
|
347
351
|
// src/api/index.ts
|
|
@@ -383,6 +387,18 @@ var fetchZapQuote = (request, cancelToken) => invokeZap({
|
|
|
383
387
|
method: POST,
|
|
384
388
|
cancelToken
|
|
385
389
|
});
|
|
390
|
+
var fetchZapBundleQuote = (request, cancelToken) => invokeZap({
|
|
391
|
+
endpoint: ZAP_ENDPOINTS.bundle.quote,
|
|
392
|
+
data: request,
|
|
393
|
+
method: POST,
|
|
394
|
+
cancelToken
|
|
395
|
+
});
|
|
396
|
+
var fetchZapBundleBuildTx = (request, cancelToken) => invokeZap({
|
|
397
|
+
endpoint: ZAP_ENDPOINTS.bundle.buildTx,
|
|
398
|
+
data: request,
|
|
399
|
+
method: POST,
|
|
400
|
+
cancelToken
|
|
401
|
+
});
|
|
386
402
|
var fetchZapTxnStatus = (request) => invokeZap({
|
|
387
403
|
endpoint: ZAP_ENDPOINTS.status,
|
|
388
404
|
data: request,
|
|
@@ -15056,9 +15072,9 @@ _ZapTxnHandler.zap = async ({
|
|
|
15056
15072
|
signer
|
|
15057
15073
|
}) => {
|
|
15058
15074
|
try {
|
|
15059
|
-
const
|
|
15075
|
+
const chainId = "srcChainId" in request ? request.srcChainId : request.actions[0].srcChainId;
|
|
15060
15076
|
if (!steps || steps.length === 0) {
|
|
15061
|
-
const route = (await fetchZapBuildTxnData(request)).data;
|
|
15077
|
+
const route = "actions" in request ? (await fetchZapBundleBuildTx(request)).data : (await fetchZapBuildTxnData(request)).data;
|
|
15062
15078
|
steps = route.steps;
|
|
15063
15079
|
if (!steps || steps.length === 0) {
|
|
15064
15080
|
return {
|
|
@@ -15079,6 +15095,13 @@ _ZapTxnHandler.zap = async ({
|
|
|
15079
15095
|
txnHash = result.txnHash;
|
|
15080
15096
|
}
|
|
15081
15097
|
}
|
|
15098
|
+
if (!txnHash) {
|
|
15099
|
+
return {
|
|
15100
|
+
status: "error" /* error */,
|
|
15101
|
+
code: 500 /* Error */,
|
|
15102
|
+
errorMsg: "No executable steps found."
|
|
15103
|
+
};
|
|
15104
|
+
}
|
|
15082
15105
|
return {
|
|
15083
15106
|
status: "success" /* success */,
|
|
15084
15107
|
code: 200 /* Success */,
|
|
@@ -16000,7 +16023,11 @@ var _DZapClient = class _DZapClient {
|
|
|
16000
16023
|
* });
|
|
16001
16024
|
* ```
|
|
16002
16025
|
*/
|
|
16003
|
-
async zap({
|
|
16026
|
+
async zap({
|
|
16027
|
+
request,
|
|
16028
|
+
steps,
|
|
16029
|
+
signer
|
|
16030
|
+
}) {
|
|
16004
16031
|
return await zap_default.zap({
|
|
16005
16032
|
request,
|
|
16006
16033
|
steps,
|
|
@@ -16073,6 +16100,37 @@ var _DZapClient = class _DZapClient {
|
|
|
16073
16100
|
const route = (await fetchZapQuote(request, this.cancelTokenSource.token)).data;
|
|
16074
16101
|
return route;
|
|
16075
16102
|
}
|
|
16103
|
+
/**
|
|
16104
|
+
* Fetches quote data (pricing, routing, and approvals) for bundle operations.
|
|
16105
|
+
* Bundle operations support portfolio position actions such as claim fees,
|
|
16106
|
+
* harvest, decrease, increase, and reposition.
|
|
16107
|
+
*
|
|
16108
|
+
* @param request - Bundle quote request containing the actions array
|
|
16109
|
+
* @returns Promise resolving to bundle quote response (amountOut, approvalData, path)
|
|
16110
|
+
*/
|
|
16111
|
+
async getZapBundleQuote(request) {
|
|
16112
|
+
if (this.cancelTokenSource) {
|
|
16113
|
+
this.cancelTokenSource.cancel("Cancelled due to new request");
|
|
16114
|
+
}
|
|
16115
|
+
this.cancelTokenSource = Axios__default.default.CancelToken.source();
|
|
16116
|
+
const route = (await fetchZapBundleQuote(request, this.cancelTokenSource.token)).data;
|
|
16117
|
+
return route;
|
|
16118
|
+
}
|
|
16119
|
+
/**
|
|
16120
|
+
* Builds executable transaction data for bundle operations.
|
|
16121
|
+
* Use this after fetching a bundle quote.
|
|
16122
|
+
*
|
|
16123
|
+
* @param request - Bundle build request containing the actions array
|
|
16124
|
+
* @returns Promise resolving to bundle build response (steps, path, approvalData)
|
|
16125
|
+
*/
|
|
16126
|
+
async buildZapBundleTx(request) {
|
|
16127
|
+
if (this.cancelTokenSource) {
|
|
16128
|
+
this.cancelTokenSource.cancel("Cancelled due to new request");
|
|
16129
|
+
}
|
|
16130
|
+
this.cancelTokenSource = Axios__default.default.CancelToken.source();
|
|
16131
|
+
const route = (await fetchZapBundleBuildTx(request, this.cancelTokenSource.token)).data;
|
|
16132
|
+
return route;
|
|
16133
|
+
}
|
|
16076
16134
|
/**
|
|
16077
16135
|
* Fetches the current execution status of a zap transaction.
|
|
16078
16136
|
* Zap transactions involve multiple steps and this method provides detailed progress information
|
|
@@ -16328,7 +16386,9 @@ var zapPathAction = {
|
|
|
16328
16386
|
deposit: "deposit",
|
|
16329
16387
|
withdraw: "withdraw",
|
|
16330
16388
|
stake: "stake",
|
|
16331
|
-
unstake: "unstake"
|
|
16389
|
+
unstake: "unstake",
|
|
16390
|
+
increase: "increase",
|
|
16391
|
+
harvest: "harvest"
|
|
16332
16392
|
};
|
|
16333
16393
|
|
|
16334
16394
|
exports.ApprovalModes = ApprovalModes;
|
package/dist/index.mjs
CHANGED
|
@@ -316,7 +316,11 @@ var ZAP_ENDPOINTS = {
|
|
|
316
316
|
positions: "/user/positions",
|
|
317
317
|
buildTx: "/buildTx",
|
|
318
318
|
quote: "/quote",
|
|
319
|
-
broadcast: "/broadcast"
|
|
319
|
+
broadcast: "/broadcast",
|
|
320
|
+
bundle: {
|
|
321
|
+
quote: "/bundle/quote",
|
|
322
|
+
buildTx: "/bundle/buildTx"
|
|
323
|
+
}
|
|
320
324
|
};
|
|
321
325
|
|
|
322
326
|
// src/api/index.ts
|
|
@@ -358,6 +362,18 @@ var fetchZapQuote = (request, cancelToken) => invokeZap({
|
|
|
358
362
|
method: POST,
|
|
359
363
|
cancelToken
|
|
360
364
|
});
|
|
365
|
+
var fetchZapBundleQuote = (request, cancelToken) => invokeZap({
|
|
366
|
+
endpoint: ZAP_ENDPOINTS.bundle.quote,
|
|
367
|
+
data: request,
|
|
368
|
+
method: POST,
|
|
369
|
+
cancelToken
|
|
370
|
+
});
|
|
371
|
+
var fetchZapBundleBuildTx = (request, cancelToken) => invokeZap({
|
|
372
|
+
endpoint: ZAP_ENDPOINTS.bundle.buildTx,
|
|
373
|
+
data: request,
|
|
374
|
+
method: POST,
|
|
375
|
+
cancelToken
|
|
376
|
+
});
|
|
361
377
|
var fetchZapTxnStatus = (request) => invokeZap({
|
|
362
378
|
endpoint: ZAP_ENDPOINTS.status,
|
|
363
379
|
data: request,
|
|
@@ -15031,9 +15047,9 @@ _ZapTxnHandler.zap = async ({
|
|
|
15031
15047
|
signer
|
|
15032
15048
|
}) => {
|
|
15033
15049
|
try {
|
|
15034
|
-
const
|
|
15050
|
+
const chainId = "srcChainId" in request ? request.srcChainId : request.actions[0].srcChainId;
|
|
15035
15051
|
if (!steps || steps.length === 0) {
|
|
15036
|
-
const route = (await fetchZapBuildTxnData(request)).data;
|
|
15052
|
+
const route = "actions" in request ? (await fetchZapBundleBuildTx(request)).data : (await fetchZapBuildTxnData(request)).data;
|
|
15037
15053
|
steps = route.steps;
|
|
15038
15054
|
if (!steps || steps.length === 0) {
|
|
15039
15055
|
return {
|
|
@@ -15054,6 +15070,13 @@ _ZapTxnHandler.zap = async ({
|
|
|
15054
15070
|
txnHash = result.txnHash;
|
|
15055
15071
|
}
|
|
15056
15072
|
}
|
|
15073
|
+
if (!txnHash) {
|
|
15074
|
+
return {
|
|
15075
|
+
status: "error" /* error */,
|
|
15076
|
+
code: 500 /* Error */,
|
|
15077
|
+
errorMsg: "No executable steps found."
|
|
15078
|
+
};
|
|
15079
|
+
}
|
|
15057
15080
|
return {
|
|
15058
15081
|
status: "success" /* success */,
|
|
15059
15082
|
code: 200 /* Success */,
|
|
@@ -15975,7 +15998,11 @@ var _DZapClient = class _DZapClient {
|
|
|
15975
15998
|
* });
|
|
15976
15999
|
* ```
|
|
15977
16000
|
*/
|
|
15978
|
-
async zap({
|
|
16001
|
+
async zap({
|
|
16002
|
+
request,
|
|
16003
|
+
steps,
|
|
16004
|
+
signer
|
|
16005
|
+
}) {
|
|
15979
16006
|
return await zap_default.zap({
|
|
15980
16007
|
request,
|
|
15981
16008
|
steps,
|
|
@@ -16048,6 +16075,37 @@ var _DZapClient = class _DZapClient {
|
|
|
16048
16075
|
const route = (await fetchZapQuote(request, this.cancelTokenSource.token)).data;
|
|
16049
16076
|
return route;
|
|
16050
16077
|
}
|
|
16078
|
+
/**
|
|
16079
|
+
* Fetches quote data (pricing, routing, and approvals) for bundle operations.
|
|
16080
|
+
* Bundle operations support portfolio position actions such as claim fees,
|
|
16081
|
+
* harvest, decrease, increase, and reposition.
|
|
16082
|
+
*
|
|
16083
|
+
* @param request - Bundle quote request containing the actions array
|
|
16084
|
+
* @returns Promise resolving to bundle quote response (amountOut, approvalData, path)
|
|
16085
|
+
*/
|
|
16086
|
+
async getZapBundleQuote(request) {
|
|
16087
|
+
if (this.cancelTokenSource) {
|
|
16088
|
+
this.cancelTokenSource.cancel("Cancelled due to new request");
|
|
16089
|
+
}
|
|
16090
|
+
this.cancelTokenSource = Axios.CancelToken.source();
|
|
16091
|
+
const route = (await fetchZapBundleQuote(request, this.cancelTokenSource.token)).data;
|
|
16092
|
+
return route;
|
|
16093
|
+
}
|
|
16094
|
+
/**
|
|
16095
|
+
* Builds executable transaction data for bundle operations.
|
|
16096
|
+
* Use this after fetching a bundle quote.
|
|
16097
|
+
*
|
|
16098
|
+
* @param request - Bundle build request containing the actions array
|
|
16099
|
+
* @returns Promise resolving to bundle build response (steps, path, approvalData)
|
|
16100
|
+
*/
|
|
16101
|
+
async buildZapBundleTx(request) {
|
|
16102
|
+
if (this.cancelTokenSource) {
|
|
16103
|
+
this.cancelTokenSource.cancel("Cancelled due to new request");
|
|
16104
|
+
}
|
|
16105
|
+
this.cancelTokenSource = Axios.CancelToken.source();
|
|
16106
|
+
const route = (await fetchZapBundleBuildTx(request, this.cancelTokenSource.token)).data;
|
|
16107
|
+
return route;
|
|
16108
|
+
}
|
|
16051
16109
|
/**
|
|
16052
16110
|
* Fetches the current execution status of a zap transaction.
|
|
16053
16111
|
* Zap transactions involve multiple steps and this method provides detailed progress information
|
|
@@ -16303,7 +16361,9 @@ var zapPathAction = {
|
|
|
16303
16361
|
deposit: "deposit",
|
|
16304
16362
|
withdraw: "withdraw",
|
|
16305
16363
|
stake: "stake",
|
|
16306
|
-
unstake: "unstake"
|
|
16364
|
+
unstake: "unstake",
|
|
16365
|
+
increase: "increase",
|
|
16366
|
+
harvest: "harvest"
|
|
16307
16367
|
};
|
|
16308
16368
|
|
|
16309
16369
|
export { ApprovalModes, dZapClient_default as DZapClient, DZapPermitMode, OtherAbis, PermitTypes, QuoteFilters, STATUS, Services, SignatureExpiryInSecs, StatusCodes, SwapInputDataDecoder, TxnStatus, checkEIP2612PermitSupport, contractErrorActions, erc20Functions, formatToken, getTokensPairKey, zapPathAction, zapStepAction };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzapio/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.25",
|
|
4
4
|
"description": "A TypeScript/JavaScript SDK for interacting with the DZap protocol, providing utilities for DeFi operations including Swaps, Bridges, and Zaps.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"source": "src/index.ts",
|