Skip to content

Commit

Permalink
Select from available addreses dropdown (#222)
Browse files Browse the repository at this point in the history
* select from available addreses dropdown

* fix linter
  • Loading branch information
marlowl authored Jan 4, 2022
1 parent ecbc18d commit b376ab1
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/Transfer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { Form, Input, Grid, Label, Icon } from 'semantic-ui-react';
import { Form, Input, Grid, Label, Icon, Dropdown } from 'semantic-ui-react';
import { TxButton } from './substrate-lib/components';
import { useSubstrate } from './substrate-lib';

export default function Main (props) {
const [status, setStatus] = useState(null);
Expand All @@ -12,6 +13,14 @@ export default function Main (props) {

const { addressTo, amount } = formState;

const { keyring } = useSubstrate();
const accounts = keyring.getPairs();

const availableAccounts = [];
accounts.map(account => {
return availableAccounts.push({ key: account.meta.name, text: account.meta.name, value: account.address });
});

return (
<Grid.Column width={8}>
<h1>Transfer</h1>
Expand All @@ -27,12 +36,25 @@ export default function Main (props) {
</Label>
</Form.Field>

<Form.Field>
<Dropdown
placeholder='Select from available addresses'
fluid
selection
search
options={availableAccounts}
state='addressTo'
onChange={onChange}
/>
</Form.Field>

<Form.Field>
<Input
fluid
label='To'
type='text'
placeholder='address'
value={addressTo}
state='addressTo'
onChange={onChange}
/>
Expand Down

0 comments on commit b376ab1

Please sign in to comment.