11// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
22// SPDX-License-Identifier: Apache-2.0
33
4+ import type { Config as ScConfig } from '@substrate/connect' ;
45import type { JsonRpcResponse , ProviderInterface , ProviderInterfaceCallback , ProviderInterfaceEmitCb , ProviderInterfaceEmitted } from '../types' ;
56
67import { Chain , createScClient , ScClient , WellKnownChain } from '@substrate/connect' ;
@@ -67,7 +68,9 @@ export class ScProvider implements ProviderInterface {
6768 throw new Error ( 'clone() is not supported.' ) ;
6869 }
6970
70- async connect ( ) : Promise < void > {
71+ // Config details can be found in @substrate /connect repo following the link:
72+ // https://github.com/paritytech/substrate-connect/blob/main/packages/connect/src/connector/index.ts
73+ async connect ( config ?: ScConfig ) : Promise < void > {
7174 assert ( ! this . isConnected , 'Already connected!' ) ;
7275
7376 // it could happen that after emitting `disconnected` due to the fact taht
@@ -86,7 +89,7 @@ export class ScProvider implements ProviderInterface {
8689
8790 const client = this . #sharedSandbox
8891 ? scClients . get ( this . #sharedSandbox)
89- : createScClient ( ) ;
92+ : createScClient ( config ) ;
9093
9194 assert ( client , 'Unkown ScProvider!' ) ;
9295 scClients . set ( this , client ) ;
@@ -348,3 +351,4 @@ export class ScProvider implements ProviderInterface {
348351 }
349352}
350353export type ScProviderClass = typeof ScProvider
354+ export type Config = ScConfig
0 commit comments