Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePrivateKey(encodedKey string) (*ecdsa.PrivateKey, error)
- func EncodePrivateKey(privateKeyBytes []byte) string
- func GetAccountAndSigner(accountString string, client *ethclient.Client) (*bind.TransactOpts, func(data []byte) ([]byte, error), error)
- func GetClient(url string) (*ethclient.Client, error)
- type PaymentChannel
- func (p *PaymentChannel) Available() (*big.Int, error)
- func (p *PaymentChannel) WithdrawIfOverMargin(transferAddress common.Address, amount *big.Int, tolerance *big.Int) (*types.Transaction, error)
- func (p *PaymentChannel) WithdrawUpTo(transferAddress common.Address, amount *big.Int) (*types.Transaction, error)
- func (p *PaymentChannel) Withdrawn() (*big.Int, error)
- type PaymentChannelValidator
Constants ¶
const PrivateKeySize = 256 / 8
Variables ¶
var DefaultKeystore = "~/.ethereum/keystore"
Functions ¶
func DecodePrivateKey ¶
func DecodePrivateKey(encodedKey string) (*ecdsa.PrivateKey, error)
func EncodePrivateKey ¶
func GetAccountAndSigner ¶
Types ¶
type PaymentChannel ¶
type PaymentChannel struct { Payment *abi.Payment TransactOpts *bind.TransactOpts Publisher common.Address PodID common.Hash PricingTable resource.PricingTableMap }
Manipulator encompassing some of the typical operations one can do with a payment channel
func (*PaymentChannel) Available ¶
func (p *PaymentChannel) Available() (*big.Int, error)
Get how much funds are still available in the channel
func (*PaymentChannel) WithdrawIfOverMargin ¶
func (p *PaymentChannel) WithdrawIfOverMargin(transferAddress common.Address, amount *big.Int, tolerance *big.Int) (*types.Transaction, error)
Withdraw the funds between Withdrawn() and amount; that is, withdraw amount - Withdrawn() -- but only if the amount that will be withdrawn in such a transaction is over the given tolerance. Useful to avoid spamming costly transactions that only net small amounts of income.
func (*PaymentChannel) WithdrawUpTo ¶
func (p *PaymentChannel) WithdrawUpTo(transferAddress common.Address, amount *big.Int) (*types.Transaction, error)
Withdraw the funds between Withdrawn() and amount; that is, withdraw amount - Withdrawn()
type PaymentChannelValidator ¶
A validator for payment channels which confirms they have sufficient funds and are established on a permissible contract before returning a PaymentChannel that can be used to interact with them.
func NewPaymentChannelValidator ¶
func NewPaymentChannelValidator(ethClient *ethclient.Client, pricingTables map[common.Address]resource.PricingTableMap, transactOpts *bind.TransactOpts) (*PaymentChannelValidator, error)
Create a new PaymentChannelValidator
func (*PaymentChannelValidator) Parse ¶
func (v *PaymentChannelValidator) Parse(channel *pb.PaymentChannel) (*PaymentChannel, error)
Parse/validate a pb.PaymentChannel to create a PaymentChannel