fix(viewState): fetch block data for sortKey on viewState evaluation

This commit is contained in:
dtfiedler
2024-03-01 13:14:21 -07:00
committed by Asia
parent 024ed9b35c
commit 40f4f45c6e
2 changed files with 4 additions and 1 deletions

View File

@@ -90,7 +90,7 @@
"homepage": "https://github.com/warp-contracts/warp#readme",
"dependencies": {
"archiver": "^5.3.0",
"arweave": "1.13.7",
"arweave": "1.14.4",
"async-mutex": "^0.4.0",
"bignumber.js": "9.1.1",
"events": "3.3.0",

View File

@@ -849,9 +849,12 @@ export class HandlerBasedContract<State> implements Contract<State> {
// create execution context
let executionContext = await this.createExecutionContext(this._contractTxId, sortKey, true, undefined, signal);
const blockHeight = sortKey ? await this._sorter.extractBlockHeight(sortKey) : undefined;
const currentBlockData =
this.warp.environment == 'mainnet' && !(this.warp.interactionsLoader.type() === 'arweave')
? await this._arweaveWrapper.warpGwBlock()
: blockHeight
? await arweave.blocks.getByHeight(blockHeight)
: await arweave.blocks.getCurrent();
// add caller info to execution context