-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/evm-api/eth_getUncleByBlockHashAndIndex
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
packages/api-evm/source/actions/eth-get-uncle-count-by-block-number.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters