Giter Site home page Giter Site logo

Comments (3)

WendySanarwanto avatar WendySanarwanto commented on July 24, 2024 2

Hello @rahuldamodar94 ,

In your code snippet, before returning result, you can get your transaction's info by writing this line:

const transactionInfo = await tronweb.trx.getTransaction(result);
console.log(`[debug] transactionInfo: \n`, transactionInfo);

In case you want to wait until getting your transactionInfo's status (e.g. CONFIRMED, REVERT), wrap the code above as a callback parameter of setTimeout method. Example:

setTimeout(() => {
    const transactionInfo = await tronweb.trx.getTransaction(result);
    const txStatus = transactionInfo.ret[0].contractRet; // CONFIRMED or REVERT
    console.log(`[debug] transactionInfo: \n`, transactionInfo);
    // TODO: Do something against transactionInfo. 
}, 4000); // wait for 4 seconds then call getTransaction method

Hope it helps.

Cheers.

from tronweb.

sullof avatar sullof commented on July 24, 2024

@rahuldamodar94, I think that the approach above suggested by @WendySanarwanto is a good one. But, if you still need help, please re-open it.

from tronweb.

bruffstar avatar bruffstar commented on July 24, 2024

Hey,

I am also using the solution above. However, I am not a fan of the "4 seconds".

A nice solution could be an additional option, to use in combination with shouldPollResponse.

Something like returnBeforeConfirmation or something. Basically, just to get the contractRet asap.

Would something like this be possible?

Thank you.

from tronweb.

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.