diff --git a/explorer/src/components/MixNodes/Economics/Columns.ts b/explorer/src/components/MixNodes/Economics/Columns.ts index 133551bcc6..3c20e0eebd 100644 --- a/explorer/src/components/MixNodes/Economics/Columns.ts +++ b/explorer/src/components/MixNodes/Economics/Columns.ts @@ -31,7 +31,7 @@ export const EconomicsInfoColumns: ColumnsType[] = [ flex: 1, headerAlign: 'left', tooltipInfo: - 'Level of stake saturation for this node. Nodes receive more rewards the higher their saturation level, up to 100%. Beyond 100% no additional rewards are granted. The current stake saturation level is: 750k NYM, computed as S/K where S is total amount of tokens available to stakeholders and K is the number of nodes in the reward set.', + 'Level of stake saturation for this node. Nodes receive more rewards the higher their saturation level, up to 100%. Beyond 100% no additional rewards are granted. The current stake saturation level is 730k NYM, computed as S/K where S is target amount of tokens staked in the network and K is the number of nodes in the reward set.', }, { field: 'profitMargin', diff --git a/explorer/src/pages/Mixnodes/index.tsx b/explorer/src/pages/Mixnodes/index.tsx index f199a7adc8..5aaa02640f 100644 --- a/explorer/src/pages/Mixnodes/index.tsx +++ b/explorer/src/pages/Mixnodes/index.tsx @@ -149,7 +149,7 @@ export const PageMixnodes: FCWithChildren = () => { renderHeader: () => ( ), headerClassName: 'MuiDataGrid-header-override', diff --git a/nym-api/src/support/nyxd/mod.rs b/nym-api/src/support/nyxd/mod.rs index 4492fbaa04..7ec23b9780 100644 --- a/nym-api/src/support/nyxd/mod.rs +++ b/nym-api/src/support/nyxd/mod.rs @@ -189,6 +189,9 @@ impl Client { .nyxd .query_contract_raw(vesting_contract, b"key".to_vec()) .await?; + if res.is_empty() { + return Ok(0); + } Ok(serde_json::from_slice(&res).map_err(NyxdError::from)?) } diff --git a/nym-connect/CHANGELOG.md b/nym-connect/CHANGELOG.md index 17bc105f2b..138b2beb0c 100644 --- a/nym-connect/CHANGELOG.md +++ b/nym-connect/CHANGELOG.md @@ -2,6 +2,8 @@ ## UNRELEASED +- Remove test and earn + ## [nym-connect-v1.1.6](https://github.com/nymtech/nym/tree/nym-connect-v1.1.6) (2023-01-17) - part (1) show gateway status on the UI if the gateway is not live, is overloaded or is slow ([#2824]) @@ -49,7 +51,6 @@ This release contains the new opt-in Test & Earn program, and it uses a stress-t [#1789]: https://github.com/nymtech/nym/pull/1789 [#1805]: https://github.com/nymtech/nym/pull/1805 - ## [nym-connect-v1.1.0](https://github.com/nymtech/nym/tree/nym-connect-v1.1.0) (2022-11-09) - nym-connect: rework of rewarding changes the directory data structures that describe the mixnet topology ([#1472]) @@ -77,7 +78,6 @@ This release contains the new opt-in Test & Earn program, and it uses a stress-t [#1540]: https://github.com/nymtech/nym/pull/1540 - ## [nym-connect-v1.0.1](https://github.com/nymtech/nym/tree/nym-connect-v1.0.1) (2022-07-22) ### Added diff --git a/nym-connect/src-tauri/tauri.conf.json b/nym-connect/src-tauri/tauri.conf.json index 1afe519f37..b9942d4537 100644 --- a/nym-connect/src-tauri/tauri.conf.json +++ b/nym-connect/src-tauri/tauri.conf.json @@ -68,7 +68,7 @@ { "title": "NymConnect", "width": 240, - "height": 675, + "height": 635, "resizable": false, "decorations": false, "transparent": true diff --git a/nym-connect/src/layouts/ConnectedLayout.tsx b/nym-connect/src/layouts/ConnectedLayout.tsx index ed51482042..da4c757208 100644 --- a/nym-connect/src/layouts/ConnectedLayout.tsx +++ b/nym-connect/src/layouts/ConnectedLayout.tsx @@ -53,6 +53,5 @@ export const ConnectedLayout: FCWithChildren<{ {/* */} - ); diff --git a/nym-connect/src/layouts/DefaultLayout.tsx b/nym-connect/src/layouts/DefaultLayout.tsx index ad4c5f018e..29858afe7f 100644 --- a/nym-connect/src/layouts/DefaultLayout.tsx +++ b/nym-connect/src/layouts/DefaultLayout.tsx @@ -44,8 +44,6 @@ export const DefaultLayout: FCWithChildren<{ isError={isError} onClick={onConnectClick} /> - - ); }; diff --git a/nym-wallet/CHANGELOG.md b/nym-wallet/CHANGELOG.md index 7e5efac2f3..d73e728f2a 100644 --- a/nym-wallet/CHANGELOG.md +++ b/nym-wallet/CHANGELOG.md @@ -4,7 +4,8 @@ ## [nym-wallet-v1.1.7](https://github.com/nymtech/nym/releases/tag/nym-wallet-v1.1.7) (2023-01-17) -- link to the ng mixnet explorer for account info ([#2823]) +- link to the ng mixnet explorer for account info ([#2823]) +- Fix delegations sorting ([#2885]) (2023-01-23) [#2823]: https://github.com/nymtech/nym/pull/2823 @@ -21,7 +22,7 @@ This release contains the APY calculator feature. ## [nym-wallet-v1.1.4](https://github.com/nymtech/nym/releases/tag/nym-wallet-v1.1.4) (2022-12-20) -This release contains a bugfix for hiding and displaying the mnemonic, and displays the Bity wallet address in the buy page, as well as better error handling. +This release contains a bugfix for hiding and displaying the mnemonic, and displays the Bity wallet address in the buy page, as well as better error handling. - wallet: present some cases of the more technical errors (abci, ..) in a more human readable form. - Bug fix/hide display mnemonic by @fmtabbara in https://github.com/nymtech/nym/pull/1874 @@ -41,13 +42,12 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - wallet: compatibility with nym-binaries-1.1.1 - ## [nym-wallet-v1.1.0](https://github.com/nymtech/nym/releases/tag/nym-wallet-v1.1.0) (2022-11-09) - wallet: Add window for showing logs for when the terminal is not available. - wallet: Rework of rewarding ([#1472]) - wallet: Highlight delegations on an unbonded node to notify the delegator to undelegate stake -- wallet: Group delegations on unbonded nodes at the top of the list +- wallet: Group delegations on unbonded nodes at the top of the list - wallet: Simplified delegation screen when user has no delegations - wallet: Update "create password" howto guide - wallet: Allow setting of operating cost when node is bonded @@ -67,7 +67,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - wallet: new bonding flow and screen for bonded node - wallet: compound and redeem functionalities for operator rewards -- wallet: a few minor touch ups and bug fixes +- wallet: a few minor touch ups and bug fixes ## [nym-wallet-v1.0.7](https://github.com/nymtech/nym/tree/nym-wallet-v1.0.7) (2022-07-11) @@ -76,7 +76,6 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ [#1388]: https://github.com/nymtech/nym/pull/1388 - ## [nym-wallet-v1.0.6](https://github.com/nymtech/nym/tree/nym-wallet-v1.0.6) (2022-06-21) - wallet: undelegating now uses either the mixnet or vesting contract, or both, depending on how delegations were made @@ -137,7 +136,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - Type safe bounds [\#1179](https://github.com/nymtech/nym/pull/1179) ([durch](https://github.com/durch)) - Fix delegation paging [\#1174](https://github.com/nymtech/nym/pull/1174) ([durch](https://github.com/durch)) - Update binaries to rc version [\#1172](https://github.com/nymtech/nym/pull/1172) ([tommyv1987](https://github.com/tommyv1987)) -- Bump ansi-regex from 4.1.0 to 4.1.1 in /docker/typescript\_client/upload\_contract [\#1171](https://github.com/nymtech/nym/pull/1171) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump ansi-regex from 4.1.0 to 4.1.1 in /docker/typescript_client/upload_contract [\#1171](https://github.com/nymtech/nym/pull/1171) ([dependabot[bot]](https://github.com/apps/dependabot)) ## [nym-wallet-v1.0.2](https://github.com/nymtech/nym/tree/nym-wallet-v1.0.2) (2022-04-05) @@ -153,7 +152,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - wallet: add test for decrypting stored wallet file [\#1189](https://github.com/nymtech/nym/pull/1189) ([octol](https://github.com/octol)) - Fix clippy warnings [\#1188](https://github.com/nymtech/nym/pull/1188) ([octol](https://github.com/octol)) - Password for wallet with routes [\#1187](https://github.com/nymtech/nym/pull/1187) ([mmsinclair](https://github.com/mmsinclair)) -- wallet: add validate\_mnemonic [\#1186](https://github.com/nymtech/nym/pull/1186) ([octol](https://github.com/octol)) +- wallet: add validate_mnemonic [\#1186](https://github.com/nymtech/nym/pull/1186) ([octol](https://github.com/octol)) - wallet: support removing accounts from the wallet file [\#1185](https://github.com/nymtech/nym/pull/1185) ([octol](https://github.com/octol)) - Feature/adding discord [\#1184](https://github.com/nymtech/nym/pull/1184) ([gala1234](https://github.com/gala1234)) - wallet: config backend for validator selection [\#1183](https://github.com/nymtech/nym/pull/1183) ([octol](https://github.com/octol)) @@ -192,7 +191,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ **Closed issues:** - Rewarded set inclusion probability API endpoint [\#1037](https://github.com/nymtech/nym/issues/1037) -- Update cw-storage-plus to 0.11 [\#1032](https://github.com/nymtech/nym/issues/1032) +- Update cw-storage-plus to 0.11 [\#1032](https://github.com/nymtech/nym/issues/1032) - Change `u128` fields in `RewardEstimationResponse` to `u64` [\#1029](https://github.com/nymtech/nym/issues/1029) - Test out the mainnet Gravity Bridge [\#1006](https://github.com/nymtech/nym/issues/1006) - Add vesting contract interface to nym-wallet [\#959](https://github.com/nymtech/nym/issues/959) @@ -214,7 +213,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - Bump follow-redirects from 1.14.1 to 1.14.7 in /clients/native/examples/js-examples/websocket [\#1079](https://github.com/nymtech/nym/pull/1079) ([dependabot[bot]](https://github.com/apps/dependabot)) - Bump nanoid from 3.1.23 to 3.2.0 in /clients/native/examples/js-examples/websocket [\#1078](https://github.com/nymtech/nym/pull/1078) ([dependabot[bot]](https://github.com/apps/dependabot)) - Setup basic test for mixnode stats reporting [\#1077](https://github.com/nymtech/nym/pull/1077) ([octol](https://github.com/octol)) -- Make wallet\_address mandatory for mixnode init [\#1076](https://github.com/nymtech/nym/pull/1076) ([octol](https://github.com/octol)) +- Make wallet_address mandatory for mixnode init [\#1076](https://github.com/nymtech/nym/pull/1076) ([octol](https://github.com/octol)) - Tidy nym-mixnode module visibility [\#1075](https://github.com/nymtech/nym/pull/1075) ([octol](https://github.com/octol)) - Feature/wallet login with password [\#1074](https://github.com/nymtech/nym/pull/1074) ([fmtabbara](https://github.com/fmtabbara)) - Add trait to mock client dependency in DelayForwarder [\#1073](https://github.com/nymtech/nym/pull/1073) ([octol](https://github.com/octol)) @@ -223,7 +222,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - Add @octol as codeowner [\#1068](https://github.com/nymtech/nym/pull/1068) ([octol](https://github.com/octol)) - set-up inclusion probability [\#1067](https://github.com/nymtech/nym/pull/1067) ([fmtabbara](https://github.com/fmtabbara)) - Feature/wasm client [\#1066](https://github.com/nymtech/nym/pull/1066) ([neacsu](https://github.com/neacsu)) -- Changed bech32\_prefix from punk to nymt [\#1064](https://github.com/nymtech/nym/pull/1064) ([jstuczyn](https://github.com/jstuczyn)) +- Changed bech32_prefix from punk to nymt [\#1064](https://github.com/nymtech/nym/pull/1064) ([jstuczyn](https://github.com/jstuczyn)) - Bump nanoid from 3.1.30 to 3.2.0 in /testnet-faucet [\#1063](https://github.com/nymtech/nym/pull/1063) ([dependabot[bot]](https://github.com/apps/dependabot)) - Bump nanoid from 3.1.30 to 3.2.0 in /nym-wallet [\#1062](https://github.com/nymtech/nym/pull/1062) ([dependabot[bot]](https://github.com/apps/dependabot)) - Rework vesting contract storage [\#1061](https://github.com/nymtech/nym/pull/1061) ([durch](https://github.com/durch)) diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 094176c68b..09241b5cfa 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -2932,7 +2932,7 @@ dependencies = [ [[package]] name = "nym_wallet" -version = "1.1.6" +version = "1.1.7" dependencies = [ "aes-gcm", "argon2 0.3.4", diff --git a/nym-wallet/src/components/Delegation/DelegationList.tsx b/nym-wallet/src/components/Delegation/DelegationList.tsx index 1e9599b8f1..42f4a5e3a3 100644 --- a/nym-wallet/src/components/Delegation/DelegationList.tsx +++ b/nym-wallet/src/components/Delegation/DelegationList.tsx @@ -12,13 +12,16 @@ import { } from '@mui/material'; import { visuallyHidden } from '@mui/utils'; import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; +import { orderBy as _orderBy } from 'lodash'; import { DelegationWithEverything } from '@nymproject/types'; import { DelegationListItemActions } from './DelegationActions'; -import { DelegationWithEvent, isDelegation, isPendingDelegation, TDelegations } from '../../context/delegations'; +import { isDelegation, isPendingDelegation, TDelegations } from '../../context/delegations'; import { DelegationItem } from './DelegationItem'; import { PendingDelegationItem } from './PendingDelegationItem'; type Order = 'asc' | 'desc'; +type AdditionalTypes = { profit_margin_percent: number; operating_cost: number }; +type SortingKeys = keyof AdditionalTypes | keyof DelegationWithEverything; interface EnhancedTableProps { onRequestSort: (event: React.MouseEvent, property: string) => void; @@ -82,7 +85,8 @@ const EnhancedTableHead: FCWithChildren = ({ order, orderBy, ); }; -const sortByUnbondedMixnodeFirst = (a: DelegationWithEvent) => { +// Pin delegations on unbonded nodes to the top of the list +const sortByUnbondedMixnodeFirst = (a: any) => { if (!a.node_identity) return -1; return 1; }; @@ -95,21 +99,47 @@ export const DelegationList: FCWithChildren<{ // eslint-disable-next-line @typescript-eslint/no-unused-vars }> = ({ isLoading, items, onItemActionClick, explorerUrl }) => { const [order, setOrder] = React.useState('asc'); - const [orderBy, setOrderBy] = React.useState('delegated_on_iso_datetime'); + const [orderBy, setOrderBy] = React.useState('delegated_on_iso_datetime'); - const handleRequestSort = (event: React.MouseEvent, property: string) => { + const handleRequestSort = (event: React.MouseEvent, property: any) => { const isAsc = orderBy === property && order === 'asc'; setOrder(isAsc ? 'desc' : 'asc'); setOrderBy(property); }; + // if sorting by either amount or unclaimed_rewards + // base sorting on their number counterparts + const mapOrderBy = (key: SortingKeys) => { + if (key === 'amount') return 'delegationValue'; + if (key === 'unclaimed_rewards') return 'operatorReward'; + if (key === 'profit_margin_percent') return 'profitMarginValue'; + if (key === 'operating_cost') return 'operatorCostValue'; + return key; + }; + + const mapAndSort = (_items: TDelegations) => { + const map = _items.map((item) => + isDelegation(item) + ? { + ...item, + delegationValue: Number(item.amount.amount), + operatorReward: Number(item.unclaimed_rewards?.amount), + profitMarginValue: Number(item.cost_params?.profit_margin_percent), + operatorCostValue: Number(item.cost_params?.interval_operating_cost), + } + : item, + ); + + return _orderBy(map, mapOrderBy(orderBy), order).sort(sortByUnbondedMixnodeFirst); + }; + return ( {items.length ? ( - items.sort(sortByUnbondedMixnodeFirst).map((item) => { + mapAndSort(items).map((item: any) => { if (isPendingDelegation(item)) return ; if (isDelegation(item)) return (