Skip to content

Commit

Permalink
web: Get fees dynamically
Browse files Browse the repository at this point in the history
for namedContainerFee & withdrawalFee

closes #209

Signed-off-by: Mikhail Petrov <[email protected]>
  • Loading branch information
mike-petrov committed Aug 8, 2024
1 parent 4b0e5a0 commit fa4cd77
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const App = () => {
rest_gw: process.env.REACT_APP_RESTGW ? process.env.REACT_APP_RESTGW : 'https://rest.t5.fs.neo.org/v1',
});

const [networkInfo, setNetworkInfo] = useState(null);
const [depositQuantity, setDepositQuantity] = useState(0);
const [withdrawQuantity, setWithdrawQuantity] = useState(0);
const [attributes, setAttributes] = useState([]);
Expand Down Expand Up @@ -214,6 +215,12 @@ export const App = () => {
onPopup('success', 'Wallet connected');
onModal();

api('GET', '/network-info').then((e) => {
if (!e.message) {
setNetworkInfo(e);
}
});

if (location.pathname.indexOf('/profile') === -1 && location.pathname.indexOf('/getobject') === -1) {
navigate('/profile');
}
Expand Down Expand Up @@ -1083,7 +1090,7 @@ export const App = () => {
Container creation is a paid operation, make sure you have sufficient NeoFS chain balance
</Notification>
)}
<Heading className="input_caption">Container cost is 0.0070000014 GAS for mainnet now.</Heading>
<Heading className="input_caption">{`Container cost is ${networkInfo ? networkInfo.namedContainerFee * 0.00000001 : '-'} GAS for mainnet now.`}</Heading>
<Form.Field>
<Form.Label>Name</Form.Label>
<Form.Control>
Expand Down Expand Up @@ -1717,7 +1724,7 @@ export const App = () => {
/>
</div>
<Heading align="center" size={5} weight="bold">{`Withdraw from NeoFS to ${activeNet}`}</Heading>
<Heading className="input_caption" style={{ maxWidth: 320 }}>Withdrawing requires a fee to be paid, currently it's 7 GAS. It will be reduced once the <a href="https://github.com/neo-project/neo/issues/1573" target="_blank" rel="noopener noreferrer" alt="neofs-node">notary subsystem</a> is implemented in Neo</Heading>
<Heading className="input_caption" style={{ maxWidth: 310 }}>{`Withdrawing requires a fee to be paid, currently it's ${networkInfo ? networkInfo.withdrawalFee * 0.00000001 : '-'} GAS.`} It will be reduced once the <a href="https://github.com/neo-project/neo/issues/1573" target="_blank" rel="noopener noreferrer" alt="neofs-node">notary subsystem</a> is implemented in Neo</Heading>
<Form.Field>
<Form.Label size="small" weight="light">Quantity (GAS)</Form.Label>
<Form.Control>
Expand Down

0 comments on commit fa4cd77

Please sign in to comment.