libkashwallet

package
v0.0.0-...-decf009 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 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 AppMessageUTXOToKashwalletdUTXO

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

AppMessageUTXOToKashwalletdUTXO 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,
	txType externalapi.DomainTransactionType) ([]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
	AssetType externalapi.AssetType
	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 KashwalletdUTXOsTolibkashwalletUTXOs

func KashwalletdUTXOsTolibkashwalletUTXOs(kashwalletdUtxoEntires []*pb.UtxosByAddressesEntry) ([]*UTXO, error)

KashwalletdUTXOsTolibkashwalletUTXOs converts a []*pb.UtxosByAddressesEntry to a []*libkashwallet.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