From fa9a51c177a3e136c734bcf027cf77e227748101 Mon Sep 17 00:00:00 2001 From: pacoyang Date: Fri, 29 Dec 2023 11:07:19 +0800 Subject: [PATCH] chore: check if connected chain support evm wallets --- src/lib/PhatBaseCommand.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/PhatBaseCommand.ts b/src/lib/PhatBaseCommand.ts index b8e2775..796fecf 100644 --- a/src/lib/PhatBaseCommand.ts +++ b/src/lib/PhatBaseCommand.ts @@ -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({