Code Monkey home page Code Monkey logo

Comments (2)

xf00f avatar xf00f commented on June 6, 2024

@SirensOfTitan Thank you for the kind words.

Am I to understand the event logs are insufficient because they don't contain the data you need, or simply because it's slow to request each transactions receipt and read the logs?

If it's the later, could that not be resolved by either subscribing to, or requesting past logs for all events, and then having them pushed to you as they come in, or back in one large response respectively?

If the issue is you specifically need to pass input data, it's not trivial to do it with type safety. There would need to be an equivalent tx decode function for every method the contract supported.

If happy to live without type safety, you could possibly use this:
https://github.com/xf00f/web3x/blob/master/src/contract/abi/contract-function-entry.ts#L70

You'd have to import the contracts abi e.g. import { DaiContractAbi } from 'DaiContract' and lookup the function entry by slicing the signature (first 4 bytes e.g. 0xdeadbeef) off your input data. The response object will have both numbered and named fields.

If that's helpful, then I'll look into providing a simpler decodeTx method on a contract that will do that slicing etc. I'll ponder a way of making the response type safe but it maybe more effort than it's worth...

from web3x.

xf00f avatar xf00f commented on June 6, 2024

Not sure if you'll find it useful, but I added a helper method to ContractAbi in v3.0.5 as discussed above. You can use it as in this test case:
https://github.com/xf00f/web3x/blob/master/src/contract/abi/contract-abi.test.ts

Will close this issue for now. If you have a better, and generalised idea of something that would suite your kind of use case let me know.

from web3x.

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.