applesauce-wallet-connect 0.0.0-next-20251012142625 → 0.0.0-next-20251203172109
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.
- package/dist/blueprints/notification.d.ts +1 -1
- package/dist/blueprints/notification.js +3 -3
- package/dist/blueprints/request.d.ts +1 -1
- package/dist/blueprints/request.js +3 -3
- package/dist/blueprints/response.d.ts +2 -2
- package/dist/blueprints/response.js +3 -3
- package/dist/blueprints/support.d.ts +1 -1
- package/dist/blueprints/support.js +3 -3
- package/dist/helpers/notification.d.ts +1 -1
- package/dist/helpers/request.d.ts +2 -2
- package/dist/helpers/request.js +5 -1
- package/dist/helpers/response.d.ts +3 -2
- package/dist/helpers/response.js +4 -1
- package/dist/helpers/support.d.ts +1 -1
- package/dist/interop.d.ts +2 -1
- package/dist/wallet-connect.d.ts +2 -2
- package/dist/wallet-connect.js +4 -3
- package/dist/wallet-service.d.ts +1 -1
- package/dist/wallet-service.js +6 -5
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { blueprint } from "applesauce-factory";
|
|
2
|
-
import { includeSingletonTag } from "applesauce-
|
|
3
|
-
import { setEncryptedContent } from "applesauce-
|
|
1
|
+
import { blueprint } from "applesauce-core/event-factory";
|
|
2
|
+
import { includeSingletonTag } from "applesauce-core/operations/tags";
|
|
3
|
+
import { setEncryptedContent } from "applesauce-core/operations/encrypted-content";
|
|
4
4
|
import { WALLET_NOTIFICATION_KIND, WALLET_LEGACY_NOTIFICATION_KIND, } from "../helpers/notification.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a wallet notification event (kind 23197)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { blueprint } from "applesauce-
|
|
2
|
-
import { includeSingletonTag } from "applesauce-
|
|
3
|
-
import { setEncryptedContent } from "applesauce-
|
|
1
|
+
import { blueprint } from "applesauce-core";
|
|
2
|
+
import { includeSingletonTag } from "applesauce-core/operations/tags";
|
|
3
|
+
import { setEncryptedContent } from "applesauce-core/operations/encrypted-content";
|
|
4
4
|
import { WALLET_REQUEST_KIND } from "../helpers/request.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a walelt request event
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventBlueprint } from "applesauce-
|
|
2
|
-
import { NostrEvent } from "
|
|
1
|
+
import { EventBlueprint } from "applesauce-core";
|
|
2
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
3
3
|
import { TWalletMethod } from "../helpers/methods.js";
|
|
4
4
|
/** Creates a wallet response event */
|
|
5
5
|
export declare function WalletResponseBlueprint<Method extends TWalletMethod>(request: NostrEvent, response: Method["response"] | Method["error"]): EventBlueprint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { blueprint } from "applesauce-
|
|
2
|
-
import { includeSingletonTag } from "applesauce-
|
|
3
|
-
import { setEncryptedContent } from "applesauce-
|
|
1
|
+
import { blueprint } from "applesauce-core";
|
|
2
|
+
import { includeSingletonTag } from "applesauce-core/operations/tags";
|
|
3
|
+
import { setEncryptedContent } from "applesauce-core/operations/encrypted-content";
|
|
4
4
|
import { getWalletRequestEncryption } from "../helpers/request.js";
|
|
5
5
|
import { WALLET_RESPONSE_KIND } from "../helpers/response.js";
|
|
6
6
|
/** Creates a wallet response event */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { blueprint } from "applesauce-
|
|
2
|
-
import { setContent } from "applesauce-
|
|
3
|
-
import { includeSingletonTag } from "applesauce-
|
|
1
|
+
import { blueprint } from "applesauce-core";
|
|
2
|
+
import { setContent } from "applesauce-core/operations/content";
|
|
3
|
+
import { includeSingletonTag } from "applesauce-core/operations/tags";
|
|
4
4
|
import { WALLET_INFO_KIND } from "../helpers/support.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a wallet info event
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HiddenContentSigner, KnownEvent, UnlockedHiddenContent } from "applesauce-core/helpers";
|
|
2
|
-
import { NostrEvent } from "
|
|
2
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
3
3
|
import { Transaction } from "./methods.js";
|
|
4
4
|
export declare const WALLET_NOTIFICATION_KIND = 23197;
|
|
5
5
|
export declare const WALLET_LEGACY_NOTIFICATION_KIND = 23196;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
|
|
2
|
+
import { HiddenContentSigner, UnlockedHiddenContent } from "applesauce-core/helpers/hidden-content";
|
|
3
3
|
import { WalletConnectEncryptionMethod } from "./encryption.js";
|
|
4
4
|
import { TWalletMethod } from "./methods.js";
|
|
5
5
|
export declare const WALLET_REQUEST_KIND = 23194;
|
package/dist/helpers/request.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNIP04Encrypted } from "applesauce-core/helpers/encryption";
|
|
2
|
+
import { notifyEventUpdate } from "applesauce-core/helpers/event";
|
|
3
|
+
import { getTagValue } from "applesauce-core/helpers/event";
|
|
4
|
+
import { isHiddenContentUnlocked, setHiddenContentEncryptionMethod, unlockHiddenContent, } from "applesauce-core/helpers/hidden-content";
|
|
5
|
+
import { unixNow } from "applesauce-core/helpers/time";
|
|
2
6
|
export const WALLET_REQUEST_KIND = 23194;
|
|
3
7
|
// Set the encryption method to use for request kind
|
|
4
8
|
setHiddenContentEncryptionMethod(WALLET_REQUEST_KIND, "nip44");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EncryptionMethod
|
|
2
|
-
import { NostrEvent } from "
|
|
1
|
+
import { EncryptionMethod } from "applesauce-core/helpers/encrypted-content";
|
|
2
|
+
import { KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
|
|
3
|
+
import { HiddenContentSigner, UnlockedHiddenContent } from "applesauce-core/helpers/hidden-content";
|
|
3
4
|
import { TWalletMethod } from "./methods.js";
|
|
4
5
|
export declare const WALLET_RESPONSE_KIND = 23195;
|
|
5
6
|
/** A symbol used to cache the wallet response on the event */
|
package/dist/helpers/response.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNIP04Encrypted } from "applesauce-core/helpers/encryption";
|
|
2
|
+
import { notifyEventUpdate } from "applesauce-core/helpers/event";
|
|
3
|
+
import { getTagValue } from "applesauce-core/helpers/event";
|
|
4
|
+
import { isHiddenContentUnlocked, setHiddenContentEncryptionMethod, unlockHiddenContent, } from "applesauce-core/helpers/hidden-content";
|
|
2
5
|
export const WALLET_RESPONSE_KIND = 23195;
|
|
3
6
|
// Set the encryption method to use for response kind
|
|
4
7
|
setHiddenContentEncryptionMethod(WALLET_RESPONSE_KIND, "nip04");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NostrEvent } from "
|
|
1
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
2
2
|
import { WalletConnectEncryptionMethod } from "./encryption.js";
|
|
3
3
|
import { TWalletMethod } from "./methods.js";
|
|
4
4
|
import { NotificationType } from "./notification.js";
|
package/dist/interop.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
2
|
+
import { Filter } from "applesauce-core/helpers/filter";
|
|
2
3
|
import { ObservableInput } from "rxjs";
|
|
3
4
|
/** A method used to subscribe to events on a set of relays */
|
|
4
5
|
export type NostrSubscriptionMethod = (relays: string[], filters: Filter[]) => ObservableInput<NostrEvent | string>;
|
package/dist/wallet-connect.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EncryptionMethod } from "applesauce-core/helpers";
|
|
2
|
-
import { EventSigner } from "applesauce-
|
|
3
|
-
import { NostrEvent } from "
|
|
2
|
+
import { EventSigner } from "applesauce-core";
|
|
3
|
+
import { NostrEvent } from "applesauce-core/helpers";
|
|
4
4
|
import { BehaviorSubject, Observable, Subscription } from "rxjs";
|
|
5
5
|
import { NotificationType, WalletAuthURI, WalletConnectEncryptionMethod, WalletConnectURI, WalletNotification, WalletNotificationEvent, WalletResponseEvent, WalletSupport } from "./helpers/index.js";
|
|
6
6
|
import { CommonWalletMethods, GetBalanceMethod, GetInfoMethod, ListTransactionsMethod, LookupInvoiceMethod, MakeInvoiceMethod, MultiPayInvoiceMethod, MultiPayKeysendMethod, PayInvoiceMethod, PayKeysendMethod, TWalletMethod } from "./helpers/methods.js";
|
package/dist/wallet-connect.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
|
|
2
2
|
import { simpleTimeout } from "applesauce-core";
|
|
3
|
-
import {
|
|
4
|
-
import { finalizeEvent, getPublicKey,
|
|
3
|
+
import { createEvent } from "applesauce-core";
|
|
4
|
+
import { finalizeEvent, getPublicKey, verifyEvent } from "applesauce-core/helpers";
|
|
5
|
+
import { nip04, nip44 } from "applesauce-core/helpers/encryption";
|
|
5
6
|
import { BehaviorSubject, combineLatest, defer, filter, firstValueFrom, from, fromEvent, identity, ignoreElements, lastValueFrom, map, merge, mergeMap, of, repeat, ReplaySubject, retry, share, switchMap, take, takeUntil, tap, timer, toArray, } from "rxjs";
|
|
6
7
|
import { WalletRequestBlueprint } from "./blueprints/index.js";
|
|
7
8
|
import { createWalletError } from "./helpers/error.js";
|
|
@@ -166,7 +167,7 @@ export class WalletConnect {
|
|
|
166
167
|
// Get the preferred encryption method for the wallet
|
|
167
168
|
const encryption = await firstValueFrom(this.encryption$);
|
|
168
169
|
// Create the request event
|
|
169
|
-
const draft = await
|
|
170
|
+
const draft = await createEvent({ signer: this.signer }, WalletRequestBlueprint, this.service, { method, params }, encryption);
|
|
170
171
|
// Sign the request event
|
|
171
172
|
return await this.signer.signEvent(draft);
|
|
172
173
|
}).pipe(
|
package/dist/wallet-service.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventSigner } from "applesauce-factory";
|
|
1
|
+
import { EventSigner } from "applesauce-core/event-factory";
|
|
2
2
|
import { Observable, Subscription } from "rxjs";
|
|
3
3
|
import { WalletAuthURI } from "./helpers/auth-uri.js";
|
|
4
4
|
import { WalletErrorCode } from "./helpers/error.js";
|
package/dist/wallet-service.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { logger } from "applesauce-core";
|
|
2
|
-
import {
|
|
3
|
-
import { generateSecretKey, getPublicKey, verifyEvent } from "nostr-tools";
|
|
2
|
+
import { createEvent } from "applesauce-core/event-factory";
|
|
4
3
|
import { filter, from, mergeMap, repeat, retry, share } from "rxjs";
|
|
4
|
+
import { verifyEvent } from "applesauce-core/helpers/event";
|
|
5
|
+
import { generateSecretKey, getPublicKey } from "applesauce-core/helpers/keys";
|
|
5
6
|
import { bytesToHex } from "@noble/hashes/utils";
|
|
6
7
|
import { WalletLegacyNotificationBlueprint, WalletNotificationBlueprint } from "./blueprints/notification.js";
|
|
7
8
|
import { WalletResponseBlueprint } from "./blueprints/response.js";
|
|
@@ -154,7 +155,7 @@ export class WalletService {
|
|
|
154
155
|
}
|
|
155
156
|
/** Send a notification to the client */
|
|
156
157
|
async notify(type, notification, legacy = false) {
|
|
157
|
-
const draft = await
|
|
158
|
+
const draft = await createEvent({ signer: this.signer }, legacy ? WalletLegacyNotificationBlueprint : WalletNotificationBlueprint, this.client, {
|
|
158
159
|
notification_type: type,
|
|
159
160
|
notification,
|
|
160
161
|
});
|
|
@@ -166,7 +167,7 @@ export class WalletService {
|
|
|
166
167
|
try {
|
|
167
168
|
// Tell the client which relay to use if there is only one (for nostr+walletauth URI connections)
|
|
168
169
|
const overrideRelay = this.relays.length === 1 ? this.relays[0] : undefined;
|
|
169
|
-
const draft = await
|
|
170
|
+
const draft = await createEvent({ signer: this.signer }, (WalletSupportBlueprint), this.support, this.client, overrideRelay);
|
|
170
171
|
const event = await this.signer.signEvent(draft);
|
|
171
172
|
await this.publishMethod(this.relays, event);
|
|
172
173
|
}
|
|
@@ -260,7 +261,7 @@ export class WalletService {
|
|
|
260
261
|
/** Send a response event */
|
|
261
262
|
async sendResponse(requestEvent, response) {
|
|
262
263
|
try {
|
|
263
|
-
const draft = await
|
|
264
|
+
const draft = await createEvent({ signer: this.signer }, WalletResponseBlueprint(requestEvent, response));
|
|
264
265
|
const event = await this.signer.signEvent(draft);
|
|
265
266
|
await this.publishMethod(this.relays, event);
|
|
266
267
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-wallet-connect",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20251203172109",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@noble/hashes": "^1.7.1",
|
|
62
|
-
"applesauce-
|
|
63
|
-
"applesauce-
|
|
64
|
-
"nostr-tools": "~2.17",
|
|
62
|
+
"applesauce-common": "0.0.0-next-20251203172109",
|
|
63
|
+
"applesauce-core": "0.0.0-next-20251203172109",
|
|
65
64
|
"rxjs": "^7.8.1"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
68
67
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
68
|
+
"applesauce-signers": "0.0.0-next-20251203172109",
|
|
69
69
|
"@types/debug": "^4.1.12",
|
|
70
70
|
"rimraf": "^6.0.1",
|
|
71
71
|
"typescript": "^5.8.3",
|
|
72
|
-
"vitest": "^
|
|
72
|
+
"vitest": "^4.0.15"
|
|
73
73
|
},
|
|
74
74
|
"funding": {
|
|
75
75
|
"type": "lightning",
|