Documentation ¶
Index ¶
- Constants
- Variables
- type Blockchain
- func (bc *Blockchain) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
- func (bc *Blockchain) EstimateGas(msg ethereum.CallMsg) (uint64, error)
- func (bc *Blockchain) GetAccountantFee(accountantAddress common.Address) (uint16, error)
- func (bc *Blockchain) GetAccountantOperator(accountantID common.Address) (common.Address, error)
- func (bc *Blockchain) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
- func (bc *Blockchain) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
- func (bc *Blockchain) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
- func (bc *Blockchain) GetMystBalance(mystAddress, identity common.Address) (*big.Int, error)
- func (bc *Blockchain) GetProviderChannel(accountantAddress common.Address, addressToCheck common.Address) (ProviderChannel, error)
- func (bc *Blockchain) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
- func (bc *Blockchain) GetRegistrationFee(registryAddress common.Address) (*big.Int, error)
- func (bc *Blockchain) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
- func (bc *Blockchain) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
- func (bc *Blockchain) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
- func (bc *Blockchain) NetworkID() (*big.Int, error)
- func (bc *Blockchain) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
- func (bc *Blockchain) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
- func (bc *Blockchain) SettlePromise(req SettleRequest) (*types.Transaction, error)
- func (bc *Blockchain) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (sink chan *bindings.AccountantImplementationChannelOpened, cancel func(), ...)
- func (bc *Blockchain) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
- func (bc *Blockchain) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)
- func (bc *Blockchain) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)
- func (bc *Blockchain) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
- func (bc *Blockchain) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), ...)
- func (bc *Blockchain) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), ...)
- func (bc *Blockchain) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (sink chan *bindings.AccountantImplementationChannelBalanceUpdated, ...)
- func (bc *Blockchain) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
- type BlockchainWithRetries
- func (bwr *BlockchainWithRetries) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
- func (bwr *BlockchainWithRetries) EstimateGas(msg ethereum.CallMsg) (uint64, error)
- func (bwr *BlockchainWithRetries) GetAccountantFee(accountantAddress common.Address) (uint16, error)
- func (bwr *BlockchainWithRetries) GetAccountantOperator(accountantID common.Address) (common.Address, error)
- func (bwr *BlockchainWithRetries) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
- func (bwr *BlockchainWithRetries) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
- func (bwr *BlockchainWithRetries) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
- func (bwr *BlockchainWithRetries) GetMystBalance(mystSCAddress, channel common.Address) (*big.Int, error)
- func (bwr *BlockchainWithRetries) GetProviderChannel(accountantAddress, addressToCheck common.Address) (ProviderChannel, error)
- func (bwr *BlockchainWithRetries) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
- func (bwr *BlockchainWithRetries) GetRegistrationFee(registryAddress common.Address) (*big.Int, error)
- func (bwr *BlockchainWithRetries) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
- func (bwr *BlockchainWithRetries) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
- func (bwr *BlockchainWithRetries) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
- func (bwr *BlockchainWithRetries) NetworkID() (*big.Int, error)
- func (bwr *BlockchainWithRetries) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
- func (bwr *BlockchainWithRetries) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
- func (bwr *BlockchainWithRetries) SettlePromise(req SettleRequest) (*types.Transaction, error)
- func (bwr *BlockchainWithRetries) Stop()
- func (bwr *BlockchainWithRetries) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (chan *bindings.AccountantImplementationChannelOpened, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (chan *bindings.MystTokenTransfer, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (chan *bindings.RegistryRegisteredIdentity, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (chan *bindings.AccountantImplementationPromiseSettled, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (chan *bindings.AccountantImplementationPromiseSettled, func(), error)
- func (bwr *BlockchainWithRetries) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (chan *bindings.AccountantImplementationChannelBalanceUpdated, func(), error)
- func (bwr *BlockchainWithRetries) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
- type ConsumerChannel
- type ConsumersAccountant
- type NonceTracker
- type ProviderChannel
- type ReconnectableEthClient
- type RegistrationRequest
- type SettleAndRebalanceRequest
- type SettleRequest
- type TransferRequest
- type TxWatcher
- type WatchableTransaction
- type WithDryRuns
- func (cwdr *WithDryRuns) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
- func (cwdr *WithDryRuns) GetAccountantFee(accountantAddress common.Address) (uint16, error)
- func (cwdr *WithDryRuns) GetAccountantOperator(accountantID common.Address) (common.Address, error)
- func (cwdr *WithDryRuns) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
- func (cwdr *WithDryRuns) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
- func (cwdr *WithDryRuns) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
- func (cwdr *WithDryRuns) GetMystBalance(mystSCAddress, address common.Address) (*big.Int, error)
- func (cwdr *WithDryRuns) GetProviderChannel(accountantAddress common.Address, addressToCheck common.Address) (ProviderChannel, error)
- func (cwdr *WithDryRuns) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
- func (cwdr *WithDryRuns) GetRegistrationFee(registryAddress common.Address) (*big.Int, error)
- func (cwdr *WithDryRuns) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
- func (cwdr *WithDryRuns) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
- func (cwdr *WithDryRuns) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
- func (cwdr *WithDryRuns) NetworkID() (*big.Int, error)
- func (cwdr *WithDryRuns) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
- func (cwdr *WithDryRuns) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
- func (cwdr *WithDryRuns) SettlePromise(req SettleRequest) (*types.Transaction, error)
- func (cwdr *WithDryRuns) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (sink chan *bindings.AccountantImplementationChannelOpened, cancel func(), ...)
- func (cwdr *WithDryRuns) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
- func (cwdr *WithDryRuns) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)
- func (cwdr *WithDryRuns) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)
- func (cwdr *WithDryRuns) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
- func (cwdr *WithDryRuns) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), ...)
- func (cwdr *WithDryRuns) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), ...)
- func (cwdr *WithDryRuns) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (sink chan *bindings.AccountantImplementationChannelBalanceUpdated, ...)
- func (cwdr *WithDryRuns) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
- type WriteRequest
Constants ¶
const DefaultBackoff = time.Second * 3
DefaultBackoff is the default backoff for the client
Variables ¶
var ErrStopped = errors.New("call stopped")
ErrStopped represents an error when a call is interrupted
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain contains all the useful blockchain utilities for the payment off chain messaging
func NewBlockchain ¶
func NewBlockchain(ethClient ethClientGetter, timeout time.Duration) *Blockchain
NewBlockchain returns a new instance of blockchain
func NewBlockchainWithCustomNonceTracker ¶
func NewBlockchainWithCustomNonceTracker(ethClient ethClientGetter, timeout time.Duration, nonceFunc nonceFunc) *Blockchain
NewBlockchainWithCustomNonceTracker returns a new instance of blockchain with the provided nonce tracking func
func (*Blockchain) CalculateAccountantFee ¶
func (bc *Blockchain) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
CalculateAccountantFee calls blockchain for calculation of accountant fee
func (*Blockchain) EstimateGas ¶
func (bc *Blockchain) EstimateGas(msg ethereum.CallMsg) (uint64, error)
EstimateGas exposes the clients internal estimate gas
func (*Blockchain) GetAccountantFee ¶
func (bc *Blockchain) GetAccountantFee(accountantAddress common.Address) (uint16, error)
GetAccountantFee fetches the accountant fee from blockchain
func (*Blockchain) GetAccountantOperator ¶
GetAccountantOperator returns operator address of given accountant
func (*Blockchain) GetConsumerChannel ¶
func (bc *Blockchain) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
GetConsumerChannel returns the consumer channel
func (*Blockchain) GetConsumerChannelOperator ¶
func (bc *Blockchain) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
GetConsumerChannelOperator returns the consumer channel operator/identity
func (*Blockchain) GetConsumerChannelsAccountant ¶
func (bc *Blockchain) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
GetConsumerChannelsAccountant returns the consumer channels accountant
func (*Blockchain) GetMystBalance ¶
GetMystBalance returns myst balance
func (*Blockchain) GetProviderChannel ¶
func (bc *Blockchain) GetProviderChannel(accountantAddress common.Address, addressToCheck common.Address) (ProviderChannel, error)
GetProviderChannel returns the provider channel
func (*Blockchain) GetProviderChannelByID ¶
func (bc *Blockchain) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
GetProviderChannelByID returns the given provider channel information
func (*Blockchain) GetRegistrationFee ¶
GetRegistrationFee returns fee required by registry
func (*Blockchain) IsAccountantRegistered ¶
func (bc *Blockchain) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
IsAccountantRegistered checks if given accountant is registered and returns true or false.
func (*Blockchain) IsRegistered ¶
func (bc *Blockchain) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
IsRegistered checks wether the given identity is registered or not
func (*Blockchain) IsRegisteredAsProvider ¶
func (bc *Blockchain) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
IsRegisteredAsProvider checks if the provider is registered with the accountant properly
func (*Blockchain) NetworkID ¶
func (bc *Blockchain) NetworkID() (*big.Int, error)
NetworkID returns the network id
func (*Blockchain) RegisterIdentity ¶
func (bc *Blockchain) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
RegisterIdentity registers the given identity on blockchain
func (*Blockchain) SettleAndRebalance ¶
func (bc *Blockchain) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
SettleAndRebalance is settling given accountant issued promise
func (*Blockchain) SettlePromise ¶
func (bc *Blockchain) SettlePromise(req SettleRequest) (*types.Transaction, error)
SettlePromise is settling the given consumer issued promise
func (*Blockchain) SubscribeToChannelOpenedEvents ¶
func (bc *Blockchain) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (sink chan *bindings.AccountantImplementationChannelOpened, cancel func(), err error)
SubscribeToChannelOpenedEvents subscribes to provider channel opened events
func (*Blockchain) SubscribeToConsumerBalanceEvent ¶
func (bc *Blockchain) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToConsumerBalanceEvent subscribes to balance change events in blockchain
func (*Blockchain) SubscribeToConsumerChannelBalanceUpdate ¶
func (bc *Blockchain) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)
SubscribeToConsumerChannelBalanceUpdate subscribes to consumer channel balance update events
func (*Blockchain) SubscribeToIdentityRegistrationEvents ¶
func (bc *Blockchain) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)
SubscribeToIdentityRegistrationEvents subscribes to identity registration events
func (*Blockchain) SubscribeToMystTokenTransfers ¶
func (bc *Blockchain) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToMystTokenTransfers subscribes to myst token transfers
func (*Blockchain) SubscribeToPromiseSettledEvent ¶
func (bc *Blockchain) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), err error)
SubscribeToPromiseSettledEvent subscribes to promise settled events
func (*Blockchain) SubscribeToPromiseSettledEventByChannelID ¶
func (bc *Blockchain) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), err error)
SubscribeToPromiseSettledEventByChannelID subscribes to promise settled events
func (*Blockchain) SubscribeToProviderChannelBalanceUpdate ¶
func (bc *Blockchain) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (sink chan *bindings.AccountantImplementationChannelBalanceUpdated, cancel func(), err error)
SubscribeToProviderChannelBalanceUpdate subscribes to provider channel balance update events
func (*Blockchain) TransferMyst ¶
func (bc *Blockchain) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
TransferMyst transfers myst
type BlockchainWithRetries ¶
type BlockchainWithRetries struct {
// contains filtered or unexported fields
}
BlockchainWithRetries takes in the plain blockchain implementation and exposes methods that will retry the underlying bc methods before giving up. This is required as the ethereum client will occasionally spit a TLS error if running for prolonged periods of time.
func NewBlockchainWithRetries ¶
func NewBlockchainWithRetries(bc blockchain, delay time.Duration, maxRetries int) *BlockchainWithRetries
NewBlockchainWithRetries returns a new instance of blockchain with retries
func (*BlockchainWithRetries) CalculateAccountantFee ¶
func (bwr *BlockchainWithRetries) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
CalculateAccountantFee fetches the accountant fee from blockchain
func (*BlockchainWithRetries) EstimateGas ¶
func (bwr *BlockchainWithRetries) EstimateGas(msg ethereum.CallMsg) (uint64, error)
EstimateGas proxies the estimate gas call to the underlying blockchain since no network calls are performed.
func (*BlockchainWithRetries) GetAccountantFee ¶
func (bwr *BlockchainWithRetries) GetAccountantFee(accountantAddress common.Address) (uint16, error)
GetAccountantFee fetches the accountant fee from blockchain
func (*BlockchainWithRetries) GetAccountantOperator ¶
func (bwr *BlockchainWithRetries) GetAccountantOperator(accountantID common.Address) (common.Address, error)
GetAccountantOperator returns operator address of given accountant
func (*BlockchainWithRetries) GetConsumerChannel ¶
func (bwr *BlockchainWithRetries) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
GetConsumerChannel returns the consumer channel
func (*BlockchainWithRetries) GetConsumerChannelOperator ¶
func (bwr *BlockchainWithRetries) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
GetConsumerChannelOperator returns the consumer channel operator/identity
func (*BlockchainWithRetries) GetConsumerChannelsAccountant ¶
func (bwr *BlockchainWithRetries) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
GetConsumerChannelsAccountant returns the consumer channels accountant
func (*BlockchainWithRetries) GetMystBalance ¶
func (bwr *BlockchainWithRetries) GetMystBalance(mystSCAddress, channel common.Address) (*big.Int, error)
GetMystBalance returns the balance in myst
func (*BlockchainWithRetries) GetProviderChannel ¶
func (bwr *BlockchainWithRetries) GetProviderChannel(accountantAddress, addressToCheck common.Address) (ProviderChannel, error)
GetProviderChannel returns the provider channel
func (*BlockchainWithRetries) GetProviderChannelByID ¶
func (bwr *BlockchainWithRetries) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
GetProviderChannelByID returns the given channel information
func (*BlockchainWithRetries) GetRegistrationFee ¶
func (bwr *BlockchainWithRetries) GetRegistrationFee(registryAddress common.Address) (*big.Int, error)
GetRegistrationFee returns the registration fee
func (*BlockchainWithRetries) IsAccountantRegistered ¶
func (bwr *BlockchainWithRetries) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
IsAccountantRegistered checks if given accountant is registered and returns true or false.
func (*BlockchainWithRetries) IsRegistered ¶
func (bwr *BlockchainWithRetries) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
IsRegistered checks wether the given identity is registered or not
func (*BlockchainWithRetries) IsRegisteredAsProvider ¶
func (bwr *BlockchainWithRetries) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
IsRegisteredAsProvider checks if the provider is registered with the accountant properly
func (*BlockchainWithRetries) NetworkID ¶
func (bwr *BlockchainWithRetries) NetworkID() (*big.Int, error)
NetworkID returns the network id
func (*BlockchainWithRetries) RegisterIdentity ¶
func (bwr *BlockchainWithRetries) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
RegisterIdentity registers the given identity on blockchain
func (*BlockchainWithRetries) SettleAndRebalance ¶
func (bwr *BlockchainWithRetries) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
SettleAndRebalance is settling given accountant issued promise
func (*BlockchainWithRetries) SettlePromise ¶
func (bwr *BlockchainWithRetries) SettlePromise(req SettleRequest) (*types.Transaction, error)
SettlePromise is settling the given consumer issued promise
func (*BlockchainWithRetries) Stop ¶
func (bwr *BlockchainWithRetries) Stop()
Stop stops the blockhain with retries aborting any waits for retries
func (*BlockchainWithRetries) SubscribeToChannelOpenedEvents ¶
func (bwr *BlockchainWithRetries) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (chan *bindings.AccountantImplementationChannelOpened, func(), error)
SubscribeToChannelOpenedEvents subscribes to provider channel opened events
func (*BlockchainWithRetries) SubscribeToConsumerBalanceEvent ¶
func (bwr *BlockchainWithRetries) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToConsumerBalanceEvent subscribes to the consumer balance change events
func (*BlockchainWithRetries) SubscribeToConsumerChannelBalanceUpdate ¶
func (bwr *BlockchainWithRetries) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToConsumerChannelBalanceUpdate subscribes to consumer channel balance update events
func (*BlockchainWithRetries) SubscribeToIdentityRegistrationEvents ¶
func (bwr *BlockchainWithRetries) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (chan *bindings.RegistryRegisteredIdentity, func(), error)
SubscribeToIdentityRegistrationEvents subscribes to identity registration events
func (*BlockchainWithRetries) SubscribeToMystTokenTransfers ¶
func (bwr *BlockchainWithRetries) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToMystTokenTransfers subscribes to myst token transfer events
func (*BlockchainWithRetries) SubscribeToPromiseSettledEvent ¶
func (bwr *BlockchainWithRetries) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (chan *bindings.AccountantImplementationPromiseSettled, func(), error)
SubscribeToPromiseSettledEvent subscribes to promise settled events
func (*BlockchainWithRetries) SubscribeToPromiseSettledEventByChannelID ¶
func (bwr *BlockchainWithRetries) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (chan *bindings.AccountantImplementationPromiseSettled, func(), error)
SubscribeToPromiseSettledEventByChannelID subscribes to promise settled events
func (*BlockchainWithRetries) SubscribeToProviderChannelBalanceUpdate ¶
func (bwr *BlockchainWithRetries) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (chan *bindings.AccountantImplementationChannelBalanceUpdated, func(), error)
SubscribeToProviderChannelBalanceUpdate subscribes to provider channel balance update events
func (*BlockchainWithRetries) TransferMyst ¶
func (bwr *BlockchainWithRetries) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
TransferMyst transfers myst to the provided address
type ConsumerChannel ¶
ConsumerChannel represents the consumer channel
type ConsumersAccountant ¶
type ConsumersAccountant struct { Operator common.Address ContractAddress common.Address Settled *big.Int }
ConsumersAccountant represents the consumers accountant
type NonceTracker ¶
type NonceTracker struct {
// contains filtered or unexported fields
}
NonceTracker keeps track of nonces atomically.
func NewNonceTracker ¶
func NewNonceTracker(client *ethclient.Client) *NonceTracker
NewNonceTracker returns a new nonce tracker.
func (*NonceTracker) ForceReloadNonce ¶
func (nt *NonceTracker) ForceReloadNonce(account common.Address)
ForceReloadNonce clears the nonce cache. This will force loading from BC next time.
type ProviderChannel ¶
type ProviderChannel struct { Beneficiary common.Address Balance *big.Int Settled *big.Int Loan *big.Int LastUsedNonce *big.Int Timelock *big.Int }
ProviderChannel represents the provider channel
type ReconnectableEthClient ¶
type ReconnectableEthClient struct {
// contains filtered or unexported fields
}
ReconnectableEthClient is a ethereum client that can reconnect.
func NewReconnectableEthClient ¶
func NewReconnectableEthClient(address string) (*ReconnectableEthClient, error)
NewReconnectableEthClient creates new ethereum client that can reconnect.
func (*ReconnectableEthClient) Client ¶
func (c *ReconnectableEthClient) Client() *ethclient.Client
Client returns the currently connected ethereum client.
func (*ReconnectableEthClient) Reconnect ¶
func (c *ReconnectableEthClient) Reconnect() error
Reconnect creates new ethereum client and replaces the current one.
type RegistrationRequest ¶
type RegistrationRequest struct { WriteRequest AccountantID common.Address Loan *big.Int TransactorFee *big.Int Beneficiary common.Address Signature []byte RegistryAddress common.Address Nonce *big.Int }
RegistrationRequest contains all the parameters for the registration request
type SettleAndRebalanceRequest ¶
type SettleAndRebalanceRequest struct { WriteRequest AccountantID common.Address Promise crypto.Promise }
SettleAndRebalanceRequest represents all the parameters required for settle and rebalance
type SettleRequest ¶
type SettleRequest struct { WriteRequest ChannelID common.Address Promise crypto.Promise }
SettleRequest represents all the parameters required for settle
type TransferRequest ¶
type TransferRequest struct { MystAddress common.Address Recipient common.Address Amount *big.Int WriteRequest }
TransferRequest contains all the parameters for a transfer request
type TxWatcher ¶
type TxWatcher struct {
// contains filtered or unexported fields
}
TxWatcher makes sure that transactions actually get sent to the network. It retries for the given amount of times to send the TX, each time increasing the gas price by given percentage.
func NewTxWatcher ¶
func NewTxWatcher(client client, clientTimeout time.Duration, maxRetries int, waitBetweenRetries time.Duration, percentageIncrease float64) *TxWatcher
NewTxWatcher returns a new instance of tx watcher
func (*TxWatcher) EnsureTransactionSuccess ¶
func (tw *TxWatcher) EnsureTransactionSuccess(wt WatchableTransaction, initialGasPrice *big.Int) (*types.Transaction, func(), error)
EnsureTransactionSuccess keeps track of the transaction on blockchain. If it sees that the transaction has not appeared on BC, it will try again and increase the gas price.
type WatchableTransaction ¶
type WatchableTransaction func(gasPrice *big.Int) (*types.Transaction, error)
WatchableTransaction represents a transaction that the txwatcher can keep track of
type WithDryRuns ¶
type WithDryRuns struct {
// contains filtered or unexported fields
}
WithDryRuns forces a dry run before running a write transaction on blockchain. Ethereum client will perform a dry run on a transaction with no gas limit set. This component will perform a dry run if and only if the gas limit is set to a non zero value. In this way, the dry run is always performed before sending the transaction to the network. For convenience, this component proxies read only calls to the underlying blockchain.
func NewWithDryRuns ¶
func NewWithDryRuns(bc blockchain) *WithDryRuns
NewWithDryRuns creates a new instance of client with dry runs.
func (*WithDryRuns) CalculateAccountantFee ¶
func (cwdr *WithDryRuns) CalculateAccountantFee(accountantAddress common.Address, value uint64) (*big.Int, error)
CalculateAccountantFee fetches the accountant fee from blockchain
func (*WithDryRuns) GetAccountantFee ¶
func (cwdr *WithDryRuns) GetAccountantFee(accountantAddress common.Address) (uint16, error)
GetAccountantFee fetches the accountant fee from blockchain
func (*WithDryRuns) GetAccountantOperator ¶
GetAccountantOperator returns operator address of given accountant
func (*WithDryRuns) GetConsumerChannel ¶
func (cwdr *WithDryRuns) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
GetConsumerChannel returns the consumer channel
func (*WithDryRuns) GetConsumerChannelOperator ¶
func (cwdr *WithDryRuns) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
GetConsumerChannelOperator returns the consumer channel operator/identity
func (*WithDryRuns) GetConsumerChannelsAccountant ¶
func (cwdr *WithDryRuns) GetConsumerChannelsAccountant(channelAddress common.Address) (ConsumersAccountant, error)
GetConsumerChannelsAccountant returns the consumer channels accountant
func (*WithDryRuns) GetMystBalance ¶
GetMystBalance returns the balance in myst
func (*WithDryRuns) GetProviderChannel ¶
func (cwdr *WithDryRuns) GetProviderChannel(accountantAddress common.Address, addressToCheck common.Address) (ProviderChannel, error)
GetProviderChannel returns the provider channel
func (*WithDryRuns) GetProviderChannelByID ¶
func (cwdr *WithDryRuns) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
GetProviderChannelByID returns the given channel information
func (*WithDryRuns) GetRegistrationFee ¶
GetRegistrationFee returns the registration fee
func (*WithDryRuns) IsAccountantRegistered ¶
func (cwdr *WithDryRuns) IsAccountantRegistered(registryAddress, acccountantID common.Address) (bool, error)
IsAccountantRegistered checks if given accountant is registered and returns true or false.
func (*WithDryRuns) IsRegistered ¶
func (cwdr *WithDryRuns) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
IsRegistered checks wether the given identity is registered or not
func (*WithDryRuns) IsRegisteredAsProvider ¶
func (cwdr *WithDryRuns) IsRegisteredAsProvider(accountantAddress, registryAddress, addressToCheck common.Address) (bool, error)
IsRegisteredAsProvider checks if the provider is registered with the accountant properly
func (*WithDryRuns) NetworkID ¶
func (cwdr *WithDryRuns) NetworkID() (*big.Int, error)
NetworkID returns the network id
func (*WithDryRuns) RegisterIdentity ¶
func (cwdr *WithDryRuns) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
RegisterIdentity registers the given identity on blockchain
func (*WithDryRuns) SettleAndRebalance ¶
func (cwdr *WithDryRuns) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
SettleAndRebalance is settling given accountant issued promise
func (*WithDryRuns) SettlePromise ¶
func (cwdr *WithDryRuns) SettlePromise(req SettleRequest) (*types.Transaction, error)
SettlePromise is settling the given consumer issued promise
func (*WithDryRuns) SubscribeToChannelOpenedEvents ¶
func (cwdr *WithDryRuns) SubscribeToChannelOpenedEvents(accountantAddress common.Address) (sink chan *bindings.AccountantImplementationChannelOpened, cancel func(), err error)
SubscribeToChannelOpenedEvents subscribes to provider channel opened events
func (*WithDryRuns) SubscribeToConsumerBalanceEvent ¶
func (cwdr *WithDryRuns) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToConsumerBalanceEvent subscribes to the consumer balance change events
func (*WithDryRuns) SubscribeToConsumerChannelBalanceUpdate ¶
func (cwdr *WithDryRuns) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)
SubscribeToConsumerChannelBalanceUpdate subscribes to consumer channel balance update events
func (*WithDryRuns) SubscribeToIdentityRegistrationEvents ¶
func (cwdr *WithDryRuns) SubscribeToIdentityRegistrationEvents(registryAddress common.Address, accountantIDs []common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)
SubscribeToIdentityRegistrationEvents subscribes to identity registration events
func (*WithDryRuns) SubscribeToMystTokenTransfers ¶
func (cwdr *WithDryRuns) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
SubscribeToMystTokenTransfers subscribes to myst token transfers
func (*WithDryRuns) SubscribeToPromiseSettledEvent ¶
func (cwdr *WithDryRuns) SubscribeToPromiseSettledEvent(providerID, accountantID common.Address) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), err error)
SubscribeToPromiseSettledEvent subscribes to promise settled events
func (*WithDryRuns) SubscribeToPromiseSettledEventByChannelID ¶
func (cwdr *WithDryRuns) SubscribeToPromiseSettledEventByChannelID(accountantID common.Address, providerAddresses [][32]byte) (sink chan *bindings.AccountantImplementationPromiseSettled, cancel func(), err error)
SubscribeToPromiseSettledEventByChannelID subscribes to promise settled events
func (*WithDryRuns) SubscribeToProviderChannelBalanceUpdate ¶
func (cwdr *WithDryRuns) SubscribeToProviderChannelBalanceUpdate(accountantAddress common.Address, channelAddresses [][32]byte) (sink chan *bindings.AccountantImplementationChannelBalanceUpdated, cancel func(), err error)
SubscribeToProviderChannelBalanceUpdate subscribes to provider channel balance update events
func (*WithDryRuns) TransferMyst ¶
func (cwdr *WithDryRuns) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
TransferMyst transfers myst
type WriteRequest ¶
type WriteRequest struct { Identity common.Address Signer bind.SignerFn GasLimit uint64 GasPrice *big.Int }
WriteRequest contains the required params for a write request
func (WriteRequest) GetGasLimit ¶
func (wr WriteRequest) GetGasLimit() uint64
GetGasLimit returns the gas limit