Documentation
¶
Index ¶
- func DuffsToDash(duffs float64) float64
- type BlockByHashResponse
- type BlockchainDataSyncStatusResponse
- type Client
- func (c *Client) BalanceForAddress(address string) (int, error)
- func (c *Client) CreatePaymentForward(opts *PaymentForwardOpts) (*CreatePaymentForwardResponse, error)
- func (c *Client) DeletePaymentForwardByID(id string) 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) GetPaymentForwardByID(id string) (*GetPaymentForwardByIDResponse, 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 CreatePaymentForwardResponse
- type GetPaymentForwardByIDResponse
- type InformationResponse
- type LastBlockHashResponse
- type PaymentForwardOpts
- type ProcessedTxObject
- type RateLimitResponse
- type TransactionByHashResponse
- type TransactionsForAddressResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DuffsToDash ¶ added in v1.0.3
DuffsToDash is used to convert units of duffs to dash
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"`
}
BlockByHashResponse 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) CreatePaymentForward ¶
func (c *Client) CreatePaymentForward(opts *PaymentForwardOpts) (*CreatePaymentForwardResponse, error)
CreatePaymentForward is used to create a payment forward
func (*Client) DeletePaymentForwardByID ¶
DeletePaymentForwardByID is used to delete a particular payment forward rule
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) GetPaymentForwardByID ¶
func (c *Client) GetPaymentForwardByID(id string) (*GetPaymentForwardByIDResponse, error)
GetPaymentForwardByID is used to lookup a particular payment forward
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 CreatePaymentForwardResponse ¶
type CreatePaymentForwardResponse struct {
PaymentForwardID string `json:"paymentforward_id"`
PaymentAddress string `json:"payment_address"`
DestinationAddress string `json:"destination_address"`
CommissionFeePercent float64 `json:"commission_fee_percent"`
MiningFeeDuffs int `json:"mining_fee_duffs"`
}
CreatePaymentForwardResponse is a resposne from the create payment forward call
type GetPaymentForwardByIDResponse ¶
type GetPaymentForwardByIDResponse struct {
PaymentForwardID string `json:"paymentforward_id"`
PaymentAddress string `json:"payment_address"`
DestinationAddress string `json:"destination_address"`
CommissionAddress string `json:"commission_address"`
CommissionFeePercent float64 `json:"commission_fee_percent"`
CreatedDate string `json:"created_date"`
CallbackURL string `json:"callback_url"`
MiningFeeDuffs int `json:"mining_fee_duffs"`
ProcessedTxs []ProcessedTxObject `json:"processed_txs"`
}
GetPaymentForwardByIDResponse is a response a from get payment forward by id
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 PaymentForwardOpts ¶
type PaymentForwardOpts struct {
// DestinationAddress is the address to which dash will be forwarded to
DestinationAddress string `json:"destination_address"`
}
PaymentForwardOpts is used to configure payment forward creation
type ProcessedTxObject ¶
type ProcessedTxObject struct {
InputTransactionHash string `json:"input_transaction_hash"`
ReceivedAmountDuffs int `json:"received_amount_duffs"`
TransactionHash string `json:"transaction_hash"`
// time at which the payment was forwarded
ProcessedDate string `json:"processed_date"`
}
ProcessedTxObject is a transaction that has been processed for a payment forward
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"`
}
TransactionsForAddressResponse is a collection of multiple transactions