Documentation
¶
Index ¶
- type Address
- type Client
- func (c *Client) AddAddress(walletName, address, baseAddress string, ...) error
- func (c *Client) AddTransaction(sourceAddress, txMetadata, metaDataHash string, sendTime time.Time) error
- func (c *Client) Close() error
- func (c *Client) DeleteTransaction(sourceAddress, txHash, metaDataHash string) error
- func (c *Client) Destroy() error
- func (c *Client) GetAddress(address string) (*Address, error)
- func (c *Client) GetAddresses() ([]Address, error)
- func (c *Client) GetRelayedTransactions() ([]Transfer, error)
- func (c *Client) GetSendableTransactions() ([]Transfer, error)
- func (c *Client) GetTransaction(sourceAddress, metaDataHash string) (*Transfer, error)
- func (c *Client) GetTransactions() ([]Transfer, error)
- func (c *Client) GetUnrelayedTransactions() ([]Transfer, error)
- func (c *Client) GetUnscheduledAddresses() ([]Address, error)
- func (c *Client) ScheduleTransaction(sourceAddress, txMetadata, metadataHash string, sendTime time.Time) error
- func (c *Client) SetScheduled(address string, scheduled uint) error
- func (c *Client) SetTxHash(sourceAddress, metaDataHash, txHash string) error
- func (c *Client) SetTxSpent(sourceAddress, metaDataHash string, spent uint) error
- func (c *Client) Setup() error
- type Transfer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { gorm.Model WalletName string AccountIndex uint // indicates the wallet account this is a part of AddressIndex uint // indicates the subaddress index BaseAddress string // indicates the base wallet account address Address string `gorm:"unique"` // this is the wallet account subaddress Balance uint Scheduled uint // indicates if it is scheduled, 0 = false, 1 = true Spent uint // indicates if it has been spent, 0 = false, 1 = true }
Address specifies an address, its balance and the wallet it came from
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a wrapper around the gorm client connecting to a sqlite3 database
func (*Client) AddAddress ¶
func (c *Client) AddAddress(walletName, address, baseAddress string, accountIndex, addressIndex, balance uint64) error
AddAddress is used to store an address into the database, if a previous record with this address exists it will be overwritten
func (*Client) AddTransaction ¶
func (c *Client) AddTransaction(sourceAddress, txMetadata, metaDataHash string, sendTime time.Time) error
AddTransaction is used to store a transaction that we need to relay
func (*Client) DeleteTransaction ¶
DeleteTransaction is used to remove transaction data from our database we do this once the transaction has been confirmed and to purge evidence of the churn
func (*Client) GetAddress ¶
GetAddress returns the given address if it exists
func (*Client) GetAddresses ¶
GetAddresses returns all known addresses
func (*Client) GetRelayedTransactions ¶
GetRelayedTransactions returns all currently relayed transactions
func (*Client) GetSendableTransactions ¶
GetSendableTransactions returns all transactions we can relay
func (*Client) GetTransaction ¶
GetTransaction returns the first matching transaction
func (*Client) GetTransactions ¶
GetTransactions returns all known transactions
func (*Client) GetUnrelayedTransactions ¶
GetUnrelayedTransactions returns transactinos which have been scheduled but not yet relayed
func (*Client) GetUnscheduledAddresses ¶
GetUnscheduledAddresses returns all unscheduled addresses
func (*Client) ScheduleTransaction ¶
func (c *Client) ScheduleTransaction(sourceAddress, txMetadata, metadataHash string, sendTime time.Time) error
ScheduleTransaction is used to persist transaction metadata information to disk, marking the associated address as being scheduled. This means anytime during startup, we can reschedule transactions in case the program exists with pending transactions
func (*Client) SetScheduled ¶
SetScheduled marks an address as having a scheduled transaction
func (*Client) SetTxSpent ¶
SetTxSpent sets the spent field on a transfer entry
type Transfer ¶
type Transfer struct { gorm.Model SourceAddress string // the sending address TxMetadata string // the transaction metadata we use to relay TxMetadataHash string // sha256 hash of TxMetadata TxHash string // the hash of the transaction once relayed SendTime time.Time // the time at which we will relay the transaction Spent uint // indicates if the tx is spent (ie broadcasted), 0 = false 1 = true }
Transfer is a single transfer to churn an address