Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBuckets(update func(fn func(*bolt.Tx) error) error, buckets ...[]byte) error
- func DecodeResponse(rsp *http.Response, successStatus int, data any, allowEmptyResponse bool) error
- func EncodeHex(value []byte) string
- func EnsureSubBucket(tx *bolt.Tx, parentBucket []byte, bucket []byte, allowAbsent bool) (*bolt.Bucket, error)
- func ExtractOffsetMarker(rsp *http.Response) (string, error)
- func GetURL(url url.URL, pathElements ...string) *url.URL
- func ParseHex[T types.UnitID | TxHash | []byte](value string, required bool) (T, error)
- func ParseMaxResponseItems(s string, maxValue int) (int, error)
- func SetLinkHeader(u *url.URL, w http.ResponseWriter, next string)
- func SetPaginationParams(u *url.URL, offset string, limit int)
- func SetQueryParam(u *url.URL, key, val string)
- type Bill
- type Bills
- type EmptyResponse
- type ErrorResponse
- type InfoResponse
- type LockReason
- type Predicate
- type Proof
- type PubKey
- type PubKeyHash
- type ResponseWriter
- func (rw *ResponseWriter) ErrorResponse(w http.ResponseWriter, code int, err error)
- func (rw *ResponseWriter) InvalidParamResponse(w http.ResponseWriter, name string, err error)
- func (rw *ResponseWriter) WriteCborResponse(w http.ResponseWriter, data any)
- func (rw *ResponseWriter) WriteErrorResponse(w http.ResponseWriter, err error)
- func (rw *ResponseWriter) WriteResponse(w http.ResponseWriter, data any)
- type RoundNumber
- type Transactions
- type TxHash
- type TxHistoryRecord
- type TxHistoryRecordKind
- type TxHistoryRecordState
- type TxProof
Constants ¶
View Source
const ( ContentType = "Content-Type" ApplicationJson = "application/json" ApplicationCbor = "application/cbor" UserAgent = "User-Agent" QueryParamOffsetKey = "offsetKey" QueryParamLimit = "limit" HeaderLink = "Link" HeaderLinkValueFormat = `<%s>; rel="next"` )
View Source
const ( LockReasonAddFees = 1 + iota LockReasonReclaimFees LockReasonCollectDust LockReasonManual )
Variables ¶
View Source
var ( // ErrInvalidRequest is returned when backend responded with 4nn status code, use errors.Is to check for it. ErrInvalidRequest = errors.New("invalid request") // ErrNotFound is returned when backend responded with 404 status code, use errors.Is to check for it. ErrNotFound = errors.New("not found") )
View Source
var ErrRecordNotFound = errors.New("not found")
View Source
var SwaggerFiles embed.FS
Functions ¶
func CreateBuckets ¶
func DecodeResponse ¶
DecodeResponse when "rsp" StatusCode is equal to "successStatus" response body is decoded into "data". In case of some other response status body is expected to contain error response json struct.
func EnsureSubBucket ¶
func ParseMaxResponseItems ¶
parseMaxResponseItems parses input "s" as integer. When empty string or int over "maxValue" is sent in "maxValue" is returned. In case of invalid int or value smaller than 1 error is returned.
func SetLinkHeader ¶
func SetLinkHeader(u *url.URL, w http.ResponseWriter, next string)
func SetQueryParam ¶
Types ¶
type Bill ¶
type Bill struct { Id []byte `json:"id,omitempty"` Value uint64 `json:"value,omitempty,string"` TxHash []byte `json:"txHash,omitempty"` DCTargetUnitID []byte `json:"targetUnitId,omitempty"` DCTargetUnitBacklink []byte `json:"targetUnitBacklink,omitempty"` Locked LockReason `json:"locked,omitempty,string"` }
type EmptyResponse ¶
type EmptyResponse struct{}
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
type InfoResponse ¶
type InfoResponse struct { SystemID string `json:"system_id"` // hex encoded system identifier (without 0x prefix) Name string `json:"name"` // one of [money backend | tokens backend] }
InfoResponse should be compatible with Node /info request
type LockReason ¶
type LockReason uint64
func (LockReason) String ¶
func (r LockReason) String() string
type Proof ¶
type Proof struct { TxRecord *types.TransactionRecord `json:"txRecord"` TxProof *types.TxProof `json:"txProof"` // contains filtered or unexported fields }
Proof wrapper struct around TxRecord and TxProof
func NewTxProof ¶
func (*Proof) GetActualFee ¶
type PubKey ¶
type PubKey []byte
func DecodePubKeyHex ¶
func (PubKey) Hash ¶
func (pk PubKey) Hash() PubKeyHash
type PubKeyHash ¶
type PubKeyHash []byte
type ResponseWriter ¶
type ResponseWriter struct {
LogErr func(err error)
}
func (*ResponseWriter) ErrorResponse ¶
func (rw *ResponseWriter) ErrorResponse(w http.ResponseWriter, code int, err error)
func (*ResponseWriter) InvalidParamResponse ¶
func (rw *ResponseWriter) InvalidParamResponse(w http.ResponseWriter, name string, err error)
func (*ResponseWriter) WriteCborResponse ¶
func (rw *ResponseWriter) WriteCborResponse(w http.ResponseWriter, data any)
func (*ResponseWriter) WriteErrorResponse ¶
func (rw *ResponseWriter) WriteErrorResponse(w http.ResponseWriter, err error)
func (*ResponseWriter) WriteResponse ¶
func (rw *ResponseWriter) WriteResponse(w http.ResponseWriter, data any)
type RoundNumber ¶
type Transactions ¶
type Transactions struct { Transactions []*types.TransactionOrder // contains filtered or unexported fields }
type TxHistoryRecord ¶
type TxHistoryRecord struct { UnitID types.UnitID TxHash TxHash CounterParty []byte Timeout uint64 State TxHistoryRecordState Kind TxHistoryRecordKind // contains filtered or unexported fields }
type TxHistoryRecordKind ¶
type TxHistoryRecordKind byte
const ( OUTGOING TxHistoryRecordKind = iota INCOMING )
type TxHistoryRecordState ¶
type TxHistoryRecordState byte
const ( UNCONFIRMED TxHistoryRecordState = iota CONFIRMED FAILED )
Click to show internal directories.
Click to hide internal directories.