Documentation
¶
Index ¶
- Variables
- func BuildCallData(swt Type, calls Calls) ([]byte, error)
- func GetAccountAddress(ctx context.Context, provider ethereum.ContractCaller, config Config, ...) (common.Address, error)
- func GetBiconomyInitCode(owner common.Address, index decimal.Decimal, ...) ([]byte, error)
- func GetInitCode(smartWalletConfig Config, ownerAddress common.Address, index decimal.Decimal) ([]byte, error)
- func GetKernelInitCode(owner common.Address, index decimal.Decimal, ...) ([]byte, error)
- func IsAccountDeployed(ctx context.Context, provider ethereum.ChainStateReader, ...) (bool, error)
- type Call
- type Calls
- type Config
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( // SimpleAccountType represents a smart wallet type for a Simple Account wallet. SimpleAccountType = Type{"simple_account"} // BiconomyType represents a type for BiconomyType Smart Account wallet. BiconomyType = Type{"biconomy"} // KernelType represents a type for Zerodev KernelType wallet. KernelType = Type{"kernel"} )
var ( // ErrSmartWalletNotSupported is returned on attempt to perform some actions with an unsupported smart wallet type. // Make sure that the smart wallet type you are trying to use // has no `unsupported` or `untested` tags in the source files. ErrSmartWalletNotSupported = errors.New("smart wallet not supported") )
var KernelExecuteABI = must(abi.JSON(strings.NewReader(`[
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "enum Operation",
"name": "",
"type": "uint8"
}
],
"name": "execute",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [{
"components": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct Call[]",
"name": "calls",
"type": "tuple[]"
}],
"name": "executeBatch",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
]`)))
kernelExecuteABI is used to execute a transaction on Zerodev Kernel smart account.
Functions ¶
func GetAccountAddress ¶
func GetBiconomyInitCode ¶
func GetBiconomyInitCode(owner common.Address, index decimal.Decimal, factory, ecdsaValidator common.Address) ([]byte, error)
getBiconomyInitCode returns a middleware that sets the init code for a Biconomy smart account. The init code deploys a smart account if it is not already deployed. NOTE: this was NOT tested. Use at your own risk or wait for the package to be updated.
func GetInitCode ¶
func GetKernelInitCode ¶
func GetKernelInitCode(owner common.Address, index decimal.Decimal, factory, accountLogic, ecdsaValidator common.Address) ([]byte, error)
getKernelInitCode returns a middleware that sets the init code for a Zerodev Kernel smart account. The init code deploys a smart account if it is not already deployed.
func IsAccountDeployed ¶
Types ¶
type Call ¶
Call represents sufficient data to build a single transaction, which is a part of a user operation to be executed in a batch with other ones.
type Calls ¶
type Calls []Call
func UnpackCallsForKernel ¶
UnpackCallsForKernel unpacks CallData for Zerodev Kernel smart wallet.
func UnpackCallsForSimpleAccount ¶
UnpackCallsForSimpleAccount unpacks CallData for SimpleAccount smart wallet.
func (Calls) PackForKernel ¶
handleCallKernel packs calldata for Zerodev Kernel smart wallet.
func (Calls) PackForSimpleAccount ¶
PackForSimpleAccount packs CallData for SimpleAccount smart wallet.
type Config ¶
type Config struct {
Type *Type `yaml:"type" env:"SMART_WALLET_TYPE"`
ECDSAValidator common.Address `yaml:"ecdsa_validator" env:"SMART_WALLET_ECDSA_VALIDATOR"`
Logic common.Address `yaml:"logic" env:"SMART_WALLET_LOGIC"`
Factory common.Address `yaml:"factory" env:"SMART_WALLET_FACTORY"`
}
SmartWalletConfig represents the configuration for the smart wallet to be used with the client.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type represents an enum for supported ERC-4337 smart wallets that can be used with the client to send user operations from.
func (*Type) UnmarshalJSON ¶
UnmarshalJSON unmarshals the JSON representation of a SmartWalletType.
func (*Type) UnmarshalYAML ¶
UnmarshalYAML unmarshals the YAML representation of a SmartWalletType.