feat: NDK (WIP)
This commit is contained in:
@ -156,9 +156,7 @@ export class NostrConnectWallet extends EventEmitter<WalletEvents> implements LN
|
||||
},
|
||||
reject,
|
||||
});
|
||||
this.#conn?.queueReq(["REQ", "info", { kinds: [13194], limit: 1 }], () => {
|
||||
// ignored
|
||||
});
|
||||
this.#conn?.request(["REQ", "info", { kinds: [13194], limit: 1 }]);
|
||||
});
|
||||
} else {
|
||||
throw new WalletError(WalletErrorCode.GeneralError, rsp.error.message);
|
||||
@ -292,7 +290,7 @@ export class NostrConnectWallet extends EventEmitter<WalletEvents> implements LN
|
||||
|
||||
pending.resolve(e.content);
|
||||
this.#commandQueue.delete(replyTo[1]);
|
||||
this.#conn?.closeReq(sub);
|
||||
this.#conn?.closeRequest(sub);
|
||||
}
|
||||
|
||||
async #rpc<T>(method: string, params: Record<string, string | number | undefined>) {
|
||||
@ -320,21 +318,16 @@ export class NostrConnectWallet extends EventEmitter<WalletEvents> implements LN
|
||||
.tag(["p", this.#config.walletPubkey]);
|
||||
|
||||
const evCommand = await eb.buildAndSign(this.#config.secret);
|
||||
this.#conn.queueReq(
|
||||
[
|
||||
"REQ",
|
||||
evCommand.id.slice(0, 12),
|
||||
{
|
||||
kinds: [23195 as EventKind],
|
||||
authors: [this.#config.walletPubkey],
|
||||
["#e"]: [evCommand.id],
|
||||
},
|
||||
],
|
||||
() => {
|
||||
// ignored
|
||||
this.#conn.request([
|
||||
"REQ",
|
||||
evCommand.id.slice(0, 12),
|
||||
{
|
||||
kinds: [23195 as EventKind],
|
||||
authors: [this.#config.walletPubkey],
|
||||
["#e"]: [evCommand.id],
|
||||
},
|
||||
);
|
||||
await this.#conn.sendEventAsync(evCommand);
|
||||
]);
|
||||
await this.#conn.publish(evCommand);
|
||||
return await new Promise<T>((resolve, reject) => {
|
||||
this.#commandQueue.set(evCommand.id, {
|
||||
resolve: async (o: string) => {
|
||||
|
Reference in New Issue
Block a user