Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async createSmartAccount(signer: string) {
- if (!this.provider) {
- throw new Error('Provider not set');
- }
- const safe4337Pack = await Safe4337Pack.init({
- provider: this.provider as any,
- bundlerUrl,
- options: {
- owners: [signer],
- threshold: 1,
- },
- paymasterOptions: {
- paymasterUrl,
- isSponsored: true,
- },
- });
- // 2) Create SafeOperation
- const rawTx = {
- to: zeroAddress,
- data: '0x0000000000000000000000000000000000000000000000000000000000000000',
- value: '0',
- };
- const safeOperation = await safe4337Pack.createTransaction({
- transactions: [rawTx],
- });
- // 3) Sign SafeOperation
- const signedSafeOperation = await safe4337Pack.signSafeOperation(
- safeOperation,
- );
- // 4) Execute SafeOperation
- const userOperationHash = await safe4337Pack.executeTransaction({
- executable: signedSafeOperation,
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment