wip
This commit is contained in:
@@ -9,7 +9,7 @@ MIX_DENOM_DISPLAY=nym
|
||||
STAKE_DENOM=unyx
|
||||
STAKE_DENOM_DISPLAY=nyx
|
||||
DENOMS_EXPONENT=6
|
||||
MIXNET_CONTRACT_ADDRESS=n1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsd3qaep
|
||||
MIXNET_CONTRACT_ADDRESS=n1rjzps6qrmdqmf0xz4cn4x4rcmqeqzq6hnzqg4wcvd0r2lyasdq5sepn5s8
|
||||
VESTING_CONTRACT_ADDRESS=n1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3sjkxkav
|
||||
BANDWIDTH_CLAIM_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
COCONUT_BANDWIDTH_CONTRACT_ADDRESS=n1ghd753shjuwexxywmgs4xz7x2q732vcn7ty4yw
|
||||
|
||||
@@ -160,7 +160,7 @@ mod qa {
|
||||
pub(crate) const STAKE_DENOM: DenomDetails = DenomDetails::new("unyx", "nyx", 6);
|
||||
|
||||
pub(crate) const MIXNET_CONTRACT_ADDRESS: &str =
|
||||
"n1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsd3qaep";
|
||||
"n1rjzps6qrmdqmf0xz4cn4x4rcmqeqzq6hnzqg4wcvd0r2lyasdq5sepn5s8";
|
||||
pub(crate) const VESTING_CONTRACT_ADDRESS: &str =
|
||||
"n1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3sjkxkav";
|
||||
pub(crate) const BANDWIDTH_CLAIM_CONTRACT_ADDRESS: &str =
|
||||
|
||||
@@ -118,14 +118,16 @@ export const BondedMixnode = ({
|
||||
</Stack>
|
||||
}
|
||||
Action={
|
||||
<Button
|
||||
variant="text"
|
||||
color="secondary"
|
||||
onClick={() => navigate('/bonding/node-settings')}
|
||||
startIcon={<NodeIcon />}
|
||||
>
|
||||
Settings
|
||||
</Button>
|
||||
mixnode.type === 'mixnode' && (
|
||||
<Button
|
||||
variant="text"
|
||||
color="secondary"
|
||||
onClick={() => navigate('/bonding/node-settings')}
|
||||
startIcon={<NodeIcon />}
|
||||
>
|
||||
Settings
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
>
|
||||
<NodeTable headers={headers} cells={cells} />
|
||||
|
||||
@@ -35,6 +35,7 @@ import { attachDefaultOperatingCost, toPercentFloatString, toPercentIntegerStrin
|
||||
|
||||
// TODO add relevant data
|
||||
export type TBondedMixnode = {
|
||||
type: 'mixnode';
|
||||
name?: string;
|
||||
identityKey: string;
|
||||
stake: DecCoin;
|
||||
@@ -48,12 +49,12 @@ export type TBondedMixnode = {
|
||||
host: string;
|
||||
httpApiPort: number;
|
||||
mixPort: number;
|
||||
profitMarginPercent: number;
|
||||
verlocPort: number;
|
||||
version: string;
|
||||
};
|
||||
|
||||
export interface TBondedGateway {
|
||||
type: 'gateway';
|
||||
name: string;
|
||||
identityKey: string;
|
||||
ip: string;
|
||||
@@ -63,7 +64,6 @@ export interface TBondedGateway {
|
||||
host: string;
|
||||
httpApiPort: number;
|
||||
mixPort: number;
|
||||
profitMarginPercent: number;
|
||||
verlocPort: number;
|
||||
version: string;
|
||||
}
|
||||
@@ -167,45 +167,34 @@ export const BondingContextProvider = ({ children }: { children?: React.ReactNod
|
||||
Console.warn(`get_operator_rewards request failed: ${e}`);
|
||||
}
|
||||
if (data) {
|
||||
// const { mix_node } = data;
|
||||
// const { status, stakeSaturation, numberOfDelegators } = await getAdditionalMixnodeDetails(
|
||||
// data.mix_node.identity_key,
|
||||
// );
|
||||
console.log('data', data);
|
||||
const { status, stakeSaturation } = await getAdditionalMixnodeDetails(data.bond_information.id);
|
||||
const { bond_information, rewarding_details } = data;
|
||||
const { status, stakeSaturation } = await getAdditionalMixnodeDetails(bond_information.id);
|
||||
const nodeDescription = await getNodeDescription(
|
||||
data.bond_information.mix_node.host,
|
||||
data.bond_information.mix_node.http_api_port,
|
||||
bond_information.mix_node.host,
|
||||
bond_information.mix_node.http_api_port,
|
||||
);
|
||||
setBondedNode({
|
||||
type: ownership.nodeType,
|
||||
name: nodeDescription?.name,
|
||||
identityKey: data.bond_information.mix_node.identity_key,
|
||||
ip: '',
|
||||
identityKey: bond_information.mix_node.identity_key,
|
||||
ip: bond_information.id,
|
||||
stake: {
|
||||
amount: calculateStake(data.rewarding_details.operator, data.rewarding_details.delegates).toString(),
|
||||
denom: data.bond_information.original_pledge.denom,
|
||||
amount: calculateStake(rewarding_details.operator, data.rewarding_details.delegates).toString(),
|
||||
denom: bond_information.original_pledge.denom,
|
||||
},
|
||||
bond: data.bond_information.original_pledge,
|
||||
profitMargin: toPercentIntegerString(data.rewarding_details.cost_params.profit_margin_percent),
|
||||
delegators: data.rewarding_details.unique_delegations,
|
||||
proxy: data.bond_information.proxy,
|
||||
bond: bond_information.original_pledge,
|
||||
profitMargin: toPercentIntegerString(rewarding_details.cost_params.profit_margin_percent),
|
||||
delegators: rewarding_details.unique_delegations,
|
||||
proxy: bond_information.proxy,
|
||||
operatorRewards,
|
||||
status,
|
||||
stakeSaturation,
|
||||
host: '1.2.34.5',
|
||||
httpApiPort: 8000,
|
||||
mixPort: 1789,
|
||||
profitMarginPercent: 10,
|
||||
verlocPort: 1790,
|
||||
version: '1.0.2',
|
||||
host: bond_information.mix_node.host.replace(/\s/g, ''),
|
||||
httpApiPort: bond_information.mix_node.http_api_port,
|
||||
mixPort: bond_information.mix_node.mix_port,
|
||||
verlocPort: bond_information.mix_node.verloc_port,
|
||||
version: bond_information.mix_node.version,
|
||||
} as TBondedMixnode);
|
||||
|
||||
// host: mix_node.host.replace(/\s/g, ''),
|
||||
// httpApiPort: mix_node.http_api_port,
|
||||
// mixPort: mix_node.mix_port,
|
||||
// profitMarginPercent: mix_node.profit_margin_percent,
|
||||
// verlocPort: mix_node.verloc_port,
|
||||
// version: mix_node.version,
|
||||
}
|
||||
} catch (e: any) {
|
||||
Console.warn(e);
|
||||
@@ -220,6 +209,7 @@ export const BondingContextProvider = ({ children }: { children?: React.ReactNod
|
||||
const nodeDescription = await getNodeDescription(data.gateway.host, data.gateway.clients_port);
|
||||
|
||||
setBondedNode({
|
||||
type: ownership.nodeType,
|
||||
name: nodeDescription?.name,
|
||||
identityKey: data.gateway.identity_key,
|
||||
ip: data.gateway.host,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { mockSleep } from './utils';
|
||||
const SLEEP_MS = 1000;
|
||||
|
||||
const bondedMixnodeMock: TBondedMixnode = {
|
||||
type: 'mixnode',
|
||||
name: 'Monster node',
|
||||
identityKey: '7mjM2fYbtN6kxMwp1TrmQ4VwPks3URR5pBgWPWhzT98F',
|
||||
stake: { denom: 'nym', amount: '1234' },
|
||||
@@ -19,12 +20,12 @@ const bondedMixnodeMock: TBondedMixnode = {
|
||||
host: '1.2.34.5 ',
|
||||
httpApiPort: 8000,
|
||||
mixPort: 1789,
|
||||
profitMarginPercent: 10,
|
||||
verlocPort: 1790,
|
||||
version: '1.0.2',
|
||||
};
|
||||
|
||||
const bondedGatewayMock: TBondedGateway = {
|
||||
type: 'gateway',
|
||||
name: 'Monster node',
|
||||
identityKey: 'WayM2fYbtN6kxMwp1TrmQ4VwPks3URR5pBgWPWhzT98F',
|
||||
ip: '112.43.234.57',
|
||||
@@ -32,7 +33,6 @@ const bondedGatewayMock: TBondedGateway = {
|
||||
host: '1.2.34.5 ',
|
||||
httpApiPort: 8000,
|
||||
mixPort: 1789,
|
||||
profitMarginPercent: 10,
|
||||
verlocPort: 1790,
|
||||
version: '1.0.2',
|
||||
};
|
||||
|
||||
@@ -6,12 +6,14 @@ import { TBondedMixnode, TBondedGateway } from '../../../../context/bonding';
|
||||
import { SimpleModal } from '../../../../components/Modals/SimpleModal';
|
||||
|
||||
export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode | TBondedGateway }) => {
|
||||
const { profitMarginPercent, bond } = bondedNode;
|
||||
const { bond } = bondedNode;
|
||||
|
||||
const [buttonActive, setButtonActive] = useState<boolean>(false);
|
||||
const [open, setOpen] = useState(true);
|
||||
const [openConfirmationModal, setOpenConfirmationModal] = useState<boolean>(false);
|
||||
const [profitMargin, setProfitMargin] = useState<number>(profitMarginPercent);
|
||||
const [profitMarginPercent, setProfitMarginPercent] = useState<string>(
|
||||
bondedNode.type === 'mixnode' ? bondedNode.profitMargin : '',
|
||||
);
|
||||
const [operatorCost, setOperatorCost] = useState<number>(parseInt(bond.amount));
|
||||
|
||||
const theme = useTheme();
|
||||
@@ -29,7 +31,7 @@ export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode
|
||||
const numNewValue = parseInt(value) || 0;
|
||||
switch (id) {
|
||||
case 'profitMargin':
|
||||
setProfitMargin(numNewValue);
|
||||
setProfitMarginPercent(value);
|
||||
break;
|
||||
case 'operatorCost':
|
||||
setOperatorCost(numNewValue);
|
||||
|
||||
Reference in New Issue
Block a user