Documentation ¶
Index ¶
- Constants
- Variables
- func NewEthClient(rpcURLString string) (*ethclient.Client, error)
- func NewPermissionTree(permissions []Permission) (*mt.MerkleTree, error)
- func PackEnableValidatorSignature(enableData []byte, validator, executor common.Address, ...) []byte
- func PackUseSessionKeySignature(sessionKey common.Address, sessionKeySig signer.Signature, ...) ([]byte, error)
- type Client
- type Config
- type ParamCondition
- type ParamRule
- type Permission
- type SessionData
Constants ¶
View Source
const ( CallKernelOperation = iota DelegateCallKernelOperation )
View Source
const ( ValidatorApprovedStruct = "ValidatorApproved(bytes4 sig,uint256 validatorData,address executor,bytes enableData)" DomainStruct = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" KernelDomainName = "Kernel" KernelDomainVersion = "0.2.2" KernelEnableDataLength = 20 + 32 + 6 + 6 + 20 + 32 )
View Source
const ECDSAValidatorAddress = "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390"
Kernel v2.2
View Source
const (
KernelEnableSigOffset = 4 + 6 + 6 + 20 + 20 + 32 + KernelEnableDataLength + 32
)
View Source
const SessionKeyValidatorAddress = "0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5"
Kernel v2.4
Variables ¶
View Source
var ( KernelExecuteSig = [4]byte(userop.KernelExecuteABI.Methods["execute"].ID) KernelExecuteBatchSig = [4]byte(userop.KernelExecuteABI.Methods["executeBatch"].ID) )
Functions ¶
func NewPermissionTree ¶
func NewPermissionTree(permissions []Permission) (*mt.MerkleTree, error)
Types ¶
type Client ¶
type Client interface { // GetEnableDataDigest returns the hash of the enable session data, which is used to validate the session key. // // Parameters: // - kernelAddress: the address of the kernel contract // - sessionKey: the address of session key // // Returns: // - the hash of the enable session data GetEnableDataDigest(kernelAddress, sessionKey common.Address) ([]byte, error) // GetEnablingUserOpSigner returns a user operation signer that signs the user operation // with the session key and the enable signature. // // Parameters: // - sessionSigner: the session key signer // - enableSig: the signature of the enable session data // // Returns: // - a user operation signer function // - an error if the signer could not be created GetEnablingUserOpSigner(sessionSigner signer.Signer, enableSig signer.Signature) userop.Signer // GetUserOpSigner returns a user operation signer that signs the user operation with the session key. // // Parameters: // - sessionSigner: the session key signer // // Returns: // - a user operation signer function // - an error if the signer could not be created GetUserOpSigner(sessionSigner signer.Signer) userop.Signer }
type ParamCondition ¶
type ParamCondition uint8
const ( EqualParamCondition ParamCondition = iota GreaterThanParamCondition LessThanParamCondition GreaterEqualParamCondition LessEqualParamCondition NotEqualParamCondition )
type ParamRule ¶
type ParamRule struct { Condition ParamCondition `json:"condition"` Param [32]byte `json:"param"` }
type Permission ¶
type Permission struct { Target common.Address `json:"target"` FunctionABI abi.Method `json:"functionABI"` ValueLimit *big.Int `json:"valueLimit"` // NOTE: in the current implementation each function parameter can have only one verification rule. // This also means that to specify rule to only second parameter, the rule for the first parameter can NOT be omitted. Rules []ParamRule `json:"rules"` }
type SessionData ¶
type SessionData struct { SessionKey common.Address ValidAfter time.Time ValidUntil time.Time // should be generated from the list of permissions MerkleRoot []byte // address(0) means accept userOp without paymaster, // address(1) means reject userOp with paymaster, // other address means accept userOp with paymaster with the address Paymaster common.Address // `SessionKeyValidator.nonces.lastNonce++` -> used in permissionKey to track executions Nonce *big.Int }
func UnpackEnableData ¶
func UnpackEnableData(signature []byte) (SessionData, error)
func (SessionData) PackEnableData ¶
func (sd SessionData) PackEnableData() []byte
Source Files ¶
Click to show internal directories.
Click to hide internal directories.