libkaspawallet

package
v0.0.0-...-30b4086 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SingleSignerPurpose = 44
	// Note: this is not entirely compatible to BIP 45 since
	// BIP 45 doesn't have a coin type in its derivation path.
	MultiSigPurpose = 45
	// TODO: Register the coin type in https://github.com/satoshilabs/slips/blob/master/slip-0044.md
	CoinType = 111111
)

Purpose and CoinType constants

View Source
const (
	// ExternalKeychain is the key chain that is used to create receive addresses
	ExternalKeychain = 0
	// InternalKeychain is used to create change addresses
	InternalKeychain = 1
)

Variables

This section is empty.

Functions

func Address

func Address(params *dagconfig.Params, extendedPublicKeys []string, minimumSignatures uint32, path string, ecdsa bool) (util.Address, error)

Address returns the address associated with the given public keys and minimum signatures parameters.

func AppMessageUTXOToKaspawalletdUTXO

func AppMessageUTXOToKaspawalletdUTXO(appUTXOsByAddressesEntry *appmessage.UTXOsByAddressesEntry) *pb.UtxosByAddressesEntry

AppMessageUTXOToKaspawalletdUTXO converts an appmessage.UTXOsByAddressesEntry to a pb.UtxosByAddressesEntry

func CreateKeyPair

func CreateKeyPair(ecdsa bool) ([]byte, []byte, error)

CreateKeyPair generates a private-public key pair

func CreateMnemonic

func CreateMnemonic() (string, error)

CreateMnemonic creates a new bip-39 compatible mnemonic

func CreateUnsignedTransaction

func CreateUnsignedTransaction(
	extendedPublicKeys []string,
	minimumSignatures uint32,
	payments []*Payment,
	selectedUTXOs []*UTXO) ([]byte, error)

CreateUnsignedTransaction creates an unsigned transaction

func ExtractTransaction

func ExtractTransaction(partiallySignedTransactionBytes []byte, ecdsa bool) (*externalapi.DomainTransaction, error)

ExtractTransaction extracts a domain transaction from partially signed transaction after all of the relevant parties have signed it.

func ExtractTransactionDeserialized

func ExtractTransactionDeserialized(partiallySignedTransaction *serialization.PartiallySignedTransaction, ecdsa bool) (
	*externalapi.DomainTransaction, error)

ExtractTransactionDeserialized does the same thing ExtractTransaction does, only receives the PartiallySignedTransaction in an already deserialized format

func IsTransactionFullySigned

func IsTransactionFullySigned(partiallySignedTransactionBytes []byte) (bool, error)

IsTransactionFullySigned returns whether the transaction is fully signed and ready to broadcast.

func MasterPublicKeyFromMnemonic

func MasterPublicKeyFromMnemonic(params *dagconfig.Params, mnemonic string, isMultisig bool) (string, error)

MasterPublicKeyFromMnemonic returns the master public key with the correct derivation for the given mnemonic.

func MinimumCosignerIndex

func MinimumCosignerIndex(cosignerExtendedPublicKeys, allExtendedPublicKeys []string) (uint32, error)

MinimumCosignerIndex returns the minimum index for the cosigner from the set of all extended public keys.

func PublicKeyFromPrivateKey

func PublicKeyFromPrivateKey(privateKeyBytes []byte) ([]byte, error)

PublicKeyFromPrivateKey returns the public key associated with a private key

func Sign

func Sign(params *dagconfig.Params, mnemonics []string, serializedPSTx []byte, ecdsa bool) ([]byte, error)

Sign signs the transaction with the given private keys

Types

type Payment

type Payment struct {
	Address util.Address
	Amount  uint64
}

Payment contains a recipient payment details

type UTXO

type UTXO struct {
	Outpoint       *externalapi.DomainOutpoint
	UTXOEntry      externalapi.UTXOEntry
	DerivationPath string
}

UTXO is a type that stores a UTXO and meta data that is needed in order to sign it and create transactions with it.

func KaspawalletdUTXOsTolibkaspawalletUTXOs

func KaspawalletdUTXOsTolibkaspawalletUTXOs(karlsenwalletdUtxoEntires []*pb.UtxosByAddressesEntry) ([]*UTXO, error)

KaspawalletdUTXOsTolibkaspawalletUTXOs converts a []*pb.UtxosByAddressesEntry to a []*libkaspawallet.UTXO

Directories

Path Synopsis
base58
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package base58 provides an API for working with modified base58 and Base58Check encodings.

Jump to

Keyboard shortcuts

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