Skip to content
Discussions/App Development/How to get effective time of event using PQSForum ↗

How to get effective time of event using PQS

App Development6 posts135 views1 likesLast activity May 2024
HU
huwOP
May 2024

Is there any way I can write a query to find the effective ledger time at which a particular contract was created using PQS?

BE
bernhard
May 2024

Hi @huw , transactions have an effective_at field. So do a join via the “offset” field on creates and transactions and get the effective time from the transaction.

HU
huw
May 2024

Yes but I notice that the effective_at field is nullable on the _transactions table. In testing it has come up as NULL. Moreover the _transactions table’s schema may not be stable. Can you advise on the best approach?

HU
huw
May 2024

After some more experimentation, it seems there is a timing issue: if I run my test immediately after scribe has started the effective time stamp may be NULL, but after adding some delay before querying I get the expected time stamps. It would be good to get some clarity on how to do this correctly. I guess I need to use some of the offset-related functions?

VL
vladgangan
May 2024

A couple of suggestions:

  1. _transactions points to a very old version of PQS, it is no longer supported, please upgrade ASAP
  2. use Read API table functions to access data (without underscores) instead of going into internal tables
  3. PQS v0.3.2 exposes the event’s transaction’s effective_at field via Read API now
select contract_id, created_effective_at, archived_effective_at, payload
from creates('PingPong:Pong');
HU
huw
May 2024

Ok thank you. I will try again with the latest version of PQS

← Back to Discussions