smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12.01k stars 2.91k forks source link

fromEncrptedJsonSyn (Lesson5) #5610

Open Abhishek2061 opened 1 year ago

Abhishek2061 commented 1 year ago

Lesson

Lesson 5

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

07:46:25

Operating System

Windows 11

Describe the bug

let wallet = new ethers.Wallet.fromEncryptedJson( encryptedJson, process.env.PRIVATE_KEY_PASSWORD );

TypeError: ethers.Wallet.createEncryptedJson is not a constructor "this is the error I am getting over and over again"

alymurtazamemon commented 1 year ago

@Abhishek2061 Use this;

let wallet = new ethers.Wallet.fromEncryptedJsonSync(
  encryptedJson,
  process.env.PRIVATE_KEY_PASSWORD
);
Abhishek2061 commented 1 year ago

@alymurtazamemon have tried it but still the same error is showing

the-first-elder commented 1 year ago
let wallet = ethers.Wallet.fromEncryptedJsonSync(
  encryptedJson,
  process.env.PRIVATE_KEY_PASSWORD
); 

This should fix the not a constructor problem