mirror of
https://github.com/nostr-connect/connect.git
synced 2025-12-17 05:04:20 +01:00
lint
This commit is contained in:
@@ -62,13 +62,16 @@ export class ConnectURI {
|
|||||||
relay: this.relayURL,
|
relay: this.relayURL,
|
||||||
secretKey,
|
secretKey,
|
||||||
});
|
});
|
||||||
await rpc.call({
|
await rpc.call(
|
||||||
target: this.target,
|
{
|
||||||
request: {
|
target: this.target,
|
||||||
method: 'connect',
|
request: {
|
||||||
params: [getPublicKey(secretKey)],
|
method: 'connect',
|
||||||
|
params: [getPublicKey(secretKey)],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, { skipResponse: true });
|
{ skipResponse: true }
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -78,13 +81,16 @@ export class ConnectURI {
|
|||||||
relay: this.relayURL,
|
relay: this.relayURL,
|
||||||
secretKey,
|
secretKey,
|
||||||
});
|
});
|
||||||
await rpc.call({
|
await rpc.call(
|
||||||
target: this.target,
|
{
|
||||||
request: {
|
target: this.target,
|
||||||
method: 'disconnect',
|
request: {
|
||||||
params: [],
|
method: 'disconnect',
|
||||||
|
params: [],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, { skipResponse: true });
|
{ skipResponse: true }
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -135,7 +141,7 @@ export class Connect {
|
|||||||
const [pubkey] = payload.params;
|
const [pubkey] = payload.params;
|
||||||
this.target = pubkey;
|
this.target = pubkey;
|
||||||
this.events.emit('connect', pubkey);
|
this.events.emit('connect', pubkey);
|
||||||
return
|
return;
|
||||||
case 'disconnect':
|
case 'disconnect':
|
||||||
this.target = undefined;
|
this.target = undefined;
|
||||||
this.events.emit('disconnect');
|
this.events.emit('disconnect');
|
||||||
|
|||||||
26
src/rpc.ts
26
src/rpc.ts
@@ -37,17 +37,20 @@ export class NostrRPC {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async call({
|
async call(
|
||||||
target,
|
{
|
||||||
request: { id = randomID(), method, params = [] },
|
target,
|
||||||
}: {
|
request: { id = randomID(), method, params = [] },
|
||||||
target: string;
|
}: {
|
||||||
request: {
|
target: string;
|
||||||
id?: string;
|
request: {
|
||||||
method: string;
|
id?: string;
|
||||||
params?: any[];
|
method: string;
|
||||||
};
|
params?: any[];
|
||||||
}, opts?: { skipResponse?: boolean, timeout?: number }): Promise<any> {
|
};
|
||||||
|
},
|
||||||
|
opts?: { skipResponse?: boolean; timeout?: number }
|
||||||
|
): Promise<any> {
|
||||||
// connect to relay
|
// connect to relay
|
||||||
const relay = await connectToRelay(this.relay);
|
const relay = await connectToRelay(this.relay);
|
||||||
|
|
||||||
@@ -295,4 +298,3 @@ export async function broadcastToRelay(relay: Relay, event: Event) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user