Documentation ¶
Index ¶
- Constants
- func MakeCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry)
- func ServerFromConfig(conf *Config) (crg.Server, error)
- func SetFlags(flags *pflag.FlagSet)
- func TMBlockToRosettaBlockIdentifier(block *tmcoretypes.ResultBlock) *types.BlockIdentifier
- func TMBlockToRosettaParentBlockIdentifier(block *tmcoretypes.ResultBlock) *types.BlockIdentifier
- func TMStatusToRosettaSyncStatus(status *tmcoretypes.ResultStatus) *types.SyncStatus
- func TMTxsToRosettaTxsIdentifiers(txs []tmtypes.Tx) []*types.TransactionIdentifier
- func TmPeersToRosettaPeers(peers []tmcoretypes.Peer) []*types.Peer
- func TmTxToRosettaTxsIdentifier(tx tmtypes.Tx) *types.TransactionIdentifier
- type Client
- func (c *Client) AccountIdentifierFromPublicKey(pubKey *types.PublicKey) (*types.AccountIdentifier, error)
- func (c *Client) Balances(ctx context.Context, addr string, height *int64) ([]*types.Amount, error)
- func (c *Client) BlockByHash(ctx context.Context, hash string) (crgtypes.BlockResponse, error)
- func (c *Client) BlockByHeight(ctx context.Context, height *int64) (crgtypes.BlockResponse, error)
- func (c *Client) BlockTransactionsByHash(ctx context.Context, hash string) (crgtypes.BlockTransactionsResponse, error)
- func (c *Client) BlockTransactionsByHeight(ctx context.Context, height *int64) (crgtypes.BlockTransactionsResponse, error)
- func (c *Client) Bootstrap() error
- func (c *Client) ConstructionMetadataFromOptions(ctx context.Context, options map[string]interface{}) (meta map[string]interface{}, err error)
- func (c *Client) ConstructionPayload(_ context.Context, request *types.ConstructionPayloadsRequest) (resp *types.ConstructionPayloadsResponse, err error)
- func (c *Client) GetTx(_ context.Context, hash string) (*types.Transaction, error)
- func (c *Client) GetUnconfirmedTx(ctx context.Context, hash string) (*types.Transaction, error)
- func (c *Client) Mempool(ctx context.Context) ([]*types.TransactionIdentifier, error)
- func (c *Client) OperationStatuses() []*types.OperationStatus
- func (c *Client) Peers(ctx context.Context) ([]*types.Peer, error)
- func (c *Client) PostTx(txBytes []byte) (*types.TransactionIdentifier, map[string]interface{}, error)
- func (c *Client) PreprocessOperationsToOptions(_ context.Context, req *types.ConstructionPreprocessRequest) (options map[string]interface{}, err error)
- func (c *Client) Ready() error
- func (c *Client) SignedTx(ctx context.Context, txBytes []byte, signatures []*types.Signature) (signedTxBytes []byte, err error)
- func (c *Client) Status(ctx context.Context) (*types.SyncStatus, error)
- func (c *Client) SupportedOperations() []string
- func (c *Client) TxOperationsAndSignersAccountIdentifiers(signed bool, txBytes []byte) (ops []*types.Operation, signers []*types.AccountIdentifier, err error)
- func (c *Client) Version() string
- type Config
- type Msg
- type PayloadReqMetadata
Constants ¶
const ( // DefaultBlockchain defines the default blockchain identifier name DefaultBlockchain = "app" // DefaultAddr defines the default rosetta binding address DefaultAddr = ":8080" // DefaultRetries is the default number of retries DefaultRetries = 5 // DefaultTendermintEndpoint is the default value for the tendermint endpoint DefaultTendermintEndpoint = "localhost:26657" // DefaultGRPCEndpoint is the default value for the gRPC endpoint DefaultGRPCEndpoint = "localhost:9090" // DefaultNetwork defines the default network name DefaultNetwork = "network" // DefaultOffline defines the default offline value DefaultOffline = false )
configuration defaults constants
const ( FlagBlockchain = "blockchain" FlagNetwork = "network" FlagTendermintEndpoint = "tendermint" FlagGRPCEndpoint = "grpc" FlagAddr = "addr" FlagRetries = "retries" FlagOffline = "offline" )
configuration flags
const ( StatusSuccess = "Success" StatusReverted = "Reverted" StageSynced = "synced" StageSyncing = "syncing" )
statuses
const ( OptionAccountNumber = "account_number" OptionAddress = "address" OptionChainID = "chain_id" OptionSequence = "sequence" OptionMemo = "memo" OptionGas = "gas" )
options
const (
Log = "log"
)
misc
const (
OperationFee = "fee"
)
operations
Variables ¶
This section is empty.
Functions ¶
func MakeCodec ¶
func MakeCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry)
MakeCodec generates the codec required to interact with the cosmos APIs used by the rosetta gateway
func TMBlockToRosettaBlockIdentifier ¶
func TMBlockToRosettaBlockIdentifier(block *tmcoretypes.ResultBlock) *types.BlockIdentifier
TMBlockToRosettaBlockIdentifier converts a tendermint result block to a rosetta block identifier
func TMBlockToRosettaParentBlockIdentifier ¶
func TMBlockToRosettaParentBlockIdentifier(block *tmcoretypes.ResultBlock) *types.BlockIdentifier
TMBlockToRosettaParentBlockIdentifier returns the parent block identifier from the last block
func TMStatusToRosettaSyncStatus ¶
func TMStatusToRosettaSyncStatus(status *tmcoretypes.ResultStatus) *types.SyncStatus
TMStatusToRosettaSyncStatus converts a tendermint status to rosetta sync status
func TMTxsToRosettaTxsIdentifiers ¶
func TMTxsToRosettaTxsIdentifiers(txs []tmtypes.Tx) []*types.TransactionIdentifier
TMTxsToRosettaTxsIdentifiers converts a tendermint raw transactions into an array of rosetta tx identifiers
func TmPeersToRosettaPeers ¶
func TmPeersToRosettaPeers(peers []tmcoretypes.Peer) []*types.Peer
TmPeersToRosettaPeers converts tendermint peers to rosetta ones
func TmTxToRosettaTxsIdentifier ¶
func TmTxToRosettaTxsIdentifier(tx tmtypes.Tx) *types.TransactionIdentifier
TmTxToRosettaTxsIdentifier converts a tendermint raw transaction into a rosetta tx identifier
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a single network client to interact with cosmos based chains
func (*Client) AccountIdentifierFromPublicKey ¶
func (*Client) BlockByHash ¶
func (*Client) BlockByHeight ¶
func (*Client) BlockTransactionsByHash ¶
func (*Client) BlockTransactionsByHeight ¶
func (*Client) ConstructionMetadataFromOptions ¶
func (*Client) ConstructionPayload ¶
func (c *Client) ConstructionPayload(_ context.Context, request *types.ConstructionPayloadsRequest) (resp *types.ConstructionPayloadsResponse, err error)
func (*Client) GetUnconfirmedTx ¶
GetUnconfirmedTx gets an unconfirmed transaction given its hash
func (*Client) OperationStatuses ¶
func (c *Client) OperationStatuses() []*types.OperationStatus
func (*Client) PreprocessOperationsToOptions ¶
func (*Client) SupportedOperations ¶
func (*Client) TxOperationsAndSignersAccountIdentifiers ¶
type Config ¶
type Config struct { // Blockchain defines the blockchain name // defaults to DefaultBlockchain Blockchain string // Network defines the network name Network string // TendermintRPC defines the endpoint to connect to // tendermint RPC, specifying 'tcp://' before is not // required, usually it's at port 26657 of the TendermintRPC string // GRPCEndpoint defines the cosmos application gRPC endpoint // usually it is located at 9090 port GRPCEndpoint string // Addr defines the default address to bind the rosetta server to // defaults to DefaultAddr Addr string // Retries defines the maximum number of retries // rosetta will do before quitting Retries int // Offline defines if the server must be run in offline mode Offline bool // Codec overrides the default data and construction api client codecs Codec *codec.ProtoCodec // InterfaceRegistry overrides the default data and construction api interface registry InterfaceRegistry codectypes.InterfaceRegistry }
Config defines the configuration of the rosetta server
func (*Config) NetworkIdentifier ¶
func (c *Config) NetworkIdentifier() *types.NetworkIdentifier
NetworkIdentifier returns the network identifier given the configuration
func (*Config) WithCodec ¶
func (c *Config) WithCodec(ir codectypes.InterfaceRegistry, cdc *codec.ProtoCodec)
WithCodec extends the configuration with a predefined Codec