From 43d54c4456198ab044633ade9f9d7c180b0c9829 Mon Sep 17 00:00:00 2001 From: Vaibhav Jindal Date: Tue, 12 Sep 2023 11:09:08 +0530 Subject: [PATCH] Implemented the GetVoteOnHash under Bor namespace --- internal/ethapi/backend.go | 3 +++ internal/ethapi/bor_api.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 2add3b8def..2dca44cc7e 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -139,6 +139,9 @@ func GetAPIs(apiBackend Backend) []rpc.API { }, { Namespace: "personal", Service: NewPersonalAccountAPI(apiBackend, nonceLock), + }, { + Namespace: "bor", + Service: NewBorAPI(apiBackend), }, } } diff --git a/internal/ethapi/bor_api.go b/internal/ethapi/bor_api.go index 6a96480504..289f6a3650 100644 --- a/internal/ethapi/bor_api.go +++ b/internal/ethapi/bor_api.go @@ -51,3 +51,17 @@ func (s *BlockChainAPI) appendRPCMarshalBorTransaction(ctx context.Context, bloc return fields } + +// EthereumAPI provides an API to access Ethereum related information. +type BorAPI struct { + b Backend +} + +// NewEthereumAPI creates a new Ethereum protocol API. +func NewBorAPI(b Backend) *BorAPI { + return &BorAPI{b} +} + +func (api *BorAPI) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBlockNr uint64, hash string, milestoneId string) (bool, error) { + return api.b.GetVoteOnHash(ctx, starBlockNr, endBlockNr, hash, milestoneId) +}