Skip to content

Commit

Permalink
feat(refactor): Update withProviders (#2314)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbulat authored Nov 2, 2024
1 parent 5a4d91c commit d43bd60
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 71 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@polkawatch/ddp-client": "^2.0.20",
"@substrate/connect": "^1.1.0",
"@w3ux/extension-assets": "^0.4.0",
"@w3ux/factories": "1.0.0-beta.0",
"@w3ux/hooks": "1.2.1-beta.0",
"@w3ux/react-connect-kit": "^1.8.0",
"@w3ux/react-odometer": "^1.1.0",
Expand Down
98 changes: 49 additions & 49 deletions src/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import { DappName } from 'consts';
import { ImportedAccountsProvider } from 'contexts/Connect/ImportedAccounts';
import { PoolPerformanceProvider } from 'contexts/Pools/PoolPerformance';
import { ExternalAccountsProvider } from 'contexts/Connect/ExternalAccounts';
import type { Provider } from 'hooks/withProviders';
import { withProviders } from 'hooks/withProviders';
import { withProviders } from '@w3ux/factories';
import { CommunityProvider } from 'contexts/Community';
import { OverlayProvider } from 'kits/Overlay/Provider';
import { JoinPoolsProvider } from 'contexts/Pools/JoinPools';
Expand All @@ -52,53 +51,54 @@ export const Providers = () => {
const { network } = useNetwork();
const { activeAccount, setActiveAccount } = useActiveAccounts();

// !! Provider order matters.
const providers: Provider[] = [
UIProvider,
[APIProvider, { network }],
LedgerHardwareProvider,
return withProviders(
// !! Provider order matters.
[
ExtensionsProvider,
{ options: { chainSafeSnapEnabled: true, polkagateSnapEnabled: true } },
UIProvider,
[APIProvider, { network }],
LedgerHardwareProvider,
[
ExtensionsProvider,
{ options: { chainSafeSnapEnabled: true, polkagateSnapEnabled: true } },
],
[
ExtensionAccountsProvider,
{ dappName: DappName, network, activeAccount, setActiveAccount },
],
WCAccountsProvider,
VaultAccountsProvider,
LedgerAccountsProvider,
ExternalAccountsProvider,
OtherAccountsProvider,
ImportedAccountsProvider,
WalletConnectProvider,
ProxiesProvider,
HelpProvider,
PluginsProvider,
BondedProvider,
BalancesProvider,
StakingProvider,
FavoritePoolsProvider,
BondedPoolsProvider,
PoolMembersProvider,
ActivePoolProvider,
TransferOptionsProvider,
ValidatorsProvider,
FavoriteValidatorsProvider,
FastUnstakeProvider,
PayoutsProvider,
PoolPerformanceProvider,
JoinPoolsProvider,
SetupProvider,
MenuProvider,
TooltipProvider,
TxMetaProvider,
OverlayProvider,
PromptProvider,
MigrateProvider,
FiltersProvider,
CommunityProvider,
],
[
ExtensionAccountsProvider,
{ dappName: DappName, network, activeAccount, setActiveAccount },
],
WCAccountsProvider,
VaultAccountsProvider,
LedgerAccountsProvider,
ExternalAccountsProvider,
OtherAccountsProvider,
ImportedAccountsProvider,
WalletConnectProvider,
ProxiesProvider,
HelpProvider,
PluginsProvider,
BondedProvider,
BalancesProvider,
StakingProvider,
FavoritePoolsProvider,
BondedPoolsProvider,
PoolMembersProvider,
ActivePoolProvider,
TransferOptionsProvider,
ValidatorsProvider,
FavoriteValidatorsProvider,
FastUnstakeProvider,
PayoutsProvider,
PoolPerformanceProvider,
JoinPoolsProvider,
SetupProvider,
MenuProvider,
TooltipProvider,
TxMetaProvider,
OverlayProvider,
PromptProvider,
MigrateProvider,
FiltersProvider,
CommunityProvider,
];

return withProviders(providers, ThemedRouter);
ThemedRouter
);
};
22 changes: 0 additions & 22 deletions src/hooks/withProviders/index.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3673,6 +3673,15 @@ __metadata:
languageName: node
linkType: hard

"@w3ux/factories@npm:1.0.0-beta.0":
version: 1.0.0-beta.0
resolution: "@w3ux/factories@npm:1.0.0-beta.0"
peerDependencies:
react: ^18
checksum: 10c0/1c2a8adb966300fe7e36410e4b91381221a70f2470dfa3c1b5612ddc2e84c4579b6928ac7d4c9cad34291b7d8e1cbc97cbba66ae46fd04627042df50e9646b66
languageName: node
linkType: hard

"@w3ux/hooks@npm:1.2.1-beta.0":
version: 1.2.1-beta.0
resolution: "@w3ux/hooks@npm:1.2.1-beta.0"
Expand Down Expand Up @@ -8563,6 +8572,7 @@ __metadata:
"@typescript-eslint/parser": "npm:^7.12.0"
"@vitejs/plugin-react-swc": "npm:^3.7.0"
"@w3ux/extension-assets": "npm:^0.4.0"
"@w3ux/factories": "npm:1.0.0-beta.0"
"@w3ux/hooks": "npm:1.2.1-beta.0"
"@w3ux/react-connect-kit": "npm:^1.8.0"
"@w3ux/react-odometer": "npm:^1.1.0"
Expand Down

0 comments on commit d43bd60

Please sign in to comment.