update `RequestClient` options (#546)
* update `RequestClient` options * c * u
This commit is contained in:
parent
4ff9d6ba5c
commit
e863523510
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@status-im/js': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
update `RequestClient` options
|
|
@ -56,19 +56,24 @@ class RequestClient {
|
||||||
constructor(
|
constructor(
|
||||||
waku: LightNode,
|
waku: LightNode,
|
||||||
options: {
|
options: {
|
||||||
ethProviderURLs: Record<number, string>
|
|
||||||
ethProviderApiKey: string
|
ethProviderApiKey: string
|
||||||
contractAddresses: Record<number, Record<string, string>>
|
ethProviderURLs?: Record<number, string>
|
||||||
|
contractAddresses?: Record<number, Record<string, string>>
|
||||||
started?: boolean
|
started?: boolean
|
||||||
|
environment?: 'development' | 'preview' | 'production'
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
const { environment = 'development' } = options
|
||||||
|
|
||||||
this.waku = waku
|
this.waku = waku
|
||||||
this.wakuMessages = new Set()
|
this.wakuMessages = new Set()
|
||||||
this.#started = options.started ?? false
|
this.#started = options.started ?? false
|
||||||
this.#ethProviderURLs = options.ethProviderURLs
|
this.#ethProviderURLs =
|
||||||
|
options.ethProviderURLs ?? providers[environment].infura
|
||||||
this.#ethProviderApiKey = options.ethProviderApiKey
|
this.#ethProviderApiKey = options.ethProviderApiKey
|
||||||
this.#ethereumClients = new Map()
|
this.#ethereumClients = new Map()
|
||||||
this.#contractAddresses = options.contractAddresses
|
this.#contractAddresses =
|
||||||
|
options.contractAddresses ?? contracts[environment]
|
||||||
}
|
}
|
||||||
|
|
||||||
static async start(options: RequestClientOptions): Promise<RequestClient> {
|
static async start(options: RequestClientOptions): Promise<RequestClient> {
|
||||||
|
@ -106,9 +111,9 @@ class RequestClient {
|
||||||
|
|
||||||
client = new RequestClient(waku, {
|
client = new RequestClient(waku, {
|
||||||
started: true,
|
started: true,
|
||||||
ethProviderURLs: providers['production'].infura,
|
ethProviderURLs: providers[environment].infura,
|
||||||
ethProviderApiKey: options.ethProviderApiKey,
|
ethProviderApiKey: options.ethProviderApiKey,
|
||||||
contractAddresses: contracts['production'],
|
contractAddresses: contracts[environment],
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (waku) {
|
if (waku) {
|
||||||
|
|
Loading…
Reference in New Issue