Documentation ¶
Index ¶
- Constants
- type Opts
- type PayProtocol
- func (proto *PayProtocol) PayForSelf(ctx context.Context, currencyID byte, toAddr string, resCh string, ...) error
- func (proto *PayProtocol) PayForSelfWithOffer(ctx context.Context, receivedOffer fcroffer.PayOffer, resCh string, ...) error
- func (p *PayProtocol) Receive(ctx context.Context, currencyID byte, originalAddr string) (*big.Int, error)
- func (p *PayProtocol) Shutdown()
Constants ¶
const ( DirectPayProtocol = "/fcr-calibr/paynet/pay/direct" ProxyPayProtocol = "/fcr-calibr/paynet/pay/proxy" ProtocolVersion = "/0.0.1" TempKey = "tempkey" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // The datastore path. Path string // The timeout for every network io operation. IOTimeout time.Duration // The timeout for every internal operation. OpTimeout time.Duration // The cleaning frequency. CleanFreq time.Duration // The cleaning timeout (for locking). CleanTimeout time.Duration }
Opts is the options for paych protocol.
type PayProtocol ¶
type PayProtocol struct {
// contains filtered or unexported fields
}
PayProtocol manages payment protocol. It handles payment.
func NewPayProtocol ¶
func NewPayProtocol( ctx context.Context, h host.Host, addrProto *addrproto.AddrProtocol, signer crypto.Signer, peerMgr peermgr.PeerManager, payMgr paymgr.PaymentManager, opts Opts, ) (*PayProtocol, error)
NewPayProtocol creates a new payment protocol.
@input - context, host, addr protocol, signer, peer manager, payment manager, options.
@output - payment protocol, error.
func (*PayProtocol) PayForSelf ¶
func (proto *PayProtocol) PayForSelf(ctx context.Context, currencyID byte, toAddr string, resCh string, resID uint64, pettyAmtRequired *big.Int) error
PayForSelf does a payment for self.
@input - context, currency id, recipient address, reserved channel, reserved id, petty amount required.
@output - error.
func (*PayProtocol) PayForSelfWithOffer ¶
func (proto *PayProtocol) PayForSelfWithOffer(ctx context.Context, receivedOffer fcroffer.PayOffer, resCh string, resID uint64, pettyAmtRequired *big.Int) error
PayForSelfWithOffer does a payment for self with offer.
@input - context, received offer, reserved channel, reserved id, petty amount required.
func (*PayProtocol) Receive ¶
func (p *PayProtocol) Receive(ctx context.Context, currencyID byte, originalAddr string) (*big.Int, error)
Receive receives amount for given peer.
@input - context, currency id, original address.
@output - amount received, error.
func (*PayProtocol) Shutdown ¶
func (p *PayProtocol) Shutdown()
Shutdown safely shuts down the component.