Skip to content

Commit

Permalink
web: Add global neo network variable, closes #117
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Petrov <[email protected]>
  • Loading branch information
mike-petrov committed Jan 11, 2024
1 parent 5e6e2d0 commit 1a276db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ REACT_APP_RESTGW=https://rest.fs.neo.org/v1
REACT_APP_HTTPGW=https://http.fs.neo.org

# Mainnet NeoFS contract
REACT_APP_NETWORK=mainnet
REACT_APP_NEOFS_ACCOUNT=NNxVrKjLsRkWsmGgmuNXLcMswtxTGaNQLk
REACT_APP_NEOFS_SCRIPT_HASH=0x2cafa46838e8b564468ebd868dcafdd99dce6221
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Set variables in `.env` file
containers and object in neofs (control path)
- `REACT_APP_HTTPGW` - [NeoFS HTTP Gateway](https://github.com/nspcc-dev/neofs-http-gw), which we use to get objects (
data path)
- `REACT_APP_NETWORK` - Network of the Neo (might be `mainnet`, `testnet`)
- `REACT_APP_NEOFS_ACCOUNT` - Neo3 address of the NeoFS contract
- `REACT_APP_NEOFS_SCRIPT_HASH` - Script hash of the NeoFS contract

Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import './App.css';
export const App = () => {
const location = useLocation();
const wcSdk = useWalletConnect();
const [activeNet] = useState('neo3:mainnet');
const [activeNet] = useState(process.env.REACT_APP_NETWORK ? process.env.REACT_APP_NETWORK : 'mainnet');

const [ContentTypeHeader] = useState("Content-Type");
const [AuthorizationHeader] = useState("Authorization");
Expand Down Expand Up @@ -474,7 +474,7 @@ export const App = () => {

const onConnectWallet = async () => {
try {
const { uri, approval } = await wcSdk.createConnection(activeNet, ['invokeFunction', 'testInvoke', 'signMessage', 'verifyMessage']);
const { uri, approval } = await wcSdk.createConnection(`neo3:${activeNet}`, ['invokeFunction', 'testInvoke', 'signMessage', 'verifyMessage']);
onModal('connectWallet', uri);
const session = await approval();
wcSdk.setSession(session);
Expand Down

0 comments on commit 1a276db

Please sign in to comment.