Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/api/contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U committed Nov 29, 2024
2 parents 14cbe27 + 6957ff6 commit 5f10816
Show file tree
Hide file tree
Showing 77 changed files with 153 additions and 80 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "0.0.1-evm.9"
"version": "0.0.1-evm.10"
}
2 changes: 1 addition & 1 deletion packages/api-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-common",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Common API building blocks for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-database",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "API database for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-development/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-development",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Development API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-evm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-evm",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Ethereum JSON-RPC compatible API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
38 changes: 38 additions & 0 deletions packages/api-evm/source/actions/eth-get-block-by-hash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { inject, injectable } from "@mainsail/container";
import { Contracts, Identifiers } from "@mainsail/contracts";

import { BlockResource } from "../resources/index.js";

@injectable()
export class EthGetBlockByHashAction implements Contracts.Api.RPC.Action {
public readonly name: string = "eth_getBlockByHash";

@inject(Identifiers.Application.Instance)
private readonly app!: Contracts.Kernel.Application;

@inject(Identifiers.Database.Service)
private readonly databaseService!: Contracts.Database.DatabaseService;

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

maxItems: 2,
minItems: 2,

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

public async handle(parameters: [string, boolean]): Promise<object | null> {
const transactionObject = parameters[1];

const commit = await this.databaseService.getCommitById(parameters[0].slice(2));

if (!commit) {
// eslint-disable-next-line unicorn/no-null
return null;
}

return this.app.resolve(BlockResource).transform(commit.block, transactionObject);
}
}
1 change: 1 addition & 0 deletions packages/api-evm/source/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from "./eth-block-number.js";
export * from "./eth-call.js";
export * from "./eth-get-balance.js";
export * from "./eth-get-block-by-hash.js";
export * from "./eth-get-block-by-number.js";
export * from "./eth-get-code.js";
export * from "./eth-get-storage-at.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 @@ -6,6 +6,7 @@ import {
CallAction,
EthBlockNumberAction,
EthGetBalanceAction,
EthGetBlockByHashAction,
EthGetBlockByNumberAction,
EthGetCodeAction,
EthGetStorageAtAction,
Expand Down Expand Up @@ -66,6 +67,7 @@ export class ServiceProvider extends AbstractServiceProvider<Server> {
this.app.resolve(CallAction),
this.app.resolve(EthBlockNumberAction),
this.app.resolve(EthGetBalanceAction),
this.app.resolve(EthGetBlockByHashAction),
this.app.resolve(EthGetBlockByNumberAction),
this.app.resolve(EthGetCodeAction),
this.app.resolve(EthGetStorageAtAction),
Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-http",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "HTTP/S API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-sync/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-sync",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "API database sync for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-transaction-pool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-transaction-pool",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Transaction Pool API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/bootstrap",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Bootstrap manager for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/cli",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "CLI utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/configuration-generator",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Configuration generator for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus-storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/consensus-storage",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Consensus storage for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/consensus",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Consensus for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/container/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/container",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Container for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/contracts",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Contracts for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/source/contracts/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface DatabaseService {

getState(): State;
getCommit(height: number): Promise<Commit | undefined>;
getCommitById(id: string): Promise<Commit | undefined>;
findCommitBuffers(start: number, end: number): Promise<Buffer[]>;
readCommits(start: number, end: number): AsyncGenerator<Commit>;
findBlocks(start: number, end: number): Promise<Block[]>;
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/source/identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const Identifiers = {
Service: Symbol("Database<Service>"),
Storage: {
Block: Symbol("Database<Storage.Block>"),
BlockId: Symbol("Database<Storage.BlockId>"),
State: Symbol("Database<Storage.State>"),
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/core",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Core CLI commands for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-address-base58/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-address-base58",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Base58 address derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-address-keccak256/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-address-keccak256",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Keccak256 address derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-block/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-block",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Block utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-commit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-commit",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Commit utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-config",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Crypto configuration for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-consensus-bls12-381/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-consensus-bls12-381",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Combined BLS12-381 utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-hash-bcrypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-hash-bcrypto",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Hashing powered by bcrypto for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-key-pair-bls12-381/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-key-pair-bls12-381",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "BLS12-381 key derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-key-pair-ecdsa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-key-pair-ecdsa",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Secp256k1 key derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-key-pair-ed25519/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-key-pair-ed25519",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Ed25519 key derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-key-pair-schnorr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-key-pair-schnorr",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Schnorr key derivation for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-messages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-messages",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Crypto messages utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-signature-bls12-381/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-signature-bls12-381",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "BLS12-381 signatures for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-signature-ecdsa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-signature-ecdsa",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Elliptic Curve Cryptography (ECDSA) signatures for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-signature-schnorr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-signature-schnorr",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Schnorr (BIP340) signatures from libtorsion for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-transaction-evm-call/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-transaction-evm-call",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "EVM transaction for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-transaction/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-transaction",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Crypto transaction utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-validation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-validation",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Crypto validation utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-wif/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-wif",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Standalone version of identity interactions for the Mainsail blockchain.",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/crypto-worker",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "Crypto worker based on node child processes for Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/database",
"version": "0.0.1-evm.9",
"version": "0.0.1-evm.10",
"description": "LMDB based database for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
Loading

0 comments on commit 5f10816

Please sign in to comment.