Documentation ¶
Overview ¶
Package fcrpaymentmgr - provides common methods facilitate payment process for parties.
Methods like pay, receive payment, top up balance and verify payment.
Index ¶
- type FCRPaymentMgr
- func (mgr *FCRPaymentMgr) Pay(recipient string, lane uint64, amount *big.Int) (string, string, bool, error)
- func (mgr *FCRPaymentMgr) Receive(channel string, voucher string) (*big.Int, error)
- func (mgr *FCRPaymentMgr) Shutdown()
- func (mgr *FCRPaymentMgr) Topup(recipient string, amount *big.Int) error
- type SecpSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FCRPaymentMgr ¶
type FCRPaymentMgr struct {
// contains filtered or unexported fields
}
FCRPaymentMgr - payment manager, manages all payment related functions
func NewFCRPaymentMgr ¶
func NewFCRPaymentMgr(privateKey, lotusAPIAddr, authToken string) (*FCRPaymentMgr, error)
NewFCRPaymentMgr creates a new payment manager.
func (*FCRPaymentMgr) Pay ¶
func (mgr *FCRPaymentMgr) Pay(recipient string, lane uint64, amount *big.Int) (string, string, bool, error)
Pay will generate a voucher and pay the recipient a given amount. Return channel address, voucher, true if needs to top up, and error.
func (*FCRPaymentMgr) Receive ¶
Receive will receive a given voucher at a given payment channel and return the amount received. Amount of 1000000000000000000 means 1 coin received.
func (*FCRPaymentMgr) Shutdown ¶
func (mgr *FCRPaymentMgr) Shutdown()
Shutdown will safely shutdown the payment manager.
type SecpSigner ¶
type SecpSigner struct{}
SecpSigner is used to sign, and the following code is taken from lotus source code.
func (SecpSigner) GenPrivate ¶
func (SecpSigner) GenPrivate() ([]byte, error)
GenPrivate generates a private key
func (SecpSigner) Sign ¶
func (SecpSigner) Sign(pk []byte, msg []byte) ([]byte, error)
Sign signs the given msg using given private key