# @account-abstraction/sdk

> This package provides 2 APIs for using UserOperations:

Latest version **0.6.0** (published 2023-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @account-abstraction/sdk
pnpm add @account-abstraction/sdk
yarn add @account-abstraction/sdk
bun add @account-abstraction/sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2023-05-08 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 168.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | drortirosh |

## Links

- npm: https://www.npmjs.com/package/@account-abstraction/sdk
- npm.io page: https://npm.io/package/@account-abstraction/sdk

## Dependencies (10)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [ethers](https://npm.io/package/ethers.md) ^5.7.0
- [@types/debug](https://npm.io/package/@types/debug.md) ^4.1.7
- [@ethersproject/networks](https://npm.io/package/@ethersproject/networks.md) ^5.7.0
- [@ethersproject/providers](https://npm.io/package/@ethersproject/providers.md) ^5.7.0
- [@ethersproject/properties](https://npm.io/package/@ethersproject/properties.md) ^5.7.0
- [@account-abstraction/utils](https://npm.io/package/@account-abstraction/utils.md) ^0.6.0
- [@account-abstraction/contracts](https://npm.io/package/@account-abstraction/contracts.md) ^0.6.0
- [@ethersproject/abstract-signer](https://npm.io/package/@ethersproject/abstract-signer.md) ^5.7.0
- [@ethersproject/abstract-provider](https://npm.io/package/@ethersproject/abstract-provider.md) ^5.7.0

## Recent versions

- 0.6.0 (latest) — 2023-05-08
- 0.5.0 — 2023-02-23
- 0.4.0 — 2022-12-27
- 0.3.0 — 2022-11-28
- 0.2.3 — 2022-10-09
- 0.2.1 — 2022-10-08
- 0.2.0 — 2022-10-05

## README

# SDK to create and send UserOperation 

This package provides 2 APIs for using UserOperations:

- Low-level "walletAPI"
- High-level Provider


## LowLevel API:

### BaseWalletAPI

An abstract base-class to create UserOperation for a contract wallet.

### SimpleAccountAPI

An implementation of the BaseWalletAPI, for the SimpleWallet sample of account-abstraction.

```typescript
owner = provider.getSigner()
const walletAPI = new SimpleAccountAPI({
    provider, 
    entryPointAddress,
    owner,
    factoryAddress
})
const op = await walletAPI.createSignedUserOp({
  target: recipient.address,
  data: recipient.interface.encodeFunctionData('something', ['hello'])
})
```

## High-Level Provider API

A simplified mode that doesn't require a different wallet extension. 
Instead, the current provider's account is used as wallet owner by calling its "Sign Message" operation.

This can only work for wallets that use an EIP-191 ("Ethereum Signed Message") signature (like our sample SimpleWallet)
Also, the UX is not great (the user is asked to sign a hash, and even the wallet address is not mentioned, only the signer)

```typescript
import { wrapProvider } from '@account-abstraction/sdk'

//use this account as wallet-owner (which will be used to sign the requests)
const aaSigner = provider.getSigner()
const config = {
  chainId: await provider.getNetwork().then(net => net.chainId),
  entryPointAddress,
  bundlerUrl: 'http://localhost:3000/rpc'
} 
const aaProvider = await wrapProvider(provider, config, aaSigner)
const walletAddress = await aaProvider.getSigner().getAddress()

// send some eth to the wallet Address: wallet should have some balance to pay for its own creation, and for calling methods.

const myContract = new Contract(abi, aaProvider)

// this method will get called from the wallet address, through account-abstraction EntryPoint
await myContract.someMethod()
```

---
_Source: https://npm.io/package/@account-abstraction/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
