Documentation
¶
Index ¶
- Constants
- Variables
- func CanUseLiquidityManager(backend LightningBackend) bool
- func CreateDirectoryAndPath(dirPath string, filename string) error
- func ExtractInternalFile(ctx context.Context, container testcontainers.Container, path string) (string, error)
- func GetAndCalculateProofsValues(proofs *cashu.Proofs) ([]cashu.WrappedPublicKey, error)
- func GetConfigDirectory() (string, error)
- func GetLogsDirectory() (string, error)
- func GetMessagesForChange(overpaidFees uint64, outputs []cashu.BlindedMessage) []cashu.BlindedMessage
- func ParseErrorToCashuErrorCode(proofError error) (cashu.ErrorCode, *string)
- func RandomHash() (string, error)
- func ReadDataFromReader(reader io.Reader) (string, error)
- func ReadNostrNotificationNsec() ([]byte, error)
- func ReadNostrNotificationNsecFromDir(dirPath string) ([]byte, error)
- func ReadOrCreateNostrNotificationNsec(nsec []byte) ([]byte, error)
- func ReadOrCreateNostrNotificationNsecFromDir(dirPath string, nsec []byte) ([]byte, error)
- func SetUpLightingNetworkTestEnviroment(ctx context.Context, names string) (testcontainers.Container, testcontainers.Container, testcontainers.Container, ...)
- func SyncNostrNotificationNsec(config *NostrNotificationConfig, createIfMissing bool) error
- func WriteNostrNotificationNsec(nsec []byte) error
- func WriteNostrNotificationNsecToDir(dirPath string, nsec []byte) error
- type Config
- type LightningBackend
- type LiquiditySwap
- type NostrNotificationConfig
- type SlogRecordJSON
- type SwapState
- type SwapType
Constants ¶
View Source
const ( LND_HOST = "LND_GRPC_HOST" LND_TLS_CERT = "LND_TLS_CERT" LND_MACAROON = "LND_MACAROON" MINT_LNBITS_ENDPOINT = "MINT_LNBITS_ENDPOINT" MINT_LNBITS_KEY = "MINT_LNBITS_KEY" CLN_HOST = "CLN_GRPC_HOST" CLN_TLS_CERT = "CLN_TLS_CERT" CLN_MACAROON = "CLN_MACAROON" )
View Source
const ConfigDirName string = "nutmix"
View Source
const ConfigFileName string = "config.toml"
View Source
const LogExtraInfo string = "extra-info"
View Source
const LogFileName string = "nutmix.log"
View Source
const NostrNotificationNsecFileName = "nostr_notification_nsec"
Variables ¶
View Source
var ( MODE_ENV = "MODE" MINT_PRIVATE_KEY_ENV = "MINT_PRIVATE_KEY" )
View Source
var ( // AppVersion will be in 0.0.0 format AppVersion = "development" // BuildTime is the time it built, in RFC3339 BuildTime = "unknown" // GitCommit is the Git commit hash GitCommit = "unknown" Version = "nutmix/" + AppVersion )
View Source
var ErrAlreadyLNPaying = errors.New("already paying lightning invoice")
Functions ¶
func CanUseLiquidityManager ¶
func CanUseLiquidityManager(backend LightningBackend) bool
func CreateDirectoryAndPath ¶
func ExtractInternalFile ¶
func GetAndCalculateProofsValues ¶
func GetAndCalculateProofsValues(proofs *cashu.Proofs) ([]cashu.WrappedPublicKey, error)
Sets the y and seen at field in by references and returns the Y's array
func GetConfigDirectory ¶ added in v0.6.0
func GetLogsDirectory ¶
func GetMessagesForChange ¶
func GetMessagesForChange(overpaidFees uint64, outputs []cashu.BlindedMessage) []cashu.BlindedMessage
func RandomHash ¶
func ReadNostrNotificationNsec ¶ added in v0.6.0
func ReadNostrNotificationNsecFromDir ¶ added in v0.6.0
func ReadOrCreateNostrNotificationNsec ¶ added in v0.6.0
func ReadOrCreateNostrNotificationNsecFromDir ¶ added in v0.6.0
func SetUpLightingNetworkTestEnviroment ¶
func SetUpLightingNetworkTestEnviroment(ctx context.Context, names string) (testcontainers.Container, testcontainers.Container, testcontainers.Container, testcontainers.Container, error)
This is used for testing purpose returns alice, bob, btcNode, aliceLnBits, error
func SyncNostrNotificationNsec ¶ added in v0.6.0
func SyncNostrNotificationNsec(config *NostrNotificationConfig, createIfMissing bool) error
func WriteNostrNotificationNsec ¶ added in v0.6.0
func WriteNostrNotificationNsecToDir ¶ added in v0.6.0
Types ¶
type Config ¶
type Config struct {
PEG_OUT_LIMIT_SATS *int `db:"peg_out_limit_sats,omitempty"`
IconUrl *string `db:"icon_url,omitempty"`
TosUrl *string `db:"tos_url,omitempty"`
PEG_IN_LIMIT_SATS *int `db:"peg_in_limit_sats,omitempty"`
NETWORK string `db:"network"`
CLN_CLIENT_CERT string `db:"cln_client_cert"`
EMAIL string `db:"email"`
NOSTR string `db:"nostr"`
NAME string `db:"name"`
MINT_LIGHTNING_BACKEND LightningBackend `db:"mint_lightning_backend"`
LND_GRPC_HOST string `db:"lnd_grpc_host"`
LND_TLS_CERT string `db:"lnd_tls_cert"`
LND_MACAROON string `db:"lnd_macaroon"`
MINT_LNBITS_ENDPOINT string `db:"mint_lnbits_endpoint"`
MINT_LNBITS_KEY string `db:"mint_lnbits_key"`
CLN_GRPC_HOST string `db:"cln_grpc_host"`
CLN_CA_CERT string `db:"cln_ca_cert"`
MOTD string `db:"motd"`
CLN_CLIENT_KEY string `db:"cln_client_key"`
CLN_MACAROON string `db:"cln_macaroon"`
STRIKE_KEY string `db:"strike_key"`
STRIKE_ENDPOINT string `db:"strike_endpoint"`
MINT_AUTH_OICD_CLIENT_ID string `db:"mint_auth_oicd_client_id,omitempty"`
DESCRIPTION_LONG string `db:"description_long"`
DESCRIPTION string `db:"description"`
MINT_AUTH_OICD_URL string `db:"mint_auth_oicd_url,omitempty"`
MINT_AUTH_CLEAR_AUTH_URLS []string `db:"mint_auth_clear_auth_urls,omitempty"`
MINT_AUTH_BLIND_AUTH_URLS []string `db:"mint_auth_blind_auth_urls,omitempty"`
MINT_AUTH_RATE_LIMIT_PER_MINUTE int `db:"mint_auth_rate_limit_per_minute,omitempty"`
MINT_AUTH_MAX_BLIND_TOKENS uint64 `db:"mint_auth_max_blind_tokens,omitempty"`
MINT_REQUIRE_AUTH bool `db:"mint_require_auth,omitempty"`
PEG_OUT_ONLY bool `db:"peg_out_only"`
}
func (*Config) UseEnviromentVars ¶
func (c *Config) UseEnviromentVars()
type LightningBackend ¶
type LightningBackend string
const CLNGRPC LightningBackend = "ClnGrpcWallet"
const FAKE_WALLET LightningBackend = "FakeWallet"
const LNBITS LightningBackend = "LNbitsWallet"
Deprecated: LNBITS backend will be removed in v0.8.0.
const LNDGRPC LightningBackend = "LndGrpcWallet"
const Strike LightningBackend = "Strike"
Deprecated: Strike backend will be removed in v0.7.0.
func StringToLightningBackend ¶
func StringToLightningBackend(text string) LightningBackend
type LiquiditySwap ¶
type NostrNotificationConfig ¶ added in v0.6.0
type NostrNotificationConfig struct {
NOSTR_NOTIFICATION_NSEC []byte `db:"-"`
NOSTR_NOTIFICATION_NPUBS []cashu.WrappedPublicKey `db:"-"`
NOSTR_NOTIFICATIONS bool `db:"nostr_notifications"`
NOSTR_NOTIFICATION_NIP04_DM bool `db:"nostr_notification_nip04_dm"`
}
func (*NostrNotificationConfig) SetNostrNotificationConfig ¶ added in v0.6.0
func (c *NostrNotificationConfig) SetNostrNotificationConfig(enabled bool, nsec []byte, npubs []cashu.WrappedPublicKey) error
type SlogRecordJSON ¶
type SlogRecordJSON struct {
Time time.Time
Extras map[string]any `json:"-"`
Msg string
ExtraInfo string `json:"extra-info"`
Level slog.Level
}
func ParseLogFileByLevelAndTime ¶
func ParseLogFileByLevelAndTime(file *os.File, wantedLevel []slog.Level, limitTime time.Time) []SlogRecordJSON
ParseLogFileByLevelAndTime parses the provided log file line-by-line assuming the file is in ascending time order (oldest logs first). It skips lines until it finds the first log with Time >= limitTime, then collects all subsequent records whose Level is in wantedLevel.
type SwapState ¶
type SwapState string
const Expired SwapState = "Expired"
const Finished SwapState = "Finished"
const LightningPaymentExpired SwapState = "LightningPaymentExpired"
const LightningPaymentFail SwapState = "LightningPaymentFail"
const LightningPaymentPending SwapState = "LightningPaymentPending"
const MintWaitingPaymentRecv SwapState = "MintWaitingPaymentRecv"
const UnknownProblem SwapState = "UnknownProblem"
const WaitingUserConfirmation SwapState = "WaitingUserConfirmation"
Click to show internal directories.
Click to hide internal directories.