Giter Club home page Giter Club logo

Comments (4)

alessandrokonrad avatar alessandrokonrad commented on June 14, 2024 1

Yes! Simply add validTo(unixTime) or validFrom(unixTime) to your tx if you want to make use of time.
For your tx it looks like you have to add validFrom because that should be equivalent to --invalid-before.
Note Lucid wants you to add the unixTime in milliseconds and not the slot. For instance you could make use of Date.now() in Js:

      const tx = await lucid
        .newTx()
        .collectFrom([utxo], Redeemer(number))
        .validFrom(...)
        .attachSpendingValidator(vestingScript)
        .addSigner(benificialAddress)
        .complete()

I saw that there is work around for this case which is adding --invalid-before 48866954 in cardano-cli transaction build

It's not a workaround. Adding an interval is necessary if you want your script to read out a certain valid time interval, for Plutus and Native scripts :)

from lucid.

ahaxu avatar ahaxu commented on June 14, 2024 1

I watched this again (started at 29:24) slowly (0.5 xspeed), and everything clear now.
Thank you again!

from lucid.

ahaxu avatar ahaxu commented on June 14, 2024

Thank you so much @alessandrokonrad.

It's not a workaround. Adding an interval is necessary if you want your script to read out a certain valid time interval, for Plutus and Native scripts :)

can you explain more on this, i really still feel dump why we need to add --invalid-before.

From what i understand, this part on on-chain

    deadlineReached = contains (from $ deadline p) $ txInfoValidRange info

assumed to check if the deadline reached or not.

Can you elaborate more on this ;)

from lucid.

ahaxu avatar ahaxu commented on June 14, 2024

So, after thinking for a while,
i guess --invalid-before or validFrom option is checked when script is evaluated (when building tnx), before tnx actually hit (submit) on-chain logic.

from lucid.

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.