mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-07 14:10:28 +03:00
Respect onlyIfTrusted parameter on Solana connect request
This commit is contained in:
parent
a72bf1b1a9
commit
cff5fe2e8c
File diff suppressed because one or more lines are too long
@ -59,8 +59,12 @@ class TokenarySolana extends EventEmitter {
|
||||
this.pendingPayloads = [];
|
||||
}
|
||||
|
||||
connect() {
|
||||
return this.request({method: "connect"});
|
||||
connect(params) {
|
||||
var payload = {method: "connect"};
|
||||
if (typeof params !== "undefined") {
|
||||
payload.params = params;
|
||||
}
|
||||
return this.request(payload);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
@ -143,7 +147,12 @@ class TokenarySolana extends EventEmitter {
|
||||
switch (payload.method) {
|
||||
case "connect":
|
||||
if (!this.publicKey) {
|
||||
return this.postMessage("connect", payload.id, {});
|
||||
if ("params" in payload && "onlyIfTrusted" in payload.params && payload.params.onlyIfTrusted) {
|
||||
this.sendError(payload.id, "Click a button to connect");
|
||||
return;
|
||||
} else {
|
||||
return this.postMessage("connect", payload.id, {});
|
||||
}
|
||||
} else {
|
||||
this.isConnected = true;
|
||||
this.emitConnect(this.publicKey);
|
||||
|
Loading…
Reference in New Issue
Block a user