Documentation ¶
Index ¶
- Constants
- Variables
- func AddressFromHash160(hash [20]byte, params *chaincfg.Params, isScript bool) (btcutil.Address, error)
- func CalcSignatureHash(subScript []byte, hashType txscript.SigHashType, tx *zecutil.MsgTx, idx int, ...) ([]byte, error)
- func DecodeAddress(address string, params *chaincfg.Params) (btcutil.Address, error)
- func NewErrInsufficientBalance(address string, required, current int64) error
- func NewErrUnsupportedNetwork(network string) error
- func NewErrZCashSubmitTx(msg string) error
- func PayToAddrScript(address btcutil.Address) ([]byte, error)
- func SuggestedTxRate(txSpeed TxExecutionSpeed) (int64, error)
- type Account
- type Client
- type Tx
- type TxBuilder
- type TxExecutionSpeed
- type Wallet
Constants ¶
const ( Nil = TxExecutionSpeed(iota) Slow Standard Fast )
TxExecutionSpeed values.
const MaxZCashFee = int64(10000)
const ZCashDust = 600
const ZCashExpiryHeight = 6000000
Variables ¶
var ErrMismatchedPubKeys = fmt.Errorf("failed to fund the transaction mismatched script public keys")
var ErrNoSpendingTransactions = fmt.Errorf("No spending transactions")
var ErrPostConditionCheckFailed = errors.New("post-condition check failed")
ErrPostConditionCheckFailed indicates that the post-condition for executing a transaction failed.
var ErrPreConditionCheckFailed = errors.New("pre-condition check failed")
ErrPreConditionCheckFailed indicates that the pre-condition for executing a transaction failed.
var ErrTimedOut = errors.New("timed out")
Functions ¶
func AddressFromHash160 ¶
func CalcSignatureHash ¶
func DecodeAddress ¶
func NewErrZCashSubmitTx ¶
func SuggestedTxRate ¶
func SuggestedTxRate(txSpeed TxExecutionSpeed) (int64, error)
SuggestedTxRate returns the gas price that zcashfees.earn.com recommends for transactions to be mined on ZCash blockchain based on the speed provided.
Types ¶
type Account ¶
type Account interface { Client BTCClient() Client Address() (btcutil.Address, error) SerializedPublicKey() ([]byte, error) Transfer(ctx context.Context, to string, value int64, speed TxExecutionSpeed, sendAll bool) (string, int64, error) SendTransaction( ctx context.Context, script []byte, speed TxExecutionSpeed, updateTxIn func(*wire.TxIn), preCond func(*wire.MsgTx) bool, f func(*txscript.ScriptBuilder), postCond func(*wire.MsgTx) bool, sendAll bool, ) (string, int64, error) }
Account is an ZCash external account that can sign and submit transactions to the ZCash blockchain. An Account is an abstraction over the ZCash blockchain.
func NewAccount ¶
func NewAccount(client Client, privateKey *ecdsa.PrivateKey, logger logrus.FieldLogger) Account
NewAccount returns a user account for the provided private key which is connected to a ZCash client.
type Client ¶
type Client interface { clients.ClientCore // Balance of the given address on ZCash blockchain. Balance(address string, confirmations int64) (int64, error) // FormatTransactionView formats the message and txhash into a user friendly // message. FormatTransactionView(msg, txhash string) string // SerializePublicKey serializes the given public key. SerializePublicKey(pubKey *btcec.PublicKey) ([]byte, error) // PublicKeyToAddress converts the public key to a zcash address. PublicKeyToAddress(pubKeyBytes []byte) (btcutil.Address, error) // SlaveAddress creates an a deterministic unique address that can be spent // by the private key correspndong to the given master public key hash SlaveAddress(mpkh, nonce []byte) (btcutil.Address, error) // SlaveScript creates a deterministic unique script that can be spent by // the private key correspndong to the given master public key hash SlaveScript(mpkh, nonce []byte) ([]byte, error) // UTXOCount returns the number of utxos that can be spent. UTXOCount(address string, confirmations int64) (int, error) // Validate returns whether an address is valid or not Validate(address string) error }
func NewChainSoClient ¶
func NewMercuryClient ¶
type TxBuilder ¶
type TxBuilder interface {
Build(pubKey ecdsa.PublicKey, to string, contract []byte, value int64, mwUTXOs, scriptUTXOs []clients.UTXO) (Tx, error)
}
The TxBuilder can build txs, that allow the user to extract the hashes to be signed.
func NewTxBuilder ¶
NewTxBuilder creates a new tx builder.
type TxExecutionSpeed ¶
type TxExecutionSpeed uint8
The TxExecutionSpeed indicates the tier of speed that the transaction falls under while writing to the blockchain.