applesauce-wallet 0.0.0-next-20250725170333 → 0.0.0-next-20250726160247

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.
@@ -1,7 +1,7 @@
1
1
  import { blueprint } from "applesauce-factory";
2
2
  import { skip } from "applesauce-factory/helpers";
3
- import { NUTZAP_KIND } from "../helpers/zaps.js";
4
- import { setComment, setEvent, setMint, setProofs, setRecipient } from "../operations/nut-zap.js";
3
+ import { NUTZAP_KIND } from "../helpers/nutzap.js";
4
+ import { setComment, setEvent, setMint, setProofs, setRecipient } from "../operations/nutzap.js";
5
5
  /** A blueprint to create a NIP-61 nutzap event for an event */
6
6
  export function NutzapBlueprint(event, token, comment) {
7
7
  return blueprint(NUTZAP_KIND, setProofs(token.proofs), setMint(token.mint), setEvent(event), setRecipient(event.pubkey), comment ? setComment(comment) : skip());
@@ -3,4 +3,4 @@ export * from "./history.js";
3
3
  export * from "./tokens.js";
4
4
  export * from "./wallet.js";
5
5
  export * from "./zap-info.js";
6
- export * from "./zaps.js";
6
+ export * from "./nutzap.js";
@@ -3,4 +3,4 @@ export * from "./history.js";
3
3
  export * from "./tokens.js";
4
4
  export * from "./wallet.js";
5
5
  export * from "./zap-info.js";
6
- export * from "./zaps.js";
6
+ export * from "./nutzap.js";
@@ -4,6 +4,7 @@ import { AddressPointer, EventPointer } from "nostr-tools/nip19";
4
4
  export declare const NUTZAP_KIND = 9321;
5
5
  export declare const NutzapProofsSymbol: unique symbol;
6
6
  export declare const NutzapAmountSymbol: unique symbol;
7
+ export declare const NutzapMintSymbol: unique symbol;
7
8
  /** Returns the cashu proofs from a kind:9321 nutzap event */
8
9
  export declare function getNutzapProofs(event: NostrEvent): Proof[];
9
10
  /** Returns the mint URL from a kind:9321 nutzap event */
@@ -1,9 +1,10 @@
1
- import { getAddressPointerFromATag, getEventPointerFromETag, getOrComputeCachedValue, processTags, safeParse, } from "applesauce-core/helpers";
1
+ import { getAddressPointerFromATag, getEventPointerFromETag, getOrComputeCachedValue, getTagValue, processTags, safeParse, } from "applesauce-core/helpers";
2
2
  import { getHistoryRedeemed } from "./history.js";
3
3
  export const NUTZAP_KIND = 9321;
4
4
  // Symbols for caching computed values
5
5
  export const NutzapProofsSymbol = Symbol.for("nutzap-proofs");
6
6
  export const NutzapAmountSymbol = Symbol.for("nutzap-amount");
7
+ export const NutzapMintSymbol = Symbol.for("nutzap-mint");
7
8
  /** Returns the cashu proofs from a kind:9321 nutzap event */
8
9
  export function getNutzapProofs(event) {
9
10
  return getOrComputeCachedValue(event, NutzapProofsSymbol, () => {
@@ -12,11 +13,14 @@ export function getNutzapProofs(event) {
12
13
  }
13
14
  /** Returns the mint URL from a kind:9321 nutzap event */
14
15
  export function getNutzapMint(event) {
15
- return event.tags.find((t) => t[0] === "u")?.[1];
16
+ return getOrComputeCachedValue(event, NutzapMintSymbol, () => {
17
+ const url = getTagValue(event, "u");
18
+ return url && URL.canParse(url) ? url : undefined;
19
+ });
16
20
  }
17
21
  /** Returns the recipient pubkey from a kind:9321 nutzap event */
18
22
  export function getNutzapRecipient(event) {
19
- return event.tags.find((t) => t[0] === "p")?.[1];
23
+ return getTagValue(event, "p");
20
24
  }
21
25
  /** Returns the event ID being nutzapped from a kind:9321 nutzap event */
22
26
  export function getNutzapEventPointer(event) {
@@ -1,4 +1,4 @@
1
1
  export * from "./history.js";
2
2
  export * from "./tokens.js";
3
3
  export * from "./wallet.js";
4
- export * from "./zaps.js";
4
+ export * from "./nutzap.js";
@@ -1,4 +1,4 @@
1
1
  export * from "./history.js";
2
2
  export * from "./tokens.js";
3
3
  export * from "./wallet.js";
4
- export * from "./zaps.js";
4
+ export * from "./nutzap.js";
@@ -1,6 +1,6 @@
1
1
  import { getReplaceableAddress, isReplaceable } from "applesauce-core/helpers";
2
2
  import { map } from "rxjs";
3
- import { getNutzapPointer, NUTZAP_KIND } from "../helpers/zaps.js";
3
+ import { getNutzapPointer, NUTZAP_KIND } from "../helpers/nutzap.js";
4
4
  /** A model that returns all nutzap events for an event */
5
5
  export function EventNutZapzModel(event) {
6
6
  return (events) => isReplaceable(event.kind)
@@ -2,4 +2,4 @@ export * as History from "./history.js";
2
2
  export * as Tokens from "./tokens.js";
3
3
  export * as Wallet from "./wallet.js";
4
4
  export * as ZapInfo from "./zap-info.js";
5
- export * as NutZap from "./nut-zap.js";
5
+ export * as NutZap from "./nutzap.js";
@@ -2,4 +2,4 @@ export * as History from "./history.js";
2
2
  export * as Tokens from "./tokens.js";
3
3
  export * as Wallet from "./wallet.js";
4
4
  export * as ZapInfo from "./zap-info.js";
5
- export * as NutZap from "./nut-zap.js";
5
+ export * as NutZap from "./nutzap.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-wallet",
3
- "version": "0.0.0-next-20250725170333",
3
+ "version": "0.0.0-next-20250726160247",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -80,16 +80,16 @@
80
80
  "@cashu/cashu-ts": "2.0.0-rc1",
81
81
  "@gandlaf21/bc-ur": "^1.1.12",
82
82
  "@noble/hashes": "^1.7.1",
83
- "applesauce-actions": "0.0.0-next-20250725170333",
84
- "applesauce-core": "0.0.0-next-20250725170333",
85
- "applesauce-factory": "0.0.0-next-20250725170333",
83
+ "applesauce-actions": "0.0.0-next-20250726160247",
84
+ "applesauce-core": "0.0.0-next-20250726160247",
85
+ "applesauce-factory": "0.0.0-next-20250726160247",
86
86
  "nostr-tools": "^2.13",
87
87
  "rxjs": "^7.8.1"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@hirez_io/observer-spy": "^2.2.0",
91
91
  "@types/debug": "^4.1.12",
92
- "applesauce-signers": "0.0.0-next-20250725170333",
92
+ "applesauce-signers": "0.0.0-next-20250726160247",
93
93
  "typescript": "^5.8.3",
94
94
  "vitest": "^3.2.3"
95
95
  },
File without changes
File without changes
File without changes