Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fuel provider fixed to async #32

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-suns-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-connectors/evm-connector": patch
---

fix fuel provider to async
4 changes: 2 additions & 2 deletions packages/evm-connector/src/EvmWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class EVMWalletConnector extends FuelConnector {

async configProviders(config: EVMWalletConnectorConfig = {}) {
this.config = Object.assign(config, {
fuelProvider: config.fuelProvider || (await Provider.create(BETA_5_URL)),
fuelProvider: config.fuelProvider || Provider.create(BETA_5_URL),
ethProvider: config.ethProvider || window.ethereum,
});
}
Expand Down Expand Up @@ -110,7 +110,7 @@ export class EVMWalletConnector extends FuelConnector {
throw new Error('Ethereum provider not found');
}

this.fuelProvider = this.config.fuelProvider ?? null;
this.fuelProvider = (await this.config.fuelProvider) ?? null;

if (!this.fuelProvider) {
throw new Error('Fuel provider not found');
Expand Down
2 changes: 1 addition & 1 deletion packages/evm-connector/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Provider } from 'fuels';
import type { EIP1193Provider } from './utils/eip-1193';

export type EVMWalletConnectorConfig = {
fuelProvider?: Provider;
fuelProvider?: Provider | Promise<Provider>;
ethProvider?: EIP1193Provider;
};

Expand Down
Loading