Documentation
¶
Index ¶
- Constants
- Variables
- func AttachNode(node *node.Node)
- func BuildSolanaAddress(encodedString string) (types.SolanaAddress, error)
- func ClearSessionCookie(w http.ResponseWriter)
- func CloseAllWallets() (err error)
- func GetCSRFToken(sessionID string) string
- func GetSessionFromRequest(req *http.Request) string
- func IsRunning() bool
- func IsSessionExpired(sessionID string) bool
- func NewCurrencyStr(amount string) (types.Currency, error)
- func SetSessionCookie(w http.ResponseWriter, sessionID string)
- func StartHTTPServer(webWalletConfig *wwConfig.WebWalletConfig)
- func UpdateSessionActivity(sessionID string)
- func ValidateCSRFToken(req *http.Request, sessionID string) bool
- type AllowanceResponse
- type BalInfo
- type JSONMessage
- type RestWallet
- type Session
- type SummarizedTransaction
- type TransactionHistoryLine
- type TransactionHistoryPage
- type TransportHistoryRecord
- type TxDetails
- type TxInput
- type TxOutput
- type Vote
- type VoteOption
Constants ¶
const ( // SessionCookieName is the name of the HTTP-only session cookie SessionCookieName = "webwallet_session" // CSRFCookieName is the name of the CSRF token cookie (readable by JS) CSRFCookieName = "webwallet_csrf" // CSRFHeaderName is the header name for CSRF token validation CSRFHeaderName = "X-CSRF-Token" // SessionMaxAge is the session timeout in seconds (24 hours) SessionMaxAge = 86400 )
Variables ¶
var ( // ErrParseCurrencyAmount is returned when the input is unable to be parsed // into a currency unit due to a malformed amount. ErrParseCurrencyAmount = errors.New("malformed amount") // ErrParseCurrencyInteger is returned when the input is unable to be parsed // into a currency unit due to a non-integer value. ErrParseCurrencyInteger = errors.New("non-integer number of hastings") // ErrParseCurrencyUnits is returned when the input is unable to be parsed // into a currency unit due to missing units. ErrParseCurrencyUnits = errors.New("amount is missing currency units. Currency units are case sensitive") // ErrNegativeCurrency is the error that is returned if performing an // operation results in a negative currency. ErrNegativeCurrency = errors.New("negative currency not allowed") // ErrUint64Overflow is the error that is returned if converting to a // unit64 would cause an overflow. ErrUint64Overflow = errors.New("cannot return the uint64 of this currency - result is an overflow") // ZeroCurrency defines a currency of value zero. ZeroCurrency = types.NewCurrency64(0) )
var (
UI lorca.UI
)
Functions ¶
func BuildSolanaAddress ¶ added in v1.1.0
func BuildSolanaAddress(encodedString string) (types.SolanaAddress, error)
func ClearSessionCookie ¶ added in v1.5.0
func ClearSessionCookie(w http.ResponseWriter)
ClearSessionCookie removes the session cookies
func CloseAllWallets ¶ added in v0.1.4
func CloseAllWallets() (err error)
CloseAllWallets closes all wallets and detaches them from the node.
func GetCSRFToken ¶ added in v1.5.0
GetCSRFToken returns the CSRF token for a session (to include in forms/headers)
func GetSessionFromRequest ¶ added in v1.5.0
GetSessionFromRequest extracts session ID from cookie (preferred) or falls back to form/query param (legacy)
func IsRunning ¶ added in v0.1.4
func IsRunning() bool
IsRunning returns true when the server is running
func IsSessionExpired ¶ added in v1.5.0
IsSessionExpired checks if a session has expired
func NewCurrencyStr ¶
NewCurrencyStr creates a Currency value from a supplied string with unit suffix. Valid unit suffixes are: H, pS, nS, uS, mS, SCP, KS, MS, GS, TS, SPF Unit Suffixes are case sensitive.
func SetSessionCookie ¶ added in v1.5.0
func SetSessionCookie(w http.ResponseWriter, sessionID string)
SetSessionCookie sets the session ID as an HTTP-only cookie
func StartHTTPServer ¶
func StartHTTPServer(webWalletConfig *wwConfig.WebWalletConfig)
StartHTTPServer starts the HTTP server to serve the GUI.
func UpdateSessionActivity ¶ added in v1.5.0
func UpdateSessionActivity(sessionID string)
UpdateSessionActivity updates the last access time for a session
Types ¶
type AllowanceResponse ¶ added in v1.4.0
type AllowanceResponse struct {
Regular types.SolanaTransportAllowance `json:"regular"`
Premined map[string]types.SolanaTransportAllowance `json:"premined"`
Airdrop *types.SolanaTransportAllowance `json:"airdrop,omitempty"`
History []TransportHistoryRecord `json:"history"`
Balance interface{} `json:"balance"`
CoinType string `json:"coinType"`
}
type JSONMessage ¶ added in v1.1.0
type JSONMessage struct {
Success bool `json:"success"`
Message interface{} `json:"message"`
}
func NewErrorMessage ¶ added in v1.1.0
func NewErrorMessage(message interface{}) JSONMessage
func NewSuccessMessage ¶ added in v1.1.0
func NewSuccessMessage(message interface{}) JSONMessage
type RestWallet ¶ added in v1.1.0
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is a struct that tracks session settings
type SummarizedTransaction ¶
type SummarizedTransaction struct {
TxnID string `json:"txn_id"`
Type string `json:"type"`
Time types.Timestamp `json:"time"`
Confirmed string `json:"confirmed"`
Scp float64 `json:"scp"`
ScpFee float64 `json:"scp_fee"`
SpfA float64 `json:"spfa"`
SpfB float64 `json:"spfb"`
}
SummarizedTransaction is a transaction that has been formatted for· humans to read.
func ComputeSummarizedTransactions ¶
func ComputeSummarizedTransactions(pts []modules.ProcessedTransaction, blockHeight types.BlockHeight, wwallet modules.Wallet) ([]SummarizedTransaction, error)
ComputeSummarizedTransactions creates a set of SummarizedTransactions from a set of ProcessedTransactions.
type TransactionHistoryLine ¶ added in v0.2.0
type TransactionHistoryLine struct {
TransactionID string `json:"transaction_id"`
ShortTransactionID string `json:"short_transaction_id"`
Type string `json:"type"`
Time types.Timestamp `json:"time"`
Amount string `json:"amount"`
AmountSCP float64 `json:"amount_scp"`
AmountSPFA float64 `json:"amount_spfa"`
AmountSPFB float64 `json:"amount_spfb"`
Fee string `json:"fee"`
FeeSCP float64 `json:"fee_scp"`
Confirmed string `json:"confirmed"`
}
type TransactionHistoryPage ¶ added in v0.2.0
type TransactionHistoryPage struct {
TransactionHistoryLines []TransactionHistoryLine `json:"lines"`
Current int `json:"current"`
Total int `json:"total"`
}
type TransportHistoryRecord ¶ added in v1.4.0
type TransportHistoryRecord struct {
BurnID types.TransactionID `json:"burn_id"`
Status types.SolanaTransportStatus `json:"status"`
Amount string `json:"currency"`
Created types.Timestamp `json:"created"`
}
type TxDetails ¶ added in v1.1.0
type TxDetails struct {
Timestamp types.Timestamp
TxID types.TransactionID
TxType modules.TXType
TxBlock types.BlockHeight
Inputs []TxInput
Outputs []TxOutput
}
type TxInput ¶ added in v1.1.0
type TxInput struct {
Value types.Currency
Address types.UnlockHash
FundType string
}
type TxOutput ¶ added in v1.1.0
type TxOutput struct {
Value types.Currency
Address types.UnlockHash
FundType string
}