UNPKG

@etherspot/modular-sdk

Version:

Etherspot Modular SDK - build with ERC-7579 smart accounts modules

63 lines 1.72 kB
import { encodeAbiParameters, encodeFunctionData } from 'viem'; export const HookMultiplexer = [ { type: 'function', name: 'onInstall', inputs: [ { name: 'data', type: 'bytes', internalType: 'bytes', }, ], outputs: [], stateMutability: 'nonpayable', }, { type: 'function', name: 'addHook', inputs: [ { name: 'hook', type: 'address', internalType: 'address', }, { name: 'hookType', type: 'bytes1', internalType: 'enum HookType', }, ], outputs: [], stateMutability: 'nonpayable', }, ]; export function getHookMultiPlexerInitData(globalHooks = [], valueHooks = [], delegatecallHooks = [], sigHooks = [], targetSigHooks = []) { const abiType = [ { type: 'address[]' }, { type: 'address[]' }, { type: 'address[]' }, { type: 'tuple[]', components: [{ type: 'bytes4' }, { type: 'address[]' }], }, { type: 'tuple[]', components: [{ type: 'bytes4' }, { type: 'address[]' }], }, ]; const encodedData = encodeAbiParameters(abiType, [ globalHooks, valueHooks, delegatecallHooks, sigHooks, targetSigHooks, ]); const hookMultiplexerInitData = encodeFunctionData({ abi: HookMultiplexer, args: [encodedData], functionName: 'onInstall', }); return hookMultiplexerInitData; } //# sourceMappingURL=utils.js.map