bitcoincash

package
v0.0.0-...-b2d66a9 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BCH_FEE               = 330
	PAYMENT_GATE_SETTINGS = settings.LoadPaymentGateSettings()
)

Functions

func ConfigureRouter

func ConfigureRouter(router *web.Router)

func GetRecomnededFee

func GetRecomnededFee() (int, error)

func GetUnspentBitcoinCashTransactions

func GetUnspentBitcoinCashTransactions(w BitcoinCashWallet) ([]insight.Tx, error)

func MigrateBTCToBCH

func MigrateBTCToBCH()

func PushBitcoinCashTransaction

func PushBitcoinCashTransaction(rawtx string) error

func SetupViews

func SetupViews()

func SweepBitcoinCashWallet

func SweepBitcoinCashWallet(addressFrom string, addressTo string)

func SweepCommissionAndPremiumBitcoinCashWallets

func SweepCommissionAndPremiumBitcoinCashWallets(addressTo string)

func TaskUpdateBitcoinCashTransactionFee

func TaskUpdateBitcoinCashTransactionFee()

func TaskUpdateBitcoinCashWalletBalances

func TaskUpdateBitcoinCashWalletBalances()

func UpdateBCHTransactionFee

func UpdateBCHTransactionFee()

func UpdateBitcoinCashWalletBalances

func UpdateBitcoinCashWalletBalances()

func ViewCreateBitcoinCashWallet

func ViewCreateBitcoinCashWallet(w web.ResponseWriter, r *web.Request)

func ViewCreateMultisigBitcoinCashWallet

func ViewCreateMultisigBitcoinCashWallet(w web.ResponseWriter, r *web.Request)

func ViewEstimateFeeFromMultipleBitcoinCashWalletsWithAmountSplit

func ViewEstimateFeeFromMultipleBitcoinCashWalletsWithAmountSplit(w web.ResponseWriter, r *web.Request)

func ViewListBitcoinCashWalletsWithPositiveBalance

func ViewListBitcoinCashWalletsWithPositiveBalance(w web.ResponseWriter, r *web.Request)

func ViewSendFromMultipleBitcoinCashWalletsWithAmountSplit

func ViewSendFromMultipleBitcoinCashWalletsWithAmountSplit(w web.ResponseWriter, r *web.Request)

func ViewSendFromSingleBitcoinCashWalletWithPercentSplit

func ViewSendFromSingleBitcoinCashWalletWithPercentSplit(w web.ResponseWriter, r *web.Request)

func ViewShowBitcoinCashWallet

func ViewShowBitcoinCashWallet(w web.ResponseWriter, r *web.Request)

func ViewTableListBitcoinCashWalletsWithPositiveBalance

func ViewTableListBitcoinCashWalletsWithPositiveBalance(w web.ResponseWriter, r *web.Request)

func ViewUpdateBitcoinCashWallets

func ViewUpdateBitcoinCashWallets(w web.ResponseWriter, r *web.Request)

Types

type BCHPayment

type BCHPayment struct {
	Address string  `json:"address"`
	Percent float64 `json:"percent"`
	Amount  float64 `json:"amount"`
}

type BCHPaymentResult

type BCHPaymentResult struct {
	Fee            int                `json:"fee"`
	RawTransaction string             `json:"rawTransaction"`
	Outputs        []insight.TxOutput `json:"outputs"`
	Hash           string             `json:"hash"`
	Error          *string            `json:"error"`
	Description    string             `json:"description"`
}

func BuildRawBitcoinCashTransaction

func BuildRawBitcoinCashTransaction(
	outputs []insight.TxOutput,
	utxoSet []insight.UtxoSet,
	feePerByte int,
	feeOutput int,
	feeOnly bool,
) (BCHPaymentResult, error)

type BitcoinCashWallet

type BitcoinCashWallet struct {
	PublicKey  string `json:"address" gorm:"primary_key"`
	PrivateKey string `json:"private_key,omitempty" sql:"type:varchar(1024)"`

	// Multisig
	BuyerPublicKey    string `json:"buyer_public_key"`
	SellerPublicKey   string `json:"seller_public_key"`
	MultisigPublicKey string `json:"multisig_public_key"`
	MultisigAddress   string `json:"multisig_address"`

	Type string `json:"type"`

	CreatedAt *time.Time `json:"created_at,omitempty" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at,omitempty" gorm:"index"`
}

func CreateBitcoinCashWallet

func CreateBitcoinCashWallet(tp string) (BitcoinCashWallet, error)

func CreateMultisigBitcoinCashWallet

func CreateMultisigBitcoinCashWallet(buyerPublicKey, sellerPublicKey string) (BitcoinCashWallet, error)

func FindAllBitcoinCashWallets

func FindAllBitcoinCashWallets() ([]BitcoinCashWallet, error)

func FindBitcoinCashWalletByPublicKey

func FindBitcoinCashWalletByPublicKey(publicKey string) (*BitcoinCashWallet, error)

func (BitcoinCashWallet) CurrentBalance

func (w BitcoinCashWallet) CurrentBalance() (*BitcoinCashWalletBalance, error)

func (BitcoinCashWallet) Remove

func (w BitcoinCashWallet) Remove() error

func (BitcoinCashWallet) Save

func (w BitcoinCashWallet) Save() error

func (BitcoinCashWallet) SaveToDatabase

func (w BitcoinCashWallet) SaveToDatabase() error

func (BitcoinCashWallet) SendWithPercentSplit

func (w BitcoinCashWallet) SendWithPercentSplit(payments []BCHPayment) (BCHPaymentResult, error)

func (BitcoinCashWallet) UpdateBalance

func (w BitcoinCashWallet) UpdateBalance() (*BitcoinCashWalletBalance, error)

func (BitcoinCashWallet) Validate

func (w BitcoinCashWallet) Validate() error

type BitcoinCashWalletBalance

type BitcoinCashWalletBalance struct {
	ID                             int     `json:"id" gorm:"primary_key"`
	PublicKey                      string  `json:"address" gorm:"index"`
	Balance                        float64 `json:"balance"`
	BalanceTxApperances            int     `json:"txApperances"`
	UnconfirmedBalance             float64 `json:"unconfirmedBalance"`
	UnconfirmedBalanceTxApperances int     `json:"unconfirmedTxApperances"`

	CreatedAt *time.Time `json:"created_at" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"index"`

	BitcoinCashWallet BitcoinCashWallet `json:"-" gorm:"ForeignKey:PublicKey;AssociationForeignKey:PublicKey"`
}

func FindAllBitcoinCashWalletBalances

func FindAllBitcoinCashWalletBalances() ([]BitcoinCashWalletBalance, error)

func FindBitcoinCashWalletsWithNonZeroBalance

func FindBitcoinCashWalletsWithNonZeroBalance() ([]BitcoinCashWalletBalance, error)

func FindBitcoinCashWalletsWithNonZeroBalanceByType

func FindBitcoinCashWalletsWithNonZeroBalanceByType(tp string) ([]BitcoinCashWalletBalance, error)

func GetBitcoinCashWalletBalance

func GetBitcoinCashWalletBalance(w BitcoinCashWallet) (*BitcoinCashWalletBalance, error)

func (BitcoinCashWalletBalance) DisplayBitcoinCashWallet

func (w BitcoinCashWalletBalance) DisplayBitcoinCashWallet() DisplayBitcoinCashWallet

func (BitcoinCashWalletBalance) Remove

func (w BitcoinCashWalletBalance) Remove() error

func (BitcoinCashWalletBalance) Save

type BitcoinCashWallets

type BitcoinCashWallets []BitcoinCashWallet

func (BitcoinCashWallets) BuildTransactionWithAmountSplit

func (wts BitcoinCashWallets) BuildTransactionWithAmountSplit(payments []BCHPayment, feeOnly bool) (BCHPaymentResult, error)

func (BitcoinCashWallets) BuildTransactionWithPercentSplit

func (wts BitcoinCashWallets) BuildTransactionWithPercentSplit(
	payments []BCHPayment,
	txfeeOnly bool,
) (BCHPaymentResult, error)

func (BitcoinCashWallets) SendWithAmountSplit

func (wts BitcoinCashWallets) SendWithAmountSplit(payments []BCHPayment) (BCHPaymentResult, error)

func (BitcoinCashWallets) SendWithPercentSplit

func (wts BitcoinCashWallets) SendWithPercentSplit(payments []BCHPayment) (BCHPaymentResult, error)

type DisplayBitcoinCashWallet

type DisplayBitcoinCashWallet struct {
	PublicKey             string     `json:"address"`
	Balance               float64    `json:"balance"`
	UnconfirmedBalance    float64    `json:"unconfirmed_balance"`
	IsConfirmed           bool       `json:"-"`
	NumberOfConfirmations int        `json:"-"`
	Type                  string     `json:"type"`
	CreatedAt             *time.Time `json:"created_at"`
	UpdatedAt             *time.Time `json:"updated_at"`
}

type ViewListBitcoinCashWalletsWithPositiveBalanceResponse

type ViewListBitcoinCashWalletsWithPositiveBalanceResponse struct {
	DisplayBitcoinCashWallets []DisplayBitcoinCashWallet `json:"wallets"`
	SummaryBalance            float64                    `json:"balance"`
}

Jump to

Keyboard shortcuts

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