Documentation ¶
Index ¶
- Constants
- func ValidateAddress(arg string) (bool, error)
- type Adapterer
- type Address
- type Bitcoin
- type BitcoinClient
- func (b *BitcoinClient) CreateWallet(name string) (*CreateWalletResp, error)
- func (b *BitcoinClient) EstimateSmartFee(target int) (*EstimateSmartFeeResp, error)
- func (b *BitcoinClient) GetBalance(wallet string) (*Bitcoin, error)
- func (b *BitcoinClient) GetNewAddress(wallet string) (Address, error)
- func (b *BitcoinClient) ListTransactions(wallet string, count int, skip int) ([]ListTransactionRecord, error)
- func (b *BitcoinClient) ListWallets() ([]string, error)
- func (b *BitcoinClient) LoadWallet(wallet string) error
- func (b *BitcoinClient) SendToAddress(wallet string, arg SendToAddressOpts) (string, error)
- func (b *BitcoinClient) SetLogger(log librefund.Logger)
- func (b *BitcoinClient) SetTXFee(amount *Bitcoin) (bool, error)
- func (b *BitcoinClient) ValidateAddress(address string) (*ValidateAddressResponse, error)
- type BitcoinPaymentFailed
- type BitcoinPaymentPaid
- type BitcoinPaymentRefunded
- type BitcoinPaymentStarted
- type BitcoinStub
- func (s *BitcoinStub) EnsureWalletExists(wallet string) error
- func (s *BitcoinStub) GetBalance(wallet string) (*librefund.Money, error)
- func (s *BitcoinStub) GetNewAddress(wallet string) (Address, error)
- func (s *BitcoinStub) NotifyTransactionUpdate(newTX <-chan librefund.TransactionID, lastCompleted *TransactionID) error
- func (s *BitcoinStub) Transfer(txs []librefund.Transaction) error
- func (s *BitcoinStub) UpdateTransactions(wallet string) error
- func (s *BitcoinStub) ValidateBitcoinAddress(arg string) (bool, error)
- type CreateWalletResp
- type EstimateSmartFeeResp
- type GetTransactionDetails
- type GetTransactionResult
- type ListTransactionRecord
- type Params
- type PaymentGateway
- func (s *PaymentGateway) GetLastPayments(from int, amount int) ([]*payment.Payment, error)
- func (s *PaymentGateway) GetPayment(paymentID string) (*payment.Payment, error)
- func (s *PaymentGateway) GetPaymentInfo(paymentID string) (*PaymentInfo, error)
- func (s *PaymentGateway) GetReceiveAddress(paymentID string) (Address, error)
- func (s *PaymentGateway) IsAwaitingConfirmation(paymentID string) bool
- func (s *PaymentGateway) PaymentURL(paymentID string) (string, error)
- func (s *PaymentGateway) RefundPayment(paymentID string, req *payment.RefundRequest) (*payment.RefundResponse, error)
- func (s *PaymentGateway) SetLogger(log librefund.Logger)
- func (s *PaymentGateway) Start() error
- func (s *PaymentGateway) StartPayment(req *payment.PaymentRequest) (*payment.PaymentResponse, error)
- func (s *PaymentGateway) Stop()
- func (s *PaymentGateway) TransferMethod() string
- func (s *PaymentGateway) ValidateAddress(arg string) (bool, error)
- type PaymentInfo
- type PaymentStore
- func (s *PaymentStore) GetLastPayments(from int, amount int) ([]*payment.Payment, error)
- func (s *PaymentStore) GetPaymentInfo(paymentID string) (*PaymentInfo, bool)
- func (s *PaymentStore) GetPaymentInfoByRecvAddr(recvAddr Address) (*PaymentInfo, bool)
- func (s *PaymentStore) PaymentFailed(paymentID string) error
- func (s *PaymentStore) PaymentPaid(paymentID string) error
- func (s *PaymentStore) PaymentRefunded(paymentID string, refundAmount *librefund.Money) error
- func (s *PaymentStore) PaymentStarted(paymentID string, amount *librefund.Money, fulfillmentURL string, ...) error
- type Satoshis
- type SendToAddressOpts
- type SendToAddressResult
- type TransactionID
- type TransferID
- type TransferInfo
- type URI
- type ValidateAddressResponse
Constants ¶
View Source
const ( Unset = "UNSET" Economical = "ECONOMICAL" Conservative = "CONSERVATIVE" )
View Source
const BitSymbol = "μ₿"
BitSymbol is the symbol for 0.000001 BTC.
View Source
const Confirmations = 3
View Source
const CurrencyCode = "BTC"
View Source
const MillibitSymbol = "m₿"
MillibitSymbol is the symbol for 0.001 BTC.
View Source
const Scheme = "bitcoin"
Scheme is the URI scheme.
View Source
const Symbol = "₿"
View Source
const TransferMethod = "bitcoin"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapterer ¶
type Adapterer interface { GetBalance(wallet string) (*librefund.Money, error) GetNewAddress(wallet string) (Address, error) EnsureWalletExists(wallet string) error Transfer(txs []librefund.Transaction) error UpdateTransactions(wallet string) error NotifyTransactionUpdate(newTX <-chan librefund.TransactionID, lastCompleted *TransactionID) error ValidateAddress(arg string) (bool, error) }
type Address ¶
type Address string
Address is a Bitcoin address.
func MustAddress ¶
MustAddress returns an address, panicing if its invalid.
func NewAddress ¶
NewAddress returns a validated Address.
type Bitcoin ¶
type BitcoinClient ¶
func NewClient ¶
func NewClient(cfg librefund.Config) *BitcoinClient
func (*BitcoinClient) CreateWallet ¶
func (b *BitcoinClient) CreateWallet(name string) (*CreateWalletResp, error)
func (*BitcoinClient) EstimateSmartFee ¶
func (b *BitcoinClient) EstimateSmartFee(target int) (*EstimateSmartFeeResp, error)
func (*BitcoinClient) GetBalance ¶
func (b *BitcoinClient) GetBalance(wallet string) (*Bitcoin, error)
func (*BitcoinClient) GetNewAddress ¶
func (b *BitcoinClient) GetNewAddress(wallet string) (Address, error)
func (*BitcoinClient) ListTransactions ¶
func (b *BitcoinClient) ListTransactions( wallet string, count int, skip int, ) ([]ListTransactionRecord, error)
func (*BitcoinClient) ListWallets ¶
func (b *BitcoinClient) ListWallets() ([]string, error)
ListWallets ...
func (*BitcoinClient) LoadWallet ¶
func (b *BitcoinClient) LoadWallet(wallet string) error
LoadWallet ...
func (*BitcoinClient) SendToAddress ¶
func (b *BitcoinClient) SendToAddress( wallet string, arg SendToAddressOpts, ) (string, error)
SendToAddress ...
func (*BitcoinClient) SetLogger ¶
func (b *BitcoinClient) SetLogger(log librefund.Logger)
func (*BitcoinClient) SetTXFee ¶
func (b *BitcoinClient) SetTXFee( amount *Bitcoin, ) (bool, error)
SetTXFee sets the transaction fee.
func (*BitcoinClient) ValidateAddress ¶
func (b *BitcoinClient) ValidateAddress( address string, ) (*ValidateAddressResponse, error)
ValidateAddress ...
type BitcoinPaymentFailed ¶
type BitcoinPaymentFailed struct { Event string `json:"event"` CreatedAt time.Time `json:"createdAt"` PaymentID string `json:"paymentId"` }
func (*BitcoinPaymentFailed) Name ¶
func (s *BitcoinPaymentFailed) Name() string
func (*BitcoinPaymentFailed) New ¶
func (s *BitcoinPaymentFailed) New() interface{}
type BitcoinPaymentPaid ¶
type BitcoinPaymentPaid struct { Event string `json:"event"` CreatedAt time.Time `json:"createdAt"` PaymentID string `json:"paymentId"` }
func (*BitcoinPaymentPaid) Name ¶
func (s *BitcoinPaymentPaid) Name() string
func (*BitcoinPaymentPaid) New ¶
func (s *BitcoinPaymentPaid) New() interface{}
type BitcoinPaymentRefunded ¶
type BitcoinPaymentRefunded struct { Event string `json:"event"` CreatedAt time.Time `json:"createdAt"` PaymentID string `json:"paymentId"` RefundAmount *librefund.Money }
func (*BitcoinPaymentRefunded) Name ¶
func (s *BitcoinPaymentRefunded) Name() string
func (*BitcoinPaymentRefunded) New ¶
func (s *BitcoinPaymentRefunded) New() interface{}
type BitcoinPaymentStarted ¶
type BitcoinPaymentStarted struct { Event string `json:"event"` CreatedAt time.Time `json:"createdAt"` Amount *librefund.Money `json:"amount"` FulfillmentURL string `json:"fulfillmentUrl"` PaymentID string `json:"paymentId"` ReceiveAddress Address `json:"receiveAddress"` ReturnAddress Address `json:"returnAddress"` }
func (*BitcoinPaymentStarted) Name ¶
func (s *BitcoinPaymentStarted) Name() string
func (*BitcoinPaymentStarted) New ¶
func (s *BitcoinPaymentStarted) New() interface{}
type BitcoinStub ¶
func (*BitcoinStub) EnsureWalletExists ¶
func (s *BitcoinStub) EnsureWalletExists(wallet string) error
func (*BitcoinStub) GetBalance ¶
func (s *BitcoinStub) GetBalance(wallet string) (*librefund.Money, error)
func (*BitcoinStub) GetNewAddress ¶
func (s *BitcoinStub) GetNewAddress(wallet string) (Address, error)
func (*BitcoinStub) NotifyTransactionUpdate ¶
func (s *BitcoinStub) NotifyTransactionUpdate(newTX <-chan librefund.TransactionID, lastCompleted *TransactionID) error
func (*BitcoinStub) Transfer ¶
func (s *BitcoinStub) Transfer(txs []librefund.Transaction) error
func (*BitcoinStub) UpdateTransactions ¶
func (s *BitcoinStub) UpdateTransactions(wallet string) error
func (*BitcoinStub) ValidateBitcoinAddress ¶
func (s *BitcoinStub) ValidateBitcoinAddress(arg string) (bool, error)
type CreateWalletResp ¶
type EstimateSmartFeeResp ¶
type GetTransactionDetails ¶
type GetTransactionResult ¶
type ListTransactionRecord ¶
type Params ¶
type Params struct {
ReturnAddress Address `schema:"returnAddress"`
}
Params are this Gateway's specific parameters for creating orders.
type PaymentGateway ¶
type PaymentGateway struct { Config librefund.Config Client clienter // contains filtered or unexported fields }
func NewPaymentGateway ¶
func (*PaymentGateway) GetLastPayments ¶
func (*PaymentGateway) GetPayment ¶
func (s *PaymentGateway) GetPayment(paymentID string) (*payment.Payment, error)
func (*PaymentGateway) GetPaymentInfo ¶
func (s *PaymentGateway) GetPaymentInfo(paymentID string) (*PaymentInfo, error)
func (*PaymentGateway) GetReceiveAddress ¶
func (s *PaymentGateway) GetReceiveAddress(paymentID string) (Address, error)
func (*PaymentGateway) IsAwaitingConfirmation ¶
func (s *PaymentGateway) IsAwaitingConfirmation( paymentID string, ) bool
func (*PaymentGateway) PaymentURL ¶
func (s *PaymentGateway) PaymentURL( paymentID string, ) (string, error)
func (*PaymentGateway) RefundPayment ¶
func (s *PaymentGateway) RefundPayment( paymentID string, req *payment.RefundRequest, ) (*payment.RefundResponse, error)
func (*PaymentGateway) SetLogger ¶
func (s *PaymentGateway) SetLogger(log librefund.Logger)
func (*PaymentGateway) Start ¶
func (s *PaymentGateway) Start() error
func (*PaymentGateway) StartPayment ¶
func (s *PaymentGateway) StartPayment( req *payment.PaymentRequest, ) (*payment.PaymentResponse, error)
func (*PaymentGateway) Stop ¶
func (s *PaymentGateway) Stop()
func (*PaymentGateway) TransferMethod ¶
func (s *PaymentGateway) TransferMethod() string
func (*PaymentGateway) ValidateAddress ¶
func (s *PaymentGateway) ValidateAddress( arg string, ) (bool, error)
ValidateBitcoinAddress validates addresses using a naive Regular Expression pattern matching.
type PaymentInfo ¶
type PaymentInfo struct { Amount *librefund.Money `json:"amount"` FulfillmentURL string `json:"fulfillmentUrl"` ID string `json:"id"` ReceiveAddress Address `json:"receiveAddress"` RefundAmount *librefund.Money `json:"refundAmount"` ReturnAddress Address `json:"returnAddress"` Status payment.PaymentStatus `json:"status"` IsAwaitingConfirmation bool `json:"isAwaitingConfirmation"` }
type PaymentStore ¶
type PaymentStore struct {
// contains filtered or unexported fields
}
func NewPaymentStore ¶
func NewPaymentStore( eventLog *librefund.EventLog, ) *PaymentStore
func (*PaymentStore) GetLastPayments ¶
func (*PaymentStore) GetPaymentInfo ¶
func (s *PaymentStore) GetPaymentInfo( paymentID string, ) (*PaymentInfo, bool)
func (*PaymentStore) GetPaymentInfoByRecvAddr ¶
func (s *PaymentStore) GetPaymentInfoByRecvAddr( recvAddr Address, ) (*PaymentInfo, bool)
func (*PaymentStore) PaymentFailed ¶
func (s *PaymentStore) PaymentFailed( paymentID string, ) error
func (*PaymentStore) PaymentPaid ¶
func (s *PaymentStore) PaymentPaid( paymentID string, ) error
type SendToAddressOpts ¶
type SendToAddressOpts struct { // The bitcoin address to send to. Address Address `json:"address"` // The amount in BTC to send. eg 0.1 Amount *Bitcoin `json:"amount"` // A comment used to store what the transaction is for. This is not // part of the transaction, just kept in your wallet. Comment *string `json:"comment"` // A comment to store the name of the person or organization to which // you’re sending the transaction. This is not part of the transaction, // just kept in your wallet. CommentTo *string `json:"comment_to"` // The fee will be deducted from the amount being sent. The recipient // will receive less bitcoins than you enter in the amount field. SubtractFeeFromAmount *bool `json:"subtract_fee_from_amount"` // Allow this transaction to be replaced by a transaction with higher // fees via BIP 125. Replaceable *bool `json:"replaceable"` // Confirmation target (in blocks). ConfTarget *int `json:"conf_target"` EstimateMode *string `json:"estimate_mode"` }
type TransferInfo ¶
type TransferInfo struct { ReceiveAddress Address `json:"receiveAddress" schema:"receiveAddress"` ReturnAddress Address `json:"returnAddress" schema:"returnAddress"` }
TransferInfo is the Bitcoin specific information used to track Bitcoin transfers for contributions.
Click to show internal directories.
Click to hide internal directories.