Documentation
¶
Index ¶
- Variables
- type AddressStorage
- type BeneficiaryStorage
- type ChangeStatus
- type Provider
- type Saver
- func (bcs Saver) CleanupAndGetChangeStatus(id identity.Identity, currentBeneficiary string) (*ChangeStatus, error)
- func (bcs Saver) GetChangeStatus(id identity.Identity) (*ChangeStatus, error)
- func (b *Saver) SettleAndSaveBeneficiary(id identity.Identity, hermeses []common.Address, beneficiary common.Address) error
- type SettleState
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidAddress = errors.New("invalid address") ErrNotFound = errors.New("beneficiary not found") )
ErrInvalidAddress represents invalid address error
Functions ¶
This section is empty.
Types ¶
type AddressStorage ¶
type AddressStorage struct {
// contains filtered or unexported fields
}
AddressStorage handles storing of beneficiary address
func NewAddressStorage ¶
func NewAddressStorage(storage localStorage) *AddressStorage
NewAddressStorage constructor
func (*AddressStorage) Address ¶
func (as *AddressStorage) Address(identity string) (string, error)
Address retrieve beneficiary address for identity
func (*AddressStorage) Save ¶
func (as *AddressStorage) Save(identity, address string) error
Save beneficiary address for identity
type BeneficiaryStorage ¶
type BeneficiaryStorage interface { Address(identity string) (string, error) Save(identity, address string) error }
BeneficiaryStorage handles storing of beneficiary address
type ChangeStatus ¶
type ChangeStatus struct { ChangeTo string State SettleState Error string }
ChangeStatus holds Beneficiary settlement transaction information
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider describes a beneficiary provider.
func NewProvider ¶
NewProvider returns a new beneficiary handler according to the given chain.
type Saver ¶
type Saver struct {
// contains filtered or unexported fields
}
Saver saves a given beneficiary and tracks its progress.
func NewSaver ¶
func NewSaver(currentChain int64, ad addressProvider, st storage, bc multiChainBC, set settler) *Saver
NewSaver returns a new beneficiary saver according to the given chain.
func (Saver) CleanupAndGetChangeStatus ¶
func (bcs Saver) CleanupAndGetChangeStatus(id identity.Identity, currentBeneficiary string) (*ChangeStatus, error)
CleanupAndGetChangeStatus cleans up current change status and returns it.
Cleanup is done using the provided currentBeneficiary, if the beneficiaries match and transaction is still in state "Pending" it will be bumped to completed, else nothing is done.
func (Saver) GetChangeStatus ¶
func (bcs Saver) GetChangeStatus(id identity.Identity) (*ChangeStatus, error)
GetChangeStatus returns current change transaction status.
type SettleState ¶
type SettleState string
SettleState represents the state of settle with beneficiary transaction
const ( // Pending transaction is pending Pending SettleState = "pending" // Completed transaction is completed Completed SettleState = "completed" // NotFound transaction state NotFound SettleState = "not_found" )