Skip to content

Commit

Permalink
added module type enum and module info thpe
Browse files Browse the repository at this point in the history
  • Loading branch information
RanaBug committed Jul 11, 2024
1 parent 355ade3 commit d725630
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions __tests__/hooks/useEtherspotModules.test.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/useEtherspotModules.ts
Original file line number Diff line number Diff line change
@@ -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<string>;
Expand Down
19 changes: 19 additions & 0 deletions src/types/EtherspotTransactionKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit d725630

Please sign in to comment.