Versions in this module Expand all Collapse all v1 v1.0.1 Sep 24, 2024 Changes in this version type L1 + GetBlockchainInfo func() (RpcBlockchainInfo, error) + type RpcBlockchainInfo struct + AutomaticPruning bool + BestBlockHash string + Blocks int64 + Chain string + ChainWord string + Difficulty float64 + Headers int64 + InitialBlockDownload bool + MedianTime int64 + PruneHeight int64 + PruneTargetSize int64 + Pruned bool + SizeOnDisk int64 + VerificationProgress float64 v1.0.0 Mar 26, 2024 Changes in this version + const HD_DISCOVERY_RANGE + const NumKoinuDigits + const OneCoin_64 + const TxnDustLimit_64 + var EVENT_TYPES []EventType = []EventType + var ItemTypes []string = []string + var OneCoin = decimal.NewFromInt(1) + var TxnDustLimit = OneCoin.Div(decimal.NewFromInt(100)) + var TxnFeePerByte = TxnFeePerKB.Div(decimal.NewFromInt(1000)) + var TxnFeePerKB = OneCoin.Div(decimal.NewFromInt(100)) + var TxnRecommendedMaxFee = OneCoin + var TxnRecommendedMinFee = OneCoin.Div(decimal.NewFromInt(100)) + var ZeroCoins = decimal.NewFromInt(0) + func IsAlreadyExistsError(err error) bool + func IsDBConflictError(err error) bool + func IsError(err error, ofType ErrorCode) bool + func IsNotFoundError(err error) bool + func NewErr(code ErrorCode, format string, args ...any) error + type API struct + L1 L1 + Store Store + func NewAPI(store Store, l1 L1, bus MessageBus, follower ChainFollower, config Config) API + func (a API) CalculateBalance(foreignID string) (AccountBalance, error) + func (a API) CreateAccount(request AccountCreateRequest, foreignID string, upsert bool) (AccountPublic, error) + func (a API) CreateInvoice(request InvoiceCreateRequest, foreignID string) (Invoice, error) + func (a API) GetAccount(foreignID string) (AccountPublic, error) + func (a API) GetInvoice(id Address) (Invoice, error) + func (a API) ListInvoices(foreignID string, cursor int, limit int) (ListInvoicesResponse, error) + func (a API) PayInvoiceFromAccount(invoiceID Address, foreignID string) (res SendFundsResult, err error) + func (a API) SendFundsToAddress(foreignID string, payTo []PayTo, explicitFee CoinAmount, maxFee CoinAmount) (res SendFundsResult, err error) + func (a API) SetSyncHeight(height int64) error + func (a API) UpdateAccountSettings(foreignID string, update map[string]interface{}) (AccountPublic, error) + type AccBalanceChangeEvent struct + AccountID Address + CurrentBalance CoinAmount + ForeignID string + IncomingBalance CoinAmount + OutgoingBalance CoinAmount + type Account struct + Address Address + CurrentBalance CoinAmount + ForeignID string + IncomingBalance CoinAmount + NextExternalKey uint32 + NextInternalKey uint32 + NextPoolExternal uint32 + NextPoolInternal uint32 + OutgoingBalance CoinAmount + PayoutAddress Address + PayoutFrequency string + PayoutThreshold CoinAmount + Privkey Privkey + func (a *Account) GenerateAddresses(lib L1, first uint32, count uint32, isInternal bool) ([]Address, error) + func (a *Account) NextChangeAddress(lib L1) (Address, error) + func (a *Account) NextPayToAddress(lib L1) (Address, uint32, error) + func (a *Account) UpdatePoolAddresses(tx StoreTransaction, lib L1) error + func (a Account) GetPublicInfo() AccountPublic + type AccountBalance struct + CurrentBalance CoinAmount + IncomingBalance CoinAmount + OutgoingBalance CoinAmount + type AccountCreateRequest struct + PayoutAddress Address + PayoutFrequency string + PayoutThreshold CoinAmount + type AccountPublic struct + Address Address + ForeignID string + PayoutAddress Address + PayoutFrequency string + PayoutThreshold CoinAmount + type Address = doge.Address + type BrokerEmitter interface + Subscribe func(chan<- BrokerEvent) + type BrokerEvent struct + Height int64 + ID string + TxnID string + Type BrokerEventType + type BrokerEventType int + const InvoiceConfirmed + const InvoiceInBlock + const NewInvoice + type CallbackConfig struct + Path string + Types []string + type ChainFollower interface + SendCommand func(cmd any) + type ChainState struct + BestBlockHash string + BestBlockHeight int64 + FirstHeight int64 + NextSeq int64 + RootHash string + func (c *ChainState) GetSeq() int64 + type CoinAmount = decimal.Decimal + type Config struct + Callbacks map[string]CallbackConfig + Core NodeConfig + Dogecoind map[string]NodeConfig + Gigawallet GigawalletConfig + Loggers map[string]LoggersConfig + MQTT MQTTConfig + Store StoreConfig + WebAPI WebAPIConfig + func TestConfig() Config + type ConnectEnvelope struct + Hash string + Payload string + ServiceDomain string + ServiceIconURL string + ServiceKeyHash string + ServiceName string + Version string + func InvoiceToConnectRequestEnvelope(i Invoice, conf Config) (ConnectEnvelope, error) + type ConnectInvoice struct + Address string + ID string + Initiated time.Time + Items []ConnectItem + TimeoutSec int + Total decimal.Decimal + Type string + type ConnectItem struct + Description string + ID string + Name string + Thumb string + Type string + UnitCost decimal.Decimal + UnitCount int + type EVENT_ACC string + const ACC_BALANCE_CHANGE + const ACC_CREATED + const ACC_UPDATED + func (e EVENT_ACC) Type() string + type EVENT_ALL string + func (e EVENT_ALL) Type() string + type EVENT_INV string + const INV_CREATED + const INV_OVER_PAYMENT_CONFIRMED + const INV_OVER_PAYMENT_DETECTED + const INV_PART_PAYMENT_DETECTED + const INV_PAYMENT_REFUNDED + const INV_PAYMENT_SENT + const INV_PAYMENT_UNCONFIRMED + const INV_TOTAL_PAYMENT_CONFIRMED + const INV_TOTAL_PAYMENT_DETECTED + func (e EVENT_INV) Type() string + type EVENT_NET string + func (e EVENT_NET) Type() string + type EVENT_PAYMENT string + const PAYMENT_CONFIRMED + const PAYMENT_ON_CHAIN + const PAYMENT_SENT + const PAYMENT_UNCONFIRMED + func (e EVENT_PAYMENT) Type() string + type EVENT_SYS string + const SYS_ERR + const SYS_MSG + const SYS_STARTUP + func (e EVENT_SYS) Type() string + type ErrorCode string + const AlreadyExists + const BadRequest + const DBConflict + const InsufficientFunds + const InvalidTxn + const L1Error + const NotAvailable + const NotFound + const UnknownError + type ErrorInfo struct + Code ErrorCode + Message string + func (e *ErrorInfo) Error() string + type EventType interface + Type func() string + type GigawalletConfig struct + ConfirmationsNeeded int + Network string + RejectionsNeeded int + ServiceDomain string + ServiceIconURL string + ServiceKeyHash string + ServiceKeySecret string + ServiceName string + type InvOverpaymentEvent struct + AccountID Address + ForeignID string + InvoiceID Address + InvoiceTotal CoinAmount + OverpaymentConfirmed CoinAmount + OverpaymentIncoming CoinAmount + TotalConfirmed CoinAmount + TotalIncoming CoinAmount + type InvPaymentEvent struct + AccountID Address + ForeignID string + InvoiceID Address + InvoiceTotal CoinAmount + TotalConfirmed CoinAmount + TotalIncoming CoinAmount + type Invoice struct + Account Address + BlockID string + Confirmations int32 + Created time.Time + ID Address + IncomingAmount CoinAmount + Items []Item + KeyIndex uint32 + LastIncomingAmount CoinAmount + LastPaidAmount CoinAmount + PaidAmount CoinAmount + PaidEvent time.Time + PaidHeight int64 + Total CoinAmount + func (i *Invoice) CalcTotal() CoinAmount + func (i *Invoice) ToPublic() PublicInvoice + func (i *Invoice) Validate() error + type InvoiceCreateRequest struct + Confirmations int32 + Items []Item + type Item struct + Description string + ImageLink string + Name string + Quantity int + SKU string + Type string + Value CoinAmount + type L1 interface + DecodeTransaction func(txnHex string) (RawTxn, error) + EstimateFee func(confirmTarget int) (feePerKB CoinAmount, err error) + GetBestBlockHash func() (string, error) + GetBlock func(blockHash string) (RpcBlock, error) + GetBlockCount func() (int64, error) + GetBlockHash func(height int64) (string, error) + GetBlockHeader func(blockHash string) (RpcBlockHeader, error) + GetBlockHex func(blockHash string) (string, error) + GetTransaction func(txnHash string) (RawTxn, error) + MakeAddress func(isTestNet bool) (Address, Privkey, error) + MakeChildAddress func(privkey Privkey, addressIndex uint32, isInternal bool) (Address, error) + MakeTransaction func(inputs []UTXO, outputs []NewTxOut, fee CoinAmount, change Address, ...) (NewTxn, error) + Send func(txnHex string) (txid string, err error) + type ListInvoicesResponse struct + Cursor int + Items []Invoice + type LoggersConfig struct + Path string + Types []string + type MQTTConfig struct + Address string + ClientID string + Password string + Queues map[string]MQTTQueueConfig + Username string + type MQTTQueueConfig struct + TopicFilter string + Types []string + type Message struct + EventType EventType + ID string + Message interface{} + type MessageBus struct + func NewMessageBus() MessageBus + func (b MessageBus) Register(m MessageSubscriber, types ...EventType) + func (b MessageBus) Run(started, stopped chan bool, stop chan context.Context) error + func (b MessageBus) Send(t EventType, msg interface{}, msgID ...string) error + func (b MessageBus) Unregister(sub *Subscription) + type MessageSubscriber interface + GetChan func() chan Message + type MockFollower struct + func (m MockFollower) SendCommand(cmd any) + type NewTxOut struct + Amount CoinAmount + ScriptAddress Address + ScriptType ScriptType + type NewTxn struct + ChangeAmount CoinAmount + FeeAmount CoinAmount + TotalIn CoinAmount + TotalOut CoinAmount + TxnHex string + func CreateTxn(payTo []PayTo, fixedFee CoinAmount, maxFee CoinAmount, acc Account, ...) (NewTxn, error) + type NodeConfig struct + Host string + RPCHost string + RPCPass string + RPCPort int + RPCUser string + ZMQPort int + type NodeEmitter interface + Subscribe func(chan<- NodeEvent) + type NodeEvent struct + Data string + ID string + Type NodeEventType + type NodeEventType int + const Block + const TX + type PayTo struct + Amount CoinAmount + DeductFeePercent decimal.Decimal + PayTo Address + type Payment struct + AccountAddress Address + ConfirmedEvent time.Time + ConfirmedHeight int64 + Created time.Time + Fee CoinAmount + ID int64 + OnChainEvent time.Time + PaidHeight int64 + PaidTxID string + PayTo []PayTo + Total CoinAmount + UnconfirmedEvent time.Time + type PaymentEvent struct + AccountID Address + ForeignID string + PayTo []PayTo + PaymentID int64 + Total CoinAmount + TxID string + type Privkey string + type PublicInvoice struct + Confirmations int32 + Created time.Time + Estimate int + ID Address + Items []Item + PartDetected bool + PayTo Address + Total CoinAmount + TotalConfirmed bool + TotalDetected bool + Unconfirmed bool + type RawTxn struct + Hash string + LockTime int64 + Size int64 + TxID string + VIn []RawTxnVIn + VOut []RawTxnVOut + VSize int64 + Version int64 + type RawTxnScriptPubKey struct + Addresses []string + Asm string + Hex string + ReqSigs int64 + Type string + type RawTxnScriptSig struct + Asm string + Hex string + type RawTxnVIn struct + ScriptSig RawTxnScriptSig + Sequence int64 + TxID string + TxInWitness []string + VOut int + type RawTxnVOut struct + N int + ScriptPubKey RawTxnScriptPubKey + Value decimal.Decimal + type ReSyncChainFollowerCmd struct + BlockHash string + type RestartChainFollowerCmd struct + type RpcBlock struct + Bits string + ChainWork string + Confirmations int64 + Difficulty decimal.Decimal + Hash string + Height int64 + MedianTime int + MerkleRoot string + NextBlockHash string + Nonce int + PreviousBlockHash string + Size int + StrippedSize int + Time int + Tx []string + Version int + VersionHex string + Weight int + type RpcBlockHeader struct + Bits string + ChainWork string + Confirmations int64 + Difficulty decimal.Decimal + Hash string + Height int64 + MedianTime int + MerkleRoot string + NextBlockHash string + Nonce int + PreviousBlockHash string + Time int + Version int + VersionHex string + type ScriptType = doge.ScriptType + func DecodeCoreRPCScriptType(coreRpcType string) ScriptType + type SendFundsResult struct + Fee CoinAmount + Paid CoinAmount + Total CoinAmount + TxId string + type StopChainFollowerCmd struct + Ctx context.Context + type Store interface + Begin func() (StoreTransaction, error) + CalculateBalance func(accountID Address) (AccountBalance, error) + Close func() + GetAccount func(foreignID string) (Account, error) + GetAllUnreservedUTXOs func(account Address) ([]UTXO, error) + GetChainState func() (ChainState, error) + GetInvoice func(id Address) (Invoice, error) + GetPayment func(account Address, id int64) (Payment, error) + GetServiceCursor func(name string) (int64, error) + ListInvoices func(account Address, cursor int, limit int) (items []Invoice, next_cursor int, err error) + ListPayments func(account Address, cursor int64, limit int) (items []Payment, next_cursor int64, err error) + type StoreConfig struct + DBFile string + type StoreTransaction interface + CalculateBalance func(accountID Address) (AccountBalance, error) + Commit func() error + ConfirmPayments func(confirmations int, blockHeight int64) (affectedAcconts []string, err error) + ConfirmUTXOs func(confirmations int, blockHeight int64) (affectedAcconts []string, err error) + CreateAccount func(account Account) error + CreatePayment func(account Address, payTo []PayTo, total CoinAmount, fee CoinAmount) (Payment, error) + CreateUTXO func(utxo UTXO) error + FindAccountForAddress func(pkhAddress Address) (accountID Address, keyIndex uint32, isInternal bool, err error) + GetAccount func(foreignID string) (Account, error) + GetAccountByID func(accountID Address) (Account, error) + GetAllUnreservedUTXOs func(account Address) ([]UTXO, error) + GetChainState func() (ChainState, error) + GetInvoice func(id Address) (Invoice, error) + GetPayment func(account Address, id int64) (Payment, error) + IncChainSeqForAccounts func(accounts map[string]int64) error + ListAccountsModifiedSince func(cursor int64, limit int) (ids []string, nextCursor int64, err error) + ListInvoices func(account Address, cursor int, limit int) (items []Invoice, next_cursor int, err error) + ListPayments func(account Address, cursor int64, limit int) (items []Payment, next_cursor int64, err error) + MarkInvoiceEventSent func(invoiceID Address, event EVENT_INV) error + MarkInvoicesPaid func(blockHeight int64, blockID string) (affectedAcconts []string, err error) + MarkPaymentsOnChain func(txIDs []string, blockHeight int64) (affectedAcconts []string, err error) + MarkUTXOSpent func(txID string, vOut int, spentHeight int64, spendTxID string) (accountId string, scriptAddress Address, err error) + RevertChangesAboveHeight func(maxValidHeight int64, nextSeq int64) (newSeq int64, err error) + Rollback func() error + SetServiceCursor func(name string, cursor int64) error + StoreAddresses func(accountID Address, addresses []Address, firstAddress uint32, internal bool) error + StoreInvoice func(invoice Invoice) error + UpdateAccount func(account Account) error + UpdateAccountBalance func(accountID Address, bal AccountBalance) error + UpdateChainState func(state ChainState, writeRoot bool) error + UpdatePaymentWithTxID func(paymentID int64, txID string) error + type StoreUTXOSource struct + func (s *StoreUTXOSource) FindUTXOLargerThan(amount CoinAmount, taken UTXOSet) (UTXO, error) + func (s *StoreUTXOSource) NextUnspentUTXO(taken UTXOSet) (UTXO, error) + type Subscription struct + type TipChaserReceiver = chan NodeEvent + type UTXO struct + AccountID Address + BlockHeight int64 + IsInternal bool + KeyIndex uint32 + PaymentID int64 + ScriptAddress Address + ScriptHex string + ScriptType ScriptType + SpendTxID string + TxID string + VOut int + Value CoinAmount + type UTXOMapSet struct + func NewUTXOSet() UTXOMapSet + func (u UTXOMapSet) Add(txID string, vOut int) + func (u UTXOMapSet) Includes(txID string, vOut int) bool + type UTXOSet interface + Add func(txID string, vOut int) + Includes func(txID string, vOut int) bool + type UTXOSource interface + FindUTXOLargerThan func(amount CoinAmount, taken UTXOSet) (UTXO, error) + NextUnspentUTXO func(taken UTXOSet) (UTXO, error) + func NewArrayUTXOSource(utxos []UTXO) UTXOSource + func NewUTXOSource(store Store, accountID Address) UTXOSource + type WebAPIConfig struct + AdminBind string + AdminPort string + PubAPIRootURL string + PubBind string + PubPort string v0 v0.1.0-beta2 Sep 1, 2023 v0.1.0-beta1 Aug 17, 2023