Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoAuthorizationKey = Error.New("no authorization key")
ErrNoAuthorizationKey is error that indicates that there is no authorization key.
var Error = errs.Class("coinpayments client error")
Error is error class API errors.
Functions ¶
func GetTransacationKeyFromURL ¶
GetTransacationKeyFromURL parses provided raw url string and extracts authorization key from it. Returns ErrNoAuthorizationKey if there is no authorization key and error if rawurl cannot be parsed.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles base API processing.
func NewClient ¶
func NewClient(creds Credentials) *Client
NewClient creates new instance of client with provided credentials.
func (*Client) Transactions ¶
func (c *Client) Transactions() Transactions
Transactions returns transactions API.
type CreateTX ¶
type CreateTX struct { Amount big.Float CurrencyIn Currency CurrencyOut Currency BuyerEmail string }
CreateTX defines parameters for transaction creating.
type Credentials ¶
Credentials contains public and private API keys for client.
type Status ¶
type Status int
Status is a type wrapper for transaction statuses.
const ( // StatusCancelled defines cancelled or timeout transaction. StatusCancelled Status = -1 // StatusPending defines pending transaction which is waiting for buyer funds. StatusPending Status = 0 // StatusReceived defines transaction which successfully received required amount of funds. StatusReceived Status = 1 )
type Transaction ¶
type Transaction struct { ID TransactionID Address string Amount big.Float DestTag string ConfirmsNeeded int Timeout time.Duration CheckoutURL string StatusURL string QRCodeURL string }
Transaction contains data returned on transaction creation.
func (*Transaction) UnmarshalJSON ¶
func (tx *Transaction) UnmarshalJSON(b []byte) error
UnmarshalJSON handles json unmarshaling for transaction.
type TransactionID ¶
type TransactionID string
TransactionID is type wrapper for transaction id.
func (TransactionID) String ¶
func (id TransactionID) String() string
String returns string representation of transaction id.
type TransactionIDList ¶
type TransactionIDList []TransactionID
TransactionIDList is a type wrapper for list of transactions.
func (TransactionIDList) Encode ¶
func (list TransactionIDList) Encode() string
Encode returns encoded string representation of transaction id list.
type TransactionInfo ¶
type TransactionInfo struct { Address string Coin Currency Amount big.Float Received big.Float ConfirmsReceived int Status Status ExpiresAt time.Time CreatedAt time.Time }
TransactionInfo holds transaction information.
func (*TransactionInfo) UnmarshalJSON ¶
func (info *TransactionInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON handles json unmarshaling for transaction info.
type TransactionInfos ¶
type TransactionInfos map[TransactionID]TransactionInfo
TransactionInfos is map of transaction infos by transaction id.
func (*TransactionInfos) UnmarshalJSON ¶
func (infos *TransactionInfos) UnmarshalJSON(b []byte) error
UnmarshalJSON handles json unmarshaling for TransactionInfos.
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
Transactions defines transaction related API methods.
func (Transactions) Create ¶
func (t Transactions) Create(ctx context.Context, params CreateTX) (*Transaction, error)
Create creates new transaction.
func (Transactions) Info ¶
func (t Transactions) Info(ctx context.Context, id TransactionID) (*TransactionInfo, error)
Info receives transaction info by transaction id.
func (Transactions) ListInfos ¶
func (t Transactions) ListInfos(ctx context.Context, ids TransactionIDList) (TransactionInfos, error)
ListInfos returns up to 25 transaction infos.