Can not run any ethers.utils functions. #4093
Replies: 6 comments 2 replies
-
In v6, all utility functions are available on the root, so you should use |
Beta Was this translation helpful? Give feedback.
-
(the playground still uses v5, but is being updated for v6) |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick reply, I tested, it works. However, there is one function abiCoder(), is it also in root or still in utils, like this: const abiCoder = new ethers.utils.abiCoder(); |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for your reply. I have some code, which is not working. |
Beta Was this translation helpful? Give feedback.
-
Hi, let me know how can I run the above code in ethers playground, I tried this, but not working: outputTypes = "[ 'bool', 'address' ]" |
Beta Was this translation helpful? Give feedback.
-
Hi, I have figured this out: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Ethers Version
6.4.0
Search Terms
toUtf8Bytes, keccak256
Describe the Problem
I want to run some simple code in Node.js, but the code failed. However, from ethers playground, the code works: message = "Hello World";
"Hello World"
messageBytes = ethers.utils.toUtf8Bytes(message);
Uint8Array { 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 }
ethers.utils.keccak256(messageBytes);
"0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba"
Code Snippet
Contract ABI
No response
Errors
Environment
node.js (v12 or newer)
Environment (Other)
Windows 10, tested on node.js v18.16.0 and v20.2.0; both have the same errors.
Beta Was this translation helpful? Give feedback.
All reactions