This example showcases how to use the Abstract Global Wallet with Vue.js using the new EIP-6963 provider discovery standard.
It uses MIPD (Multi Injected Provider Discovery) EIP-6963 implementation with the agw-web package that announces AGW as an EIP-6963 provider.
-
Get a copy of the
agw-vueexample directory from the Abstract Examples repository:mkdir -p agw-vue && curl -L https://codeload.github.com/Abstract-Foundation/examples/tar.gz/main | tar -xz --strip=2 -C agw-vue examples-main/agw-vue && cd agw-vue
-
Install dependencies
npm install
-
Run the development server
npm run dev
Visit http://localhost:5173 to see the app.
The app uses MIPD to discover available wallet providers following the EIP-6963 standard:
import { createStore } from 'mipd'
const store = createStore()
const providers = store.getProviders()
const agwProvider = providers.find(p => p.info.name.includes('Abstract'))The useWallet composable manages connection state and wallet interactions:
const { connect, disconnect, address, isConnected } = useWallet()Send gas-sponsored transactions using paymasters:
// Send sponsored contract interaction
const hash = await walletClient.value.writeContract({
abi: parseAbi(['function mint(address,uint256) external']),
address: '0xC4822AbB9F05646A9Ce44EFa6dDcda0Bf45595AA',
functionName: 'mint',
args: [address.value, BigInt(1)],
paymaster: '0x5407B5040dec3D339A9247f3654E59EEccbb6391',
paymasterInput: getGeneralPaymasterInput({ innerInput: '0x' })
})