Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeAddressToCashAddr(address string, params *chaincfg.Params) (string, error)
- func DecodeAddressToLegacyAddr(address string, params *chaincfg.Params) (string, error)
- func IsCashAddrAddress(address string, params *chaincfg.Params) (bool, error)
- func IsLegacyAddress(address string, params *chaincfg.Params) (bool, error)
- func ValidateAddress(addrress string) bool
- type BCH
- type CalculateTxSizeData
- type Config
- type GenerateAddressData
- type TxBuilder
- func (s *TxBuilder) AddInput(input TxInput) error
- func (s *TxBuilder) AddOutput(address string, amount decimal.Decimal) error
- func (s *TxBuilder) CalculateTxSize(feePerByte decimal.Decimal) CalculateTxSizeData
- func (s *TxBuilder) EmulateTxSize(feePerByte decimal.Decimal) (CalculateTxSizeData, error)
- func (s *TxBuilder) MsgTx() *wire.MsgTx
- func (s *TxBuilder) SignTx() error
- type TxInput
- type WalletSDK
- func (s WalletSDK) AddressFromPrivateKey(privateKeyWIF string) (string, *bchec.PrivateKey, error)
- func (s WalletSDK) ChainParams() *chaincfg.Params
- func (s WalletSDK) GenerateAddress(mnemonic, passphrase string, sequenceNumber uint32) (*GenerateAddressData, error)
- func (s WalletSDK) ValidateAddress(address string) bool
Constants ¶
View Source
const ( AssetIdentifier = "bch" AssetDecimals = 1e8 )
Variables ¶
View Source
var ( ErrInputAlreadyUsed = errors.New("input already used") ErrOutputAlreadyExists = errors.New("output already exists") )
Functions ¶
func DecodeAddressToCashAddr ¶
func IsCashAddrAddress ¶
func ValidateAddress ¶
Types ¶
type CalculateTxSizeData ¶
type Config ¶
type Config struct {
RPCConfig *rpcclient.ConnConfig
}
type GenerateAddressData ¶
type GenerateAddressData struct {
Address *bchutil.AddressPubKeyHash
PublicKey *bchec.PublicKey
PrivateKey *bchec.PrivateKey
PrivateKeyWIF *bchutil.WIF
MasterKey *hdkeychain.ExtendedKey
Sequence uint32
// contains filtered or unexported fields
}
func (GenerateAddressData) AddressPubKey ¶
func (s GenerateAddressData) AddressPubKey() (string, error)
type TxBuilder ¶
type TxBuilder struct {
Inputs []TxInput
// contains filtered or unexported fields
}
func NewTxBuilder ¶
func (*TxBuilder) CalculateTxSize ¶
func (s *TxBuilder) CalculateTxSize(feePerByte decimal.Decimal) CalculateTxSizeData
CalculateTxSize calculates the size of the transaction and the fee for it.
Docs: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#transaction-size-calculations
func (*TxBuilder) EmulateTxSize ¶
func (s *TxBuilder) EmulateTxSize(feePerByte decimal.Decimal) (CalculateTxSizeData, error)
EmulateTxSize calculates the size of the transaction and the fee for it.
type WalletSDK ¶
type WalletSDK struct {
// contains filtered or unexported fields
}
func NewWalletSDK ¶
NewWalletSDK creates a new WalletSDK instance.
If chainParams is nil, the mainnet parameters will be used.
func (WalletSDK) AddressFromPrivateKey ¶
func (WalletSDK) ChainParams ¶
ChainParams returns the chain parameters for the wallet
func (WalletSDK) GenerateAddress ¶
func (s WalletSDK) GenerateAddress(mnemonic, passphrase string, sequenceNumber uint32) (*GenerateAddressData, error)
func (WalletSDK) ValidateAddress ¶
Bitcoin Cash
Click to show internal directories.
Click to hide internal directories.