@dodoex/dodo-contract-request 1.5.0 → 1.6.0-alpha.2
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/.releaserc.json +8 -3
- package/CHANGELOG.md +15 -25
- package/contract-config/sepolia.json +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/contract/BuyoutModel.d.ts +42 -12
- package/dist/types/contract/CP.d.ts +214 -50
- package/dist/types/contract/CloneFactory.d.ts +1 -1
- package/dist/types/contract/CrowdPoolingFactory.d.ts +126 -34
- package/dist/types/contract/CustomERC20.d.ts +75 -20
- package/dist/types/contract/CustomMintableERC20.d.ts +77 -22
- package/dist/types/contract/D3Proxy.d.ts +33 -13
- package/dist/types/contract/D3Vault.d.ts +324 -123
- package/dist/types/contract/DODOApprove.d.ts +44 -14
- package/dist/types/contract/DODOApproveProxy.d.ts +51 -16
- package/dist/types/contract/DODOCalleeHelper.d.ts +10 -5
- package/dist/types/contract/DODOCirculationHelper.d.ts +47 -12
- package/dist/types/contract/DODOCpProxy.d.ts +20 -5
- package/dist/types/contract/DODOCpProxyWithoutGlobalQuota.d.ts +20 -5
- package/dist/types/contract/DODODppProxy.d.ts +20 -5
- package/dist/types/contract/DODODspProxy.d.ts +27 -7
- package/dist/types/contract/DODODspProxyWithoutGSP.d.ts +20 -5
- package/dist/types/contract/DODOIncentive.d.ts +75 -26
- package/dist/types/contract/DODOMineV2Factory.d.ts +50 -15
- package/dist/types/contract/DODOMineV3Proxy.d.ts +43 -13
- package/dist/types/contract/DODOMineV3ProxyWithoutPlatform.d.ts +43 -13
- package/dist/types/contract/DODOMineV3Registry.d.ts +43 -13
- package/dist/types/contract/DODONFT.d.ts +95 -25
- package/dist/types/contract/DODONFT1155.d.ts +56 -16
- package/dist/types/contract/DODONFTApprove.d.ts +47 -17
- package/dist/types/contract/DODONFTPoolProxy.d.ts +74 -24
- package/dist/types/contract/DODONFTProxy.d.ts +84 -24
- package/dist/types/contract/DODONFTRegistry.d.ts +49 -17
- package/dist/types/contract/DODONFTRouteHelper.d.ts +12 -2
- package/dist/types/contract/DODOSellHelper.d.ts +12 -2
- package/dist/types/contract/DODOStarterProxy.d.ts +13 -3
- package/dist/types/contract/DODOV1.d.ts +269 -77
- package/dist/types/contract/DODOV1Adapter.d.ts +8 -3
- package/dist/types/contract/DODOV1PmmHelper.d.ts +6 -1
- package/dist/types/contract/DODOV1Proxy.d.ts +13 -8
- package/dist/types/contract/DODOV2Proxy02.d.ts +97 -32
- package/dist/types/contract/DODOV2RouteHelper.d.ts +24 -4
- package/dist/types/contract/DPPAdvanced.d.ts +172 -69
- package/dist/types/contract/DPPAdvancedAdmin.d.ts +51 -16
- package/dist/types/contract/DPPFactory.d.ts +97 -30
- package/dist/types/contract/DSP.d.ts +221 -78
- package/dist/types/contract/DSPFactory.d.ts +73 -21
- package/dist/types/contract/DVM.d.ts +203 -71
- package/dist/types/contract/DVMFactory.d.ts +73 -21
- package/dist/types/contract/ERC20.d.ts +41 -11
- package/dist/types/contract/ERC20Helper.d.ts +24 -23
- package/dist/types/contract/ERC20MineV3.d.ts +91 -36
- package/dist/types/contract/ERC20V3Factory.d.ts +77 -26
- package/dist/types/contract/FeeRateDIP3Impl.d.ts +71 -30
- package/dist/types/contract/FeeRateModel.d.ts +28 -8
- package/dist/types/contract/GSP.d.ts +265 -95
- package/dist/types/contract/GSPFactory.d.ts +68 -21
- package/dist/types/contract/InitializableERC20.d.ts +46 -11
- package/dist/types/contract/LimitOrder.d.ts +71 -21
- package/dist/types/contract/LimitOrderBot.d.ts +45 -15
- package/dist/types/contract/MulticallWithValid.d.ts +43 -8
- package/dist/types/contract/PermissionManager.d.ts +33 -13
- package/dist/types/contract/UniswapV2Factory.d.ts +34 -9
- package/dist/types/contract/UniswapV2Pair.d.ts +126 -35
- package/dist/types/contract/UniswapV2Router02.d.ts +59 -24
- package/dist/types/contract/dodoTeam.d.ts +100 -33
- package/dist/types/contract/vDODOToken.d.ts +196 -58
- package/dist/types/contractRequests.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/scripts/contract-generate.ts +8 -1
- package/src/config/sepolia.ts +1 -1
- package/src/contract/BuyoutModel.ts +60 -0
- package/src/contract/CP.ts +340 -0
- package/src/contract/CrowdPoolingFactory.ts +190 -0
- package/src/contract/CustomERC20.ts +110 -0
- package/src/contract/CustomMintableERC20.ts +110 -0
- package/src/contract/D3Proxy.ts +40 -0
- package/src/contract/D3Vault.ts +480 -0
- package/src/contract/DODOApprove.ts +60 -0
- package/src/contract/DODOApproveProxy.ts +70 -0
- package/src/contract/DODOCalleeHelper.ts +10 -0
- package/src/contract/DODOCirculationHelper.ts +70 -0
- package/src/contract/DODOCpProxy.ts +30 -0
- package/src/contract/DODOCpProxyWithoutGlobalQuota.ts +30 -0
- package/src/contract/DODODppProxy.ts +30 -0
- package/src/contract/DODODspProxy.ts +40 -0
- package/src/contract/DODODspProxyWithoutGSP.ts +30 -0
- package/src/contract/DODOIncentive.ts +110 -0
- package/src/contract/DODOMineV2Factory.ts +70 -0
- package/src/contract/DODOMineV3Proxy.ts +60 -0
- package/src/contract/DODOMineV3ProxyWithoutPlatform.ts +60 -0
- package/src/contract/DODOMineV3Registry.ts +60 -0
- package/src/contract/DODONFT.ts +140 -0
- package/src/contract/DODONFT1155.ts +80 -0
- package/src/contract/DODONFTApprove.ts +60 -0
- package/src/contract/DODONFTPoolProxy.ts +100 -0
- package/src/contract/DODONFTProxy.ts +120 -0
- package/src/contract/DODONFTRegistry.ts +70 -0
- package/src/contract/DODONFTRouteHelper.ts +20 -0
- package/src/contract/DODOSellHelper.ts +20 -0
- package/src/contract/DODOStarterProxy.ts +20 -0
- package/src/contract/DODOV1.ts +390 -0
- package/src/contract/DODOV1Adapter.ts +10 -0
- package/src/contract/DODOV1PmmHelper.ts +10 -0
- package/src/contract/DODOV1Proxy.ts +10 -0
- package/src/contract/DODOV2Proxy02.ts +130 -0
- package/src/contract/DODOV2RouteHelper.ts +40 -0
- package/src/contract/DPPAdvanced.ts +270 -0
- package/src/contract/DPPAdvancedAdmin.ts +70 -0
- package/src/contract/DPPFactory.ts +140 -0
- package/src/contract/DSP.ts +350 -0
- package/src/contract/DSPFactory.ts +110 -0
- package/src/contract/DVM.ts +320 -0
- package/src/contract/DVMFactory.ts +110 -0
- package/src/contract/ERC20.ts +60 -0
- package/src/contract/ERC20Helper.ts +40 -0
- package/src/contract/ERC20MineV3.ts +130 -0
- package/src/contract/ERC20V3Factory.ts +110 -0
- package/src/contract/FeeRateDIP3Impl.ts +100 -0
- package/src/contract/FeeRateModel.ts +40 -0
- package/src/contract/GSP.ts +410 -0
- package/src/contract/GSPFactory.ts +100 -0
- package/src/contract/InitializableERC20.ts +70 -0
- package/src/contract/LimitOrder.ts +100 -0
- package/src/contract/LimitOrderBot.ts +60 -0
- package/src/contract/MulticallWithValid.ts +70 -0
- package/src/contract/PermissionManager.ts +40 -0
- package/src/contract/UniswapV2Factory.ts +51 -1
- package/src/contract/UniswapV2Pair.ts +190 -0
- package/src/contract/UniswapV2Router02.ts +71 -1
- package/src/contract/dodoTeam.ts +140 -0
- package/src/contract/vDODOToken.ts +300 -0
- package/src/index.ts +2 -1
|
@@ -15,6 +15,16 @@ export function fetchPermissionManager_NEW_OWNER_(chainId: number, __to: string)
|
|
|
15
15
|
const __data = hexlify(concat(['0x8456db15', __encodeData]));
|
|
16
16
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
17
17
|
}
|
|
18
|
+
export function getFetchPermissionManager_NEW_OWNER_QueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
19
|
+
return {
|
|
20
|
+
queryKey: ['contract-request', chainId, __to],
|
|
21
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
22
|
+
queryFn: () => {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
return fetchPermissionManager_NEW_OWNER_(chainId, __to);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* fetch _OWNER_
|
|
@@ -27,6 +37,16 @@ export function fetchPermissionManager_OWNER_(chainId: number, __to: string) {
|
|
|
27
37
|
const __data = hexlify(concat(['0x16048bc4', __encodeData]));
|
|
28
38
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
29
39
|
}
|
|
40
|
+
export function getFetchPermissionManager_OWNER_QueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
41
|
+
return {
|
|
42
|
+
queryKey: ['contract-request', chainId, __to],
|
|
43
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
44
|
+
queryFn: () => {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
return fetchPermissionManager_OWNER_(chainId, __to);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
30
50
|
|
|
31
51
|
/**
|
|
32
52
|
* fetch _WHITELIST_MODE_ON_
|
|
@@ -39,6 +59,16 @@ export function fetchPermissionManager_WHITELIST_MODE_ON_(chainId: number, __to:
|
|
|
39
59
|
const __data = hexlify(concat(['0x63e9cad6', __encodeData]));
|
|
40
60
|
return contractRequests.batchCall<boolean>(chainId, __to, __data, [{"internalType":"bool","name":"","type":"bool"}])
|
|
41
61
|
}
|
|
62
|
+
export function getFetchPermissionManager_WHITELIST_MODE_ON_QueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
63
|
+
return {
|
|
64
|
+
queryKey: ['contract-request', chainId, __to],
|
|
65
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
66
|
+
queryFn: () => {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
return fetchPermissionManager_WHITELIST_MODE_ON_(chainId, __to);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
42
72
|
|
|
43
73
|
/**
|
|
44
74
|
* fetch isAllowed
|
|
@@ -52,6 +82,16 @@ export function fetchPermissionManagerIsAllowed(chainId: number, __to: string, a
|
|
|
52
82
|
const __data = hexlify(concat(['0xbabcc539', __encodeData]));
|
|
53
83
|
return contractRequests.batchCall<boolean>(chainId, __to, __data, [{"internalType":"bool","name":"","type":"bool"}])
|
|
54
84
|
}
|
|
85
|
+
export function getFetchPermissionManagerIsAllowedQueryOptions(chainId: number | undefined, __to: string | undefined, account: string | undefined) {
|
|
86
|
+
return {
|
|
87
|
+
queryKey: ['contract-request', chainId, __to, account],
|
|
88
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null, account !== undefined && account !== null],
|
|
89
|
+
queryFn: () => {
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
return fetchPermissionManagerIsAllowed(chainId, __to, account);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
55
95
|
|
|
56
96
|
/**
|
|
57
97
|
* encode addToBlacklist
|
|
@@ -3,7 +3,7 @@ import { defaultAbiCoder, concat, hexlify } from '@dodoex/contract-request';
|
|
|
3
3
|
import { contractRequests } from '../contractRequests';
|
|
4
4
|
|
|
5
5
|
export function getUniswapV2FactoryContractAddressByChainId(chainId: number) {
|
|
6
|
-
const contractAddressObject = {"11155111":"
|
|
6
|
+
const contractAddressObject = {"11155111":"0xf553a3EA6ecc758ed6f05F62C831b1D71bA7e09c"};
|
|
7
7
|
const result = contractAddressObject[String(chainId) as keyof typeof contractAddressObject];
|
|
8
8
|
if (!result) throw new Error(`Not support ChainId: ${chainId}.`)
|
|
9
9
|
return result
|
|
@@ -22,6 +22,16 @@ export function fetchUniswapV2FactoryAllPairs(chainId: number, __input1: number)
|
|
|
22
22
|
const __data = hexlify(concat(['0x1e3dd18b', __encodeData]));
|
|
23
23
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
24
24
|
}
|
|
25
|
+
export function getFetchUniswapV2FactoryAllPairsQueryOptions(chainId: number | undefined, __input1: number | undefined) {
|
|
26
|
+
return {
|
|
27
|
+
queryKey: ['contract-request', chainId, __input1],
|
|
28
|
+
enabled: [chainId !== undefined && chainId !== null, __input1 !== undefined && __input1 !== null],
|
|
29
|
+
queryFn: () => {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
return fetchUniswapV2FactoryAllPairs(chainId, __input1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
|
|
26
36
|
/**
|
|
27
37
|
* fetch allPairsLength
|
|
@@ -35,6 +45,16 @@ export function fetchUniswapV2FactoryAllPairsLength(chainId: number) {
|
|
|
35
45
|
const __data = hexlify(concat(['0x574f2ba3', __encodeData]));
|
|
36
46
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
37
47
|
}
|
|
48
|
+
export function getFetchUniswapV2FactoryAllPairsLengthQueryOptions(chainId: number | undefined) {
|
|
49
|
+
return {
|
|
50
|
+
queryKey: ['contract-request', chainId],
|
|
51
|
+
enabled: [chainId !== undefined && chainId !== null],
|
|
52
|
+
queryFn: () => {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
return fetchUniswapV2FactoryAllPairsLength(chainId);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
38
58
|
|
|
39
59
|
/**
|
|
40
60
|
* fetch feeTo
|
|
@@ -48,6 +68,16 @@ export function fetchUniswapV2FactoryFeeTo(chainId: number) {
|
|
|
48
68
|
const __data = hexlify(concat(['0x017e7e58', __encodeData]));
|
|
49
69
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
50
70
|
}
|
|
71
|
+
export function getFetchUniswapV2FactoryFeeToQueryOptions(chainId: number | undefined) {
|
|
72
|
+
return {
|
|
73
|
+
queryKey: ['contract-request', chainId],
|
|
74
|
+
enabled: [chainId !== undefined && chainId !== null],
|
|
75
|
+
queryFn: () => {
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
return fetchUniswapV2FactoryFeeTo(chainId);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
51
81
|
|
|
52
82
|
/**
|
|
53
83
|
* fetch feeToSetter
|
|
@@ -61,6 +91,16 @@ export function fetchUniswapV2FactoryFeeToSetter(chainId: number) {
|
|
|
61
91
|
const __data = hexlify(concat(['0x094b7415', __encodeData]));
|
|
62
92
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
63
93
|
}
|
|
94
|
+
export function getFetchUniswapV2FactoryFeeToSetterQueryOptions(chainId: number | undefined) {
|
|
95
|
+
return {
|
|
96
|
+
queryKey: ['contract-request', chainId],
|
|
97
|
+
enabled: [chainId !== undefined && chainId !== null],
|
|
98
|
+
queryFn: () => {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
return fetchUniswapV2FactoryFeeToSetter(chainId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
64
104
|
|
|
65
105
|
/**
|
|
66
106
|
* fetch getPair
|
|
@@ -77,6 +117,16 @@ export function fetchUniswapV2FactoryGetPair(chainId: number, __input1: string,
|
|
|
77
117
|
const __data = hexlify(concat(['0x5eced480', __encodeData]));
|
|
78
118
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
79
119
|
}
|
|
120
|
+
export function getFetchUniswapV2FactoryGetPairQueryOptions(chainId: number | undefined, __input1: string | undefined, __input2: string | undefined, __input3: number | undefined) {
|
|
121
|
+
return {
|
|
122
|
+
queryKey: ['contract-request', chainId, __input1, __input2, __input3],
|
|
123
|
+
enabled: [chainId !== undefined && chainId !== null, __input1 !== undefined && __input1 !== null, __input2 !== undefined && __input2 !== null, __input3 !== undefined && __input3 !== null],
|
|
124
|
+
queryFn: () => {
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
return fetchUniswapV2FactoryGetPair(chainId, __input1, __input2, __input3);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
80
130
|
|
|
81
131
|
/**
|
|
82
132
|
* encode createPair
|
|
@@ -15,6 +15,16 @@ export function fetchUniswapV2PairDOMAIN_SEPARATOR(chainId: number, __to: string
|
|
|
15
15
|
const __data = hexlify(concat(['0x3644e515', __encodeData]));
|
|
16
16
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"bytes32","name":"","type":"bytes32"}])
|
|
17
17
|
}
|
|
18
|
+
export function getFetchUniswapV2PairDOMAIN_SEPARATORQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
19
|
+
return {
|
|
20
|
+
queryKey: ['contract-request', chainId, __to],
|
|
21
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
22
|
+
queryFn: () => {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
return fetchUniswapV2PairDOMAIN_SEPARATOR(chainId, __to);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* fetch MINIMUM_LIQUIDITY
|
|
@@ -27,6 +37,16 @@ export function fetchUniswapV2PairMINIMUM_LIQUIDITY(chainId: number, __to: strin
|
|
|
27
37
|
const __data = hexlify(concat(['0xba9a7a56', __encodeData]));
|
|
28
38
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
29
39
|
}
|
|
40
|
+
export function getFetchUniswapV2PairMINIMUM_LIQUIDITYQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
41
|
+
return {
|
|
42
|
+
queryKey: ['contract-request', chainId, __to],
|
|
43
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
44
|
+
queryFn: () => {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
return fetchUniswapV2PairMINIMUM_LIQUIDITY(chainId, __to);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
30
50
|
|
|
31
51
|
/**
|
|
32
52
|
* fetch PERMIT_TYPEHASH
|
|
@@ -39,6 +59,16 @@ export function fetchUniswapV2PairPERMIT_TYPEHASH(chainId: number, __to: string)
|
|
|
39
59
|
const __data = hexlify(concat(['0x30adf81f', __encodeData]));
|
|
40
60
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"bytes32","name":"","type":"bytes32"}])
|
|
41
61
|
}
|
|
62
|
+
export function getFetchUniswapV2PairPERMIT_TYPEHASHQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
63
|
+
return {
|
|
64
|
+
queryKey: ['contract-request', chainId, __to],
|
|
65
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
66
|
+
queryFn: () => {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
return fetchUniswapV2PairPERMIT_TYPEHASH(chainId, __to);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
42
72
|
|
|
43
73
|
/**
|
|
44
74
|
* fetch allowance
|
|
@@ -53,6 +83,16 @@ export function fetchUniswapV2PairAllowance(chainId: number, __to: string, __inp
|
|
|
53
83
|
const __data = hexlify(concat(['0xdd62ed3e', __encodeData]));
|
|
54
84
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
55
85
|
}
|
|
86
|
+
export function getFetchUniswapV2PairAllowanceQueryOptions(chainId: number | undefined, __to: string | undefined, __input1: string | undefined, __input2: string | undefined) {
|
|
87
|
+
return {
|
|
88
|
+
queryKey: ['contract-request', chainId, __to, __input1, __input2],
|
|
89
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null, __input1 !== undefined && __input1 !== null, __input2 !== undefined && __input2 !== null],
|
|
90
|
+
queryFn: () => {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
return fetchUniswapV2PairAllowance(chainId, __to, __input1, __input2);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
56
96
|
|
|
57
97
|
/**
|
|
58
98
|
* fetch balanceOf
|
|
@@ -66,6 +106,16 @@ export function fetchUniswapV2PairBalanceOf(chainId: number, __to: string, __inp
|
|
|
66
106
|
const __data = hexlify(concat(['0x70a08231', __encodeData]));
|
|
67
107
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
68
108
|
}
|
|
109
|
+
export function getFetchUniswapV2PairBalanceOfQueryOptions(chainId: number | undefined, __to: string | undefined, __input1: string | undefined) {
|
|
110
|
+
return {
|
|
111
|
+
queryKey: ['contract-request', chainId, __to, __input1],
|
|
112
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null, __input1 !== undefined && __input1 !== null],
|
|
113
|
+
queryFn: () => {
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
return fetchUniswapV2PairBalanceOf(chainId, __to, __input1);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
69
119
|
|
|
70
120
|
/**
|
|
71
121
|
* fetch decimals
|
|
@@ -78,6 +128,16 @@ export function fetchUniswapV2PairDecimals(chainId: number, __to: string) {
|
|
|
78
128
|
const __data = hexlify(concat(['0x313ce567', __encodeData]));
|
|
79
129
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint8","name":"","type":"uint8"}])
|
|
80
130
|
}
|
|
131
|
+
export function getFetchUniswapV2PairDecimalsQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
132
|
+
return {
|
|
133
|
+
queryKey: ['contract-request', chainId, __to],
|
|
134
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
135
|
+
queryFn: () => {
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
return fetchUniswapV2PairDecimals(chainId, __to);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
81
141
|
|
|
82
142
|
/**
|
|
83
143
|
* fetch factory
|
|
@@ -90,6 +150,16 @@ export function fetchUniswapV2PairFactory(chainId: number, __to: string) {
|
|
|
90
150
|
const __data = hexlify(concat(['0xc45a0155', __encodeData]));
|
|
91
151
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
92
152
|
}
|
|
153
|
+
export function getFetchUniswapV2PairFactoryQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
154
|
+
return {
|
|
155
|
+
queryKey: ['contract-request', chainId, __to],
|
|
156
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
157
|
+
queryFn: () => {
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
return fetchUniswapV2PairFactory(chainId, __to);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
93
163
|
|
|
94
164
|
/**
|
|
95
165
|
* fetch feeRate
|
|
@@ -102,6 +172,16 @@ export function fetchUniswapV2PairFeeRate(chainId: number, __to: string) {
|
|
|
102
172
|
const __data = hexlify(concat(['0x978bbdb9', __encodeData]));
|
|
103
173
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
104
174
|
}
|
|
175
|
+
export function getFetchUniswapV2PairFeeRateQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
176
|
+
return {
|
|
177
|
+
queryKey: ['contract-request', chainId, __to],
|
|
178
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
179
|
+
queryFn: () => {
|
|
180
|
+
// @ts-ignore
|
|
181
|
+
return fetchUniswapV2PairFeeRate(chainId, __to);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
105
185
|
|
|
106
186
|
/**
|
|
107
187
|
* fetch getReserves
|
|
@@ -120,6 +200,16 @@ export function fetchUniswapV2PairGetReserves(chainId: number, __to: string) {
|
|
|
120
200
|
_blockTimestampLast: bigint;
|
|
121
201
|
}>(chainId, __to, __data, [{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}])
|
|
122
202
|
}
|
|
203
|
+
export function getFetchUniswapV2PairGetReservesQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
204
|
+
return {
|
|
205
|
+
queryKey: ['contract-request', chainId, __to],
|
|
206
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
207
|
+
queryFn: () => {
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
return fetchUniswapV2PairGetReserves(chainId, __to);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
123
213
|
|
|
124
214
|
/**
|
|
125
215
|
* fetch kLast
|
|
@@ -132,6 +222,16 @@ export function fetchUniswapV2PairKLast(chainId: number, __to: string) {
|
|
|
132
222
|
const __data = hexlify(concat(['0x7464fc3d', __encodeData]));
|
|
133
223
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
134
224
|
}
|
|
225
|
+
export function getFetchUniswapV2PairKLastQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
226
|
+
return {
|
|
227
|
+
queryKey: ['contract-request', chainId, __to],
|
|
228
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
229
|
+
queryFn: () => {
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
return fetchUniswapV2PairKLast(chainId, __to);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
135
235
|
|
|
136
236
|
/**
|
|
137
237
|
* fetch lpMtRatio
|
|
@@ -144,6 +244,16 @@ export function fetchUniswapV2PairLpMtRatio(chainId: number, __to: string) {
|
|
|
144
244
|
const __data = hexlify(concat(['0x9670a8cb', __encodeData]));
|
|
145
245
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
146
246
|
}
|
|
247
|
+
export function getFetchUniswapV2PairLpMtRatioQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
248
|
+
return {
|
|
249
|
+
queryKey: ['contract-request', chainId, __to],
|
|
250
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
251
|
+
queryFn: () => {
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
return fetchUniswapV2PairLpMtRatio(chainId, __to);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
147
257
|
|
|
148
258
|
/**
|
|
149
259
|
* fetch name
|
|
@@ -156,6 +266,16 @@ export function fetchUniswapV2PairName(chainId: number, __to: string) {
|
|
|
156
266
|
const __data = hexlify(concat(['0x06fdde03', __encodeData]));
|
|
157
267
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"string","name":"","type":"string"}])
|
|
158
268
|
}
|
|
269
|
+
export function getFetchUniswapV2PairNameQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
270
|
+
return {
|
|
271
|
+
queryKey: ['contract-request', chainId, __to],
|
|
272
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
273
|
+
queryFn: () => {
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
return fetchUniswapV2PairName(chainId, __to);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
159
279
|
|
|
160
280
|
/**
|
|
161
281
|
* fetch nonces
|
|
@@ -169,6 +289,16 @@ export function fetchUniswapV2PairNonces(chainId: number, __to: string, __input1
|
|
|
169
289
|
const __data = hexlify(concat(['0x7ecebe00', __encodeData]));
|
|
170
290
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
171
291
|
}
|
|
292
|
+
export function getFetchUniswapV2PairNoncesQueryOptions(chainId: number | undefined, __to: string | undefined, __input1: string | undefined) {
|
|
293
|
+
return {
|
|
294
|
+
queryKey: ['contract-request', chainId, __to, __input1],
|
|
295
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null, __input1 !== undefined && __input1 !== null],
|
|
296
|
+
queryFn: () => {
|
|
297
|
+
// @ts-ignore
|
|
298
|
+
return fetchUniswapV2PairNonces(chainId, __to, __input1);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
172
302
|
|
|
173
303
|
/**
|
|
174
304
|
* fetch price0CumulativeLast
|
|
@@ -181,6 +311,16 @@ export function fetchUniswapV2PairPrice0CumulativeLast(chainId: number, __to: st
|
|
|
181
311
|
const __data = hexlify(concat(['0x5909c0d5', __encodeData]));
|
|
182
312
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
183
313
|
}
|
|
314
|
+
export function getFetchUniswapV2PairPrice0CumulativeLastQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
315
|
+
return {
|
|
316
|
+
queryKey: ['contract-request', chainId, __to],
|
|
317
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
318
|
+
queryFn: () => {
|
|
319
|
+
// @ts-ignore
|
|
320
|
+
return fetchUniswapV2PairPrice0CumulativeLast(chainId, __to);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
184
324
|
|
|
185
325
|
/**
|
|
186
326
|
* fetch price1CumulativeLast
|
|
@@ -193,6 +333,16 @@ export function fetchUniswapV2PairPrice1CumulativeLast(chainId: number, __to: st
|
|
|
193
333
|
const __data = hexlify(concat(['0x5a3d5493', __encodeData]));
|
|
194
334
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
195
335
|
}
|
|
336
|
+
export function getFetchUniswapV2PairPrice1CumulativeLastQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
337
|
+
return {
|
|
338
|
+
queryKey: ['contract-request', chainId, __to],
|
|
339
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
340
|
+
queryFn: () => {
|
|
341
|
+
// @ts-ignore
|
|
342
|
+
return fetchUniswapV2PairPrice1CumulativeLast(chainId, __to);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
196
346
|
|
|
197
347
|
/**
|
|
198
348
|
* fetch symbol
|
|
@@ -205,6 +355,16 @@ export function fetchUniswapV2PairSymbol(chainId: number, __to: string) {
|
|
|
205
355
|
const __data = hexlify(concat(['0x95d89b41', __encodeData]));
|
|
206
356
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"string","name":"","type":"string"}])
|
|
207
357
|
}
|
|
358
|
+
export function getFetchUniswapV2PairSymbolQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
359
|
+
return {
|
|
360
|
+
queryKey: ['contract-request', chainId, __to],
|
|
361
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
362
|
+
queryFn: () => {
|
|
363
|
+
// @ts-ignore
|
|
364
|
+
return fetchUniswapV2PairSymbol(chainId, __to);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
208
368
|
|
|
209
369
|
/**
|
|
210
370
|
* fetch token0
|
|
@@ -217,6 +377,16 @@ export function fetchUniswapV2PairToken0(chainId: number, __to: string) {
|
|
|
217
377
|
const __data = hexlify(concat(['0x0dfe1681', __encodeData]));
|
|
218
378
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
219
379
|
}
|
|
380
|
+
export function getFetchUniswapV2PairToken0QueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
381
|
+
return {
|
|
382
|
+
queryKey: ['contract-request', chainId, __to],
|
|
383
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
384
|
+
queryFn: () => {
|
|
385
|
+
// @ts-ignore
|
|
386
|
+
return fetchUniswapV2PairToken0(chainId, __to);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
220
390
|
|
|
221
391
|
/**
|
|
222
392
|
* fetch token1
|
|
@@ -229,6 +399,16 @@ export function fetchUniswapV2PairToken1(chainId: number, __to: string) {
|
|
|
229
399
|
const __data = hexlify(concat(['0xd21220a7', __encodeData]));
|
|
230
400
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
231
401
|
}
|
|
402
|
+
export function getFetchUniswapV2PairToken1QueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
403
|
+
return {
|
|
404
|
+
queryKey: ['contract-request', chainId, __to],
|
|
405
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
406
|
+
queryFn: () => {
|
|
407
|
+
// @ts-ignore
|
|
408
|
+
return fetchUniswapV2PairToken1(chainId, __to);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
232
412
|
|
|
233
413
|
/**
|
|
234
414
|
* fetch totalSupply
|
|
@@ -241,6 +421,16 @@ export function fetchUniswapV2PairTotalSupply(chainId: number, __to: string) {
|
|
|
241
421
|
const __data = hexlify(concat(['0x18160ddd', __encodeData]));
|
|
242
422
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"","type":"uint256"}])
|
|
243
423
|
}
|
|
424
|
+
export function getFetchUniswapV2PairTotalSupplyQueryOptions(chainId: number | undefined, __to: string | undefined) {
|
|
425
|
+
return {
|
|
426
|
+
queryKey: ['contract-request', chainId, __to],
|
|
427
|
+
enabled: [chainId !== undefined && chainId !== null, __to !== undefined && __to !== null],
|
|
428
|
+
queryFn: () => {
|
|
429
|
+
// @ts-ignore
|
|
430
|
+
return fetchUniswapV2PairTotalSupply(chainId, __to);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
244
434
|
|
|
245
435
|
/**
|
|
246
436
|
* encode approve
|
|
@@ -3,7 +3,7 @@ import { defaultAbiCoder, concat, hexlify } from '@dodoex/contract-request';
|
|
|
3
3
|
import { contractRequests } from '../contractRequests';
|
|
4
4
|
|
|
5
5
|
export function getUniswapV2Router02ContractAddressByChainId(chainId: number) {
|
|
6
|
-
const contractAddressObject = {"11155111":"
|
|
6
|
+
const contractAddressObject = {"11155111":"0x78F661c4a883064018c6FA2F2815c0c8b1d35327"};
|
|
7
7
|
const result = contractAddressObject[String(chainId) as keyof typeof contractAddressObject];
|
|
8
8
|
if (!result) throw new Error(`Not support ChainId: ${chainId}.`)
|
|
9
9
|
return result
|
|
@@ -21,6 +21,16 @@ export function fetchUniswapV2Router02WETH(chainId: number) {
|
|
|
21
21
|
const __data = hexlify(concat(['0xad5c4648', __encodeData]));
|
|
22
22
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
23
23
|
}
|
|
24
|
+
export function getFetchUniswapV2Router02WETHQueryOptions(chainId: number | undefined) {
|
|
25
|
+
return {
|
|
26
|
+
queryKey: ['contract-request', chainId],
|
|
27
|
+
enabled: [chainId !== undefined && chainId !== null],
|
|
28
|
+
queryFn: () => {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
return fetchUniswapV2Router02WETH(chainId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
24
34
|
|
|
25
35
|
/**
|
|
26
36
|
* fetch factory
|
|
@@ -34,6 +44,16 @@ export function fetchUniswapV2Router02Factory(chainId: number) {
|
|
|
34
44
|
const __data = hexlify(concat(['0xc45a0155', __encodeData]));
|
|
35
45
|
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
36
46
|
}
|
|
47
|
+
export function getFetchUniswapV2Router02FactoryQueryOptions(chainId: number | undefined) {
|
|
48
|
+
return {
|
|
49
|
+
queryKey: ['contract-request', chainId],
|
|
50
|
+
enabled: [chainId !== undefined && chainId !== null],
|
|
51
|
+
queryFn: () => {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
return fetchUniswapV2Router02Factory(chainId);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
37
57
|
|
|
38
58
|
/**
|
|
39
59
|
* fetch getAmountIn
|
|
@@ -51,6 +71,16 @@ export function fetchUniswapV2Router02GetAmountIn(chainId: number, amountOut: nu
|
|
|
51
71
|
const __data = hexlify(concat(['0x571fd012', __encodeData]));
|
|
52
72
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountIn","type":"uint256"}])
|
|
53
73
|
}
|
|
74
|
+
export function getFetchUniswapV2Router02GetAmountInQueryOptions(chainId: number | undefined, amountOut: number | undefined, reserveIn: number | undefined, reserveOut: number | undefined, fee: number | undefined) {
|
|
75
|
+
return {
|
|
76
|
+
queryKey: ['contract-request', chainId, amountOut, reserveIn, reserveOut, fee],
|
|
77
|
+
enabled: [chainId !== undefined && chainId !== null, amountOut !== undefined && amountOut !== null, reserveIn !== undefined && reserveIn !== null, reserveOut !== undefined && reserveOut !== null, fee !== undefined && fee !== null],
|
|
78
|
+
queryFn: () => {
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
return fetchUniswapV2Router02GetAmountIn(chainId, amountOut, reserveIn, reserveOut, fee);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
54
84
|
|
|
55
85
|
/**
|
|
56
86
|
* fetch getAmountOut
|
|
@@ -68,6 +98,16 @@ export function fetchUniswapV2Router02GetAmountOut(chainId: number, amountIn: nu
|
|
|
68
98
|
const __data = hexlify(concat(['0x52707d8c', __encodeData]));
|
|
69
99
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountOut","type":"uint256"}])
|
|
70
100
|
}
|
|
101
|
+
export function getFetchUniswapV2Router02GetAmountOutQueryOptions(chainId: number | undefined, amountIn: number | undefined, reserveIn: number | undefined, reserveOut: number | undefined, fee: number | undefined) {
|
|
102
|
+
return {
|
|
103
|
+
queryKey: ['contract-request', chainId, amountIn, reserveIn, reserveOut, fee],
|
|
104
|
+
enabled: [chainId !== undefined && chainId !== null, amountIn !== undefined && amountIn !== null, reserveIn !== undefined && reserveIn !== null, reserveOut !== undefined && reserveOut !== null, fee !== undefined && fee !== null],
|
|
105
|
+
queryFn: () => {
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
return fetchUniswapV2Router02GetAmountOut(chainId, amountIn, reserveIn, reserveOut, fee);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
71
111
|
|
|
72
112
|
/**
|
|
73
113
|
* fetch getAmountsIn
|
|
@@ -84,6 +124,16 @@ export function fetchUniswapV2Router02GetAmountsIn(chainId: number, amountOut: n
|
|
|
84
124
|
const __data = hexlify(concat(['0x56191a59', __encodeData]));
|
|
85
125
|
return contractRequests.batchCall<Array<bigint>>(chainId, __to, __data, [{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}])
|
|
86
126
|
}
|
|
127
|
+
export function getFetchUniswapV2Router02GetAmountsInQueryOptions(chainId: number | undefined, amountOut: number | undefined, path: Array<string> | undefined, fees: Array<number> | undefined) {
|
|
128
|
+
return {
|
|
129
|
+
queryKey: ['contract-request', chainId, amountOut, path, fees],
|
|
130
|
+
enabled: [chainId !== undefined && chainId !== null, amountOut !== undefined && amountOut !== null, path !== undefined && path !== null, fees !== undefined && fees !== null],
|
|
131
|
+
queryFn: () => {
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
return fetchUniswapV2Router02GetAmountsIn(chainId, amountOut, path, fees);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
87
137
|
|
|
88
138
|
/**
|
|
89
139
|
* fetch getAmountsOut
|
|
@@ -100,6 +150,16 @@ export function fetchUniswapV2Router02GetAmountsOut(chainId: number, amountIn: n
|
|
|
100
150
|
const __data = hexlify(concat(['0xb677fd5c', __encodeData]));
|
|
101
151
|
return contractRequests.batchCall<Array<bigint>>(chainId, __to, __data, [{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}])
|
|
102
152
|
}
|
|
153
|
+
export function getFetchUniswapV2Router02GetAmountsOutQueryOptions(chainId: number | undefined, amountIn: number | undefined, path: Array<string> | undefined, fees: Array<number> | undefined) {
|
|
154
|
+
return {
|
|
155
|
+
queryKey: ['contract-request', chainId, amountIn, path, fees],
|
|
156
|
+
enabled: [chainId !== undefined && chainId !== null, amountIn !== undefined && amountIn !== null, path !== undefined && path !== null, fees !== undefined && fees !== null],
|
|
157
|
+
queryFn: () => {
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
return fetchUniswapV2Router02GetAmountsOut(chainId, amountIn, path, fees);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
103
163
|
|
|
104
164
|
/**
|
|
105
165
|
* fetch quote
|
|
@@ -116,6 +176,16 @@ export function fetchUniswapV2Router02Quote(chainId: number, amountA: number, re
|
|
|
116
176
|
const __data = hexlify(concat(['0xad615dec', __encodeData]));
|
|
117
177
|
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountB","type":"uint256"}])
|
|
118
178
|
}
|
|
179
|
+
export function getFetchUniswapV2Router02QuoteQueryOptions(chainId: number | undefined, amountA: number | undefined, reserveA: number | undefined, reserveB: number | undefined) {
|
|
180
|
+
return {
|
|
181
|
+
queryKey: ['contract-request', chainId, amountA, reserveA, reserveB],
|
|
182
|
+
enabled: [chainId !== undefined && chainId !== null, amountA !== undefined && amountA !== null, reserveA !== undefined && reserveA !== null, reserveB !== undefined && reserveB !== null],
|
|
183
|
+
queryFn: () => {
|
|
184
|
+
// @ts-ignore
|
|
185
|
+
return fetchUniswapV2Router02Quote(chainId, amountA, reserveA, reserveB);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
119
189
|
|
|
120
190
|
/**
|
|
121
191
|
* encode addLiquidity
|