Skip to content

Commit

Permalink
fix(web3-wagmi): Correct spelling of 'Factories' (#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tian-Hun authored Aug 21, 2024
1 parent 31a047e commit efbd948
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-games-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ant-design/web3-wagmi': patch
---

fix(web3-wagmi): Correct spelling of "Factories"
4 changes: 2 additions & 2 deletions packages/wagmi/src/wagmi-provider/__tests__/balance.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('WagmiWeb3ConfigProvider balance', () => {
const App = () => (
<AntDesignWeb3ConfigProvider
balance
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={config}
>
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('WagmiWeb3ConfigProvider balance', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={config}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('WagmiWeb3ConfigProvider connect with UniversalWallet', () => {
const App = () => (
<AntDesignWeb3ConfigProvider
chainAssets={[Mainnet]}
walletFactorys={[TokenPocket()]}
walletFactories={[TokenPocket()]}
wagimConfig={mockWagmiConfig}
>
<CustomConnector />
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('WagmiWeb3ConfigProvider connect with UniversalWallet', () => {
const App = () => (
<AntDesignWeb3ConfigProvider
chainAssets={[Mainnet]}
walletFactorys={[TokenPocket()]}
walletFactories={[TokenPocket()]}
wagimConfig={mockWagmiConfig}
>
<CustomConnector />
Expand Down
4 changes: 2 additions & 2 deletions packages/wagmi/src/wagmi-provider/__tests__/connect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('WagmiWeb3ConfigProvider connect', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={mockWagmiConfig}
>
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('WagmiWeb3ConfigProvider connect', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={mockWagmiConfig}
>
Expand Down
4 changes: 2 additions & 2 deletions packages/wagmi/src/wagmi-provider/__tests__/ens.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('WagmiWeb3ConfigProvider ens', () => {
const App = () => (
<AntDesignWeb3ConfigProvider
ens
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={config}
>
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('WagmiWeb3ConfigProvider ens', () => {
const App = () => (
<AntDesignWeb3ConfigProvider
ens
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={config}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/src/wagmi-provider/__tests__/nft.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('WagmiWeb3ConfigProvider getMetadata', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet]}
wagimConfig={config}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('switch chain when not connected', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet, Polygon]}
wagimConfig={config}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('switch chain when connect', () => {

const App = () => (
<AntDesignWeb3ConfigProvider
walletFactorys={[MetaMask()]}
walletFactories={[MetaMask()]}
chainAssets={[Mainnet, Polygon]}
wagimConfig={config}
>
Expand Down
12 changes: 6 additions & 6 deletions packages/wagmi/src/wagmi-provider/config-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { getNFTMetadata } from './methods';

export interface AntDesignWeb3ConfigProviderProps {
chainAssets: Chain[];
walletFactorys: WalletFactory[];
walletFactories: WalletFactory[];
locale?: Locale;
children?: React.ReactNode;
ens?: boolean;
Expand All @@ -39,7 +39,7 @@ export const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderPr
const {
children,
chainAssets,
walletFactorys,
walletFactories,
ens = true,
balance,
locale,
Expand Down Expand Up @@ -83,7 +83,7 @@ export const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderPr
if (
typeof eip6963 === 'object' &&
eip6963?.autoAddInjectedWallets &&
!walletFactorys.find((item) => item.connectors.includes(connector.name))
!walletFactories.find((item) => item.connectors.includes(connector.name))
) {
// not config wallet and find the wallet in connectors, auto add it
autoAddEIP6963Wallets.push(EIP6963Wallet().create([connector]));
Expand All @@ -92,7 +92,7 @@ export const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderPr
return;
}

const walletFactory = walletFactorys.find((factory) =>
const walletFactory = walletFactories.find((factory) =>
factory.connectors.includes(connector.name),
);

Expand All @@ -105,7 +105,7 @@ export const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderPr
});

// Generate Wallet for @ant-design/web3
const supportWallets = walletFactorys
const supportWallets = walletFactories
.map((factory) => {
const connectors = factory.connectors
.map(findConnectorByName)
Expand All @@ -125,7 +125,7 @@ export const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderPr
.filter((item) => item !== null) as Wallet[];

return [...supportWallets, ...autoAddEIP6963Wallets];
}, [wagimConfig.connectors, walletFactorys, eip6963]);
}, [wagimConfig.connectors, walletFactories, eip6963]);

const chainList: Chain[] = React.useMemo(() => {
return wagimConfig.chains
Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/src/wagmi-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function WagmiWeb3ConfigProvider({
<AntDesignWeb3ConfigProvider
locale={locale}
chainAssets={chainAssets}
walletFactorys={wallets}
walletFactories={wallets}
ens={ens}
balance={balance}
eip6963={eip6963}
Expand Down

0 comments on commit efbd948

Please sign in to comment.