Documentation ¶
Index ¶
- Variables
- type CardDetails
- type CardSettings
- type HTTPSignedRequest
- type Wallet
- func (w *Wallet) ConfirmTransaction(id string) (*wallet.TransactionInfo, error)
- func (w *Wallet) CreateCardAddress(network string) (string, error)
- func (w *Wallet) GetBalance(refresh bool) (*wallet.Balance, error)
- func (w *Wallet) GetCardDetails() (*CardDetails, error)
- func (w *Wallet) GetTransaction(id string) (*wallet.TransactionInfo, error)
- func (w *Wallet) GetWalletInfo() wallet.Info
- func (w *Wallet) ListTransactions(limit int, startDate time.Time) ([]wallet.TransactionInfo, error)
- func (w *Wallet) PrepareRegistration(label string) (string, error)
- func (w *Wallet) PrepareTransaction(altcurrency altcurrency.AltCurrency, probi decimal.Decimal, destination string, ...) (string, error)
- func (w *Wallet) Register(label string) error
- func (w *Wallet) SubmitRegistration(registrationB64 string) error
- func (w *Wallet) SubmitTransaction(transactionB64 string, confirm bool) (*wallet.TransactionInfo, error)
- func (w *Wallet) Transfer(altcurrency altcurrency.AltCurrency, probi decimal.Decimal, destination string) (*wallet.TransactionInfo, error)
- func (w *Wallet) VerifyAnonCardTransaction(transactionB64 string) (*wallet.TransactionInfo, error)
- func (w *Wallet) VerifyTransaction(transactionB64 string) (*wallet.TransactionInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ( // SettlementDestination is the address of the settlement wallet SettlementDestination = os.Getenv("BAT_SETTLEMENT_ADDRESS") // AnonCardSettlementAddress is the address of the settlement wallet AnonCardSettlementAddress = os.Getenv("ANON_CARD_SETTLEMENT_ADDRESS") // UpholdSettlementAddress is the address of the settlement wallet UpholdSettlementAddress = os.Getenv("UPHOLD_SETTLEMENT_ADDRESS") )
Functions ¶
This section is empty.
Types ¶
type CardDetails ¶
type CardDetails struct { AvailableBalance decimal.Decimal `json:"available"` Balance decimal.Decimal `json:"balance"` Currency altcurrency.AltCurrency `json:"currency"` ID uuid.UUID `json:"id"` Settings CardSettings `json:"settings"` }
CardDetails contains details corresponding to the Uphold card
type CardSettings ¶
type CardSettings struct {
Protected bool `json:"protected,omitempty"`
}
CardSettings contains settings corresponding to the Uphold card
type HTTPSignedRequest ¶ added in v0.1.1
type HTTPSignedRequest struct { Headers map[string]string `json:"headers" valid:"-"` Body string `json:"octets" valid:"json"` }
HTTPSignedRequest encapsulates a signed HTTP request
type Wallet ¶
Wallet a wallet information using Uphold as the provider A wallet corresponds to a single Uphold "card"
func FromWalletInfo ¶
FromWalletInfo returns an uphold wallet matching the provided wallet info
func New ¶
New returns an uphold wallet constructed using the provided parameters NOTE that it does not register a wallet with Uphold if it does not already exist
func (*Wallet) ConfirmTransaction ¶
func (w *Wallet) ConfirmTransaction(id string) (*wallet.TransactionInfo, error)
ConfirmTransaction confirms a previously submitted transaction, moving funds
func (*Wallet) CreateCardAddress ¶ added in v0.1.1
CreateCardAddress on network, returning the address
func (*Wallet) GetBalance ¶
GetBalance returns the last known balance, if refresh is true then the current balance is fetched
func (*Wallet) GetCardDetails ¶
func (w *Wallet) GetCardDetails() (*CardDetails, error)
GetCardDetails returns the details associated with the wallet's backing Uphold card
func (*Wallet) GetTransaction ¶ added in v0.1.1
func (w *Wallet) GetTransaction(id string) (*wallet.TransactionInfo, error)
GetTransaction returns info about a previously confirmed transaction
func (*Wallet) GetWalletInfo ¶
GetWalletInfo returns the info associated with the wallet
func (*Wallet) ListTransactions ¶ added in v0.1.1
ListTransactions for this wallet, pagination not yet supported
func (*Wallet) PrepareRegistration ¶ added in v0.1.1
PrepareRegistration returns a b64 encoded serialized signed registration suitable for SubmitRegistration
func (*Wallet) PrepareTransaction ¶
func (w *Wallet) PrepareTransaction(altcurrency altcurrency.AltCurrency, probi decimal.Decimal, destination string, message string) (string, error)
PrepareTransaction returns a b64 encoded serialized signed transaction suitable for SubmitTransaction
func (*Wallet) SubmitRegistration ¶ added in v0.1.1
SubmitRegistration from a b64 encoded signed string
func (*Wallet) SubmitTransaction ¶
func (w *Wallet) SubmitTransaction(transactionB64 string, confirm bool) (*wallet.TransactionInfo, error)
SubmitTransaction submits the base64 encoded transaction for verification but does not move funds
unless confirm is set to true.
func (*Wallet) Transfer ¶
func (w *Wallet) Transfer(altcurrency altcurrency.AltCurrency, probi decimal.Decimal, destination string) (*wallet.TransactionInfo, error)
Transfer moves funds out of the associated wallet and to the specific destination
func (*Wallet) VerifyAnonCardTransaction ¶ added in v0.3.0
func (w *Wallet) VerifyAnonCardTransaction(transactionB64 string) (*wallet.TransactionInfo, error)
VerifyAnonCardTransaction calls VerifyTransaction and checks the currency, amount and destination
func (*Wallet) VerifyTransaction ¶
func (w *Wallet) VerifyTransaction(transactionB64 string) (*wallet.TransactionInfo, error)
VerifyTransaction verifies that the transaction is valid NOTE VerifyTransaction guards against transactions that seek to exploit parser differences such as including additional fields that are not understood by this implementation but may be understood by the upstream wallet provider. See DecodeTransaction for details.