onflow/flow-js-testing

setTimestampOffset not work for timestamp in contracts

LanfordCai opened this issue · 0 comments

If I send a transaction with timestamp related logic, the timestamp does changed after setTimestampOffset:

    transaction() {
      prepare(acct: AuthAccount) {
        panic(getCurrentBlock().timestamp.toString())
      }
    }

However, if the timestamp related logic is locates in a contract, and I send a transaction to call the function of that contract, timestamp would not change:

pub contract Time {
    pub fun panicTime() {
        panic(getCurrentBlock().timestamp.toString())
    }

    init() {}
}
import Time from "../contracts/Time.cdc"

transaction() {
    prepare(acct: AuthAccount) {
        Time.panicTime()
    }
}