Structure of the repository

What are the elements and how do they work together?

This documentation outlines the structure of a Next.js dApp repository that integrates AA SDK With SL MPC Signer . The goal is to demonstrate how to set up and organize a repository that can flexibly support any AA-SDK with an MPC-based wallet dApp.

Repository Structure

WalletName/
├── mpc/
│   ├── keygen.ts
│   ├── pairing.ts
│   |── sign.ts
    |-backup.ts
├── aaSDK/
│   ├── mintingService.ts
│   └── transactionService.ts
├── app/
├── components/
├── silentWallet.ts
├── package.json
└── README.md

Directory and File Descriptions

  • mpc/

    • keygen/: Contains logic for key generation.

    • pair/: Contains logic for pairing keys.

    • sign/: Contains logic for signing operations.

  • aaSDK/

    • requestSender/: Handles request sending logic.

    • mintingService.ts: Implements wallet minting functionality using the AA-SDK.

    • transactionService.ts: Implements transaction-sending functionality using the AA-SDK.

  • app/

  • components/

    • NextJs component.

  • silentWallet.ts: Implements the custom signer logic integrating MPC

  • package.json: Lists dependencies and scripts for the project.

  • README.md: Readme

Implementation Details

SilentWallet

The silentWallet.ts file defines the SilentWallet class, which extends ethers.Signer. This class is responsible for handling signing operations using MPC key shares.

Minting Service

Located in aaSDK/mintingService.ts, this service uses the AA-SDK to create a smart account client. It integrates the SilentWallet to manage key shards and provider initialization.

Transaction Service

Located in aaSDK/transactionService.ts, this service facilitates transaction sending via the AA-SDK. It also integrates the SilentWallet for signing transactions.

Frontend Integration

The Next.js frontend directly calls the services defined in mintingService.ts and transactionService.ts. This integration allows the frontend to handle wallet minting and transaction sending seamlessly.

Switching to any AA-SDK

Navigate to the aaSDK folder in the project repository. Inside this folder are two services that need to be updated:

  • mintingService.ts

  • transactionService.ts

Replace specific imports with any SDK imports in mintingService.ts and transactionService.ts.

Update the mintWallet and sendTransaction function accordingly.

Last updated