Merge pull request #21 from nimbus-gui/rd.create-deposits

Create deposits
This commit is contained in:
Radoslav Dimchev 2023-10-12 17:59:25 +03:00 committed by GitHub
commit 6b08f7ec85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 138 additions and 75 deletions

View File

@ -36,7 +36,7 @@
"@web3-onboard/injected-wallets": "^2.10.6",
"@web3-onboard/ledger": "^2.5.2",
"@web3-onboard/react": "^2.8.13",
"@web3-onboard/walletconnect": "^2.4.6",
"@web3-onboard/walletconnect": "^2.4.7",
"chart.js": "^4.4.0",
"emoji-picker-react": "^4.4.11",
"ethers": "^6.7.1",

View File

@ -16,30 +16,14 @@ import PairDevice from './pages/PairDevice/PairDevice'
import PinnedNotification from './components/General/PinnedNottification'
import CreateLocalNodePage from './pages/CreateLocalNodePage/CreateLocalNodePage'
import ValidatorOnboarding from './pages/ValidatorOnboarding/ValidatorOnboarding'
import { ethereumRopsten, wcV2InitOptions, apiKey } from './constants'
import Dashboard from './pages/Dashboard/Dashboard'
import './App.css'
import ConnectExistingInstance from './pages/ConnectExistingInstance/ConnectExistingInstance'
import './App.css'
const apiKey = '1730eff0-9d50-4382-a3fe-89f0d34a2070'
const INFURA_KEY = 'f25e905e25a545dcaad2c939530b91db'
const rpcUrl = `https://mainnet.infura.io/v3/${INFURA_KEY}`
const wcV2InitOptions = {
projectId: 'abc123...',
requiredChains: [1, 56],
dappUrl: 'http://YourAwesomeDapp.com',
}
const injected = injectedModule()
const walletConnect = walletConnectModule(wcV2InitOptions)
const ethereumRopsten = {
id: '0x3',
token: 'rETH',
label: 'Ethereum Ropsten',
rpcUrl,
}
const chains = [ethereumRopsten]
const wallets = [injected, walletConnect]
const web3Onboard = init({

View File

@ -1,21 +1,35 @@
// App
export const apiKey = '1730eff0-9d50-4382-a3fe-89f0d34a2070'
const INFURA_KEY = 'f25e905e25a545dcaad2c939530b91db'
const rpcUrl = `https://mainnet.infura.io/v3/${INFURA_KEY}`
export const wcV2InitOptions = {
projectId: '4f6c353926c22973029147b9d85c4485',
requiredChains: [1, 56],
dappUrl: 'http://localhost:5173/',
}
export const ethereumRopsten = {
id: '0x3',
token: 'rETH',
label: 'Ethereum Ropsten',
rpcUrl,
}
// Device Health Check
export const GOOD_STORAGE_TEXT =
'You have plenty of storage available for additional node services.'
export const GOOD_CPU_CLOCK_RATE_TEXT = '2.4GHz is recommended for CPU.'
export const GOOD_RAM_MEMORY_TEXT = 'There is sufficient RAM required for selected services.'
export const GOOD_NETWORK_TEXT = 'Network Latency is low.'
export const BAD_STORAGE_TEXT =
'Your storage is running low as required for additional node services.'
export const BAD_CPU_CLOCK_RATE_TEXT = 'Your CPU clock rate is below the recommended 2.4GHz.'
export const BAD_RAM_MEMORY_TEXT = 'There is insufficient RAM required for selected services.'
export const BAD_NETWORK_TEXT = 'Network Latency is high.'
/* Validator Onboarding */
// Validator Onboarding
export const KEYSTORE_FILES = 'KeystoreFiles'
export const RECOVERY_PHRASE = 'Recovery Phrase'
export const BOTH_KEY_AND_RECOVERY = 'Both KeystoreFiles & Recovery Phrase'
export const ETH_PER_VALIDATOR = 32
// for now, this will be constant values

View File

@ -2,9 +2,9 @@ import { Avatar, Button } from '@status-im/components'
import { useAccountCenter, useConnectWallet } from '@web3-onboard/react'
import { XStack } from 'tamagui'
import { useDispatch } from 'react-redux'
import { useEffect } from 'react'
import { setIsWalletConnected } from '../../../redux/ValidatorOnboarding/Deposit/slice'
import { useEffect } from 'react'
const ConnectWallet = () => {
const [{ wallet, connecting }, connect, disconnect] = useConnectWallet()
@ -28,11 +28,6 @@ const ConnectWallet = () => {
}
}
// let ethersProvider
// if (wallet) {
// ethersProvider = new ethers.BrowserProvider(wallet.provider, 'any')
// }
return (
<XStack space={'$2'} alignItems={'center'}>
<Avatar type="icon" size={32} icon={<img src={'/icons/eth-logo.svg'} alt="eth-logo" />} />

View File

@ -1,11 +1,11 @@
import { Avatar, Text } from '@status-im/components'
import { Stack, XStack, YStack } from 'tamagui'
import { getFormattedWalletAddress } from '../../../utilities'
import { useConnectWallet } from '@web3-onboard/react'
import { useEffect, useState } from 'react'
import { ethers } from 'ethers'
import { formatToFixed4, getFormattedWalletAddress } from '../../../utilities'
const ConnectedWallet = () => {
const [{ wallet }] = useConnectWallet()
const [address, setAddress] = useState('')
@ -60,7 +60,7 @@ const ConnectedWallet = () => {
Balance
</Text>
<Text size={27} weight={'semibold'}>
{balance} ETH
{formatToFixed4(balance)} ETH
</Text>
</YStack>
</XStack>

View File

@ -48,3 +48,13 @@ export const getFormattedWalletAddress = (address: string) => {
// 0xb9dasdfc35 -> 0xb9d...c35
return `${address.slice(0, 5)}...${address.slice(-3)}`
}
export const formatToFixed4 = (value: string) => {
const decimalPart = value.split('.')[1]
const decimalLength = decimalPart ? decimalPart.length : 0
if (decimalLength > 4) {
return Number(value).toFixed(4)
}
return value
}

148
yarn.lock
View File

@ -9342,9 +9342,9 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/core@npm:2.10.1":
version: 2.10.1
resolution: "@walletconnect/core@npm:2.10.1"
"@walletconnect/core@npm:2.10.2":
version: 2.10.2
resolution: "@walletconnect/core@npm:2.10.2"
dependencies:
"@walletconnect/heartbeat": 1.2.1
"@walletconnect/jsonrpc-provider": 1.0.13
@ -9357,12 +9357,12 @@ __metadata:
"@walletconnect/relay-auth": ^1.0.4
"@walletconnect/safe-json": ^1.0.2
"@walletconnect/time": ^1.0.2
"@walletconnect/types": 2.10.1
"@walletconnect/utils": 2.10.1
"@walletconnect/types": 2.10.2
"@walletconnect/utils": 2.10.2
events: ^3.3.0
lodash.isequal: 4.5.0
uint8arrays: ^3.1.0
checksum: d58ae15c53efe1792da8c7aa1b7ba47efb49807cfe0c73f225d59c5cd847a0e50979ce6965b94915812412deba3e5aa2dca13a02bd41c087e85575e99afad223
checksum: 78b6e56bdd44ee0d27157eacbc916d053d75013b1f9e00869efc63141c1d0b33a771eaf8ab6f2fcb1bef3c0f87173f31067674567962a6dd9d45a4376a306c91
languageName: node
linkType: hard
@ -9457,25 +9457,25 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/ethereum-provider@npm:^2.10.0":
version: 2.10.1
resolution: "@walletconnect/ethereum-provider@npm:2.10.1"
"@walletconnect/ethereum-provider@npm:^2.10.1":
version: 2.10.2
resolution: "@walletconnect/ethereum-provider@npm:2.10.2"
dependencies:
"@walletconnect/jsonrpc-http-connection": ^1.0.7
"@walletconnect/jsonrpc-provider": ^1.0.13
"@walletconnect/jsonrpc-types": ^1.0.3
"@walletconnect/jsonrpc-utils": ^1.0.8
"@walletconnect/sign-client": 2.10.1
"@walletconnect/types": 2.10.1
"@walletconnect/universal-provider": 2.10.1
"@walletconnect/utils": 2.10.1
"@walletconnect/sign-client": 2.10.2
"@walletconnect/types": 2.10.2
"@walletconnect/universal-provider": 2.10.2
"@walletconnect/utils": 2.10.2
events: ^3.3.0
peerDependencies:
"@walletconnect/modal": ">=2"
peerDependenciesMeta:
"@walletconnect/modal":
optional: true
checksum: ec3d88ba101a5d8f193262b5b1e770cccad6457ec56fa1f3d17fa531de4e07e8cf03a1341669122c61956f0d5c3a6eca57d3f12f524e046acddb401cdb76fe7c
checksum: 86aecdb2c6eaf5d5cccd6d577ae815ae0d5f743703562db8eebcc573485eaca7a85ae08a30a7bac1f17b35d5de8d1df6a2c8ccac6ca4c63ef7ef6e97f74ea064
languageName: node
linkType: hard
@ -9612,6 +9612,15 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/modal-core@npm:2.6.2":
version: 2.6.2
resolution: "@walletconnect/modal-core@npm:2.6.2"
dependencies:
valtio: 1.11.2
checksum: 94daceba50c323b06ecbeac2968d9f0972f327359c6118887c6526cd64006249b12f64322d71bc6c4a2b928436ecc89cf3d3af706511fcdc264c1f4b34a2dd5d
languageName: node
linkType: hard
"@walletconnect/modal-ui@npm:2.6.1":
version: 2.6.1
resolution: "@walletconnect/modal-ui@npm:2.6.1"
@ -9624,6 +9633,18 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/modal-ui@npm:2.6.2":
version: 2.6.2
resolution: "@walletconnect/modal-ui@npm:2.6.2"
dependencies:
"@walletconnect/modal-core": 2.6.2
lit: 2.8.0
motion: 10.16.2
qrcode: 1.5.3
checksum: cd1ec0205eb491e529670599d3dd26f6782d7c5a99d5594bf6949a8c760c1c5f4eb6ed72b8662450774fe4e2dd47678f2c05145c8f2494bd7153446ddf4bd7ed
languageName: node
linkType: hard
"@walletconnect/modal@npm:2.6.1":
version: 2.6.1
resolution: "@walletconnect/modal@npm:2.6.1"
@ -9634,6 +9655,16 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/modal@npm:2.6.2":
version: 2.6.2
resolution: "@walletconnect/modal@npm:2.6.2"
dependencies:
"@walletconnect/modal-core": 2.6.2
"@walletconnect/modal-ui": 2.6.2
checksum: 68b354d49960b96d22de0e47a3801df27c01a3e96ec5fbde3ca6df1344ca2b20668b0c4d58fe1803f5670ac7b7b4c6f5b7b405e354f5f9eaff5cca147c13de9c
languageName: node
linkType: hard
"@walletconnect/qrcode-modal@npm:^1.8.0":
version: 1.8.0
resolution: "@walletconnect/qrcode-modal@npm:1.8.0"
@ -9700,20 +9731,20 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/sign-client@npm:2.10.1":
version: 2.10.1
resolution: "@walletconnect/sign-client@npm:2.10.1"
"@walletconnect/sign-client@npm:2.10.2":
version: 2.10.2
resolution: "@walletconnect/sign-client@npm:2.10.2"
dependencies:
"@walletconnect/core": 2.10.1
"@walletconnect/core": 2.10.2
"@walletconnect/events": ^1.0.1
"@walletconnect/heartbeat": 1.2.1
"@walletconnect/jsonrpc-utils": 1.0.8
"@walletconnect/logger": ^2.0.1
"@walletconnect/time": ^1.0.2
"@walletconnect/types": 2.10.1
"@walletconnect/utils": 2.10.1
"@walletconnect/types": 2.10.2
"@walletconnect/utils": 2.10.2
events: ^3.3.0
checksum: dbdced8dece73b20ae73df9c0cf0d9e3eee753f6c81e264c87583ca60d1d13d4f7d61944e4b22d1f70c5f32424fd842a7de778838aa7d0ae27195976a86e102f
checksum: d74556906d46dd6c161548d26068ceb256a18e1d5dcb4967072d6dad891fa443a0f2aa92108b45301a71066246ad2de8dba1b32e40857a93c6f072b18cbb5cb2
languageName: node
linkType: hard
@ -9754,9 +9785,9 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/types@npm:2.10.1":
version: 2.10.1
resolution: "@walletconnect/types@npm:2.10.1"
"@walletconnect/types@npm:2.10.2":
version: 2.10.2
resolution: "@walletconnect/types@npm:2.10.2"
dependencies:
"@walletconnect/events": ^1.0.1
"@walletconnect/heartbeat": 1.2.1
@ -9764,7 +9795,7 @@ __metadata:
"@walletconnect/keyvaluestorage": ^1.0.2
"@walletconnect/logger": ^2.0.1
events: ^3.3.0
checksum: b663a236404bb423d3cc5cde656794ce42132f09193da5a51dac815d844f78eebb29c7275ebe10f6134492db21386ffd81b66ce42992332847b72c9128f74990
checksum: dafcb840b2b93343db56ca6684edfe8a20d9b2f703f81b2d1fdbea558fe41de9fbddec12c24e9d51a50c75ee6298a1cfd347d7fa0202146033788670371cfd6a
languageName: node
linkType: hard
@ -9789,20 +9820,20 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/universal-provider@npm:2.10.1":
version: 2.10.1
resolution: "@walletconnect/universal-provider@npm:2.10.1"
"@walletconnect/universal-provider@npm:2.10.2":
version: 2.10.2
resolution: "@walletconnect/universal-provider@npm:2.10.2"
dependencies:
"@walletconnect/jsonrpc-http-connection": ^1.0.7
"@walletconnect/jsonrpc-provider": 1.0.13
"@walletconnect/jsonrpc-types": ^1.0.2
"@walletconnect/jsonrpc-utils": ^1.0.7
"@walletconnect/logger": ^2.0.1
"@walletconnect/sign-client": 2.10.1
"@walletconnect/types": 2.10.1
"@walletconnect/utils": 2.10.1
"@walletconnect/sign-client": 2.10.2
"@walletconnect/types": 2.10.2
"@walletconnect/utils": 2.10.2
events: ^3.3.0
checksum: a33ad597a7601157cd96bceb7637c3463a5df981e5548c5343ab84f92c542bd7cae577fb2884d549164c9ad8262b097dc5fc0bc7fd9a515ee7c3f30b271cb034
checksum: 4629c8031f8edbc1ecdd2f816a94963fd67ea4c8ba966fe12764585614d809fa5994b11d7ab30e7d8d2b51b8dac3a377c7433cb2cfca32070d4884d11d8dbbc7
languageName: node
linkType: hard
@ -9823,9 +9854,9 @@ __metadata:
languageName: node
linkType: hard
"@walletconnect/utils@npm:2.10.1":
version: 2.10.1
resolution: "@walletconnect/utils@npm:2.10.1"
"@walletconnect/utils@npm:2.10.2":
version: 2.10.2
resolution: "@walletconnect/utils@npm:2.10.2"
dependencies:
"@stablelib/chacha20poly1305": 1.0.1
"@stablelib/hkdf": 1.0.1
@ -9835,13 +9866,13 @@ __metadata:
"@walletconnect/relay-api": ^1.0.9
"@walletconnect/safe-json": ^1.0.2
"@walletconnect/time": ^1.0.2
"@walletconnect/types": 2.10.1
"@walletconnect/types": 2.10.2
"@walletconnect/window-getters": ^1.0.1
"@walletconnect/window-metadata": ^1.0.1
detect-browser: 5.3.0
query-string: 7.1.3
uint8arrays: ^3.1.0
checksum: 150d1a3c75ce0736ffc8ed8a844e3dc63476e556f7f308154ee6bc9d99e08907bc11a504b7ce3889951293b48d9eef4e32b84de1c7f27b7a84e6731a7bb65189
checksum: 168e65d48ce6121f04f040662668fce63c8e42050c7c7d1da2948cf2e486657f8bf972f3386dc84251fcabf3626a26bb696e3363d55bc92826ec1602d7b493c7
languageName: node
linkType: hard
@ -9988,19 +10019,19 @@ __metadata:
languageName: node
linkType: hard
"@web3-onboard/walletconnect@npm:^2.4.6":
version: 2.4.6
resolution: "@web3-onboard/walletconnect@npm:2.4.6"
"@web3-onboard/walletconnect@npm:^2.4.7":
version: 2.4.7
resolution: "@web3-onboard/walletconnect@npm:2.4.7"
dependencies:
"@ethersproject/providers": 5.5.0
"@walletconnect/client": ^1.8.0
"@walletconnect/ethereum-provider": ^2.10.0
"@walletconnect/modal": 2.6.1
"@walletconnect/ethereum-provider": ^2.10.1
"@walletconnect/modal": 2.6.2
"@walletconnect/qrcode-modal": ^1.8.0
"@web3-onboard/common": ^2.3.3
joi: 17.9.1
rxjs: ^7.5.2
checksum: 90b80a6354af785705aeb27b98172b80bf20f57ff4b6fced0c90d1596e23923dbc6cf7b5ab80ec2417cae1dc48ead6241b1fd338f2af5c11a0d3fcb03dbe8f75
checksum: cfeefcf195ca84fac8de2f80ac8684e980d72c17d519185b2e817b218fa5274839d940b52d6866ae7c6b21b3570726950c84fdd4aee4e3af0a944e6223b1eacd
languageName: node
linkType: hard
@ -16957,6 +16988,17 @@ __metadata:
languageName: node
linkType: hard
"lit@npm:2.8.0":
version: 2.8.0
resolution: "lit@npm:2.8.0"
dependencies:
"@lit/reactive-element": ^1.6.0
lit-element: ^3.3.0
lit-html: ^2.8.0
checksum: 2480e733f7d022d3ecba91abc58a20968f0ca8f5fa30b3341ecf4bcf4845e674ad27b721a5ae53529cafc6ca603c015b80d0979ceb7a711e268ef20bb6bc7527
languageName: node
linkType: hard
"locate-path@npm:^3.0.0":
version: 3.0.0
resolution: "locate-path@npm:3.0.0"
@ -18066,7 +18108,7 @@ __metadata:
"@web3-onboard/injected-wallets": ^2.10.6
"@web3-onboard/ledger": ^2.5.2
"@web3-onboard/react": ^2.8.13
"@web3-onboard/walletconnect": ^2.4.6
"@web3-onboard/walletconnect": ^2.4.7
chart.js: ^4.4.0
emoji-picker-react: ^4.4.11
eslint: ^8.45.0
@ -22236,6 +22278,24 @@ __metadata:
languageName: node
linkType: hard
"valtio@npm:1.11.2":
version: 1.11.2
resolution: "valtio@npm:1.11.2"
dependencies:
proxy-compare: 2.5.1
use-sync-external-store: 1.2.0
peerDependencies:
"@types/react": ">=16.8"
react: ">=16.8"
peerDependenciesMeta:
"@types/react":
optional: true
react:
optional: true
checksum: cce2d9212aac9fc4bdeba2d381188cc831cfe8d2d03039024cfcd58ba1801f2a5b14d01c2bb21a2c9f12046d2ede64f1dd887175185f39bee553677a35592c30
languageName: node
linkType: hard
"vary@npm:~1.1.2":
version: 1.1.2
resolution: "vary@npm:1.1.2"