You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using the Ethers library in a project and I've encountered an issue with the FixedNumber object, specifically with operations that access o.#val, a private field.
Here's a simplified snippet of the FixedNumber class and a method that's causing problems:
When the #mul method is called, it leads to the following error:
Uncaught (in promise) TypeError: Cannot read from private field
The issue arises from attempts to access the private field o.#val. I have observed this behavior when using the FixedNumber object within a Pinia store (Nuxt3), but the underlying problem appears to be in the FixedNumber object itself, even though it doesn't occur on other parts of the code.
This behavior is unexpected as operations on a FixedNumber object should not be attempting to access private properties of the object.
Uncaught (in promise) TypeError: Cannot read from private field
at __accessCheck (chunk-ZR4A2MMM.js?v=91ea41d3:38:11)
at __privateGet (chunk-ZR4A2MMM.js?v=91ea41d3:41:3)
at _FixedNumber.mul_fn (fixednumber.ts:359:46)
at _FixedNumber.mul (fixednumber.ts:373:51)
Environment
Browser (Chrome, Safari, etc)
Environment (Other)
Nuxt3 + pinia
The text was updated successfully, but these errors were encountered:
You cannot access private members, in general. Can you provide some sample code that causes this?
An incorrectly implemented proxy can result in a wrapped object that doesn’t pass the original target along to the method as the this, but I’m not sure what else would cause this.
Hey Ric, thanks for the quick response, I couldn't reproduce the exact issue in a sandbox, but indeed there's something weird happening with the FixedNumber proxies generated by pinia, here's an example
This seems to relate to the vue reactivity implementation. In cases where you don't need the deep reactive conversion of vue, you could use markRaw, but use it with caution.
Ethers Version
6.4.2
Search Terms
FixedNumber
Describe the Problem
I've been using the Ethers library in a project and I've encountered an issue with the FixedNumber object, specifically with operations that access o.#val, a private field.
Here's a simplified snippet of the FixedNumber class and a method that's causing problems:
When the #mul method is called, it leads to the following error:
Uncaught (in promise) TypeError: Cannot read from private field
The issue arises from attempts to access the private field o.#val. I have observed this behavior when using the FixedNumber object within a Pinia store (Nuxt3), but the underlying problem appears to be in the FixedNumber object itself, even though it doesn't occur on other parts of the code.
This behavior is unexpected as operations on a FixedNumber object should not be attempting to access private properties of the object.
Code Snippet
Contract ABI
No response
Errors
Environment
Browser (Chrome, Safari, etc)
Environment (Other)
Nuxt3 + pinia
The text was updated successfully, but these errors were encountered: