Skip to content

Commit 01964c8

Browse files
authored
chore(browser-playground): add address field for legacy-evm send-transaction (#247)
1 parent 179590b commit 01964c8

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

playground/browser-playground/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12+
- Change LegacyEVM card's `sendTransaction` to have an address field and default it to the connected address ([#247](https://github.com/MetaMask/connect-monorepo/pull/247))
1213
- Add `localhost` to wagmi's configured chains ([#246](https://github.com/MetaMask/connect-monorepo/pull/246))
1314
- Bump wagmi from `^2.19.2` to `^3.5.0` and apply v3 migration changes: use `useConnectors()` instead of `useConnect().connectors`, `useChains()` instead of `useSwitchChain().chains`, and rename `useAccount` to `useConnection` ([#233](https://github.com/MetaMask/connect-monorepo/pull/233))
1415
- Bump `@wagmi/core` from `^2.22.1` to `^3.4.0` ([#233](https://github.com/MetaMask/connect-monorepo/pull/233))

playground/browser-playground/src/components/LegacyEVMCard.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function LegacyEVMCard({
1919
disconnect,
2020
}: LegacyEVMCardProps) {
2121
const [response, setResponse] = useState<string>('');
22+
const [toAddress, setToAddress] = useState<string>(accounts[0] ?? '');
2223

2324
const requestPermissions = async () => {
2425
if (!provider) {
@@ -112,7 +113,7 @@ export function LegacyEVMCard({
112113
setResponse('No account available');
113114
return;
114115
}
115-
const to = '0x0000000000000000000000000000000000000000';
116+
const to = toAddress || accounts[0];
116117
const transactionParameters = {
117118
to, // Required except during contract publications.
118119
from: accounts[0], // must match user's active address.
@@ -251,6 +252,13 @@ export function LegacyEVMCard({
251252
personal_sign
252253
</button>
253254

255+
<input
256+
type="text"
257+
value={toAddress}
258+
onChange={(e) => setToAddress(e.target.value)}
259+
placeholder={accounts[0] ?? '0x...'}
260+
className="w-full border rounded px-3 py-2 text-sm font-mono"
261+
/>
254262
<button
255263
type="button"
256264
data-testid={TEST_IDS.legacyEvm.btnSendTransaction}

0 commit comments

Comments
 (0)