models

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package models contain HTTP response data structures received from BWS

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	CreatedOn   uint   `json:"createdOn"`
	Type        string `json:"type"`
	CopayerID   string `json:"copayerId"`
	CopayerName string `json:"copayerName"`
	Comment     string `json:"comment"`
}

Action represents transaction update

type Address

type Address struct {
	Version     string   `json:"version"`
	CreatedOn   uint     `json:"createdOn"`
	Address     string   `json:"address"`
	WalletID    string   `json:"walletId"`
	IsChange    bool     `json:"isChange"`
	Path        string   `json:"path"`
	PublicKeys  []string `json:"publicKeys"`
	Coin        string   `json:"coin"`
	Network     string   `json:"network"`
	Type        string   `json:"type"`
	HasActivity *bool    `json:"hasActivity,omitempty"`
}

Address represents receive address

type AddressScan

type AddressScan struct {
	Started bool `json:"started"`
}

AddressScan represents address scan process

type Balance

type Balance struct {
	TotalAmount              uint64 `json:"totalAmount"`
	LockedAmount             uint64 `json:"lockedAmount"`
	TotalConfirmedAmount     uint64 `json:"totalConfirmedAmount"`
	LockedConfirmedAmount    uint64 `json:"lockedConfirmedAmount"`
	AvailableAmount          uint64 `json:"availableAmount"`
	AvailableConfirmedAmount uint64 `json:"availableConfirmedAmount"`
}

Balance represents wallet balance

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error represents HTTP response embedded error

type FeeLevel

type FeeLevel struct {
	Level     string `json:"level"`
	FeePerKb  uint   `json:"feePerKb"`
	NumBlocks uint   `json:"nbBlocks"`
}

FeeLevel represents network-specific fee level

type FiatRate

type FiatRate struct {
	Timestamp *int    `json:"ts"`
	FetchedOn int     `json:"fetchedOn"`
	Rate      float64 `json:"rate"`
}

FiatRate represents currency exchange rate

type MaxInfo

type MaxInfo struct {
	Amount             int64      `json:"amount"`
	Fee                int64      `json:"fee"`
	FeePerKB           uint       `json:"feePerKb"`
	Size               int        `json:"size"`
	Inputs             []*TxInput `json:"inputs"`
	UtxosBelowFee      uint       `json:"utxosBelowFee"`
	AmountBelowFee     int64      `json:"amountBelowFee"`
	UtxosAboveMaxSize  uint       `json:"utxosAboveMaxSize"`
	AmountAboveMaxSize int64      `json:"amountAboveMaxSize"`
}

MaxInfo represents send maximum information

type Notification

type Notification struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"`
	Version   string                 `json:"version"`
	Data      map[string]interface{} `json:"data"`
	CreatedOn int                    `json:"createdOn"`
	CreatorID *string                `json:"creatorId"`
	WalletID  string                 `json:"walletId"`
}

Notification represents... well, notification

type Preferences

type Preferences struct {
	Version   string `json:"version"`
	CreatedOn uint   `json:"createdOn"`
	WalletID  string `json:"walletId"`
	CopayerID string `json:"copayerId"`
	Email     string `json:"email"`
	Language  string `json:"language"`
	Unit      string `json:"unit"`
}

Preferences represent user preferences

type Transaction

type Transaction struct {
	TxID                 string      `json:"txid"`
	BlockHeight          uint64      `json:"blockheight"`
	ProposalID           string      `json:"proposalId"`
	CreatedOn            uint        `json:"createdOn"`
	CreatorName          string      `json:"creatorName"`
	Action               string      `json:"action"`
	Actions              []*Action   `json:"actions"`
	Amount               int64       `json:"amount"`
	AddressTo            string      `json:"addressTo"`
	Fees                 int64       `json:"fees"`
	Time                 uint        `json:"time"`
	Confirmations        uint        `json:"confirmations"`
	FeePerKB             uint        `json:"feePerKb"`
	Outputs              []*TxOutput `json:"outputs"`
	HasUnconfirmedInputs bool        `json:"hasUnconfirmedInputs"`
	LowFees              bool        `json:"lowFees"`
}

Transaction represents transaction from history

type TxAction

type TxAction struct {
	Version     string   `jsons:"version"`
	CreatedOn   uint     `json:"createdOn"`
	Type        string   `json:"type"`
	CopayerID   string   `json:"copayerId"`
	Signatures  []string `json:"signatures"`
	XPub        string   `json:"xPub"`
	CopayerName string   `json:"copayerName"`
	Comment     string   `json:"comment"`
}

TxAction represents transcation proposal actions

type TxInput

type TxInput struct {
	TxID          string   `json:"txid"`
	Vout          uint32   `json:"vout"`
	Address       string   `json:"address"`
	ScriptPubKey  string   `json:"scriptPubKey"`
	Satoshis      int64    `json:"satoshis"`
	Confirmations uint     `json:"confirmations"`
	Locked        bool     `json:"locked"`
	Path          string   `json:"path"`
	PublicKeys    []string `json:"publicKeys"`
}

TxInput represents transaction input

type TxOutput

type TxOutput struct {
	Amount    int64   `json:"amount"`
	Address   string  `json:"address,omitempty"` // For received transactions
	ToAddress string  `json:"toAddress"`
	Message   *string `json:"message"`
}

TxOutput represents transaction output

func NewTxOutput

func NewTxOutput(amount int64, toAddress string) *TxOutput

NewTxOutput creates new tx output without a message

func NewTxOutputSingle

func NewTxOutputSingle(amount int64, toAddress string) []*TxOutput

NewTxOutputSingle creates tx output list with a single output

type TxProposal

type TxProposal struct {
	ID                      string      `json:"id"`
	TxID                    string      `json:"txId"`
	WalletID                string      `json:"walletId"`
	CreatorID               string      `json:"creatorId"`
	Version                 int32       `json:"version"`
	CreatedOn               uint        `json:"createdOn"`
	BroadcastedOn           uint        `json:"broadcastedOn"`
	Coin                    string      `json:"coin"`
	Network                 string      `json:"network"`
	Message                 *string     `json:"message"`
	PayProURL               *string     `json:"payProUrl"`
	WalletM                 int         `json:"walletM"`
	WalletN                 int         `json:"walletN"`
	RequiredSignatures      uint        `json:"requiredSignatures"`
	RequiredRejections      uint        `json:"requiredRejections"`
	Status                  string      `json:"status"`
	FeeLevel                string      `json:"feeLevel"`
	FeePerKB                uint        `json:"feePerKb"`
	ExcludeUnconfirmedUtxos bool        `json:"excludeUnconfrimedUtxos"`
	AddressType             string      `json:"addressType"`
	Amount                  int64       `json:"amount"`
	Fee                     int64       `json:"fee"`
	CreatorName             string      `json:"creatorName"`
	HasUnconfirmedInputs    bool        `json:"hasUnconfirmedInputs"`
	InputPaths              []string    `json:"inputPaths"`
	OutputOrder             []int       `json:"outputOrder"`
	ChangeAddress           *Address    `json:"changeAddress"`
	Inputs                  []*TxInput  `json:"inputs"`
	Outputs                 []*TxOutput `json:"outputs"`
	Actions                 []*TxAction `json:"actions"`
	// contains filtered or unexported fields
}

TxProposal represents transaction proposal

func (*TxProposal) AddInputs

func (txp *TxProposal) AddInputs(tx *wire.MsgTx, net *chaincfg.Params) (int64, error)

func (*TxProposal) AddMultisigInputs

func (txp *TxProposal) AddMultisigInputs(tx *wire.MsgTx, net *chaincfg.Params) (int64, error)

func (*TxProposal) BuildRedeemScript

func (txp *TxProposal) BuildRedeemScript(input *TxInput, net *chaincfg.Params) ([]byte, error)

BuildRedeemScript builds multisig redeem script

func (*TxProposal) InputSignature

func (txp *TxProposal) InputSignature(privKey *btcec.PrivateKey, net *chaincfg.Params, idx int) ([]byte, error)

InputSignature signs transaction input

func (*TxProposal) ProposalSignature

func (txp *TxProposal) ProposalSignature(privKey *btcec.PrivateKey, net *chaincfg.Params) ([]byte, error)

ProposalSignature serializes transaction and signs with private key

func (*TxProposal) Serialize

func (txp *TxProposal) Serialize(net *chaincfg.Params) ([]byte, error)

Serialize returns raw transaction from proposal data

func (*TxProposal) ToTransaction

func (txp *TxProposal) ToTransaction(net *chaincfg.Params) (*wire.MsgTx, error)

ToTransaction converts tx proposal to btcd transaction type

func (*TxProposal) Validate

func (txp *TxProposal) Validate() error

Validate performs basic validation before serialization

type Version

type Version struct {
	ServiceVersion string `json:"serviceVersion"`
}

Version represents healthcheck response

type Wallet

type Wallet struct {
	ID                 string `json:"id"`
	Version            string `json:"version"`
	CreatedOn          uint   `json:"createdOn"`
	M                  uint   `json:"m"`
	N                  uint   `json:"n"`
	SingleAddress      bool   `json:"singleAddress"`
	Status             string `json:"status"`
	PubKey             string `json:"pubKey"`
	Coin               string `json:"coin"`
	Network            string `json:"network"`
	DerivationStrategy string `json:"derivationStrategy"`
	AddressType        string `json:"addressType"`
}

Wallet represents generic wallet data structure

type WalletCreate

type WalletCreate struct {
	WalletID string `json:"walletId"`
	Secret   string `json:"secret"`
}

WalletCreate represents wallet creation response

type WalletJoin

type WalletJoin struct {
	Wallet *Wallet `json:"wallet,omitempty"`
}

WalletJoin represents wallet status response

type WalletStatus

type WalletStatus struct {
	Wallet *Wallet `json:"wallet,omitempty"`
}

WalletStatus represents wallet status response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL