Skip to content

Commit

Permalink
Merge branch 'develop' into feat/evm-api/eth_getUncleByBlockHashAndIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastijankuzner committed Dec 2, 2024
2 parents 502e27b + 954ccf3 commit f58153d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { inject, injectable } from "@mainsail/container";
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";

@injectable()
export class EthGetUncleCountByBlockNumber implements Contracts.Api.RPC.Action {
@inject(Identifiers.State.Store)
private readonly stateStore!: Contracts.State.Store;

public readonly name: string = "eth_getUncleCountByBlockNumber";

public readonly schema = {
$id: `jsonRpc_${this.name}`,
maxItems: 1,
minItems: 1,

prefixItems: [{ $ref: "prefixedHex" }],
type: "array",
};

public async handle(parameters: [string]): Promise<string> {
if (this.stateStore.getHeight() < Number(parameters[0])) {
throw new Exceptions.RpcError("Block not found");
}

return `0x0`;
}
}
1 change: 1 addition & 0 deletions packages/api-evm/source/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from "./eth-get-storage-at.js";
export * from "./eth-get-transaction-count.js";
export * from "./eth-get-uncle-by-block-hash-and-index.js";
export * from "./eth-get-uncle-count-by-block-hash.js";
export * from "./eth-get-uncle-count-by-block-number.js";
export * from "./net-listening.js";
export * from "./net-peer-count.js";
export * from "./web3-client-version.js";
2 changes: 2 additions & 0 deletions packages/api-evm/source/service-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
EthGetTransactionCount,
EthGetUncleByBlockHashAndIndex,
EthGetUncleCountByBlockHash,
EthGetUncleCountByBlockNumber,
NetListeningAction,
NetPeerCountAction,
Web3ClientVersionAction,
Expand Down Expand Up @@ -76,6 +77,7 @@ export class ServiceProvider extends AbstractServiceProvider<Server> {
this.app.resolve(EthGetTransactionCount),
this.app.resolve(EthGetUncleByBlockHashAndIndex),
this.app.resolve(EthGetUncleCountByBlockHash),
this.app.resolve(EthGetUncleCountByBlockNumber),
this.app.resolve(NetListeningAction),
this.app.resolve(NetPeerCountAction),
this.app.resolve(Web3ClientVersionAction),
Expand Down

0 comments on commit f58153d

Please sign in to comment.