Files
timmy-config/go/pkg/mod/github.com/nbd-wtf/go-nostr@v0.51.8/nip60/utils.go
2026-03-31 20:02:01 +00:00

26 lines
507 B
Go

package nip60
import "github.com/elnosh/gonuts/cashu"
func GetProofsAndMint(tokenStr string) (cashu.Proofs, string, error) {
token, err := cashu.DecodeToken(tokenStr)
if err != nil {
return nil, "", err
}
return token.Proofs(), token.Mint(), nil
}
func MakeTokenString(proofs cashu.Proofs, mint string) string {
token, err := cashu.NewTokenV4(proofs, mint, cashu.Sat, true)
if err != nil {
panic(err)
}
tokenStr, err := token.Serialize()
if err != nil {
panic(err)
}
return tokenStr
}