diff --git a/packages/api-evm/source/actions/eth-get-uncle-count-by-block-number.ts b/packages/api-evm/source/actions/eth-get-uncle-count-by-block-number.ts new file mode 100644 index 000000000..d1f58ffd4 --- /dev/null +++ b/packages/api-evm/source/actions/eth-get-uncle-count-by-block-number.ts @@ -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 { + if (this.stateStore.getHeight() < Number(parameters[0])) { + throw new Exceptions.RpcError("Block not found"); + } + + return `0x0`; + } +} diff --git a/packages/api-evm/source/actions/index.ts b/packages/api-evm/source/actions/index.ts index 182e83c38..4578f8bb0 100644 --- a/packages/api-evm/source/actions/index.ts +++ b/packages/api-evm/source/actions/index.ts @@ -7,6 +7,7 @@ export * from "./eth-get-code.js"; export * from "./eth-get-storage-at.js"; export * from "./eth-get-transaction-count.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"; diff --git a/packages/api-evm/source/service-provider.ts b/packages/api-evm/source/service-provider.ts index 596959a20..c225fef7a 100644 --- a/packages/api-evm/source/service-provider.ts +++ b/packages/api-evm/source/service-provider.ts @@ -12,6 +12,7 @@ import { EthGetStorageAtAction, EthGetTransactionCount, EthGetUncleCountByBlockHash, + EthGetUncleCountByBlockNumber, NetListeningAction, NetPeerCountAction, Web3ClientVersionAction, @@ -74,6 +75,7 @@ export class ServiceProvider extends AbstractServiceProvider { this.app.resolve(EthGetStorageAtAction), this.app.resolve(EthGetTransactionCount), this.app.resolve(EthGetUncleCountByBlockHash), + this.app.resolve(EthGetUncleCountByBlockNumber), this.app.resolve(NetListeningAction), this.app.resolve(NetPeerCountAction), this.app.resolve(Web3ClientVersionAction),