Skip to content
Snippets Groups Projects
Commit 4ac9cf00 authored by Igor Markin's avatar Igor Markin
Browse files

Add build

parent ef9f351e
No related branches found
No related tags found
1 merge request!8028 get seal time from aeternity api
Pipeline #44829 passed
......@@ -15,6 +15,11 @@ declare class AeternityService {
requestApi: (apiUrls: string[]) => Request;
getTxDataByHash(hash: string): Promise<TxData>;
decodeContractCallData(callData: string): Promise<DecodedCallData>;
getMicroBlock(hash: string): Promise<{
height: number;
time: number;
hash: string;
}>;
getBlock(height: number): Promise<{
height: number;
time: number;
......
......@@ -83,6 +83,7 @@ class AeternityService {
tx: {
callData: data.tx.call_data,
},
blockHash: data.block_hash,
};
});
}
......@@ -106,6 +107,18 @@ class AeternityService {
};
});
}
getMicroBlock(hash) {
return __awaiter(this, void 0, void 0, function* () {
const { time, height } = yield this.requestNode({
url: `/v2/micro-blocks/hash/${hash}/header`,
}).then(({ data }) => data);
return {
height,
time,
hash,
};
});
}
getBlock(height) {
return __awaiter(this, void 0, void 0, function* () {
const { time, hash } = yield this.requestNode({
......
export interface AeternityAPITxData {
hash: string;
block_height: number;
block_hash: string;
tx: {
call_data: string;
};
......
......@@ -113,7 +113,13 @@ class VerificationService extends EventEmitter {
batchHash,
};
this.emit(exports.STATUS_BATCH_VERIFIED, batchVerificationDetails);
blockData = yield this.getBlockData(txData.blockHeight);
const blockRequests = yield Promise.all([
this.getBlockData(txData.blockHeight),
this._aeternityService.getMicroBlock(txData.blockHash),
]);
blockData = blockRequests[0];
const microBlockData = blockRequests[1];
txData.time = microBlockData.time;
this.emit(exports.BLOCK_DATA_RETRIEVED, blockData);
}
catch (e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment