mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-22 03:58:24 +01:00
nip60: wallet.PayBolt11()
This commit is contained in:
@@ -37,18 +37,42 @@ func LoadStash(
|
||||
kr nostr.Keyer,
|
||||
pool *nostr.SimplePool,
|
||||
relays []string,
|
||||
) *WalletStash {
|
||||
return loadStashFromPool(ctx, kr, pool, relays, false)
|
||||
}
|
||||
|
||||
func LoadStashWithHistory(
|
||||
ctx context.Context,
|
||||
kr nostr.Keyer,
|
||||
pool *nostr.SimplePool,
|
||||
relays []string,
|
||||
) *WalletStash {
|
||||
return loadStashFromPool(ctx, kr, pool, relays, true)
|
||||
}
|
||||
|
||||
func loadStashFromPool(
|
||||
ctx context.Context,
|
||||
kr nostr.Keyer,
|
||||
pool *nostr.SimplePool,
|
||||
relays []string,
|
||||
withHistory bool,
|
||||
) *WalletStash {
|
||||
pk, err := kr.GetPublicKey(ctx)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
kinds := []int{37375, 7375}
|
||||
if withHistory {
|
||||
kinds = append(kinds, 7375)
|
||||
}
|
||||
|
||||
eoseChan := make(chan struct{})
|
||||
events := pool.SubManyNotifyEOSE(
|
||||
ctx,
|
||||
relays,
|
||||
nostr.Filters{
|
||||
{Kinds: []int{37375, 7375, 7376}, Authors: []string{pk}},
|
||||
{Kinds: kinds, Authors: []string{pk}},
|
||||
{Kinds: []int{5}, Tags: nostr.TagMap{"k": []string{"7375"}}, Authors: []string{pk}},
|
||||
},
|
||||
eoseChan,
|
||||
|
||||
Reference in New Issue
Block a user