ltc

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetIdentifier = "ltc"
	AssetDecimals   = 1e8
)

Variables

View Source
var (
	ErrInputAlreadyUsed    = errors.New("input already used")
	ErrOutputAlreadyExists = errors.New("output already exists")
)

Functions

func ValidateAddress

func ValidateAddress(address string) bool

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)

func (AddressType) Validate

func (t AddressType) Validate() error

Validate

type CalculateTxSizeData

type CalculateTxSizeData struct {
	TxFullSize     decimal.Decimal
	TxStrippedSize decimal.Decimal
	Weight         decimal.Decimal
	VSize          decimal.Decimal
	TotalFee       decimal.Decimal
}

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 NewLTC

func NewLTC(conf Config, walletSDK *WalletSDK) (*LTC, error)

func (*LTC) Name

func (t *LTC) Name() string

Name returns the service name

func (*LTC) Node

func (t *LTC) Node() *rpcclient.Client

Node returns the grpc client

func (*LTC) Start

func (t *LTC) Start(_ context.Context) error

Start

func (*LTC) Stop

func (t *LTC) Stop(_ context.Context) error

Stop

type TxBuilder

type TxBuilder struct {
	Inputs []TxInput
	// contains filtered or unexported fields
}

func NewTransactionFromBuilder

func NewTransactionFromBuilder(builder *TxBuilder) *TxBuilder

func NewTxBuilder

func NewTxBuilder(chainParams *chaincfg.Params) *TxBuilder

func (*TxBuilder) AddInput

func (s *TxBuilder) AddInput(input TxInput) error

func (*TxBuilder) AddOutput

func (s *TxBuilder) AddOutput(address string, amount decimal.Decimal) error

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.

func (*TxBuilder) MsgTx

func (s *TxBuilder) MsgTx() *wire.MsgTx

MsgTx

func (*TxBuilder) SignTx

func (s *TxBuilder) SignTx() error

SignTx

type TxInput

type TxInput struct {
	PrivateKey *btcec.PrivateKey
	PkScript   string
	Hash       string
	Sequence   uint32
	Amount     int64
}

type WalletSDK

type WalletSDK struct {
	// contains filtered or unexported fields
}

func NewWalletSDK

func NewWalletSDK(chainParams *chaincfg.Params) *WalletSDK

NewWalletSDK creates a new WalletSDK instance.

If chainParams is nil, the mainnet parameters will be used.

func (WalletSDK) AddressFromPrivateKey

func (s WalletSDK) AddressFromPrivateKey(privateKeyWIF string) (string, *btcec.PrivateKey, error)

func (WalletSDK) ChainParams

func (s WalletSDK) ChainParams() *chaincfg.Params

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)

func (WalletSDK) ValidateAddress

func (s WalletSDK) ValidateAddress(address string) bool

Jump to

Keyboard shortcuts

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