Closed
Description
Component
Forge, Cast
Describe the feature you would like
Description
I import my private key (from Ganache local blockchain) by typing
cast wallet import gan-wall --interactive
Enter private key:
Enter password:
`gan-wall` keystore was saved successfully. Address: 0xdcc0ed94411272c1eb99067f34dfb0aefc511709
then I try to deploy my smart contract using script by typing
forge script script/DeploySimpleStorage.s.sol --rpc-url $GANACHE_RPC_URL --broadcast --account gan-wall
I got an error
Error:
You seem to be using Foundry's default sender. Be sure to set your own --sender.
No associated wallet for addresses: {0x1804c8ab1f12e6bbf3894d4083f33e07309d1f38}. Unlocked wallets: [0xdcc0ed94411272c1eb99067f34dfb0aefc511709]
I add --sender, and it works
forge script script/DeploySimpleStorage.s.sol --rpc-url $GANACHE_RPC_URL --broadcast --account gan-wall --sender 0xdCC0eD94411272c1eB99067F34dFb0AEfc511709
Expected Behavior
I think specifying --account should automatically select the corresponding address as the sender because technically --account is the replacement for --private-key, and when you use --private-key you don't have to explicitly specify --sender as it automatically defaults to it, same should be the case with --account.
-- from @usmanfarooq91
Additional context
- original discussion: [Lesson 6] A better UX about wallet management Cyfrin/foundry-full-course-cu#945 (comment)
- @PatrickAlphaC will be happy to sponsor this work.
- forge version: forge 0.2.0 (8c1a569 2023-09-19T00:25:23.149586075Z)
- cast version: cast 0.2.0 (8c1a569 2023-09-19T00:25:23.141846282Z)
Metadata
Assignees
Labels
Type
Projects
Status
Completed