0.1.5 • Published 1 year ago
aa-snap37 v0.1.5
Account Abstraction Snap for MetaMask
Generate and Sign Transactions using the Smart Contract Wallet generated by MetaMask Note : Works only with MetaMask Flask Build 10.25
Steps to use the snap in your dapp
Install package
npm i aa-snap37
Setup the Snap origin
const defaultSnapOrigin = `npm:aa-snap37`;
Connect the Snap
const connectSnap = async (
snapId: string = defaultSnapOrigin,
params: Record<"version" | string, unknown> = {}
) => {
await window.ethereum?.request({
method: "wallet_requestSnaps",
params: {
[snapId]: params,
},
});
};
Call the Snap method
const callSnap = async()=>{
await window.ethereum?.request({
method:"wallet_invokeSnap",
params:{
snapId : defaultSnapOrigin,
request:{
method:"init_aa",
},
},
});
}
Run Locally
- Clone the project
git clone https://github.com/Arch0125/snap4337
- Install dependencies
yarn install
- Manually add polyfills
Add the following to /node_modules/@account-abstraction/sdk/dist/src/index.js
1 | "use strict";
2 | +++ globalThis.Buffer = require('buffer/').Buffer;
3 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2)
- Start the server
yarn start