Skip to content

Commit

Permalink
update RequestClient options (#546)
Browse files Browse the repository at this point in the history
* update `RequestClient` options

* c

* u
  • Loading branch information
felicio authored Mar 26, 2024
1 parent 4ff9d6b commit e863523
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-colts-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@status-im/js': patch
---

update `RequestClient` options
17 changes: 11 additions & 6 deletions packages/status-js/src/request-client/request-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,24 @@ class RequestClient {
constructor(
waku: LightNode,
options: {
ethProviderURLs: Record<number, string>
ethProviderApiKey: string
contractAddresses: Record<number, Record<string, string>>
ethProviderURLs?: Record<number, string>
contractAddresses?: Record<number, Record<string, string>>
started?: boolean
environment?: 'development' | 'preview' | 'production'
}
) {
const { environment = 'development' } = options

this.waku = waku
this.wakuMessages = new Set()
this.#started = options.started ?? false
this.#ethProviderURLs = options.ethProviderURLs
this.#ethProviderURLs =
options.ethProviderURLs ?? providers[environment].infura
this.#ethProviderApiKey = options.ethProviderApiKey
this.#ethereumClients = new Map()
this.#contractAddresses = options.contractAddresses
this.#contractAddresses =
options.contractAddresses ?? contracts[environment]
}

static async start(options: RequestClientOptions): Promise<RequestClient> {
Expand Down Expand Up @@ -106,9 +111,9 @@ class RequestClient {

client = new RequestClient(waku, {
started: true,
ethProviderURLs: providers['production'].infura,
ethProviderURLs: providers[environment].infura,
ethProviderApiKey: options.ethProviderApiKey,
contractAddresses: contracts['production'],
contractAddresses: contracts[environment],
})
} catch (error) {
if (waku) {
Expand Down

0 comments on commit e863523

Please sign in to comment.