Skip to content

Commit c6bdba7

Browse files
committed
Fix issues
1 parent fe6b53a commit c6bdba7

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

packages/examples/packages/send-flow/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "2KqVh93QMGT4VYzKWcfT+ErTBxRHBJ9TtVh8q+wefCM=",
10+
"shasum": "xqCLzNxCLbQVqGEp7GvJSHlDLAuk8DgJZIQbXMKpKTE=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/send-flow/src/components/SendForm.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from '@metamask/snaps-sdk/jsx';
1313

1414
import { AccountSelector } from './AccountSelector';
15-
import btcIcon from '../images/btc.svg';
1615
import jazzicon3 from '../images/jazzicon3.svg';
1716
import type { Account, SendFormErrors } from '../types';
1817

@@ -57,21 +56,31 @@ export const SendForm: SnapComponent<SendFormProps> = ({
5756
}) => (
5857
<Form name="sendForm">
5958
<AccountSelector selectedAccount={selectedAccount} accounts={accounts} />
60-
<Field label="Send amount" error={errors?.amount}>
61-
<Box>
62-
<Image src={btcIcon} />
63-
</Box>
59+
60+
<AssetSelector
61+
name="asset"
62+
addresses={[
63+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp:2pvE8WojpCju8XQEFAKrHgsxgUtsDxeq8PWZ4RP6YYWL',
64+
]}
65+
/>
66+
<Box direction="horizontal">
6467
<Field label="Asset">
65-
<AssetSelector name="asset" addresses={} />
68+
<AssetSelector
69+
name="asset2"
70+
addresses={['eip155:0:0xc366063eA70eBD30316062C9C82445591c772870']}
71+
/>
6672
</Field>
67-
<Input name="amount" type="number" placeholder="Enter amount to send" />
68-
<Box direction="horizontal" center>
69-
<Text color="alternative">{selectedCurrency}</Text>
70-
<Button name="swap">
71-
<Icon name="swap-vertical" color="primary" size="md" />
72-
</Button>
73-
</Box>
74-
</Field>
73+
<Field label="Send amount" error={errors?.amount}>
74+
<Input name="amount" type="number" placeholder="Enter amount to send" />
75+
<Box direction="horizontal" center>
76+
<Text color="alternative">{selectedCurrency}</Text>
77+
<Button name="swap">
78+
<Icon name="swap-vertical" color="primary" size="md" />
79+
</Button>
80+
</Box>
81+
</Field>
82+
</Box>
83+
7584
<Field label="To account" error={errors?.to}>
7685
<Box>
7786
<Image src={jazzicon3} />

packages/snaps-sdk/src/jsx/components/form/Field.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AssetSelectorElement } from './AssetSelector';
12
import type { CheckboxElement } from './Checkbox';
23
import type { DropdownElement } from './Dropdown';
34
import type { FileInputElement } from './FileInput';
@@ -26,7 +27,8 @@ export type FieldProps = {
2627
| FileInputElement
2728
| InputElement
2829
| CheckboxElement
29-
| SelectorElement;
30+
| SelectorElement
31+
| AssetSelectorElement;
3032
};
3133

3234
const TYPE = 'Field';

packages/snaps-sdk/src/jsx/validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,8 @@ const FieldChildStruct = selectiveUnion((value) => {
551551
| FileInputElement
552552
| InputElement
553553
| CheckboxElement
554-
| SelectorElement,
554+
| SelectorElement
555+
| AssetSelectorElement,
555556
null
556557
>;
557558

0 commit comments

Comments
 (0)