1.7.5 • Published 5 months ago

@abstract-foundation/web3-react-agw v1.7.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@abstract-foundation/web3-react-agw

The @abstract-foundation/web3-react-agw package implements a web3-react connector for Abstract Global Wallet (AGW).

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.

Installation

Install the connector via NPM:

npm install @abstract-foundation/web3-react-agw

Quick Start

Importing

import { AbstractGlobalWallet } from '@abstract-foundation/web3-react-agw';

Initializing the connector

// connector.tsx
import { initializeConnector } from '@web3-react/core';
import { AbstractGlobalWallet } from '@abstract-foundation/web3-react-agw';

export const [agw, hooks] = initializeConnector<AbstractGlobalWallet>(
  (actions) => new AbstractGlobalWallet({ actions }),
);

Using the connector

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 (
    <div>
      {isActive ? (
        <button onClick={logout}>Disconnect</button>
      ) : (
        <button onClick={login}>Sign in with Abstract</button>
      )}
    </div>
  );
}

API Reference

AbstractGlobalWallet

Creates an AbstractGlobalWallet connector, extending the web3-react Connector to support the Abstract Global Wallet.

Documentation

For detailed documentation, please refer to the Abstract Global Wallet Documentation.

1.7.5

5 months ago

1.7.4

5 months ago

1.7.3

5 months ago

1.7.2

5 months ago

1.7.1

6 months ago

1.7.0

6 months ago

1.6.3

6 months ago

1.6.2

6 months ago

1.6.1

6 months ago

1.6.0

6 months ago

1.6.0-beta.0

6 months ago

1.5.5

6 months ago

1.5.4

6 months ago

1.5.3

6 months ago

1.5.2

7 months ago

1.5.1

7 months ago

1.5.0

8 months ago

1.4.4-beta.2

8 months ago

1.4.4-beta.1

8 months ago

1.4.4-beta.0

8 months ago

1.4.3

8 months ago

1.4.3-beta.1

8 months ago

1.4.3-beta.0

8 months ago

1.4.2

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.3.1

9 months ago

1.4.0-beta.0

9 months ago

1.3.0

9 months ago

1.2.0

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.1.0-beta.2

9 months ago

1.0.2-beta.1

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

1.0.0-beta.2

10 months ago

0.1.8

10 months ago

1.0.0-beta.1

10 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

11 months ago

0.0.1-beta.2

11 months ago

0.0.1-beta.1

12 months ago