0.9.31 • Published 2 months ago

@epoch-protocol/sdk v0.9.31

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

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.

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)

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()
0.9.31

2 months ago

0.9.29

2 months ago

0.9.27

3 months ago

0.9.28

3 months ago

0.9.25

3 months ago

0.9.26

3 months ago

0.9.23

3 months ago

0.9.24

3 months ago

0.9.20

3 months ago

0.9.21

3 months ago

0.9.22

3 months ago

0.9.19

3 months ago

0.9.18

4 months ago

0.9.17

4 months ago

0.9.16

4 months ago

0.9.15

4 months ago

0.9.13

4 months ago

0.9.12

4 months ago

0.9.9

4 months ago

0.9.10

4 months ago

0.9.11

4 months ago

0.9.8

4 months ago

0.9.7

4 months ago

0.9.4

4 months ago

0.9.3

4 months ago

0.9.6

4 months ago

0.9.5

4 months ago

0.8.12

4 months ago

0.9.0

4 months ago

0.9.2

4 months ago

0.9.1

4 months ago

0.8.9

4 months ago

0.8.10

4 months ago

0.8.8

5 months ago

0.8.5

5 months ago

0.8.4

6 months ago

0.8.7

5 months ago

0.8.6

5 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.8.3

6 months ago

0.8.2

6 months ago

0.7.0

9 months ago

0.6.1

11 months ago

0.6.0

11 months ago