-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timestamp not included in searchTx() response #1181
Comments
I have decoded the transaction and that doesn't hold a timestamp ... what am i missing decodeTxRawFunc(transactions[0].tx) |
Transactions don't have a timestamp. The only time that exists is the timestamp of the block in which the transaction was executed. To get that you need to take the height and query the block information at that height. |
Thanks again :) ...... the only thing i would add is that when using the REST api you get all transactions and the timestamp ... this is where a lot of my confusion stems ie i was using the REST end points to test out data fetch ie /cosmos/tx/v1beta1/txs .... then moved to cosmJS and nothing made sense but that is all part of on boarding yourself to new tech ...... once again thanks. |
Yeah, right, makes sense. The reason is that the "REST" API server does exactly what I described behind the scenes to provide a convenient response to users. It's always the block time of the block in which the transaction is executed. |
Closing as resolved. Please feel free to re-open if you have follow-up questions that fall under the same title. |
Is there any reason that the timestamp is not included in the returned response when it is parsed in the following function ..
private async txsQuery(query: string): Promise<readonly IndexedTx[]> {
const results = await this.forceGetTmClient().txSearchAll({ query: query });
return results.txs.map((tx) => {
return {
height: tx.height,
hash: toHex(tx.hash).toUpperCase(),
code: tx.result.code,
rawLog: tx.result.log || "",
tx: tx.tx,
gasUsed: tx.result.gasUsed,
gasWanted: tx.result.gasWanted,
};
});
}
.......... as its not included what is the expectations with regards to getting timestamp, do we have to call getBlock() ?
The text was updated successfully, but these errors were encountered: