Documentation
¶
Index ¶
- type BlockByHashResponse
- type BlockchainDataSyncStatusResponse
- type Client
- func (c *Client) BalanceForAddress(address string) (int, error)
- func (c *Client) GeneratePayload()
- func (c *Client) GetBlockByHash(blockHash string) (*BlockByHashResponse, error)
- func (c *Client) GetBlockchainSyncStatus() (*BlockchainDataSyncStatusResponse, error)
- func (c *Client) GetInformation() (*InformationResponse, error)
- func (c *Client) GetLastBlockHash() (*LastBlockHashResponse, error)
- func (c *Client) GetRateLimit() (*RateLimitResponse, error)
- func (c *Client) TransactionByHash(txHash string) (*TransactionByHashResponse, error)
- func (c *Client) TransactionsForAddress(address string) (*TransactionsForAddressResponse, error)
- type ConfigOpts
- type InformationResponse
- type LastBlockHashResponse
- type RateLimitResponse
- type TransactionByHashResponse
- type TransactionsForAddressResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockByHashResponse ¶
type BlockByHashResponse struct {
Hash string `json:"hash"`
Size int `json:"size"`
Height int `json:"height"`
Version int `json:"version"`
MerkleRoot string `json:"merkleroot"`
Tx []string `json:"tx"`
Time int `json:"time"`
Bits string `json:"bits"`
ChainWork string `json:"chainwork"`
Confirmations int `json:"confirmations"`
PreviousBlockHash string `json:"previousblockhash"`
NextBlockHash string `json:"nextblockhash"`
Reward string `json:"reward"`
IsMainChain bool `json:"isMainChain"`
PoolInfo interface{} `json:"poolInfo"`
}
BlockByHash is information fro a particular block
type BlockchainDataSyncStatusResponse ¶
type BlockchainDataSyncStatusResponse struct {
Status string `json:"status"`
BlockchainHeight int `json:"blockChainHeight"`
SyncPercentage int `json:"syncPercentage"`
Height int `json:"height"`
Error string `json:"error"`
Type string `json:"type"`
}
BlockchainDataSyncStatusResponse is a response from the blockchain data sync call
type Client ¶
type Client struct {
URL string `json:"url"`
Payload string `json:"payload"`
Token string `json:"token"`
HC *http.Client
}
Client is how we interact with the chain rider api
func NewClient ¶
func NewClient(opts *ConfigOpts) (*Client, error)
NewClient is used to initialize our ChainRider client
func (*Client) BalanceForAddress ¶
BalanceForAddress returns the balance for an address in duffs
func (*Client) GeneratePayload ¶
func (c *Client) GeneratePayload()
GeneratePayload is used to generate our payload
func (*Client) GetBlockByHash ¶
func (c *Client) GetBlockByHash(blockHash string) (*BlockByHashResponse, error)
func (*Client) GetBlockchainSyncStatus ¶
func (c *Client) GetBlockchainSyncStatus() (*BlockchainDataSyncStatusResponse, error)
func (*Client) GetInformation ¶
func (c *Client) GetInformation() (*InformationResponse, error)
GetInformation is used to retrieve general blockchain information
func (*Client) GetLastBlockHash ¶
func (c *Client) GetLastBlockHash() (*LastBlockHashResponse, error)
func (*Client) GetRateLimit ¶
func (c *Client) GetRateLimit() (*RateLimitResponse, error)
GetRateLimit is used to get our rate limit information for the current token
func (*Client) TransactionByHash ¶
func (c *Client) TransactionByHash(txHash string) (*TransactionByHashResponse, error)
TransactionByHash is used to get transaction information for a particular hash
func (*Client) TransactionsForAddress ¶
func (c *Client) TransactionsForAddress(address string) (*TransactionsForAddressResponse, error)
TransactionsForAddress is used to get a list of several transactions for a particular address
type ConfigOpts ¶
type ConfigOpts struct {
APIVersion string `json:"api_version"`
DigitalCurrency string `json:"digital_currency"`
Blockchain string `json:"blockchain"`
Token string `json:"token"`
}
ConfigOpts are the configuration options for our session with teh api
type InformationResponse ¶
type InformationResponse struct {
Info struct {
Version int `json:"version"`
InsightVerison string `json:"insightversion"`
ProtocolVersion int `json:"protocolversion"`
Blocks int `json:"blocks"`
TimeOffset int `json:"timeoffset"`
Connections int `json:"connections"`
Proxy string `json:"proxy"`
Difficulty float64 `json:"difficulty"`
Testnet bool `json:"testnet"`
RelayFee float64 `json:"relayfee"`
Errors string `json:"errors"`
Network string `json:"network"`
} `json:"info"`
}
InformationResponse is the resposne from the information request
type LastBlockHashResponse ¶
type LastBlockHashResponse struct {
SyncTipHash string `json:"syncTipHash"`
LastBlockHash string `json:"lastblockhash"`
}
LastBlockHashResponse is a resposne from the last block hash call
type RateLimitResponse ¶
type RateLimitResponse struct {
Message struct {
Hour struct {
Usage int `json:"usage"`
Limit int `json:"limit"`
TimeLeft int `json:"time_left"`
} `json:"hour"`
Day struct {
Usage int `json:"usage"`
Limit int `json:"limit"`
TimeLeft int `json:"time_left"`
} `json:"day"`
Forward struct {
Usage int `json:"usage"`
Limit int `json:"limit"`
TimeLeft int `json:"time_left"`
} `json:"forward"`
} `json:"message"`
}
RateLimitResponse is the response given by the rate limit request
type TransactionByHashResponse ¶
type TransactionByHashResponse struct {
TxID string `json:"txid"`
Version int `json:"version"`
Locktime int `json:"locktime"`
Vin []struct {
TxID string `json:"txid"`
Vout int `json:"vout"`
N int `json:"n"`
ScriptSig struct {
Hex string `json:"hex"`
Asm string `json:"asm"`
} `json:"scriptsig"`
Addr string `json:"addr"`
ValueSat int `json:"valueSat"`
Value float64 `json:"value"`
DoubleSpentTxID string `json:"doubleSpentTxID,omitempty"`
} `json:"vin"`
Vout []struct {
Value string `json:"value"` // this might need to be a string
N int `json:"n"`
ScriptPubKey struct {
Hex string `json:"hex"`
Asm string `json:"asm"`
Addresses []string `json:"addresses"`
Type string `json:"type"`
} `json:"scriptPubKey"`
SpentTxID string `json:"spentTxId"`
SpentIndex int `json:"spentIndex"`
SpentHeight int `json:"spentHeight"`
} `json:"vout"`
BlockHash string `json:"blockhash"`
BlockHeight int `json:"blockheight"`
Confirmations int `json:"confirmations"`
Time int `json:"time"` // looks like its unix timestamp
BlockTime int `json:"blocktime"` // looks like its unix timestamps
ValueOut float64 `json:"valueOut"`
Size int `json:"size"`
ValueIn float64 `json:"valueIn"`
Fees float64 `json:"fees"`
TxLock bool `json:"txlock"`
}
TransactionByHashResponse is a response for a given transaction hash request
type TransactionsForAddressResponse ¶
type TransactionsForAddressResponse struct {
PagesTotal int `json:"pagesTotal"`
Transactions []TransactionByHashResponse `json:"txs"`
}
TransactionsForAddressResposne is a collection of multiple transactions