ltc

package
v0.0.0-...-4c3d690 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: ISC Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
	SatoshiPerBitcent = 1e6

	// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
	SatoshiPerBitcoin = 1e8

	// MaxSatoshi is the maximum transaction amount allowed in satoshi.
	MaxSatoshi = 21e6 * SatoshiPerBitcoin
)

Variables

This section is empty.

Functions

func AuditContract

func AuditContract(testnet bool, params libs.AuditParams) (*libs.AuditResult, error)

AuditContract command

func ExtractSecret

func ExtractSecret(redemptionTx string, secretHash string) (string, error)

ExtractSecret returns a secret from the scriptSig of a transaction redeeming a contract

func GetNewAddress

func GetNewAddress(testnet bool, rpcinfo libs.RPCInfo) (string, error)

GetNewAddress gets a new address from the controlled wallet

func GetTx

func GetTx(testnet bool, rpcinfo libs.RPCInfo, txid string) (*libs.GetTxResult, error)

GetTx gets info on a broadcasted transaction

func Initiate

func Initiate(testnet bool, rpcinfo libs.RPCInfo, params libs.InitiateParams) (*libs.InitiateResult, error)

Initiate command builds a P2SH contract and a transaction to fund it

func Participate

func Participate(testnet bool, rpcinfo libs.RPCInfo, params libs.ParticipateParams) (*libs.ParticipateResult, error)

Participate command builds a P2SH contract and a transaction to fund it

func PingRPC

func PingRPC(testnet bool, rpcinfo libs.RPCInfo) error

PingRPC tests if wallet node RPC is available

func Publish

func Publish(testnet bool, rpcinfo libs.RPCInfo, tx string) (string, error)

Publish command broadcasts a raw hex transaction

func Redeem

func Redeem(testnet bool, rpcinfo libs.RPCInfo, params libs.RedeemParams) (*libs.RedeemResult, error)

Redeem command builds a transaction to redeem a contract

func Refund

func Refund(testnet bool, rpcinfo libs.RPCInfo, params libs.RefundParams) (*libs.RefundResult, error)

Refund command builds a refund transaction for an unredeemed contract

Types

type Amount

type Amount int64

Amount represents the base bitcoin monetary unit (colloquially referred to as a `Satoshi'). A single Amount is equal to 1e-8 of a litecoin.

func NewAmount

func NewAmount(f float64) (Amount, error)

NewAmount creates an Amount from a floating point value representing some value in bitcoin. NewAmount errors if f is NaN or +-Infinity, but does not check that the amount is within the total amount of litecoin producible as f may not refer to an amount at a single moment in time.

NewAmount is for specifically for converting LTC to Satoshi. For creating a new Amount with an int64 value which denotes a quantity of Satoshi, do a simple type conversion from type int64 to Amount. See GoDoc for example: http://godoc.org/github.com/btcsuite/xzcutil#example-Amount

func (Amount) Format

func (a Amount) Format(u AmountUnit) string

Format formats a monetary amount counted in bitcoin base units as a string for a given unit. The conversion will succeed for any unit, however, known units will be formated with an appended label describing the units with SI notation, or "Satoshi" for the base unit.

func (Amount) MulF64

func (a Amount) MulF64(f float64) Amount

MulF64 multiplies an Amount by a floating point value. While this is not an operation that must typically be done by a full node or wallet, it is useful for services that build on top of bitcoin (for example, calculating a fee by multiplying by a percentage).

func (Amount) String

func (a Amount) String() string

String is the equivalent of calling Format with AmountLTC.

func (Amount) ToLTC

func (a Amount) ToLTC() float64

ToLTC is the equivalent of calling ToUnit with AmountLTC.

func (Amount) ToUnit

func (a Amount) ToUnit(u AmountUnit) float64

ToUnit converts a monetary amount counted in bitcoin base units to a floating point value representing an amount of bitcoin.

type AmountUnit

type AmountUnit int

AmountUnit describes a method of converting an Amount to something other than the base unit of a bitcoin. The value of the AmountUnit is the exponent component of the decadic multiple to convert from an amount in litecoin to an amount counted in units.

const (
	AmountMegaLTC  AmountUnit = 6
	AmountKiloLTC  AmountUnit = 3
	AmountLTC      AmountUnit = 0
	AmountMilliLTC AmountUnit = -3
	AmountMicroLTC AmountUnit = -6
	AmountSatoshi  AmountUnit = -8
)

These constants define various units used when describing a litecoin monetary amount.

func (AmountUnit) String

func (u AmountUnit) String() string

String returns the unit as a string. For recognized units, the SI prefix is used, or "Satoshi" for the base unit. For all unrecognized units, "1eN LTC" is returned, where N is the AmountUnit.

Jump to

Keyboard shortcuts

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