mint

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuoteExpiryMins = 10
	BOLT11_METHOD   = "bolt11"
	SAT_UNIT        = "sat"
)

Variables

This section is empty.

Functions

func StartMintServer

func StartMintServer(server *MintServer)

Types

type Config

type Config struct {
	DerivationPathIdx uint32
	Port              string
	MintPath          string
	DBMigrationPath   string
	InputFeePpk       uint
	MintInfo          MintInfo
	Limits            MintLimits
	LightningClient   lightning.Client
}

type MeltMethodSettings added in v0.2.0

type MeltMethodSettings struct {
	MinAmount uint64
	MaxAmount uint64
}

type Mint

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

func LoadMint

func LoadMint(config Config) (*Mint, error)

func (*Mint) GetActiveKeyset added in v0.2.0

func (m *Mint) GetActiveKeyset() crypto.MintKeyset

func (*Mint) GetMeltQuoteState

func (m *Mint) GetMeltQuoteState(method, quoteId string) (storage.MeltQuote, error)

GetMeltQuoteState returns the state of a melt quote. Used to check whether a melt quote has been paid.

func (*Mint) GetMintQuoteState

func (m *Mint) GetMintQuoteState(method, quoteId string) (storage.MintQuote, error)

GetMintQuoteState returns the state of a mint quote. Used to check whether a mint quote has been paid.

func (*Mint) MeltTokens

func (m *Mint) MeltTokens(method, quoteId string, proofs cashu.Proofs) (storage.MeltQuote, error)

MeltTokens verifies whether proofs provided are valid and proceeds to attempt payment.

func (*Mint) MintTokens

func (m *Mint) MintTokens(method, id string, blindedMessages cashu.BlindedMessages) (cashu.BlindedSignatures, error)

MintTokens verifies whether the mint quote with id has been paid and proceeds to sign the blindedMessages and return the BlindedSignatures if it was paid.

func (*Mint) RequestMeltQuote added in v0.2.0

func (m *Mint) RequestMeltQuote(method, request, unit string) (storage.MeltQuote, error)

MeltRequest will process a request to melt tokens and return a MeltQuote. A melt is requested by a wallet to request the mint to pay an invoice.

func (*Mint) RequestMintQuote

func (m *Mint) RequestMintQuote(method string, amount uint64, unit string) (storage.MintQuote, error)

RequestMintQuote will process a request to mint tokens and returns a mint quote or an error. The request to mint a token is explained in NUT-04 here: https://github.com/cashubtc/nuts/blob/main/04.md.

func (*Mint) RetrieveMintInfo added in v0.2.0

func (m *Mint) RetrieveMintInfo() (nut06.MintInfo, error)

func (*Mint) SetMintInfo added in v0.2.0

func (m *Mint) SetMintInfo(mintInfo MintInfo) error

func (*Mint) Swap

func (m *Mint) Swap(proofs cashu.Proofs, blindedMessages cashu.BlindedMessages) (cashu.BlindedSignatures, error)

Swap will process a request to swap tokens. A swap requires a set of valid proofs and blinded messages. If valid, the mint will sign the blindedMessages and invalidate the proofs that were used as input. It returns the BlindedSignatures.

func (*Mint) TransactionFees added in v0.2.0

func (m *Mint) TransactionFees(inputs cashu.Proofs) uint

type MintInfo added in v0.2.0

type MintInfo struct {
	Name            string
	Description     string
	LongDescription string
	Contact         []nut06.ContactInfo
	Motd            string
}

type MintLimits added in v0.2.0

type MintLimits struct {
	MaxBalance      uint64
	MintingSettings MintMethodSettings
	MeltingSettings MeltMethodSettings
}

type MintMethodSettings added in v0.2.0

type MintMethodSettings struct {
	MinAmount uint64
	MaxAmount uint64
}

type MintServer

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

func SetupMintServer

func SetupMintServer(config Config) (*MintServer, error)

func (*MintServer) LogInfo

func (ms *MintServer) LogInfo(format string, v ...any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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