diff --git a/.changeset/silver-colts-wash.md b/.changeset/silver-colts-wash.md new file mode 100644 index 00000000..6d30b077 --- /dev/null +++ b/.changeset/silver-colts-wash.md @@ -0,0 +1,5 @@ +--- +'@status-im/js': patch +--- + +update `RequestClient` options diff --git a/packages/status-js/src/request-client/request-client.ts b/packages/status-js/src/request-client/request-client.ts index 6ca2ce85..2937a94c 100644 --- a/packages/status-js/src/request-client/request-client.ts +++ b/packages/status-js/src/request-client/request-client.ts @@ -56,19 +56,24 @@ class RequestClient { constructor( waku: LightNode, options: { - ethProviderURLs: Record ethProviderApiKey: string - contractAddresses: Record> + ethProviderURLs?: Record + contractAddresses?: Record> 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 { @@ -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) {