question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: should slice (and other missing ops) be shimmed? (e.g. slice in ReactNative)

See original GitHub issue

I’m creating a ReactNative based app using this lib. When I run in iOS simulator, eveything goes fine. But when I run in my real Android device I’m having the following error:

[TypeError: undefined is not a function (evaluating 'data.slice(offset + junkLength, offset + 32)')]

It happens when I’m trying to execute the following piece of code after loading the wallet with my private key:

const updateBalance = () => (dispatch) => {
    const { contract, wallet } = store.getState().wallet;
    contract.functions.balanceOf(wallet.getAddress())
        .then(({ balance }) => dispatch({ type: UPDATE_BALANCE, payload: balance }));
}

Looking at the lib source, I figured out the place where this error can be located at in this: https://github.com/ethers-io/ethers.js/blob/fb65772dd68d5ec5271ff2171560b306f013d09d/contracts/interface.js#L73

Do you have any idea of what might be happening?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Nov 9, 2017

Heya! it does for React too. I’ve added the automatic slice and a few other features that often missing in older environments, like React.

Can you try updating to the latest version and remove your shims to see if it works now, out of the box?

It passes all the PhantomJS tests sans shims, so I’m hoping it does for React too. 😃

0reactions
ricmoocommented, Nov 10, 2017

Awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should every React component have it's own slice, when ...
No. There has never been a 1:1 association between components and Redux state structure. Instead, you should organize your state in terms of ......
Read more >
How To Setup Redux Slices with Redux Toolkit - SoftKraft
createSlice takes an object of reducer functions, a slice name, and an initial state value and lets us auto-generate action types and action...
Read more >
Lists and Keys - React
You can build collections of elements and include them in JSX using curly ... a key to our list items inside numbers.map() and...
Read more >
A powerful React + Redux Toolkit pattern (reuseable state ...
Redux Toolkit includes a number of functions which make reusing similar "slices" of state quite easy, however there is a missing piece to ......
Read more >
Airbnb JavaScript Style Guide()
It improves syntax highlighting, and is also more easily optimized by many JS engines. // bad const bad = { 'foo': ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found