Skip to content

Commit

Permalink
Merge branch 'develop' into feat/evm-api/eth_getUncleByBlockNumberAnd…
Browse files Browse the repository at this point in the history
…Index
  • Loading branch information
sebastijankuzner committed Dec 2, 2024
2 parents 04a7262 + 47ab48b commit b9c8063
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { inject, injectable } from "@mainsail/container";
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";

@injectable()
export class EthGetUncleByBlockHashAndIndex implements Contracts.Api.RPC.Action {
@inject(Identifiers.Database.Service)
private readonly databaseService!: Contracts.Database.DatabaseService;

public readonly name: string = "eth_getUncleByBlockHashAndIndex";

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

prefixItems: [{ $ref: "prefixedHex" }, { $ref: "prefixedHex" }], // TODO: Replace prefixedHex with prefixedBlockId
type: "array",
};

public async handle(parameters: [string]): Promise<null> {
if (!this.databaseService.hasCommitById(parameters[0].slice(2))) {
throw new Exceptions.RpcError("Block not found");
}

// eslint-disable-next-line unicorn/no-null
return null;
}
}
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 @@ -6,6 +6,7 @@ export * from "./eth-get-block-by-number.js";
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-by-block-hash-and-index.js";
export * from "./eth-get-uncle-by-block-number-and-index.js";
export * from "./eth-get-uncle-count-by-block-hash.js";
export * from "./eth-get-uncle-count-by-block-number.js";
Expand Down
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 @@ -11,6 +11,7 @@ import {
EthGetCodeAction,
EthGetStorageAtAction,
EthGetTransactionCount,
EthGetUncleByBlockHashAndIndex,
EthGetUncleByBlockNumberAndIndex,
EthGetUncleCountByBlockHash,
EthGetUncleCountByBlockNumber,
Expand Down Expand Up @@ -75,6 +76,7 @@ export class ServiceProvider extends AbstractServiceProvider<Server> {
this.app.resolve(EthGetCodeAction),
this.app.resolve(EthGetStorageAtAction),
this.app.resolve(EthGetTransactionCount),
this.app.resolve(EthGetUncleByBlockHashAndIndex),
this.app.resolve(EthGetUncleByBlockNumberAndIndex),
this.app.resolve(EthGetUncleCountByBlockHash),
this.app.resolve(EthGetUncleCountByBlockNumber),
Expand Down

0 comments on commit b9c8063

Please sign in to comment.