Merge branch 'wallets'

This commit is contained in:
Ilja 2022-03-15 14:48:45 +02:00
commit 2b85264b42
2 changed files with 34 additions and 15 deletions

View File

@ -29,6 +29,10 @@ export default class SolanaLib {
return await this.keypair.publicKey.toBase58()
}
public getSecretKey() {
return this.keypair.secretKey.toString()
}
public async signMessage(message: string) {
const signature = nacl.sign.detached(bs58.decode(message), this.keypair.secretKey)

View File

@ -1,29 +1,18 @@
import PageHeader from '@/components/PageHeader'
import SettingsStore from '@/store/SettingsStore'
import { cosmosWallets } from '@/utils/CosmosWalletUtil'
import { eip155Wallets } from '@/utils/EIP155WalletUtil'
import { solanaWallets } from '@/utils/SolanaWalletUtil'
import { Card, Divider, Row, Switch, Text } from '@nextui-org/react'
import { Fragment } from 'react'
import { useSnapshot } from 'valtio'
export default function SettingsPage() {
const { testNets, eip155Address } = useSnapshot(SettingsStore.state)
const { testNets, eip155Address, cosmosAddress, solanaAddress } = useSnapshot(SettingsStore.state)
return (
<Fragment>
<PageHeader title="Settings" />
<Text h4 css={{ marginBottom: '$5' }}>
Mnemonic
</Text>
<Card bordered borderWeight="light" css={{ minHeight: '75px' }}>
<Text css={{ fontFamily: '$mono' }}>{eip155Wallets[eip155Address].mnemonic.phrase}</Text>
</Card>
<Text css={{ color: '$yellow500', marginTop: '$5', textAlign: 'center' }}>
Warning: mnemonic is provided for development purposes only and should not be used
elsewhere!
</Text>
<Divider y={3} />
<Text h4 css={{ marginBottom: '$5' }}>
Testnets
@ -33,7 +22,33 @@ export default function SettingsPage() {
<Text>{testNets ? 'Enabled' : 'Disabled'}</Text>
</Row>
<Divider y={3} />
<Divider y={2} />
<Text css={{ color: '$yellow500', marginBottom: '$5', textAlign: 'left', padding: 0 }}>
Warning: mnemonics and secret keys are provided for development purposes only and should not
be used elsewhere!
</Text>
<Text h4 css={{ marginTop: '$5', marginBottom: '$5' }}>
EIP155 Mnemonic
</Text>
<Card bordered borderWeight="light" css={{ minHeight: '100px' }}>
<Text css={{ fontFamily: '$mono' }}>{eip155Wallets[eip155Address].getMnemonic()}</Text>
</Card>
<Text h4 css={{ marginTop: '$10', marginBottom: '$5' }}>
Cosmos Mnemonic
</Text>
<Card bordered borderWeight="light" css={{ minHeight: '100px' }}>
<Text css={{ fontFamily: '$mono' }}>{cosmosWallets[cosmosAddress].getMnemonic()}</Text>
</Card>
<Text h4 css={{ marginTop: '$10', marginBottom: '$5' }}>
Solana Secret Key
</Text>
<Card bordered borderWeight="light" css={{ minHeight: '215px', wordWrap: 'break-word' }}>
<Text css={{ fontFamily: '$mono' }}>{solanaWallets[solanaAddress].getSecretKey()}</Text>
</Card>
</Fragment>
)
}