Documentation ¶
Index ¶
- Constants
- func NewSQLiteStore(fileName string) (giga.Store, error)
- type Mock
- func (m Mock) Commit(updates []any) error
- func (m Mock) CreateAccount(account giga.Account) error
- func (m Mock) GetAccount(foreignID string) (giga.Account, error)
- func (m Mock) GetAccountByAddress(id giga.Address) (giga.Account, error)
- func (m Mock) GetAllUnreservedUTXOs(account giga.Address) ([]giga.UTXO, error)
- func (m Mock) GetChainState() (giga.ChainState, error)
- func (m Mock) GetInvoice(id giga.Address) (giga.Invoice, error)
- func (m Mock) IncAccountChainSeq(accountId string) error
- func (m Mock) ListInvoices(account giga.Address, cursor int, limit int) (items []giga.Invoice, next_cursor int, err error)
- func (m Mock) MarkInvoiceAsPaid(id giga.Address) error
- func (m Mock) RevertTxnsAboveHeight(maxValidHeight int64) error
- func (m Mock) RevertUTXOsAboveHeight(maxValidHeight int64) error
- func (m Mock) StoreInvoice(invoice giga.Invoice) error
- func (m Mock) UpdateAccount(account giga.Account) error
- func (m Mock) UpdateChainState(state giga.ChainState) error
- type Queryable
- type SQLiteStore
- func (s SQLiteStore) Begin() (giga.StoreTransaction, error)
- func (s SQLiteStore) CalculateBalance(accountID giga.Address) (giga.AccountBalance, error)
- func (s SQLiteStore) Close()
- func (s SQLiteStore) GetAccount(foreignID string) (giga.Account, error)
- func (s SQLiteStore) GetAllUnreservedUTXOs(account giga.Address) (result []giga.UTXO, err error)
- func (s SQLiteStore) GetChainState() (giga.ChainState, error)
- func (s SQLiteStore) GetInvoice(addr giga.Address) (giga.Invoice, error)
- func (s SQLiteStore) GetPayment(account giga.Address, id int64) (giga.Payment, error)
- func (s SQLiteStore) GetServiceCursor(name string) (cursor int64, err error)
- func (s SQLiteStore) ListInvoices(account giga.Address, cursor int, limit int) (items []giga.Invoice, next_cursor int, err error)
- func (s SQLiteStore) ListPayments(account giga.Address, cursor int64, limit int) (items []giga.Payment, next_cursor int64, err error)
- type SQLiteStoreTransaction
- func (t SQLiteStoreTransaction) CalculateBalance(accountID giga.Address) (giga.AccountBalance, error)
- func (t *SQLiteStoreTransaction) Commit() error
- func (t SQLiteStoreTransaction) ConfirmPayments(confirmations int, blockHeight int64) (affectedAccounts []string, err error)
- func (t SQLiteStoreTransaction) ConfirmUTXOs(confirmations int, blockHeight int64) (affectedAccounts []string, err error)
- func (t SQLiteStoreTransaction) CreateAccount(acc giga.Account) error
- func (t SQLiteStoreTransaction) CreatePayment(accountAddr giga.Address, amount giga.CoinAmount, payTo giga.Address) (giga.Payment, error)
- func (t SQLiteStoreTransaction) CreateUTXO(utxo giga.UTXO) error
- func (t SQLiteStoreTransaction) FindAccountForAddress(address giga.Address) (giga.Address, uint32, bool, error)
- func (t SQLiteStoreTransaction) GetAccount(foreignID string) (giga.Account, error)
- func (t SQLiteStoreTransaction) GetAccountByID(ID giga.Address) (giga.Account, error)
- func (t SQLiteStoreTransaction) GetAllUnreservedUTXOs(account giga.Address) (result []giga.UTXO, err error)
- func (t SQLiteStoreTransaction) GetChainState() (giga.ChainState, error)
- func (t SQLiteStoreTransaction) GetInvoice(addr giga.Address) (giga.Invoice, error)
- func (t SQLiteStoreTransaction) GetPayment(account giga.Address, id int64) (giga.Payment, error)
- func (t SQLiteStoreTransaction) IncChainSeqForAccounts(accounts map[string]int64) error
- func (t SQLiteStoreTransaction) ListAccountsModifiedSince(cursor int64, limit int) (ids []string, nextCursor int64, err error)
- func (t SQLiteStoreTransaction) ListInvoices(account giga.Address, cursor int, limit int) (items []giga.Invoice, next_cursor int, err error)
- func (t SQLiteStoreTransaction) ListPayments(account giga.Address, cursor int64, limit int) (items []giga.Payment, next_cursor int64, err error)
- func (t SQLiteStoreTransaction) MarkInvoiceEventSent(invoiceID giga.Address, event giga.EVENT_INV) error
- func (t SQLiteStoreTransaction) MarkInvoicesPaid(blockHeight int64, blockID string) (accounts []string, err error)
- func (t SQLiteStoreTransaction) MarkPaymentsOnChain(txIDs []string, blockHeight int64) (accounts []string, err error)
- func (t SQLiteStoreTransaction) MarkUTXOSpent(txID string, vOut int, blockHeight int64, spendTxID string) (id string, scriptAddress giga.Address, err error)
- func (t SQLiteStoreTransaction) RevertChangesAboveHeight(maxValidHeight int64, seq int64) (int64, error)
- func (t SQLiteStoreTransaction) Rollback() error
- func (t SQLiteStoreTransaction) SetServiceCursor(name string, cursor int64) error
- func (t SQLiteStoreTransaction) StoreAddresses(accountID giga.Address, addresses []giga.Address, firstAddress uint32, ...) error
- func (t SQLiteStoreTransaction) StoreInvoice(inv giga.Invoice) error
- func (t SQLiteStoreTransaction) UpdateAccount(acc giga.Account) error
- func (t SQLiteStoreTransaction) UpdateAccountBalance(accountID giga.Address, bal giga.AccountBalance) error
- func (t SQLiteStoreTransaction) UpdateChainState(state giga.ChainState, writeRoot bool) error
- func (t SQLiteStoreTransaction) UpdatePaymentWithTxID(paymentID int64, txID string) error
- type Scannable
Constants ¶
const SETUP_SQL string = `` /* 2915-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
func NewMock ¶
func NewMock() Mock
NewMock returns a giga.PaymentsStore implementor that stores orders in memory
func (Mock) GetAccountByAddress ¶
func (Mock) GetAllUnreservedUTXOs ¶
func (Mock) GetChainState ¶
func (m Mock) GetChainState() (giga.ChainState, error)
func (Mock) IncAccountChainSeq ¶
func (Mock) ListInvoices ¶
func (Mock) RevertTxnsAboveHeight ¶
func (Mock) RevertUTXOsAboveHeight ¶
func (Mock) UpdateChainState ¶
func (m Mock) UpdateChainState(state giga.ChainState) error
type Queryable ¶
type Queryable interface { Query(query string, args ...any) (*sql.Rows, error) QueryRow(query string, args ...any) *sql.Row }
The common read-only parts of sql.DB and sql.Tx interfaces, so we can pass either one to some helper functions (for methods that appear on both SQLiteStore and SQLiteStoreTransaction)
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func (SQLiteStore) Begin ¶
func (s SQLiteStore) Begin() (giga.StoreTransaction, error)
func (SQLiteStore) CalculateBalance ¶
func (s SQLiteStore) CalculateBalance(accountID giga.Address) (giga.AccountBalance, error)
func (SQLiteStore) GetAccount ¶
func (s SQLiteStore) GetAccount(foreignID string) (giga.Account, error)
func (SQLiteStore) GetAllUnreservedUTXOs ¶
func (SQLiteStore) GetChainState ¶
func (s SQLiteStore) GetChainState() (giga.ChainState, error)
func (SQLiteStore) GetInvoice ¶
func (SQLiteStore) GetPayment ¶
func (SQLiteStore) GetServiceCursor ¶
func (s SQLiteStore) GetServiceCursor(name string) (cursor int64, err error)
func (SQLiteStore) ListInvoices ¶
type SQLiteStoreTransaction ¶
type SQLiteStoreTransaction struct {
// contains filtered or unexported fields
}
func (SQLiteStoreTransaction) CalculateBalance ¶
func (t SQLiteStoreTransaction) CalculateBalance(accountID giga.Address) (giga.AccountBalance, error)
func (*SQLiteStoreTransaction) Commit ¶
func (t *SQLiteStoreTransaction) Commit() error
func (SQLiteStoreTransaction) ConfirmPayments ¶
func (t SQLiteStoreTransaction) ConfirmPayments(confirmations int, blockHeight int64) (affectedAccounts []string, err error)
func (SQLiteStoreTransaction) ConfirmUTXOs ¶
func (t SQLiteStoreTransaction) ConfirmUTXOs(confirmations int, blockHeight int64) (affectedAccounts []string, err error)
func (SQLiteStoreTransaction) CreateAccount ¶
func (t SQLiteStoreTransaction) CreateAccount(acc giga.Account) error
func (SQLiteStoreTransaction) CreatePayment ¶
func (t SQLiteStoreTransaction) CreatePayment(accountAddr giga.Address, amount giga.CoinAmount, payTo giga.Address) (giga.Payment, error)
func (SQLiteStoreTransaction) CreateUTXO ¶
func (t SQLiteStoreTransaction) CreateUTXO(utxo giga.UTXO) error
func (SQLiteStoreTransaction) FindAccountForAddress ¶
func (SQLiteStoreTransaction) GetAccount ¶
func (t SQLiteStoreTransaction) GetAccount(foreignID string) (giga.Account, error)
func (SQLiteStoreTransaction) GetAccountByID ¶
func (SQLiteStoreTransaction) GetAllUnreservedUTXOs ¶
func (SQLiteStoreTransaction) GetChainState ¶
func (t SQLiteStoreTransaction) GetChainState() (giga.ChainState, error)
func (SQLiteStoreTransaction) GetInvoice ¶
func (SQLiteStoreTransaction) GetPayment ¶
func (SQLiteStoreTransaction) IncChainSeqForAccounts ¶
func (t SQLiteStoreTransaction) IncChainSeqForAccounts(accounts map[string]int64) error
func (SQLiteStoreTransaction) ListAccountsModifiedSince ¶
func (SQLiteStoreTransaction) ListInvoices ¶
func (SQLiteStoreTransaction) ListPayments ¶
func (SQLiteStoreTransaction) MarkInvoiceEventSent ¶
func (SQLiteStoreTransaction) MarkInvoicesPaid ¶
func (t SQLiteStoreTransaction) MarkInvoicesPaid(blockHeight int64, blockID string) (accounts []string, err error)
Mark all invoices paid that have corresponding confirmed UTXOs [via ConfirmUTXOs] that sum up to the invoice total, storing the given block-height. Returns the IDs of the Accounts that own any affected invoices (can return duplicates)
func (SQLiteStoreTransaction) MarkPaymentsOnChain ¶
func (t SQLiteStoreTransaction) MarkPaymentsOnChain(txIDs []string, blockHeight int64) (accounts []string, err error)
Mark payments paid that match any of the txIDs (storing the given block-height) Returns the IDs of the Accounts that own any affected payments (can have duplicates)
func (SQLiteStoreTransaction) MarkUTXOSpent ¶
func (SQLiteStoreTransaction) RevertChangesAboveHeight ¶
func (t SQLiteStoreTransaction) RevertChangesAboveHeight(maxValidHeight int64, seq int64) (int64, error)
func (SQLiteStoreTransaction) Rollback ¶
func (t SQLiteStoreTransaction) Rollback() error
func (SQLiteStoreTransaction) SetServiceCursor ¶
func (t SQLiteStoreTransaction) SetServiceCursor(name string, cursor int64) error
func (SQLiteStoreTransaction) StoreAddresses ¶
func (SQLiteStoreTransaction) StoreInvoice ¶
func (t SQLiteStoreTransaction) StoreInvoice(inv giga.Invoice) error
Store an invoice
func (SQLiteStoreTransaction) UpdateAccount ¶
func (t SQLiteStoreTransaction) UpdateAccount(acc giga.Account) error
func (SQLiteStoreTransaction) UpdateAccountBalance ¶
func (t SQLiteStoreTransaction) UpdateAccountBalance(accountID giga.Address, bal giga.AccountBalance) error
func (SQLiteStoreTransaction) UpdateChainState ¶
func (t SQLiteStoreTransaction) UpdateChainState(state giga.ChainState, writeRoot bool) error
func (SQLiteStoreTransaction) UpdatePaymentWithTxID ¶
func (t SQLiteStoreTransaction) UpdatePaymentWithTxID(paymentID int64, txID string) error