From 031f91df4fb48e5953383046150c6d072367ad57 Mon Sep 17 00:00:00 2001 From: saguero Date: Fri, 2 Sep 2022 17:28:36 -0300 Subject: [PATCH 01/60] fix typo --- front/constants/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/constants/index.tsx b/front/constants/index.tsx index fa52829..5682e59 100644 --- a/front/constants/index.tsx +++ b/front/constants/index.tsx @@ -13,7 +13,7 @@ export const MODAL_TEXT = { UNLOCK: { CONFIRM: { title: `Start unlocking`, - text: `Are you sure you want to start unlocking this position? Your tokens will be releases when the locking period ends.` + text: `Are you sure you want to start unlocking this position? Your tokens will be released when the locking period ends.` }, ERROR_NOT_ENOUGH: { title: `Not Enough Available Voting Power`, From 207fe9f986bbd6a38ed33c0f34819a4f31edc095 Mon Sep 17 00:00:00 2001 From: the-preem-palver Date: Sat, 3 Sep 2022 16:38:15 -0300 Subject: [PATCH 02/60] fix typo --- front/pages/components/MyDashboard/ListingVotes.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/pages/components/MyDashboard/ListingVotes.tsx b/front/pages/components/MyDashboard/ListingVotes.tsx index ecbca30..144c67e 100644 --- a/front/pages/components/MyDashboard/ListingVotes.tsx +++ b/front/pages/components/MyDashboard/ListingVotes.tsx @@ -114,7 +114,7 @@ const ListingVotes = () => { You didn’t vote anything yet. ) From 52ae9d66fd85b1e3109dc245c34e92183a1c5d67 Mon Sep 17 00:00:00 2001 From: the-preem-palver Date: Sat, 3 Sep 2022 17:32:12 -0300 Subject: [PATCH 03/60] make env=development the default if no env values --- front/constants/index.tsx | 2 +- front/contexts/WalletSelectorContext.tsx | 2 +- front/lib/near.ts | 10 +- .../components/MyDashboard/DashHeader.tsx | 4 +- front/yarn.lock | 1184 +---------------- 5 files changed, 25 insertions(+), 1177 deletions(-) diff --git a/front/constants/index.tsx b/front/constants/index.tsx index fa52829..664ad92 100644 --- a/front/constants/index.tsx +++ b/front/constants/index.tsx @@ -1,5 +1,5 @@ - export const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS_METAVOTE; +export const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS_METAVOTE||"metayield.app"; export const enum ACTION_TYPE { RELOCK, diff --git a/front/contexts/WalletSelectorContext.tsx b/front/contexts/WalletSelectorContext.tsx index 1d469f3..98052a9 100644 --- a/front/contexts/WalletSelectorContext.tsx +++ b/front/contexts/WalletSelectorContext.tsx @@ -33,7 +33,7 @@ const WalletSelectorContext = React.createContext(null); export const WalletSelectorContextProvider: React.FC = ({ children }) => { - const env = process.env.NEXT_PUBLIC_VERCEL_ENV || "production"; + const env = process.env.NEXT_PUBLIC_VERCEL_ENV || "development"; const nearConfig = getConfig(env); const [selector, setSelector] = useState(null); const [modal, setModal] = useState(null); diff --git a/front/lib/near.ts b/front/lib/near.ts index 648c568..ecebf2c 100644 --- a/front/lib/near.ts +++ b/front/lib/near.ts @@ -30,14 +30,14 @@ import { yton, } from "./util"; -export const CONTRACT_ID = process.env.NEXT_PUBLIC_CONTRACT_ID; +export const CONTRACT_ID = process.env.NEXT_PUBLIC_CONTRACT_ID||"metavote.testnet"; +const env = process.env.NEXT_PUBLIC_VERCEL_ENV || 'development'; export const NETWORK_ID = process.env.NEXT_PUBLIC_VERCEL_ENV == 'production' ? 'mainnet' : 'testnet'; -export const METAPOOL_CONTRACT_ID = process.env.NEXT_PUBLIC_METAPOOL_CONTRACT_ID; -export const META_CONTRACT_ID = process.env.NEXT_PUBLIC_META_CONTRACT_ID; +export const METAPOOL_CONTRACT_ID = process.env.NEXT_PUBLIC_METAPOOL_CONTRACT_ID||"metavote.testnet"; +export const META_CONTRACT_ID = process.env.NEXT_PUBLIC_META_CONTRACT_ID||"meta-v2.pool.testnet"; export const gas = new BN("70000000000000"); export const GAS = "200000000000000"; -const env = process.env.NEXT_PUBLIC_VERCEL_ENV || 'production'; const nearConfig = getConfig(env); const provider = new providers.JsonRpcProvider({ url: nearConfig.nodeUrl }); @@ -149,6 +149,7 @@ export const getMetapoolAccountInfo = async () => { export const getMetaTokenAccountInfo = async () => { const account_id = window.account_id; + if (!account_id) return 0; return callViewMetaTokenMethod( metaTokenMethods.getMetas, { account_id: account_id, }); @@ -301,6 +302,7 @@ const callViewMetapoolMethod = async (method: string, args: any) => { }; */ const callViewMetaTokenMethod = async (method: string, args: any) => { + console.log("view",META_CONTRACT_ID, JSON.stringify(args)) const response: any = await provider.query({ request_type: "call_function", finality: "optimistic", diff --git a/front/pages/components/MyDashboard/DashHeader.tsx b/front/pages/components/MyDashboard/DashHeader.tsx index dd499a2..0a0444b 100644 --- a/front/pages/components/MyDashboard/DashHeader.tsx +++ b/front/pages/components/MyDashboard/DashHeader.tsx @@ -118,14 +118,14 @@ const DashboardHeader = () => { - + {yton(voterData.votingPower)} - +