@dzapio/sdk 2.0.23 → 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 +73 -9
- package/dist/index.mjs +73 -9
- 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,
|
|
@@ -554,7 +570,6 @@ var artheraNativeToken = "0x000000000000000000000000000000000000aA09";
|
|
|
554
570
|
var suiNativeToken = "0x2::sui::SUI";
|
|
555
571
|
var aptosNativeToken = "0x1::aptos_coin::AptosCoin";
|
|
556
572
|
var stableChainNativeToken = "0x0000000000000000000000000000000000001000";
|
|
557
|
-
var tempoNativeToken = "0x20C0000000000000000000000000000000000000";
|
|
558
573
|
var nativeTokens = [
|
|
559
574
|
"0x0000000000000000000000000000000000001010",
|
|
560
575
|
eFormatNativeTokenLowerCase,
|
|
@@ -567,8 +582,7 @@ var nativeTokens = [
|
|
|
567
582
|
artheraNativeToken,
|
|
568
583
|
suiNativeToken,
|
|
569
584
|
aptosNativeToken,
|
|
570
|
-
stableChainNativeToken
|
|
571
|
-
tempoNativeToken
|
|
585
|
+
stableChainNativeToken
|
|
572
586
|
];
|
|
573
587
|
|
|
574
588
|
// src/service/price/types/IPriceProvider.ts
|
|
@@ -10762,7 +10776,13 @@ var stableChain = /* @__PURE__ */ viem.defineChain({
|
|
|
10762
10776
|
}
|
|
10763
10777
|
});
|
|
10764
10778
|
var tempo = viemChains.tempo.extend({
|
|
10765
|
-
feeToken:
|
|
10779
|
+
feeToken: "0x20C0000000000000000000000000000000000000",
|
|
10780
|
+
contracts: {
|
|
10781
|
+
multicall3: {
|
|
10782
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
10783
|
+
blockCreated: 775442
|
|
10784
|
+
}
|
|
10785
|
+
}
|
|
10766
10786
|
});
|
|
10767
10787
|
|
|
10768
10788
|
// src/chains/index.ts
|
|
@@ -15052,9 +15072,9 @@ _ZapTxnHandler.zap = async ({
|
|
|
15052
15072
|
signer
|
|
15053
15073
|
}) => {
|
|
15054
15074
|
try {
|
|
15055
|
-
const
|
|
15075
|
+
const chainId = "srcChainId" in request ? request.srcChainId : request.actions[0].srcChainId;
|
|
15056
15076
|
if (!steps || steps.length === 0) {
|
|
15057
|
-
const route = (await fetchZapBuildTxnData(request)).data;
|
|
15077
|
+
const route = "actions" in request ? (await fetchZapBundleBuildTx(request)).data : (await fetchZapBuildTxnData(request)).data;
|
|
15058
15078
|
steps = route.steps;
|
|
15059
15079
|
if (!steps || steps.length === 0) {
|
|
15060
15080
|
return {
|
|
@@ -15075,6 +15095,13 @@ _ZapTxnHandler.zap = async ({
|
|
|
15075
15095
|
txnHash = result.txnHash;
|
|
15076
15096
|
}
|
|
15077
15097
|
}
|
|
15098
|
+
if (!txnHash) {
|
|
15099
|
+
return {
|
|
15100
|
+
status: "error" /* error */,
|
|
15101
|
+
code: 500 /* Error */,
|
|
15102
|
+
errorMsg: "No executable steps found."
|
|
15103
|
+
};
|
|
15104
|
+
}
|
|
15078
15105
|
return {
|
|
15079
15106
|
status: "success" /* success */,
|
|
15080
15107
|
code: 200 /* Success */,
|
|
@@ -15996,7 +16023,11 @@ var _DZapClient = class _DZapClient {
|
|
|
15996
16023
|
* });
|
|
15997
16024
|
* ```
|
|
15998
16025
|
*/
|
|
15999
|
-
async zap({
|
|
16026
|
+
async zap({
|
|
16027
|
+
request,
|
|
16028
|
+
steps,
|
|
16029
|
+
signer
|
|
16030
|
+
}) {
|
|
16000
16031
|
return await zap_default.zap({
|
|
16001
16032
|
request,
|
|
16002
16033
|
steps,
|
|
@@ -16069,6 +16100,37 @@ var _DZapClient = class _DZapClient {
|
|
|
16069
16100
|
const route = (await fetchZapQuote(request, this.cancelTokenSource.token)).data;
|
|
16070
16101
|
return route;
|
|
16071
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
|
+
}
|
|
16072
16134
|
/**
|
|
16073
16135
|
* Fetches the current execution status of a zap transaction.
|
|
16074
16136
|
* Zap transactions involve multiple steps and this method provides detailed progress information
|
|
@@ -16324,7 +16386,9 @@ var zapPathAction = {
|
|
|
16324
16386
|
deposit: "deposit",
|
|
16325
16387
|
withdraw: "withdraw",
|
|
16326
16388
|
stake: "stake",
|
|
16327
|
-
unstake: "unstake"
|
|
16389
|
+
unstake: "unstake",
|
|
16390
|
+
increase: "increase",
|
|
16391
|
+
harvest: "harvest"
|
|
16328
16392
|
};
|
|
16329
16393
|
|
|
16330
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,
|
|
@@ -529,7 +545,6 @@ var artheraNativeToken = "0x000000000000000000000000000000000000aA09";
|
|
|
529
545
|
var suiNativeToken = "0x2::sui::SUI";
|
|
530
546
|
var aptosNativeToken = "0x1::aptos_coin::AptosCoin";
|
|
531
547
|
var stableChainNativeToken = "0x0000000000000000000000000000000000001000";
|
|
532
|
-
var tempoNativeToken = "0x20C0000000000000000000000000000000000000";
|
|
533
548
|
var nativeTokens = [
|
|
534
549
|
"0x0000000000000000000000000000000000001010",
|
|
535
550
|
eFormatNativeTokenLowerCase,
|
|
@@ -542,8 +557,7 @@ var nativeTokens = [
|
|
|
542
557
|
artheraNativeToken,
|
|
543
558
|
suiNativeToken,
|
|
544
559
|
aptosNativeToken,
|
|
545
|
-
stableChainNativeToken
|
|
546
|
-
tempoNativeToken
|
|
560
|
+
stableChainNativeToken
|
|
547
561
|
];
|
|
548
562
|
|
|
549
563
|
// src/service/price/types/IPriceProvider.ts
|
|
@@ -10737,7 +10751,13 @@ var stableChain = /* @__PURE__ */ defineChain({
|
|
|
10737
10751
|
}
|
|
10738
10752
|
});
|
|
10739
10753
|
var tempo = tempo$1.extend({
|
|
10740
|
-
feeToken:
|
|
10754
|
+
feeToken: "0x20C0000000000000000000000000000000000000",
|
|
10755
|
+
contracts: {
|
|
10756
|
+
multicall3: {
|
|
10757
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
10758
|
+
blockCreated: 775442
|
|
10759
|
+
}
|
|
10760
|
+
}
|
|
10741
10761
|
});
|
|
10742
10762
|
|
|
10743
10763
|
// src/chains/index.ts
|
|
@@ -15027,9 +15047,9 @@ _ZapTxnHandler.zap = async ({
|
|
|
15027
15047
|
signer
|
|
15028
15048
|
}) => {
|
|
15029
15049
|
try {
|
|
15030
|
-
const
|
|
15050
|
+
const chainId = "srcChainId" in request ? request.srcChainId : request.actions[0].srcChainId;
|
|
15031
15051
|
if (!steps || steps.length === 0) {
|
|
15032
|
-
const route = (await fetchZapBuildTxnData(request)).data;
|
|
15052
|
+
const route = "actions" in request ? (await fetchZapBundleBuildTx(request)).data : (await fetchZapBuildTxnData(request)).data;
|
|
15033
15053
|
steps = route.steps;
|
|
15034
15054
|
if (!steps || steps.length === 0) {
|
|
15035
15055
|
return {
|
|
@@ -15050,6 +15070,13 @@ _ZapTxnHandler.zap = async ({
|
|
|
15050
15070
|
txnHash = result.txnHash;
|
|
15051
15071
|
}
|
|
15052
15072
|
}
|
|
15073
|
+
if (!txnHash) {
|
|
15074
|
+
return {
|
|
15075
|
+
status: "error" /* error */,
|
|
15076
|
+
code: 500 /* Error */,
|
|
15077
|
+
errorMsg: "No executable steps found."
|
|
15078
|
+
};
|
|
15079
|
+
}
|
|
15053
15080
|
return {
|
|
15054
15081
|
status: "success" /* success */,
|
|
15055
15082
|
code: 200 /* Success */,
|
|
@@ -15971,7 +15998,11 @@ var _DZapClient = class _DZapClient {
|
|
|
15971
15998
|
* });
|
|
15972
15999
|
* ```
|
|
15973
16000
|
*/
|
|
15974
|
-
async zap({
|
|
16001
|
+
async zap({
|
|
16002
|
+
request,
|
|
16003
|
+
steps,
|
|
16004
|
+
signer
|
|
16005
|
+
}) {
|
|
15975
16006
|
return await zap_default.zap({
|
|
15976
16007
|
request,
|
|
15977
16008
|
steps,
|
|
@@ -16044,6 +16075,37 @@ var _DZapClient = class _DZapClient {
|
|
|
16044
16075
|
const route = (await fetchZapQuote(request, this.cancelTokenSource.token)).data;
|
|
16045
16076
|
return route;
|
|
16046
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
|
+
}
|
|
16047
16109
|
/**
|
|
16048
16110
|
* Fetches the current execution status of a zap transaction.
|
|
16049
16111
|
* Zap transactions involve multiple steps and this method provides detailed progress information
|
|
@@ -16299,7 +16361,9 @@ var zapPathAction = {
|
|
|
16299
16361
|
deposit: "deposit",
|
|
16300
16362
|
withdraw: "withdraw",
|
|
16301
16363
|
stake: "stake",
|
|
16302
|
-
unstake: "unstake"
|
|
16364
|
+
unstake: "unstake",
|
|
16365
|
+
increase: "increase",
|
|
16366
|
+
harvest: "harvest"
|
|
16303
16367
|
};
|
|
16304
16368
|
|
|
16305
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",
|