Documentation ¶
Overview ¶
Package fcrlotusmgr - lotus manager handles the interaction with filecoin via lotus.
Package fcrlotusmgr - lotus manager handles the interaction with filecoin via lotus.
Index ¶
- func GenerateVoucher(privKey string, chAddr string, lane uint64, nonce uint64, newRedeemed *big.Int) (string, error)
- func Sign(pk []byte, msg []byte) ([]byte, error)
- func Verify(sig []byte, msg []byte) (string, error)
- func VerifyVoucher(voucher string) (string, string, uint64, uint64, *big.Int, error)
- type FCRLotusMgr
- type FCRLotusMgrImplV1
- func (mgr *FCRLotusMgrImplV1) CheckPaymentChannel(chAddr string) (bool, *big.Int, string, error)
- func (mgr *FCRLotusMgrImplV1) CollectPaymentChannel(privKey string, chAddr string) error
- func (mgr *FCRLotusMgrImplV1) CreatePaymentChannel(privKey string, recipientAddr string, amt *big.Int) (string, error)
- func (mgr *FCRLotusMgrImplV1) GetCostToCreate(privKey string, recipientAddr string, amt *big.Int) (*big.Int, error)
- func (mgr *FCRLotusMgrImplV1) GetCostToSettle(privKey string, chAddr string, vouchers []string) (*big.Int, error)
- func (mgr *FCRLotusMgrImplV1) GetPaymentChannelCreationBlock(chAddr string) (*big.Int, error)
- func (mgr *FCRLotusMgrImplV1) GetPaymentChannelSettlementBlock(chAddr string) (*big.Int, error)
- func (mgr *FCRLotusMgrImplV1) SettlePaymentChannel(privKey string, chAddr string, vouchers []string) error
- func (mgr *FCRLotusMgrImplV1) TopupPaymentChannel(privKey string, chAddr string, amt *big.Int) error
- type LotusAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateVoucher ¶
func GenerateVoucher(privKey string, chAddr string, lane uint64, nonce uint64, newRedeemed *big.Int) (string, error)
GenerateVoucher generates a voucher by given private key, channel address, lane number and amount.
Types ¶
type FCRLotusMgr ¶
type FCRLotusMgr interface { // CreatePaymentChannel creates a payment channel using the given private key, recipient address and a given amount. CreatePaymentChannel(privKey string, recipientAddr string, amt *big.Int) (string, error) // TopupPaymentChannel topups a payment channel using the given private key, channel address and a given amount. TopupPaymentChannel(privKey string, chAddr string, amt *big.Int) error // SettlePaymentChannel settles a payment channel using the given private key, channel address and a final voucher. SettlePaymentChannel(privKey string, chAddr string, vouchers []string) error // CollectPaymentChannel collects a payment channel using the given private key, channel address. CollectPaymentChannel(privKey string, chAddr string) error // CheckPaymentChannel checks the state of a channel. // It returns a boolean indicating if the channel is settling/settled, the channel balance, the recipient address and error. CheckPaymentChannel(chAddr string) (bool, *big.Int, string, error) // GetCostToCreate gets the current cost to create a payment channel. GetCostToCreate(privKey string, recipientAddr string, amt *big.Int) (*big.Int, error) // GetCostToSettle gets the current cost to settle a payment channel + updating voucher. GetCostToSettle(privKey string, chAddr string, vouchers []string) (*big.Int, error) // GetPaymentChannelCreationBlock gets the block number at which given payment channel is created. GetPaymentChannelCreationBlock(chAddr string) (*big.Int, error) // GetPaymentChannelSettlementBlock gets the block number at which given payment channel is called to settle. GetPaymentChannelSettlementBlock(chAddr string) (*big.Int, error) }
FCRLotusMgr represents the manager that interacts with the lotus.
func NewFCRLotusMgrImplV1 ¶
type FCRLotusMgrImplV1 ¶
type FCRLotusMgrImplV1 struct {
// contains filtered or unexported fields
}
func (*FCRLotusMgrImplV1) CheckPaymentChannel ¶
func (*FCRLotusMgrImplV1) CollectPaymentChannel ¶
func (mgr *FCRLotusMgrImplV1) CollectPaymentChannel(privKey string, chAddr string) error
func (*FCRLotusMgrImplV1) CreatePaymentChannel ¶
func (*FCRLotusMgrImplV1) GetCostToCreate ¶
func (*FCRLotusMgrImplV1) GetCostToSettle ¶
func (*FCRLotusMgrImplV1) GetPaymentChannelCreationBlock ¶
func (mgr *FCRLotusMgrImplV1) GetPaymentChannelCreationBlock(chAddr string) (*big.Int, error)
func (*FCRLotusMgrImplV1) GetPaymentChannelSettlementBlock ¶
func (mgr *FCRLotusMgrImplV1) GetPaymentChannelSettlementBlock(chAddr string) (*big.Int, error)
func (*FCRLotusMgrImplV1) SettlePaymentChannel ¶
func (mgr *FCRLotusMgrImplV1) SettlePaymentChannel(privKey string, chAddr string, vouchers []string) error
func (*FCRLotusMgrImplV1) TopupPaymentChannel ¶
type LotusAPI ¶
type LotusAPI interface { ChainReadObj(ctx context.Context, obj cid.Cid) ([]byte, error) GasEstimateFeeCap(ctx context.Context, msg *types.Message, maxqueueblks int64, tsk types.TipSetKey) (types.BigInt, error) GasEstimateGasLimit(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (int64, error) GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error) MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error) MpoolPush(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error) StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) StateGetReceipt(ctx context.Context, msg cid.Cid, tsk types.TipSetKey) (*types.MessageReceipt, error) }
LotusAPI is the minimum interface interacting with the Lotus to achieve payment function.
Click to show internal directories.
Click to hide internal directories.