Skip to content

A better UX about wallet management #6034

Closed
@Osneue

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status

      Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions