@dzapio/sdk 1.0.2 → 1.0.3
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/api/index.d.ts +1 -1
- package/dist/artifacts/ERC20Permit.d.ts +1 -1
- package/dist/artifacts/default/DZapCoreV2Abi.d.ts +2 -0
- package/dist/artifacts/default/index.d.ts +2 -1
- package/dist/artifacts/index.d.ts +2 -2
- package/dist/config/index.d.ts +36 -0
- package/dist/constants/chains.d.ts +1 -0
- package/dist/constants/contract.d.ts +2 -2
- package/dist/constants/erc20.d.ts +3 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/rpc.d.ts +1 -1
- package/dist/dZapClient/index.d.ts +27 -16
- package/dist/enums/index.d.ts +8 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/service/price/index.d.ts +1 -1
- package/dist/service/price/provider/coingecko/index.d.ts +1 -1
- package/dist/service/price/provider/defiLlama/index.d.ts +1 -1
- package/dist/service/price/types/IPriceProvider.d.ts +1 -1
- package/dist/transactionHandlers/generic.d.ts +2 -2
- package/dist/transactionHandlers/permit.d.ts +10 -8
- package/dist/transactionHandlers/trade.d.ts +7 -2
- package/dist/transactionHandlers/zap.d.ts +3 -3
- package/dist/types/chains.d.ts +1 -1
- package/dist/types/contract.d.ts +1 -1
- package/dist/types/index.d.ts +12 -13
- package/dist/types/wallet.d.ts +2 -0
- package/dist/types/zap/index.d.ts +1 -1
- package/dist/types/zap/path.d.ts +1 -1
- package/dist/types/zap/pool.d.ts +2 -1
- package/dist/types/zap/status.d.ts +3 -0
- package/dist/types/zap/step.d.ts +1 -1
- package/dist/utils/amount.d.ts +4 -4
- package/dist/utils/axios.d.ts +1 -1
- package/dist/utils/eip-5792/batchApproveTokens.d.ts +21 -0
- package/dist/utils/eip-5792/index.d.ts +3 -0
- package/dist/utils/eip-5792/isBatchTxnSupportedByWallet.d.ts +6 -0
- package/dist/utils/eip-5792/sendBatchCalls.d.ts +10 -0
- package/dist/utils/eip-5792/waitForBatchTransactionReceipt.d.ts +4 -0
- package/dist/utils/encodeApproveCall.d.ts +6 -0
- package/dist/utils/erc20.d.ts +8 -6
- package/dist/utils/errors.d.ts +2 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/multicall.d.ts +4 -2
- package/dist/utils/permit/permit2Methods.d.ts +6 -5
- package/dist/utils/permit/permitMethods.d.ts +17 -9
- package/dist/utils/signTypedData.d.ts +3 -3
- package/dist/utils/tokens.d.ts +2 -2
- package/dist/utils/updateQuotes.d.ts +2 -2
- package/package.json +17 -3
- package/dist/config.d.ts +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
2
|
-
import { HexString } from '../types';
|
|
3
1
|
import { Signer } from 'ethers';
|
|
4
2
|
import { WalletClient } from 'viem';
|
|
3
|
+
import { StatusCodes, TxnStatus } from '../enums';
|
|
4
|
+
import { HexString } from '../types';
|
|
5
5
|
declare class GenericTxnHandler {
|
|
6
6
|
static sendTransaction: ({ chainId, signer, from, to, data, value, }: {
|
|
7
7
|
chainId: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AvailableDZapServices, HexString, PermitMode } from 'src/types';
|
|
1
|
+
import { Signer } from 'ethers';
|
|
3
2
|
import { WalletClient } from 'viem';
|
|
4
|
-
import {
|
|
3
|
+
import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
|
|
4
|
+
import { AvailableDZapServices, HexString, PermitMode } from '../types';
|
|
5
5
|
declare class PermitTxnHandler {
|
|
6
|
-
static generatePermitDataForToken: ({ token, isFirstToken, oneToMany, totalSrcAmount, chainId, rpcUrls, sender, spender, permitType, signer, service, permitEIP2612DisabledTokens, }: {
|
|
6
|
+
static generatePermitDataForToken: ({ token, isFirstToken, oneToMany, totalSrcAmount, chainId, rpcUrls, sender, spender, permitType, signer, service, permitEIP2612DisabledTokens, contractVersion, }: {
|
|
7
7
|
token: {
|
|
8
8
|
address: HexString;
|
|
9
9
|
amount: string;
|
|
@@ -16,16 +16,17 @@ declare class PermitTxnHandler {
|
|
|
16
16
|
sender: HexString;
|
|
17
17
|
spender: HexString;
|
|
18
18
|
permitType: PermitMode;
|
|
19
|
-
signer: WalletClient |
|
|
19
|
+
signer: WalletClient | Signer;
|
|
20
20
|
service: AvailableDZapServices;
|
|
21
21
|
permitEIP2612DisabledTokens?: string[];
|
|
22
|
+
contractVersion: ContractVersion;
|
|
22
23
|
}) => Promise<{
|
|
23
24
|
status: TxnStatus;
|
|
24
25
|
code: StatusCodes;
|
|
25
26
|
permitData: HexString;
|
|
26
27
|
permitType: PermitMode;
|
|
27
28
|
}>;
|
|
28
|
-
static signPermit: ({ chainId, tokens, rpcUrls, sender, signer, service, signatureCallback, spender, permitType, permitEIP2612DisabledTokens, }: {
|
|
29
|
+
static signPermit: ({ chainId, tokens, rpcUrls, sender, signer, service, signatureCallback, spender, permitType, permitEIP2612DisabledTokens, contractVersion, }: {
|
|
29
30
|
chainId: number;
|
|
30
31
|
sender: HexString;
|
|
31
32
|
tokens: {
|
|
@@ -35,16 +36,17 @@ declare class PermitTxnHandler {
|
|
|
35
36
|
}[];
|
|
36
37
|
service: AvailableDZapServices;
|
|
37
38
|
rpcUrls?: string[];
|
|
38
|
-
signer: WalletClient |
|
|
39
|
+
signer: WalletClient | Signer;
|
|
39
40
|
signatureCallback?: ({ permitData, srcToken, amount, permitType, }: {
|
|
40
41
|
permitData: HexString;
|
|
41
42
|
srcToken: HexString;
|
|
42
|
-
amount:
|
|
43
|
+
amount: string;
|
|
43
44
|
permitType: PermitMode;
|
|
44
45
|
}) => Promise<void>;
|
|
45
46
|
spender: HexString;
|
|
46
47
|
permitType: PermitMode;
|
|
47
48
|
permitEIP2612DisabledTokens?: string[];
|
|
49
|
+
contractVersion: ContractVersion;
|
|
48
50
|
}) => Promise<{
|
|
49
51
|
status: TxnStatus;
|
|
50
52
|
tokens: {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { TradeBuildTxnRequest, TradeBuildTxnResponse, DZapTransactionResponse } from '../types';
|
|
2
1
|
import { Signer } from 'ethers';
|
|
3
2
|
import { WalletClient } from 'viem';
|
|
3
|
+
import { DZapTransactionResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
|
|
4
4
|
declare class TradeTxnHandler {
|
|
5
|
-
static
|
|
5
|
+
private static sendTransaction;
|
|
6
|
+
private static sendTxnWithBatch;
|
|
7
|
+
static buildAndSendTransaction: ({ request, signer, txnData, multicallAddress, batchTransaction, rpcUrls, }: {
|
|
6
8
|
request: TradeBuildTxnRequest;
|
|
7
9
|
signer: Signer | WalletClient;
|
|
8
10
|
txnData?: TradeBuildTxnResponse;
|
|
11
|
+
batchTransaction: boolean;
|
|
12
|
+
multicallAddress?: HexString;
|
|
13
|
+
rpcUrls?: string[];
|
|
9
14
|
}) => Promise<DZapTransactionResponse>;
|
|
10
15
|
}
|
|
11
16
|
export default TradeTxnHandler;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
-
import { DZapTransactionResponse, HexString } from 'src/types';
|
|
4
2
|
import { WalletClient } from 'viem';
|
|
3
|
+
import { StatusCodes, TxnStatus } from '../enums';
|
|
4
|
+
import { DZapTransactionResponse, HexString } from '../types';
|
|
5
|
+
import { ZapBuildTxnRequest } from '../types/zap';
|
|
5
6
|
import { ZapStep, ZapTxnDetails } from '../types/zap/step';
|
|
6
|
-
import { ZapBuildTxnRequest } from 'src/types/zap';
|
|
7
7
|
declare class ZapTxnHandler {
|
|
8
8
|
static execute: ({ chainId, txnData, signer, }: {
|
|
9
9
|
chainId: number;
|
package/dist/types/chains.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { exclusiveChainIds } from '
|
|
1
|
+
import { exclusiveChainIds } from '../constants/chains';
|
|
2
2
|
export type ExclusiveChainIds = (typeof exclusiveChainIds)[keyof typeof exclusiveChainIds];
|
package/dist/types/contract.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DZapAbis, OtherAbis, QuoteFilters, Services, STATUS_RESPONSE } from '
|
|
2
|
-
import {
|
|
1
|
+
import { DZapAbis, OtherAbis, QuoteFilters, Services, STATUS_RESPONSE } from '../constants';
|
|
2
|
+
import { ApprovalModes } from '../constants/approval';
|
|
3
|
+
import { PermitTypes } from '../constants/permit';
|
|
4
|
+
import { AppEnv, ContractVersion, StatusCodes, TxnStatus } from '../enums';
|
|
3
5
|
import { PsbtInput, PsbtOutput } from './btc';
|
|
4
|
-
import { PermitTypes } from 'src/constants/permit';
|
|
5
|
-
import { ApprovalModes } from 'src/constants/approval';
|
|
6
6
|
export type HexString = `0x${string}`;
|
|
7
7
|
export type ChainData = {
|
|
8
8
|
[key in number]: Chain;
|
|
@@ -58,7 +58,7 @@ export type Chain = {
|
|
|
58
58
|
swapBridgeContract: string;
|
|
59
59
|
logo: string;
|
|
60
60
|
tokenlistUrl?: string;
|
|
61
|
-
multicallAddress
|
|
61
|
+
multicallAddress?: HexString;
|
|
62
62
|
blockExplorerUrl: string;
|
|
63
63
|
nativeToken: NativeTokenInfo;
|
|
64
64
|
rpcProviders: ApiRpcResponse[];
|
|
@@ -85,6 +85,7 @@ export type Chain = {
|
|
|
85
85
|
isEnabled: boolean;
|
|
86
86
|
mainnet: boolean;
|
|
87
87
|
tags?: Tag[];
|
|
88
|
+
version?: ContractVersion;
|
|
88
89
|
permitDisabledTokens?: DisabledPermitTokens;
|
|
89
90
|
};
|
|
90
91
|
export type ApiRpcResponse = {
|
|
@@ -114,20 +115,19 @@ export type Fee = {
|
|
|
114
115
|
};
|
|
115
116
|
export type QuoteFilter = keyof typeof QuoteFilters;
|
|
116
117
|
export type TradeQuotesRequest = {
|
|
117
|
-
integratorId: string;
|
|
118
118
|
fromChain: number;
|
|
119
119
|
data: TradeQuotesRequestData[];
|
|
120
120
|
disableEstimation?: boolean;
|
|
121
121
|
account?: string;
|
|
122
|
-
|
|
122
|
+
allowedProtocols?: string[];
|
|
123
123
|
filter?: QuoteFilter;
|
|
124
124
|
};
|
|
125
125
|
export type TradeQuotesRequestData = {
|
|
126
126
|
amount: string;
|
|
127
127
|
srcToken: string;
|
|
128
|
-
srcDecimals
|
|
128
|
+
srcDecimals?: number;
|
|
129
129
|
destToken: string;
|
|
130
|
-
destDecimals
|
|
130
|
+
destDecimals?: number;
|
|
131
131
|
toChain: number;
|
|
132
132
|
slippage: number;
|
|
133
133
|
selectedSource?: string;
|
|
@@ -218,7 +218,6 @@ export type TokenResponse = {
|
|
|
218
218
|
export type TradeBuildTxnRequest = {
|
|
219
219
|
sender: HexString;
|
|
220
220
|
refundee: HexString;
|
|
221
|
-
integratorId: string;
|
|
222
221
|
fromChain: number;
|
|
223
222
|
disableEstimation?: boolean;
|
|
224
223
|
data: TradeBuildTxnRequestData[];
|
|
@@ -227,11 +226,11 @@ export type TradeBuildTxnRequest = {
|
|
|
227
226
|
export type TradeBuildTxnRequestData = {
|
|
228
227
|
amount: string;
|
|
229
228
|
srcToken: string;
|
|
230
|
-
srcDecimals
|
|
229
|
+
srcDecimals?: number;
|
|
231
230
|
destToken: string;
|
|
232
|
-
destDecimals
|
|
231
|
+
destDecimals?: number;
|
|
233
232
|
toChain: number;
|
|
234
|
-
|
|
233
|
+
protocol: string;
|
|
235
234
|
recipient: string;
|
|
236
235
|
slippage: number;
|
|
237
236
|
additionalInfo?: AdditionalInfo;
|
package/dist/types/zap/path.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HexString, ProviderDetails } from 'src/types';
|
|
2
1
|
import { ZapFee, ZapUnderlyingToken } from '.';
|
|
2
|
+
import { HexString, ProviderDetails } from '../..';
|
|
3
3
|
import { zapPathAction } from '../../zap/constants/path';
|
|
4
4
|
export type ZapPathAction = keyof typeof zapPathAction;
|
|
5
5
|
export type ZapPathAsset = {
|
package/dist/types/zap/pool.d.ts
CHANGED
package/dist/types/zap/step.d.ts
CHANGED
package/dist/utils/amount.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fee, TradeQuote } from '../types';
|
|
2
2
|
export declare const calculateAmountUSD: (amountInWei: string, decimals: number, price: string) => string;
|
|
3
3
|
export declare const calculateNetGasFeeUsd: (item: TradeQuote) => string;
|
|
4
4
|
export declare const calculateNetAmountUsd: (item: TradeQuote) => string;
|
|
@@ -74,9 +74,9 @@ export declare const updatePath: (data: TradeQuote, tokensPrice: Record<number,
|
|
|
74
74
|
srcAmountUSD: string;
|
|
75
75
|
destAmountUSD: string;
|
|
76
76
|
type: string;
|
|
77
|
-
exchange: import("
|
|
78
|
-
srcToken: import("
|
|
77
|
+
exchange: import("../types").ProviderDetails;
|
|
78
|
+
srcToken: import("../types").Token;
|
|
79
79
|
srcAmount: string;
|
|
80
|
-
destToken: import("
|
|
80
|
+
destToken: import("../types").Token;
|
|
81
81
|
destAmount: string;
|
|
82
82
|
}[];
|
package/dist/utils/axios.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type WalletClient } from 'viem';
|
|
2
|
+
import { HexString } from '../../types';
|
|
3
|
+
import { BatchCallParams } from './sendBatchCalls';
|
|
4
|
+
export declare function generateApprovalBatchCalls({ tokens, chainId, sender, spender, multicallAddress, rpcUrls, }: {
|
|
5
|
+
tokens: Array<{
|
|
6
|
+
address: HexString;
|
|
7
|
+
amount: string;
|
|
8
|
+
}>;
|
|
9
|
+
chainId: number;
|
|
10
|
+
sender: HexString;
|
|
11
|
+
spender: HexString;
|
|
12
|
+
multicallAddress?: HexString;
|
|
13
|
+
rpcUrls?: string[];
|
|
14
|
+
}): Promise<BatchCallParams[]>;
|
|
15
|
+
export declare function batchApproveTokens(walletClient: WalletClient, tokens: Array<{
|
|
16
|
+
address: HexString;
|
|
17
|
+
amount: string;
|
|
18
|
+
}>, chainId: number, spender: HexString, sender: HexString, multicallAddress?: HexString, rpcUrls?: string[]): Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
batchId?: string;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WalletClient } from 'viem';
|
|
2
|
+
import { HexString } from '../../types';
|
|
3
|
+
export type BatchCallParams = {
|
|
4
|
+
to: HexString;
|
|
5
|
+
data: HexString;
|
|
6
|
+
value?: bigint;
|
|
7
|
+
};
|
|
8
|
+
export declare function sendBatchCalls(walletClient: WalletClient, calls: BatchCallParams[]): Promise<{
|
|
9
|
+
id: string;
|
|
10
|
+
} | null>;
|
package/dist/utils/erc20.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
-
import { ApprovalMode, HexString } from 'src/types';
|
|
4
2
|
import { WalletClient } from 'viem';
|
|
3
|
+
import { StatusCodes, TxnStatus } from '../enums';
|
|
4
|
+
import { ApprovalMode, HexString } from '../types';
|
|
5
5
|
export declare const approveToken: ({ chainId, signer, rpcUrls, mode, tokens, approvalTxnCallback, spender, }: {
|
|
6
6
|
chainId: number;
|
|
7
7
|
signer: WalletClient | Signer;
|
|
8
8
|
mode: ApprovalMode;
|
|
9
9
|
tokens: {
|
|
10
10
|
address: HexString;
|
|
11
|
-
amount:
|
|
11
|
+
amount: string;
|
|
12
12
|
}[];
|
|
13
13
|
rpcUrls?: string[];
|
|
14
14
|
approvalTxnCallback?: ({ txnDetails, address, }: {
|
|
@@ -24,27 +24,29 @@ export declare const approveToken: ({ chainId, signer, rpcUrls, mode, tokens, ap
|
|
|
24
24
|
status: TxnStatus;
|
|
25
25
|
code: StatusCodes;
|
|
26
26
|
}>;
|
|
27
|
-
export declare const batchGetAllowances: ({ chainId, data, owner, rpcUrls, }: {
|
|
27
|
+
export declare const batchGetAllowances: ({ chainId, data, owner, multicallAddress, rpcUrls, }: {
|
|
28
28
|
chainId: number;
|
|
29
29
|
data: {
|
|
30
30
|
token: HexString;
|
|
31
31
|
spender: HexString;
|
|
32
32
|
}[];
|
|
33
33
|
owner: HexString;
|
|
34
|
+
multicallAddress?: HexString;
|
|
34
35
|
rpcUrls?: string[];
|
|
35
36
|
}) => Promise<{
|
|
36
37
|
status: TxnStatus;
|
|
37
38
|
code: StatusCodes;
|
|
38
39
|
data: Record<string, bigint>;
|
|
39
40
|
}>;
|
|
40
|
-
export declare const getAllowance: ({ chainId, sender, tokens, rpcUrls, mode, spender, permitEIP2612DisabledTokens, }: {
|
|
41
|
+
export declare const getAllowance: ({ chainId, sender, tokens, rpcUrls, multicallAddress, mode, spender, permitEIP2612DisabledTokens, }: {
|
|
41
42
|
chainId: number;
|
|
42
43
|
sender: HexString;
|
|
43
44
|
tokens: {
|
|
44
45
|
address: HexString;
|
|
45
|
-
amount:
|
|
46
|
+
amount: string;
|
|
46
47
|
}[];
|
|
47
48
|
spender: HexString;
|
|
49
|
+
multicallAddress?: HexString;
|
|
48
50
|
rpcUrls?: string[];
|
|
49
51
|
mode?: ApprovalMode;
|
|
50
52
|
permitEIP2612DisabledTokens?: string[];
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
|
-
import { StatusCodes, TxnStatus } from '
|
|
2
|
+
import { StatusCodes, TxnStatus } from '../enums';
|
|
3
3
|
export declare const BRIDGE_ERRORS: {
|
|
4
4
|
BridgeCallFailed: string;
|
|
5
5
|
};
|
|
@@ -14,3 +14,4 @@ export declare const handleViemTransactionError: ({ error }: {
|
|
|
14
14
|
errorMsg: any;
|
|
15
15
|
code: StatusCodes;
|
|
16
16
|
};
|
|
17
|
+
export declare const isAtomicReadyWalletRejectedUpgradeError: (e: any) => any;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
2
1
|
import { Abi, TransactionReceipt, WalletClient } from 'viem';
|
|
3
2
|
import { AvailableDZapServices, Chain, HexString, OtherAvailableAbis, SwapInfo } from '../types';
|
|
4
3
|
import { Signer } from 'ethers';
|
|
4
|
+
import { ContractVersion, StatusCodes, TxnStatus } from '../enums';
|
|
5
5
|
export declare const getPublicClient: ({ rpcUrls, chainId }: {
|
|
6
6
|
rpcUrls: string[] | undefined;
|
|
7
7
|
chainId: number;
|
|
@@ -3646,7 +3646,6 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
|
|
|
3646
3646
|
uid?: undefined;
|
|
3647
3647
|
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined>, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<import("viem").Chain, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined, import("viem").PublicRpcSchema, import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain>>) => client) => import("viem").Client<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain, undefined, import("viem").PublicRpcSchema, { [K in keyof client]: client[K]; } & import("viem").PublicActions<import("viem").FallbackTransport<import("viem").HttpTransport<undefined, false>[] | readonly [import("viem").HttpTransport<undefined, false>]>, import("viem").Chain>>;
|
|
3648
3648
|
};
|
|
3649
|
-
export declare const isNativeCurrency: (contract: string) => boolean;
|
|
3650
3649
|
export declare const getChecksumAddress: (address: string) => HexString;
|
|
3651
3650
|
export declare const formatToken: <T extends HexString | string>(token: T, nativeTokenAddress?: T) => T;
|
|
3652
3651
|
export declare function getTokensPairKey({ srcToken, destToken, srcChainId, destChainId, srcChainNativeAddress, destChainNativeAddress, }: {
|
|
@@ -3696,7 +3695,7 @@ export declare const getTrxId: (account: string) => `0x${string}`;
|
|
|
3696
3695
|
export declare const estimateGasMultiplier: bigint;
|
|
3697
3696
|
export declare const isTypeSigner: (variable: any) => variable is Signer;
|
|
3698
3697
|
export declare const isDZapNativeToken: (srcToken: string) => srcToken is "0x0000000000000000000000000000000000000000";
|
|
3699
|
-
export declare const getDZapAbi: (service: AvailableDZapServices) => Abi;
|
|
3698
|
+
export declare const getDZapAbi: (service: AvailableDZapServices, version: ContractVersion) => Abi;
|
|
3700
3699
|
export declare const handleDecodeTxnData: (data: TransactionReceipt, service: AvailableDZapServices, chain: Chain) => {
|
|
3701
3700
|
swapFailPairs: string[];
|
|
3702
3701
|
swapInfo: SwapInfo | SwapInfo[];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
2
1
|
import { MulticallParameters } from 'viem';
|
|
3
|
-
|
|
2
|
+
import { StatusCodes, TxnStatus } from '../enums';
|
|
3
|
+
import { HexString } from '../types';
|
|
4
|
+
export declare const multicall: ({ chainId, contracts, rpcUrls, multicallAddress, allowFailure, }: {
|
|
4
5
|
chainId: number;
|
|
5
6
|
contracts: MulticallParameters["contracts"];
|
|
6
7
|
rpcUrls?: string[];
|
|
8
|
+
multicallAddress?: HexString;
|
|
7
9
|
allowFailure?: boolean;
|
|
8
10
|
}) => Promise<{
|
|
9
11
|
status: TxnStatus;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
-
import { AvailableDZapServices, HexString } from 'src/types';
|
|
1
|
+
import { Signer } from 'ethers';
|
|
4
2
|
import { WalletClient } from 'viem';
|
|
3
|
+
import { ContractVersion, StatusCodes, TxnStatus } from '../../enums';
|
|
4
|
+
import { AvailableDZapServices, HexString } from '../../types';
|
|
5
5
|
export declare function getPermit2Address(chainId: number): HexString;
|
|
6
|
-
export declare function getPermit2Signature({ chainId, spender, service, account, token, signer, rpcUrls, amount, sigDeadline, expiration, }: {
|
|
6
|
+
export declare function getPermit2Signature({ chainId, spender, service, account, token, signer, rpcUrls, amount, sigDeadline, expiration, contractVersion, }: {
|
|
7
7
|
chainId: number;
|
|
8
8
|
account: HexString;
|
|
9
9
|
token: HexString;
|
|
@@ -12,8 +12,9 @@ export declare function getPermit2Signature({ chainId, spender, service, account
|
|
|
12
12
|
rpcUrls?: string[];
|
|
13
13
|
sigDeadline?: bigint;
|
|
14
14
|
amount?: bigint;
|
|
15
|
-
signer: WalletClient |
|
|
15
|
+
signer: WalletClient | Signer;
|
|
16
16
|
expiration?: bigint;
|
|
17
|
+
contractVersion: ContractVersion;
|
|
17
18
|
}): Promise<{
|
|
18
19
|
status: TxnStatus;
|
|
19
20
|
permitData: `0x${string}`;
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
-
import { HexString } from 'src/types';
|
|
1
|
+
import { Signer } from 'ethers';
|
|
4
2
|
import { WalletClient } from 'viem';
|
|
5
|
-
|
|
3
|
+
import { ContractVersion, StatusCodes, TxnStatus } from '../../enums';
|
|
4
|
+
import { AvailableDZapServices, HexString } from '../../types';
|
|
5
|
+
export declare const eip2612DisabledChains: number[];
|
|
6
|
+
export declare const checkEIP2612PermitSupport: ({ address, chainId, rpcUrls, permitEIP2612DisabledTokens, owner, }: {
|
|
6
7
|
address: HexString;
|
|
7
8
|
chainId: number;
|
|
8
9
|
rpcUrls?: string[];
|
|
9
10
|
permitEIP2612DisabledTokens?: string[];
|
|
11
|
+
owner: HexString;
|
|
10
12
|
}) => Promise<{
|
|
11
13
|
supportsPermit: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
data?: {
|
|
15
|
+
version: string;
|
|
16
|
+
name: string;
|
|
17
|
+
nonce: bigint;
|
|
18
|
+
};
|
|
14
19
|
}>;
|
|
15
|
-
export declare const getEIP2612PermitSignature: ({ chainId, spender, account, token, signer, version,
|
|
20
|
+
export declare const getEIP2612PermitSignature: ({ chainId, spender, account, token, signer, version, amount, sigDeadline, contractVersion, service, name, nonce, }: {
|
|
16
21
|
chainId: number;
|
|
17
22
|
account: HexString;
|
|
18
23
|
token: HexString;
|
|
19
24
|
spender: HexString;
|
|
20
25
|
version: string;
|
|
21
|
-
rpcUrls?: string[];
|
|
22
26
|
sigDeadline?: bigint;
|
|
23
27
|
amount?: bigint;
|
|
24
|
-
signer: WalletClient |
|
|
28
|
+
signer: WalletClient | Signer;
|
|
29
|
+
contractVersion: ContractVersion;
|
|
30
|
+
service: AvailableDZapServices;
|
|
31
|
+
name: string;
|
|
32
|
+
nonce: bigint;
|
|
25
33
|
}) => Promise<{
|
|
26
34
|
status: TxnStatus;
|
|
27
35
|
code: StatusCodes;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Signer, TypedDataField } from 'ethers';
|
|
2
2
|
import { TypedDataDomain, WalletClient } from 'viem';
|
|
3
|
-
import { HexString } from '
|
|
3
|
+
import { HexString } from '../types';
|
|
4
4
|
export declare const signTypedData: ({ signer, domain, message, types, account, primaryType, }: {
|
|
5
|
-
signer: WalletClient |
|
|
5
|
+
signer: WalletClient | Signer;
|
|
6
6
|
domain: TypedDataDomain;
|
|
7
7
|
types: Record<string, Array<TypedDataField>>;
|
|
8
8
|
message: Record<string, any>;
|
package/dist/utils/tokens.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PriceService } from '
|
|
2
|
-
import { ChainData, TokenInfo, TokenResponse } from '
|
|
1
|
+
import { PriceService } from '../service/price';
|
|
2
|
+
import { ChainData, TokenInfo, TokenResponse } from '../types';
|
|
3
3
|
export declare const isNativeCurrency: (address: string, chainConfig: ChainData) => boolean;
|
|
4
4
|
export declare const sortByBalanceInUsd: (tokenEntries: [string, TokenInfo][]) => TokenResponse;
|
|
5
5
|
export declare const updateTokenListPrices: (tokens: TokenResponse, chainId: number, chainConfig: ChainData, priceService: PriceService) => Promise<TokenResponse>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PriceService } from '../service/price';
|
|
2
|
+
import { ChainData, TradeQuotesRequest, TradeQuotesResponse } from '../types';
|
|
3
3
|
export declare const updateQuotes: (quotes: TradeQuotesResponse, request: TradeQuotesRequest, priceService: PriceService, chainConfig: ChainData) => Promise<TradeQuotesResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzapio/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|
|
@@ -107,9 +107,23 @@
|
|
|
107
107
|
"microbundle": {
|
|
108
108
|
"entry": "src/index.ts",
|
|
109
109
|
"output": "dist",
|
|
110
|
-
"format": "esm,cjs
|
|
110
|
+
"format": "esm,cjs",
|
|
111
111
|
"target": "node",
|
|
112
112
|
"sourcemap": false,
|
|
113
|
-
"generateTypes": true
|
|
113
|
+
"generateTypes": true,
|
|
114
|
+
"external": [
|
|
115
|
+
"ethers",
|
|
116
|
+
"viem",
|
|
117
|
+
"axios",
|
|
118
|
+
"decimal.js",
|
|
119
|
+
"node-cache"
|
|
120
|
+
],
|
|
121
|
+
"globals": {
|
|
122
|
+
"ethers": "ethers",
|
|
123
|
+
"viem": "viem",
|
|
124
|
+
"axios": "axios",
|
|
125
|
+
"decimal.js": "decimal.js",
|
|
126
|
+
"node-cache": "node-cache"
|
|
127
|
+
}
|
|
114
128
|
}
|
|
115
129
|
}
|