Versions in this module Expand all Collapse all v0 v0.32.0 Mar 4, 2024 Changes in this version + const CronJobNameCalculateMetrics + const CronJobNameDraftTransactionCleanUp + const CronJobNameSyncTransactionBroadcast + const CronJobNameSyncTransactionSync + const MetadataField + const ReferenceIDField + const ResolutionTypeBasic + const ResolutionTypeP2P + var AllModelNames = []ModelName + var BaseModels = []interface + var ErrAccessKeyNotFound = errors.New("access key not found") + var ErrAccessKeyRevoked = errors.New("access key has been revoked") + var ErrAuhHashMismatch = errors.New("auth hash and body hash do not match") + var ErrAuthAccessKeyNotFound = errors.New("auth access key could not be found") + var ErrCannotConvertToIDs = errors.New("cannot convert value to type IDs") + var ErrChangeStrategyNotImplemented = errors.New("change strategy nominations not implemented yet") + var ErrDatastoreRequired = errors.New("datastore is required") + var ErrDraftIDMismatch = errors.New("transaction draft id does not match utxo draft reservation id") + var ErrDraftNotFound = errors.New("corresponding draft transaction not found") + var ErrDuplicateUTXOs = errors.New("duplicate utxos found") + var ErrInvalidLockingScript = errors.New("invalid locking script") + var ErrInvalidOpReturnOutput = errors.New("invalid op_return output") + var ErrInvalidScriptOutput = errors.New("invalid script output") + var ErrInvalidTransactionID = errors.New("invalid transaction id") + var ErrMissingAccessKey = errors.New("missing access key") + var ErrMissingAddressResolutionURL = errors.New("missing address resolution url from capabilities") + var ErrMissingAuthHeader = errors.New("missing authentication header") + var ErrMissingBody = errors.New("missing body") + var ErrMissingClient = errors.New("client is missing from model, cannot save") + var ErrMissingDestination = errors.New("destination could not be found") + var ErrMissingFieldHash = errors.New("missing required field: hash") + var ErrMissingFieldHex = errors.New("missing required field: hex") + var ErrMissingFieldID = errors.New("missing required field: id") + var ErrMissingFieldSatoshis = errors.New("missing required field: satoshis") + var ErrMissingFieldScriptPubKey = errors.New("missing required field: script_pub_key") + var ErrMissingFieldTransactionID = errors.New("missing required field: transaction_id") + var ErrMissingFieldXpubID = errors.New("missing required field: xpub_id") + var ErrMissingLockingScript = errors.New("could not find locking script") + var ErrMissingPaymailAddress = errors.New("missing alias in paymail") + var ErrMissingPaymailDomain = errors.New("missing domain in paymail") + var ErrMissingPaymailExternalXPub = errors.New("missing external xPub in paymail") + var ErrMissingPaymailID = errors.New("missing id in paymail") + var ErrMissingPaymailXPubID = errors.New("missing xpub_id in paymail") + var ErrMissingRequiredXpub = errors.New("xpub was not found but was expected") + var ErrMissingSignature = errors.New("signature missing") + var ErrMissingTransaction = errors.New("transaction could not be found") + var ErrMissingTransactionOutputs = errors.New("draft transaction configuration has no outputs") + var ErrMissingTxHex = errors.New("transaction hex is empty or id is missing") + var ErrMissingUTXOsSpendable = errors.New("no utxos found using spendable") + var ErrMissingUtxo = errors.New("utxo could not be found") + var ErrMissingXPriv = errors.New("missing xPriv key") + var ErrMissingXpub = errors.New("could not find xpub") + var ErrNoMatchingOutputs = errors.New("transaction outputs do not match any known destinations") + var ErrNotAdminKey = errors.New("xpub provided is not an admin key") + var ErrNotEnoughUtxos = errors.New("could not select enough outputs to satisfy transaction") + var ErrOutputValueNotRecognized = errors.New("output value is unrecognized") + var ErrOutputValueTooHigh = errors.New("output value is too high") + var ErrOutputValueTooLow = errors.New("output value is too low") + var ErrPaymailAddressIsInvalid = errors.New("paymail address is invalid") + var ErrPaymailNotFound = errors.New("paymail could not be found") + var ErrResolutionFailed = errors.New("failed to return a resolution for paymail address") + var ErrSignatureExpired = errors.New("signature has expired") + var ErrSignatureInvalid = errors.New("signature invalid") + var ErrTransactionFeeInvalid = errors.New("transaction fee is invalid") + var ErrTransactionNotParsed = errors.New("transaction is not parsed") + var ErrUnknownAccessKey = errors.New("unknown access key") + var ErrUnknownLockingScript = errors.New("could not recognize locking script") + var ErrUnsupportedDestinationType = errors.New("unsupported destination type") + var ErrUtxoAlreadySpent = errors.New("utxo has already been spent") + var ErrUtxoNotReserved = errors.New("transaction utxo has not been reserved for spending") + var ErrXpubIDMisMatch = errors.New("xpub_id mismatch") + func DisplayModels(models interface{}) interface + func Get(ctx context.Context, model ModelInterface, conditions map[string]interface{}, ...) error + func Save(ctx context.Context, model ModelInterface) (err error) + func ToBeef(ctx context.Context, tx *Transaction, store TransactionGetter) (string, error) + func ToEfHex(ctx context.Context, tx *Transaction, store TransactionGetter) (efHex string, ok bool) + type AccessKey struct + ID string + Key string + RevokedAt customTypes.NullTime + XpubID string + func (m *AccessKey) BeforeCreating(_ context.Context) error + func (m *AccessKey) GetID() string + func (m *AccessKey) GetModelName() string + func (m *AccessKey) GetModelTableName() string + func (m *AccessKey) Migrate(client datastore.ClientInterface) error + func (m *AccessKey) Save(ctx context.Context) error + type AccessKeyService interface + GetAccessKey func(ctx context.Context, xPubID, pubAccessKey string) (*AccessKey, error) + GetAccessKeys func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) ([]*AccessKey, error) + GetAccessKeysByXPubID func(ctx context.Context, xPubID string, metadata *Metadata, ...) ([]*AccessKey, error) + GetAccessKeysByXPubIDCount func(ctx context.Context, xPubID string, metadata *Metadata, ...) (int64, error) + GetAccessKeysCount func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) (int64, error) + NewAccessKey func(ctx context.Context, rawXpubKey string, opts ...ModelOps) (*AccessKey, error) + RevokeAccessKey func(ctx context.Context, rawXpubKey, id string, opts ...ModelOps) (*AccessKey, error) + type AdminService interface + GetPaymailAddresses func(ctx context.Context, metadataConditions *Metadata, ...) ([]*PaymailAddress, error) + GetPaymailAddressesCount func(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + GetStats func(ctx context.Context, opts ...ModelOps) (*AdminStats, error) + GetXPubs func(ctx context.Context, metadataConditions *Metadata, ...) ([]*Xpub, error) + GetXPubsCount func(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + type AdminStats struct + Balance int64 + Destinations int64 + PaymailAddresses int64 + Transactions int64 + TransactionsPerDay map[string]interface{} + Utxos int64 + UtxosPerType map[string]interface{} + XPubs int64 + type BUMP struct + BlockHeight uint64 + Path [][]BUMPLeaf + func CalculateMergedBUMP(bumps []BUMP) (*BUMP, error) + func (bump *BUMP) Hex() string + func (bump *BUMP) Scan(value interface{}) error + func (bump BUMP) Value() (driver.Value, error) + type BUMPLeaf struct + Duplicate bool + Hash string + Offset uint64 + TxID bool + type BUMPs []*BUMP + func (bumps *BUMPs) Bytes() []byte + func (bumps *BUMPs) Scan(value interface{}) error + func (bumps BUMPs) Value() (driver.Value, error) + type ChangeStrategy string + const ChangeStrategyDefault + const ChangeStrategyNominations + const ChangeStrategyRandom + type Client struct + func (c *Client) AddModels(ctx context.Context, autoMigrate bool, models ...interface{}) error + func (c *Client) AuthenticateAccessKey(ctx context.Context, pubAccessKey string) (*AccessKey, error) + func (c *Client) Cachestore() cachestore.ClientInterface + func (c *Client) Chainstate() chainstate.ClientInterface + func (c *Client) Close(ctx context.Context) error + func (c *Client) Cluster() cluster.ClientInterface + func (c *Client) Datastore() datastore.ClientInterface + func (c *Client) Debug(on bool) + func (c *Client) DefaultModelOptions(opts ...ModelOps) []ModelOps + func (c *Client) DefaultSyncConfig() *SyncConfig + func (c *Client) DeletePaymailAddress(ctx context.Context, address string, opts ...ModelOps) error + func (c *Client) EnableNewRelic() + func (c *Client) GetAccessKey(ctx context.Context, xPubID, id string) (*AccessKey, error) + func (c *Client) GetAccessKeys(ctx context.Context, metadataConditions *Metadata, ...) ([]*AccessKey, error) + func (c *Client) GetAccessKeysByXPubID(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) ([]*AccessKey, error) + func (c *Client) GetAccessKeysByXPubIDCount(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetAccessKeysCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetDestinationByAddress(ctx context.Context, xPubID, address string) (*Destination, error) + func (c *Client) GetDestinationByID(ctx context.Context, xPubID, id string) (*Destination, error) + func (c *Client) GetDestinationByLockingScript(ctx context.Context, xPubID, lockingScript string) (*Destination, error) + func (c *Client) GetDestinations(ctx context.Context, metadataConditions *Metadata, ...) ([]*Destination, error) + func (c *Client) GetDestinationsByXpubID(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) ([]*Destination, error) + func (c *Client) GetDestinationsByXpubIDCount(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetDestinationsCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetDraftTransactionByID(ctx context.Context, id string, opts ...ModelOps) (*DraftTransaction, error) + func (c *Client) GetDraftTransactions(ctx context.Context, metadataConditions *Metadata, ...) ([]*DraftTransaction, error) + func (c *Client) GetDraftTransactionsCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetModelNames() []string + func (c *Client) GetOrStartTxn(ctx context.Context, name string) context.Context + func (c *Client) GetPaymailAddress(ctx context.Context, address string, opts ...ModelOps) (*PaymailAddress, error) + func (c *Client) GetPaymailAddresses(ctx context.Context, metadataConditions *Metadata, ...) ([]*PaymailAddress, error) + func (c *Client) GetPaymailAddressesByXPubID(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) ([]*PaymailAddress, error) + func (c *Client) GetPaymailAddressesCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetPaymailConfig() *PaymailServerOptions + func (c *Client) GetStats(ctx context.Context, opts ...ModelOps) (*AdminStats, error) + func (c *Client) GetTransaction(ctx context.Context, xPubID, txID string) (*Transaction, error) + func (c *Client) GetTransactionByHex(ctx context.Context, hex string) (*Transaction, error) + func (c *Client) GetTransactions(ctx context.Context, metadataConditions *Metadata, ...) ([]*Transaction, error) + func (c *Client) GetTransactionsByIDs(ctx context.Context, txIDs []string) ([]*Transaction, error) + func (c *Client) GetTransactionsByXpubID(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) ([]*Transaction, error) + func (c *Client) GetTransactionsByXpubIDCount(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetTransactionsCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetUtxo(ctx context.Context, xPubKey, txID string, outputIndex uint32) (*Utxo, error) + func (c *Client) GetUtxoByTransactionID(ctx context.Context, txID string, outputIndex uint32) (*Utxo, error) + func (c *Client) GetUtxos(ctx context.Context, metadataConditions *Metadata, ...) ([]*Utxo, error) + func (c *Client) GetUtxosByXpubID(ctx context.Context, xPubID string, metadata *Metadata, ...) ([]*Utxo, error) + func (c *Client) GetUtxosCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetXPubs(ctx context.Context, metadataConditions *Metadata, ...) ([]*Xpub, error) + func (c *Client) GetXPubsCount(ctx context.Context, metadataConditions *Metadata, ...) (int64, error) + func (c *Client) GetXpub(ctx context.Context, xPubKey string) (*Xpub, error) + func (c *Client) GetXpubByID(ctx context.Context, xPubID string) (*Xpub, error) + func (c *Client) HTTPClient() HTTPInterface + func (c *Client) IsDebug() bool + func (c *Client) IsEncryptionKeySet() bool + func (c *Client) IsIUCEnabled() bool + func (c *Client) IsMigrationEnabled() bool + func (c *Client) IsNewRelicEnabled() bool + func (c *Client) Logger() *zerolog.Logger + func (c *Client) Metrics() (metrics *metrics.Metrics, enabled bool) + func (c *Client) NewAccessKey(ctx context.Context, rawXpubKey string, opts ...ModelOps) (*AccessKey, error) + func (c *Client) NewDestination(ctx context.Context, xPubKey string, chain uint32, destinationType string, ...) (*Destination, error) + func (c *Client) NewDestinationForLockingScript(ctx context.Context, xPubID, lockingScript string, opts ...ModelOps) (*Destination, error) + func (c *Client) NewPaymailAddress(ctx context.Context, xPubKey, address, publicName, avatar string, ...) (*PaymailAddress, error) + func (c *Client) NewTransaction(ctx context.Context, rawXpubKey string, config *TransactionConfig, ...) (*DraftTransaction, error) + func (c *Client) NewXpub(ctx context.Context, xPubKey string, opts ...ModelOps) (*Xpub, error) + func (c *Client) Notifications() notifications.ClientInterface + func (c *Client) PaymailClient() paymail.ClientInterface + func (c *Client) RecordRawTransaction(ctx context.Context, txHex string, opts ...ModelOps) (*Transaction, error) + func (c *Client) RecordTransaction(ctx context.Context, xPubKey, txHex, draftID string, opts ...ModelOps) (*Transaction, error) + func (c *Client) RevertTransaction(ctx context.Context, id string) error + func (c *Client) RevokeAccessKey(ctx context.Context, rawXpubKey, id string, opts ...ModelOps) (*AccessKey, error) + func (c *Client) SetNotificationsClient(client notifications.ClientInterface) + func (c *Client) Taskmanager() taskmanager.TaskEngine + func (c *Client) UnReserveUtxos(ctx context.Context, xPubID, draftID string) error + func (c *Client) UpdateDestinationMetadataByAddress(ctx context.Context, xPubID, address string, metadata Metadata) (*Destination, error) + func (c *Client) UpdateDestinationMetadataByID(ctx context.Context, xPubID, id string, metadata Metadata) (*Destination, error) + func (c *Client) UpdateDestinationMetadataByLockingScript(ctx context.Context, xPubID, lockingScript string, metadata Metadata) (*Destination, error) + func (c *Client) UpdatePaymailAddress(ctx context.Context, address, publicName, avatar string, opts ...ModelOps) (*PaymailAddress, error) + func (c *Client) UpdatePaymailAddressMetadata(ctx context.Context, address string, metadata Metadata, opts ...ModelOps) (*PaymailAddress, error) + func (c *Client) UpdateTransaction(ctx context.Context, callbackResp *broadcast.SubmittedTx) error + func (c *Client) UpdateTransactionMetadata(ctx context.Context, xPubID, id string, metadata Metadata) (*Transaction, error) + func (c *Client) UpdateXpubMetadata(ctx context.Context, xPubID string, metadata Metadata) (*Xpub, error) + func (c *Client) UserAgent() string + func (c *Client) Version() string + type ClientInterface interface + AuthenticateAccessKey func(ctx context.Context, pubAccessKey string) (*AccessKey, error) + Close func(ctx context.Context) error + Debug func(on bool) + DefaultSyncConfig func() *SyncConfig + EnableNewRelic func() + GetOrStartTxn func(ctx context.Context, name string) context.Context + IsDebug func() bool + IsEncryptionKeySet func() bool + IsIUCEnabled func() bool + IsMigrationEnabled func() bool + IsNewRelicEnabled func() bool + Metrics func() (metrics *metrics.Metrics, enabled bool) + SetNotificationsClient func(notifications.ClientInterface) + UserAgent func() string + Version func() string + func NewClient(ctx context.Context, opts ...ClientOps) (ClientInterface, error) + type ClientOps func(c *clientOptions) + func WithAutoMigrate(migrateModels ...interface{}) ClientOps + func WithBroadcastClient(broadcastClient broadcast.Client) ClientOps + func WithCallback(callbackURL string, callbackToken string) ClientOps + func WithChainstateOptions(broadcasting, broadcastInstant, paymailP2P, syncOnChain bool) ClientOps + func WithClusterClient(clusterClient cluster.ClientInterface) ClientOps + func WithClusterKeyPrefix(prefix string) ClientOps + func WithClusterRedis(redisOptions *redis.Options) ClientOps + func WithCronCustomPeriod(cronJobName string, period time.Duration) ClientOps + func WithCustomCachestore(cacheStore cachestore.ClientInterface) ClientOps + func WithCustomChainstate(chainState chainstate.ClientInterface) ClientOps + func WithCustomDatastore(dataStore datastore.ClientInterface) ClientOps + func WithCustomNotifications(customNotifications notifications.ClientInterface) ClientOps + func WithDebugging() ClientOps + func WithEncryption(key string) ClientOps + func WithExcludedProviders(providers []string) ClientOps + func WithFeeQuotes(enabled bool) ClientOps + func WithFeeUnit(feeUnit *utils.FeeUnit) ClientOps + func WithFreeCache() ClientOps + func WithFreeCacheConnection(client *freecache.Cache) ClientOps + func WithHTTPClient(httpClient HTTPInterface) ClientOps + func WithIUCDisabled() ClientOps + func WithLogger(customLogger *zerolog.Logger) ClientOps + func WithMAPI() ClientOps + func WithMetrics(collector metrics.Collector) ClientOps + func WithMigrationDisabled() ClientOps + func WithMinercraft(minercraft minercraft.ClientInterface) ClientOps + func WithMinercraftAPIs(miners []*minercraft.MinerAPIs) ClientOps + func WithModels(models ...interface{}) ClientOps + func WithMongoConnection(database *mongo.Database, tablePrefix string) ClientOps + func WithMongoDB(config *datastore.MongoDBConfig) ClientOps + func WithNewRelic(app *newrelic.Application) ClientOps + func WithNotifications(webhookEndpoint string) ClientOps + func WithPaymailBeefSupport(blockHeadersServiceURL, blockHeadersServiceAuthToken string) ClientOps + func WithPaymailClient(client paymail.ClientInterface) ClientOps + func WithPaymailServerConfig(config *server.Configuration, defaultFromPaymail string) ClientOps + func WithPaymailSupport(domains []string, defaultFromPaymail string, ...) ClientOps + func WithRedis(config *cachestore.RedisConfig) ClientOps + func WithRedisConnection(activeClient *cache.Client) ClientOps + func WithSQL(engine datastore.Engine, config *datastore.SQLConfig) ClientOps + func WithSQLConfigs(engine datastore.Engine, configs []*datastore.SQLConfig) ClientOps + func WithSQLConnection(engine datastore.Engine, sqlDB *sql.DB, tablePrefix string) ClientOps + func WithSQLite(config *datastore.SQLiteConfig) ClientOps + func WithTaskqConfig(config *taskq.QueueOptions) ClientOps + func WithUserAgent(userAgent string) ClientOps + type ClientService interface + Cachestore func() cachestore.ClientInterface + Chainstate func() chainstate.ClientInterface + Cluster func() cluster.ClientInterface + Datastore func() datastore.ClientInterface + HTTPClient func() HTTPInterface + Logger func() *zerolog.Logger + Notifications func() notifications.ClientInterface + PaymailClient func() paymail.ClientInterface + Taskmanager func() taskmanager.TaskEngine + type Destination struct + Address string + Chain uint32 + DraftID string + ID string + LockingScript string + Num uint32 + Type string + XpubID string + func (m *Destination) AfterCreated(ctx context.Context) error + func (m *Destination) AfterDeleted(ctx context.Context) error + func (m *Destination) AfterUpdated(ctx context.Context) error + func (m *Destination) BeforeCreating(_ context.Context) error + func (m *Destination) GetID() string + func (m *Destination) GetModelName() string + func (m *Destination) GetModelTableName() string + func (m *Destination) Migrate(client datastore.ClientInterface) error + func (m *Destination) Save(ctx context.Context) (err error) + type DestinationService interface + GetDestinationByAddress func(ctx context.Context, xPubID, address string) (*Destination, error) + GetDestinationByID func(ctx context.Context, xPubID, id string) (*Destination, error) + GetDestinationByLockingScript func(ctx context.Context, xPubID, lockingScript string) (*Destination, error) + GetDestinations func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) ([]*Destination, error) + GetDestinationsByXpubID func(ctx context.Context, xPubID string, usingMetadata *Metadata, ...) ([]*Destination, error) + GetDestinationsByXpubIDCount func(ctx context.Context, xPubID string, usingMetadata *Metadata, ...) (int64, error) + GetDestinationsCount func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) (int64, error) + NewDestination func(ctx context.Context, xPubKey string, chain uint32, destinationType string, ...) (*Destination, error) + NewDestinationForLockingScript func(ctx context.Context, xPubID, lockingScript string, opts ...ModelOps) (*Destination, error) + UpdateDestinationMetadataByAddress func(ctx context.Context, xPubID, address string, metadata Metadata) (*Destination, error) + UpdateDestinationMetadataByID func(ctx context.Context, xPubID, id string, metadata Metadata) (*Destination, error) + UpdateDestinationMetadataByLockingScript func(ctx context.Context, xPubID, lockingScript string, metadata Metadata) (*Destination, error) + type DraftStatus string + const DraftStatusCanceled + const DraftStatusComplete + const DraftStatusDraft + const DraftStatusExpired + func (t *DraftStatus) Scan(value interface{}) error + func (t DraftStatus) Value() (driver.Value, error) + type DraftTransaction struct + Configuration TransactionConfig + ExpiresAt time.Time + FinalTxID string + Status DraftStatus + XpubID string + func (m *DraftTransaction) AfterUpdated(ctx context.Context) error + func (m *DraftTransaction) BeforeCreating(ctx context.Context) (err error) + func (m *DraftTransaction) GetID() string + func (m *DraftTransaction) GetModelName() string + func (m *DraftTransaction) GetModelTableName() string + func (m *DraftTransaction) Migrate(client datastore.ClientInterface) error + func (m *DraftTransaction) Save(ctx context.Context) (err error) + func (m *DraftTransaction) SignInputs(xPriv *bip32.ExtendedKey) (signedHex string, err error) + func (m *DraftTransaction) SignInputsWithKey(xPrivKey string) (signedHex string, err error) + type DraftTransactionService interface + GetDraftTransactions func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) ([]*DraftTransaction, error) + GetDraftTransactionsCount func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) (int64, error) + type HTTPInterface interface + Do func(req *http.Request) (*http.Response, error) + type IDs []string + func (IDs) GormDBDataType(db *gorm.DB, _ *schema.Field) string + func (i *IDs) Scan(value interface{}) error + func (i IDs) GormDataType() string + func (i IDs) Value() (driver.Value, error) + type MapProtocol struct + App string + Keys map[string]interface{} + Type string + type Metadata map[string]interface + func (Metadata) GormDBDataType(db *gorm.DB, _ *schema.Field) string + func (m *Metadata) MarshalBSONValue() (bsontype.Type, []byte, error) + func (m *Metadata) Scan(value interface{}) error + func (m *Metadata) UnmarshalBSONValue(t bsontype.Type, data []byte) error + func (m Metadata) GormDataType() string + func (m Metadata) Value() (driver.Value, error) + type MockTransactionStore struct + Transactions map[string]*Transaction + func NewMockTransactionStore() *MockTransactionStore + func (m *MockTransactionStore) AddToStore(tx *Transaction) + func (m *MockTransactionStore) GetTransactionsByIDs(ctx context.Context, txIDs []string) ([]*Transaction, error) + type Model struct + CreatedAt time.Time + DeletedAt customTypes.NullTime + Metadata Metadata + UpdatedAt time.Time + func NewBaseModel(name ModelName, opts ...ModelOps) (m *Model) + func (m *Model) AfterCreated(_ context.Context) error + func (m *Model) AfterDeleted(_ context.Context) error + func (m *Model) AfterUpdated(_ context.Context) error + func (m *Model) BeforeUpdating(_ context.Context) error + func (m *Model) ChildModels() []ModelInterface + func (m *Model) Client() ClientInterface + func (m *Model) Display() interface{} + func (m *Model) GetID() string + func (m *Model) GetOptions(isNewRecord bool) (opts []ModelOps) + func (m *Model) IsNew() bool + func (m *Model) Name() string + func (m *Model) New() + func (m *Model) NotNew() + func (m *Model) RawXpub() string + func (m *Model) SetOptions(opts ...ModelOps) + func (m *Model) SetRecordTime(created bool) + func (m *Model) UpdateMetadata(metadata Metadata) + type ModelInterface interface + AfterCreated func(ctx context.Context) (err error) + AfterDeleted func(ctx context.Context) (err error) + AfterUpdated func(ctx context.Context) (err error) + BeforeCreating func(ctx context.Context) (err error) + BeforeUpdating func(ctx context.Context) (err error) + ChildModels func() []ModelInterface + Client func() ClientInterface + Display func() interface{} + GetID func() string + GetModelName func() string + GetModelTableName func() string + GetOptions func(isNewRecord bool) (opts []ModelOps) + IsNew func() bool + Migrate func(client datastore.ClientInterface) error + Name func() string + New func() + NotNew func() + RawXpub func() string + Save func(ctx context.Context) (err error) + SetOptions func(opts ...ModelOps) + SetRecordTime func(bool) + UpdateMetadata func(metadata Metadata) + type ModelName string + const ModelAccessKey + const ModelDestination + const ModelDraftTransaction + const ModelMetadata + const ModelNameEmpty + const ModelPaymailAddress + const ModelSyncTransaction + const ModelTransaction + const ModelUtxo + const ModelXPub + func (n ModelName) IsEmpty() bool + func (n ModelName) String() string + type ModelOps func(m *Model) + func New() ModelOps + func WithClient(client ClientInterface) ModelOps + func WithEncryptionKey(encryptionKey string) ModelOps + func WithMetadata(key string, value interface{}) ModelOps + func WithMetadataFromJSON(jsonData []byte) ModelOps + func WithMetadatas(metadata map[string]interface{}) ModelOps + func WithPageSize(pageSize int) ModelOps + func WithXPub(rawXpubKey string) ModelOps + type ModelService interface + AddModels func(ctx context.Context, autoMigrate bool, models ...interface{}) error + DefaultModelOptions func(opts ...ModelOps) []ModelOps + GetModelNames func() []string + type OpReturn struct + Hex string + HexParts []string + Map *MapProtocol + StringParts []string + type PaymailAddress struct + Alias string + Avatar string + Domain string + ExternalXpubKey string + ID string + PublicName string + XpubID string + func (m *PaymailAddress) AfterCreated(_ context.Context) error + func (m *PaymailAddress) BeforeCreating(_ context.Context) (err error) + func (m *PaymailAddress) GetExternalXpub() (*bip32.ExtendedKey, error) + func (m *PaymailAddress) GetID() string + func (m *PaymailAddress) GetIdentityXpub() (*bip32.ExtendedKey, error) + func (m *PaymailAddress) GetModelName() string + func (m *PaymailAddress) GetModelTableName() string + func (m *PaymailAddress) Migrate(client datastore.ClientInterface) error + func (m *PaymailAddress) Save(ctx context.Context) (err error) + type PaymailDefaultServiceProvider struct + func (p *PaymailDefaultServiceProvider) CreateAddressResolutionResponse(ctx context.Context, alias, domain string, _ bool, ...) (*paymail.ResolutionPayload, error) + func (p *PaymailDefaultServiceProvider) CreateP2PDestinationResponse(ctx context.Context, alias, domain string, satoshis uint64, ...) (*paymail.PaymentDestinationPayload, error) + func (p *PaymailDefaultServiceProvider) GetPaymailByAlias(ctx context.Context, alias, domain string, ...) (*paymail.AddressInformation, error) + func (p *PaymailDefaultServiceProvider) RecordTransaction(ctx context.Context, p2pTx *paymail.P2PTransaction, ...) (*paymail.P2PTransactionPayload, error) + func (p *PaymailDefaultServiceProvider) VerifyMerkleRoots(ctx context.Context, merkleRoots []*spv.MerkleRootConfirmationRequestItem) (err error) + type PaymailP4 struct + Alias string + Domain string + Format PaymailPayloadFormat + FromPaymail string + Note string + PubKey string + ReceiveEndpoint string + ReferenceID string + ResolutionType string + type PaymailPayloadFormat uint32 + const BasicPaymailPayloadFormat + const BeefPaymailPayloadFormat + func (format PaymailPayloadFormat) String() string + type PaymailServerOptions struct + DefaultFromPaymail string + type PaymailService interface + DeletePaymailAddress func(ctx context.Context, address string, opts ...ModelOps) error + GetPaymailAddress func(ctx context.Context, address string, opts ...ModelOps) (*PaymailAddress, error) + GetPaymailAddressesByXPubID func(ctx context.Context, xPubID string, metadataConditions *Metadata, ...) ([]*PaymailAddress, error) + GetPaymailConfig func() *PaymailServerOptions + NewPaymailAddress func(ctx context.Context, key, address, publicName, avatar string, opts ...ModelOps) (*PaymailAddress, error) + UpdatePaymailAddress func(ctx context.Context, address, publicName, avatar string, opts ...ModelOps) (*PaymailAddress, error) + UpdatePaymailAddressMetadata func(ctx context.Context, address string, metadata Metadata, opts ...ModelOps) (*PaymailAddress, error) + type ScriptOutput struct + Address string + Satoshis uint64 + Script string + ScriptType string + type SyncConfig struct + Broadcast bool + BroadcastInstant bool + PaymailP2P bool + SyncOnChain bool + func (t *SyncConfig) Scan(value interface{}) error + func (t SyncConfig) Value() (driver.Value, error) + type SyncResult struct + Action string + ExecutedAt time.Time + Provider string + StatusMessage string + type SyncResults struct + LastMessage string + Results []*SyncResult + func (t *SyncResults) Scan(value interface{}) error + func (t SyncResults) Value() (driver.Value, error) + type SyncStatus string + const SyncStatusCanceled + const SyncStatusComplete + const SyncStatusError + const SyncStatusPending + const SyncStatusProcessing + const SyncStatusReady + const SyncStatusSkipped + func (t *SyncStatus) Scan(value interface{}) error + func (t SyncStatus) String() string + func (t SyncStatus) Value() (driver.Value, error) + type SyncTransaction struct + BroadcastStatus SyncStatus + Configuration SyncConfig + ID string + LastAttempt customTypes.NullTime + P2PStatus SyncStatus + Results SyncResults + SyncStatus SyncStatus + func GetSyncTransactionByID(ctx context.Context, id string, opts ...ModelOps) (*SyncTransaction, error) + func GetSyncTransactionByTxID(ctx context.Context, txID string, opts ...ModelOps) (*SyncTransaction, error) + func (m *SyncTransaction) AfterCreated(_ context.Context) error + func (m *SyncTransaction) BeforeCreating(_ context.Context) error + func (m *SyncTransaction) BeforeUpdating(_ context.Context) error + func (m *SyncTransaction) GetID() string + func (m *SyncTransaction) GetModelName() string + func (m *SyncTransaction) GetModelTableName() string + func (m *SyncTransaction) Migrate(client datastore.ClientInterface) error + func (m *SyncTransaction) Save(ctx context.Context) error + type Transaction struct + BUMP BUMP + BlockHash string + BlockHeight uint64 + Direction TransactionDirection + DraftID string + Fee uint64 + NumberOfInputs uint32 + NumberOfOutputs uint32 + OutputValue int64 + Status SyncStatus + TotalValue uint64 + TxStatus string + XPubID string + XpubInIDs IDs + XpubMetadata XpubMetadata + XpubOutIDs IDs + XpubOutputValue XpubOutputValue + func (m *Transaction) AfterCreated(ctx context.Context) error + func (m *Transaction) AfterDeleted(_ context.Context) error + func (m *Transaction) AfterUpdated(_ context.Context) error + func (m *Transaction) BeforeCreating(_ context.Context) error + func (m *Transaction) ChildModels() (childModels []ModelInterface) + func (m *Transaction) Display() interface{} + func (m *Transaction) GetID() string + func (m *Transaction) GetModelName() string + func (m *Transaction) GetModelTableName() string + func (m *Transaction) IsXpubAssociated(rawXpubKey string) bool + func (m *Transaction) IsXpubIDAssociated(xPubID string) bool + func (m *Transaction) Migrate(client datastore.ClientInterface) error + func (m *Transaction) Save(ctx context.Context) (err error) + func (m *Transaction) UpdateTransactionMetadata(xPubID string, metadata Metadata) error + type TransactionBase struct + Hex string + ID string + type TransactionConfig struct + ChangeDestinations []*Destination + ChangeDestinationsStrategy ChangeStrategy + ChangeMinimumSatoshis uint64 + ChangeNumberOfDestinations int + ChangeSatoshis uint64 + ExpiresIn time.Duration + Fee uint64 + FeeUnit *utils.FeeUnit + FromUtxos []*UtxoPointer + IncludeUtxos []*UtxoPointer + Inputs []*TransactionInput + Outputs []*TransactionOutput + SendAllTo *TransactionOutput + Sync *SyncConfig + func (t *TransactionConfig) Scan(value interface{}) error + func (t TransactionConfig) Value() (driver.Value, error) + type TransactionDirection string + const TransactionDirectionIn + const TransactionDirectionOut + const TransactionDirectionReconcile + type TransactionGetter interface + GetTransactionsByIDs func(ctx context.Context, txIDs []string) ([]*Transaction, error) + type TransactionInput struct + Destination Destination + type TransactionOutput struct + OpReturn *OpReturn + PaymailP4 *PaymailP4 + Satoshis uint64 + Script string + Scripts []*ScriptOutput + To string + UseForChange bool + type TransactionService interface + GetTransaction func(ctx context.Context, xPubID, txID string) (*Transaction, error) + GetTransactionByHex func(ctx context.Context, hex string) (*Transaction, error) + GetTransactions func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) ([]*Transaction, error) + GetTransactionsByIDs func(ctx context.Context, txIDs []string) ([]*Transaction, error) + GetTransactionsByXpubID func(ctx context.Context, xPubID string, metadata *Metadata, ...) ([]*Transaction, error) + GetTransactionsByXpubIDCount func(ctx context.Context, xPubID string, metadata *Metadata, ...) (int64, error) + GetTransactionsCount func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) (int64, error) + NewTransaction func(ctx context.Context, rawXpubKey string, config *TransactionConfig, ...) (*DraftTransaction, error) + RecordRawTransaction func(ctx context.Context, txHex string, opts ...ModelOps) (*Transaction, error) + RecordTransaction func(ctx context.Context, xPubKey, txHex, draftID string, opts ...ModelOps) (*Transaction, error) + RevertTransaction func(ctx context.Context, id string) error + UpdateTransaction func(ctx context.Context, txInfo *broadcast.SubmittedTx) error + UpdateTransactionMetadata func(ctx context.Context, xPubID, id string, metadata Metadata) (*Transaction, error) + type UTXOService interface + GetUtxo func(ctx context.Context, xPubKey, txID string, outputIndex uint32) (*Utxo, error) + GetUtxoByTransactionID func(ctx context.Context, txID string, outputIndex uint32) (*Utxo, error) + GetUtxos func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) ([]*Utxo, error) + GetUtxosByXpubID func(ctx context.Context, xPubID string, metadata *Metadata, ...) ([]*Utxo, error) + GetUtxosCount func(ctx context.Context, metadata *Metadata, conditions *map[string]interface{}, ...) (int64, error) + UnReserveUtxos func(ctx context.Context, xPubID, draftID string) error + type Utxo struct + DraftID customTypes.NullString + ID string + ReservedAt customTypes.NullTime + Satoshis uint64 + ScriptPubKey string + SpendingTxID customTypes.NullString + Transaction *Transaction + Type string + XpubID string + func (m *Utxo) BeforeCreating(_ context.Context) error + func (m *Utxo) GenerateID() string + func (m *Utxo) GetID() string + func (m *Utxo) GetModelName() string + func (m *Utxo) GetModelTableName() string + func (m *Utxo) Migrate(client datastore.ClientInterface) error + func (m *Utxo) Save(ctx context.Context) (err error) + type UtxoPointer struct + OutputIndex uint32 + TransactionID string + type XPubService interface + GetXpub func(ctx context.Context, xPubKey string) (*Xpub, error) + GetXpubByID func(ctx context.Context, xPubID string) (*Xpub, error) + NewXpub func(ctx context.Context, xPubKey string, opts ...ModelOps) (*Xpub, error) + UpdateXpubMetadata func(ctx context.Context, xPubID string, metadata Metadata) (*Xpub, error) + type Xpub struct + CurrentBalance uint64 + ID string + NextExternalNum uint32 + NextInternalNum uint32 + func (m *Xpub) AfterCreated(ctx context.Context) error + func (m *Xpub) AfterUpdated(ctx context.Context) error + func (m *Xpub) BeforeCreating(_ context.Context) error + func (m *Xpub) ChildModels() (childModels []ModelInterface) + func (m *Xpub) GetID() string + func (m *Xpub) GetModelName() string + func (m *Xpub) GetModelTableName() string + func (m *Xpub) Migrate(client datastore.ClientInterface) error + func (m *Xpub) RemovePrivateData() + func (m *Xpub) Save(ctx context.Context) error + type XpubMetadata map[string]Metadata + func (XpubMetadata) GormDBDataType(db *gorm.DB, _ *schema.Field) string + func (x *XpubMetadata) MarshalBSONValue() (bsontype.Type, []byte, error) + func (x *XpubMetadata) Scan(value interface{}) error + func (x *XpubMetadata) UnmarshalBSONValue(t bsontype.Type, data []byte) error + func (x XpubMetadata) Value() (driver.Value, error) + type XpubOutputValue map[string]int64 + func (XpubOutputValue) GormDBDataType(db *gorm.DB, _ *schema.Field) string + func (x *XpubOutputValue) Scan(value interface{}) error + func (x XpubOutputValue) Value() (driver.Value, error)