abstract-global-wallet
Abstract Global Wallet
AGW is Abstract's cross-application smart contract wallet. Users sign up once (email, social, passkey) and use it across all Abstract apps. Recommended over standard wallet connections for new Abstract apps — see the decision table below for when to consider alternatives.
For AI agent wallet access (not end-user facing), see the using-agw-mcp skill instead.
Quick Start (New Project)
npx @abstract-foundation/create-abstract-app@latest my-app
This scaffolds a React app with AGW pre-configured.
Quick Start (Existing React Project)
1. Install
npm install @abstract-foundation/agw-react @abstract-foundation/agw-client wagmi viem@2.x @tanstack/react-query
viem must be 2.x. Using viem 1.x causes compatibility errors.
2. Wrap with provider
import { AbstractWalletProvider } from "@abstract-foundation/agw-react";
import { abstractTestnet } from "viem/chains"; // or abstract for mainnet
export default function App() {
return (
<AbstractWalletProvider chain={abstractTestnet}>
{/* Your app */}
</AbstractWalletProvider>
);
}
3. Add login
import { useLoginWithAbstract } from "@abstract-foundation/agw-react";
export default function LoginButton() {
const { login, logout } = useLoginWithAbstract();
return <button onClick={login}>Login with Abstract</button>;
}
4. Send transactions
import { useAbstractClient } from "@abstract-foundation/agw-react";
export default function SendTx() {
const { data: abstractClient } = useAbstractClient();
async function send() {
if (!abstractClient) return;
const hash = await abstractClient.sendTransaction({
to: "0x...",
data: "0x...",
});
}
return <button onClick={send}>Send</button>;
}
5. Sponsored transactions (gas-free for users)
import { useWriteContractSponsored } from "@abstract-foundation/agw-react";
import { getGeneralPaymasterInput } from "viem/zksync";
export default function SponsoredMint() {
const { writeContractSponsored, isPending } = useWriteContractSponsored();
return (
<button
disabled={isPending}
onClick={() =>
writeContractSponsored({
abi: contractAbi,
address: "0xContractAddress",
functionName: "mint",
args: ["0xRecipient", BigInt(1)],
paymaster: "0xPaymasterAddress",
paymasterInput: getGeneralPaymasterInput({ innerInput: "0x" }),
})
}
>
Mint (Gas Free)
</button>
);
}
Decision Tables
AGW vs Standard Wallets
| Use Case | AGW | Standard (MetaMask/EOA) |
|---|---|---|
| New Abstract app | Yes | No |
| Cross-app wallet identity | Yes | No |
| Email/social login | Yes | No |
| Session keys (gasless UX) | Yes | No |
| Gas sponsorship | Yes | Paymaster only |
| Existing wallet user base | Consider both | Yes |
Session Keys vs Direct Transactions
| Use Case | Session Keys | Direct Approval |
|---|---|---|
| Games / frequent actions | Yes | No |
| One-time transactions | No | Yes |
| No-popup UX | Yes | No |
| High-value transactions | No | Yes |
| Testnet | Yes | Yes |
| Mainnet | Requires security review | Yes |
Feature Reference
| Feature | Where to look |
|---|---|
| React hooks API | references/react-hooks.md |
| Session keys (create, use, revoke) | references/session-keys.md |
| Third-party wallet providers | references/wallet-providers.md |
Packages
| Package | Purpose |
|---|---|
@abstract-foundation/agw-react |
React hooks + AbstractWalletProvider. Built on Wagmi. |
@abstract-foundation/agw-client |
Wallet actions + session key utilities. Built on Viem. |
Gotchas
- viem 2.x required — AGW is incompatible with viem 1.x
- Chain must be
abstractorabstractTestnet—AbstractWalletProviderthrows on unsupported chains - Session keys on mainnet need security review — testnet is permissionless, mainnet requires registry approval
- Session key signers are sensitive — never store private keys in
localStorage; use encrypted browser storage or server-side KMS approve/setApprovalForAllin session policies must include constraints restricting to a specific contract address, or the registry will reject
More from abstract-foundation/abstract-skills
using-agw-mcp
Give AI agents wallet capabilities on Abstract via the Abstract Global Wallet MCP server — read chain data, check balances, and (coming soon) send transactions on behalf of users. This skill should be used when setting up agw-mcp, giving AI agents wallet access on Abstract, or building MCP-powered agent workflows that interact with Abstract chain data.
3erc8004-on-abstract
Register AI agents, track reputation, and discover agents on Abstract using ERC-8004 — the onchain identity and reputation protocol for trustless agent economies. This skill should be used when registering an agent onchain, querying agent reputation, giving feedback to an agent, working with IdentityRegistry or ReputationRegistry on Abstract, ERC-8004, agent discovery, or onchain agent identity.
3myriad-on-abstract
Integrate Myriad Protocol prediction markets on Abstract — REST API for market data, polkamarkets-js SDK for trading outcome shares, builder revenue sharing via referralBuy, and contract addresses. This skill should be used when working with Myriad API, prediction markets on Abstract, polkamarkets-js SDK, trading or buying/selling prediction shares, builder codes, referralBuy, claiming winnings, Myriad contract addresses, or Myriad Protocol integration.
3connecting-to-abstract
Abstract network configuration — chain IDs, RPC endpoints, WebSocket URLs, block explorers, and wallet setup for the Abstract Ethereum L2. This skill should be used when configuring clients, wallets, or dev environments for Abstract, including questions about Abstract RPC URLs, chain IDs (2741/11124), testnet config, Abscan explorer, connecting to the Abstract network, or importing abstract/abstractTestnet from viem/chains.
3safe-multisig-on-abstract
Create and manage Safe multi-signature wallets on Abstract — deploy new Safes, configure owners and thresholds, propose and execute multi-sig transactions using the Safe SDK or the Safe UI. This skill should be used when working with Safe on Abstract, creating a multisig wallet on Abstract, safe.abs.xyz, Safe Protocol Kit on Abstract, multi-sig transactions, SafeL2, SafeProxyFactory, or managing shared wallets with multiple signers on Abstract.
3deploying-contracts-on-abstract
Deploy smart contracts on Abstract using Foundry (default) or Hardhat. Covers zksolc compilation, deployment, Abscan verification, and testnet faucets for the Abstract Ethereum L2. This skill should be used when deploying or compiling contracts on Abstract, using forge/foundry-zksync, forge build --zksync, forge create --zksync, anvil-zksync, verifying on Abscan, or working with the zkSync compiler on Abstract.
3