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

How to get signer and provider #13

Open
wispyco opened this issue Jan 8, 2023 · 1 comment
Open

How to get signer and provider #13

wispyco opened this issue Jan 8, 2023 · 1 comment
Assignees

Comments

@wispyco
Copy link

wispyco commented Jan 8, 2023

I am trying to integrate Third Webs React SDK and I don't know where to get the signer and provider details from my signed in user. Here is an example from the third webs docs.

Any idea of what myProvider or mySigner would be?

import { ChainId, ThirdwebSDKProvider } from "@thirdweb-dev/react";

// This is the chainId your dApp will work on.
const activeChainId = ChainId.Mainnet;

function MyApp({ Component, pageProps }) {
  // If you want to use any custom provider or signer, add it here.
  const myProvider = ...;
  const mySigner = ...;


  return (
    <ThirdwebSDKProvider
      desiredChainId={activeChainId}
      signer={mySigner}
      provider={myProvider}
    >
      {/* Your App Goes Here */}
    </ThirdwebSDKProvider>
  );
}

export default MyApp;

I think I may only need the signer, but I am not sure if it is an derived object or just the signed in wallet address?

@pi0neerpat pi0neerpat self-assigned this Jan 12, 2023
@pi0neerpat
Copy link
Contributor

pi0neerpat commented Jan 13, 2023

The developer docs for thirdweb-dev/react should be fine to follow, even though its redwood. I belive you would do something like this in web/src/App.js.

import { ChainId, ThirdwebSDKProvider } from "@thirdweb-dev/react";
import { Web3Provider } from "@ethersproject/providers";

// This is the chainId your dApp will work on.
const activeChainId = ChainId.Mainnet;

const App = () => {
     const myProvider = new Web3Provider(window.ethereum);
     const mySigner = walletProvider.getSigner(0)

    return (
      <FatalErrorBoundary page={FatalErrorPage}>
           <ThirdwebSDKProvider
          desiredChainId={activeChainId}
          signer={mySigner}
          provider={myProvider}
        >
            // Rest of the redwood app....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants