testutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUM_BLOCKS int64 = 110
)

Variables

This section is empty.

Functions

func AddHTLCWitnessToInputs added in v0.3.0

func AddHTLCWitnessToInputs(inputs cashu.Proofs, preimage string, signingKey *btcec.PrivateKey) (cashu.Proofs, error)

it will add signatures if signingKey is not nil

func AddHTLCWitnessToOutputs added in v0.3.0

func AddHTLCWitnessToOutputs(outputs cashu.BlindedMessages, preimage string, signingKey *btcec.PrivateKey) (cashu.BlindedMessages, error)

it will add signatures if signingKey is not nil

func AddP2PKWitnessToInputs added in v0.3.0

func AddP2PKWitnessToInputs(inputs cashu.Proofs, signingKeys []*btcec.PrivateKey) (cashu.Proofs, error)

func AddP2PKWitnessToOutputs added in v0.3.0

func AddP2PKWitnessToOutputs(
	outputs cashu.BlindedMessages,
	signingKeys []*btcec.PrivateKey,
) (cashu.BlindedMessages, error)

func BlindedMessagesFromSpendingCondition added in v0.3.0

func BlindedMessagesFromSpendingCondition(
	splitAmounts []uint64,
	keysetId string,
	spendingCondition nut10.SpendingCondition,
) (
	cashu.BlindedMessages,
	[]string,
	[]*secp256k1.PrivateKey,
	error,
)

func ConstructProofs

func ConstructProofs(blindedSignatures cashu.BlindedSignatures,
	secrets []string, rs []*secp256k1.PrivateKey, keyset *crypto.MintKeyset) (cashu.Proofs, error)

func CreateBlindedMessages

func CreateBlindedMessages(amount uint64, keyset crypto.MintKeyset) (cashu.BlindedMessages, []string, []*secp256k1.PrivateKey, error)

func CreateTestMint

func CreateTestMint(
	lnd *btcdocker.Lnd,
	dbpath string,
	dbMigrationPath string,
	inputFeePpk uint,
	limits mint.MintLimits,
) (*mint.Mint, error)

func CreateTestMintServer

func CreateTestMintServer(
	lnd *btcdocker.Lnd,
	port string,
	dbpath string,
	dbMigrationPath string,
	inputFeePpk uint,
) (*mint.MintServer, error)

func CreateTestWallet

func CreateTestWallet(walletpath, defaultMint string) (*wallet.Wallet, error)

func Fees

func Fees(proofs cashu.Proofs, mint string) (uint, error)

func FundCashuWallet

func FundCashuWallet(ctx context.Context, wallet *wallet.Wallet, lnd *btcdocker.Lnd, amount uint64) error

func FundLndNode

func FundLndNode(ctx context.Context, bitcoind *btcdocker.Bitcoind, lnd *btcdocker.Lnd) error

func GenerateRandomBytes added in v0.3.0

func GenerateRandomBytes() ([]byte, error)

func GetBlindedSignatures added in v0.3.0

func GetBlindedSignatures(amount uint64, mint *mint.Mint, payer *btcdocker.Lnd) (
	cashu.BlindedMessages,
	[]string,
	[]*secp256k1.PrivateKey,
	cashu.BlindedSignatures,
	error)

func GetProofsWithSpendingCondition added in v0.3.0

func GetProofsWithSpendingCondition(
	amount uint64,
	spendingCondition nut10.SpendingCondition,
	mint *mint.Mint,
	payer *btcdocker.Lnd,
) (cashu.Proofs, error)

func GetValidProofsForAmount

func GetValidProofsForAmount(amount uint64, mint *mint.Mint, payer *btcdocker.Lnd) (cashu.Proofs, error)

func MineBlocks

func MineBlocks(bitcoind *btcdocker.Bitcoind, numBlocks int64) error

func OpenChannel

func OpenChannel(
	ctx context.Context,
	bitcoind *btcdocker.Bitcoind,
	from *btcdocker.Lnd,
	to *btcdocker.Lnd,
	amount int64,
) error

func SyncLndNode

func SyncLndNode(ctx context.Context, lnd *btcdocker.Lnd) error

Types

type NutshellMintContainer

type NutshellMintContainer struct {
	testcontainers.Container
	Host string
}

func CreateNutshellMintContainer

func CreateNutshellMintContainer(ctx context.Context, inputFeePpk int) (*NutshellMintContainer, error)

Jump to

Keyboard shortcuts

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