wallet-connect-web-examples/wallets/react-web3wallet/src/components/AccountPicker.tsx
Gancho Radkov 7a3886073b
feat: Web3Wallet Example (#94)
* feat: v2 wallet

* feat: Web3Wallet sign integration

* chore: adds `core` to package.json

* feat: Web3Wallet Auth integration

* chore: core & web3wallet canary

* chore: rm config

* chore: force redeploy

* chore: rm core & sign-client deps

* fix: rm `sign-client` usage

* refactor: updates README

* feat: adds metadata mock obj & removes relay url param

* refactor: more url mentions

* refactor: rm v2 wallet readme references & uses web3wallet.core...

* refactor: wallet -> web3wallet

* refactor: rm wallet to web3wallet

* fix: adds async to example listeners
2022-12-22 11:19:46 +02:00

29 lines
1.1 KiB
TypeScript

import SettingsStore from '@/store/SettingsStore'
import { cosmosAddresses } from '@/utils/CosmosWalletUtil'
import { eip155Addresses } from '@/utils/EIP155WalletUtil'
import { nearAddresses } from '@/utils/NearWalletUtil'
import { solanaAddresses } from '@/utils/SolanaWalletUtil'
import { elrondAddresses } from '@/utils/ElrondWalletUtil'
import { useSnapshot } from 'valtio'
export default function AccountPicker() {
const { account } = useSnapshot(SettingsStore.state)
function onSelect(value: string) {
const account = Number(value)
SettingsStore.setAccount(account)
SettingsStore.setEIP155Address(eip155Addresses[account])
SettingsStore.setCosmosAddress(cosmosAddresses[account])
SettingsStore.setSolanaAddress(solanaAddresses[account])
SettingsStore.setNearAddress(nearAddresses[account])
SettingsStore.setElrondAddress(elrondAddresses[account])
}
return (
<select value={account} onChange={e => onSelect(e.currentTarget.value)} aria-label="addresses">
<option value={0}>Account 1</option>
<option value={1}>Account 2</option>
</select>
)
}