From 4a1fe3ad192d0724e79ca48ecf3a8ff8bdfc05b5 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:01:27 +0530 Subject: [PATCH] fix payment tests --- .../widget/components/BalanceBanner.jsx | 30 +++---------------- .../components/InsufficientBannerModal.jsx | 6 ++-- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/instances/treasury-devdao.near/widget/components/BalanceBanner.jsx b/instances/treasury-devdao.near/widget/components/BalanceBanner.jsx index 71904a47..0c95fb45 100644 --- a/instances/treasury-devdao.near/widget/components/BalanceBanner.jsx +++ b/instances/treasury-devdao.near/widget/components/BalanceBanner.jsx @@ -1,4 +1,4 @@ -const { getNearBalances, hasPermission } = VM.require( +const { getNearBalances } = VM.require( "${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/lib.common" ); @@ -39,36 +39,14 @@ function formatNearAmount(amount) { } function BalanceBanner({ accountId, treasuryDaoID }) { - if ( - !treasuryDaoID || - typeof getNearBalances !== "function" || - !accountId || - typeof hasPermission !== "function" - ) { + if (!treasuryDaoID || typeof getNearBalances !== "function" || !accountId) { return <>; } const nearBalances = getNearBalances(accountId); - const hasCreatePermission = hasPermission( - treasuryDaoID, - accountId, - "transfer", - "AddProposal" - ); - - const daoPolicy = useCache( - () => Near.asyncView(treasuryDaoID, "get_policy"), - "get_policy", - { subscribe: false } - ); - - // if they have create permission they need deposit amount for add proposal - const ADDITIONAL_AMOUNT = hasCreatePermission - ? formatNearAmount(daoPolicy?.proposal_bond) - : 0; - const LOW_BALANCE_LIMIT = ADDITIONAL_AMOUNT + 0.7; // 0.7N - const INSUFFICIENT_BALANCE_LIMIT = ADDITIONAL_AMOUNT + 0.3; // 0.3N + const LOW_BALANCE_LIMIT = 0.7; // 0.7N + const INSUFFICIENT_BALANCE_LIMIT = 0.3; // 0.3N const profile = Social.getr(`${accountId}/profile`); const name = profile.name ?? accountId; diff --git a/instances/treasury-devdao.near/widget/components/InsufficientBannerModal.jsx b/instances/treasury-devdao.near/widget/components/InsufficientBannerModal.jsx index 108886da..3884b7ae 100644 --- a/instances/treasury-devdao.near/widget/components/InsufficientBannerModal.jsx +++ b/instances/treasury-devdao.near/widget/components/InsufficientBannerModal.jsx @@ -56,8 +56,10 @@ const WarningModal = () => ( Hey {name}, you don't have enough NEAR to complete actions on your - treasury. You need at least {INSUFFICIENT_BALANCE_LIMIT}. Please add more - funds to your account and try again. + treasury. You need at least {INSUFFICIENT_BALANCE_LIMIT}N{" "} + {checkForDeposit && + ", which includes the proposal bond needed to create a proposal"} + . Please add more funds to your account and try again. );