Skip to content

Commit 62d9889

Browse files
authored
Update substrate connect to 0.7.5 (#4835)
* Update substrate connect to 0.7.5; Add optional configuration to connect() * Address PR's comments
1 parent 7c0e983 commit 62d9889

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/rpc-provider/src/substrate-connect/ScProvider.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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';
45
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
56

67
import { 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
}
350353
export type ScProviderClass = typeof ScProvider
354+
export type Config = ScConfig

0 commit comments

Comments
 (0)