Skip to content

Commit

Permalink
Fix provider definition on the flyoverservice instance on pegout
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldsg20 committed Dec 5, 2024
1 parent afe7663 commit e5e780e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pegout/store/FlyoverPegout/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import { BridgeService } from '@/common/services/BridgeService';
import { promiseWithTimeout } from '@/common/utils';
import { ApiService } from '@/common/services';
import { EnvironmentAccessorService } from '@/common/services/enviroment-accessor.service';
import { providers } from 'ethers';

export const actions: ActionTree<FlyoverPegoutState, RootState> = {
[constants.FLYOVER_PEGOUT_INIT]: async ({ state, dispatch }) => new Promise((resolve, reject) => {
state.flyoverService.initialize()
[constants.FLYOVER_PEGOUT_INIT]: async (
{ state, dispatch },
provider: providers.Web3Provider,
) => new Promise((resolve, reject) => {
state.flyoverService.initialize(provider.provider)
.then(() => dispatch(constants.FLYOVER_PEGOUT_GET_PROVIDERS))
.then(resolve)
.catch(reject);
Expand All @@ -27,12 +31,12 @@ export const actions: ActionTree<FlyoverPegoutState, RootState> = {
};
(async () => {
try {
const providers: LiquidityProvider2WP[] = await promiseWithTimeout(
const liquidityProviders: LiquidityProvider2WP[] = await promiseWithTimeout(
state.flyoverService.getProviders(),
EnvironmentAccessorService.getEnvironmentVariables().flyoverGetProvidersTimeout,
);
result = constants.FlyoverCallResult.SUCCESS;
resolve(commit(constants.FLYOVER_PEGOUT_SET_PROVIDERS, providers));
resolve(commit(constants.FLYOVER_PEGOUT_SET_PROVIDERS, liquidityProviders));
} catch (e) {
reject(new Error('Error getting providers'));
} finally {
Expand Down

0 comments on commit e5e780e

Please sign in to comment.