diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..55712c1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib" +} \ No newline at end of file diff --git a/package.json b/package.json index 6dc58eb..36974c7 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "start": "next start" }, "dependencies": { - "@consenlabs/imaccount-sdk": "^0.1.0", + "@consenlabs/imaccount-sdk": "^0.1.8", "next": "^13.0.0", "react": "^18.0.0", "react-dom": "^18.0.0", - "viem": "^2.21.12" + "viem": "^2.21.19" }, "devDependencies": { "@types/react": "18.3.7" diff --git a/pages/index.tsx b/pages/index.tsx index e3463a1..cb52d32 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -5,6 +5,7 @@ import { PackedUserOperation, unwrap, wrap, + SimulateType, } from "@consenlabs/imaccount-sdk"; import { Address } from "viem"; @@ -17,6 +18,10 @@ const Home = () => { "0x4d7f573039fddc84fdb28515ba20d75ef6b987ff" ); const [network, setNetwork] = useState("11155111"); + const [blockNumber, setBlockNumber] = useState("latest"); + const [simulateType, setSimulateType] = useState( + SimulateType.Send + ); // userOp input const [input, setInput] = useState(`{ @@ -60,14 +65,15 @@ const Home = () => { setLoading(true); try { - console.log(input); const simulationResult = await simulate( + simulateType, TENDERLY_ACCESS_KEY, richBundlerEOA, - parsedInput?.wrapped, + parsedInput.wrapped, projectOwner, projectName, - network + network, + blockNumber ); setResult(JSON.stringify(simulationResult, null, 2)); @@ -117,6 +123,7 @@ const Home = () => { } const handleInputChange = (e: React.ChangeEvent) => { + setResult(""); const text = e.target.value; setInput(text); try { @@ -154,7 +161,7 @@ const Home = () => { setParsedInput(null); } }; - + const handleResultClick = () => { const url = result.startsWith('"') ? JSON.parse(result) : result; window.open(url, "_blank"); @@ -240,7 +247,6 @@ const Home = () => { /> -
+
+ +
+

2. Give your userOp

+

Simulate Usage

+
+ +

UserOp Input