sdk

package module
v0.0.0-...-a4a98dd Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedeemScriptWithoutConstructorArgsHex = "" /* 162-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func CheckIfProbabilityHit

func CheckIfProbabilityHit(secret [32]byte, salt [4]byte, probability int64) bool

func GetProbabilityByRatio

func GetProbabilityByRatio(prob float64) int64

func GetProbabilityRatio

func GetProbabilityRatio(prob int64) float64

Types

type SpayCovenant

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

func NewCovenant

func NewCovenant(
	senderPkh, recipientPkh, hash [20]byte, salt [4]byte, expiration, probability int64,
	net *chaincfg.Params,
) (*SpayCovenant, error)

func NewMainnetCovenant

func NewMainnetCovenant(
	senderPkh, recipientPkh, hash [20]byte, salt [4]byte, expiration, probability int64,
) (*SpayCovenant, error)

func (*SpayCovenant) BuildFullRedeemScript

func (c *SpayCovenant) BuildFullRedeemScript() ([]byte, error)

func (*SpayCovenant) BuildReceiveSigScript

func (c *SpayCovenant) BuildReceiveSigScript(recipientSig, recipientPk, secret []byte) ([]byte, error)

func (*SpayCovenant) BuildRefundSigScript

func (c *SpayCovenant) BuildRefundSigScript(senderSig, senderPk []byte) ([]byte, error)

func (*SpayCovenant) GetP2SHAddress

func (c *SpayCovenant) GetP2SHAddress() (string, error)

func (*SpayCovenant) GetRedeemScriptHash

func (c *SpayCovenant) GetRedeemScriptHash() ([]byte, error)

func (*SpayCovenant) MakeReceiveTx

func (c *SpayCovenant) MakeReceiveTx(
	txid []byte, vout uint32, inAmt int64,
	toAddr bchutil.Address, minerFee int64,
	secret []byte,
	privKey *bchec.PrivateKey,
) (*wire.MsgTx, error)

func (*SpayCovenant) MakeRefundTx

func (c *SpayCovenant) MakeRefundTx(
	txid []byte, vout uint32, inAmt int64,
	toAddr bchutil.Address, minerFee int64,
	privKey *bchec.PrivateKey,
) (*wire.MsgTx, error)

func (*SpayCovenant) MakeSPAYTx

func (c *SpayCovenant) MakeSPAYTx(
	fromKey *bchec.PrivateKey,
	txid []byte, vout uint32, inAmt int64,
	outAmt int64,
	minerFee int64,
) (*wire.MsgTx, error)

func (*SpayCovenant) String

func (c *SpayCovenant) String() string

Jump to

Keyboard shortcuts

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