This recipe assumes you have already created an app on the Privy Dashboard and configured your Privy Provider. Refer to our React SDK Setup or React Native SDK Setup documentation to get started.

1

Enable Abstract integration

From the Privy dashboard, navigate to Global Wallet > Integrations.

Scroll down to find Abstract and toggle the switch to enable the integration.

Note the provider app id, you will need it in the next step.

2

Login users with their Abstract Global Wallet

To prompt users to log into your app with their Abstract Global Wallet, use the loginWithCrossAppAccount method from the useCrossAppAccounts hook:

import {usePrivy, useCrossAppAccounts} from '@privy-io/react-auth';

function LoginButton() {
  const {ready, authenticated} = usePrivy();
  const {loginWithCrossAppAccount} = useCrossAppAccounts();

  return (
    <button
      onClick={() => loginWithCrossAppAccount({appId: 'insert-abstract-provider-app-id'})}
      disabled={!ready || !authenticated}
    >
      Log in with Abstract Global Wallet
    </button>
  );
}
3

Sign a message with the user's Abstract Global Wallet

To prompt users to sign a message with their Abstract Global Wallet, use the signMessage method from the useCrossAppAccounts hook:

import {usePrivy, useCrossAppAccounts} from '@privy-io/react-auth';

function SignMessageButton() {
  const {user} = usePrivy();
  const {signMessage} = useCrossAppAccounts();
  const crossAppAccount = user.linkedAccounts.find((account) => account.type === 'cross_app');
  const address = crossAppAccount.embeddedWallets[0].address;

  return (
    <button onClick={() => signMessage('Hello world', {address: address})} disabled={!address}>
      Sign a message with your Abstract Global Wallet
    </button>
  );
}

Refer to Using Global Wallets for more details.