From 2ee008ffb6986960f08afbd8b180696dbf0db879 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Mon, 13 Dec 2021 22:20:49 +0000 Subject: [PATCH 01/25] set up Settings component --- nym-wallet/src/components/AdminForm.tsx | 24 +++------ nym-wallet/src/components/AppBar.tsx | 71 +++++++++---------------- nym-wallet/src/components/NymCard.tsx | 2 +- nym-wallet/src/components/Settings.tsx | 44 +++++++++++++++ nym-wallet/src/components/index.ts | 1 + nym-wallet/src/context/main.tsx | 10 +++- nym-wallet/src/index.tsx | 3 +- 7 files changed, 86 insertions(+), 69 deletions(-) create mode 100644 nym-wallet/src/components/Settings.tsx diff --git a/nym-wallet/src/components/AdminForm.tsx b/nym-wallet/src/components/AdminForm.tsx index a4f08d00c1b..f5f79aedabe 100644 --- a/nym-wallet/src/components/AdminForm.tsx +++ b/nym-wallet/src/components/AdminForm.tsx @@ -1,26 +1,16 @@ import React, { useContext, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' -import { - Backdrop, - Box, - Button, - CircularProgress, - FormControl, - Grid, - Paper, - Slide, - TextField, -} from '@mui/material' +import { Backdrop, Box, Button, CircularProgress, FormControl, Grid, Paper, Slide, TextField } from '@mui/material' import { ClientContext } from '../context/main' import { NymCard } from '.' import { getContractParams, setContractParams } from '../requests' -import { TauriStateParams } from '../types' +import { TauriContractStateParams } from '../types' export const Admin: React.FC = () => { const { showAdmin, handleShowAdmin } = useContext(ClientContext) const [isLoading, setIsLoading] = useState(false) - const [params, setParams] = useState() + const [params, setParams] = useState() const onCancel = () => { setParams(undefined) @@ -50,9 +40,7 @@ export const Admin: React.FC = () => { )} - {!isLoading && params && ( - - )} + {!isLoading && params && } @@ -61,7 +49,7 @@ export const Admin: React.FC = () => { } const AdminForm: React.FC<{ - params: TauriStateParams + params: TauriContractStateParams onCancel: () => void }> = ({ params, onCancel }) => { const { @@ -70,7 +58,7 @@ const AdminForm: React.FC<{ formState: { errors, isSubmitting }, } = useForm({ defaultValues: { ...params } }) - const onSubmit = async (data: TauriStateParams) => { + const onSubmit = async (data: TauriContractStateParams) => { await setContractParams(data) console.log(data) onCancel() diff --git a/nym-wallet/src/components/AppBar.tsx b/nym-wallet/src/components/AppBar.tsx index e6274b9ccb2..f2437d2c56f 100644 --- a/nym-wallet/src/components/AppBar.tsx +++ b/nym-wallet/src/components/AppBar.tsx @@ -1,69 +1,51 @@ import React, { useContext, useEffect } from 'react' -import { - AppBar as MuiAppBar, - Divider, - Grid, - IconButton, - Toolbar, - Typography, - useMediaQuery, -} from '@mui/material' +import { AppBar as MuiAppBar, Divider, Grid, IconButton, Toolbar, Typography, useMediaQuery } from '@mui/material' import { Box } from '@mui/system' -import { Logout } from '@mui/icons-material' +import { Logout, SettingsOutlined } from '@mui/icons-material' import { ClientContext } from '../context/main' import { CopyToClipboard } from '.' export const AppBar = () => { - const { userBalance, logOut, clientDetails } = useContext(ClientContext) + const { userBalance, clientDetails, showSettings, logOut, handleShowSettings } = useContext(ClientContext) const matches = useMediaQuery('(min-width: 769px)') return ( - + - + - + {matches && ( <> - + - } + Action={} /> )} - - - - + + + + + + + + + + + @@ -81,12 +63,7 @@ const AppBarItem: React.FC<{ {primaryText}: {' '} - + {secondaryText} {Action} diff --git a/nym-wallet/src/components/NymCard.tsx b/nym-wallet/src/components/NymCard.tsx index 0d481523fde..cada3e8cf59 100644 --- a/nym-wallet/src/components/NymCard.tsx +++ b/nym-wallet/src/components/NymCard.tsx @@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader } from '@mui/material' import { styled } from '@mui/material/styles' export const NymCard: React.FC<{ - title: string + title: string | React.ReactElement subheader?: string Action?: React.ReactNode noPadding?: boolean diff --git a/nym-wallet/src/components/Settings.tsx b/nym-wallet/src/components/Settings.tsx new file mode 100644 index 00000000000..df5b8fe4545 --- /dev/null +++ b/nym-wallet/src/components/Settings.tsx @@ -0,0 +1,44 @@ +import React, { useContext, useState } from 'react' +import { Box, Dialog, Slide, Tab, Tabs, Typography } from '@mui/material' +import { SettingsOutlined } from '@mui/icons-material' +import { NymCard } from '.' +import { ClientContext } from '../context/main' + +const tabs = ['Profile', 'System variable', 'Node stats'] + +export const Settings = () => { + const { showSettings, handleShowSettings } = useContext(ClientContext) + const [selectedTab, setSelectedTab] = useState(0) + + const handleTabChange = (event: React.SyntheticEvent, newTab: number) => setSelectedTab(newTab) + + return showSettings ? ( + + + Settings + + } + noPadding + > + <> + + Node settings + + + {tabs.map((tabName, index) => ( + + ))} + + + + + ) : null +} diff --git a/nym-wallet/src/components/index.ts b/nym-wallet/src/components/index.ts index a114809182c..5afbe81eb6a 100644 --- a/nym-wallet/src/components/index.ts +++ b/nym-wallet/src/components/index.ts @@ -8,3 +8,4 @@ export * from './RequestStatus' export * from './NoClientError' export * from './SuccessResponse' export * from './TransactionDetails' +export * from './Settings' diff --git a/nym-wallet/src/context/main.tsx b/nym-wallet/src/context/main.tsx index ad11e6f0909..71a215aea9a 100644 --- a/nym-wallet/src/context/main.tsx +++ b/nym-wallet/src/context/main.tsx @@ -9,10 +9,12 @@ export const urls = { } type TClientContext = { + mode: 'light' | 'dark' clientDetails?: TClientDetails userBalance: TUseuserBalance showAdmin: boolean - mode: 'light' | 'dark' + showSettings: boolean + handleShowSettings: () => void handleShowAdmin: () => void logIn: (clientDetails: TSignInWithMnemonic) => void logOut: () => void @@ -23,6 +25,7 @@ export const ClientContext = createContext({} as TClientContext) export const ClientContextProvider = ({ children }: { children: React.ReactNode }) => { const [clientDetails, setClientDetails] = useState() const [showAdmin, setShowAdmin] = useState(false) + const [showSettings, setShowSettings] = useState(false) const [mode, setMode] = useState<'light' | 'dark'>('light') const history = useHistory() @@ -45,14 +48,17 @@ export const ClientContextProvider = ({ children }: { children: React.ReactNode } const handleShowAdmin = () => setShowAdmin((show) => !show) + const handleShowSettings = () => setShowSettings((show) => !show) return ( { @@ -17,6 +17,7 @@ const App = () => { ) : ( + From 2389cdbfebd207657305f18e4c1a2ab6f9702160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C8=99u?= Date: Wed, 8 Dec 2021 17:02:30 +0200 Subject: [PATCH 02/25] Update network defaults --- common/network-defaults/src/lib.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/common/network-defaults/src/lib.rs b/common/network-defaults/src/lib.rs index 53011af603b..f0132990d00 100644 --- a/common/network-defaults/src/lib.rs +++ b/common/network-defaults/src/lib.rs @@ -39,13 +39,10 @@ impl ValidatorDetails { } pub fn default_validators() -> Vec { - vec![ - ValidatorDetails::new( - "https://testnet-milhon-validator1.nymtech.net", - Some("https://testnet-milhon-validator1.nymtech.net/api"), - ), - ValidatorDetails::new("https://testnet-milhon-validator2.nymtech.net", None), - ] + vec![ValidatorDetails::new( + "https://sandbox-validator.nymtech.net", + Some("https://sandbox-validator.nymtech.net/api"), + )] } pub fn default_nymd_endpoints() -> Vec { @@ -62,9 +59,9 @@ pub fn default_api_endpoints() -> Vec { .collect() } -pub const DEFAULT_MIXNET_CONTRACT_ADDRESS: &str = "punk10pyejy66429refv3g35g2t7am0was7yalwrzen"; -pub const DEFAULT_VESTING_CONTRACT_ADDRESS: &str = ""; -pub const REWARDING_VALIDATOR_ADDRESS: &str = "punk1v9qauwdq5terag6uvfsdytcs2d0sdmfdy7hgk3"; +pub const DEFAULT_MIXNET_CONTRACT_ADDRESS: &str = "tnym14hj2tavq8fpesdwxxcu44rty3hh90vhu5ksfyn"; +pub const DEFAULT_VESTING_CONTRACT_ADDRESS: &str = "tnym17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9epkgzu"; +pub const REWARDING_VALIDATOR_ADDRESS: &str = "tnym1y2hv6t02f99jws8u6esyhen8jy4x4vq703eqkh"; /// How much bandwidth (in bytes) one token can buy const BYTES_PER_TOKEN: u64 = 1024 * 1024 * 1024; @@ -77,7 +74,7 @@ pub const BANDWIDTH_VALUE: u64 = TOKENS_TO_BURN * BYTES_PER_TOKEN; pub const ETH_CONTRACT_ADDRESS: [u8; 20] = hex_literal::hex!("9fEE3e28c17dbB87310A51F13C4fbf4331A6f102"); pub const ETH_MIN_BLOCK_DEPTH: usize = 7; -pub const COSMOS_CONTRACT_ADDRESS: &str = "punk1jld76tqw4wnpfenmay2xkv86nr3j0w426eka82"; +pub const COSMOS_CONTRACT_ADDRESS: &str = "tnym1nc5tatafv6eyq7llkr2gv50ff9e22mnf3r3jqq"; // Name of the event triggered by the eth contract. If the event name is changed, // this would also need to be changed; It is currently tested against the json abi pub const ETH_EVENT_NAME: &str = "Burned"; @@ -85,8 +82,8 @@ pub const ETH_BURN_FUNCTION_NAME: &str = "burnTokenForAccessCode"; /// Defaults Cosmos Hub/ATOM path pub const COSMOS_DERIVATION_PATH: &str = "m/44'/118'/0'/0/0"; -pub const BECH32_PREFIX: &str = "punk"; -pub const DENOM: &str = "upunk"; +pub const BECH32_PREFIX: &str = "nymt"; +pub const DENOM: &str = "unymt"; // as set by validators in their configs // (note that the 'amount' postfix is relevant here as the full gas price also includes denom) pub const GAS_PRICE_AMOUNT: f64 = 0.025; From 60d0f66ab15c9691c96640d0400ab911ca5b3be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C8=99u?= Date: Fri, 10 Dec 2021 16:35:00 +0200 Subject: [PATCH 03/25] Short node identity signature check Fix tests --- common/client-libs/validator-client/src/nymd/wallet/mod.rs | 6 +++--- contracts/mixnet/src/support/helpers.rs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/client-libs/validator-client/src/nymd/wallet/mod.rs b/common/client-libs/validator-client/src/nymd/wallet/mod.rs index cd07361e791..28539240124 100644 --- a/common/client-libs/validator-client/src/nymd/wallet/mod.rs +++ b/common/client-libs/validator-client/src/nymd/wallet/mod.rs @@ -207,9 +207,9 @@ mod tests { fn generating_account_addresses() { // test vectors produced from our js wallet let mnemonic_address = vec![ - ("crush minute paddle tobacco message debate cabin peace bar jacket execute twenty winner view sure mask popular couch penalty fragile demise fresh pizza stove", "punk1jw6mp7d5xqc7w6xm79lha27glmd0vdt32a3fj2"), - ("acquire rebel spot skin gun such erupt pull swear must define ill chief turtle today flower chunk truth battle claw rigid detail gym feel", "punk1h5hgn94nsq4kh99rjj794hr5h5q6yfm22mcqqn"), - ("step income throw wheat mobile ship wave drink pool sudden upset jaguar bar globe rifle spice frost bless glimpse size regular carry aspect ball", "punk17n9flp6jflljg6fp05dsy07wcprf2uuujse962") + ("crush minute paddle tobacco message debate cabin peace bar jacket execute twenty winner view sure mask popular couch penalty fragile demise fresh pizza stove", "nymt1jw6mp7d5xqc7w6xm79lha27glmd0vdt339me94"), + ("acquire rebel spot skin gun such erupt pull swear must define ill chief turtle today flower chunk truth battle claw rigid detail gym feel", "nymt1h5hgn94nsq4kh99rjj794hr5h5q6yfm23rjshv"), + ("step income throw wheat mobile ship wave drink pool sudden upset jaguar bar globe rifle spice frost bless glimpse size regular carry aspect ball", "nymt17n9flp6jflljg6fp05dsy07wcprf2uuufgn4d4") ]; for (mnemonic, address) in mnemonic_address.into_iter() { diff --git a/contracts/mixnet/src/support/helpers.rs b/contracts/mixnet/src/support/helpers.rs index a5994b42d20..8513636da50 100644 --- a/contracts/mixnet/src/support/helpers.rs +++ b/contracts/mixnet/src/support/helpers.rs @@ -47,12 +47,15 @@ pub(crate) fn ensure_no_existing_bond( Ok(()) } +#[allow(unreachable_code)] +#[allow(unused_variables)] pub(crate) fn validate_node_identity_signature( deps: Deps, owner: &Addr, signature: String, identity: IdentityKeyRef, ) -> Result<(), ContractError> { + return Ok(()); let owner_bytes = owner.as_bytes(); let mut identity_bytes = [0u8; 32]; @@ -96,6 +99,7 @@ mod tests { use rand_chacha::rand_core::SeedableRng; #[test] + #[ignore] fn validating_node_signature() { let deps = mock_dependencies(); From 47946ad79e9e4089a4e2f87ae99317600b71debb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C8=99u?= Date: Mon, 13 Dec 2021 18:43:53 +0200 Subject: [PATCH 04/25] Do not set proxy only for this time --- contracts/mixnet/src/delegations/transactions.rs | 9 +-------- contracts/mixnet/src/gateways/transactions.rs | 12 ++---------- contracts/mixnet/src/mixnodes/transactions.rs | 12 ++---------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/contracts/mixnet/src/delegations/transactions.rs b/contracts/mixnet/src/delegations/transactions.rs index 355284f86c3..e9a40b9b371 100644 --- a/contracts/mixnet/src/delegations/transactions.rs +++ b/contracts/mixnet/src/delegations/transactions.rs @@ -56,14 +56,7 @@ pub(crate) fn try_delegate_to_mixnode_on_behalf( // check if the delegation contains any funds of the appropriate denomination let amount = validate_delegation_stake(info.funds)?; - _try_delegate_to_mixnode( - deps, - env, - mix_identity, - &delegate, - amount, - Some(info.sender), - ) + _try_delegate_to_mixnode(deps, env, mix_identity, &delegate, amount, None) } pub(crate) fn _try_delegate_to_mixnode( diff --git a/contracts/mixnet/src/gateways/transactions.rs b/contracts/mixnet/src/gateways/transactions.rs index 15977191b47..0bd6439387f 100644 --- a/contracts/mixnet/src/gateways/transactions.rs +++ b/contracts/mixnet/src/gateways/transactions.rs @@ -52,16 +52,8 @@ pub fn try_add_gateway_on_behalf( .minimum_mixnode_pledge; let pledge = validate_gateway_pledge(info.funds, minimum_pledge)?; - let proxy = info.sender; - _try_add_gateway( - deps, - env, - gateway, - pledge, - &owner, - owner_signature, - Some(proxy), - ) + let _proxy = info.sender; + _try_add_gateway(deps, env, gateway, pledge, &owner, owner_signature, None) } pub(crate) fn _try_add_gateway( diff --git a/contracts/mixnet/src/mixnodes/transactions.rs b/contracts/mixnet/src/mixnodes/transactions.rs index 8d5345293ad..fb0f4a2544f 100644 --- a/contracts/mixnet/src/mixnodes/transactions.rs +++ b/contracts/mixnet/src/mixnodes/transactions.rs @@ -54,16 +54,8 @@ pub fn try_add_mixnode_on_behalf( .minimum_mixnode_pledge; let pledge = validate_mixnode_pledge(info.funds, minimum_pledge)?; - let proxy = info.sender; - _try_add_mixnode( - deps, - env, - mix_node, - pledge, - &owner, - owner_signature, - Some(proxy), - ) + let _proxy = info.sender; + _try_add_mixnode(deps, env, mix_node, pledge, &owner, owner_signature, None) } fn _try_add_mixnode( From eeb9be999fced4fff7202b11fd71a031307cfcc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C8=99u?= Date: Tue, 14 Dec 2021 12:33:12 +0200 Subject: [PATCH 05/25] Update contract addresses --- common/network-defaults/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/network-defaults/src/lib.rs b/common/network-defaults/src/lib.rs index f0132990d00..ed6d17da48c 100644 --- a/common/network-defaults/src/lib.rs +++ b/common/network-defaults/src/lib.rs @@ -59,9 +59,9 @@ pub fn default_api_endpoints() -> Vec { .collect() } -pub const DEFAULT_MIXNET_CONTRACT_ADDRESS: &str = "tnym14hj2tavq8fpesdwxxcu44rty3hh90vhu5ksfyn"; -pub const DEFAULT_VESTING_CONTRACT_ADDRESS: &str = "tnym17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9epkgzu"; -pub const REWARDING_VALIDATOR_ADDRESS: &str = "tnym1y2hv6t02f99jws8u6esyhen8jy4x4vq703eqkh"; +pub const DEFAULT_MIXNET_CONTRACT_ADDRESS: &str = "nymt14hj2tavq8fpesdwxxcu44rty3hh90vhuysqrsr"; +pub const DEFAULT_VESTING_CONTRACT_ADDRESS: &str = "nymt1nc5tatafv6eyq7llkr2gv50ff9e22mnfp9pc5s"; +pub const REWARDING_VALIDATOR_ADDRESS: &str = "nymt17zujduc46wvkwvp6f062mm5xhr7jc3fewvqu9e"; /// How much bandwidth (in bytes) one token can buy const BYTES_PER_TOKEN: u64 = 1024 * 1024 * 1024; @@ -74,7 +74,7 @@ pub const BANDWIDTH_VALUE: u64 = TOKENS_TO_BURN * BYTES_PER_TOKEN; pub const ETH_CONTRACT_ADDRESS: [u8; 20] = hex_literal::hex!("9fEE3e28c17dbB87310A51F13C4fbf4331A6f102"); pub const ETH_MIN_BLOCK_DEPTH: usize = 7; -pub const COSMOS_CONTRACT_ADDRESS: &str = "tnym1nc5tatafv6eyq7llkr2gv50ff9e22mnf3r3jqq"; +pub const COSMOS_CONTRACT_ADDRESS: &str = "nymt17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9f8xzkv"; // Name of the event triggered by the eth contract. If the event name is changed, // this would also need to be changed; It is currently tested against the json abi pub const ETH_EVENT_NAME: &str = "Burned"; From 2ae6947768a03dee3e11d9c59357dbd6c2d5d5c0 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Tue, 14 Dec 2021 10:34:28 +0000 Subject: [PATCH 06/25] file restructure --- nym-wallet/src/components/index.ts | 2 -- nym-wallet/src/index.tsx | 5 ++-- .../AdminForm.tsx => pages/Admin/index.tsx} | 8 ++--- .../balance.tsx => pages/balance/index.tsx} | 6 ++-- .../src/{routes => pages}/bond/BondForm.tsx | 0 .../{routes => pages}/bond/SuccessView.tsx | 0 .../src/{routes => pages}/bond/index.tsx | 0 .../bond/validationSchema.ts | 0 .../delegate/DelegateForm.tsx | 0 .../delegate/SuccessView.tsx | 0 .../src/{routes => pages}/delegate/index.tsx | 0 .../delegate/validationSchema.ts | 0 nym-wallet/src/pages/index.ts | 11 +++++++ .../internal-docs/ApiList.tsx | 0 .../internal-docs/DocEntry.tsx | 0 .../{routes => pages}/internal-docs/index.tsx | 0 .../receive.tsx => pages/receive/index.tsx} | 29 ++++--------------- .../send/SendConfirmation.tsx | 0 .../src/{routes => pages}/send/SendError.tsx | 0 .../src/{routes => pages}/send/SendForm.tsx | 0 .../src/{routes => pages}/send/SendReview.tsx | 0 .../src/{routes => pages}/send/SendWizard.tsx | 0 .../src/{routes => pages}/send/index.tsx | 0 .../send/validationSchema.ts | 0 .../Settings.tsx => pages/settings/index.tsx} | 6 ++-- .../sign-in/create-account.tsx | 0 .../src/{routes => pages}/sign-in/index.tsx | 0 .../src/{routes => pages}/sign-in/sign-in.tsx | 0 .../src/{routes => pages}/unbond/index.tsx | 0 .../undelegate/UndelegateForm.tsx | 0 .../{routes => pages}/undelegate/index.tsx | 0 .../undelegate/validationSchema.ts | 0 nym-wallet/src/routes/404.tsx | 12 -------- nym-wallet/src/routes/check-delegation.tsx | 0 nym-wallet/src/routes/index.tsx | 14 ++------- 35 files changed, 32 insertions(+), 61 deletions(-) rename nym-wallet/src/{components/AdminForm.tsx => pages/Admin/index.tsx} (96%) rename nym-wallet/src/{routes/balance.tsx => pages/balance/index.tsx} (91%) rename nym-wallet/src/{routes => pages}/bond/BondForm.tsx (100%) rename nym-wallet/src/{routes => pages}/bond/SuccessView.tsx (100%) rename nym-wallet/src/{routes => pages}/bond/index.tsx (100%) rename nym-wallet/src/{routes => pages}/bond/validationSchema.ts (100%) rename nym-wallet/src/{routes => pages}/delegate/DelegateForm.tsx (100%) rename nym-wallet/src/{routes => pages}/delegate/SuccessView.tsx (100%) rename nym-wallet/src/{routes => pages}/delegate/index.tsx (100%) rename nym-wallet/src/{routes => pages}/delegate/validationSchema.ts (100%) create mode 100644 nym-wallet/src/pages/index.ts rename nym-wallet/src/{routes => pages}/internal-docs/ApiList.tsx (100%) rename nym-wallet/src/{routes => pages}/internal-docs/DocEntry.tsx (100%) rename nym-wallet/src/{routes => pages}/internal-docs/index.tsx (100%) rename nym-wallet/src/{routes/receive.tsx => pages/receive/index.tsx} (74%) rename nym-wallet/src/{routes => pages}/send/SendConfirmation.tsx (100%) rename nym-wallet/src/{routes => pages}/send/SendError.tsx (100%) rename nym-wallet/src/{routes => pages}/send/SendForm.tsx (100%) rename nym-wallet/src/{routes => pages}/send/SendReview.tsx (100%) rename nym-wallet/src/{routes => pages}/send/SendWizard.tsx (100%) rename nym-wallet/src/{routes => pages}/send/index.tsx (100%) rename nym-wallet/src/{routes => pages}/send/validationSchema.ts (100%) rename nym-wallet/src/{components/Settings.tsx => pages/settings/index.tsx} (89%) rename nym-wallet/src/{routes => pages}/sign-in/create-account.tsx (100%) rename nym-wallet/src/{routes => pages}/sign-in/index.tsx (100%) rename nym-wallet/src/{routes => pages}/sign-in/sign-in.tsx (100%) rename nym-wallet/src/{routes => pages}/unbond/index.tsx (100%) rename nym-wallet/src/{routes => pages}/undelegate/UndelegateForm.tsx (100%) rename nym-wallet/src/{routes => pages}/undelegate/index.tsx (100%) rename nym-wallet/src/{routes => pages}/undelegate/validationSchema.ts (100%) delete mode 100644 nym-wallet/src/routes/404.tsx delete mode 100644 nym-wallet/src/routes/check-delegation.tsx diff --git a/nym-wallet/src/components/index.ts b/nym-wallet/src/components/index.ts index 5afbe81eb6a..893c9dbafb4 100644 --- a/nym-wallet/src/components/index.ts +++ b/nym-wallet/src/components/index.ts @@ -1,4 +1,3 @@ -export * from './AdminForm' export * from './Error' export * from './CopyToClipboard' export * from './NymCard' @@ -8,4 +7,3 @@ export * from './RequestStatus' export * from './NoClientError' export * from './SuccessResponse' export * from './TransactionDetails' -export * from './Settings' diff --git a/nym-wallet/src/index.tsx b/nym-wallet/src/index.tsx index f5132ae99b6..383d3beab85 100644 --- a/nym-wallet/src/index.tsx +++ b/nym-wallet/src/index.tsx @@ -5,9 +5,10 @@ import { BrowserRouter as Router } from 'react-router-dom' import { Routes } from './routes' import { ClientContext, ClientContextProvider } from './context/main' import { ApplicationLayout } from './layouts' -import { SignIn } from './routes/sign-in/' -import { Admin, ErrorFallback, Settings } from './components' +import { Admin, SignIn } from './pages' +import { ErrorFallback } from './components' import { NymWalletTheme } from './theme' +import { Settings } from './pages' const App = () => { const { clientDetails } = useContext(ClientContext) diff --git a/nym-wallet/src/components/AdminForm.tsx b/nym-wallet/src/pages/Admin/index.tsx similarity index 96% rename from nym-wallet/src/components/AdminForm.tsx rename to nym-wallet/src/pages/Admin/index.tsx index f5f79aedabe..56eeca7c3f6 100644 --- a/nym-wallet/src/components/AdminForm.tsx +++ b/nym-wallet/src/pages/Admin/index.tsx @@ -2,10 +2,10 @@ import React, { useContext, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' import { Backdrop, Box, Button, CircularProgress, FormControl, Grid, Paper, Slide, TextField } from '@mui/material' -import { ClientContext } from '../context/main' -import { NymCard } from '.' -import { getContractParams, setContractParams } from '../requests' -import { TauriContractStateParams } from '../types' +import { ClientContext } from '../../context/main' +import { NymCard } from '../../components' +import { getContractParams, setContractParams } from '../../requests' +import { TauriContractStateParams } from '../../types' export const Admin: React.FC = () => { const { showAdmin, handleShowAdmin } = useContext(ClientContext) diff --git a/nym-wallet/src/routes/balance.tsx b/nym-wallet/src/pages/balance/index.tsx similarity index 91% rename from nym-wallet/src/routes/balance.tsx rename to nym-wallet/src/pages/balance/index.tsx index 5358021b84f..2fe320becf3 100644 --- a/nym-wallet/src/routes/balance.tsx +++ b/nym-wallet/src/pages/balance/index.tsx @@ -1,10 +1,10 @@ import React, { useContext, useEffect } from 'react' import { Alert, Button, Grid, Link, Typography } from '@mui/material' import { OpenInNew } from '@mui/icons-material' -import { NymCard } from '../components' -import { Layout } from '../layouts' +import { NymCard } from '../../components' +import { Layout } from '../../layouts' -import { ClientContext, urls } from '../context/main' +import { ClientContext, urls } from '../../context/main' export const Balance = () => { const { userBalance, clientDetails } = useContext(ClientContext) diff --git a/nym-wallet/src/routes/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx similarity index 100% rename from nym-wallet/src/routes/bond/BondForm.tsx rename to nym-wallet/src/pages/bond/BondForm.tsx diff --git a/nym-wallet/src/routes/bond/SuccessView.tsx b/nym-wallet/src/pages/bond/SuccessView.tsx similarity index 100% rename from nym-wallet/src/routes/bond/SuccessView.tsx rename to nym-wallet/src/pages/bond/SuccessView.tsx diff --git a/nym-wallet/src/routes/bond/index.tsx b/nym-wallet/src/pages/bond/index.tsx similarity index 100% rename from nym-wallet/src/routes/bond/index.tsx rename to nym-wallet/src/pages/bond/index.tsx diff --git a/nym-wallet/src/routes/bond/validationSchema.ts b/nym-wallet/src/pages/bond/validationSchema.ts similarity index 100% rename from nym-wallet/src/routes/bond/validationSchema.ts rename to nym-wallet/src/pages/bond/validationSchema.ts diff --git a/nym-wallet/src/routes/delegate/DelegateForm.tsx b/nym-wallet/src/pages/delegate/DelegateForm.tsx similarity index 100% rename from nym-wallet/src/routes/delegate/DelegateForm.tsx rename to nym-wallet/src/pages/delegate/DelegateForm.tsx diff --git a/nym-wallet/src/routes/delegate/SuccessView.tsx b/nym-wallet/src/pages/delegate/SuccessView.tsx similarity index 100% rename from nym-wallet/src/routes/delegate/SuccessView.tsx rename to nym-wallet/src/pages/delegate/SuccessView.tsx diff --git a/nym-wallet/src/routes/delegate/index.tsx b/nym-wallet/src/pages/delegate/index.tsx similarity index 100% rename from nym-wallet/src/routes/delegate/index.tsx rename to nym-wallet/src/pages/delegate/index.tsx diff --git a/nym-wallet/src/routes/delegate/validationSchema.ts b/nym-wallet/src/pages/delegate/validationSchema.ts similarity index 100% rename from nym-wallet/src/routes/delegate/validationSchema.ts rename to nym-wallet/src/pages/delegate/validationSchema.ts diff --git a/nym-wallet/src/pages/index.ts b/nym-wallet/src/pages/index.ts new file mode 100644 index 00000000000..1d0690888c4 --- /dev/null +++ b/nym-wallet/src/pages/index.ts @@ -0,0 +1,11 @@ +export * from './Admin' +export * from './balance' +export * from './bond' +export * from './delegate' +export * from './internal-docs' +export * from './receive' +export * from './send' +export * from './sign-in' +export * from './settings' +export * from './unbond' +export * from './undelegate' diff --git a/nym-wallet/src/routes/internal-docs/ApiList.tsx b/nym-wallet/src/pages/internal-docs/ApiList.tsx similarity index 100% rename from nym-wallet/src/routes/internal-docs/ApiList.tsx rename to nym-wallet/src/pages/internal-docs/ApiList.tsx diff --git a/nym-wallet/src/routes/internal-docs/DocEntry.tsx b/nym-wallet/src/pages/internal-docs/DocEntry.tsx similarity index 100% rename from nym-wallet/src/routes/internal-docs/DocEntry.tsx rename to nym-wallet/src/pages/internal-docs/DocEntry.tsx diff --git a/nym-wallet/src/routes/internal-docs/index.tsx b/nym-wallet/src/pages/internal-docs/index.tsx similarity index 100% rename from nym-wallet/src/routes/internal-docs/index.tsx rename to nym-wallet/src/pages/internal-docs/index.tsx diff --git a/nym-wallet/src/routes/receive.tsx b/nym-wallet/src/pages/receive/index.tsx similarity index 74% rename from nym-wallet/src/routes/receive.tsx rename to nym-wallet/src/pages/receive/index.tsx index d29ba1e3f75..66a41cd7920 100644 --- a/nym-wallet/src/routes/receive.tsx +++ b/nym-wallet/src/pages/receive/index.tsx @@ -1,16 +1,9 @@ import React, { useContext } from 'react' import QRCode from 'qrcode.react' -import { - Alert, - Box, - Card, - Grid, - Typography, - useMediaQuery, -} from '@mui/material' -import { CopyToClipboard, NymCard } from '../components' -import { Layout } from '../layouts' -import { ClientContext } from '../context/main' +import { Alert, Box, Card, Grid, Typography, useMediaQuery } from '@mui/material' +import { CopyToClipboard, NymCard } from '../../components' +import { Layout } from '../../layouts' +import { ClientContext } from '../../context/main' export const Receive = () => { const { clientDetails } = useContext(ClientContext) @@ -36,12 +29,7 @@ export const Receive = () => { }} variant="outlined" > - + { }} component="div" > - {clientDetails && ( - - )} + {clientDetails && } diff --git a/nym-wallet/src/routes/send/SendConfirmation.tsx b/nym-wallet/src/pages/send/SendConfirmation.tsx similarity index 100% rename from nym-wallet/src/routes/send/SendConfirmation.tsx rename to nym-wallet/src/pages/send/SendConfirmation.tsx diff --git a/nym-wallet/src/routes/send/SendError.tsx b/nym-wallet/src/pages/send/SendError.tsx similarity index 100% rename from nym-wallet/src/routes/send/SendError.tsx rename to nym-wallet/src/pages/send/SendError.tsx diff --git a/nym-wallet/src/routes/send/SendForm.tsx b/nym-wallet/src/pages/send/SendForm.tsx similarity index 100% rename from nym-wallet/src/routes/send/SendForm.tsx rename to nym-wallet/src/pages/send/SendForm.tsx diff --git a/nym-wallet/src/routes/send/SendReview.tsx b/nym-wallet/src/pages/send/SendReview.tsx similarity index 100% rename from nym-wallet/src/routes/send/SendReview.tsx rename to nym-wallet/src/pages/send/SendReview.tsx diff --git a/nym-wallet/src/routes/send/SendWizard.tsx b/nym-wallet/src/pages/send/SendWizard.tsx similarity index 100% rename from nym-wallet/src/routes/send/SendWizard.tsx rename to nym-wallet/src/pages/send/SendWizard.tsx diff --git a/nym-wallet/src/routes/send/index.tsx b/nym-wallet/src/pages/send/index.tsx similarity index 100% rename from nym-wallet/src/routes/send/index.tsx rename to nym-wallet/src/pages/send/index.tsx diff --git a/nym-wallet/src/routes/send/validationSchema.ts b/nym-wallet/src/pages/send/validationSchema.ts similarity index 100% rename from nym-wallet/src/routes/send/validationSchema.ts rename to nym-wallet/src/pages/send/validationSchema.ts diff --git a/nym-wallet/src/components/Settings.tsx b/nym-wallet/src/pages/settings/index.tsx similarity index 89% rename from nym-wallet/src/components/Settings.tsx rename to nym-wallet/src/pages/settings/index.tsx index df5b8fe4545..4ce4b1f8f70 100644 --- a/nym-wallet/src/components/Settings.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -1,10 +1,10 @@ import React, { useContext, useState } from 'react' import { Box, Dialog, Slide, Tab, Tabs, Typography } from '@mui/material' import { SettingsOutlined } from '@mui/icons-material' -import { NymCard } from '.' -import { ClientContext } from '../context/main' +import { NymCard } from '../../components' +import { ClientContext } from '../../context/main' -const tabs = ['Profile', 'System variable', 'Node stats'] +const tabs = ['Profile', 'System variables', 'Node stats'] export const Settings = () => { const { showSettings, handleShowSettings } = useContext(ClientContext) diff --git a/nym-wallet/src/routes/sign-in/create-account.tsx b/nym-wallet/src/pages/sign-in/create-account.tsx similarity index 100% rename from nym-wallet/src/routes/sign-in/create-account.tsx rename to nym-wallet/src/pages/sign-in/create-account.tsx diff --git a/nym-wallet/src/routes/sign-in/index.tsx b/nym-wallet/src/pages/sign-in/index.tsx similarity index 100% rename from nym-wallet/src/routes/sign-in/index.tsx rename to nym-wallet/src/pages/sign-in/index.tsx diff --git a/nym-wallet/src/routes/sign-in/sign-in.tsx b/nym-wallet/src/pages/sign-in/sign-in.tsx similarity index 100% rename from nym-wallet/src/routes/sign-in/sign-in.tsx rename to nym-wallet/src/pages/sign-in/sign-in.tsx diff --git a/nym-wallet/src/routes/unbond/index.tsx b/nym-wallet/src/pages/unbond/index.tsx similarity index 100% rename from nym-wallet/src/routes/unbond/index.tsx rename to nym-wallet/src/pages/unbond/index.tsx diff --git a/nym-wallet/src/routes/undelegate/UndelegateForm.tsx b/nym-wallet/src/pages/undelegate/UndelegateForm.tsx similarity index 100% rename from nym-wallet/src/routes/undelegate/UndelegateForm.tsx rename to nym-wallet/src/pages/undelegate/UndelegateForm.tsx diff --git a/nym-wallet/src/routes/undelegate/index.tsx b/nym-wallet/src/pages/undelegate/index.tsx similarity index 100% rename from nym-wallet/src/routes/undelegate/index.tsx rename to nym-wallet/src/pages/undelegate/index.tsx diff --git a/nym-wallet/src/routes/undelegate/validationSchema.ts b/nym-wallet/src/pages/undelegate/validationSchema.ts similarity index 100% rename from nym-wallet/src/routes/undelegate/validationSchema.ts rename to nym-wallet/src/pages/undelegate/validationSchema.ts diff --git a/nym-wallet/src/routes/404.tsx b/nym-wallet/src/routes/404.tsx deleted file mode 100644 index 6503774f853..00000000000 --- a/nym-wallet/src/routes/404.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import { Layout } from '../layouts' - -export const NotFound = () => { - return ( - - <> -

404

- -
- ) -} diff --git a/nym-wallet/src/routes/check-delegation.tsx b/nym-wallet/src/routes/check-delegation.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/nym-wallet/src/routes/index.tsx b/nym-wallet/src/routes/index.tsx index c4730f00fa9..41ceff7d8c5 100644 --- a/nym-wallet/src/routes/index.tsx +++ b/nym-wallet/src/routes/index.tsx @@ -1,14 +1,7 @@ import React from 'react' import { Switch, Route } from 'react-router-dom' -import { NotFound } from './404' -import { Balance } from './balance' -import { Bond } from './bond' -import { Delegate } from './delegate' -import { Receive } from './receive' -import { Send } from './send' -import { Unbond } from './unbond' -import { Undelegate } from './undelegate' -import { InternalDocs } from './internal-docs' +import { Balance } from '../pages/balance' +import { Bond, Delegate, InternalDocs, Receive, Send, Unbond, Undelegate } from '../pages' export const Routes = () => ( @@ -36,8 +29,5 @@ export const Routes = () => ( - - - ) From 964ee9fd16c3c62ae02e4da1b2fd84b71bc50084 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Tue, 14 Dec 2021 10:40:48 +0000 Subject: [PATCH 07/25] file updates --- nym-wallet/src/pages/{Admin => admin}/index.tsx | 0 nym-wallet/src/pages/index.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename nym-wallet/src/pages/{Admin => admin}/index.tsx (100%) diff --git a/nym-wallet/src/pages/Admin/index.tsx b/nym-wallet/src/pages/admin/index.tsx similarity index 100% rename from nym-wallet/src/pages/Admin/index.tsx rename to nym-wallet/src/pages/admin/index.tsx diff --git a/nym-wallet/src/pages/index.ts b/nym-wallet/src/pages/index.ts index 1d0690888c4..ddc6c248dab 100644 --- a/nym-wallet/src/pages/index.ts +++ b/nym-wallet/src/pages/index.ts @@ -1,4 +1,4 @@ -export * from './Admin' +export * from './admin' export * from './balance' export * from './bond' export * from './delegate' From 62269a74b55166a05581b569e662bca294f58b37 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Tue, 14 Dec 2021 13:16:46 +0000 Subject: [PATCH 08/25] add settings tab panels --- .../src/pages/{admin => Admin}/index.tsx | 0 nym-wallet/src/pages/index.ts | 2 +- nym-wallet/src/pages/settings/index.tsx | 23 ++++++++------- nym-wallet/src/pages/settings/node-stats.tsx | 5 ++++ nym-wallet/src/pages/settings/overview.tsx | 13 +++++++++ nym-wallet/src/pages/settings/profile.tsx | 5 ++++ .../src/pages/settings/system-variables.tsx | 5 ++++ nym-wallet/src/pages/settings/tabs.tsx | 28 +++++++++++++++++++ 8 files changed, 68 insertions(+), 13 deletions(-) rename nym-wallet/src/pages/{admin => Admin}/index.tsx (100%) create mode 100644 nym-wallet/src/pages/settings/node-stats.tsx create mode 100644 nym-wallet/src/pages/settings/overview.tsx create mode 100644 nym-wallet/src/pages/settings/profile.tsx create mode 100644 nym-wallet/src/pages/settings/system-variables.tsx create mode 100644 nym-wallet/src/pages/settings/tabs.tsx diff --git a/nym-wallet/src/pages/admin/index.tsx b/nym-wallet/src/pages/Admin/index.tsx similarity index 100% rename from nym-wallet/src/pages/admin/index.tsx rename to nym-wallet/src/pages/Admin/index.tsx diff --git a/nym-wallet/src/pages/index.ts b/nym-wallet/src/pages/index.ts index ddc6c248dab..1d0690888c4 100644 --- a/nym-wallet/src/pages/index.ts +++ b/nym-wallet/src/pages/index.ts @@ -1,4 +1,4 @@ -export * from './admin' +export * from './Admin' export * from './balance' export * from './bond' export * from './delegate' diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 4ce4b1f8f70..90ec953c4c6 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -1,8 +1,12 @@ import React, { useContext, useState } from 'react' -import { Box, Dialog, Slide, Tab, Tabs, Typography } from '@mui/material' +import { Box, Dialog, Typography } from '@mui/material' import { SettingsOutlined } from '@mui/icons-material' import { NymCard } from '../../components' import { ClientContext } from '../../context/main' +import { TabPanel, Tabs } from './tabs' +import { Profile } from './profile' +import { SystemVariables } from './system-variables' +import { NodeStats } from './node-stats' const tabs = ['Profile', 'System variables', 'Node stats'] @@ -26,17 +30,12 @@ export const Settings = () => { Node settings - - {tabs.map((tabName, index) => ( - - ))} - + + + {selectedTab === 0 && } + {selectedTab === 1 && } + {selectedTab === 2 && } + diff --git a/nym-wallet/src/pages/settings/node-stats.tsx b/nym-wallet/src/pages/settings/node-stats.tsx new file mode 100644 index 00000000000..6c680641534 --- /dev/null +++ b/nym-wallet/src/pages/settings/node-stats.tsx @@ -0,0 +1,5 @@ +import React from 'react' + +export const NodeStats = () => { + return

Node Stats

+} diff --git a/nym-wallet/src/pages/settings/overview.tsx b/nym-wallet/src/pages/settings/overview.tsx new file mode 100644 index 00000000000..aa155f19f8f --- /dev/null +++ b/nym-wallet/src/pages/settings/overview.tsx @@ -0,0 +1,13 @@ +import React from 'react' +import { Divider, Stack, Typography } from '@mui/material' +import { CheckCircleOutline } from '@mui/icons-material' + +export const Overview = () => ( + + Node identity 94oh6aU4myLjDusK6QeTWEPUc3nm4vYPCsKkdcjYhRLd + + Mixnode is Active this epoch + + + +) diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx new file mode 100644 index 00000000000..94695a7c1f8 --- /dev/null +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -0,0 +1,5 @@ +import React from 'react' + +export const Profile = () => { + return

Profile

+} diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx new file mode 100644 index 00000000000..ef436e0b963 --- /dev/null +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -0,0 +1,5 @@ +import React from 'react' + +export const SystemVariables = () => { + return

System Variables

+} diff --git a/nym-wallet/src/pages/settings/tabs.tsx b/nym-wallet/src/pages/settings/tabs.tsx new file mode 100644 index 00000000000..50cc7809fa5 --- /dev/null +++ b/nym-wallet/src/pages/settings/tabs.tsx @@ -0,0 +1,28 @@ +import React from 'react' +import { Box } from '@mui/system' +import { Tab, Tabs as MuiTabs } from '@mui/material' +import { Overview } from './overview' + +export const Tabs: React.FC<{ + tabs: string[] + selectedTab: number + onChange: (event: React.SyntheticEvent, tab: number) => void +}> = ({ tabs, selectedTab, onChange }) => ( + + {tabs.map((tabName, index) => ( + + ))} + +) + +export const TabPanel: React.FC = ({ children }) => ( + + + {children} + +) From 0775c25c3c538ac7fac991a44dc0f33563b5cb4c Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 11:13:13 +0000 Subject: [PATCH 09/25] update them color for nym fee --- nym-wallet/src/context/main.tsx | 1 + nym-wallet/src/pages/bond/BondForm.tsx | 25 +++++---- .../src/pages/delegate/DelegateForm.tsx | 2 +- nym-wallet/src/pages/send/SendForm.tsx | 2 +- nym-wallet/src/pages/send/SendReview.tsx | 4 +- nym-wallet/src/pages/settings/index.tsx | 2 + nym-wallet/src/pages/settings/node-stats.tsx | 23 ++++++++- nym-wallet/src/pages/settings/overview.tsx | 32 +++++++++--- nym-wallet/src/pages/settings/tabs.tsx | 8 +-- .../src/pages/undelegate/UndelegateForm.tsx | 2 +- nym-wallet/src/requests/index.ts | 51 ++++++------------- nym-wallet/src/theme/mui-theme.d.ts | 1 + nym-wallet/src/theme/theme.tsx | 7 ++- 13 files changed, 91 insertions(+), 69 deletions(-) diff --git a/nym-wallet/src/context/main.tsx b/nym-wallet/src/context/main.tsx index 71a215aea9a..12889d641c6 100644 --- a/nym-wallet/src/context/main.tsx +++ b/nym-wallet/src/context/main.tsx @@ -6,6 +6,7 @@ import { TUseuserBalance, useGetBalance } from '../hooks/useGetBalance' export const ADMIN_ADDRESS = 'punk1h3w4nj7kny5dfyjw2le4vm74z03v9vd4dstpu0' export const urls = { blockExplorer: 'https://testnet-milhon-blocks.nymtech.net', + networkExplorer: 'https://testnet-milhon-explorer.nymtech.net', } type TClientContext = { diff --git a/nym-wallet/src/pages/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx index 8fbcc2481ee..4b85fdac40b 100644 --- a/nym-wallet/src/pages/bond/BondForm.tsx +++ b/nym-wallet/src/pages/bond/BondForm.tsx @@ -25,7 +25,7 @@ import { checkHasEnoughFunds } from '../../utils' type TBondFormFields = { withAdvancedOptions: boolean nodeType: EnumNodeType - ownerSignature: string, + ownerSignature: string identityKey: string sphinxKey: string amount: string @@ -230,19 +230,18 @@ export const BondForm = ({ />
- @@ -340,7 +339,7 @@ export const BondForm = ({ )} {fees && ( - + {' '} {`A bonding fee: ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount : fees?.gateway?.amount diff --git a/nym-wallet/src/pages/delegate/DelegateForm.tsx b/nym-wallet/src/pages/delegate/DelegateForm.tsx index 978db77b4d0..fdb7dd4ad3b 100644 --- a/nym-wallet/src/pages/delegate/DelegateForm.tsx +++ b/nym-wallet/src/pages/delegate/DelegateForm.tsx @@ -104,7 +104,7 @@ export const DelegateForm = ({ /> - Fee for this transaction: {fees.mixnode.amount} punk + Fee for this transaction: {fees.mixnode.amount} punk diff --git a/nym-wallet/src/pages/send/SendForm.tsx b/nym-wallet/src/pages/send/SendForm.tsx index 1eda87378f4..fc65378896b 100644 --- a/nym-wallet/src/pages/send/SendForm.tsx +++ b/nym-wallet/src/pages/send/SendForm.tsx @@ -48,7 +48,7 @@ export const SendForm = ({ transferFee }: { transferFee?: string }) => { /> - Fee for this transaction: {transferFee} punk + Fee for this transaction: {transferFee} punk ) diff --git a/nym-wallet/src/pages/send/SendReview.tsx b/nym-wallet/src/pages/send/SendReview.tsx index c3c6aca5646..1a5f3c815b6 100644 --- a/nym-wallet/src/pages/send/SendReview.tsx +++ b/nym-wallet/src/pages/send/SendReview.tsx @@ -48,8 +48,8 @@ export const SendReview = ({ transferFee }: { transferFee?: string }) => { export const SendReviewField = ({ title, subtitle, info }: { title: string; subtitle?: string; info?: boolean }) => { return ( <> - {title} - + {title} + {subtitle} diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 90ec953c4c6..a39e07c0479 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -7,6 +7,7 @@ import { TabPanel, Tabs } from './tabs' import { Profile } from './profile' import { SystemVariables } from './system-variables' import { NodeStats } from './node-stats' +import { Overview } from './overview' const tabs = ['Profile', 'System variables', 'Node stats'] @@ -32,6 +33,7 @@ export const Settings = () => { + {selectedTab === 0 && } {selectedTab === 1 && } {selectedTab === 2 && } diff --git a/nym-wallet/src/pages/settings/node-stats.tsx b/nym-wallet/src/pages/settings/node-stats.tsx index 6c680641534..1730ec93194 100644 --- a/nym-wallet/src/pages/settings/node-stats.tsx +++ b/nym-wallet/src/pages/settings/node-stats.tsx @@ -1,5 +1,24 @@ -import React from 'react' +import { OpenInNew } from '@mui/icons-material' +import { Button, Link, Stack, Typography } from '@mui/material' +import React, { useEffect } from 'react' +import { urls } from '../../context/main' +import { useCheckOwnership } from '../../hooks/useCheckOwnership' export const NodeStats = () => { - return

Node Stats

+ const { error, ownership, checkOwnership } = useCheckOwnership() + useEffect(() => { + checkOwnership() + }, []) + + return ( + + All your node stats are available on the link below + + + + + ) } diff --git a/nym-wallet/src/pages/settings/overview.tsx b/nym-wallet/src/pages/settings/overview.tsx index aa155f19f8f..2373781c1a7 100644 --- a/nym-wallet/src/pages/settings/overview.tsx +++ b/nym-wallet/src/pages/settings/overview.tsx @@ -1,13 +1,33 @@ import React from 'react' import { Divider, Stack, Typography } from '@mui/material' -import { CheckCircleOutline } from '@mui/icons-material' +import { CheckCircleOutline, CircleOutlined, PauseCircleOutlined } from '@mui/icons-material' -export const Overview = () => ( - +type TMixnodeStatus = 'active' | 'inactive' | 'standby' + +export const Overview = ({ mixnodeStatus }: { mixnodeStatus: TMixnodeStatus }) => ( + Node identity 94oh6aU4myLjDusK6QeTWEPUc3nm4vYPCsKkdcjYhRLd - - Mixnode is Active this epoch - + {mixnodeStatus === 'active' && } + {mixnodeStatus === 'inactive' && } + {mixnodeStatus === 'standby' && } ) + +const ActiveMessage = () => ( + + Mixnode is active in this epoch + +) + +const InActiveMessage = () => ( + + Mixnode is active in this epoch + +) + +const StandbyMessage = () => ( + + Mixnode is on standy by in this epoch + +) diff --git a/nym-wallet/src/pages/settings/tabs.tsx b/nym-wallet/src/pages/settings/tabs.tsx index 50cc7809fa5..f1ac982f929 100644 --- a/nym-wallet/src/pages/settings/tabs.tsx +++ b/nym-wallet/src/pages/settings/tabs.tsx @@ -1,7 +1,6 @@ import React from 'react' import { Box } from '@mui/system' import { Tab, Tabs as MuiTabs } from '@mui/material' -import { Overview } from './overview' export const Tabs: React.FC<{ tabs: string[] @@ -20,9 +19,4 @@ export const Tabs: React.FC<{ ) -export const TabPanel: React.FC = ({ children }) => ( - - - {children} - -) +export const TabPanel: React.FC = ({ children }) => {children} diff --git a/nym-wallet/src/pages/undelegate/UndelegateForm.tsx b/nym-wallet/src/pages/undelegate/UndelegateForm.tsx index 184993de465..fd47e4fad73 100644 --- a/nym-wallet/src/pages/undelegate/UndelegateForm.tsx +++ b/nym-wallet/src/pages/undelegate/UndelegateForm.tsx @@ -100,7 +100,7 @@ export const UndelegateForm = ({ /> - Fee for this transaction: {fees.mixnode.amount} punk + Fee for this transaction: {fees.mixnode.amount} punk diff --git a/nym-wallet/src/requests/index.ts b/nym-wallet/src/requests/index.ts index e8cc656611d..a077aca097d 100644 --- a/nym-wallet/src/requests/index.ts +++ b/nym-wallet/src/requests/index.ts @@ -7,29 +7,23 @@ import { Gateway, MixNode, Operation, - TauriContractSettingsParams, + TauriContractStateParams, TauriTxResult, TCreateAccount, TDelegation, TSignInWithMnemonic, } from '../types' -export const createAccount = async (): Promise => - await invoke('create_new_account') +export const createAccount = async (): Promise => await invoke('create_new_account') -export const signInWithMnemonic = async ( - mnemonic: string, -): Promise => +export const signInWithMnemonic = async (mnemonic: string): Promise => await invoke('connect_with_mnemonic', { mnemonic }) -export const minorToMajor = async (amount: string): Promise => - await invoke('minor_to_major', { amount }) +export const minorToMajor = async (amount: string): Promise => await invoke('minor_to_major', { amount }) -export const majorToMinor = async (amount: string): Promise => - await invoke('major_to_minor', { amount }) +export const majorToMinor = async (amount: string): Promise => await invoke('major_to_minor', { amount }) -export const getGasFee = async (operation: Operation): Promise => - await invoke('get_fee', { operation }) +export const getGasFee = async (operation: Operation): Promise => await invoke('get_fee', { operation }) export const delegate = async ({ type, @@ -39,8 +33,7 @@ export const delegate = async ({ type: EnumNodeType identity: string amount: Coin -}): Promise => - await invoke(`delegate_to_${type}`, { identity, amount }) +}): Promise => await invoke(`delegate_to_${type}`, { identity, amount }) export const undelegate = async ({ type, @@ -48,19 +41,13 @@ export const undelegate = async ({ }: { type: EnumNodeType identity: string -}): Promise => - await invoke(`undelegate_from_${type}`, { identity }) +}): Promise => await invoke(`undelegate_from_${type}`, { identity }) -export const send = async (args: { - amount: Coin - address: string - memo: string -}): Promise => await invoke('send', args) -export const checkMixnodeOwnership = async (): Promise => - await invoke('owns_mixnode') +export const send = async (args: { amount: Coin; address: string; memo: string }): Promise => + await invoke('send', args) +export const checkMixnodeOwnership = async (): Promise => await invoke('owns_mixnode') -export const checkGatewayOwnership = async (): Promise => - await invoke('owns_gateway') +export const checkGatewayOwnership = async (): Promise => await invoke('owns_gateway') export const bond = async ({ type, @@ -72,19 +59,13 @@ export const bond = async ({ amount: Coin }): Promise => await invoke(`bond_${type}`, { [type]: data, bond: amount }) -export const unbond = async (type: EnumNodeType) => - await invoke(`unbond_${type}`) +export const unbond = async (type: EnumNodeType) => await invoke(`unbond_${type}`) -export const userBalance = async (): Promise => - await invoke('get_balance') +export const userBalance = async (): Promise => await invoke('get_balance') -export const getContractParams = - async (): Promise => - await invoke('get_contract_settings') +export const getContractParams = async (): Promise => await invoke('get_contract_settings') -export const setContractParams = async ( - params: TauriContractSettingsParams, -): Promise => +export const setContractParams = async (params: TauriContractStateParams): Promise => await invoke('update_contract_settings', { params }) export const getReverseMixDelegations = async (): Promise => diff --git a/nym-wallet/src/theme/mui-theme.d.ts b/nym-wallet/src/theme/mui-theme.d.ts index 50d2b60c598..86599b10e9f 100644 --- a/nym-wallet/src/theme/mui-theme.d.ts +++ b/nym-wallet/src/theme/mui-theme.d.ts @@ -31,6 +31,7 @@ declare module '@mui/material/styles' { highlight: string success: string info: string + fee: string background: { light: string; dark: string } text: { light: string diff --git a/nym-wallet/src/theme/theme.tsx b/nym-wallet/src/theme/theme.tsx index e12c65bdf74..02e4f92b9f7 100644 --- a/nym-wallet/src/theme/theme.tsx +++ b/nym-wallet/src/theme/theme.tsx @@ -7,6 +7,7 @@ import { createTheme, NymPaletteVariant, } from '@mui/material/styles' +import { number } from 'yup' //----------------------------------------------------------------------------------------------- // Nym palette type definitions @@ -22,7 +23,8 @@ const nymPalette: NymPalette = { /** emphasises important elements */ highlight: '#FB6E4E', success: '#21D073', - info: '#967FF0', + info: '#60D7EF', + fee: '#967FF0', background: { light: '#F4F6F8', dark: '#121726' }, text: { light: '#F2F2F2', @@ -86,6 +88,9 @@ const variantToMUIPalette = (variant: NymPaletteVariant): PaletteOptions => ({ success: { main: nymPalette.success, }, + info: { + main: nymPalette.info, + }, background: { default: variant.background.main, paper: variant.background.paper, From 72873fe6e38332e2c37f8ed5ca6609b74ee5e029 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 11:37:55 +0000 Subject: [PATCH 10/25] rework layout --- nym-wallet/src/pages/settings/index.tsx | 10 +++---- nym-wallet/src/pages/settings/node-stats.tsx | 2 +- nym-wallet/src/pages/settings/overview.tsx | 2 +- nym-wallet/src/pages/settings/profile.tsx | 28 +++++++++++++++++++- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index a39e07c0479..e5357eff02a 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -32,12 +32,10 @@ export const Settings = () => { Node settings
- - - {selectedTab === 0 && } - {selectedTab === 1 && } - {selectedTab === 2 && } - + + {selectedTab === 0 && } + {selectedTab === 1 && } + {selectedTab === 2 && } diff --git a/nym-wallet/src/pages/settings/node-stats.tsx b/nym-wallet/src/pages/settings/node-stats.tsx index 1730ec93194..c08dbffd640 100644 --- a/nym-wallet/src/pages/settings/node-stats.tsx +++ b/nym-wallet/src/pages/settings/node-stats.tsx @@ -11,7 +11,7 @@ export const NodeStats = () => { }, []) return ( - + All your node stats are available on the link below ( - + Node identity 94oh6aU4myLjDusK6QeTWEPUc3nm4vYPCsKkdcjYhRLd {mixnodeStatus === 'active' && } {mixnodeStatus === 'inactive' && } diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx index 94695a7c1f8..ce25828580f 100644 --- a/nym-wallet/src/pages/settings/profile.tsx +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -1,5 +1,31 @@ +import { Button, Stack, TextField } from '@mui/material' +import { Box } from '@mui/system' import React from 'react' export const Profile = () => { - return

Profile

+ return ( + <> + + + + + + + + `1px solid ${theme.palette.grey[300]}`, + bgcolor: 'grey.200', + padding: 2, + }} + > + + + + ) } From 6f544e4ad1a2a426d12511e864a25408339c4d29 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 16:27:06 +0000 Subject: [PATCH 11/25] update bond form to include signature and profit percent --- nym-wallet/src/pages/bond/BondForm.tsx | 63 +++++++++++++++--------- nym-wallet/src/pages/send/SendWizard.tsx | 2 +- nym-wallet/src/pages/settings/index.tsx | 4 +- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/nym-wallet/src/pages/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx index 4b85fdac40b..58de60b9a97 100644 --- a/nym-wallet/src/pages/bond/BondForm.tsx +++ b/nym-wallet/src/pages/bond/BondForm.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react' import { - Alert, Box, Button, Checkbox, @@ -28,6 +27,7 @@ type TBondFormFields = { ownerSignature: string identityKey: string sphinxKey: string + profitMarginPercent: number amount: string host: string version: string @@ -43,9 +43,11 @@ const defaultValues = { nodeType: EnumNodeType.mixnode, identityKey: '', sphinxKey: '', + ownerSignature: '', amount: '', host: '', version: '', + profitMarginPercent: 10, location: undefined, mixPort: 1789, verlocPort: 1790, @@ -60,6 +62,7 @@ const formatData = (data: TBondFormFields) => { host: data.host, version: data.version, mix_port: data.mixPort, + profit_margin_percent: data.profitMarginPercent, } if (data.nodeType === EnumNodeType.mixnode) { @@ -108,9 +111,9 @@ export const BondForm = ({ } const formattedData = formatData(data) - const amount = await majorToMinor(data.amount) + const pledge = await majorToMinor(data.amount) - await bond({ type: data.nodeType, data: formattedData, amount }) + await bond({ type: data.nodeType, ownerSignature: data.ownerSignature, data: formattedData, pledge }) .then(() => { userBalance.fetchBalance() onSuccess({ address: data.identityKey, amount: data.amount }) @@ -164,7 +167,23 @@ export const BondForm = ({ disabled={disabled} /> - + + + + + + + + + + - - - - - + {' '} - {`A bonding fee: ${ + {`Bonding fee: ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount : fees?.gateway?.amount - }`} + } punk`} )} diff --git a/nym-wallet/src/pages/send/SendWizard.tsx b/nym-wallet/src/pages/send/SendWizard.tsx index 239f723e654..f3965b3d0d6 100644 --- a/nym-wallet/src/pages/send/SendWizard.tsx +++ b/nym-wallet/src/pages/send/SendWizard.tsx @@ -139,7 +139,7 @@ export const SendWizard = () => { alignItems: 'center', justifyContent: 'flex-end', borderTop: (theme) => `1px solid ${theme.palette.grey[200]}`, - bgcolor: 'grey.50', + bgcolor: 'grey.100', p: 2, }} > diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index e5357eff02a..e0ebfbc12f9 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -1,9 +1,9 @@ -import React, { useContext, useState } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { Box, Dialog, Typography } from '@mui/material' import { SettingsOutlined } from '@mui/icons-material' import { NymCard } from '../../components' import { ClientContext } from '../../context/main' -import { TabPanel, Tabs } from './tabs' +import { Tabs } from './tabs' import { Profile } from './profile' import { SystemVariables } from './system-variables' import { NodeStats } from './node-stats' From 6dc2a3250a5baf7a8f5c6c3fc529f4e5203b99ae Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 16:48:42 +0000 Subject: [PATCH 12/25] create info tooltip + make status component optional --- nym-wallet/src/components/InfoToolTip.tsx | 15 +++++++++++++++ nym-wallet/src/pages/settings/index.tsx | 2 +- nym-wallet/src/pages/settings/overview.tsx | 2 +- nym-wallet/src/pages/settings/profile.tsx | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 nym-wallet/src/components/InfoToolTip.tsx diff --git a/nym-wallet/src/components/InfoToolTip.tsx b/nym-wallet/src/components/InfoToolTip.tsx new file mode 100644 index 00000000000..2f24e6a9404 --- /dev/null +++ b/nym-wallet/src/components/InfoToolTip.tsx @@ -0,0 +1,15 @@ +import { InfoOutlined } from '@mui/icons-material' +import { Tooltip, TooltipProps } from '@mui/material' +import React from 'react' + +export const InfoTooltip = ({ + text, + placement = 'bottom', +}: { + text: string + placement?: TooltipProps['placement'] +}) => ( + + + +) diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index e0ebfbc12f9..8bd1a07186c 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -32,7 +32,7 @@ export const Settings = () => { Node settings - + {selectedTab === 0 && } {selectedTab === 1 && } {selectedTab === 2 && } diff --git a/nym-wallet/src/pages/settings/overview.tsx b/nym-wallet/src/pages/settings/overview.tsx index 233808d70fc..3bfc5fd120c 100644 --- a/nym-wallet/src/pages/settings/overview.tsx +++ b/nym-wallet/src/pages/settings/overview.tsx @@ -4,7 +4,7 @@ import { CheckCircleOutline, CircleOutlined, PauseCircleOutlined } from '@mui/ic type TMixnodeStatus = 'active' | 'inactive' | 'standby' -export const Overview = ({ mixnodeStatus }: { mixnodeStatus: TMixnodeStatus }) => ( +export const Overview = ({ mixnodeStatus }: { mixnodeStatus?: TMixnodeStatus }) => ( Node identity 94oh6aU4myLjDusK6QeTWEPUc3nm4vYPCsKkdcjYhRLd {mixnodeStatus === 'active' && } diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx index ce25828580f..fc5f7e364e1 100644 --- a/nym-wallet/src/pages/settings/profile.tsx +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -1,6 +1,7 @@ import { Button, Stack, TextField } from '@mui/material' import { Box } from '@mui/system' import React from 'react' +import { InfoTooltip } from '../../components/InfoToolTip' export const Profile = () => { return ( From 9cf540c4e9d0699e1c10ab83c6d495bf653f7755 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 20:50:05 +0000 Subject: [PATCH 13/25] fix overflow --- nym-wallet/src/components/InfoToolTip.tsx | 6 +- nym-wallet/src/components/NymCard.tsx | 2 +- nym-wallet/src/pages/bond/BondForm.tsx | 2 +- .../src/pages/settings/system-variables.tsx | 55 ++++++++++++++++++- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/nym-wallet/src/components/InfoToolTip.tsx b/nym-wallet/src/components/InfoToolTip.tsx index 2f24e6a9404..bd65d584ca0 100644 --- a/nym-wallet/src/components/InfoToolTip.tsx +++ b/nym-wallet/src/components/InfoToolTip.tsx @@ -3,13 +3,13 @@ import { Tooltip, TooltipProps } from '@mui/material' import React from 'react' export const InfoTooltip = ({ - text, + title, placement = 'bottom', }: { - text: string + title: string placement?: TooltipProps['placement'] }) => ( - + ) diff --git a/nym-wallet/src/components/NymCard.tsx b/nym-wallet/src/components/NymCard.tsx index cada3e8cf59..bfaf7fa18a0 100644 --- a/nym-wallet/src/components/NymCard.tsx +++ b/nym-wallet/src/components/NymCard.tsx @@ -9,7 +9,7 @@ export const NymCard: React.FC<{ noPadding?: boolean }> = ({ title, subheader, Action, noPadding, children }) => { return ( - + - + {' '} {`Bonding fee: ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount : fees?.gateway?.amount diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index ef436e0b963..beae08c4ce1 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,5 +1,58 @@ +import { Box, Button, Divider, Stack, TextField, Typography } from '@mui/material' import React from 'react' +import { InfoTooltip } from '../../components/InfoToolTip' export const SystemVariables = () => { - return

System Variables

+ return ( + <> + + + + + + + + + + + + + `1px solid ${theme.palette.grey[300]}`, + bgcolor: 'grey.200', + padding: 2, + }} + > + + + + ) } + +const DataField = ({ title, info }: { title: string; info: string }) => ( + + + {title} + +) From c5ca5149645594db6c71983c23118473431749d1 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 21:41:08 +0000 Subject: [PATCH 14/25] update sys vars tab --- nym-wallet/Cargo.lock | 287 +++++++++--------- .../src/pages/settings/system-variables.tsx | 38 ++- 2 files changed, 176 insertions(+), 149 deletions(-) diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 34eb903b5e1..d94ac89d8b3 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.45" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" [[package]] name = "arrayref" @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", @@ -154,9 +154,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "az" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6dff4a1892b54d70af377bf7a17064192e822865791d812957f21e3108c325" +checksum = "f771a5d1f5503f7f4279a30f3643d3421ba149848b89ecaaec0ea2acf04a5ac4" [[package]] name = "base64" @@ -394,9 +394,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" dependencies = [ "jobserver", ] @@ -448,19 +448,6 @@ dependencies = [ "keystream", ] -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "serde", - "winapi", -] - [[package]] name = "cipher" version = "0.3.0" @@ -696,9 +683,9 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.0.0-beta2" +version = "1.0.0-beta3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c16b255449b3f5cd7fa4b79acd5225b5185655261087a3d8aaac44f88a0e23e9" +checksum = "a380b87642204557629c9b72988c47b55fbfe6d474960adba56b22331504956a" dependencies = [ "digest 0.9.0", "ed25519-zebra", @@ -709,18 +696,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.0.0-beta2" +version = "1.0.0-beta3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abad1a6ff427a2f66890a4dce6354b4563cd07cee91a942300e011c921c09ed2" +checksum = "866713b2fe13f23038c7d8824c3059d1f28dd94685fb406d1533c4eeeefeefae" dependencies = [ "syn", ] [[package]] name = "cosmwasm-std" -version = "1.0.0-beta2" +version = "1.0.0-beta3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1660ee3d5734672e1eb4f0ceda403e2d83345e15143a48845f340f3252ce99a6" +checksum = "8dbb9939b31441dfa9af3ec9740c8a24d585688401eff1b6b386abb7ad0d10a8" dependencies = [ "base64", "cosmwasm-crypto", @@ -743,9 +730,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" dependencies = [ "cfg-if 1.0.0", ] @@ -872,7 +859,7 @@ checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" dependencies = [ "cssparser-macros", "dtoa-short", - "itoa", + "itoa 0.4.8", "matches", "phf 0.8.0", "proc-macro2", @@ -909,6 +896,12 @@ dependencies = [ "cipher", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -990,9 +983,9 @@ dependencies = [ [[package]] name = "der" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28e98c534e9c8a0483aa01d6f6913bc063de254311bd267c9cf535e9b70e15b2" +checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" dependencies = [ "const-oid", ] @@ -1010,14 +1003,14 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.16" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn", ] @@ -1160,9 +1153,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc" +checksum = "74e1069e39f1454367eb2de793ed062fac4c35c2934b76a81d90dd9abcd28816" dependencies = [ "signature", ] @@ -1225,9 +1218,9 @@ checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99" [[package]] name = "encoding_rs" -version = "0.8.29" +version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746" +checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ "cfg-if 1.0.0", ] @@ -1286,7 +1279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" dependencies = [ "memoffset", - "rustc_version", + "rustc_version 0.3.3", ] [[package]] @@ -1303,9 +1296,9 @@ dependencies = [ [[package]] name = "fixed" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d333a26ec13a023c6dff4b7584de4d323cfee2e508f5dd2bbee6669e4f7efdf" +checksum = "80a9a8cb2e34880a498f09367089339bda5e12d6f871640f947850f7113058c0" dependencies = [ "az", "bytemuck", @@ -1631,9 +1624,9 @@ dependencies = [ [[package]] name = "getset" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b328c01a4d71d2d8173daa93562a73ab0fe85616876f02500f53d82948c504" +checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" dependencies = [ "proc-macro-error", "proc-macro2", @@ -1843,9 +1836,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55" +checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd" dependencies = [ "bytes", "fnv", @@ -1937,9 +1930,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "hkd32" @@ -1997,7 +1990,7 @@ checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ "bytes", "fnv", - "itoa", + "itoa 0.4.8", ] [[package]] @@ -2025,9 +2018,9 @@ checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -2047,9 +2040,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.14" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b" +checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" dependencies = [ "bytes", "futures-channel", @@ -2060,7 +2053,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa", + "itoa 0.4.8", "pin-project-lite", "socket2", "tokio", @@ -2227,9 +2220,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -2240,6 +2233,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + [[package]] name = "javascriptcore-rs" version = "0.14.0" @@ -2328,9 +2327,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.107" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libm" @@ -2370,9 +2369,9 @@ dependencies = [ [[package]] name = "loom" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b9df80a3804094bf49bb29881d18f6f05048db72127e84e09c26fc7c2324f5" +checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309" dependencies = [ "cfg-if 1.0.0", "generator", @@ -2420,9 +2419,9 @@ dependencies = [ [[package]] name = "matchers" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ "regex-automata", ] @@ -2447,9 +2446,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg 1.0.1", ] @@ -2577,9 +2576,9 @@ dependencies = [ [[package]] name = "ndk-sys" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" [[package]] name = "network-defaults" @@ -2587,7 +2586,7 @@ version = "0.1.0" dependencies = [ "hex-literal", "serde", - "time 0.3.4", + "time 0.3.5", "url", ] @@ -2780,9 +2779,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "opaque-debug" @@ -2798,9 +2797,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46b233de7d83bc167fe43ae2dda3b5b84e80e09cceba581e4decb958a4896bf" +checksum = "176ee4b630d174d2da8241336763bb459281dddc0f4d87f72c3b1efc9a6109b7" dependencies = [ "pathdiff", "winapi", @@ -2828,9 +2827,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.70" +version = "0.9.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" dependencies = [ "autocfg 1.0.1", "cc", @@ -3041,9 +3040,9 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ "phf_macros 0.10.0", "phf_shared 0.10.0", @@ -3170,9 +3169,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "pmutil" @@ -3278,9 +3277,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" dependencies = [ "unicode-xid", ] @@ -3542,11 +3541,21 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" dependencies = [ "libc", + "raw-window-handle 0.4.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba75eee94a9d5273a68c9e1e105d9cffe1ef700532325788389e5a83e2522b7" +dependencies = [ + "cty", ] [[package]] @@ -3639,9 +3648,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.6" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d2927ca2f685faf0fc620ac4834690d29e7abb153add10f5812eef20b5e280" +checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5" dependencies = [ "base64", "bytes", @@ -3688,7 +3697,7 @@ dependencies = [ "objc", "objc-foundation", "objc_id", - "raw-window-handle", + "raw-window-handle 0.3.4", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3730,6 +3739,15 @@ dependencies = [ "semver 0.11.0", ] +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.4", +] + [[package]] name = "rustls" version = "0.19.1" @@ -3757,15 +3775,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "same-file" @@ -3788,9 +3806,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a48d098c2a7fdf5740b19deb1181b4fb8a9e68e03ae517c14cde04b5725409" +checksum = "c6b5a3c80cea1ab61f4260238409510e814e38b4b563c06044edf91e7dc070e3" dependencies = [ "dyn-clone", "schemars_derive", @@ -3800,9 +3818,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9ea2a613fe4cd7118b2bb101a25d8ae6192e1975179b67b2f17afd11e70ac8" +checksum = "41ae4dce13e8614c46ac3c38ef1c0d668b101df6ac39817aebdaa26642ddae9b" dependencies = [ "proc-macro2", "quote", @@ -3901,18 +3919,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.130" +version = "1.0.131" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "b4ad69dfbd3e45369132cc64e6748c2d65cdfb001a2b1c232d128b4ad60561c1" dependencies = [ "serde_derive", ] [[package]] name = "serde-json-wasm" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50eef3672ec8fa45f3457fd423ba131117786784a895548021976117c1ded449" +checksum = "042ac496d97e5885149d34139bad1d617192770d7eb8f1866da2317ff4501853" dependencies = [ "serde", ] @@ -3928,9 +3946,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.131" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "b710a83c4e0dff6a3d511946b95274ad9ca9e5d3ae497b63fda866ac955358d2" dependencies = [ "proc-macro2", "quote", @@ -3950,11 +3968,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.69" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8" +checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" dependencies = [ - "itoa", + "itoa 1.0.1", "ryu", "serde", ] @@ -3977,7 +3995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" dependencies = [ "dtoa", - "itoa", + "itoa 0.4.8", "serde", "url", ] @@ -3989,7 +4007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ "form_urlencoded", - "itoa", + "itoa 0.4.8", "ryu", "serde", ] @@ -4511,7 +4529,7 @@ dependencies = [ "ndk-sys", "objc", "parking_lot", - "raw-window-handle", + "raw-window-handle 0.3.4", "scopeguard", "serde", "unicode-segmentation", @@ -4521,9 +4539,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" dependencies = [ "filetime", "libc", @@ -4553,7 +4571,7 @@ dependencies = [ "open", "percent-encoding", "rand 0.8.4", - "raw-window-handle", + "raw-window-handle 0.3.4", "rfd", "semver 1.0.4", "serde", @@ -4661,7 +4679,7 @@ checksum = "fcb9b79594f22b6ed0cc8362e0dfde5b7969962de3cd8ca683de702e59e8221b" dependencies = [ "html5ever", "kuchiki", - "phf 0.10.0", + "phf 0.10.1", "proc-macro2", "quote", "serde", @@ -4687,13 +4705,12 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d1cdb0236becb17ab35a2ed1566503e412fd910944dc940239857bb7663652" +checksum = "9015fdeab074f9b8f97dcb89c2bb2ec8537c89423e95551e8d7ecdfbab58a329" dependencies = [ "async-trait", "bytes", - "chrono", "ed25519", "ed25519-dalek", "flex-error", @@ -4713,14 +4730,15 @@ dependencies = [ "subtle 2.4.1", "subtle-encoding", "tendermint-proto", + "time 0.3.5", "zeroize", ] [[package]] name = "tendermint-config" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1f94250d30e3011130a09756b05985d8dbfbd562cf261b5a17e36d89a37992" +checksum = "a2b2e6d4442bab49319dbacdfd79c5929bc6e0b35d1e0d959ff5b79fddf3f018" dependencies = [ "flex-error", "serde", @@ -4732,12 +4750,11 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff16a7b42bdbcf31c8cd10a4cffc7631f2a301360ba3a3f71dde48eabfa5bced" +checksum = "da86f6e52ced9c2f24c4ae57662ce8a44dd90ee7bc47bae27a710b02d48e193c" dependencies = [ "bytes", - "chrono", "flex-error", "num-derive", "num-traits", @@ -4746,17 +4763,17 @@ dependencies = [ "serde", "serde_bytes", "subtle-encoding", + "time 0.3.5", ] [[package]] name = "tendermint-rpc" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7842dcd5edb60b077572aa92ff8b29fc810b9b463310f9810a2607474130db4" +checksum = "50f5f4875c36798e5590894a5176cf8d75e4bc81ec34ced1b9a87609e7d56861" dependencies = [ "async-trait", "bytes", - "chrono", "flex-error", "futures", "getrandom 0.1.16", @@ -4774,6 +4791,7 @@ dependencies = [ "tendermint-config", "tendermint-proto", "thiserror", + "time 0.3.5", "tokio", "tracing", "url", @@ -4839,9 +4857,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99beeb0daeac2bd1e86ac2c21caddecb244b39a093594da1a661ec2060c7aedd" +checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" dependencies = [ "libc", "time-macros", @@ -4855,11 +4873,10 @@ checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6" [[package]] name = "tokio" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ - "autocfg 1.0.1", "bytes", "libc", "memchr", @@ -4872,9 +4889,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.5.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", @@ -4974,36 +4991,22 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" -version = "0.2.25" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3" dependencies = [ "ansi_term", - "chrono", "lazy_static", "matchers", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec 1.7.0", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] [[package]] diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index beae08c4ce1..8f5aa6542fa 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,5 +1,5 @@ -import { Box, Button, Divider, Stack, TextField, Typography } from '@mui/material' import React from 'react' +import { Box, Button, Divider, Grid, LinearProgress, Stack, TextField, Typography } from '@mui/material' import { InfoTooltip } from '../../components/InfoToolTip' export const SystemVariables = () => { @@ -15,20 +15,25 @@ export const SystemVariables = () => { ~ 152,140,028 punk
} /> } /> } /> + } />
@@ -50,9 +55,28 @@ export const SystemVariables = () => { ) } -const DataField = ({ title, info }: { title: string; info: string }) => ( - - - {title} - +const DataField = ({ title, info, Indicator }: { title: string; info: string; Indicator: React.ReactElement }) => ( + + + + + {title} + + + + + {Indicator} + + ) + +const PercentIndicator = ({ value }: { value: number }) => { + return ( + + + + {value} % + + + ) +} From 6a17893fd527e1eb9eeedb909fc27997db3a3342 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 22:04:55 +0000 Subject: [PATCH 15/25] get mixnode bond details --- nym-wallet/src/pages/settings/index.tsx | 9 +++++++++ nym-wallet/src/requests/index.ts | 4 ++++ nym-wallet/src/types/global.ts | 12 +++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 8bd1a07186c..06f749cddb1 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -8,6 +8,7 @@ import { Profile } from './profile' import { SystemVariables } from './system-variables' import { NodeStats } from './node-stats' import { Overview } from './overview' +import { getMixnodeBondDetails } from '../../requests' const tabs = ['Profile', 'System variables', 'Node stats'] @@ -15,6 +16,14 @@ export const Settings = () => { const { showSettings, handleShowSettings } = useContext(ClientContext) const [selectedTab, setSelectedTab] = useState(0) + useEffect(() => { + const getBondDetails = async () => { + const details = await getMixnodeBondDetails() + console.log(details) + } + if (showSettings) getBondDetails() + }, [showSettings]) + const handleTabChange = (event: React.SyntheticEvent, newTab: number) => setSelectedTab(newTab) return showSettings ? ( diff --git a/nym-wallet/src/requests/index.ts b/nym-wallet/src/requests/index.ts index 70806e29223..ae1eba1d8d6 100644 --- a/nym-wallet/src/requests/index.ts +++ b/nym-wallet/src/requests/index.ts @@ -11,6 +11,7 @@ import { TauriTxResult, TCreateAccount, TDelegation, + TMixnodeBondDetails, TSignInWithMnemonic, } from '../types' @@ -76,3 +77,6 @@ export const getReverseMixDelegations = async (): Promise => export const getReverseGatewayDelegations = async (): Promise => await invoke('get_reverse_gateway_delegations_paged') + +export const getMixnodeBondDetails = async (): Promise => + await invoke('mixnode_bond_details') diff --git a/nym-wallet/src/types/global.ts b/nym-wallet/src/types/global.ts index edd8e871f2d..e644fe2db16 100644 --- a/nym-wallet/src/types/global.ts +++ b/nym-wallet/src/types/global.ts @@ -1,4 +1,4 @@ -import { Coin } from '.' +import { Coin, MixNode } from '.' export enum EnumNodeType { mixnode = 'mixnode', @@ -33,3 +33,13 @@ export type TDelegation = { delegation_owner: string start_next_after: string } + +export type TMixnodeBondDetails = { + pledge_amount: Coin + total_delegation: Coin + owner: string + layer: string + block_height: number + mix_node: MixNode + proxy: any +} From c9898e051a490efb442b300e97954c558399720b Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 22:35:22 +0000 Subject: [PATCH 16/25] use mixnode id in settings --- nym-wallet/src/context/main.tsx | 4 ++-- nym-wallet/src/pages/settings/index.tsx | 9 ++++++--- nym-wallet/src/pages/settings/node-stats.tsx | 12 ++---------- nym-wallet/src/pages/settings/overview.tsx | 11 +++++++++-- nym-wallet/src/requests/index.ts | 8 +++++--- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/nym-wallet/src/context/main.tsx b/nym-wallet/src/context/main.tsx index 12889d641c6..b35bd9d85bb 100644 --- a/nym-wallet/src/context/main.tsx +++ b/nym-wallet/src/context/main.tsx @@ -5,8 +5,8 @@ import { TUseuserBalance, useGetBalance } from '../hooks/useGetBalance' export const ADMIN_ADDRESS = 'punk1h3w4nj7kny5dfyjw2le4vm74z03v9vd4dstpu0' export const urls = { - blockExplorer: 'https://testnet-milhon-blocks.nymtech.net', - networkExplorer: 'https://testnet-milhon-explorer.nymtech.net', + blockExplorer: 'https://sandbox-blocks.nymtech.net', + networkExplorer: 'https://sandbox-explorer.nymtech.net', } type TClientContext = { diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 06f749cddb1..7db1f9dbeb2 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from 'react' -import { Box, Dialog, Typography } from '@mui/material' +import { Alert, Box, Dialog, Typography } from '@mui/material' import { SettingsOutlined } from '@mui/icons-material' import { NymCard } from '../../components' import { ClientContext } from '../../context/main' @@ -9,16 +9,19 @@ import { SystemVariables } from './system-variables' import { NodeStats } from './node-stats' import { Overview } from './overview' import { getMixnodeBondDetails } from '../../requests' +import { TMixnodeBondDetails } from '../../types' const tabs = ['Profile', 'System variables', 'Node stats'] export const Settings = () => { const { showSettings, handleShowSettings } = useContext(ClientContext) const [selectedTab, setSelectedTab] = useState(0) + const [mixnodeDetails, setMixnodeDetails] = useState() useEffect(() => { const getBondDetails = async () => { const details = await getMixnodeBondDetails() + setMixnodeDetails(details) console.log(details) } if (showSettings) getBondDetails() @@ -41,10 +44,10 @@ export const Settings = () => { Node settings - + {selectedTab === 0 && } {selectedTab === 1 && } - {selectedTab === 2 && } + {selectedTab === 2 && } diff --git a/nym-wallet/src/pages/settings/node-stats.tsx b/nym-wallet/src/pages/settings/node-stats.tsx index c08dbffd640..24d186ffef7 100644 --- a/nym-wallet/src/pages/settings/node-stats.tsx +++ b/nym-wallet/src/pages/settings/node-stats.tsx @@ -4,19 +4,11 @@ import React, { useEffect } from 'react' import { urls } from '../../context/main' import { useCheckOwnership } from '../../hooks/useCheckOwnership' -export const NodeStats = () => { - const { error, ownership, checkOwnership } = useCheckOwnership() - useEffect(() => { - checkOwnership() - }, []) - +export const NodeStats = ({ mixnodeId }: { mixnodeId?: string }) => { return ( All your node stats are available on the link below - + diff --git a/nym-wallet/src/pages/settings/overview.tsx b/nym-wallet/src/pages/settings/overview.tsx index 3bfc5fd120c..a89daaad3a4 100644 --- a/nym-wallet/src/pages/settings/overview.tsx +++ b/nym-wallet/src/pages/settings/overview.tsx @@ -1,12 +1,19 @@ import React from 'react' import { Divider, Stack, Typography } from '@mui/material' import { CheckCircleOutline, CircleOutlined, PauseCircleOutlined } from '@mui/icons-material' +import { TMixnodeBondDetails } from '../../types' type TMixnodeStatus = 'active' | 'inactive' | 'standby' -export const Overview = ({ mixnodeStatus }: { mixnodeStatus?: TMixnodeStatus }) => ( +export const Overview = ({ + mixnodeStatus, + details, +}: { + mixnodeStatus?: TMixnodeStatus + details?: TMixnodeBondDetails | null +}) => ( - Node identity 94oh6aU4myLjDusK6QeTWEPUc3nm4vYPCsKkdcjYhRLd + Node identity {details?.mix_node.identity_key} {mixnodeStatus === 'active' && } {mixnodeStatus === 'inactive' && } {mixnodeStatus === 'standby' && } diff --git a/nym-wallet/src/requests/index.ts b/nym-wallet/src/requests/index.ts index ae1eba1d8d6..f76c18fa117 100644 --- a/nym-wallet/src/requests/index.ts +++ b/nym-wallet/src/requests/index.ts @@ -56,12 +56,14 @@ export const checkGatewayOwnership = async (): Promise => await invoke( export const bond = async ({ type, data, - amount, + ownerSignature, + pledge, }: { type: EnumNodeType + ownerSignature: string data: MixNode | Gateway - amount: Coin -}): Promise => await invoke(`bond_${type}`, { [type]: data, bond: amount }) + pledge: Coin +}): Promise => await invoke(`bond_${type}`, { [type]: data, ownerSignature, pledge }) export const unbond = async (type: EnumNodeType) => await invoke(`unbond_${type}`) From 0f9eb89ef5d97838ad3e66a12a4601045ea3f5af Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 22:50:00 +0000 Subject: [PATCH 17/25] set up profit percentage value on sys vars tab --- nym-wallet/src/pages/settings/index.tsx | 17 ++++++++++++----- nym-wallet/src/pages/settings/overview.tsx | 2 +- .../src/pages/settings/system-variables.tsx | 7 +++++-- nym-wallet/src/pages/settings/tabs.tsx | 5 +++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 7db1f9dbeb2..0d70a2e0b28 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -21,8 +21,8 @@ export const Settings = () => { useEffect(() => { const getBondDetails = async () => { const details = await getMixnodeBondDetails() - setMixnodeDetails(details) console.log(details) + setMixnodeDetails(details) } if (showSettings) getBondDetails() }, [showSettings]) @@ -43,11 +43,18 @@ export const Settings = () => { Node settings - + - {selectedTab === 0 && } - {selectedTab === 1 && } - {selectedTab === 2 && } + {!mixnodeDetails && ( + + You don't currently have a node running + + )} + {selectedTab === 0 && mixnodeDetails && } + {selectedTab === 1 && mixnodeDetails && ( + + )} + {selectedTab === 2 && mixnodeDetails && } diff --git a/nym-wallet/src/pages/settings/overview.tsx b/nym-wallet/src/pages/settings/overview.tsx index a89daaad3a4..7554a561648 100644 --- a/nym-wallet/src/pages/settings/overview.tsx +++ b/nym-wallet/src/pages/settings/overview.tsx @@ -13,7 +13,7 @@ export const Overview = ({ details?: TMixnodeBondDetails | null }) => ( - Node identity {details?.mix_node.identity_key} + Node identity {details?.mix_node.identity_key || 'n/a'} {mixnodeStatus === 'active' && } {mixnodeStatus === 'inactive' && } {mixnodeStatus === 'standby' && } diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index 8f5aa6542fa..8566b19baf2 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,8 +1,9 @@ -import React from 'react' +import React, { ChangeEvent, useState } from 'react' import { Box, Button, Divider, Grid, LinearProgress, Stack, TextField, Typography } from '@mui/material' import { InfoTooltip } from '../../components/InfoToolTip' -export const SystemVariables = () => { +export const SystemVariables = ({ profitMargin }: { profitMargin: number }) => { + const [profitMarginPercent, setProfirMarginPercent] = useState(profitMargin) return ( <> @@ -10,6 +11,8 @@ export const SystemVariables = () => { ) => setProfirMarginPercent(+e.target.value)} /> void -}> = ({ tabs, selectedTab, onChange }) => ( +}> = ({ tabs, selectedTab, disabled, onChange }) => ( {tabs.map((tabName, index) => ( - + ))} ) From dc2237c47cb080e5fd55801e169bd295bb2e32b6 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 15 Dec 2021 23:03:18 +0000 Subject: [PATCH 18/25] profit percentage styling --- nym-wallet/src/pages/settings/system-variables.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index 8566b19baf2..3339cc8b935 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,9 +1,10 @@ import React, { ChangeEvent, useState } from 'react' -import { Box, Button, Divider, Grid, LinearProgress, Stack, TextField, Typography } from '@mui/material' +import { Box, Button, Chip, Divider, Grid, LinearProgress, Stack, TextField, Typography } from '@mui/material' +import { AccessTimeOutlined, PercentOutlined } from '@mui/icons-material' import { InfoTooltip } from '../../components/InfoToolTip' export const SystemVariables = ({ profitMargin }: { profitMargin: number }) => { - const [profitMarginPercent, setProfirMarginPercent] = useState(profitMargin) + const [profitMarginPercent, setProfirMarginPercent] = useState(profitMargin.toString()) return ( <> @@ -12,7 +13,8 @@ export const SystemVariables = ({ profitMargin }: { profitMargin: number }) => { label="Profit margin" helperText="The percentage of your delegators' rewards that you as the node operator will take" value={profitMarginPercent} - onChange={(e: ChangeEvent) => setProfirMarginPercent(+e.target.value)} + onChange={(e: ChangeEvent) => setProfirMarginPercent(e.target.value)} + InputProps={{ endAdornment: }} /> { } + Indicator={} />} /> From 3bf92c179b7b1c91cffd97e50f20a412fef990cc Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 16 Dec 2021 16:06:27 +0000 Subject: [PATCH 19/25] add fix for delegations list --- .../src/components/TransactionDetails.tsx | 2 +- .../src/pages/undelegate/UndelegateForm.tsx | 23 +++++-------------- nym-wallet/src/pages/undelegate/index.tsx | 16 ++++--------- nym-wallet/src/requests/index.ts | 5 ++-- nym-wallet/src/types/global.ts | 11 +++++++-- 5 files changed, 24 insertions(+), 33 deletions(-) diff --git a/nym-wallet/src/components/TransactionDetails.tsx b/nym-wallet/src/components/TransactionDetails.tsx index 78790ffec3e..1b50cffed6f 100644 --- a/nym-wallet/src/components/TransactionDetails.tsx +++ b/nym-wallet/src/components/TransactionDetails.tsx @@ -8,7 +8,7 @@ export const TransactionDetails: React.FC<{ details: TTransactionDetails }> = ({ {details.map(({ primary, secondary }, i) => { return ( - + theme.palette.grey[600] }}>{primary} diff --git a/nym-wallet/src/pages/undelegate/UndelegateForm.tsx b/nym-wallet/src/pages/undelegate/UndelegateForm.tsx index fd47e4fad73..28cf29543e0 100644 --- a/nym-wallet/src/pages/undelegate/UndelegateForm.tsx +++ b/nym-wallet/src/pages/undelegate/UndelegateForm.tsx @@ -1,22 +1,11 @@ import React, { useContext, useEffect } from 'react' import { useForm, Controller } from 'react-hook-form' -import { - Box, - Alert, - Autocomplete, - Button, - CircularProgress, - FormControl, - Grid, - TextField, - Typography, -} from '@mui/material' +import { Box, Autocomplete, Button, CircularProgress, FormControl, Grid, TextField, Typography } from '@mui/material' import { yupResolver } from '@hookform/resolvers/yup' import { validationSchema } from './validationSchema' -import { EnumNodeType, TFee } from '../../types' +import { EnumNodeType, TDelegation, TFee } from '../../types' import { ClientContext } from '../../context/main' import { undelegate } from '../../requests' -import { TDelegations } from '.' type TFormData = { nodeType: EnumNodeType @@ -35,7 +24,7 @@ export const UndelegateForm = ({ onSuccess, }: { fees: TFee - delegations: TDelegations + delegations?: TDelegation[] onError: (message?: string) => void onSuccess: (message?: string) => void }) => { @@ -77,11 +66,11 @@ export const UndelegateForm = ({ ( + render={() => ( setValue('identity', value || '')} - options={watchNodeType === EnumNodeType.mixnode ? delegations.mixnodes.delegated_nodes : []} + options={delegations?.map((d) => d.node_identity) || []} renderInput={(params) => ( { const [message, setMessage] = useState() const [status, setStatus] = useState(EnumRequestStatus.initial) const [isLoading, setIsLoading] = useState(true) const [fees, setFees] = useState() - const [delegations, setDelegations] = useState() + const [pagedDelegations, setPagesDelegations] = useState() useEffect(() => { initialize() @@ -35,9 +31,7 @@ export const Undelegate = () => { mixnode: mixnodeFee, }) - setDelegations({ - mixnodes: mixnodeDelegations, - }) + setPagesDelegations(mixnodeDelegations) } catch { setStatus(EnumRequestStatus.error) setMessage('An error occured when initialising the page') @@ -61,10 +55,10 @@ export const Undelegate = () => { )} <> - {status === EnumRequestStatus.initial && fees && delegations && ( + {status === EnumRequestStatus.initial && fees && pagedDelegations && ( { setMessage(message) setStatus(EnumRequestStatus.error) diff --git a/nym-wallet/src/requests/index.ts b/nym-wallet/src/requests/index.ts index f76c18fa117..6cb329c346f 100644 --- a/nym-wallet/src/requests/index.ts +++ b/nym-wallet/src/requests/index.ts @@ -12,6 +12,7 @@ import { TCreateAccount, TDelegation, TMixnodeBondDetails, + TPagedDelegations, TSignInWithMnemonic, } from '../types' @@ -74,10 +75,10 @@ export const getContractParams = async (): Promise => export const setContractParams = async (params: TauriContractStateParams): Promise => await invoke('update_contract_settings', { params }) -export const getReverseMixDelegations = async (): Promise => +export const getReverseMixDelegations = async (): Promise => await invoke('get_reverse_mix_delegations_paged') -export const getReverseGatewayDelegations = async (): Promise => +export const getReverseGatewayDelegations = async (): Promise => await invoke('get_reverse_gateway_delegations_paged') export const getMixnodeBondDetails = async (): Promise => diff --git a/nym-wallet/src/types/global.ts b/nym-wallet/src/types/global.ts index e644fe2db16..4d15f8214de 100644 --- a/nym-wallet/src/types/global.ts +++ b/nym-wallet/src/types/global.ts @@ -29,8 +29,15 @@ export type TFee = { } export type TDelegation = { - delegated_nodes: string[] - delegation_owner: string + owner: string + node_identity: string + amount: Coin + block_height: number + proxy: string // proxy address used to delegate the funds on behalf of anouther address +} + +export type TPagedDelegations = { + delegations: TDelegation[] start_next_after: string } From 2dc6150370d69e43c6b5df430d3fc5becd2e4566 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 16 Dec 2021 17:21:27 +0000 Subject: [PATCH 20/25] fix unbond UI bug --- nym-wallet/src/hooks/useGetBalance.tsx | 2 +- nym-wallet/src/pages/unbond/index.tsx | 7 ++++--- nym-wallet/src/types/global.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nym-wallet/src/hooks/useGetBalance.tsx b/nym-wallet/src/hooks/useGetBalance.tsx index ec740f49aed..6c322cf7d29 100644 --- a/nym-wallet/src/hooks/useGetBalance.tsx +++ b/nym-wallet/src/hooks/useGetBalance.tsx @@ -15,7 +15,7 @@ export const useGetBalance = (): TUseuserBalance => { const [error, setError] = useState() const [isLoading, setIsLoading] = useState(false) - const fetchBalance = useCallback(() => { + const fetchBalance = useCallback(async () => { setIsLoading(true) setError(undefined) invoke('get_balance') diff --git a/nym-wallet/src/pages/unbond/index.tsx b/nym-wallet/src/pages/unbond/index.tsx index 3aeffed255c..53291a39a61 100644 --- a/nym-wallet/src/pages/unbond/index.tsx +++ b/nym-wallet/src/pages/unbond/index.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from 'react' -import { Alert, Box, Button, CircularProgress, Theme } from '@mui/material' +import { Alert, Box, Button, CircularProgress } from '@mui/material' import { NymCard } from '../../components' import { Layout } from '../../layouts' import { useCheckOwnership } from '../../hooks/useCheckOwnership' @@ -31,8 +31,9 @@ export const Unbond = () => { disabled={isLoading} onClick={async () => { setIsLoading(true) - await unbond(ownership.nodeType!) - userBalance.fetchBalance() + await unbond(ownership.nodeType) + await userBalance.fetchBalance() + await checkOwnership() setIsLoading(false) }} > diff --git a/nym-wallet/src/types/global.ts b/nym-wallet/src/types/global.ts index 4d15f8214de..9523163a441 100644 --- a/nym-wallet/src/types/global.ts +++ b/nym-wallet/src/types/global.ts @@ -7,7 +7,7 @@ export enum EnumNodeType { export type TNodeOwnership = { hasOwnership: boolean - nodeType?: EnumNodeType + nodeType: EnumNodeType } export type TClientDetails = { From 4d8c6b09f193e7abd9f4757bdf60eb80c9749f29 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 16 Dec 2021 17:44:42 +0000 Subject: [PATCH 21/25] minor style updates --- nym-wallet/src/context/main.tsx | 2 +- nym-wallet/src/pages/settings/profile.tsx | 6 +++--- .../src/pages/settings/system-variables.tsx | 18 +++++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/nym-wallet/src/context/main.tsx b/nym-wallet/src/context/main.tsx index 01a6bea8377..c917d976009 100644 --- a/nym-wallet/src/context/main.tsx +++ b/nym-wallet/src/context/main.tsx @@ -8,7 +8,7 @@ export const { MAJOR_CURRENCY, MINOR_CURRENCY, ADMIN_ADDRESS, NETWORK_NAME } = c export const urls = { blockExplorer: `https://${NETWORK_NAME}-blocks.nymtech.net`, - networkExplorer: `https://${NETWORK_NAME}}-explorer.nymtech.net`, + networkExplorer: `https://${NETWORK_NAME}-explorer.nymtech.net`, } type TClientContext = { diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx index fc5f7e364e1..3576e83b499 100644 --- a/nym-wallet/src/pages/settings/profile.tsx +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -8,9 +8,9 @@ export const Profile = () => { <> - - - + + + { ~ 152,140,028 punk} + Indicator={~ 152,140,028 punk} /> { return ( - - - - {value} % - - + + + + {value}% + + + + + + ) } From 5d912e34f635fbafcc85e331b80e5a221b519949 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Fri, 17 Dec 2021 11:00:59 +0000 Subject: [PATCH 22/25] dont allow profit percent on gateway bonding --- nym-wallet/src/pages/bond/BondForm.tsx | 66 ++++++++++++------------ nym-wallet/src/pages/send/SendReview.tsx | 2 +- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/nym-wallet/src/pages/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx index f079ac1aaa2..82c91f18d28 100644 --- a/nym-wallet/src/pages/bond/BondForm.tsx +++ b/nym-wallet/src/pages/bond/BondForm.tsx @@ -201,39 +201,26 @@ export const BondForm = ({ /> - - - - - - - + {watchNodeType === EnumNodeType.mixnode && ( + + + + )} {/* if it's a gateway - get location */} - - {watchNodeType === EnumNodeType.gateway && ( + {watchNodeType === EnumNodeType.gateway && ( + - )} + + )} + + + diff --git a/nym-wallet/src/pages/send/SendReview.tsx b/nym-wallet/src/pages/send/SendReview.tsx index f0cf18a3184..5a96e40a016 100644 --- a/nym-wallet/src/pages/send/SendReview.tsx +++ b/nym-wallet/src/pages/send/SendReview.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Card, Divider, Grid, Typography } from '@mui/material' import { useFormContext } from 'react-hook-form' -import {} from '../../context/main' +import { MAJOR_CURRENCY } from '../../context/main' export const SendReview = ({ transferFee }: { transferFee?: string }) => { const { getValues } = useFormContext() From de0bc746e473795bd2a4e590e170cf5ae4747e54 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Fri, 17 Dec 2021 11:23:48 +0000 Subject: [PATCH 23/25] webpack prod fix --- nym-wallet/webpack.common.js | 2 +- nym-wallet/webpack.prod.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nym-wallet/webpack.common.js b/nym-wallet/webpack.common.js index 959fbc82535..817d186e5ae 100644 --- a/nym-wallet/webpack.common.js +++ b/nym-wallet/webpack.common.js @@ -10,7 +10,7 @@ module.exports = { template: path.resolve(__dirname, 'public/index.html'), filename: 'index.html', }), - new FaviconsWebpackPlugin(path.resolve(__dirname, 'public/favicon.ico')), + new FaviconsWebpackPlugin(path.resolve(__dirname, 'public/favicon.png')), new Dotenv(), ], module: { diff --git a/nym-wallet/webpack.prod.js b/nym-wallet/webpack.prod.js index 530692fecfa..a916a614994 100644 --- a/nym-wallet/webpack.prod.js +++ b/nym-wallet/webpack.prod.js @@ -1,9 +1,11 @@ var path = require('path') +const common = require('./webpack.common') +const { default: merge } = require('webpack-merge') -module.exports = { +module.exports = merge(common, { mode: 'production', node: { __dirname: false, }, entry: path.resolve(__dirname, './src/index'), -} +}) From e021809c2a6fee20046afbbd7a689bb69ee4de0d Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Fri, 17 Dec 2021 14:51:38 +0000 Subject: [PATCH 24/25] update profit percentage from settings area --- nym-wallet/src/pages/bond/BondForm.tsx | 2 +- nym-wallet/src/pages/bond/validationSchema.ts | 2 +- nym-wallet/src/pages/settings/index.tsx | 5 +- nym-wallet/src/pages/settings/profile.tsx | 4 +- .../src/pages/settings/system-variables.tsx | 116 +++++++++++++++--- .../src/pages/settings/validationSchema.ts | 6 + 6 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 nym-wallet/src/pages/settings/validationSchema.ts diff --git a/nym-wallet/src/pages/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx index 82c91f18d28..f2afa85177e 100644 --- a/nym-wallet/src/pages/bond/BondForm.tsx +++ b/nym-wallet/src/pages/bond/BondForm.tsx @@ -212,7 +212,7 @@ export const BondForm = ({ label="Profit percentage" fullWidth error={!!errors.profitMarginPercent} - helperText={errors.profitMarginPercent?.message} + helperText={errors.profitMarginPercent ? errors.profitMarginPercent.message : 'Default is 10%'} disabled={disabled} /> diff --git a/nym-wallet/src/pages/bond/validationSchema.ts b/nym-wallet/src/pages/bond/validationSchema.ts index 0c2576aed9f..c98f27cd49b 100644 --- a/nym-wallet/src/pages/bond/validationSchema.ts +++ b/nym-wallet/src/pages/bond/validationSchema.ts @@ -25,7 +25,7 @@ export const validationSchema = Yup.object().shape({ .test('valid-signature', 'A valid signature is required', function (value) { return validateKey(value || '', 64) }), - profitMarginPercent: Yup.number().required('Profit Percentage is required').min(1).max(100), + profitMarginPercent: Yup.number().required('Profit Percentage is required').min(0).max(100), amount: Yup.string() .required('An amount is required') .test('valid-amount', `A valid amount is required (min 100 ${MAJOR_CURRENCY})`, function (value) { diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 0d70a2e0b28..874d76d89b3 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -21,12 +21,13 @@ export const Settings = () => { useEffect(() => { const getBondDetails = async () => { const details = await getMixnodeBondDetails() - console.log(details) setMixnodeDetails(details) } if (showSettings) getBondDetails() }, [showSettings]) + console.log(mixnodeDetails) + const handleTabChange = (event: React.SyntheticEvent, newTab: number) => setSelectedTab(newTab) return showSettings ? ( @@ -52,7 +53,7 @@ export const Settings = () => { )} {selectedTab === 0 && mixnodeDetails && } {selectedTab === 1 && mixnodeDetails && ( - + )} {selectedTab === 2 && mixnodeDetails && } diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx index 3576e83b499..228d63e8ad2 100644 --- a/nym-wallet/src/pages/settings/profile.tsx +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -23,8 +23,8 @@ export const Profile = () => { padding: 2, }} > - diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index ce3009d92d9..b7b566b36e2 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,37 +1,107 @@ -import React, { ChangeEvent, useState } from 'react' -import { Box, Button, Chip, Divider, Grid, LinearProgress, Stack, TextField, Typography } from '@mui/material' +import React, { useContext, useState } from 'react' +import { + Box, + Button, + Chip, + CircularProgress, + Divider, + Grid, + LinearProgress, + Stack, + TextField, + Typography, +} from '@mui/material' import { AccessTimeOutlined, PercentOutlined } from '@mui/icons-material' +import { yupResolver } from '@hookform/resolvers/yup' +import { useForm } from 'react-hook-form' import { InfoTooltip } from '../../components/InfoToolTip' +import { EnumNodeType, TMixnodeBondDetails } from '../../types' +import { validationSchema } from './validationSchema' +import { bond, unbond } from '../../requests' +import { ClientContext } from '../../context/main' + +type TFormData = { + profitMarginPercent: number + signature: string +} + +export const SystemVariables = ({ + mixnodeDetails, + pledge, +}: { + mixnodeDetails: TMixnodeBondDetails['mix_node'] + pledge: TMixnodeBondDetails['pledge_amount'] +}) => { + const [nodeUpdateResponse, setNodeUpdateResponse] = useState<'success' | 'failed'>() + + const { + register, + handleSubmit, + formState: { errors, isSubmitting }, + } = useForm({ + resolver: yupResolver(validationSchema), + defaultValues: { profitMarginPercent: mixnodeDetails.profit_margin_percent.toString(), signature: '' }, + }) + console.log(pledge, mixnodeDetails) + const { userBalance } = useContext(ClientContext) + + const onSubmit = async (data: TFormData) => { + await unbond(EnumNodeType.mixnode) + await bond({ + type: EnumNodeType.mixnode, + data: { ...mixnodeDetails, profit_margin_percent: data.profitMarginPercent }, + pledge: { denom: 'Minor', amount: pledge.amount }, + ownerSignature: data.signature, + }) + .then(() => { + userBalance.fetchBalance() + setNodeUpdateResponse('success') + }) + .catch((e) => { + setNodeUpdateResponse('failed') + console.log(e) + }) + } -export const SystemVariables = ({ profitMargin }: { profitMargin: number }) => { - const [profitMarginPercent, setProfirMarginPercent] = useState(profitMargin.toString()) return ( <> ) => setProfirMarginPercent(e.target.value)} + helperText={ + !!errors.profitMarginPercent + ? errors.profitMarginPercent.message + : "The percentage of your delegators' rewards that you as the node operator will take" + } InputProps={{ endAdornment: }} + error={!!errors.profitMarginPercent} + disabled={isSubmitting} + /> + ~ 152,140,028 punk} + Indicator={} />} /> } + Indicator={} />} /> } + Indicator={} />} /> @@ -46,14 +116,28 @@ export const SystemVariables = ({ profitMargin }: { profitMargin: number }) => { sx={{ display: 'flex', alignItems: 'center', - justifyContent: 'flex-end', + justifyContent: 'space-between', borderTop: (theme) => `1px solid ${theme.palette.grey[300]}`, bgcolor: 'grey.200', padding: 2, }} > - @@ -69,8 +153,10 @@ const DataField = ({ title, info, Indicator }: { title: string; info: string; In - - {Indicator} + + + {Indicator} + ) diff --git a/nym-wallet/src/pages/settings/validationSchema.ts b/nym-wallet/src/pages/settings/validationSchema.ts new file mode 100644 index 00000000000..4e76f3a6d4c --- /dev/null +++ b/nym-wallet/src/pages/settings/validationSchema.ts @@ -0,0 +1,6 @@ +import * as Yup from 'yup' + +export const validationSchema = Yup.object({ + profitMarginPercent: Yup.number().typeError('profit margin percent must be a number').min(0).max(100).required(), + signature: Yup.string().required(), +}) From 805288789946eb17d086ecc66b507544118b998e Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Fri, 17 Dec 2021 16:09:37 +0000 Subject: [PATCH 25/25] hardcode signature for profit percentage update --- nym-wallet/src/pages/settings/index.tsx | 3 +-- .../src/pages/settings/system-variables.tsx | 21 +++++++++---------- .../src/pages/settings/validationSchema.ts | 1 - 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index 874d76d89b3..676a1b1710f 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -24,10 +24,9 @@ export const Settings = () => { setMixnodeDetails(details) } if (showSettings) getBondDetails() + if (!showSettings) setSelectedTab(0) }, [showSettings]) - console.log(mixnodeDetails) - const handleTabChange = (event: React.SyntheticEvent, newTab: number) => setSelectedTab(newTab) return showSettings ? ( diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index b7b566b36e2..e473e6548aa 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { Box, Button, @@ -36,22 +36,28 @@ export const SystemVariables = ({ const { register, + reset, handleSubmit, formState: { errors, isSubmitting }, } = useForm({ resolver: yupResolver(validationSchema), - defaultValues: { profitMarginPercent: mixnodeDetails.profit_margin_percent.toString(), signature: '' }, + defaultValues: { profitMarginPercent: mixnodeDetails.profit_margin_percent.toString() }, }) - console.log(pledge, mixnodeDetails) + const { userBalance } = useContext(ClientContext) + useEffect(() => { + return () => reset() + }, []) + const onSubmit = async (data: TFormData) => { await unbond(EnumNodeType.mixnode) await bond({ type: EnumNodeType.mixnode, data: { ...mixnodeDetails, profit_margin_percent: data.profitMarginPercent }, pledge: { denom: 'Minor', amount: pledge.amount }, - ownerSignature: data.signature, + //hardcoded for the moment as required in bonding but not necessary + ownerSignature: 'foo', }) .then(() => { userBalance.fetchBalance() @@ -79,13 +85,6 @@ export const SystemVariables = ({ error={!!errors.profitMarginPercent} disabled={isSubmitting} /> -