Documentation
¶
Overview ¶
Package currency provides information on the price of ETH.
Index ¶
- func GWei2Wei(amountGWei *big.Float) *big.Int
- func Wei2GWei(amountWei *big.Int) *big.Float
- type BalanceDiff
- type Converter
- func (c *Converter) CalculateBalanceDiff(startingBalance *big.Int, endingBalance *big.Int) (BalanceDiff, error)
- func (c *Converter) CalculateReceiptDetails(receipt *types.Receipt, gasPrice *big.Int) ReceiptDetails
- func (c *Converter) CalculateTransactionDetails(tx *types.Transaction) TransactionDetails
- func (c *Converter) FmtBalanceSheet(startingBalance *big.Int, endingBalance *big.Int) string
- func (c *Converter) FmtTransaction(tx *types.Transaction) string
- func (c *Converter) FmtTransactionReceipt(receipt *types.Receipt, gasPrice *big.Int) string
- func (c *Converter) GWei2USD(amountGWei *big.Float) string
- func (c *Converter) USD2GWei(amountUSD *big.Float) *big.Float
- func (c *Converter) USD2Wei(amountUSD *big.Float) *big.Int
- func (c *Converter) Values() (oneETHToUSD *big.Float, oneUSDToETH *big.Float)
- func (c *Converter) Wei2USD(amountWei *big.Int) string
- type DataETH
- type DataUSD
- type LogData
- type ReceiptDetails
- type ResponseETH2USD
- type ResponseUSD2ETH
- type Status
- type TransactionDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BalanceDiff ¶
BalanceDiff performs calculations on the starting and ending balance.
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter maintains the information required for ETH conversions.
func NewConverter ¶
NewConverter constructs a conversion for working with ETH and USD.
func NewDefaultConverter ¶
NewDefaultConverter can be used if the API is failing to set reasonable defaults. Also good for tests.
func (*Converter) CalculateBalanceDiff ¶
func (c *Converter) CalculateBalanceDiff(startingBalance *big.Int, endingBalance *big.Int) (BalanceDiff, error)
CalculateBalanceDiff performs calculations on the starting and ending balance.
func (*Converter) CalculateReceiptDetails ¶
func (c *Converter) CalculateReceiptDetails(receipt *types.Receipt, gasPrice *big.Int) ReceiptDetails
CalculateReceiptDetails performs calculations on the receipt.
func (*Converter) CalculateTransactionDetails ¶
func (c *Converter) CalculateTransactionDetails(tx *types.Transaction) TransactionDetails
CalculateTransactionDetails performs calculations on the transaction.
func (*Converter) FmtBalanceSheet ¶
FmtBalanceSheet produces a easy to read format of the starting and ending balance for the connected account.
func (*Converter) FmtTransaction ¶
func (c *Converter) FmtTransaction(tx *types.Transaction) string
FmtTransaction produces a easy to read format of the specified transaction.
func (*Converter) FmtTransactionReceipt ¶
FmtTransactionReceipt produces a easy to read format of the specified receipt.
type DataETH ¶
type DataETH struct { Symbol string `json:"symbol"` Amount int `json:"amount"` LastUpdated string `json:"last_updated"` Quote struct { ETH struct { Price float64 `json:"price"` LastUpdated string `json:"last_updated"` } `json:"ETH"` } `json:"quote"` }
DataETH represents the data provided when asking for ETH.
type DataUSD ¶
type DataUSD struct { Symbol string `json:"symbol"` Amount int `json:"amount"` LastUpdated string `json:"last_updated"` Quote struct { USD struct { Price float64 `json:"price"` LastUpdated string `json:"last_updated"` } `json:"USD"` } `json:"quote"` }
DataUSD represents the data provided when asking for USD.
type ReceiptDetails ¶
type ReceiptDetails struct { Status uint64 GasUsed uint64 GasPriceGWei string GasPriceUSD string FinalCostGWei string FinalCostUSD string }
ReceiptDetails provides details about a receipt and it's cost.
type ResponseETH2USD ¶
ResponseETH2USD represents the complete response when converting ETH to USD.
type ResponseUSD2ETH ¶
ResponseUSD2ETH represents the complete response when converting USD to ETH.