Skip to content

Commit 0916038

Browse files
committed
Allow ability to change networkId after initialization
1 parent 71ad9ef commit 0916038

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ interface GetState {
158158
}
159159

160160
export interface ConfigOptions {
161-
darkMode: boolean
161+
darkMode?: boolean
162+
networkId?: number
162163
}
163164

164165
export interface API {

src/validation.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,23 @@ export function validateWalletCheckModule(module: WalletCheckModule) {
326326
export function validateConfig(configuration: ConfigOptions): never | void {
327327
validateType({ name: 'configuration', value: configuration, type: 'object' })
328328

329-
const { darkMode, ...otherParams } = configuration
329+
const { darkMode, networkId, ...otherParams } = configuration
330330

331-
invalidParams(otherParams, ['darkMode'], 'configuration')
331+
invalidParams(otherParams, ['darkMode', 'networkId'], 'configuration')
332332

333333
validateType({
334334
name: 'darkMode',
335335
value: darkMode,
336336
type: 'boolean',
337337
optional: true
338338
})
339+
340+
validateType({
341+
name: 'networkId',
342+
value: networkId,
343+
type: 'number',
344+
optional: true
345+
})
339346
}
340347

341348
export function validateModal(modal: WalletCheckModal): never | void {

0 commit comments

Comments
 (0)