good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
93e2ac27
Unverified
Commit
93e2ac27
authored
Sep 29, 2020
by
Jaynti Kanani
Committed by
GitHub
Sep 29, 2020
Browse files
Options
Downloads
Plain Diff
Merge pull request #88 from maticnetwork/arpit/mat-2318
mat-2318 (Create `bor.getAuthor()` api for bor module)
parents
21bbd174
0e4487db
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
consensus/bor/api.go
+17
-0
17 additions, 0 deletions
consensus/bor/api.go
internal/web3ext/web3ext.go
+6
-0
6 additions, 0 deletions
internal/web3ext/web3ext.go
with
23 additions
and
0 deletions
consensus/bor/api.go
+
17
−
0
View file @
93e2ac27
...
@@ -62,6 +62,23 @@ func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) {
...
@@ -62,6 +62,23 @@ func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) {
return
api
.
bor
.
snapshot
(
api
.
chain
,
header
.
Number
.
Uint64
(),
header
.
Hash
(),
nil
)
return
api
.
bor
.
snapshot
(
api
.
chain
,
header
.
Number
.
Uint64
(),
header
.
Hash
(),
nil
)
}
}
// GetAuthor retrieves the author a block.
func
(
api
*
API
)
GetAuthor
(
number
*
rpc
.
BlockNumber
)
(
*
common
.
Address
,
error
)
{
// Retrieve the requested block number (or current if none requested)
var
header
*
types
.
Header
if
number
==
nil
||
*
number
==
rpc
.
LatestBlockNumber
{
header
=
api
.
chain
.
CurrentHeader
()
}
else
{
header
=
api
.
chain
.
GetHeaderByNumber
(
uint64
(
number
.
Int64
()))
}
// Ensure we have an actually valid block and return its snapshot
if
header
==
nil
{
return
nil
,
errUnknownBlock
}
author
,
err
:=
api
.
bor
.
Author
(
header
)
return
&
author
,
err
}
// GetSnapshotAtHash retrieves the state snapshot at a given block.
// GetSnapshotAtHash retrieves the state snapshot at a given block.
func
(
api
*
API
)
GetSnapshotAtHash
(
hash
common
.
Hash
)
(
*
Snapshot
,
error
)
{
func
(
api
*
API
)
GetSnapshotAtHash
(
hash
common
.
Hash
)
(
*
Snapshot
,
error
)
{
header
:=
api
.
chain
.
GetHeaderByHash
(
hash
)
header
:=
api
.
chain
.
GetHeaderByHash
(
hash
)
...
...
This diff is collapsed.
Click to expand it.
internal/web3ext/web3ext.go
+
6
−
0
View file @
93e2ac27
...
@@ -129,6 +129,12 @@ web3._extend({
...
@@ -129,6 +129,12 @@ web3._extend({
params: 1,
params: 1,
inputFormatter: [null]
inputFormatter: [null]
}),
}),
new web3._extend.Method({
name: 'getAuthor',
call: 'bor_getAuthor',
params: 1,
inputFormatter: [null]
}),
new web3._extend.Method({
new web3._extend.Method({
name: 'getSnapshotAtHash',
name: 'getSnapshotAtHash',
call: 'bor_getSnapshotAtHash',
call: 'bor_getSnapshotAtHash',
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment