Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateAddress(address string) bool
- type AddressType
- type CalculateTxSizeData
- type Config
- type GenerateAddressData
- type LTC
- 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, *btcec.PrivateKey, error)
- func (s WalletSDK) ChainParams() *chaincfg.Params
- func (s WalletSDK) DecodeAddressType(address string) (AddressType, error)
- func (s WalletSDK) GenerateAddress(addressType AddressType, mnemonic, passphrase string, sequenceNumber uint32) (*GenerateAddressData, error)
- func (s WalletSDK) ValidateAddress(address string) bool
Constants ¶
const ( AssetIdentifier = "ltc" AssetDecimals = 1e8 )
Variables ¶
var ( ErrInputAlreadyUsed = errors.New("input already used") ErrOutputAlreadyExists = errors.New("output already exists") )
Functions ¶
func ValidateAddress ¶
Types ¶
type AddressType ¶
type AddressType string
AddressType represents the type of a Bitcoin address.
const ( AddressTypeP2PKH AddressType = "P2PKH" // Legacy AddressTypeP2SH AddressType = "P2SH" // SegWit (nested) AddressTypeP2WPKH AddressType = "P2WPKH" // Native SegWit (Bech32) AddressTypeP2TR AddressType = "P2TR" // Taproot )
func DecodeAddressType ¶
func DecodeAddressType(address string, chainParams *chaincfg.Params) (AddressType, error)
type CalculateTxSizeData ¶
type Config ¶
type Config struct {
RPCConfig *rpcclient.ConnConfig
}
type GenerateAddressData ¶
type GenerateAddressData struct {
Address ltcutil.Address
PublicKey *btcec.PublicKey
PrivateKey *btcec.PrivateKey
PrivateKeyWIF *ltcutil.WIF
MasterKey *hdkeychain.ExtendedKey
Sequence uint32
// contains filtered or unexported fields
}
func (GenerateAddressData) AddressPubKey ¶
func (s GenerateAddressData) AddressPubKey() (string, error)
type LTC ¶
type LTC struct {
WalletSDK *WalletSDK
// contains filtered or unexported fields
}
func (*LTC) EstimateFeePerByte ¶ added in v0.9.13
EstimateFeePerByte returns the current network fee rate in base units per virtual byte estimated by the node. Returns zero if the node does not have enough data for the estimate yet.
func (*LTC) MinRelayFeePerByte ¶ added in v0.9.14
MinRelayFeePerByte returns the lowest fee rate in base units per byte the node accepts into its mempool: the larger of the node relay fee and the current mempool minimum fee. Transactions paying less are rejected with "min relay fee not met".
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) DecodeAddressType ¶
func (s WalletSDK) DecodeAddressType(address string) (AddressType, error)
func (WalletSDK) GenerateAddress ¶
func (s WalletSDK) GenerateAddress(addressType AddressType, mnemonic, passphrase string, sequenceNumber uint32) (*GenerateAddressData, error)