File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ export interface ConnectorEvents {
2828 disconnect ( ) : void
2929}
3030
31+ export type ConnectOptions = {
32+ silent_mode : boolean
33+ }
34+
3135export abstract class Connector extends EventEmitter < ConnectorEvents > {
3236 /** Unique connector id. */
3337 abstract get id ( ) : string
@@ -41,7 +45,7 @@ export abstract class Connector extends EventEmitter<ConnectorEvents> {
4145 /** Whether connector is already authorized */
4246 abstract ready ( ) : Promise < boolean >
4347 /** Connect wallet. */
44- abstract connect ( ) : Promise < ConnectorData >
48+ abstract connect ( params ?: ConnectOptions ) : Promise < ConnectorData >
4549 /** Disconnect wallet. */
4650 abstract disconnect ( ) : Promise < void >
4751 /** Get current account silently. Return null if the account is not authorized */
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818} from "../../errors"
1919import { removeStarknetLastConnectedWallet } from "../../helpers/lastConnected"
2020import {
21+ ConnectOptions ,
2122 Connector ,
2223 type ConnectorData ,
2324 type ConnectorIcons ,
@@ -138,7 +139,7 @@ export class InjectedConnector extends Connector {
138139 return new Account ( provider , accounts [ 0 ] , "" )
139140 }
140141
141- async connect ( ) : Promise < ConnectorData > {
142+ async connect ( params : ConnectOptions ) : Promise < ConnectorData > {
142143 this . ensureWallet ( )
143144
144145 if ( ! this . _wallet ) {
@@ -147,9 +148,16 @@ export class InjectedConnector extends Connector {
147148
148149 let accounts : string [ ]
149150 try {
150- accounts = await this . request ( {
151- type : "wallet_requestAccounts" ,
152- } )
151+ accounts = await this . request (
152+ params
153+ ? {
154+ type : "wallet_requestAccounts" ,
155+ params,
156+ }
157+ : {
158+ type : "wallet_requestAccounts" ,
159+ } ,
160+ )
153161 } catch {
154162 throw new UserRejectedRequestError ( )
155163 }
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ export const connect = async ({
5252 let connectorData : ConnectorData | null = null
5353
5454 if ( connector && resultType === "wallet" ) {
55- connectorData = await connector . connect ( )
55+ connectorData = await connector . connect ( {
56+ silent_mode : true ,
57+ } )
5658 }
5759
5860 return {
You can’t perform that action at this time.
0 commit comments