1.3.0 • Published 8 months ago

@metavault/apps-wagmi v1.3.0

Weekly downloads
-
License
BUSL-1.1 SEE LICE...
Repository
-
Last release
8 months ago

Metavault Wagmi Connector

It is the wagmi connector that allows the application to auto-connect to the Metavault Shell.

Install

Use npm to install @metavault/apps-wagmi and @metavault/apps-react-sdk

  npm install @metavault/apps-wagmi @metavault/apps-react-sdk 

Feedback

If you have any feedback, please contact us at admin@metavault.org or 0xr@metavault.org

Usage / React Sample

1. Wrap your top level component with the MetavaultProvider.

import { MetavaultProvider } from '@metavault/apps-react-sdk';

function CustomApp({ Component, pageProps }: AppProps) {
  return (
    <>
      <MetavaultProvider> --> Metavault provider 
        <Web3Provider> --> Our Custom WagmiConfig wrapper
            ...
                <div>
                    <Component {...pageProps} />
                </div>
            ...    
        <Web3Provider>
      </MetavaultProvider>
    </>
  );
}

2. Initialize wagmi client with the Metavault Connector

import { WagmiConfig, configureChains, createClient } from 'wagmi';
import { arbitrum, polygon } from 'wagmi/chains';
import { MetavaultConnector } from '@metavault/apps-wagmi';
....

const { chains, provider } = configureChains(
  [polygon, arbitrum],
  [publicProvider()]
);

export function Web3Provider({ children }: any) {
  const client = useMemo(() => {
    return createClient({
      autoConnect: true,
      connectors: [
        new MetavaultConnector({ chains }),
        new MetaMaskConnector({ chains }),
        new InjectedConnector({
          chains,
          options: {
            name: 'Injected',
            shimDisconnect: true,
          },
        }),
      ],
      provider: provider,
    });
  }, [chains, provider]);

  return (
    <WagmiConfig client={client}>
        {children}
    </WagmiConfig>
  );
}

3. Your app should automatically connected to Metavualt Shell app if you open the app inside shell application.

4. Add manifest.json file to app's public directory to enable remote Metavault App's to load inside Metavault Shell.

Here is the minimum manifest.json file content

{
  "name": "My Metavault App",
  "description": "Apps loaded inside Metavualt Shell",
  "iconPath": "./logo.svg"
}

To test your integration, please contact us.

1.2.0

10 months ago

1.2.6

10 months ago

1.2.5

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.3.0

8 months ago

1.2.1

10 months ago

1.0.2

11 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago