Giter Site home page Giter Site logo

Comments (7)

denisgranha avatar denisgranha commented on June 18, 2024

Hi @krzkaczor !

22 is actually 34 in hex. Not sure where that 33 is coming from but the number seems correct? in etherscan is also displayed as 22

from abi-decoder.

krzkaczor avatar krzkaczor commented on June 18, 2024

@denisgranha thanks for the quick response! Yeah sorry, I meant 34 DEC anyway, the response that I am getting from the lib is totally different.

I pinned point the issue to BN.JS - the version that I have in my project incorrectly parses hex strings starting with 0x.

Are you able to confirm that it works for you?

I am gonna push the whole repository with repro in a sec.

from abi-decoder.

krzkaczor avatar krzkaczor commented on June 18, 2024

Its ready here: https://github.com/krzkaczor/abi-decoder-bug-repro

from abi-decoder.

denisgranha avatar denisgranha commented on June 18, 2024

Hi @krzkaczor I was able to reproduce the bug, thank you for the report.

Will fix it soon

from abi-decoder.

krzkaczor avatar krzkaczor commented on June 18, 2024

My dummy fix would be to use this function to create BN instances rather than doing it directly:

function createBN(number) {
  // ensure to remove leading 0x for hex numbers
  if (typeof number === 'string' && number.startsWith("0x")) {
    number = number.slice(2);
  }
  return new BN(number);
}

from abi-decoder.

krzkaczor avatar krzkaczor commented on June 18, 2024

Thanks for quick fix! @denisgranha

Note: there are other calls to BN constuctor, do you think they are fine?

from abi-decoder.

krzkaczor avatar krzkaczor commented on June 18, 2024

Turns out that it still doesnt work correctly. My PR fixes it.

Stranger, if you're looking for a fix just use my fork.

from abi-decoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.