Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: (0, paddedBits_1.bitsToPaddedBuffer)(bits).copy is not a function (it is undefined #40

Open
divyangkhatri opened this issue Aug 16, 2024 · 2 comments

Comments

@divyangkhatri
Copy link

Hello,
Version Details
react-native: 0.75.1
"@ton/core": "^0.56.3",
"@ton/crypto": "^3.3.0",
"@ton/ton": "^14.0.0",

When i just import the @ton/ton package, I am facing this error "TypeError: (0, paddedBits_1.bitsToPaddedBuffer)(bits).copy is not a function (it is undefined" after updating the react-native version. 0.72.7 to 0.75.1.
Previously it was working fine in older version of RN.
On the below line there is the crash

bitsToPaddedBuffer(bits).copy(repr, reprCursor);

I also attach the screenshot of the error

@Alexander3006
Copy link

There are several ways to fix this.
The first one is the fastest but also the dirtiest:

Uint8Array.prototype.copy = Buffer.prototype.copy;

However, the issue is not with the copy method but with the subarray method (feross/buffer#329).

The problem description provides ways to patch this.
You can patch the subarray method separately.

But I would recommend using the following library, which resolves all issues related to typed arrays: https://www.npmjs.com/package/@exodus/patch-broken-hermes-typed-arrays.

@joon08
Copy link

joon08 commented Nov 27, 2024

Have you solved this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants