applesauce-wallet 0.0.0-next-20250313125308 → 0.0.0-next-20250313135311

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.
@@ -6,7 +6,7 @@ import { NostrEvent } from "nostr-tools";
6
6
  * @param token the cashu token to add
7
7
  * @param redeemed an array of nutzap event ids to mark as redeemed
8
8
  */
9
- export declare function ReceiveToken(token: Token, redeemed?: string[]): Action;
9
+ export declare function ReceiveToken(token: Token, redeemed?: string[], fee?: number): Action;
10
10
  /** An action that deletes old tokens and creates a new one but does not add a history event */
11
11
  export declare function RolloverTokens(tokens: NostrEvent[], token: Token): Action;
12
12
  /** An action that deletes old token events and adds a spend history item */
@@ -7,11 +7,11 @@ import { WalletHistoryBlueprint } from "../blueprints/history.js";
7
7
  * @param token the cashu token to add
8
8
  * @param redeemed an array of nutzap event ids to mark as redeemed
9
9
  */
10
- export function ReceiveToken(token, redeemed) {
10
+ export function ReceiveToken(token, redeemed, fee) {
11
11
  return async ({ factory, publish }) => {
12
12
  const amount = token.proofs.reduce((t, p) => t + p.amount, 0);
13
13
  const tokenEvent = await factory.sign(await factory.create(WalletTokenBlueprint, token, []));
14
- const history = await factory.sign(await factory.create(WalletHistoryBlueprint, { direction: "in", amount, mint: token.mint, created: [tokenEvent.id] }, redeemed ?? []));
14
+ const history = await factory.sign(await factory.create(WalletHistoryBlueprint, { direction: "in", amount, mint: token.mint, created: [tokenEvent.id], fee }, redeemed ?? []));
15
15
  await publish("Save tokens", tokenEvent);
16
16
  await publish("Save transaction", history);
17
17
  };
@@ -46,7 +46,7 @@ export function WalletBalanceQuery(pubkey) {
46
46
  run: (events) => {
47
47
  const updates = events.updates.pipe(filter((e) => e.kind === WALLET_TOKEN_KIND && e.pubkey === pubkey), startWith(undefined));
48
48
  const timeline = events.timeline({ kinds: [WALLET_TOKEN_KIND], authors: [pubkey] });
49
- return combineLatest([updates, timeline]).pipe(map(([_, tokens]) => tokens),
49
+ return combineLatest([updates, timeline]).pipe(map(([_, tokens]) => tokens.filter((t) => !isTokenContentLocked(t))),
50
50
  // filter out deleted tokens
51
51
  map(filterDeleted),
52
52
  // map tokens to totals
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-wallet",
3
- "version": "0.0.0-next-20250313125308",
3
+ "version": "0.0.0-next-20250313135311",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -80,9 +80,9 @@
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-20250313125308",
84
- "applesauce-core": "0.0.0-next-20250313125308",
85
- "applesauce-factory": "0.0.0-next-20250313125308",
83
+ "applesauce-actions": "0.0.0-next-20250313135311",
84
+ "applesauce-core": "0.0.0-next-20250313135311",
85
+ "applesauce-factory": "0.0.0-next-20250313135311",
86
86
  "buffer": "^6.0.3",
87
87
  "nostr-tools": "^2.10.4",
88
88
  "rxjs": "^7.8.1"
@@ -90,7 +90,7 @@
90
90
  "devDependencies": {
91
91
  "@hirez_io/observer-spy": "^2.2.0",
92
92
  "@types/debug": "^4.1.12",
93
- "applesauce-signers": "0.0.0-next-20250313125308",
93
+ "applesauce-signers": "0.0.0-next-20250313135311",
94
94
  "typescript": "^5.7.3",
95
95
  "vitest": "^3.0.5"
96
96
  },