From a1e3bb3bd6906c8b74f0f9ded660e9f9d8a8095e Mon Sep 17 00:00:00 2001 From: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:52:57 +0530 Subject: [PATCH] fix(wallet)_: Paraswap contract address (#21635) This commit fixes ParaSwap contract address displayed on the setting approval cap for a token. Since we get the approval contract address in the swap proposal, we take that as higher precedence over the hardcoded value in the constants file Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> --- src/status_im/constants.cljs | 2 +- .../wallet/swap/set_spending_cap/view.cljs | 14 ++++++++------ src/status_im/subs/wallet/swap.cljs | 5 +++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index b3ffdb0898..f298b0a249 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -605,7 +605,7 @@ {:name :paraswap :full-name "ParaSwap" :color :blue - :contract-address "0xdef171fe48cf0115b1d80b88dc8eab59176fee57" + :contract-address "0x6a000f20005980200259b80c5102003040001068" :terms-and-conditions-url "https://files.paraswap.io/tos_v4.pdf"}) (def ^:const swap-providers {:paraswap swap-provider-paraswap}) diff --git a/src/status_im/contexts/wallet/swap/set_spending_cap/view.cljs b/src/status_im/contexts/wallet/swap/set_spending_cap/view.cljs index 6932480ac1..077150f744 100644 --- a/src/status_im/contexts/wallet/swap/set_spending_cap/view.cljs +++ b/src/status_im/contexts/wallet/swap/set_spending_cap/view.cljs @@ -148,10 +148,12 @@ (defn- spender-contract-section [] - (let [theme (quo.theme/use-theme) - network (rf/sub [:wallet/swap-network]) - provider (rf/sub [:wallet/swap-proposal-provider]) - network-chain-id (:chain-id network)] + (let [theme (quo.theme/use-theme) + network (rf/sub [:wallet/swap-network]) + provider (rf/sub [:wallet/swap-proposal-provider]) + spender-contract-address (or (rf/sub [:wallet/swap-proposal-approval-contract-address]) + (:contract-address provider)) + network-chain-id (:chain-id network)] [rn/view {:style style/summary-section-container} [quo/text {:size :paragraph-2 @@ -164,10 +166,10 @@ {:type :token-contract :option-icon :i/options :on-option-press #(on-option-press {:chain-id network-chain-id - :contract-address (:contract-address provider)}) + :contract-address spender-contract-address}) :unlimited-icon? false :label (:full-name provider) - :description (address-utils/get-short-wallet-address (:contract-address provider)) + :description (address-utils/get-short-wallet-address spender-contract-address) :avatar-props {:image (resources/get-network (:name provider))}}])])) (defn- data-item diff --git a/src/status_im/subs/wallet/swap.cljs b/src/status_im/subs/wallet/swap.cljs index a57672d35c..1ddeafbad6 100644 --- a/src/status_im/subs/wallet/swap.cljs +++ b/src/status_im/subs/wallet/swap.cljs @@ -227,6 +227,11 @@ :<- [:wallet/swap-proposal] :-> :approval-required) +(rf/reg-sub + :wallet/swap-proposal-approval-contract-address + :<- [:wallet/swap-proposal] + :-> :approval-contract-address) + (rf/reg-sub :wallet/swap-proposal-approval-amount-required :<- [:wallet/swap-proposal]