applesauce-wallet-connect 0.0.0-next-20250808173123 → 0.0.0-next-20250815164532

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +3 -3
  2. package/dist/blueprints/support.d.ts +1 -1
  3. package/dist/blueprints/support.js +4 -2
  4. package/dist/helpers/auth-uri.d.ts +44 -0
  5. package/dist/helpers/auth-uri.js +113 -0
  6. package/dist/helpers/connect-uri.d.ts +5 -0
  7. package/dist/helpers/connect-uri.js +6 -2
  8. package/dist/helpers/index.d.ts +1 -0
  9. package/dist/helpers/index.js +1 -0
  10. package/dist/types.d.ts +5 -0
  11. package/dist/wallet-connect.d.ts +28 -11
  12. package/dist/wallet-connect.js +90 -30
  13. package/dist/wallet-service.d.ts +20 -5
  14. package/dist/wallet-service.js +35 -12
  15. package/package.json +3 -3
  16. package/dist/actions/index.d.ts +0 -1
  17. package/dist/actions/index.js +0 -1
  18. package/dist/actions/tokens.d.ts +0 -17
  19. package/dist/actions/tokens.js +0 -110
  20. package/dist/actions/wallet.d.ts +0 -13
  21. package/dist/actions/wallet.js +0 -64
  22. package/dist/actions/zap-info.d.ts +0 -22
  23. package/dist/actions/zap-info.js +0 -83
  24. package/dist/actions/zaps.d.ts +0 -8
  25. package/dist/actions/zaps.js +0 -30
  26. package/dist/blueprints/history.d.ts +0 -4
  27. package/dist/blueprints/history.js +0 -11
  28. package/dist/blueprints/info.d.ts +0 -4
  29. package/dist/blueprints/info.js +0 -8
  30. package/dist/blueprints/tokens.d.ts +0 -7
  31. package/dist/blueprints/tokens.js +0 -11
  32. package/dist/blueprints/wallet.d.ts +0 -5
  33. package/dist/blueprints/wallet.js +0 -11
  34. package/dist/blueprints/zaps.d.ts +0 -8
  35. package/dist/blueprints/zaps.js +0 -12
  36. package/dist/helpers/animated-qr.d.ts +0 -30
  37. package/dist/helpers/animated-qr.js +0 -71
  38. package/dist/helpers/history.d.ts +0 -26
  39. package/dist/helpers/history.js +0 -47
  40. package/dist/helpers/info.d.ts +0 -34
  41. package/dist/helpers/info.js +0 -97
  42. package/dist/helpers/methods.d.ts +0 -1
  43. package/dist/helpers/methods.js +0 -1
  44. package/dist/helpers/nutzap.d.ts +0 -27
  45. package/dist/helpers/nutzap.js +0 -66
  46. package/dist/helpers/tokens.d.ts +0 -58
  47. package/dist/helpers/tokens.js +0 -162
  48. package/dist/helpers/wallet.d.ts +0 -15
  49. package/dist/helpers/wallet.js +0 -41
  50. package/dist/helpers/zap-info.d.ts +0 -19
  51. package/dist/helpers/zap-info.js +0 -42
  52. package/dist/interface.d.ts +0 -6
  53. package/dist/interface.js +0 -1
  54. package/dist/models/history.d.ts +0 -6
  55. package/dist/models/history.js +0 -21
  56. package/dist/models/index.d.ts +0 -4
  57. package/dist/models/index.js +0 -4
  58. package/dist/models/nutzap.d.ts +0 -6
  59. package/dist/models/nutzap.js +0 -16
  60. package/dist/models/tokens.d.ts +0 -6
  61. package/dist/models/tokens.js +0 -58
  62. package/dist/models/wallet.d.ts +0 -13
  63. package/dist/models/wallet.js +0 -18
  64. package/dist/operations/history.d.ts +0 -7
  65. package/dist/operations/history.js +0 -34
  66. package/dist/operations/index.d.ts +0 -5
  67. package/dist/operations/index.js +0 -5
  68. package/dist/operations/nutzap.d.ts +0 -14
  69. package/dist/operations/nutzap.js +0 -33
  70. package/dist/operations/tokens.d.ts +0 -4
  71. package/dist/operations/tokens.js +0 -24
  72. package/dist/operations/wallet.d.ts +0 -8
  73. package/dist/operations/wallet.js +0 -30
  74. package/dist/operations/zap-info.d.ts +0 -10
  75. package/dist/operations/zap-info.js +0 -17
@@ -1,19 +0,0 @@
1
- import { Proof } from "@cashu/cashu-ts";
2
- import { NostrEvent } from "nostr-tools";
3
- export declare const NUTZAP_INFO_KIND = 10019;
4
- export declare const NutzapMintsSymbol: unique symbol;
5
- export declare const NutzapRelaysSymbol: unique symbol;
6
- /** Returns the relay URLs from a kind:10019 nutzap info event */
7
- export declare function getNutzapInfoRelays(event: NostrEvent): string[];
8
- /** Returns the mint URLs from a kind:10019 nutzap info event */
9
- export declare function getNutzapInfoMints(event: NostrEvent): {
10
- mint: string;
11
- units?: string[];
12
- }[];
13
- /** Returns the pubkey for P2PK-locking from a kind:10019 nutzap info event */
14
- export declare function getNutzapInfoPubkey(event: NostrEvent): string | undefined;
15
- /**
16
- * verfies if proofs are locked to nutzap info
17
- * @throws {Error} if proofs are not locked to nutzap info
18
- */
19
- export declare function verifyProofsLocked(proofs: Proof[], info: NostrEvent): void;
@@ -1,42 +0,0 @@
1
- import { getOrComputeCachedValue, mergeRelaySets, safeParse } from "applesauce-core/helpers";
2
- export const NUTZAP_INFO_KIND = 10019;
3
- // Symbols for caching computed values
4
- export const NutzapMintsSymbol = Symbol.for("nutzap-mints");
5
- export const NutzapRelaysSymbol = Symbol.for("nutzap-relays");
6
- /** Returns the relay URLs from a kind:10019 nutzap info event */
7
- export function getNutzapInfoRelays(event) {
8
- return getOrComputeCachedValue(event, NutzapRelaysSymbol, () => {
9
- return mergeRelaySets(event.tags.filter((t) => t[0] === "relay").map((t) => t[1]));
10
- });
11
- }
12
- /** Returns the mint URLs from a kind:10019 nutzap info event */
13
- export function getNutzapInfoMints(event) {
14
- return getOrComputeCachedValue(event, NutzapMintsSymbol, () => {
15
- return event.tags.filter((t) => t[0] === "mint").map((t) => ({ mint: t[1], units: t.slice(2).filter(Boolean) }));
16
- });
17
- }
18
- /** Returns the pubkey for P2PK-locking from a kind:10019 nutzap info event */
19
- export function getNutzapInfoPubkey(event) {
20
- return event.tags.find((t) => t[0] === "pubkey")?.[1];
21
- }
22
- /**
23
- * verfies if proofs are locked to nutzap info
24
- * @throws {Error} if proofs are not locked to nutzap info
25
- */
26
- export function verifyProofsLocked(proofs, info) {
27
- const pubkey = getNutzapInfoPubkey(info);
28
- if (!pubkey)
29
- throw new Error("Nutzap info must have a pubkey");
30
- const fullPubkey = pubkey.length === 64 ? `02${pubkey}` : pubkey;
31
- for (const proof of proofs) {
32
- const secret = safeParse(proof.secret);
33
- if (!secret)
34
- throw new Error(`Cashu token must have a spending condition`);
35
- if (!Array.isArray(secret))
36
- throw new Error("Invalid spending condition");
37
- if (secret[0] !== "P2PK")
38
- throw new Error("Token proofs must be P2PK locked");
39
- if (secret[1].data !== fullPubkey)
40
- throw new Error("Token proofs must be P2PK locked to the recipient's nutzap pubkey");
41
- }
42
- }
@@ -1,6 +0,0 @@
1
- import { Filter, NostrEvent } from "nostr-tools";
2
- import { Observable } from "rxjs";
3
- /** A method used to subscribe to events on a set of relays */
4
- export type NostrSubscriptionMethod = (relays: string[], filters: Filter[]) => Observable<NostrEvent | string>;
5
- /** A method used for publishing an event, can return a Promise that completes when published or an Observable that completes when published*/
6
- export type NostrPublishMethod = (relays: string[], event: NostrEvent) => Promise<any> | Observable<any>;
package/dist/interface.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { Model } from "applesauce-core";
2
- import { NostrEvent } from "nostr-tools";
3
- /** A model that returns an array of redeemed event ids for a wallet */
4
- export declare function WalletRedeemedModel(pubkey: string): Model<string[]>;
5
- /** A model that returns a timeline of wallet history events */
6
- export declare function WalletHistoryModel(pubkey: string, locked?: boolean | undefined): Model<NostrEvent[]>;
@@ -1,21 +0,0 @@
1
- import { combineLatest, filter, map, scan, startWith } from "rxjs";
2
- import { getHistoryRedeemed, isHistoryContentLocked, WALLET_HISTORY_KIND } from "../helpers/history.js";
3
- /** A model that returns an array of redeemed event ids for a wallet */
4
- export function WalletRedeemedModel(pubkey) {
5
- return (events) => events
6
- .filters({ kinds: [WALLET_HISTORY_KIND], authors: [pubkey] })
7
- .pipe(scan((ids, history) => [...ids, ...getHistoryRedeemed(history)], []));
8
- }
9
- /** A model that returns a timeline of wallet history events */
10
- export function WalletHistoryModel(pubkey, locked) {
11
- return (events) => {
12
- const updates = events.update$.pipe(filter((e) => e.kind === WALLET_HISTORY_KIND && e.pubkey === pubkey), startWith(undefined));
13
- const timeline = events.timeline({ kinds: [WALLET_HISTORY_KIND], authors: [pubkey] });
14
- return combineLatest([updates, timeline]).pipe(map(([_, history]) => {
15
- if (locked === undefined)
16
- return history;
17
- else
18
- return history.filter((entry) => isHistoryContentLocked(entry) === locked);
19
- }));
20
- };
21
- }
@@ -1,4 +0,0 @@
1
- export * from "./history.js";
2
- export * from "./tokens.js";
3
- export * from "./wallet.js";
4
- export * from "./nutzap.js";
@@ -1,4 +0,0 @@
1
- export * from "./history.js";
2
- export * from "./tokens.js";
3
- export * from "./wallet.js";
4
- export * from "./nutzap.js";
@@ -1,6 +0,0 @@
1
- import { Model } from "applesauce-core";
2
- import { NostrEvent } from "nostr-tools";
3
- /** A model that returns all nutzap events for an event */
4
- export declare function EventNutZapzModel(event: NostrEvent): Model<NostrEvent[]>;
5
- /** A model that returns all nutzaps for a users profile */
6
- export declare function ProfileNutZapzModel(pubkey: string): Model<NostrEvent[]>;
@@ -1,16 +0,0 @@
1
- import { getReplaceableAddress, isReplaceable } from "applesauce-core/helpers";
2
- import { map } from "rxjs";
3
- import { getNutzapPointer, NUTZAP_KIND } from "../helpers/nutzap.js";
4
- /** A model that returns all nutzap events for an event */
5
- export function EventNutZapzModel(event) {
6
- return (events) => isReplaceable(event.kind)
7
- ? events.timeline({ kinds: [NUTZAP_KIND], "#e": [event.id] })
8
- : events.timeline({ kinds: [NUTZAP_KIND], "#a": [getReplaceableAddress(event)] });
9
- }
10
- /** A model that returns all nutzaps for a users profile */
11
- export function ProfileNutZapzModel(pubkey) {
12
- return (events) => events
13
- .timeline({ kinds: [NUTZAP_KIND], "#p": [pubkey] })
14
- // filter out nutzaps that are for events
15
- .pipe(map((zaps) => zaps.filter((zap) => getNutzapPointer(zap) === undefined)));
16
- }
@@ -1,6 +0,0 @@
1
- import { Model } from "applesauce-core";
2
- import { NostrEvent } from "nostr-tools";
3
- /** A model that subscribes to all token events for a wallet, passing locked will filter by token locked status */
4
- export declare function WalletTokensModel(pubkey: string, locked?: boolean | undefined): Model<NostrEvent[]>;
5
- /** A model that returns the visible balance of a wallet for each mint */
6
- export declare function WalletBalanceModel(pubkey: string): Model<Record<string, number>>;
@@ -1,58 +0,0 @@
1
- import { combineLatest, filter, map, startWith } from "rxjs";
2
- import { getTokenContent, ignoreDuplicateProofs, isTokenContentLocked, WALLET_TOKEN_KIND } from "../helpers/tokens.js";
3
- /** removes deleted events from sorted array */
4
- function filterDeleted(tokens) {
5
- const deleted = new Set();
6
- return Array.from(tokens)
7
- .reverse()
8
- .filter((token) => {
9
- // skip this event if it a newer event says its deleted
10
- if (deleted.has(token.id))
11
- return false;
12
- // add ids to deleted array
13
- if (!isTokenContentLocked(token)) {
14
- const details = getTokenContent(token);
15
- for (const id of details.del)
16
- deleted.add(id);
17
- }
18
- return true;
19
- })
20
- .reverse();
21
- }
22
- /** A model that subscribes to all token events for a wallet, passing locked will filter by token locked status */
23
- export function WalletTokensModel(pubkey, locked) {
24
- return (events) => {
25
- const updates = events.update$.pipe(filter((e) => e.kind === WALLET_TOKEN_KIND && e.pubkey === pubkey), startWith(undefined));
26
- const timeline = events.timeline({ kinds: [WALLET_TOKEN_KIND], authors: [pubkey] });
27
- return combineLatest([updates, timeline]).pipe(
28
- // filter out locked tokens
29
- map(([_, tokens]) => {
30
- if (locked === undefined)
31
- return tokens;
32
- else
33
- return tokens.filter((t) => isTokenContentLocked(t) === locked);
34
- }),
35
- // remove deleted events
36
- map(filterDeleted));
37
- };
38
- }
39
- /** A model that returns the visible balance of a wallet for each mint */
40
- export function WalletBalanceModel(pubkey) {
41
- return (events) => {
42
- const updates = events.update$.pipe(filter((e) => e.kind === WALLET_TOKEN_KIND && e.pubkey === pubkey), startWith(undefined));
43
- const timeline = events.timeline({ kinds: [WALLET_TOKEN_KIND], authors: [pubkey] });
44
- return combineLatest([updates, timeline]).pipe(map(([_, tokens]) => tokens.filter((t) => !isTokenContentLocked(t))),
45
- // filter out deleted tokens
46
- map(filterDeleted),
47
- // map tokens to totals
48
- map((tokens) => {
49
- // ignore duplicate proofs
50
- const seen = new Set();
51
- return tokens.reduce((totals, token) => {
52
- const details = getTokenContent(token);
53
- const total = details.proofs.filter(ignoreDuplicateProofs(seen)).reduce((t, p) => t + p.amount, 0);
54
- return { ...totals, [details.mint]: (totals[details.mint] ?? 0) + total };
55
- }, {});
56
- }));
57
- };
58
- }
@@ -1,13 +0,0 @@
1
- import { Model } from "applesauce-core";
2
- import { NostrEvent } from "nostr-tools";
3
- export type WalletInfo = {
4
- locked: true;
5
- event: NostrEvent;
6
- } | {
7
- locked: false;
8
- event: NostrEvent;
9
- privateKey?: Uint8Array;
10
- mints: string[];
11
- };
12
- /** A model to get the state of a NIP-60 wallet */
13
- export declare function WalletModel(pubkey: string): Model<WalletInfo | undefined>;
@@ -1,18 +0,0 @@
1
- import { filter, map, merge } from "rxjs";
2
- import { getWalletMints, getWalletPrivateKey, isWalletLocked, WALLET_KIND } from "../helpers/wallet.js";
3
- /** A model to get the state of a NIP-60 wallet */
4
- export function WalletModel(pubkey) {
5
- return (events) => merge(
6
- // get the latest replaceable event
7
- events.replaceable(WALLET_KIND, pubkey),
8
- // and listen for any updates to matching events
9
- events.update$.pipe(filter((e) => e.kind === WALLET_KIND && e.pubkey === pubkey))).pipe(map((wallet) => {
10
- if (!wallet)
11
- return;
12
- if (isWalletLocked(wallet))
13
- return { locked: true, event: wallet };
14
- const mints = getWalletMints(wallet);
15
- const privateKey = getWalletPrivateKey(wallet);
16
- return { locked: false, mints, privateKey, event: wallet };
17
- }));
18
- }
@@ -1,7 +0,0 @@
1
- import { EventOperation } from "applesauce-factory";
2
- import { EventPointer } from "nostr-tools/nip19";
3
- import { HistoryContent } from "../helpers/history.js";
4
- /** Sets the encrypted tags of a wallet history event */
5
- export declare function setHistoryContent(content: HistoryContent): EventOperation;
6
- /** Sets the "e" "redeemed" tags on a wallet history event */
7
- export declare function setHistoryRedeemed(redeemed: (string | EventPointer)[]): EventOperation;
@@ -1,34 +0,0 @@
1
- import { ensureMarkedEventPointerTag } from "applesauce-factory/helpers";
2
- import { modifyHiddenTags, modifyPublicTags } from "applesauce-factory/operations";
3
- import { setSingletonTag } from "applesauce-factory/operations/tag";
4
- /** Includes "e" "created" tags in wallet history tags */
5
- function includeHistoryCreatedTags(created) {
6
- return (tags) => {
7
- for (const id of created) {
8
- tags = ensureMarkedEventPointerTag(tags, typeof id === "string" ? { id } : id, "created");
9
- }
10
- return tags;
11
- };
12
- }
13
- /** Sets the encrypted tags of a wallet history event */
14
- export function setHistoryContent(content) {
15
- const operations = [
16
- setSingletonTag(["direction", content.direction], true),
17
- setSingletonTag(["amount", String(content.amount)], true),
18
- includeHistoryCreatedTags(content.created),
19
- ];
20
- if (content.fee !== undefined)
21
- operations.push(setSingletonTag(["fee", String(content.fee)], true));
22
- if (content.mint !== undefined)
23
- operations.push(setSingletonTag(["mint", content.mint], true));
24
- return modifyHiddenTags(...operations);
25
- }
26
- /** Sets the "e" "redeemed" tags on a wallet history event */
27
- export function setHistoryRedeemed(redeemed) {
28
- return modifyPublicTags((tags) => {
29
- for (const id of redeemed) {
30
- tags = ensureMarkedEventPointerTag(tags, typeof id === "string" ? { id } : id, "redeemed");
31
- }
32
- return tags;
33
- });
34
- }
@@ -1,5 +0,0 @@
1
- export * as History from "./history.js";
2
- export * as Tokens from "./tokens.js";
3
- export * as Wallet from "./wallet.js";
4
- export * as ZapInfo from "./zap-info.js";
5
- export * as NutZap from "./nutzap.js";
@@ -1,5 +0,0 @@
1
- export * as History from "./history.js";
2
- export * as Tokens from "./tokens.js";
3
- export * as Wallet from "./wallet.js";
4
- export * as ZapInfo from "./zap-info.js";
5
- export * as NutZap from "./nutzap.js";
@@ -1,14 +0,0 @@
1
- import { Proof } from "@cashu/cashu-ts";
2
- import { EventOperation } from "applesauce-factory";
3
- import { NostrEvent } from "nostr-tools";
4
- import { AddressPointer, EventPointer, ProfilePointer } from "nostr-tools/nip19";
5
- /** Sets the cashu proofs for a nutzap event */
6
- export declare function setProofs(proofs: Proof[]): EventOperation;
7
- /** Sets the mint URL for a nutzap event */
8
- export declare function setMint(mint: string): EventOperation;
9
- /** Sets the recipient of a nutzap event */
10
- export declare function setRecipient(recipient: string | ProfilePointer): EventOperation;
11
- /** Sets the event that is being nutzapped */
12
- export declare function setEvent(event: EventPointer | AddressPointer | NostrEvent): EventOperation;
13
- /** Sets the comment content for a nutzap event */
14
- export declare function setComment(comment: string): EventOperation;
@@ -1,33 +0,0 @@
1
- import { getReplaceableAddress, isAddressPointer, isEvent, isReplaceable } from "applesauce-core/helpers";
2
- import { modifyPublicTags } from "applesauce-factory/operations";
3
- import { setContent } from "applesauce-factory/operations/content";
4
- import { addAddressTag, addEventTag, addPubkeyTag, setSingletonTag } from "applesauce-factory/operations/tag";
5
- /** Sets the cashu proofs for a nutzap event */
6
- export function setProofs(proofs) {
7
- // Create an operation to append proof tags
8
- const operation = (tags) => [...tags, ...proofs.map((proof) => ["proof", JSON.stringify(proof)])];
9
- return modifyPublicTags(operation);
10
- }
11
- /** Sets the mint URL for a nutzap event */
12
- export function setMint(mint) {
13
- return modifyPublicTags(setSingletonTag(["u", mint]));
14
- }
15
- /** Sets the recipient of a nutzap event */
16
- export function setRecipient(recipient) {
17
- return modifyPublicTags(addPubkeyTag(recipient, true));
18
- }
19
- /** Sets the event that is being nutzapped */
20
- export function setEvent(event) {
21
- let operation;
22
- if (isEvent(event))
23
- operation = isReplaceable(event.kind) ? addEventTag(event.id) : addAddressTag(getReplaceableAddress(event));
24
- else if (isAddressPointer(event))
25
- operation = addAddressTag(event);
26
- else
27
- operation = addEventTag(event);
28
- return modifyPublicTags(operation);
29
- }
30
- /** Sets the comment content for a nutzap event */
31
- export function setComment(comment) {
32
- return setContent(comment);
33
- }
@@ -1,4 +0,0 @@
1
- import { Token } from "@cashu/cashu-ts";
2
- import { EventOperation } from "applesauce-factory";
3
- /** Sets the content of a 7375 token event */
4
- export declare function setToken(token: Token, del?: string[]): EventOperation;
@@ -1,24 +0,0 @@
1
- import { EventContentEncryptionMethod } from "applesauce-core/helpers";
2
- import { setEncryptedContent } from "applesauce-factory/operations/content";
3
- /** Sets the content of a 7375 token event */
4
- export function setToken(token, del = []) {
5
- return async (draft, ctx) => {
6
- if (!ctx.signer)
7
- throw new Error(`Missing signer`);
8
- const pubkey = await ctx.signer.getPublicKey();
9
- const method = EventContentEncryptionMethod[draft.kind];
10
- if (!method)
11
- throw new Error("Failed to find encryption method");
12
- if (!token.mint)
13
- throw new Error("Token mint is required");
14
- if (!token.proofs || token.proofs.length === 0)
15
- throw new Error("Token proofs are required");
16
- const content = {
17
- mint: token.mint,
18
- proofs: token.proofs,
19
- unit: token.unit,
20
- del,
21
- };
22
- return await setEncryptedContent(pubkey, JSON.stringify(content), method)(draft, ctx);
23
- };
24
- }
@@ -1,8 +0,0 @@
1
- import { EventOperation } from "applesauce-factory";
2
- import { NostrEvent } from "nostr-tools";
3
- /** Sets the content of a kind 375 wallet backup event */
4
- export declare function setBackupContent(wallet: NostrEvent): EventOperation;
5
- /** Sets the "mint" tags in a wallet event */
6
- export declare function setMints(mints: string[]): EventOperation;
7
- /** Sets the "privkey" tag on a wallet event */
8
- export declare function setPrivateKey(privateKey: Uint8Array): EventOperation;
@@ -1,30 +0,0 @@
1
- import { bytesToHex } from "@noble/hashes/utils";
2
- import { modifyHiddenTags } from "applesauce-factory/operations";
3
- import { setSingletonTag } from "applesauce-factory/operations/tag";
4
- import { WALLET_KIND } from "../helpers/wallet.js";
5
- /** Sets the content of a kind 375 wallet backup event */
6
- export function setBackupContent(wallet) {
7
- return async (draft, ctx) => {
8
- if (wallet.kind !== WALLET_KIND)
9
- throw new Error(`Cant create a wallet backup from kind ${wallet.kind}`);
10
- if (!wallet.content)
11
- throw new Error("Wallet missing content");
12
- const pubkey = await ctx.signer?.getPublicKey();
13
- if (wallet.pubkey !== pubkey)
14
- throw new Error("Wallet pubkey dose not match signer pubkey");
15
- return { ...draft, content: wallet.content };
16
- };
17
- }
18
- /** Sets the "mint" tags in a wallet event */
19
- export function setMints(mints) {
20
- return modifyHiddenTags((tags) => [
21
- // remove all existing mint tags
22
- ...tags.filter((t) => t[0] !== "mint"),
23
- // add new mint tags
24
- ...mints.map((mint) => ["mint", mint]),
25
- ]);
26
- }
27
- /** Sets the "privkey" tag on a wallet event */
28
- export function setPrivateKey(privateKey) {
29
- return modifyHiddenTags(setSingletonTag(["privkey", bytesToHex(privateKey)], true));
30
- }
@@ -1,10 +0,0 @@
1
- import { EventOperation } from "applesauce-factory";
2
- /** Sets the relays for a nutzap info event */
3
- export declare function setNutzapInfoRelays(relays: string[]): EventOperation;
4
- /** Sets the mints for a nutzap info event */
5
- export declare function setNutzapInfoMints(mints: Array<{
6
- url: string;
7
- units?: string[];
8
- }>): EventOperation;
9
- /** Sets the pubkey for a nutzap info event */
10
- export declare function setNutzapInfoPubkey(pubkey: string): EventOperation;
@@ -1,17 +0,0 @@
1
- import { modifyPublicTags } from "applesauce-factory/operations";
2
- import { addNameValueTag, setSingletonTag } from "applesauce-factory/operations/tag";
3
- /** Sets the relays for a nutzap info event */
4
- export function setNutzapInfoRelays(relays) {
5
- return modifyPublicTags(...relays.map((relay) => addNameValueTag(["relay", relay], false)));
6
- }
7
- /** Sets the mints for a nutzap info event */
8
- export function setNutzapInfoMints(mints) {
9
- return modifyPublicTags(...mints.map((mint) => {
10
- const tag = mint.units ? ["mint", mint.url, ...mint.units] : ["mint", mint.url];
11
- return addNameValueTag(tag, false);
12
- }));
13
- }
14
- /** Sets the pubkey for a nutzap info event */
15
- export function setNutzapInfoPubkey(pubkey) {
16
- return modifyPublicTags(setSingletonTag(["pubkey", pubkey], true));
17
- }