goaa

package module
v0.0.0-...-6605048 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 15 Imported by: 0

README

GoAA: Account Abstraction Package for Go

GoAA is a Go package that implements Account Abstraction (ERC-4337), allowing you to work with Ethereum accounts and transactions more efficiently. This package simplifies the interaction with Ethereum smart contracts and blockchain by providing easy-to-use functions and abstractions.

Features

  • Account Abstraction (ERC-4337): GoAA is built following the ERC-4337 standard, enabling seamless integration with Ethereum accounts and transactions.

  • Go Implementation: Written in Go, GoAA is designed for easy integration into Go-based applications and projects.

Getting Started

To get started with GoAA, you can follow these steps:

  1. Clone the GoAA repository to your local machine.

  2. Navigate to the "examples" directory to find sample code and usage examples.

  3. Include the GoAA package in your Go project and start working with Ethereum accounts and transactions effortlessly.

Example

All the example are available within the example directory

Documentation

Coming soon

Contributing

Contributions are welcome from the community! If you find a bug or have a feature request, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractAddressParams

type ContractAddressParams struct {
	// contains filtered or unexported fields
}

type SmartAccountProvider

type SmartAccountProvider struct {
	Client     *ethclient.Client      // Ethereum client for interacting with the blockchain
	Owner      common.Address         // Ethereum address of the owner
	SAFactory  *factory.Factory       // Smart account factory contract instance
	EntryPoint *entrypoint.EntryPoint // Smart account factory contract instance
	PrivateKey string                 // The private key of the Ethereum account
	Contracts  *ContractAddressParams // The object that contains all the contract addresses
}

SmartAccountProvider is a struct that manages interaction with Ethereum smart contracts.

func NewSmartAccountProvider

func NewSmartAccountProvider(params SmartAccountProviderParams) (*SmartAccountProvider, error)

NewSmartAccountProvider creates a new instance of SmartAccountProvider with the provided parameters. It initializes the Ethereum client, owner's address, and the smart account factory contract.

func (*SmartAccountProvider) GetSmartAccountAddress

func (sap *SmartAccountProvider) GetSmartAccountAddress(salt int64) (common.Address, error)

GetSmartAccountAddress retrieves the address of a smart account based on a given salt value.

func (*SmartAccountProvider) SendUserOpsTransaction

func (sap *SmartAccountProvider) SendUserOpsTransaction(target TargetParams) (any, error)

type SmartAccountProviderParams

type SmartAccountProviderParams struct {
	OwnerPrivateKey            string // The private key of the Ethereum account
	RPC                        string // The RPC endpoint for the Ethereum node
	EntryPointAddress          string // The address of the entry point contract
	SmartAccountFactoryAddress string // The address of the smart account factory contract
}

SmartAccountProviderParams stores the parameters required to initialize the SmartAccountProvider.

type TargetParams

type TargetParams struct {
	Target string
	Data   string
	Value  string
}

type UOps

type UOps struct {
	Sender               common.Address `json:"sender"`
	Nonce                string         `json:"nonce"`
	InitCode             string         `json:"initCode"`
	CallData             string         `json:"callData"`
	Signature            *common.Hash   `json:"signature,omitempty"`
	CallGasLimit         string         `json:"callGasLimit"`
	VerificationGasLimit string         `json:"verificationGasLimit"`
	PreVerificationGas   string         `json:"preVerificationGas"`
	MaxFeePerGas         string         `json:"maxFeePerGas"`
	MaxPriorityFeePerGas string         `json:"maxPriorityFeePerGas"`
	PaymasterAndData     string         `json:"paymasterAndData"`
}

type UserOperationTxnPayload

type UserOperationTxnPayload struct {
	Id      int64  `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  []any  `json:"params"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL