Documentation ¶
Index ¶
- Constants
- Variables
- type Receiver
- func (r *Receiver) Close(req *models.CloseRequest) (*models.CloseResponse, error)
- func (r *Receiver) CloseMined() error
- func (r *Receiver) Create(req *models.CreateRequest) (*models.CreateResponse, error)
- func (r *Receiver) Open(txout *wire.TxOut, req *models.OpenRequest) (*models.OpenResponse, error)
- func (r *Receiver) Send(amount int64, req *models.SendRequest) (*models.SendResponse, error)
- func (r *Receiver) Status(req *models.StatusRequest) (*models.StatusResponse, error)
- func (r *Receiver) Validate(amount int64, payment []byte) (bool, error)
- type ReceiverConfig
- type Sender
- func (s *Sender) CloseMined() error
- func (s *Sender) GetCloseRequest() (*models.CloseRequest, error)
- func (s *Sender) GetCreateRequest(outputAddr string) (*models.CreateRequest, error)
- func (s *Sender) GetOpenRequest(txid string, vout uint32, amount int64) (*models.OpenRequest, error)
- func (s *Sender) GetSendRequest(amount int64, payment []byte) (*models.SendRequest, error)
- func (s *Sender) GotCloseResponse(resp *models.CloseResponse) error
- func (s *Sender) GotCreateResponse(resp *models.CreateResponse) error
- func (s *Sender) GotOpenResponse(resp *models.OpenResponse) error
- func (s *Sender) GotSendResponse(amount int64, payment []byte, resp *models.SendResponse) error
- func (s *Sender) Refund() ([]byte, error)
- type SenderConfig
- type SharedState
- func (s *SharedState) GetClosureTx(balance int64, hash [32]byte) (*wire.MsgTx, error)
- func (s *SharedState) GetClosureTxSigned(balance int64, hash [32]byte, senderSig []byte, privKey *btcec.PrivateKey) ([]byte, error)
- func (s *SharedState) GetFundingScript() ([]byte, string, error)
- func (ss *SharedState) GetNet() (*chaincfg.Params, error)
- func (s *SharedState) GetRefundTxSigned(privKey *btcec.PrivateKey) ([]byte, error)
- func (ss *SharedState) ReceiverAddressPubKey() (*btcutil.AddressPubKey, error)
- func (ss *SharedState) SenderAddressPubKey() (*btcutil.AddressPubKey, error)
- type Status
Constants ¶
View Source
const ( StatusCreated = 1 StatusOpen = 2 StatusClosing = 3 StatusClosed = 4 )
View Source
const ( NetMain = "mainnet" NetTestnet3 = "testnet3" )
View Source
const (
Version = 1
)
Variables ¶
View Source
var DefaultReceiverConfig = ReceiverConfig{ Net: NetTestnet3, Timeout: 1008, FeeRate: 300, }
View Source
var DefaultSenderConfig = SenderConfig{ Net: NetTestnet3, MinTimeout: 144, MaxTimeout: 1008, MinFeeRate: 10, MaxFeeRate: 300, }
View Source
var ErrAmountTooSmall = errors.New("amount is too small")
View Source
var ErrInsufficientCapacity = errors.New("amount exceeds channel capacity")
View Source
var ErrInvalidAddress = errors.New("invalid address")
View Source
var ErrNotStatusClosing = errors.New("channel is not in state closing")
View Source
var ErrNotStatusCreated = errors.New("channel is not in state created")
View Source
var ErrNotStatusOpen = errors.New("channel is not in state open")
Functions ¶
This section is empty.
Types ¶
type Receiver ¶
type Receiver struct { State SharedState // contains filtered or unexported fields }
func LoadReceiver ¶
func LoadReceiver(c ReceiverConfig, state SharedState, privKey *btcec.PrivateKey) (*Receiver, error)
func NewReceiver ¶
func NewReceiver(c ReceiverConfig, receiverOutput string, privKey *btcec.PrivateKey) (*Receiver, error)
func (*Receiver) Close ¶
func (r *Receiver) Close(req *models.CloseRequest) (*models.CloseResponse, error)
func (*Receiver) CloseMined ¶
func (*Receiver) Create ¶
func (r *Receiver) Create(req *models.CreateRequest) (*models.CreateResponse, error)
func (*Receiver) Open ¶
func (r *Receiver) Open(txout *wire.TxOut, req *models.OpenRequest) (*models.OpenResponse, error)
TODO: add nconf param and validate according to config
func (*Receiver) Send ¶
func (r *Receiver) Send(amount int64, req *models.SendRequest) (*models.SendResponse, error)
func (*Receiver) Status ¶
func (r *Receiver) Status(req *models.StatusRequest) (*models.StatusResponse, error)
type ReceiverConfig ¶
type Sender ¶
type Sender struct { State SharedState // contains filtered or unexported fields }
func LoadSender ¶
func LoadSender(c SenderConfig, state SharedState, privKey *btcec.PrivateKey) (*Sender, error)
func NewSender ¶
func NewSender(c SenderConfig, privKey *btcec.PrivateKey) (*Sender, error)
func (*Sender) CloseMined ¶
func (*Sender) GetCloseRequest ¶
func (s *Sender) GetCloseRequest() (*models.CloseRequest, error)
func (*Sender) GetCreateRequest ¶
func (s *Sender) GetCreateRequest(outputAddr string) (*models.CreateRequest, error)
func (*Sender) GetOpenRequest ¶
func (*Sender) GetSendRequest ¶
func (*Sender) GotCloseResponse ¶
func (s *Sender) GotCloseResponse(resp *models.CloseResponse) error
func (*Sender) GotCreateResponse ¶
func (s *Sender) GotCreateResponse(resp *models.CreateResponse) error
func (*Sender) GotOpenResponse ¶
func (s *Sender) GotOpenResponse(resp *models.OpenResponse) error
func (*Sender) GotSendResponse ¶
type SenderConfig ¶
type SharedState ¶
type SharedState struct {}
func (*SharedState) GetClosureTx ¶
func (*SharedState) GetClosureTxSigned ¶
func (s *SharedState) GetClosureTxSigned(balance int64, hash [32]byte, senderSig []byte, privKey *btcec.PrivateKey) ([]byte, error)
func (*SharedState) GetFundingScript ¶
func (s *SharedState) GetFundingScript() ([]byte, string, error)
func (*SharedState) GetRefundTxSigned ¶
func (s *SharedState) GetRefundTxSigned(privKey *btcec.PrivateKey) ([]byte, error)
func (*SharedState) ReceiverAddressPubKey ¶
func (ss *SharedState) ReceiverAddressPubKey() (*btcutil.AddressPubKey, error)
func (*SharedState) SenderAddressPubKey ¶
func (ss *SharedState) SenderAddressPubKey() (*btcutil.AddressPubKey, error)
Click to show internal directories.
Click to hide internal directories.