Skip to content

Commit

Permalink
chore: check if connected chain support evm wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
pacoyang committed Dec 29, 2023
1 parent 4d02ce4 commit fa9a51c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/PhatBaseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ export default abstract class PhatBaseCommand extends BaseCommand {
apiPromise: ApiPromise
}) {
if (this.parsedFlags.privateKey || (process.env.PRIVATE_KEY && !this.parsedFlags.suri && !this.parsedFlags.accountFilePath)) {
if (!apiPromise.consts?.evmAccountMapping?.eip712Name) {
this.action.fail('The current connected chain does not support EVM wallets.')
this.exit(1)
}
const privateKey = add0xPrefix(this.parsedFlags.privateKey || process.env.PRIVATE_KEY!)
const account = privateKeyToAccount(privateKey)
const client = createWalletClient({
Expand Down

0 comments on commit fa9a51c

Please sign in to comment.