ModuleSDK
Glossary
Types

Types in ModuleSDK

Glossary of types in ModuleSDK.

Account

The object representing an account in ModuleSDK.

Definition

type Account = {
  address: Address;
  initCode?: Hex;
  type: AccountType;
  deployedOnChains: Number[];
};

Properties

address

The address of the account.

initCode

The init code of the account.

type

The type of the account.

deployedOnChains

  • Type: Number[]

The chains on which the account is deployed.

AccountType

The type of the account.

Definition

type AccountType = "erc7579-implementation" | "kernel" | "safe" | "nexus";

Properties

type

  • Type: string

One of the following values:

  • erc7579-implementation
  • kernel
  • safe
  • nexus

Action

The object representing an action in ModuleSDK.

Definition

type Action = {
  target: Address;
  value: BigInt;
  callData: Hex;
};

Properties

target

The address of the target.

value

  • Type: BigInt

The native token value of the execution.

callData

The calldata of the action to be executed on the target.

HookType

The types of subhooks for the HookMultiplexer.

Definition

enum HookType {
  GLOBAL,
  DELEGATECALL,
  VALUE,
  SIG,
  TARGET,
}

Properties

GLOBAL

  • Type: number

Global hooks that get run on every execution.

DELEGATECALL

  • Type: number

Hooks that get run on every delegatecall.

VALUE

  • Type: number

Hooks that get run on every value transfer.

SIG

  • Type: number

Hooks that get run based on which function is called on the account.

TARGET

  • Type: number

Hooks that get run based on the function called on the target.

Module

The object representing a module in ModuleSDK.

Definition

type Module = {
  module: Address;
  data?: Hex;
  additionalContext?: Hex;
  type: ModuleType;
};

Properties

module

The address of the module.

data

The installation or uninstallation data to be sent to the module.

additionalContext

The additional context to be sent to the account.

type

The type of the module.

ModuleType

The type of the module.

Definition

type ModuleType = "validators" | "executors" | "hooks" | "fallbacks";

Properties

type

  • Type: string

One of the following values:

  • validators
  • executors
  • hooks
  • fallbacks

Session

The object representing a smart sessions validator session in ModuleSDK.

Definition

export type Session = {
  sessionValidator: Address
  sessionValidatorInitData: Hex
  salt: Hex
  userOpPolicies: PolicyData[]
  erc7739Policies: ERC7739Data
  actions: ActionData[]
}

Properties

sessionValidator

The address of the session validator.

sessionValidatorInitData

The configuration data of the validator. For example, this could be the owners to be verified against.

salt

A unique identifier to prevent collision between sessions. A session key owner can have multiple sessions with the same parameters. To facilitate this, a salt is necessary to avoid collision.

userOpPolicies

A list of userOp policies.

erc7739Policies

A list of erc7739 policies.

actions

A list of action policies.

PolicyData

The object representing a policy data for userOp and action policies in a session.

Definition

export type PolicyData = {
  policy: Address
  initData: Hex
}

Properties

policy

The address of the policy contract.

initData

The init data for initializing policy.

ERC7739Data

The object representing an ERC7739Data in a session.

Definition

export type ERC7739Data = {
  allowedERC7739Content: string[]
  erc1271Policies: PolicyData[]
}

Properties

allowedERC7739Content

  • Type: [string[]]

A list of allowed ERC7739 content.

erc1271Policies

A list of erc1271 policies.

ActionData

The object representing the ActionData in a session.

Definition

export type ActionData = {
  actionTargetSelector: Hex
  actionTarget: Address
  actionPolicies: PolicyData[]
}

Properties

actionTargetSelector

The selector of the action target.

actionTarget

The address of the action target.

actionPolicies

A list of action policies.

SmartSessionMode

The mode of the session.

Definition

type SmartSessionMode = 
      '0x00' // USE mode: If the USE mode was selected, no futher policies have to be enabled.
    | '0x01' // ENABLE mode: If the ENABLE mode was selected, the userOp.signature will contain the EnableSession data This data will be used to enable policies and validator for the session
    | '0x02' // UNSAFE_ENABLE
 

SessionEIP712

The object representing an EIP712 session in ModuleSDK.

Definition

export type SessionEIP712 = {
  account: Address
  smartSession: Address
  mode: number
  nonce: bigint
  sessionValidator: Address
  sessionValidatorInitData: Hex
  salt: Hex
  userOpPolicies: PolicyData[]
  erc7739Policies: ERC7739Data
  actions: ActionData[]
}

Properties

account

The address of the account.

smartSession

The address of the smart session.

mode

The mode of the session.

sessionValidator

The address of the session validator.

sessionValidatorInitData

The configuration data of the validator.

salt

A unique identifier to prevent collision between sessions. A session key owner can have multiple sessions with the same parameters. To facilitate this, a salt is necessary to avoid collision.

userOpPolicies

A list of userOp policies.

erc7739Policies

A list of erc7739 policies.

actions

A list of action policies.

ChainSession

The object representing a chain session in ModuleSDK.

Definition

export type ChainSession = {
  chainId: bigint
  session: SessionEIP712
}

Properties

chainId

  • Type: bigInt

The chain id of the session.

session

EnableSession

The object representing a chain session in ModuleSDK.

Definition

export type EnableSession = {
  chainDigestIndex: number
  hashesAndChainIds: ChainDigest[]
  sessionToEnable: Session
  permissionEnableSig: Hex
}

Properties

chainDigestIndex

  • Type: number

The chain digest index for the chain you want to enable session on.

hashesAndChainIds

The session digest hashes and chain ids.

sessionToEnable

The session to enable.

permissionEnableSig

The permission enable signature.

EnableSessionData

The object representing data needed to enabled a session in an account.

Definition

export type EnableSessionData = {
  enableSession: EnableSession
  validator: Address
  accountType: AccountType
}

Properties

enableSession

The enable session object.

validator

The address of the validator.

accountType

The type of the account.

DecodedSessionData

The object representing a decoded session data in ModuleSDK.

Definition

export type DecodedSessionData = {
  mode: SmartSessionMode
  permssionId: Hex
  signature: Hex,
  enableSessionData: EnableSessionData
}

Properties

mode

The mode of the session.

permssionId

The permission ID of the session.

signature

The signature of the session.

enableSessionData

The data needed to enable a session in an account.

Policy

The object representing a smart session policy in ModuleSDK.

Definition

export type Policy = {
  address: Address
  initData: Hex
  deInitData: Hex
}

Properties

address

The address of the policy.

initData

The init data of the policy.

deInitData

The deinit data of the policy.

TokenWithLimit

Token with limit object.

Definition

type TokenWithLimit = {
  token: Address
  limit: bigint
}

Properties

token

The address of the token.

limit

  • Type: bigint

The limit of the token.

ActionConfig

The object representing universal action policy configuration.

Definition

type ActionConfig = {
  valueLimitPerUse: bigint
  paramRules: ParamRules
}

Properties

valueLimitPerUse

  • Type: bigint

The value limit per use.

paramRules

The parameter rules.

ParamRules

The object representing parameter rules for universal action policy configuration.

Definition

type ParamRules = {
  length: number
  rules: ParamRule[]
}

Properties

length

  • Type: number

The length of the rules.

rules

The parameter rules.

ParamRule

The object representing a parameter rule for universal action policy configuration.

Definition

type ParamRule = {
  condition: ParamCondition
  offset: number
  isLimited: boolean
  ref: Hex
  usage: LimitUsage
}

Properties

condition

The condition of the rule.

offset

  • Type: number

The offset of the rule.

isLimited

  • Type: boolean

Whether the rule is limited.

ref

The parameter rules.

usage

The limit usage.

LimitUsage

The object representing a limit usage for universal action policy configuration.

Definition

type LimitUsage = {
  limit: bigint
  used: bigint
}

Properties

limit

  • Type: bigint

The limit of the usage.

used

  • Type: bigint

The used limit.

ParamCondition

The enum representing the universal action policy param condition types.

Definition

export enum ParamCondition {
  EQUAL,
  GREATER_THAN,
  LESS_THAN,
  GREATER_THAN_OR_EQUAL,
  LESS_THAN_OR_EQUAL,
  NOT_EQUAL,
}