-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
package client | ||
|
||
import "github.com/gnolang/gno/tm2/pkg/std" | ||
import ( | ||
"github.com/gnolang/gno/tm2/pkg/std" | ||
) | ||
|
||
// Client defines the client interface for fetching chain data | ||
type Client interface { | ||
// GetLatestBlockNumber returns the latest block height from the chain | ||
GetLatestBlockNumber() (uint64, error) | ||
|
||
// GetBlockTransactions returns the transactions contained | ||
// within the specified block, if any | ||
GetBlockTransactions(uint64) ([]std.Tx, error) | ||
// GetBlock returns the transactions contained | ||
// within the specified block, if any, apart from the block height and | ||
// its timestamp in milliseconds. | ||
GetBlock(uint64) (*Block, error) | ||
} | ||
|
||
type Block struct { | ||
Txs []std.Tx | ||
Height uint64 | ||
Timestamp int64 | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package types | ||
|
||
import "github.com/gnolang/gno/tm2/pkg/std" | ||
import ( | ||
"github.com/gnolang/gno/tm2/pkg/std" | ||
) | ||
|
||
// TxData contains the single block transaction, | ||
// along with the block information | ||
type TxData struct { | ||
Tx std.Tx `json:"tx"` | ||
BlockNum uint64 `json:"blockNum"` | ||
|
||
// Timestamp contains the block creation time in unix milliseconds | ||
Timestamp int64 `json:"bt"` //nolint:tagliatelle // this name reduces disk space usage | ||
} |