Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Fees management' left side menu option hidden when using Metamask #978

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 86 additions & 101 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,94 +13,99 @@
- [Stablecoin Studio SDK](#stablecoin-studio-sdk)
- [Table of contents](#table-of-contents)
- [Overview](#overview)
- [Installation](#installation) - [Prerequisites](#prerequisites) - [Steps](#steps) - [**For projects (WIP - when published)**](#for-projects-wip---when-published) - [**For development**](#for-development)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Steps](#steps)
- [**For projects (WIP - when published)**](#for-projects-wip---when-published)
- [**For development**](#for-development)
- [Build](#build)
- [Quick Start](#quick-start)
- [Initialization](#initialization)
- [Connect SDK](#connect-sdk)
- [Wallet Events](#wallet-events)
- [Initialization](#initialization)
- [Connect SDK](#connect-sdk)
- [Wallet Events](#wallet-events)
- [Usage](#usage)
- [About Operations Execution](#about-operations-execution)
- [StableCoin](#stablecoin)
- [Create](#create)
- [Creates a simple stablecoin, with all keys set to the Smart Contracts](#creates-a-simple-stablecoin-with-all-keys-set-to-the-smart-contracts)
- [Creates a simple stablecoin, with all keys set to the admin's public key](#creates-a-simple-stablecoin-with-all-keys-set-to-the-admins-public-key)
- [Creates a simple stablecoin, with all keys set to none](#creates-a-simple-stablecoin-with-all-keys-set-to-none)
- [GetInfo](#getinfo)
- [GetBalanceOf](#getbalanceof)
- [GetBalanceOfHBAR](#getbalanceofhbar)
- [Associate](#associate)
- [isAccountAssociated](#isaccountassociated)
- [CashIn](#cashin)
- [Burn](#burn)
- [Rescue](#rescue)
- [Rescue HBAR](#rescue-hbar)
- [Wipe](#wipe)
- [Pause](#pause)
- [Unpause](#unpause)
- [Freeze](#freeze)
- [Unfreeze](#unfreeze)
- [GrantKYC](#grantkyc)
- [RevokeKYC](#revokekyc)
- [IsAccountKYCGranted](#isaccountkycgranted)
- [Transfers](#transfers)
- [Update](#update)
- [Delete](#delete)
- [GetReserveAddress](#getreserveaddress)
- [UpdateReserveAddress](#updatereserveaddress)
- [Capabilities](#capabilities)
- [Proxy](#proxy)
- [GetProxyConfig](#getproxyconfig)
- [ChangeProxyOwner](#changeproxyowner)
- [AcceptProxyOwner](#acceptproxyowner)
- [UpgradeImplementation](#upgradeimplementation)
- [GetFactoryProxyConfig](#getfactoryproxyconfig)
- [UpgradeFactoryImplementation](#upgradefactoryimplementation)
- [ChangeFactoryProxyOwner](#changefactoryproxyowner)
- [Network](#network)
- [Connect](#connect)
- [Disconnect](#disconnect)
- [Init](#init)
- [SetNetwork](#setnetwork)
- [GetNetwork](#getnetwork)
- [IsNetworkRecognized](#isnetworkrecognized)
- [SetConfig](#setconfig)
- [GetFactoryAddress](#getfactoryaddress)
- [Event](#event)
- [Register](#register)
- [Account](#account)
- [GetPublicKey](#getpublickey)
- [ListStableCoins](#liststablecoins)
- [GetInfo](#getinfo-1)
- [Role](#role)
- [HasRole](#hasrole)
- [GrantRole](#grantrole)
- [GrantMultiRoles](#grantmultiroles)
- [RevokeRole](#revokerole)
- [RevokeMultiRole](#revokemultirole)
- [GetRoles](#getroles)
- [GetAccountsWithRoles](#getaccountswithroles)
- [GetAllowance](#getallowance)
- [ResetAllowance](#resetallowance)
- [IncreaseAllowance](#increaseallowance)
- [DecreaseAllowance](#decreaseallowance)
- [IsLimited](#islimited)
- [IsUnlimited](#isunlimited)
- [Reserve Data Feed](#reserve-data-feed)
- [Get Reserve Amount](#get-reserve-amount)
- [Update Reserve Amount](#update-reserve-amount)
- [Factory](#factory)
- [GetHederaTokenManagerList](#gethederatokenmanagerlist)
- [Common](#common)
- [Testing](#testing) - [Jest](#jest)
- [About Operations Execution](#about-operations-execution)
- [StableCoin](#stablecoin)
- [Create](#create)
- [Creates a simple stablecoin, with all keys set to the Smart Contracts](#creates-a-simple-stablecoin-with-all-keys-set-to-the-smart-contracts)
- [Creates a simple stablecoin, with all keys set to the admin's public key](#creates-a-simple-stablecoin-with-all-keys-set-to-the-admins-public-key)
- [Creates a simple stablecoin, with all keys set to none](#creates-a-simple-stablecoin-with-all-keys-set-to-none)
- [GetInfo](#getinfo)
- [GetBalanceOf](#getbalanceof)
- [GetBalanceOfHBAR](#getbalanceofhbar)
- [Associate](#associate)
- [isAccountAssociated](#isaccountassociated)
- [CashIn](#cashin)
- [Burn](#burn)
- [Rescue](#rescue)
- [Rescue HBAR](#rescue-hbar)
- [Wipe](#wipe)
- [Pause](#pause)
- [Unpause](#unpause)
- [Freeze](#freeze)
- [Unfreeze](#unfreeze)
- [GrantKYC](#grantkyc)
- [RevokeKYC](#revokekyc)
- [IsAccountKYCGranted](#isaccountkycgranted)
- [Transfers](#transfers)
- [Update](#update)
- [Delete](#delete)
- [GetReserveAddress](#getreserveaddress)
- [UpdateReserveAddress](#updatereserveaddress)
- [Capabilities](#capabilities)
- [Proxy](#proxy)
- [GetProxyConfig](#getproxyconfig)
- [ChangeProxyOwner](#changeproxyowner)
- [AcceptProxyOwner](#acceptproxyowner)
- [UpgradeImplementation](#upgradeimplementation)
- [GetFactoryProxyConfig](#getfactoryproxyconfig)
- [UpgradeFactoryImplementation](#upgradefactoryimplementation)
- [ChangeFactoryProxyOwner](#changefactoryproxyowner)
- [Network](#network)
- [Connect](#connect)
- [Disconnect](#disconnect)
- [Init](#init)
- [SetNetwork](#setnetwork)
- [GetNetwork](#getnetwork)
- [IsNetworkRecognized](#isnetworkrecognized)
- [SetConfig](#setconfig)
- [GetFactoryAddress](#getfactoryaddress)
- [Event](#event)
- [Register](#register)
- [Account](#account)
- [GetPublicKey](#getpublickey)
- [ListStableCoins](#liststablecoins)
- [GetInfo](#getinfo-1)
- [Role](#role)
- [HasRole](#hasrole)
- [GrantRole](#grantrole)
- [GrantMultiRoles](#grantmultiroles)
- [RevokeRole](#revokerole)
- [RevokeMultiRole](#revokemultirole)
- [GetRoles](#getroles)
- [GetAccountsWithRoles](#getaccountswithroles)
- [GetAllowance](#getallowance)
- [ResetAllowance](#resetallowance)
- [IncreaseAllowance](#increaseallowance)
- [DecreaseAllowance](#decreaseallowance)
- [IsLimited](#islimited)
- [IsUnlimited](#isunlimited)
- [Reserve Data Feed](#reserve-data-feed)
- [Get Reserve Amount](#get-reserve-amount)
- [Update Reserve Amount](#update-reserve-amount)
- [Factory](#factory)
- [GetHederaTokenManagerList](#gethederatokenmanagerlist)
- [Common](#common)
- [Testing](#testing)
- [Jest](#jest)
- [Typescript](#typescript)
- [Tsconfig](#tsconfig)
- [Client side](#client-side)
- [Server side](#server-side)
- [Tsconfig](#tsconfig)
- [Client side](#client-side)
- [Server side](#server-side)
- [Support](#support)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [License](#license)
- [License](#license)

# Overview

Expand Down Expand Up @@ -628,10 +633,6 @@ Wipes an amount of tokens from an account. The operating account must have the w
```

### Pause
<<<<<<< HEAD
=======

>>>>>>> origin/main
Pauses a stablecoin. None of the operations can be taken while the stablecoin is in paused state. The operating account must have the pause role.

**Spec:**
Expand All @@ -651,10 +652,6 @@ Pauses a stablecoin. None of the operations can be taken while the stablecoin is
```

### Unpause
<<<<<<< HEAD
=======

>>>>>>> origin/main
Unpauses a stablecoin. If the stablecoin is not paused it will throw an exception. The operating account must have the pause role.

**Spec:**
Expand All @@ -674,10 +671,6 @@ Unpauses a stablecoin. If the stablecoin is not paused it will throw an exceptio
```

### Freeze
<<<<<<< HEAD
=======

>>>>>>> origin/main
Prevents transfer of a stablecoin to/from an account. The operating account must have the freeze role.

**Spec:**
Expand All @@ -698,10 +691,6 @@ Prevents transfer of a stablecoin to/from an account. The operating account must
```

### Unfreeze
<<<<<<< HEAD
=======

>>>>>>> origin/main
Enables transfer of a stablecoin to/from an account. The operating account must have the freeze role.

**Spec:**
Expand Down Expand Up @@ -870,10 +859,6 @@ import {
```

### Delete
<<<<<<< HEAD
=======

>>>>>>> origin/main
Deletes a stablecoin. **Important** this operation is not reversible. The operating account must have the admin role.

**Spec:**
Expand Down
2 changes: 2 additions & 0 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ This menú option displays stablecoin details and also allows the user to update

If your account has the stablecoin fee role, you will also be allowed to manage the token's custom fees.

This menu option will only be visible when using Hashpack or Blade, and will soon be available when using Metamask as well.

### Proof of reserve

![image](https://user-images.githubusercontent.com/110887433/213154467-70663bd0-2116-4121-9b3a-3028e4309fff.png)
Expand Down
9 changes: 7 additions & 2 deletions web/src/layout/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Flex } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { NamedRoutes } from '../../Router/NamedRoutes';
import SidebarOption from './SidebarOption';
import { SELECTED_WALLET_COIN } from '../../store/slices/walletSlice';
import { SELECTED_WALLET_COIN, LAST_WALLET_SELECTED } from '../../store/slices/walletSlice';
import { useSelector } from 'react-redux';
import { SupportedWallets } from '@hashgraph/stablecoin-npm-sdk';

interface optionsProps {
icon: string;
Expand All @@ -16,6 +17,8 @@ interface optionsProps {
const Sidebar = () => {
const { t } = useTranslation('global');
const selectedStableCoin = useSelector(SELECTED_WALLET_COIN);
const lastWalletSelected = useSelector(LAST_WALLET_SELECTED);

const options: optionsProps[] = [
{
icon: 'Coin',
Expand All @@ -37,7 +40,9 @@ const Sidebar = () => {
icon: 'Receipt',
title: t('sidebar.feesManagement'),
route: NamedRoutes.FeesManagement,
isHidden: selectedStableCoin && !selectedStableCoin.feeScheduleKey,
isHidden:
lastWalletSelected === SupportedWallets.METAMASK ||
(selectedStableCoin && !selectedStableCoin.feeScheduleKey),
},
{
icon: 'File',
Expand Down
Loading