Documentation ¶
Index ¶
- func IsWellFormedHash(hash string) error
- type Block
- type BlockHeader
- type Chunk
- type ChunkHeader
- type HttpNearRpc
- type NearApi
- type NearApiImpl
- func (n NearApiImpl) GetBlock(ctx context.Context, blockId string) (Block, error)
- func (n NearApiImpl) GetBlockByHeight(ctx context.Context, blockHeight uint64) (Block, error)
- func (n NearApiImpl) GetChunk(ctx context.Context, chunkHeader ChunkHeader) (Chunk, error)
- func (n NearApiImpl) GetFinalBlock(ctx context.Context) (Block, error)
- func (n NearApiImpl) GetTxStatus(ctx context.Context, txHash string, senderAccountId string) ([]byte, error)
- type NearRpc
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsWellFormedHash ¶
Types ¶
type Block ¶
type Block struct { Header BlockHeader // contains filtered or unexported fields }
func NewBlockFromBytes ¶
func (Block) ChunkHashes ¶
func (b Block) ChunkHashes() []ChunkHeader
type BlockHeader ¶
type Chunk ¶
type Chunk struct { Hash string // contains filtered or unexported fields }
func NewChunkFromBytes ¶
func (Chunk) Transactions ¶
func (c Chunk) Transactions() []Transaction
type ChunkHeader ¶
type ChunkHeader struct {
Hash string
}
type HttpNearRpc ¶
type HttpNearRpc struct {
// contains filtered or unexported fields
}
func NewHttpNearRpc ¶
func NewHttpNearRpc(nearRPC string) HttpNearRpc
type NearApi ¶
type NearApi interface { GetBlock(ctx context.Context, blockId string) (Block, error) GetBlockByHeight(ctx context.Context, blockHeight uint64) (Block, error) GetFinalBlock(ctx context.Context) (Block, error) GetChunk(ctx context.Context, chunkHeader ChunkHeader) (Chunk, error) GetTxStatus(ctx context.Context, txHash string, senderAccountId string) ([]byte, error) }
type NearApiImpl ¶
type NearApiImpl struct {
// contains filtered or unexported fields
}
func NewNearApiImpl ¶
func NewNearApiImpl(nearRpc NearRpc) NearApiImpl
func (NearApiImpl) GetBlock ¶
getBlock calls the NEAR RPC API to retrieve a block by its hash (https://docs.near.org/api/rpc/block-chunk#block-details)
func (NearApiImpl) GetBlockByHeight ¶
getBlockByHeight calls the NEAR RPC API to retrieve a block by its height (https://docs.near.org/api/rpc/block-chunk#block-details)
func (NearApiImpl) GetChunk ¶
func (n NearApiImpl) GetChunk(ctx context.Context, chunkHeader ChunkHeader) (Chunk, error)
getChunk gets a chunk from the NEAR RPC API: https://docs.near.org/api/rpc/block-chunk#chunk-details
func (NearApiImpl) GetFinalBlock ¶
func (n NearApiImpl) GetFinalBlock(ctx context.Context) (Block, error)
getFinalBlock gets a finalized block from the NEAR RPC API using the parameter "finality": "final" (https://docs.near.org/api/rpc/block-chunk)
func (NearApiImpl) GetTxStatus ¶
func (n NearApiImpl) GetTxStatus(ctx context.Context, txHash string, senderAccountId string) ([]byte, error)
getTxStatus queries status of a transaction by hash, returning the transaction_outcomes and receipts_outcomes sender_account_id is used to determine which shard to query for the transaction See https://docs.near.org/api/rpc/transactions#transaction-status