chain

package
v0.0.0-...-c15aa5a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: GPL-3.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BTCChain

type BTCChain struct {
	// contains filtered or unexported fields
}

BTCChain is a struct for identifier blockchains and their forks

func (*BTCChain) UnwrapResponse

func (ec *BTCChain) UnwrapResponse(cmd uint8, payload []RPCResponse) ([]byte, error)

func (*BTCChain) WrapRequest

func (ec *BTCChain) WrapRequest(rpcURL string, cmd uint8, payload []byte) (*HttpData, error)

type CosmosChain

type CosmosChain struct {
	// contains filtered or unexported fields
}

CosmosChain is a struct for identifier blockchains and their forks

func (*CosmosChain) UnwrapResponse

func (ec *CosmosChain) UnwrapResponse(cmd uint8, payload []RPCResponse) ([]byte, error)

func (*CosmosChain) WrapRequest

func (ec *CosmosChain) WrapRequest(rpcURL string, cmd uint8, payload []byte) (*HttpData, error)

type ETHChain

type ETHChain struct {
	// contains filtered or unexported fields
}

ETHChain is a struct for identifier blockchains and their forks

func (*ETHChain) UnwrapResponse

func (ec *ETHChain) UnwrapResponse(cmd uint8, payload []RPCResponse) ([]byte, error)

func (*ETHChain) WrapRequest

func (ec *ETHChain) WrapRequest(rpcURL string, cmd uint8, payload []byte) (*HttpData, error)

type HttpData

type HttpData struct {
	Method string
	URL    string
	Body   []byte
}

HttpData is the common struct containing the body and url Tag is for specifying the response message

type IChain

type IChain interface {
	WrapRequest(rpcURL string, cmd uint8, payload []byte) (*HttpData, error)
	UnwrapResponse(cmd uint8, payload []RPCResponse) ([]byte, error)
}

IChain is an abstraction for a cryptocurrency It creates raw transactions

func GetChain

func GetChain(ticker string) (IChain, error)

GetChain takes a ticker symbol for a supported chain and returns an interface for that chain

type RPCError

type RPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

type RPCResponse

type RPCResponse struct {
	Version string    `json:"jsonrpc,omitempty"`
	ID      uint      `json:"id,omitempty"`
	Error   *RPCError `json:"error,omitempty"`
	Result  string    `json:"result,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL