applesauce-wallet 0.0.0-next-20250312113207 → 0.0.0-next-20250312152821
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EventStore, QueryStore } from "applesauce-core";
|
|
2
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
3
|
+
import { EventFactory } from "applesauce-factory";
|
|
4
|
+
import { generateSecretKey } from "nostr-tools";
|
|
5
|
+
import { subscribeSpyTo } from "@hirez_io/observer-spy";
|
|
6
|
+
import { FakeUser } from "../../__tests__/fake-user.js";
|
|
7
|
+
import { WalletBlueprint } from "../../blueprints/wallet.js";
|
|
8
|
+
import { WalletQuery } from "../wallet.js";
|
|
9
|
+
import { unlockWallet } from "../../helpers/wallet.js";
|
|
10
|
+
const user = new FakeUser();
|
|
11
|
+
const factory = new EventFactory({ signer: user });
|
|
12
|
+
let events;
|
|
13
|
+
let queries;
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
events = new EventStore();
|
|
16
|
+
queries = new QueryStore(events);
|
|
17
|
+
});
|
|
18
|
+
describe("WalletQuery", () => {
|
|
19
|
+
it("it should update when event is unlocked", async () => {
|
|
20
|
+
const wallet = await user.signEvent(await factory.create(WalletBlueprint, generateSecretKey(), []));
|
|
21
|
+
events.add(wallet);
|
|
22
|
+
const spy = subscribeSpyTo(queries.createQuery(WalletQuery, await user.getPublicKey()));
|
|
23
|
+
await unlockWallet(wallet, user);
|
|
24
|
+
expect(spy.getValues()).toEqual([
|
|
25
|
+
expect.objectContaining({ locked: true }),
|
|
26
|
+
expect.objectContaining({ locked: false }),
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-wallet",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250312152821",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -79,16 +79,16 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@cashu/cashu-ts": "2.0.0-rc1",
|
|
81
81
|
"@noble/hashes": "^1.7.1",
|
|
82
|
-
"applesauce-actions": "0.0.0-next-
|
|
83
|
-
"applesauce-core": "0.0.0-next-
|
|
84
|
-
"applesauce-factory": "0.0.0-next-
|
|
82
|
+
"applesauce-actions": "0.0.0-next-20250312152821",
|
|
83
|
+
"applesauce-core": "0.0.0-next-20250312152821",
|
|
84
|
+
"applesauce-factory": "0.0.0-next-20250312152821",
|
|
85
85
|
"nostr-tools": "^2.10.4",
|
|
86
86
|
"rxjs": "^7.8.1"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
90
90
|
"@types/debug": "^4.1.12",
|
|
91
|
-
"applesauce-signers": "0.0.0-next-
|
|
91
|
+
"applesauce-signers": "0.0.0-next-20250312152821",
|
|
92
92
|
"typescript": "^5.7.3",
|
|
93
93
|
"vitest": "^3.0.5"
|
|
94
94
|
},
|