@dzapio/sdk 1.0.1
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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +355 -0
- package/dist/api/index.d.ts +19 -0
- package/dist/artifacts/ERC20Permit.d.ts +336 -0
- package/dist/artifacts/Permit2.d.ts +700 -0
- package/dist/artifacts/default/DZapCoreAbi.d.ts +2 -0
- package/dist/artifacts/default/DZapDcaAbi.d.ts +2 -0
- package/dist/artifacts/default/Permit2Abi.d.ts +70 -0
- package/dist/artifacts/default/erc20Abi.d.ts +165 -0
- package/dist/artifacts/default/index.d.ts +5 -0
- package/dist/artifacts/index.d.ts +2 -0
- package/dist/artifacts/staging/DZapCoreSwapAbi.d.ts +2 -0
- package/dist/artifacts/staging/index.d.ts +2 -0
- package/dist/axios/baseClient.d.ts +2 -0
- package/dist/axios/index.d.ts +8 -0
- package/dist/config.d.ts +16 -0
- package/dist/constants/address.d.ts +13 -0
- package/dist/constants/approval.d.ts +5 -0
- package/dist/constants/axios.d.ts +2 -0
- package/dist/constants/chains.d.ts +16 -0
- package/dist/constants/contract.d.ts +6 -0
- package/dist/constants/erc20.d.ts +22 -0
- package/dist/constants/httpMethods.d.ts +2 -0
- package/dist/constants/index.d.ts +43 -0
- package/dist/constants/permit.d.ts +5 -0
- package/dist/constants/permit2.d.ts +2 -0
- package/dist/constants/rpc.d.ts +2 -0
- package/dist/constants/urlConstants.d.ts +13 -0
- package/dist/dZapClient/index.d.ts +383 -0
- package/dist/enums/index.d.ts +36 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.m.js +2 -0
- package/dist/index.m.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/service/cache/cacheProvider.d.ts +10 -0
- package/dist/service/cache/constant.d.ts +2 -0
- package/dist/service/price/index.d.ts +16 -0
- package/dist/service/price/provider/coingecko/config.d.ts +6 -0
- package/dist/service/price/provider/coingecko/index.d.ts +9 -0
- package/dist/service/price/provider/defiLlama/config.d.ts +3 -0
- package/dist/service/price/provider/defiLlama/index.d.ts +9 -0
- package/dist/service/price/provider/defiLlama/types.d.ts +11 -0
- package/dist/service/price/provider/dzap/index.d.ts +6 -0
- package/dist/service/price/types/IPriceProvider.d.ts +14 -0
- package/dist/transactionHandlers/generic.d.ts +24 -0
- package/dist/transactionHandlers/permit.d.ts +58 -0
- package/dist/transactionHandlers/trade.d.ts +11 -0
- package/dist/transactionHandlers/zap.d.ts +37 -0
- package/dist/types/axiosClient.d.ts +6 -0
- package/dist/types/btc.d.ts +45 -0
- package/dist/types/chains.d.ts +2 -0
- package/dist/types/contract.d.ts +14 -0
- package/dist/types/eip-2612.d.ts +6 -0
- package/dist/types/index.d.ts +317 -0
- package/dist/types/zap/index.d.ts +65 -0
- package/dist/types/zap/path.d.ts +36 -0
- package/dist/types/zap/step.d.ts +15 -0
- package/dist/utils/amount.d.ts +82 -0
- package/dist/utils/axios.d.ts +13 -0
- package/dist/utils/chains.d.ts +2 -0
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/erc20.d.ts +61 -0
- package/dist/utils/errors.d.ts +16 -0
- package/dist/utils/index.d.ts +3940 -0
- package/dist/utils/multicall.d.ts +12 -0
- package/dist/utils/permit/permit2Methods.d.ts +32 -0
- package/dist/utils/permit/permitMethods.d.ts +29 -0
- package/dist/utils/signTypedData.d.ts +11 -0
- package/dist/utils/tokens.d.ts +7 -0
- package/dist/utils/updateQuotes.d.ts +3 -0
- package/dist/zap/constants/index.d.ts +2 -0
- package/dist/zap/constants/path.d.ts +8 -0
- package/dist/zap/constants/step.d.ts +3 -0
- package/dist/zap/constants/urls.d.ts +3 -0
- package/package.json +115 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
+
import { ApprovalMode, HexString } from 'src/types';
|
|
4
|
+
import { WalletClient } from 'viem';
|
|
5
|
+
export declare const approveToken: ({ chainId, signer, rpcUrls, mode, tokens, approvalTxnCallback, spender, }: {
|
|
6
|
+
chainId: number;
|
|
7
|
+
signer: WalletClient | Signer;
|
|
8
|
+
mode: ApprovalMode;
|
|
9
|
+
tokens: {
|
|
10
|
+
address: HexString;
|
|
11
|
+
amount: bigint;
|
|
12
|
+
}[];
|
|
13
|
+
rpcUrls?: string[];
|
|
14
|
+
approvalTxnCallback?: ({ txnDetails, address, }: {
|
|
15
|
+
txnDetails: {
|
|
16
|
+
txnHash: string;
|
|
17
|
+
code: StatusCodes;
|
|
18
|
+
status: TxnStatus;
|
|
19
|
+
};
|
|
20
|
+
address: HexString;
|
|
21
|
+
}) => Promise<TxnStatus | void>;
|
|
22
|
+
spender: HexString;
|
|
23
|
+
}) => Promise<{
|
|
24
|
+
status: TxnStatus;
|
|
25
|
+
code: StatusCodes;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const batchGetAllowances: ({ chainId, data, owner, rpcUrls, }: {
|
|
28
|
+
chainId: number;
|
|
29
|
+
data: {
|
|
30
|
+
token: HexString;
|
|
31
|
+
spender: HexString;
|
|
32
|
+
}[];
|
|
33
|
+
owner: HexString;
|
|
34
|
+
rpcUrls?: string[];
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
status: TxnStatus;
|
|
37
|
+
code: StatusCodes;
|
|
38
|
+
data: Record<string, bigint>;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const getAllowance: ({ chainId, sender, tokens, rpcUrls, mode, spender, permitEIP2612DisabledTokens, }: {
|
|
41
|
+
chainId: number;
|
|
42
|
+
sender: HexString;
|
|
43
|
+
tokens: {
|
|
44
|
+
address: HexString;
|
|
45
|
+
amount: bigint;
|
|
46
|
+
}[];
|
|
47
|
+
spender: HexString;
|
|
48
|
+
rpcUrls?: string[];
|
|
49
|
+
mode?: ApprovalMode;
|
|
50
|
+
permitEIP2612DisabledTokens?: string[];
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
status: TxnStatus;
|
|
53
|
+
code: StatusCodes;
|
|
54
|
+
data: {
|
|
55
|
+
[key: string]: {
|
|
56
|
+
allowance: bigint;
|
|
57
|
+
approvalNeeded: boolean;
|
|
58
|
+
signatureNeeded: boolean;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import { StatusCodes, TxnStatus } from 'src/enums';
|
|
3
|
+
export declare const BRIDGE_ERRORS: {
|
|
4
|
+
BridgeCallFailed: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function getErrorName(errorString: string): string | null;
|
|
7
|
+
export declare const getRevertMsg: (res: string) => string;
|
|
8
|
+
export declare const isAxiosError: (error: unknown) => error is AxiosError;
|
|
9
|
+
export declare const handleViemTransactionError: ({ error }: {
|
|
10
|
+
error: any;
|
|
11
|
+
}) => {
|
|
12
|
+
status: TxnStatus;
|
|
13
|
+
error: any;
|
|
14
|
+
errorMsg: any;
|
|
15
|
+
code: StatusCodes;
|
|
16
|
+
};
|