api

package
v1.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func Init

func Init(config *configs.Config, utxoMonitor UtxoMonitor) (*API, error)

func (*API) CreateAddress

func (api *API) CreateAddress(addresses ...Address) error

func (*API) CreateEmail

func (api *API) CreateEmail(userId string, email string, description string, pubkey string) error

func (*API) CreateUser

func (api *API) CreateUser() (User, error)

func (*API) CreateWebhook

func (api *API) CreateWebhook(userId string, name string, url string) error

func (*API) CreateXpub

func (api *API) CreateXpub(userId string, pubkey string, name *string, gap int) (Xpub, error)

func (*API) DeleteAddress

func (api *API) DeleteAddress(userId string, addressId string) error

func (*API) DeleteAddresses

func (api *API) DeleteAddresses(userId string) error

func (*API) DeleteEmail

func (api *API) DeleteEmail(userId string, notificationId string) error

func (*API) DeleteEmails

func (api *API) DeleteEmails(userId string) error

func (*API) DeleteUserXpubs

func (api *API) DeleteUserXpubs(userId string) error

func (*API) DeleteWebhook

func (api *API) DeleteWebhook(userId string, notificationId string) error

func (*API) DeleteWebhooks

func (api *API) DeleteWebhooks(userId string) error

func (*API) DeleteXpub

func (api *API) DeleteXpub(userId string, xpubId string) error

func (*API) GetAddress

func (api *API) GetAddress(address string) (*Address, error)

func (*API) GetAddressById

func (api *API) GetAddressById(addressId string, userId string) (*Address, error)

func (*API) GetAddresses

func (api *API) GetAddresses() []Address

func (*API) GetAddressesForUser

func (api *API) GetAddressesForUser(userId string) []Address

func (*API) GetAddressesForXpub

func (api *API) GetAddressesForXpub(userId string, xpubId string) []Address

func (*API) GetAddressesWithoutXpub

func (api *API) GetAddressesWithoutXpub(userId string) []Address

func (*API) GetDailyEmailCount

func (api *API) GetDailyEmailCount(address_id string, user_id string) (int, error)

func (*API) GetEmail

func (api *API) GetEmail(userId string, notificationId string) (Email, error)

func (*API) GetEmailByAddress

func (api *API) GetEmailByAddress(userId string, address string) (Email, error)

func (*API) GetUser

func (api *API) GetUser(userId string) (User, error)

func (*API) GetUserByUsername

func (api *API) GetUserByUsername(username string) (User, error)

func (*API) GetUserEmails

func (api *API) GetUserEmails(userId string) ([]Email, error)

func (*API) GetUserWebhooks

func (api *API) GetUserWebhooks(userId string) ([]Webhook, error)

func (*API) GetVerifiedUserEmails

func (api *API) GetVerifiedUserEmails(userId string) ([]Email, error)

func (*API) GetWebhook

func (api *API) GetWebhook(userId string, id string) (Webhook, error)

func (*API) GetWebhooks

func (api *API) GetWebhooks() ([]Webhook, error)

func (*API) GetXpub

func (api *API) GetXpub(userId string, xpub_id string) (Xpub, error)

func (*API) GetXpubs

func (api *API) GetXpubs(userId string) ([]Xpub, error)

func (*API) LogAlertEmail

func (api *API) LogAlertEmail(email string, user_id string, address_id string, transaction_id string, emailError error) error

func (*API) ResetVerificationCode

func (api *API) ResetVerificationCode(userId string, notificationId string) (Email, error)

func (*API) SoftDeleteUser

func (api *API) SoftDeleteUser(userId string) error

func (*API) UpdateAddressUTXOs

func (api *API) UpdateAddressUTXOs(scriptHash string, utxos []*electrum.ListUnspentResult) error

func (*API) UpdateEmailDescription

func (api *API) UpdateEmailDescription(userId string, notificationId string, description string) error

func (*API) UpdateEmailPubkey

func (api *API) UpdateEmailPubkey(userId string, notificationId string, pubkey string) error

func (*API) UpdateWebhook

func (api *API) UpdateWebhook(userId string, notificationId string, url string, name string) error

func (*API) VerifyEmail

func (api *API) VerifyEmail(userId string, notificationId string, verificationCode string) error

type Address

type Address struct {
	Model
	UserID       string  `db:"user_id"`
	XpubID       *string `db:"xpub_id"`
	Address      string  `form:"address"`
	Scripthash   string  `db:"scripthash"`
	Name         *string `form:"name"`
	IsExternal   bool    `db:"is_external"`
	AddressIndex int     `db:"address_index"`
	UTXOs        []*electrum.ListUnspentResult
}

type DB added in v1.1.4

type DB interface {
	Ping(ctx context.Context) error
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	Select(ctx context.Context, dest any, query string, args ...any) error
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}

type Email

type Email struct {
	Model
	UserID              string     `db:"user_id"`
	Description         string     `form:"description"`
	Email               string     `form:"email"`
	IsVerified          bool       `db:"is_verified"`
	VerificationCode    string     `db:"verification_code"`
	VerificationExpires *time.Time `db:"verification_expires"`
	VerifiedOn          *time.Time `db:"verified_on"`
	Pubkey              *string    `db:"pgp_pubkey"`
}

type Model

type Model struct {
	ID        string
	CreatedAt *time.Time `db:"created_at"`
	UpdatedAt *time.Time `db:"updated_at"`
	DeletedAt *time.Time `db:"deleted_at"`
}

type User

type User struct {
	Model

	Username     string
	PasswordHash string `db:"password_hash"`
	IsAdmin      bool   `db:"is_admin"`
	// contains filtered or unexported fields
}

type UtxoMonitor

type UtxoMonitor interface {
	EnqueueScan(scriptHash string)
	GetUtxoStream() <-chan interface{}
}

type UtxoResult

type UtxoResult interface {
	GetScriptHash() string
	GetUtxoData() []*electrum.ListUnspentResult
}

type Webhook

type Webhook struct {
	Model
	UserID string `db:"user_id"`
	Name   string `form:"name" binding:"required"`
	Url    string `form:"url" binding:"required,http_url,startswith=https"`
}

type Xpub

type Xpub struct {
	Model
	UserID string  `db:"user_id"`
	Pubkey string  `form:"pubkey" binding:"required"`
	Name   *string `form:"name"`
	Gap    int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL