
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@avalabs/web3-react-core-connector
Advanced tools
Core Extension connector for the web3-react library
Core Extension connector for web3-react.
There is a working example in this repo under the package web3-react-dapp-example
import { createContext, useContext } from 'react';
import { initializeConnector, Web3ReactHooks } from '@web3-react/core';
import { CoreWallet } from '@avalabs/web3-react-core-connector';
const Web3ConnectionContext = createContext<
{
connector: CoreWallet;
} & Web3ReactHooks
>({} as any);
export function Web3ConnectionContextProvider({ children }: { children: any }) {
const [error, setError] = useState<Error | undefined>();
const [connector, hooks] = initializeConnector(
(actions) =>
new CoreWallet({
actions,
onError: (e: Error) => {
console.error('Core Connector error', e);
setError(e);
},
})
);
return (
<Web3ConnectionContext.Provider
value={{
connector,
error,
...hooks,
}}
>
{children}
</Web3ConnectionContext.Provider>
);
}
export function useWeb3ConnectionContext() {
return useContext(Web3ConnectionContext);
}
<Web3ConnectionContextProvider>
<App />
</Web3ConnectionContextProvider>
import { useWeb3ConnectionContext } from 'your-path-here';
export function YourFancyComponent() {
const { connector, useIsActive, useAccount } = useWeb3ConnectionContext();
const isActive = useIsActive();
const activeAccount = useAccount();
if (!isActive) {
return (
<button
onClick={() => connector.activate().catch((e) => console.error(e))}
>
Connect with Core
</button>
);
}
return (
<div>
<strong>Connected:</strong> {activeAccount}
</div>
);
}
FAQs
Core Extension connector for the web3-react library
We found that @avalabs/web3-react-core-connector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.