nip61, and related modifications to nip60.

This commit is contained in:
fiatjaf
2025-02-02 18:16:46 -03:00
parent c9f670d700
commit d0f53b3b7a
11 changed files with 327 additions and 59 deletions
+25
View File
@@ -0,0 +1,25 @@
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
}