Abstract Global Wallet for web3-react
npm install @abstract-foundation/web3-react-agwThe @abstract-foundation/web3-react-agw package implements a web3-react connector for Abstract Global Wallet (AGW).
Abstract Global Wallet (AGW) is a cross-application smart contract wallet that users can use to interact with any application built on Abstract, powered by Abstract's native account abstraction.
Install the connector via NPM:
``bash`
npm install @abstract-foundation/web3-react-agw
`tsx`
import { AbstractGlobalWallet } from '@abstract-foundation/web3-react-agw';
`tsx
// connector.tsx
import { initializeConnector } from '@web3-react/core';
import { AbstractGlobalWallet } from '@abstract-foundation/web3-react-agw';
export const [agw, hooks] = initializeConnector
(actions) => new AbstractGlobalWallet({ actions }),
);
`
`tsx
import React from 'react';
import { agw, hooks } from './connector';
const { useIsActive } = hooks;
export default function App() {
const isActive = useIsActive();
useEffect(() => {
void agw.connectEagerly().catch(() => {
console.debug('Failed to connect eagerly to agw');
});
}, []);
const login = () => {
void agw.activate();
};
const logout = () => {
void agw.deactivate();
};
return (
API Reference
$3
Creates an
AbstractGlobalWallet connector, extending the web3-react Connector` to support the Abstract Global Wallet.For detailed documentation, please refer to the Abstract Global Wallet Documentation.