Skip to content

getAccountFromAddress not working if account not deployed #281

@FabijanC

Description

@FabijanC

When doing

starknet.OpenZeppelinAccount.getAccountFromAddress(address, privateKey);

the plugin performs an internal validation that the provided private key matches the deployed public key.
Source code: OpenZeppelinAccount, ArgentAccount

Since starknet-hardhat-plugin v0.7.0, it is a problem if the account contract hasn't yet been deployed (so there is no public key deployed to check against). When can this happen? Assume the following use-case:

const account = await starknet.OpenZeppelinAccount.createAccount(...);
console.log("Account address:", account.address);
// you exit the script to fund the account

Then a new script is run which first tries to get the account:

const account = await starknet.OpenZeppelinAccount.getAccountFromAddress(...);
// FAILS with reporting an UNINITIALIZED_CONTRACT

Originally reported on Discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions