From d72563040b1cf0f2fec764326f8025d14b9590fd Mon Sep 17 00:00:00 2001 From: RanaBug Date: Thu, 11 Jul 2024 12:50:57 +0100 Subject: [PATCH] added module type enum and module info thpe --- CHANGELOG.md | 5 +++++ __tests__/hooks/useEtherspotModules.test.js | 4 +--- example/src/App.tsx | 4 ++-- package.json | 2 +- src/hooks/useEtherspotModules.ts | 5 ++--- src/types/EtherspotTransactionKit.ts | 19 +++++++++++++++++++ 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a9d565..64ca30b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [0.14.1] - 2024-07-11 + +### Added Changes +- Added `MODULE_TYPE` enume and `ModuleInfo` type from `etherspot-modular` + ## [0.14.0] - 2024-07-10 ### Added Changes diff --git a/__tests__/hooks/useEtherspotModules.test.js b/__tests__/hooks/useEtherspotModules.test.js index 1404d6d..e13a756 100644 --- a/__tests__/hooks/useEtherspotModules.test.js +++ b/__tests__/hooks/useEtherspotModules.test.js @@ -1,9 +1,7 @@ import { renderHook, waitFor } from '@testing-library/react'; import { ethers } from 'ethers'; +import { useEtherspotModules, EtherspotTransactionKit, MODULE_TYPE } from '../../src'; -// hooks -import { useEtherspotModules, EtherspotTransactionKit } from '../../src'; -import { MODULE_TYPE } from '@etherspot/modular-sdk/dist/sdk/common'; const ethersProvider = new ethers.providers.JsonRpcProvider('http://localhost:8545', 'sepolia'); // replace with your node's RPC URL const provider = new ethers.Wallet.createRandom().connect(ethersProvider); diff --git a/example/src/App.tsx b/example/src/App.tsx index 8904fc1..0b19405 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,5 +1,3 @@ -import { ModuleInfo } from '@etherspot/modular-sdk/dist/sdk/base/EtherspotWalletAPI'; -import { MODULE_TYPE } from '@etherspot/modular-sdk/dist/sdk/common'; import { EstimatedBatch, EtherspotBatch, @@ -12,6 +10,8 @@ import { useEtherspotTransactions, useWalletAddress, useEtherspotModules, + ModuleInfo, + MODULE_TYPE, } from '@etherspot/transaction-kit'; import TreeItem from '@mui/lab/TreeItem'; import TreeView from '@mui/lab/TreeView'; diff --git a/package.json b/package.json index 6e35b96..e634696 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@etherspot/transaction-kit", "description": "React Etherspot Transaction Kit", - "version": "0.14.0", + "version": "0.14.1", "main": "dist/cjs/index.js", "scripts": { "rollup:build": "NODE_OPTIONS=--max-old-space-size=8192 rollup -c", diff --git a/src/hooks/useEtherspotModules.ts b/src/hooks/useEtherspotModules.ts index 9136c00..a04f8d4 100644 --- a/src/hooks/useEtherspotModules.ts +++ b/src/hooks/useEtherspotModules.ts @@ -1,12 +1,11 @@ import { useMemo } from 'react'; +import { ModularSdk } from '@etherspot/modular-sdk'; // hooks import useEtherspot from './useEtherspot'; // types -import { MODULE_TYPE } from '@etherspot/modular-sdk/dist/sdk/common'; -import { ModularSdk } from '@etherspot/modular-sdk'; -import { ModuleInfo } from '@etherspot/modular-sdk/dist/sdk/base/EtherspotWalletAPI'; +import { MODULE_TYPE, ModuleInfo } from '../types/EtherspotTransactionKit'; interface IEtherspotModulesHook { installModule: (moduleType: MODULE_TYPE, module: string, initData?: string, accountAddress?: string, modulesChainId?: number) => Promise; diff --git a/src/types/EtherspotTransactionKit.ts b/src/types/EtherspotTransactionKit.ts index b1260d8..390d939 100644 --- a/src/types/EtherspotTransactionKit.ts +++ b/src/types/EtherspotTransactionKit.ts @@ -184,3 +184,22 @@ export interface UserOpTransaction { } export type AccountTemplate = 'etherspot' | 'etherspotModular' | 'zeroDev' | 'simpleAccount'; + +export enum MODULE_TYPE { + VALIDATOR = "0x01", + EXECUTOR = "0x02", + FALLBACK = "0x03", + HOOK = "0x04" +} + +export type ModuleInfo = { + validators?: string[]; + executors?: string[]; + hook?: string; + fallbacks?: FallbackInfo[]; +}; + +export type FallbackInfo = { + selector: string; + handlerAddress: string; +}; \ No newline at end of file