cashu

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateInvoice

func CreateInvoice() lightning.Invoicer

CreateInvoice will generate a blank invoice

func IsPay2ScriptHash

func IsPay2ScriptHash(s string) bool

Types

type BlindedMessage

type BlindedMessage struct {
	Amount uint64 `json:"amount"`
	B_     string `json:"B_"`
}

type BlindedMessages

type BlindedMessages []BlindedMessage

type BlindedSignature

type BlindedSignature struct {
	Id     string `json:"id"`
	Amount uint64 `json:"amount"`
	C_     string `json:"C_"`
}

type CheckFeesRequest added in v0.1.7

type CheckFeesRequest struct {
	Pr string `json:"pr"`
}

type CheckFeesResponse added in v0.1.7

type CheckFeesResponse struct {
	Fee uint64 `json:"fee"`
}

type CheckSpendableRequest added in v0.1.7

type CheckSpendableRequest struct {
	Proofs Proofs `json:"proofs"`
}

type CheckSpendableResponse added in v0.1.7

type CheckSpendableResponse struct {
	Spendable []bool `json:"spendable"`
}

type ErrorOptions

type ErrorOptions func(err *ErrorResponse)

func WithCode

func WithCode(code int) ErrorOptions

type ErrorResponse

type ErrorResponse struct {
	Err  string `json:"error"`
	Code int    `json:"code"`
}

func NewErrorResponse

func NewErrorResponse(err error, options ...ErrorOptions) ErrorResponse

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

func (ErrorResponse) String

func (e ErrorResponse) String() string

type GetKeySetsResponse added in v0.1.7

type GetKeySetsResponse struct {
	KeySets []string `json:"keysets"`
}

type GetKeysResponse added in v0.1.7

type GetKeysResponse map[int]string

type GetMintResponse added in v0.1.7

type GetMintResponse struct {
	Pr   string `json:"pr"`
	Hash string `json:"hash"`
}

type MeltRequest added in v0.1.7

type MeltRequest struct {
	Proofs  Proofs           `json:"proofs"`
	Pr      string           `json:"pr"`
	Outputs []BlindedMessage `json:"outputs,omitempty"`
}

type MeltResponse added in v0.1.7

type MeltResponse struct {
	Paid     bool               `json:"paid"`
	Preimage string             `json:"preimage"`
	Change   []BlindedSignature `json:"change,omitempty"`
}

type Mint added in v0.1.7

type Mint struct {
	Url     string   `json:"url"`
	KeySets []string `json:"ks"`
}

type MintRequest added in v0.1.7

type MintRequest struct {
	Outputs BlindedMessages `json:"outputs"`
}

type MintResponse added in v0.1.7

type MintResponse struct {
	Promises []BlindedSignature `json:"promises"`
}

type P2SHScript

type P2SHScript struct {
	Script    string `json:"script"`
	Signature string `json:"signature"`
	Address   string `json:"address"`
}

type Promise

type Promise struct {
	B_b    string `json:"C_b" gorm:"primaryKey"`
	C_c    string `json:"C_c"`
	Amount uint64 `json:"amount"`
}

func (Promise) Log

func (p Promise) Log() map[string]interface{}

type Proof

type Proof struct {
	Id           string      `json:"id"`
	Amount       uint64      `json:"amount"`
	Secret       string      `json:"secret" gorm:"primaryKey"`
	C            string      `json:"C"`
	Status       ProofStatus `json:"-"`
	Reserved     bool        `json:"-,omitempty"`
	Script       *P2SHScript `gorm:"-" json:"script,omitempty" structs:"Script,omitempty"`
	SendId       uuid.UUID   `json:"-,omitempty" structs:"SendId,omitempty"`
	TimeCreated  time.Time   `json:"-,omitempty" structs:"TimeCreated,omitempty"`
	TimeReserved time.Time   `json:"-,omitempty" structs:"TimeReserved,omitempty"`
}

func (Proof) Decode

func (p Proof) Decode() ([]byte, error)

func (Proof) Log

func (p Proof) Log() map[string]interface{}

type ProofStatus added in v0.1.7

type ProofStatus int
const (
	ProofStatusSpent ProofStatus = iota
	ProofStatusPending
	ProofStatusReserved
)

type Proofs

type Proofs []Proof

type ProofsUsed

type ProofsUsed struct {
	Amount   uint64 `json:"amount"`
	Secret   string `json:"secret" gorm:"primaryKey"`
	C        string `json:"C"`
	TimeUsed time.Time
}

type SplitRequest added in v0.1.7

type SplitRequest struct {
	Proofs  Proofs           `json:"proofs"`
	Amount  uint64           `json:"amount"`
	Outputs []BlindedMessage `json:"outputs"`
}

type SplitResponse added in v0.1.7

type SplitResponse struct {
	Fst []BlindedSignature `json:"fst"`
	Snd []BlindedSignature `json:"snd"`
}

Jump to

Keyboard shortcuts

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