@velora-dex/widget 0.0.12 → 0.0.14
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/components/ui/drawer.d.ts +1 -1
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js +25 -19
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/vaul/browser.d.ts +8 -0
- package/dist/components/ui/vaul/browser.d.ts.map +1 -0
- package/dist/components/ui/vaul/browser.js +37 -0
- package/dist/components/ui/vaul/browser.js.map +1 -0
- package/dist/components/ui/vaul/constants.d.ts +12 -0
- package/dist/components/ui/vaul/constants.d.ts.map +1 -0
- package/dist/components/ui/vaul/constants.js +24 -0
- package/dist/components/ui/vaul/constants.js.map +1 -0
- package/dist/components/ui/vaul/context.d.ts +38 -0
- package/dist/components/ui/vaul/context.d.ts.map +1 -0
- package/dist/components/ui/vaul/context.js +72 -0
- package/dist/components/ui/vaul/context.js.map +1 -0
- package/dist/components/ui/vaul/helpers.d.ts +17 -0
- package/dist/components/ui/vaul/helpers.d.ts.map +1 -0
- package/dist/components/ui/vaul/helpers.js +87 -0
- package/dist/components/ui/vaul/helpers.js.map +1 -0
- package/dist/components/ui/vaul/index.d.ts +140 -0
- package/dist/components/ui/vaul/index.d.ts.map +1 -0
- package/dist/components/ui/vaul/index.js +807 -0
- package/dist/components/ui/vaul/index.js.map +1 -0
- package/dist/components/ui/vaul/types.d.ts +7 -0
- package/dist/components/ui/vaul/types.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-composed-refs.d.ts +14 -0
- package/dist/components/ui/vaul/use-composed-refs.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-composed-refs.js +28 -0
- package/dist/components/ui/vaul/use-composed-refs.js.map +1 -0
- package/dist/components/ui/vaul/use-controllable-state.d.ts +9 -0
- package/dist/components/ui/vaul/use-controllable-state.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-controllable-state.js +134 -0
- package/dist/components/ui/vaul/use-controllable-state.js.map +1 -0
- package/dist/components/ui/vaul/use-position-fixed.d.ts +19 -0
- package/dist/components/ui/vaul/use-position-fixed.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-position-fixed.js +109 -0
- package/dist/components/ui/vaul/use-position-fixed.js.map +1 -0
- package/dist/components/ui/vaul/use-prevent-scroll.d.ts +18 -0
- package/dist/components/ui/vaul/use-prevent-scroll.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-prevent-scroll.js +182 -0
- package/dist/components/ui/vaul/use-prevent-scroll.js.map +1 -0
- package/dist/components/ui/vaul/use-scale-background.d.ts +2 -0
- package/dist/components/ui/vaul/use-scale-background.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-scale-background.js +68 -0
- package/dist/components/ui/vaul/use-scale-background.js.map +1 -0
- package/dist/components/ui/vaul/use-snap-points.d.ts +32 -0
- package/dist/components/ui/vaul/use-snap-points.d.ts.map +1 -0
- package/dist/components/ui/vaul/use-snap-points.js +222 -0
- package/dist/components/ui/vaul/use-snap-points.js.map +1 -0
- package/dist/components/web3/AccountButton.d.ts.map +1 -1
- package/dist/components/web3/AccountButton.js +26 -30
- package/dist/components/web3/AccountButton.js.map +1 -1
- package/dist/components/web3/ConnectWallets/index.d.ts.map +1 -1
- package/dist/components/web3/ConnectWallets/index.js +12 -64
- package/dist/components/web3/ConnectWallets/index.js.map +1 -1
- package/dist/components/widget/AppHeader/ActivityButton.d.ts +2 -0
- package/dist/components/widget/AppHeader/ActivityButton.d.ts.map +1 -0
- package/dist/components/widget/AppHeader/ActivityButton.js +46 -0
- package/dist/components/widget/AppHeader/ActivityButton.js.map +1 -0
- package/dist/components/widget/AppHeader/AppHeader.d.ts.map +1 -1
- package/dist/components/widget/AppHeader/AppHeader.js +35 -29
- package/dist/components/widget/AppHeader/AppHeader.js.map +1 -1
- package/dist/components/widget/Drawer/index.d.ts +1 -1
- package/dist/components/widget/Drawer/index.d.ts.map +1 -1
- package/dist/components/widget/Drawer/index.js +37 -30
- package/dist/components/widget/Drawer/index.js.map +1 -1
- package/dist/components/widget/Informative/Informative.d.ts +7 -0
- package/dist/components/widget/Informative/Informative.d.ts.map +1 -0
- package/dist/components/widget/Informative/Informative.js +33 -0
- package/dist/components/widget/Informative/Informative.js.map +1 -0
- package/dist/components/widget/PoweredBy/PoweredBy.d.ts +2 -0
- package/dist/components/widget/PoweredBy/PoweredBy.d.ts.map +1 -0
- package/dist/components/widget/PoweredBy/PoweredBy.js +31 -0
- package/dist/components/widget/PoweredBy/PoweredBy.js.map +1 -0
- package/dist/components/widget/PoweredBy/assets/velora.svg.js +12 -0
- package/dist/components/widget/PoweredBy/assets/velora.svg.js.map +1 -0
- package/dist/components/widget/ReceiverAddress/ReceiverAddress.js +35 -39
- package/dist/components/widget/ReceiverAddress/ReceiverAddress.js.map +1 -1
- package/dist/components/widget/ReceiverAddress/state/receiverAddressAtom.js +1 -1
- package/dist/components/widget/SelectToken/SelectTokenButton.js +55 -65
- package/dist/components/widget/SelectToken/SelectTokenButton.js.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/state/swapModeActionsAtom.d.ts.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/state/swapModeActionsAtom.js +1 -0
- package/dist/components/widget/SwapModeSwitcher/state/swapModeActionsAtom.js.map +1 -1
- package/dist/components/widget/TokenInput/index.d.ts.map +1 -1
- package/dist/components/widget/TokenInput/index.js +133 -103
- package/dist/components/widget/TokenInput/index.js.map +1 -1
- package/dist/components/widget/TokenInput/types.d.ts +4 -2
- package/dist/components/widget/TokenInput/types.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/Stepper.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/Stepper.js +38 -3
- package/dist/components/widget/TradeOverview/Stepper.js.map +1 -1
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.d.ts +2 -1
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.d.ts.map +1 -1
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.js +30 -29
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.js.map +1 -1
- package/dist/hooks/gas/config.d.ts +6 -0
- package/dist/hooks/gas/config.d.ts.map +1 -0
- package/dist/hooks/gas/config.js +53 -0
- package/dist/hooks/gas/config.js.map +1 -0
- package/dist/hooks/gas/types.d.ts +43 -0
- package/dist/hooks/gas/types.d.ts.map +1 -0
- package/dist/hooks/gas/useGasPrices.d.ts +7 -0
- package/dist/hooks/gas/useGasPrices.d.ts.map +1 -0
- package/dist/hooks/gas/useGasPrices.js +118 -0
- package/dist/hooks/gas/useGasPrices.js.map +1 -0
- package/dist/hooks/gas/utils.d.ts +8 -0
- package/dist/hooks/gas/utils.d.ts.map +1 -0
- package/dist/hooks/gas/utils.js +21 -0
- package/dist/hooks/gas/utils.js.map +1 -0
- package/dist/hooks/getCode/useIsAccountContract.d.ts +2 -0
- package/dist/hooks/getCode/useIsAccountContract.d.ts.map +1 -0
- package/dist/hooks/getCode/useIsAccountContract.js +34 -0
- package/dist/hooks/getCode/useIsAccountContract.js.map +1 -0
- package/dist/hooks/permit/hooks/useGetPermitInfo.d.ts +27 -0
- package/dist/hooks/permit/hooks/useGetPermitInfo.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useGetPermitInfo.js +98 -0
- package/dist/hooks/permit/hooks/useGetPermitInfo.js.map +1 -0
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.d.ts +31 -0
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.js +129 -0
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.js.map +1 -0
- package/dist/hooks/permit/hooks/usePermit1Nonce.d.ts +38 -0
- package/dist/hooks/permit/hooks/usePermit1Nonce.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/usePermit1Nonce.js +153 -0
- package/dist/hooks/permit/hooks/usePermit1Nonce.js.map +1 -0
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.d.ts +18 -0
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.js +109 -0
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.js.map +1 -0
- package/dist/hooks/permit/hooks/useSignPermit.d.ts +13 -0
- package/dist/hooks/permit/hooks/useSignPermit.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useSignPermit.js +103 -0
- package/dist/hooks/permit/hooks/useSignPermit.js.map +1 -0
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.d.ts +50 -0
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.js +338 -0
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.js.map +1 -0
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.d.ts +10 -0
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.js +69 -0
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.js.map +1 -0
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.d.ts +10 -0
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.js +63 -0
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.js.map +1 -0
- package/dist/hooks/permit/hooks/useTryToSignPermit1.d.ts +16 -0
- package/dist/hooks/permit/hooks/useTryToSignPermit1.d.ts.map +1 -0
- package/dist/hooks/permit/hooks/useTryToSignPermit1.js +94 -0
- package/dist/hooks/permit/hooks/useTryToSignPermit1.js.map +1 -0
- package/dist/hooks/permit/utils/abi.d.ts +219 -0
- package/dist/hooks/permit/utils/abi.d.ts.map +1 -0
- package/dist/hooks/permit/utils/abi.js +204 -0
- package/dist/hooks/permit/utils/abi.js.map +1 -0
- package/dist/hooks/permit/utils/constants.d.ts +224 -0
- package/dist/hooks/permit/utils/constants.d.ts.map +1 -0
- package/dist/hooks/permit/utils/constants.js +229 -0
- package/dist/hooks/permit/utils/constants.js.map +1 -0
- package/dist/hooks/permit/utils/construct.d.ts +161 -0
- package/dist/hooks/permit/utils/construct.d.ts.map +1 -0
- package/dist/hooks/permit/utils/construct.js +227 -0
- package/dist/hooks/permit/utils/construct.js.map +1 -0
- package/dist/hooks/permit/utils/detect.d.ts +35 -0
- package/dist/hooks/permit/utils/detect.d.ts.map +1 -0
- package/dist/hooks/permit/utils/detect.js +241 -0
- package/dist/hooks/permit/utils/detect.js.map +1 -0
- package/dist/hooks/permit/utils/domainSeparator.d.ts +44 -0
- package/dist/hooks/permit/utils/domainSeparator.d.ts.map +1 -0
- package/dist/hooks/permit/utils/domainSeparator.js +216 -0
- package/dist/hooks/permit/utils/domainSeparator.js.map +1 -0
- package/dist/hooks/permit/utils/encodeArgs.d.ts +11 -0
- package/dist/hooks/permit/utils/encodeArgs.d.ts.map +1 -0
- package/dist/hooks/permit/utils/encodeArgs.js +29 -0
- package/dist/hooks/permit/utils/encodeArgs.js.map +1 -0
- package/dist/hooks/permit/utils/trySignPermit1.d.ts +42 -0
- package/dist/hooks/permit/utils/trySignPermit1.d.ts.map +1 -0
- package/dist/hooks/permit/utils/trySignPermit1.js +283 -0
- package/dist/hooks/permit/utils/trySignPermit1.js.map +1 -0
- package/dist/hooks/permit/utils/types.d.ts +77 -0
- package/dist/hooks/permit/utils/types.d.ts.map +1 -0
- package/dist/hooks/permit/utils/utils.d.ts +15 -0
- package/dist/hooks/permit/utils/utils.d.ts.map +1 -0
- package/dist/hooks/permit/utils/utils.js +44 -0
- package/dist/hooks/permit/utils/utils.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.d.ts +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js +94 -0
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js.map +1 -0
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js +1 -1
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.d.ts +3 -0
- package/dist/hooks/swap/prices/useSwapPrices.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.js +43 -29
- package/dist/hooks/swap/prices/useSwapPrices.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.d.ts +2 -10
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js +10 -10
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/types.d.ts +15 -0
- package/dist/hooks/swap/tradeFlow/common/types.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts +2 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js +433 -268
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js +4 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketFlow.d.ts +2 -1
- package/dist/hooks/swap/tradeFlow/useMarketFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketFlow.js +411 -245
- package/dist/hooks/swap/tradeFlow/useMarketFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketSwapStep.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js +4 -1
- package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js.map +1 -1
- package/dist/hooks/tokens/allowance/types.d.ts +2 -0
- package/dist/hooks/tokens/allowance/types.d.ts.map +1 -1
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.d.ts +3 -1
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.d.ts.map +1 -1
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.js +4 -2
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.js.map +1 -1
- package/dist/hooks/tokens/allowance/useTokenAllowance.d.ts +1 -1
- package/dist/hooks/tokens/allowance/useTokenAllowance.d.ts.map +1 -1
- package/dist/hooks/tokens/allowance/useTokenAllowance.js +11 -8
- package/dist/hooks/tokens/allowance/useTokenAllowance.js.map +1 -1
- package/dist/hooks/tokens/balances/useInvalidateTokenData.d.ts +1 -0
- package/dist/hooks/tokens/balances/useInvalidateTokenData.d.ts.map +1 -1
- package/dist/hooks/tokens/balances/useInvalidateTokenData.js +32 -5
- package/dist/hooks/tokens/balances/useInvalidateTokenData.js.map +1 -1
- package/dist/hooks/txs/mutations/useSendTx.d.ts.map +1 -1
- package/dist/hooks/txs/mutations/useSendTx.js +48 -44
- package/dist/hooks/txs/mutations/useSendTx.js.map +1 -1
- package/dist/hooks/useIsCrosschainPossible.d.ts +12 -0
- package/dist/hooks/useIsCrosschainPossible.d.ts.map +1 -0
- package/dist/hooks/useIsCrosschainPossible.js +68 -0
- package/dist/hooks/useIsCrosschainPossible.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils/delta.d.ts +13 -0
- package/dist/lib/utils/delta.d.ts.map +1 -0
- package/dist/lib/utils/delta.js +35 -0
- package/dist/lib/utils/delta.js.map +1 -0
- package/dist/lib/utils/explorer.d.ts +2 -0
- package/dist/lib/utils/explorer.d.ts.map +1 -1
- package/dist/lib/utils/explorer.js +15 -1
- package/dist/lib/utils/explorer.js.map +1 -1
- package/dist/styles/global.css.js +4 -0
- package/dist/styles/global.css.js.map +1 -0
- package/dist/styles.css +194 -3411
- package/dist/test/Configurator.d.ts.map +1 -1
- package/dist/tokens/defaultTokens.js.map +1 -1
- package/dist/widget/Updaters.d.ts.map +1 -1
- package/dist/widget/Updaters.js +4 -0
- package/dist/widget/Updaters.js.map +1 -1
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.d.ts +9 -0
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.d.ts.map +1 -0
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.js +81 -0
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.js.map +1 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +303 -259
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/inputs/hooks/types.d.ts +4 -0
- package/dist/widget/inputs/hooks/types.d.ts.map +1 -0
- package/dist/widget/inputs/hooks/useTokenFromInputProps.d.ts +3 -1
- package/dist/widget/inputs/hooks/useTokenFromInputProps.d.ts.map +1 -1
- package/dist/widget/inputs/hooks/useTokenFromInputProps.js +160 -99
- package/dist/widget/inputs/hooks/useTokenFromInputProps.js.map +1 -1
- package/dist/widget/inputs/hooks/useTokenToInputProps.d.ts +2 -1
- package/dist/widget/inputs/hooks/useTokenToInputProps.d.ts.map +1 -1
- package/dist/widget/inputs/hooks/useTokenToInputProps.js +136 -105
- package/dist/widget/inputs/hooks/useTokenToInputProps.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { useRef } from 'react';
|
|
|
13
13
|
import { useInvalidateTokenDataQuery } from '../../tokens/balances/useInvalidateTokenData.js';
|
|
14
14
|
import { UserCancelledError } from './common/errors.js';
|
|
15
15
|
import { useReceiverAddressValue } from '../../../components/widget/ReceiverAddress/state/receiverAddressAtom.js';
|
|
16
|
+
import { useSignTokenPermit1, useMarkPermit1NonceAsUsed } from '../../permit/hooks/useSignTokenFromPermit1.js';
|
|
16
17
|
import { useApprove } from '../../txs/mutations/useApprove.js';
|
|
17
18
|
|
|
18
19
|
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
@@ -27,7 +28,7 @@ globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
|
27
28
|
};
|
|
28
29
|
const MARKET_SWAP_MUTATION_KEY = "runMarketSwapFlow";
|
|
29
30
|
function useMarketFlow(t0) {
|
|
30
|
-
const $ = distExports.c(
|
|
31
|
+
const $ = distExports.c(117);
|
|
31
32
|
const {
|
|
32
33
|
marketPrice
|
|
33
34
|
} = t0;
|
|
@@ -35,41 +36,43 @@ function useMarketFlow(t0) {
|
|
|
35
36
|
const t1 = marketPrice?.srcToken;
|
|
36
37
|
const t2 = marketPrice?.srcAmount;
|
|
37
38
|
let t3;
|
|
38
|
-
if ($[0] !==
|
|
39
|
+
if ($[0] !== chainId || $[1] !== t1 || $[2] !== t2) {
|
|
39
40
|
t3 = {
|
|
40
41
|
tokenAddress: t1,
|
|
41
42
|
amountToApproveInWei: t2,
|
|
42
|
-
spenderContractType: "AugustusSwapper"
|
|
43
|
+
spenderContractType: "AugustusSwapper",
|
|
44
|
+
chainId
|
|
43
45
|
};
|
|
44
|
-
$[0] =
|
|
45
|
-
$[1] =
|
|
46
|
-
$[2] =
|
|
46
|
+
$[0] = chainId;
|
|
47
|
+
$[1] = t1;
|
|
48
|
+
$[2] = t2;
|
|
49
|
+
$[3] = t3;
|
|
47
50
|
} else {
|
|
48
|
-
t3 = $[
|
|
51
|
+
t3 = $[3];
|
|
49
52
|
}
|
|
50
53
|
const allowance = useGenericTokenAllowanceMin(t3);
|
|
51
54
|
let t4;
|
|
52
|
-
if ($[
|
|
55
|
+
if ($[4] !== marketPrice) {
|
|
53
56
|
t4 = marketPrice?.srcToken ? {
|
|
54
57
|
address: marketPrice.srcToken
|
|
55
58
|
} : void 0;
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
59
|
+
$[4] = marketPrice;
|
|
60
|
+
$[5] = t4;
|
|
58
61
|
} else {
|
|
59
|
-
t4 = $[
|
|
62
|
+
t4 = $[5];
|
|
60
63
|
}
|
|
61
64
|
let t5;
|
|
62
|
-
if ($[
|
|
65
|
+
if ($[6] !== allowance.allowanceToSet) {
|
|
63
66
|
t5 = {
|
|
64
67
|
allowanceToSet: allowance.allowanceToSet
|
|
65
68
|
};
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
69
|
+
$[6] = allowance.allowanceToSet;
|
|
70
|
+
$[7] = t5;
|
|
68
71
|
} else {
|
|
69
|
-
t5 = $[
|
|
72
|
+
t5 = $[7];
|
|
70
73
|
}
|
|
71
74
|
let t6;
|
|
72
|
-
if ($[
|
|
75
|
+
if ($[8] !== allowance.spender || $[9] !== t4 || $[10] !== t5) {
|
|
73
76
|
t6 = {
|
|
74
77
|
token: t4,
|
|
75
78
|
allowanceData: t5,
|
|
@@ -77,38 +80,107 @@ function useMarketFlow(t0) {
|
|
|
77
80
|
onSuccess: _temp,
|
|
78
81
|
onError: _temp2
|
|
79
82
|
};
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
83
|
+
$[8] = allowance.spender;
|
|
84
|
+
$[9] = t4;
|
|
85
|
+
$[10] = t5;
|
|
86
|
+
$[11] = t6;
|
|
84
87
|
} else {
|
|
85
|
-
t6 = $[
|
|
88
|
+
t6 = $[11];
|
|
86
89
|
}
|
|
87
90
|
const approveTxMut = useApprove(t6);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const t7 = marketPrice?.srcToken;
|
|
92
|
+
let t8;
|
|
93
|
+
if ($[12] !== chainId || $[13] !== t7) {
|
|
94
|
+
t8 = {
|
|
95
|
+
address: t7,
|
|
96
|
+
network: chainId
|
|
93
97
|
};
|
|
94
|
-
$[11] = approveTxMut.txHash;
|
|
95
98
|
$[12] = chainId;
|
|
96
99
|
$[13] = t7;
|
|
100
|
+
$[14] = t8;
|
|
101
|
+
} else {
|
|
102
|
+
t8 = $[14];
|
|
103
|
+
}
|
|
104
|
+
const t9 = allowance.spender;
|
|
105
|
+
let t10;
|
|
106
|
+
if ($[15] !== allowance.allowanceToSet || $[16] !== allowance.needsApproval || $[17] !== t8 || $[18] !== t9) {
|
|
107
|
+
t10 = {
|
|
108
|
+
token: t8,
|
|
109
|
+
value: allowance.allowanceToSet,
|
|
110
|
+
spender: t9,
|
|
111
|
+
enabled: allowance.needsApproval,
|
|
112
|
+
onSuccess: _temp3,
|
|
113
|
+
onError: _temp4
|
|
114
|
+
};
|
|
115
|
+
$[15] = allowance.allowanceToSet;
|
|
116
|
+
$[16] = allowance.needsApproval;
|
|
117
|
+
$[17] = t8;
|
|
118
|
+
$[18] = t9;
|
|
119
|
+
$[19] = t10;
|
|
97
120
|
} else {
|
|
98
|
-
|
|
121
|
+
t10 = $[19];
|
|
99
122
|
}
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
const signPermit1Mut = useSignTokenPermit1(t10);
|
|
124
|
+
const t11 = allowance.spender;
|
|
125
|
+
let t12;
|
|
126
|
+
if ($[20] !== allowance.allowanceToSet || $[21] !== signPermit1Mut.error || $[22] !== signPermit1Mut.isError || $[23] !== signPermit1Mut.isPending || $[24] !== signPermit1Mut.isPermitReadyToSign || $[25] !== signPermit1Mut.isPermitSupported || $[26] !== signPermit1Mut.isSuccess || $[27] !== signPermit1Mut.permit1EncodedArgs || $[28] !== signPermit1Mut.permitFetchingState.isPending || $[29] !== signPermit1Mut.permitSigningState.isPending || $[30] !== signPermit1Mut.permitSigningState.isSuccess || $[31] !== signPermit1Mut.signature || $[32] !== t11) {
|
|
127
|
+
t12 = {
|
|
128
|
+
isPermitSupported: signPermit1Mut.isPermitSupported,
|
|
129
|
+
isPermitReadyToSign: signPermit1Mut.isPermitReadyToSign,
|
|
130
|
+
amountToPermit: allowance.allowanceToSet,
|
|
131
|
+
spender: t11,
|
|
132
|
+
isLoadingPermitData: signPermit1Mut.permitFetchingState.isPending,
|
|
133
|
+
isSigningPermit: signPermit1Mut.permitSigningState.isPending,
|
|
134
|
+
isPermitSigned: signPermit1Mut.permitSigningState.isSuccess,
|
|
135
|
+
signature: signPermit1Mut.signature,
|
|
136
|
+
permitEncodedArgs: signPermit1Mut.permit1EncodedArgs,
|
|
137
|
+
isPending: signPermit1Mut.isPending,
|
|
138
|
+
isSuccess: signPermit1Mut.isSuccess,
|
|
139
|
+
isError: signPermit1Mut.isError,
|
|
140
|
+
error: signPermit1Mut.error
|
|
141
|
+
};
|
|
142
|
+
$[20] = allowance.allowanceToSet;
|
|
143
|
+
$[21] = signPermit1Mut.error;
|
|
144
|
+
$[22] = signPermit1Mut.isError;
|
|
145
|
+
$[23] = signPermit1Mut.isPending;
|
|
146
|
+
$[24] = signPermit1Mut.isPermitReadyToSign;
|
|
147
|
+
$[25] = signPermit1Mut.isPermitSupported;
|
|
148
|
+
$[26] = signPermit1Mut.isSuccess;
|
|
149
|
+
$[27] = signPermit1Mut.permit1EncodedArgs;
|
|
150
|
+
$[28] = signPermit1Mut.permitFetchingState.isPending;
|
|
151
|
+
$[29] = signPermit1Mut.permitSigningState.isPending;
|
|
152
|
+
$[30] = signPermit1Mut.permitSigningState.isSuccess;
|
|
153
|
+
$[31] = signPermit1Mut.signature;
|
|
154
|
+
$[32] = t11;
|
|
155
|
+
$[33] = t12;
|
|
156
|
+
} else {
|
|
157
|
+
t12 = $[33];
|
|
158
|
+
}
|
|
159
|
+
const signPermit = t12;
|
|
106
160
|
let t13;
|
|
107
|
-
if ($[
|
|
161
|
+
if ($[34] !== approveTxMut.txHash || $[35] !== chainId) {
|
|
108
162
|
t13 = {
|
|
163
|
+
hash: approveTxMut.txHash,
|
|
164
|
+
chainId
|
|
165
|
+
};
|
|
166
|
+
$[34] = approveTxMut.txHash;
|
|
167
|
+
$[35] = chainId;
|
|
168
|
+
$[36] = t13;
|
|
169
|
+
} else {
|
|
170
|
+
t13 = $[36];
|
|
171
|
+
}
|
|
172
|
+
const approveTxMined = useAwaitTx(t13);
|
|
173
|
+
const t14 = allowance.spender;
|
|
174
|
+
const t15 = allowance.needsApproval && (approveTxMut.isPending || approveTxMined.isLoading);
|
|
175
|
+
const t16 = allowance.needsApproval && (approveTxMut.isError || approveTxMined.isError);
|
|
176
|
+
const t17 = !allowance.needsApproval || approveTxMined.isSuccess;
|
|
177
|
+
const t18 = allowance.needsApproval ? approveTxMut.error || approveTxMined.error : null;
|
|
178
|
+
let t19;
|
|
179
|
+
if ($[37] !== allowance.allowanceToSet || $[38] !== allowance.isLoadingPrerequisites || $[39] !== allowance.needsApproval || $[40] !== approveTxMined.data || $[41] !== approveTxMined.isLoading || $[42] !== approveTxMined.isSuccess || $[43] !== approveTxMut.isPending || $[44] !== approveTxMut.isSuccess || $[45] !== approveTxMut.txHash || $[46] !== t14 || $[47] !== t15 || $[48] !== t16 || $[49] !== t17 || $[50] !== t18) {
|
|
180
|
+
t19 = {
|
|
109
181
|
needsApproval: allowance.needsApproval,
|
|
110
182
|
allowanceToSet: allowance.allowanceToSet,
|
|
111
|
-
spender:
|
|
183
|
+
spender: t14,
|
|
112
184
|
txHash: approveTxMut.txHash,
|
|
113
185
|
receipt: approveTxMined.data,
|
|
114
186
|
isLoadingAllowance: allowance.isLoadingPrerequisites,
|
|
@@ -116,124 +188,124 @@ function useMarketFlow(t0) {
|
|
|
116
188
|
isTxSent: approveTxMut.isSuccess,
|
|
117
189
|
isTxPending: approveTxMined.isLoading,
|
|
118
190
|
isTxMined: approveTxMined.isSuccess,
|
|
119
|
-
isPending:
|
|
120
|
-
isError:
|
|
121
|
-
isSuccess:
|
|
122
|
-
error:
|
|
191
|
+
isPending: t15,
|
|
192
|
+
isError: t16,
|
|
193
|
+
isSuccess: t17,
|
|
194
|
+
error: t18
|
|
123
195
|
};
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
196
|
+
$[37] = allowance.allowanceToSet;
|
|
197
|
+
$[38] = allowance.isLoadingPrerequisites;
|
|
198
|
+
$[39] = allowance.needsApproval;
|
|
199
|
+
$[40] = approveTxMined.data;
|
|
200
|
+
$[41] = approveTxMined.isLoading;
|
|
201
|
+
$[42] = approveTxMined.isSuccess;
|
|
202
|
+
$[43] = approveTxMut.isPending;
|
|
203
|
+
$[44] = approveTxMut.isSuccess;
|
|
204
|
+
$[45] = approveTxMut.txHash;
|
|
205
|
+
$[46] = t14;
|
|
206
|
+
$[47] = t15;
|
|
207
|
+
$[48] = t16;
|
|
208
|
+
$[49] = t17;
|
|
209
|
+
$[50] = t18;
|
|
210
|
+
$[51] = t19;
|
|
139
211
|
} else {
|
|
140
|
-
|
|
212
|
+
t19 = $[51];
|
|
141
213
|
}
|
|
142
|
-
const approval =
|
|
143
|
-
let
|
|
144
|
-
if ($[
|
|
145
|
-
|
|
146
|
-
onSuccess:
|
|
147
|
-
onError:
|
|
214
|
+
const approval = t19;
|
|
215
|
+
let t20;
|
|
216
|
+
if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
|
|
217
|
+
t20 = {
|
|
218
|
+
onSuccess: _temp5,
|
|
219
|
+
onError: _temp6
|
|
148
220
|
};
|
|
149
|
-
$[
|
|
221
|
+
$[52] = t20;
|
|
150
222
|
} else {
|
|
151
|
-
|
|
223
|
+
t20 = $[52];
|
|
152
224
|
}
|
|
153
|
-
let
|
|
154
|
-
if ($[
|
|
155
|
-
|
|
225
|
+
let t21;
|
|
226
|
+
if ($[53] !== chainId) {
|
|
227
|
+
t21 = {
|
|
156
228
|
chainId,
|
|
157
|
-
mutationOptions:
|
|
229
|
+
mutationOptions: t20
|
|
158
230
|
};
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
231
|
+
$[53] = chainId;
|
|
232
|
+
$[54] = t21;
|
|
161
233
|
} else {
|
|
162
|
-
|
|
234
|
+
t21 = $[54];
|
|
163
235
|
}
|
|
164
|
-
const buildTxMut = useBuildTx(
|
|
165
|
-
let
|
|
166
|
-
if ($[
|
|
167
|
-
|
|
236
|
+
const buildTxMut = useBuildTx(t21);
|
|
237
|
+
let t22;
|
|
238
|
+
if ($[55] !== buildTxMut.error || $[56] !== buildTxMut.isError || $[57] !== buildTxMut.isPending || $[58] !== buildTxMut.isSuccess) {
|
|
239
|
+
t22 = {
|
|
168
240
|
isPending: buildTxMut.isPending,
|
|
169
241
|
isError: buildTxMut.isError,
|
|
170
242
|
isSuccess: buildTxMut.isSuccess,
|
|
171
243
|
error: buildTxMut.error
|
|
172
244
|
};
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
245
|
+
$[55] = buildTxMut.error;
|
|
246
|
+
$[56] = buildTxMut.isError;
|
|
247
|
+
$[57] = buildTxMut.isPending;
|
|
248
|
+
$[58] = buildTxMut.isSuccess;
|
|
249
|
+
$[59] = t22;
|
|
178
250
|
} else {
|
|
179
|
-
|
|
251
|
+
t22 = $[59];
|
|
180
252
|
}
|
|
181
|
-
const buildTxParams =
|
|
182
|
-
let
|
|
183
|
-
if ($[
|
|
184
|
-
|
|
185
|
-
onSuccess:
|
|
186
|
-
onError:
|
|
253
|
+
const buildTxParams = t22;
|
|
254
|
+
let t23;
|
|
255
|
+
if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
|
|
256
|
+
t23 = {
|
|
257
|
+
onSuccess: _temp7,
|
|
258
|
+
onError: _temp8
|
|
187
259
|
};
|
|
188
|
-
$[
|
|
260
|
+
$[60] = t23;
|
|
189
261
|
} else {
|
|
190
|
-
|
|
262
|
+
t23 = $[60];
|
|
191
263
|
}
|
|
192
|
-
const sendSwapTxMut = useSendMarketSwapTx(
|
|
193
|
-
let
|
|
194
|
-
if ($[
|
|
195
|
-
|
|
264
|
+
const sendSwapTxMut = useSendMarketSwapTx(t23);
|
|
265
|
+
let t24;
|
|
266
|
+
if ($[61] !== chainId || $[62] !== sendSwapTxMut.txHash) {
|
|
267
|
+
t24 = {
|
|
196
268
|
hash: sendSwapTxMut.txHash,
|
|
197
269
|
chainId
|
|
198
270
|
};
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
271
|
+
$[61] = chainId;
|
|
272
|
+
$[62] = sendSwapTxMut.txHash;
|
|
273
|
+
$[63] = t24;
|
|
202
274
|
} else {
|
|
203
|
-
|
|
275
|
+
t24 = $[63];
|
|
204
276
|
}
|
|
205
|
-
const swapTxMined = useAwaitTx(
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
let
|
|
210
|
-
if ($[
|
|
211
|
-
|
|
277
|
+
const swapTxMined = useAwaitTx(t24);
|
|
278
|
+
const t25 = sendSwapTxMut.isPending || swapTxMined.isLoading;
|
|
279
|
+
const t26 = sendSwapTxMut.isError || swapTxMined.isError;
|
|
280
|
+
const t27 = sendSwapTxMut.error || swapTxMined.error;
|
|
281
|
+
let t28;
|
|
282
|
+
if ($[64] !== sendSwapTxMut.isPending || $[65] !== sendSwapTxMut.isSuccess || $[66] !== sendSwapTxMut.txHash || $[67] !== swapTxMined.data || $[68] !== swapTxMined.isLoading || $[69] !== swapTxMined.isSuccess || $[70] !== t25 || $[71] !== t26 || $[72] !== t27) {
|
|
283
|
+
t28 = {
|
|
212
284
|
txHash: sendSwapTxMut.txHash,
|
|
213
285
|
receipt: swapTxMined.data,
|
|
214
286
|
isConfirmingTX: sendSwapTxMut.isPending,
|
|
215
287
|
isTxSent: sendSwapTxMut.isSuccess,
|
|
216
288
|
isTxPending: swapTxMined.isLoading,
|
|
217
289
|
isTxMined: swapTxMined.isSuccess,
|
|
218
|
-
isPending:
|
|
290
|
+
isPending: t25,
|
|
219
291
|
isSuccess: swapTxMined.isSuccess,
|
|
220
|
-
isError:
|
|
221
|
-
error:
|
|
292
|
+
isError: t26,
|
|
293
|
+
error: t27
|
|
222
294
|
};
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
295
|
+
$[64] = sendSwapTxMut.isPending;
|
|
296
|
+
$[65] = sendSwapTxMut.isSuccess;
|
|
297
|
+
$[66] = sendSwapTxMut.txHash;
|
|
298
|
+
$[67] = swapTxMined.data;
|
|
299
|
+
$[68] = swapTxMined.isLoading;
|
|
300
|
+
$[69] = swapTxMined.isSuccess;
|
|
301
|
+
$[70] = t25;
|
|
302
|
+
$[71] = t26;
|
|
303
|
+
$[72] = t27;
|
|
304
|
+
$[73] = t28;
|
|
233
305
|
} else {
|
|
234
|
-
|
|
306
|
+
t28 = $[73];
|
|
235
307
|
}
|
|
236
|
-
const swap =
|
|
308
|
+
const swap = t28;
|
|
237
309
|
const {
|
|
238
310
|
address: account
|
|
239
311
|
} = useAccount();
|
|
@@ -242,132 +314,219 @@ function useMarketFlow(t0) {
|
|
|
242
314
|
} = useSlippage();
|
|
243
315
|
const ensureTxReceipt = useEnsureTxReceipt();
|
|
244
316
|
const currentAbortControllerRef = useRef(null);
|
|
245
|
-
let
|
|
246
|
-
if ($[
|
|
247
|
-
|
|
317
|
+
let t29;
|
|
318
|
+
if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
|
|
319
|
+
t29 = () => {
|
|
248
320
|
currentAbortControllerRef.current?.abort(new UserCancelledError());
|
|
249
321
|
currentAbortControllerRef.current = null;
|
|
250
322
|
};
|
|
251
|
-
$[
|
|
323
|
+
$[74] = t29;
|
|
252
324
|
} else {
|
|
253
|
-
|
|
325
|
+
t29 = $[74];
|
|
254
326
|
}
|
|
255
|
-
const cancelFlow =
|
|
256
|
-
const reset = () => {
|
|
257
|
-
approveTxMut.reset();
|
|
258
|
-
buildTxMut.reset();
|
|
259
|
-
sendSwapTxMut.reset();
|
|
260
|
-
marketSwapMut.reset();
|
|
261
|
-
};
|
|
327
|
+
const cancelFlow = t29;
|
|
262
328
|
const receiverAddress = useReceiverAddressValue();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
329
|
+
let t30;
|
|
330
|
+
if ($[75] !== chainId) {
|
|
331
|
+
t30 = {
|
|
332
|
+
chainId
|
|
333
|
+
};
|
|
334
|
+
$[75] = chainId;
|
|
335
|
+
$[76] = t30;
|
|
336
|
+
} else {
|
|
337
|
+
t30 = $[76];
|
|
338
|
+
}
|
|
339
|
+
const {
|
|
340
|
+
markNonceAsUsed,
|
|
341
|
+
clearNonce
|
|
342
|
+
} = useMarkPermit1NonceAsUsed(t30);
|
|
343
|
+
let t31;
|
|
344
|
+
if ($[77] !== account || $[78] !== approval || $[79] !== approveTxMut || $[80] !== buildTxMut || $[81] !== chainId || $[82] !== clearNonce || $[83] !== ensureTxReceipt || $[84] !== markNonceAsUsed || $[85] !== marketPrice || $[86] !== receiverAddress || $[87] !== resolvedSlippage || $[88] !== sendSwapTxMut || $[89] !== signPermit || $[90] !== signPermit1Mut) {
|
|
345
|
+
t31 = async (t322) => {
|
|
346
|
+
const {
|
|
347
|
+
onTxSent
|
|
348
|
+
} = t322 === void 0 ? {} : t322;
|
|
349
|
+
approveTxMut.reset();
|
|
350
|
+
signPermit1Mut.reset();
|
|
351
|
+
buildTxMut.reset();
|
|
352
|
+
sendSwapTxMut.reset();
|
|
353
|
+
const abortController = new AbortController();
|
|
354
|
+
currentAbortControllerRef.current = abortController;
|
|
355
|
+
const signal = abortController.signal;
|
|
356
|
+
let signedPermitResult;
|
|
357
|
+
let approveTxHash;
|
|
358
|
+
let approveTxReceipt;
|
|
359
|
+
if (approval.needsApproval) {
|
|
360
|
+
if (!signPermit.isPermitSupported || !signPermit.isPermitReadyToSign) {
|
|
361
|
+
approveTxHash = await approveTxMut.approveAsync();
|
|
362
|
+
signal.throwIfAborted();
|
|
363
|
+
const approveTxReceiptPromise = ensureTxReceipt({
|
|
364
|
+
hash: approveTxHash,
|
|
365
|
+
chainId,
|
|
366
|
+
onReplaced: (data) => {
|
|
367
|
+
console.log("onReplaced:approveTx", approveTxHash, data);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
if (onTxSent) {
|
|
371
|
+
onTxSent({
|
|
372
|
+
txHash: approveTxHash,
|
|
373
|
+
actionType: "approve",
|
|
374
|
+
receiptPromise: approveTxReceiptPromise
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
approveTxReceipt = await approveTxReceiptPromise;
|
|
378
|
+
console.log("🚀 ~ approveTx ~ receipt:", approveTxReceipt);
|
|
379
|
+
} else {
|
|
380
|
+
signedPermitResult = await signPermit1Mut.signPermit1Async();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
275
383
|
signal.throwIfAborted();
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
384
|
+
assert(account, "Account is not connected");
|
|
385
|
+
assert(marketPrice, "Market price is not available");
|
|
386
|
+
const amountsAfterSlippage = applySlippage({
|
|
387
|
+
srcAmount: marketPrice.srcAmount,
|
|
388
|
+
destAmount: marketPrice.destAmount
|
|
389
|
+
}, resolvedSlippage, marketPrice.side);
|
|
390
|
+
const txParams = await buildTxMut.mutateAsync({
|
|
391
|
+
swapTxInput: {
|
|
392
|
+
userAddress: account,
|
|
393
|
+
receiver: receiverAddress,
|
|
394
|
+
srcToken: marketPrice.srcToken,
|
|
395
|
+
destToken: marketPrice.destToken,
|
|
396
|
+
srcDecimals: marketPrice.srcDecimals,
|
|
397
|
+
destDecimals: marketPrice.destDecimals,
|
|
398
|
+
permit: signedPermitResult?.permit1EncodedArgs,
|
|
399
|
+
priceRoute: marketPrice,
|
|
400
|
+
...amountsAfterSlippage
|
|
281
401
|
}
|
|
282
402
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
receiptPromise: approveTxReceiptPromise
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
approveTxReceipt = await approveTxReceiptPromise;
|
|
291
|
-
console.log("🚀 ~ approveTx ~ receipt:", approveTxReceipt);
|
|
292
|
-
}
|
|
293
|
-
signal.throwIfAborted();
|
|
294
|
-
assert(account, "Account is not connected");
|
|
295
|
-
assert(marketPrice, "Market price is not available");
|
|
296
|
-
const amountsAfterSlippage = applySlippage({
|
|
297
|
-
srcAmount: marketPrice.srcAmount,
|
|
298
|
-
destAmount: marketPrice.destAmount
|
|
299
|
-
}, resolvedSlippage, marketPrice.side);
|
|
300
|
-
const txParams = await buildTxMut.mutateAsync({
|
|
301
|
-
swapTxInput: {
|
|
302
|
-
userAddress: account,
|
|
303
|
-
receiver: receiverAddress,
|
|
304
|
-
srcToken: marketPrice.srcToken,
|
|
305
|
-
destToken: marketPrice.destToken,
|
|
306
|
-
srcDecimals: marketPrice.srcDecimals,
|
|
307
|
-
destDecimals: marketPrice.destDecimals,
|
|
308
|
-
priceRoute: marketPrice,
|
|
309
|
-
...amountsAfterSlippage
|
|
403
|
+
signal.throwIfAborted();
|
|
404
|
+
const swapTxHash = await sendSwapTxMut.sendTransactionAsync(txParams);
|
|
405
|
+
if (signedPermitResult) {
|
|
406
|
+
markNonceAsUsed(signedPermitResult.signedPermitData);
|
|
310
407
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
408
|
+
try {
|
|
409
|
+
const swapTxReceiptPromise = ensureTxReceipt({
|
|
410
|
+
hash: swapTxHash,
|
|
411
|
+
chainId,
|
|
412
|
+
onReplaced: (data_0) => {
|
|
413
|
+
console.log("onReplaced:swapTx", swapTxHash, data_0);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
if (onTxSent) {
|
|
417
|
+
onTxSent({
|
|
418
|
+
txHash: swapTxHash,
|
|
419
|
+
actionType: "swap",
|
|
420
|
+
receiptPromise: swapTxReceiptPromise
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
const swapTxReceipt = await swapTxReceiptPromise;
|
|
424
|
+
console.log("🚀 ~ swapTx ~ receipt:", swapTxReceipt);
|
|
425
|
+
return {
|
|
426
|
+
tradeFlowType: "marketSwap",
|
|
427
|
+
approve: {
|
|
428
|
+
txHash: approveTxHash,
|
|
429
|
+
receipt: approveTxReceipt
|
|
430
|
+
},
|
|
431
|
+
swap: {
|
|
432
|
+
txHash: swapTxHash,
|
|
433
|
+
receipt: swapTxReceipt
|
|
434
|
+
},
|
|
435
|
+
marketPrice,
|
|
436
|
+
account
|
|
437
|
+
};
|
|
438
|
+
} catch (t332) {
|
|
439
|
+
const error_3 = t332;
|
|
440
|
+
if (signedPermitResult) {
|
|
441
|
+
clearNonce(signedPermitResult.signedPermitData);
|
|
442
|
+
}
|
|
443
|
+
throw error_3;
|
|
319
444
|
}
|
|
320
|
-
});
|
|
321
|
-
if (onTxSent) {
|
|
322
|
-
onTxSent({
|
|
323
|
-
txHash: swapTxHash,
|
|
324
|
-
actionType: "swap",
|
|
325
|
-
receiptPromise: swapTxReceiptPromise
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
const swapTxReceipt = await swapTxReceiptPromise;
|
|
329
|
-
console.log("🚀 ~ swapTx ~ receipt:", swapTxReceipt);
|
|
330
|
-
return {
|
|
331
|
-
tradeFlowType: "marketSwap",
|
|
332
|
-
approve: {
|
|
333
|
-
txHash: approveTxHash,
|
|
334
|
-
receipt: approveTxReceipt
|
|
335
|
-
},
|
|
336
|
-
swap: {
|
|
337
|
-
txHash: swapTxHash,
|
|
338
|
-
receipt: swapTxReceipt
|
|
339
|
-
},
|
|
340
|
-
marketPrice,
|
|
341
|
-
account
|
|
342
445
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
446
|
+
$[77] = account;
|
|
447
|
+
$[78] = approval;
|
|
448
|
+
$[79] = approveTxMut;
|
|
449
|
+
$[80] = buildTxMut;
|
|
450
|
+
$[81] = chainId;
|
|
451
|
+
$[82] = clearNonce;
|
|
452
|
+
$[83] = ensureTxReceipt;
|
|
453
|
+
$[84] = markNonceAsUsed;
|
|
454
|
+
$[85] = marketPrice;
|
|
455
|
+
$[86] = receiverAddress;
|
|
456
|
+
$[87] = resolvedSlippage;
|
|
457
|
+
$[88] = sendSwapTxMut;
|
|
458
|
+
$[89] = signPermit;
|
|
459
|
+
$[90] = signPermit1Mut;
|
|
460
|
+
$[91] = t31;
|
|
461
|
+
} else {
|
|
462
|
+
t31 = $[91];
|
|
463
|
+
}
|
|
464
|
+
const submitSwapTx = t31;
|
|
465
|
+
const invalidateTokenData = useInvalidateTokenDataQuery();
|
|
466
|
+
let t32;
|
|
467
|
+
if ($[92] === Symbol.for("react.memo_cache_sentinel")) {
|
|
468
|
+
t32 = [MARKET_SWAP_MUTATION_KEY];
|
|
469
|
+
$[92] = t32;
|
|
470
|
+
} else {
|
|
471
|
+
t32 = $[92];
|
|
472
|
+
}
|
|
473
|
+
let t33;
|
|
474
|
+
if ($[93] !== invalidateTokenData) {
|
|
475
|
+
t33 = () => {
|
|
348
476
|
console.log("Swap tx settled, invalidating balances and allowances");
|
|
349
|
-
|
|
477
|
+
invalidateTokenData({
|
|
478
|
+
nonces: true
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
$[93] = invalidateTokenData;
|
|
482
|
+
$[94] = t33;
|
|
483
|
+
} else {
|
|
484
|
+
t33 = $[94];
|
|
485
|
+
}
|
|
486
|
+
let t34;
|
|
487
|
+
if ($[95] !== submitSwapTx || $[96] !== t33) {
|
|
488
|
+
t34 = {
|
|
489
|
+
mutationFn: submitSwapTx,
|
|
490
|
+
mutationKey: t32,
|
|
491
|
+
onSuccess: _temp9,
|
|
492
|
+
onError: _temp0,
|
|
493
|
+
onSettled: t33
|
|
494
|
+
};
|
|
495
|
+
$[95] = submitSwapTx;
|
|
496
|
+
$[96] = t33;
|
|
497
|
+
$[97] = t34;
|
|
498
|
+
} else {
|
|
499
|
+
t34 = $[97];
|
|
500
|
+
}
|
|
501
|
+
const marketSwapMut = useMutation(t34);
|
|
502
|
+
let t35;
|
|
503
|
+
if ($[98] !== approveTxMut || $[99] !== buildTxMut || $[100] !== marketSwapMut || $[101] !== sendSwapTxMut || $[102] !== signPermit1Mut) {
|
|
504
|
+
t35 = () => {
|
|
505
|
+
approveTxMut.reset();
|
|
506
|
+
signPermit1Mut.reset();
|
|
507
|
+
buildTxMut.reset();
|
|
508
|
+
sendSwapTxMut.reset();
|
|
509
|
+
marketSwapMut.reset();
|
|
350
510
|
};
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
511
|
+
$[98] = approveTxMut;
|
|
512
|
+
$[99] = buildTxMut;
|
|
513
|
+
$[100] = marketSwapMut;
|
|
514
|
+
$[101] = sendSwapTxMut;
|
|
515
|
+
$[102] = signPermit1Mut;
|
|
516
|
+
$[103] = t35;
|
|
353
517
|
} else {
|
|
354
|
-
|
|
518
|
+
t35 = $[103];
|
|
355
519
|
}
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
onError: _temp8,
|
|
361
|
-
onSettled: t25
|
|
362
|
-
});
|
|
363
|
-
let t26;
|
|
364
|
-
if ($[54] !== approval || $[55] !== buildTxParams || $[56] !== chainId || $[57] !== marketSwapMut.data || $[58] !== marketSwapMut.error || $[59] !== marketSwapMut.isError || $[60] !== marketSwapMut.isPending || $[61] !== marketSwapMut.isSuccess || $[62] !== marketSwapMut.mutateAsync || $[63] !== reset || $[64] !== swap) {
|
|
365
|
-
t26 = {
|
|
520
|
+
const reset = t35;
|
|
521
|
+
let t36;
|
|
522
|
+
if ($[104] !== approval || $[105] !== buildTxParams || $[106] !== chainId || $[107] !== marketSwapMut.data || $[108] !== marketSwapMut.error || $[109] !== marketSwapMut.isError || $[110] !== marketSwapMut.isPending || $[111] !== marketSwapMut.isSuccess || $[112] !== marketSwapMut.mutateAsync || $[113] !== reset || $[114] !== signPermit || $[115] !== swap) {
|
|
523
|
+
t36 = {
|
|
366
524
|
chainId,
|
|
367
525
|
runMarketSwapFlow: marketSwapMut.mutateAsync,
|
|
368
526
|
reset,
|
|
369
527
|
cancelFlow,
|
|
370
528
|
approval,
|
|
529
|
+
signPermit,
|
|
371
530
|
buildTxParams,
|
|
372
531
|
swap,
|
|
373
532
|
isPending: marketSwapMut.isPending,
|
|
@@ -376,40 +535,47 @@ function useMarketFlow(t0) {
|
|
|
376
535
|
error: marketSwapMut.error,
|
|
377
536
|
result: marketSwapMut.data
|
|
378
537
|
};
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
538
|
+
$[104] = approval;
|
|
539
|
+
$[105] = buildTxParams;
|
|
540
|
+
$[106] = chainId;
|
|
541
|
+
$[107] = marketSwapMut.data;
|
|
542
|
+
$[108] = marketSwapMut.error;
|
|
543
|
+
$[109] = marketSwapMut.isError;
|
|
544
|
+
$[110] = marketSwapMut.isPending;
|
|
545
|
+
$[111] = marketSwapMut.isSuccess;
|
|
546
|
+
$[112] = marketSwapMut.mutateAsync;
|
|
547
|
+
$[113] = reset;
|
|
548
|
+
$[114] = signPermit;
|
|
549
|
+
$[115] = swap;
|
|
550
|
+
$[116] = t36;
|
|
391
551
|
} else {
|
|
392
|
-
|
|
552
|
+
t36 = $[116];
|
|
393
553
|
}
|
|
394
|
-
return
|
|
554
|
+
return t36;
|
|
555
|
+
}
|
|
556
|
+
function _temp0(error_4) {
|
|
557
|
+
console.error("Swap tx error", error_4);
|
|
558
|
+
}
|
|
559
|
+
function _temp9(data_1) {
|
|
560
|
+
console.log("Swap tx success", data_1);
|
|
395
561
|
}
|
|
396
562
|
function _temp8(error_2) {
|
|
397
563
|
console.error("Swap tx error", error_2);
|
|
398
564
|
}
|
|
399
|
-
function _temp7(
|
|
400
|
-
console.log("Swap tx success"
|
|
565
|
+
function _temp7() {
|
|
566
|
+
console.log("Swap tx success");
|
|
401
567
|
}
|
|
402
568
|
function _temp6(error_1) {
|
|
403
|
-
console.error("
|
|
569
|
+
console.error("Build tx error", error_1);
|
|
404
570
|
}
|
|
405
571
|
function _temp5() {
|
|
406
|
-
console.log("
|
|
572
|
+
console.log("Build tx success");
|
|
407
573
|
}
|
|
408
574
|
function _temp4(error_0) {
|
|
409
|
-
console.error("
|
|
575
|
+
console.error("Permit1 error", error_0);
|
|
410
576
|
}
|
|
411
|
-
function _temp3() {
|
|
412
|
-
console.log("
|
|
577
|
+
function _temp3(signature) {
|
|
578
|
+
console.log("Permit1 signature", signature);
|
|
413
579
|
}
|
|
414
580
|
function _temp2(error) {
|
|
415
581
|
console.error("Approve tx error", error);
|