user

package
v0.0.0-...-d30b7db Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Copyright (c) 2019 Romano (Viacoin developer) Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.

Index

Constants

View Source
const ErrNotEnoughBalance = "16: bad-txns-vout-negative. Code:-26"

type errorBroadcast string

View Source
const ErrNotEnoughFee = "66: insufficient priority. Code:-26"
View Source
const ErrTransactionTooSmall = "64: dust. Code:-26"
View Source
const ErrTxDecodeFailed = "Something seems wrong: TX decode failed. Code:-22"

Variables

This section is empty.

Functions

func BroadcastTransaction

func BroadcastTransaction(network bcoins.Network, tx bcoins.Transaction) (insightjson.Txid, bcoins.Transaction, error)

broadcast a signed transaction to the blockexplorer. the transaction will either be denied or rejected by the network

func GetInsightExplorer

func GetInsightExplorer(symbol string) (bcoins.Insight, error)

func SelectNetwork

func SelectNetwork(symbol string) (bcoins.Network, error)

Types

type UTXO

type UTXO struct {
	Hash      *chainhash.Hash
	TxIndex   uint32
	Amount    int64
	Spendable bool
	PKScript  []byte
}

type User

type User struct {
	Id             uint32 `json:"id"`
	Twitter_id     int64  `json:"twitter_id"`
	Telegram_id    int    `json:"telegram_id"`
	Username       string `json:"username"`
	Social         string `json:"social"`
	RegisteredDate int64  `json:"registered_date"`
}

func (User) AddressInfo

func (user User) AddressInfo(network bcoins.Network) (*insightjson.AddressInfo, error)

func (User) BuildSignedTx

func (user User) BuildSignedTx(network bcoins.Network, destination string, amount int64, fee int64) (bcoins.Transaction, error)

build a signed transaction by using the Network, destination, amount and fee the required UTXO will be spent and the change will be send back

func (User) GetUnspentOutputs

func (user User) GetUnspentOutputs(network bcoins.Network) []*UTXO

func (User) PayTo

func (user User) PayTo(network bcoins.Network, destination string, amount float64) (insightjson.Txid, bcoins.Transaction, error)

prepare for allowing the user to create a payment to a destination address. this function will build a signed transaction & broadcast it

func (User) PrivateKey

func (user User) PrivateKey() *hdkeychain.ExtendedKey

generate private key by using the app.yml file with the master key

func (User) PrivateKeyWif

func (user User) PrivateKeyWif(network bcoins.Network) *btcutil.WIF

convert the key to a wif format

func (User) PublicKey

func (user User) PublicKey(network bcoins.Network) *btcutil.AddressPubKeyHash

generate a public key by using the private key the public key is in a compressed format

func (User) Withdraw

func (user User) Withdraw(network bcoins.Network, destination string) (insightjson.Txid, bcoins.Transaction, error)

withdraw entire balance & use the correct fee. This function is similair to the PayTo() function

Jump to

Keyboard shortcuts

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