Skip to content

Commit

Permalink
adds notes to injected historic api
Browse files Browse the repository at this point in the history
  • Loading branch information
filvecchiato committed Aug 26, 2024
1 parent fb7af56 commit 9eb63ef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/services/blocks/BlocksService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export class BlocksService extends AbstractService {

const previousBlockHash = await this.fetchPreviousBlockHash(number);
const prevBlockHistoricApi = await api.at(previousBlockHash);
// get previous block hash historic api and inject it where needed to save calls per extrinic
/**
* Fee calculation logic. This runs the extrinsics concurrently.
*/
Expand Down Expand Up @@ -256,7 +255,6 @@ export class BlocksService extends AbstractService {
historicApi?: ApiDecoration<'promise'>,
) {
const { api } = this;
// Inject historic api here or undefined if not available
if (noFees) {
extrinsics[idx].info = {};
return;
Expand Down Expand Up @@ -420,6 +418,7 @@ export class BlocksService extends AbstractService {
historicApi?: ApiDecoration<'promise'>,
): Promise<string> {
const { api } = this;
// Get injected historicApi for previousBlockHash or create a new one
const apiAt = historicApi || (await api.at(previousBlockHash));

let inclusionFee;
Expand Down Expand Up @@ -449,7 +448,7 @@ export class BlocksService extends AbstractService {
historicApi?: ApiDecoration<'promise'>,
): Promise<RuntimeDispatchInfo | RuntimeDispatchInfoV1> {
const { api } = this;
// mMove historic api to an injection and only if undefined get it
// Get injected historicApi for previousBlockHash or create a new one
const apiAt = historicApi || (await api.at(previousBlockHash));
if (apiAt.call.transactionPaymentApi.queryInfo) {
const u8a = ext.toU8a();
Expand Down

0 comments on commit 9eb63ef

Please sign in to comment.