Skip to content

Commit bbe852e

Browse files
feat: ✨ networks setting value updates, wallet values update
1 parent 64b0ecf commit bbe852e

File tree

9 files changed

+79
-41
lines changed

9 files changed

+79
-41
lines changed

web-app/.env.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ SLACK_CONVERSATION_ID="C"
2626
FAUNA_DB_SECRET=""
2727

2828
WALLET_CONSENSUS_URI="//Alice"
29-
CONSENSUS_AMOUNT="100000000000000000000"
30-
CLAIM_WALLET_LOW_FUND_WARNING="500000000000000000000"
29+
CONSENSUS_AMOUNT="200000000000000000"

web-app/app/api/request-tokens/[...params]/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ export const POST = async (req: NextRequest) => {
4646

4747
// Get wallet free balance
4848
const { free } = await balance(api as unknown as ApiPromise, wallet.address)
49-
if (BigInt(free) < BigInt(process.env.CLAIM_WALLET_LOW_FUND_WARNING || 1000 * 10 ** 18)) {
49+
if (
50+
BigInt(free) <
51+
BigInt((Number(process.env.SLACK_BALANCE_NOTIFICATION_THRESHOLD) * Number(process.env.CONSENSUS_AMOUNT)) / 100)
52+
) {
5053
await walletBalanceLowSlackMessage(free.toString(), wallet.address)
5154
}
5255

web-app/components/AutonomysSymbol.tsx

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@ type AutonomysSymbolProps = {
66

77
export const AutonomysSymbol: FC<AutonomysSymbolProps> = ({ fill = 'currentColor' }) => {
88
return (
9-
<svg
10-
width='22'
11-
height='23'
12-
viewBox='0 0 139 137'
13-
fill='none'
14-
xmlns='http://www.w3.org/2000/svg'
15-
>
9+
<svg width='22' height='24' viewBox='0 0 139 137' fill='none' xmlns='http://www.w3.org/2000/svg'>
1610
<g clipPath='url(#clip0_62_5)'>
17-
<path
18-
d='M87.0098 0L136.38 86.39C138.09 80.35 139 73.97 139 67.38C139 35 116.92 7.78 87.0098 0Z'
19-
fill={fill}
20-
/>
21-
<path
22-
d='M87.0098 0L136.38 86.39C138.09 80.35 139 73.97 139 67.38C139 35 116.92 7.78 87.0098 0Z'
23-
fill={fill}
24-
/>
11+
<path d='M87.0098 0L136.38 86.39C138.09 80.35 139 73.97 139 67.38C139 35 116.92 7.78 87.0098 0Z' fill={fill} />
12+
<path d='M87.0098 0L136.38 86.39C138.09 80.35 139 73.97 139 67.38C139 35 116.92 7.78 87.0098 0Z' fill={fill} />
2513
<path
2614
d='M69.5001 137C89.0801 137 106.76 128.88 119.4 115.84H19.6001C32.2301 128.89 49.9201 137 69.5001 137Z'
2715
fill={fill}
@@ -30,14 +18,8 @@ export const AutonomysSymbol: FC<AutonomysSymbolProps> = ({ fill = 'currentColor
3018
d='M69.5001 137C89.0801 137 106.76 128.88 119.4 115.84H19.6001C32.2301 128.89 49.9201 137 69.5001 137Z'
3119
fill={fill}
3220
/>
33-
<path
34-
d='M0 67.39C0 73.98 0.92 80.36 2.62 86.4L51.99 0C22.09 7.78 0 35 0 67.39Z'
35-
fill={fill}
36-
/>
37-
<path
38-
d='M0 67.39C0 73.98 0.92 80.36 2.62 86.4L51.99 0C22.09 7.78 0 35 0 67.39Z'
39-
fill={fill}
40-
/>
21+
<path d='M0 67.39C0 73.98 0.92 80.36 2.62 86.4L51.99 0C22.09 7.78 0 35 0 67.39Z' fill={fill} />
22+
<path d='M0 67.39C0 73.98 0.92 80.36 2.62 86.4L51.99 0C22.09 7.78 0 35 0 67.39Z' fill={fill} />
4123
<path d='M102.53 86.28L69.5 28.48L36.48 86.28H102.53Z' fill={fill} />
4224
<path d='M102.53 86.28L69.5 28.48L36.48 86.28H102.53Z' fill={fill} />
4325
</g>

web-app/components/ConnectConsensusWallet/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const ConnectConsensusWallet: React.FC<ConnectConsensusWalletProps> = ({
2222
<button
2323
onClick={onClick}
2424
className={cn(
25-
'bg-brand hover:bg-brand-hover text-white px-4 py-2 rounded-md cursor-pointer dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover',
25+
'shadow bg-brand hover:bg-brand-hover text-white px-4 py-2 rounded-md cursor-pointer dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover',
2626
className
2727
)}>
2828
Connect Wallet

web-app/components/ConnectEVMWallet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ConnectEVMWallet: React.FC = () => {
3737

3838
if (isConnected)
3939
return (
40-
<div className='relative group flex items-center gap-2 bg-brand text-white px-4 py-2 rounded-md dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover'>
40+
<div className='shadow h-10 relative group flex items-center gap-2 bg-brand text-white px-4 py-2 rounded-md dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover'>
4141
<button onClick={openAccountModal} className='flex items-center gap-1 cursor-pointer'>
4242
{ensName != null ? (
4343
ensName
@@ -71,7 +71,7 @@ export const ConnectEVMWallet: React.FC = () => {
7171

7272
return (
7373
<button
74-
className='bg-brand hover:bg-brand-hover text-white px-4 py-2 rounded-md cursor-pointer dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover'
74+
className='shadow bg-brand hover:bg-brand-hover text-white px-4 py-2 rounded-md cursor-pointer dark:bg-brand-secondary dark:hover:bg-brand-secondary-hover'
7575
onClick={openConnectModal}>
7676
Connect Wallet
7777
</button>

web-app/components/NetworkDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const NetworkDropdown: React.FC<NetworkDropdownProps> = ({ options, onSelect, pl
4343
<div className='relative w-54 my-auto' ref={dropdownRef}>
4444
<button
4545
onClick={() => setIsOpen(!isOpen)}
46-
className='shadow flex w-full items-center justify-between py-2 px-3 bg-white text-gray-900 rounded-full cursor-pointer dark:bg-brand-secondary dark:text-white'>
46+
className='shadow flex w-full items-center justify-between py-2 px-3 bg-white text-gray-900 rounded-md cursor-pointer dark:bg-brand-secondary dark:text-white'>
4747
<div className='flex items-center gap-2'>
4848
<AutonomysSymbol fill='currentColor' />
4949
<span className='text-sm my-auto'>{selectedLabel}</span>

web-app/components/NetworkSettings.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

3-
import { autoEVM } from '@/constants/networks'
3+
import { networks } from '@/constants/networks'
4+
import { useNetworkStore } from '@/store/useStore'
45
import { Check, Copy } from 'lucide-react'
56
import { useEffect, useRef, useState } from 'react'
67

@@ -9,6 +10,9 @@ export const NetworkSettings: React.FC = () => {
910
const [tooltipVisible, setTooltipVisible] = useState<string | null>(null)
1011
const timeoutRef = useRef<NodeJS.Timeout | null>(null)
1112

13+
const { network } = useNetworkStore()
14+
const chain = networks.find((n) => n.network === network)
15+
1216
const copyToClipboard = (value: string, fieldName: string) => {
1317
navigator.clipboard.writeText(value)
1418
setCopiedField(fieldName)
@@ -34,17 +38,17 @@ export const NetworkSettings: React.FC = () => {
3438
}, [])
3539

3640
const networkData = [
37-
{ name: 'Network Name', value: autoEVM.name, id: 'network' },
38-
{ name: 'RPC URL', value: autoEVM.rpcUrls.default.http[0], id: 'rpc' },
39-
{ name: 'Chain ID', value: autoEVM.id.toString(), id: 'chainId' },
41+
{ name: 'Network Name', value: chain?.name, id: 'network' },
42+
{ name: 'RPC URL', value: chain?.rpcUrls.default.http[0], id: 'rpc' },
43+
{ name: 'Chain ID', value: chain?.id.toString(), id: 'chainId' },
4044
{
4145
name: 'Currency Symbol',
42-
value: autoEVM.nativeCurrency.symbol,
46+
value: chain?.nativeCurrency.symbol,
4347
id: 'currency'
4448
},
4549
{
4650
name: 'Block explorer URL',
47-
value: autoEVM.blockExplorers?.default.url ?? '',
51+
value: chain?.blockExplorers?.default.url ?? '',
4852
id: 'explorer'
4953
}
5054
]
@@ -58,11 +62,11 @@ export const NetworkSettings: React.FC = () => {
5862
<div key={item.id} className='bg-muted dark:bg-background-darkest p-4 rounded-lg'>
5963
<h4 className='font-medium mb-2'>{item.name}</h4>
6064
<div className='flex items-center justify-between'>
61-
<p className={item.value.length > 30 ? 'text-sm' : ''}>{item.value}</p>
65+
<p className='text-sm'>{item.value}</p>
6266
<div className='relative'>
6367
<button
6468
className='text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 cursor-pointer p-1 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors'
65-
onClick={() => copyToClipboard(item.value, item.id)}
69+
onClick={() => copyToClipboard(item.value ?? '', item.id)}
6670
onMouseEnter={() => setTooltipVisible(item.id)}
6771
onMouseLeave={() => setTooltipVisible(null)}
6872
aria-label={`Copy ${item.name}`}>

web-app/constants/networks.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,54 @@ export const autoEVM: Chain = {
2525
}
2626
}
2727

28-
export const networks: Chain[] = [autoEVM, mainnet, hardhat]
28+
type ConsensusChain = {
29+
id: string
30+
name: string
31+
network: string
32+
nativeCurrency: {
33+
decimals: number
34+
name: string
35+
symbol: string
36+
}
37+
rpcUrls: {
38+
default: {
39+
http: string[]
40+
}
41+
public: {
42+
http: string[]
43+
}
44+
}
45+
blockExplorers: {
46+
default: {
47+
name: string
48+
url: string
49+
}
50+
}
51+
}
52+
53+
export const consensus: ConsensusChain = {
54+
id: '-',
55+
name: 'Consensus - Autonomys Taurus Testnet',
56+
network: 'consensus-taurus',
57+
nativeCurrency: {
58+
decimals: 18,
59+
name: 'tAI3',
60+
symbol: 'tAI3'
61+
},
62+
rpcUrls: {
63+
default: {
64+
http: ['wss://rpc-0.taurus.autonomys.xyz/ws']
65+
},
66+
public: {
67+
http: ['wss://rpc-0.taurus.autonomys.xyz/ws']
68+
}
69+
},
70+
blockExplorers: {
71+
default: {
72+
name: 'Autonomys Astral Explorer',
73+
url: 'https://explorer.autonomys.xyz/taurus/consensus/'
74+
}
75+
}
76+
}
77+
78+
export const networks: (Chain | ConsensusChain)[] = [autoEVM, consensus, mainnet, hardhat]

web-app/store/useStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Network, networks } from '@autonomys/auto-utils'
33
import { create } from 'zustand'
44

55
export enum NetworkOptions {
6-
AUTO_EVM = 'autoEVM',
7-
CONSENSUS = 'consensus'
6+
AUTO_EVM = 'auto-evm-taurus',
7+
CONSENSUS = 'consensus-taurus'
88
}
99

1010
interface NetworkState {

0 commit comments

Comments
 (0)