From 05e05ece35f9acf8247a7d033b232d8ecd5a9236 Mon Sep 17 00:00:00 2001 From: Shivanshi Date: Sun, 25 Feb 2024 14:03:16 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/components/header.tsx | 4 +- ui/components/providers.tsx | 6 +- ui/components/shell.tsx | 290 +++++--- ui/components/version.tsx | 21 +- ui/lib/abi/IntentsEngineAbiArb.ts | 1097 ++++++++++++++--------------- ui/lib/constants.ts | 6 +- 6 files changed, 767 insertions(+), 657 deletions(-) diff --git a/ui/components/header.tsx b/ui/components/header.tsx index eeadd7b..824989a 100644 --- a/ui/components/header.tsx +++ b/ui/components/header.tsx @@ -4,7 +4,9 @@ import { Version } from "./version"; export const Header = () => { return (
-

Nani Intents Shell

+

+ Nani Intents Shell +

(c) 2024 Nani Kotoba DAO LLC. All rights reserved.

diff --git a/ui/components/providers.tsx b/ui/components/providers.tsx index da9987e..395bbc9 100644 --- a/ui/components/providers.tsx +++ b/ui/components/providers.tsx @@ -10,11 +10,7 @@ const config = getDefaultConfig({ appName: siteConfig.name, appDescription: siteConfig.description, projectId: process.env.NEXT_PUBLIC_WC_ID!, - chains: [ - mainnet, - sepolia, - arbitrum - ], + chains: [mainnet, sepolia, arbitrum], ssr: true, }); diff --git a/ui/components/shell.tsx b/ui/components/shell.tsx index 29acfa3..22df8d2 100644 --- a/ui/components/shell.tsx +++ b/ui/components/shell.tsx @@ -10,7 +10,6 @@ import { usePublicClient, useWriteContract, } from "wagmi"; -import { IntentsEngineAbi } from "../lib/abi/IntentsEngineAbi"; import { ETH_ADDRESS, IE_ADDRESS } from "../lib/constants"; import { erc20Abi, @@ -19,10 +18,12 @@ import { maxUint256, zeroAddress, } from "viem"; -import { mainnet } from "viem/chains"; +import { arbitrum, mainnet } from "viem/chains"; import useShellStore from "@/lib/use-shell-store"; import { ShellHistory } from "./shell-history"; import { cn } from "@/lib/utils"; +import { IntentsEngineAbi } from "@/lib/abi/IntentsEngineAbi"; +import { IntentsEngineAbiArb } from "@/lib/abi/IntentsEngineAbiArb"; const formSchema = z.object({ command: z.string().min(2), @@ -57,7 +58,7 @@ export const Shell = () => { chainId: mainnet.id, }); const { writeContractAsync } = useWriteContract(); - + const client = usePublicClient({ chainId: chain ? chain.id : mainnet.id, }); @@ -85,105 +86,217 @@ export const Shell = () => { addLine(

{error.message}

); }; - async function onSubmit({ command }: z.infer) { - try { - form.reset(); - addCommand({ chainId: chain?.id, user: name ?? address, command }); - if (!client) throw new Error("No client available"); - if (!address) throw new Error("No wallet connected"); - if (!chain) throw new Error("No chain connected"); + async function handleArbCommand(command: string) { + if (!client) throw new Error("No client available"); + if (!address) throw new Error("No wallet connected"); - const ieAddress = IE_ADDRESS[chain.id]; + const ieAddress = IE_ADDRESS[arbitrum.id]; - let value = 0n; + let value = 0n; - const preview = await client.readContract({ - address: ieAddress, - abi: IntentsEngineAbi, - functionName: "previewCommand", - args: [command], + const preview = await client.readContract({ + address: ieAddress, + abi: IntentsEngineAbiArb, + functionName: "previewCommand", + args: [command], + }); + const previewedToken = preview[3]; + + addLine(

Preview: {serialize(preview)}

); + + if (isAddressEqual(previewedToken, zeroAddress)) { + // invalid token + throw new Error( + "This token is not supported by the Intents Engine. Did you misspell the token symbol?", + ); + } + + if (isAddressEqual(previewedToken, ETH_ADDRESS)) { + // sending ether directly + value = preview[1]; + } else { + // consent to spend tokens + const allowance = await client.readContract({ + address: previewedToken, + abi: erc20Abi, + functionName: "allowance", + args: [address, ieAddress], }); - addLine(

Preview: {serialize(preview)}

); + if (allowance < preview[1]) { + // we do a lil approve dance + const approveTxHash = await writeContractAsync({ + address: previewedToken, + abi: erc20Abi, + functionName: "approve", + args: [ieAddress, maxUint256], + }); + + addLine( +

+ Approve TX Hash:{" "} + + {approveTxHash} + +

, + ); + + const allowanceReceipt = await client.waitForTransactionReceipt({ + hash: approveTxHash, + confirmations: 1, + }); - if (isAddressEqual(preview[2], zeroAddress)) { - // invalid token - throw new Error("This token is not supported by the Intents Engine. Did you misspell the token symbol?"); + addLine(

Allowance Set. Receipt: {serialize(allowanceReceipt)}

); } + } + + const commandTxHash = await writeContractAsync({ + address: ieAddress, + abi: IntentsEngineAbiArb, + functionName: "command", + value, + args: [command], + }); + + addLine( +

+ Command TX Hash:{" "} + + {commandTxHash} + +

, + ); + + const commandReceipt = await client.waitForTransactionReceipt({ + hash: commandTxHash, + confirmations: 1, + }); + + addLine(

Command Executed. Receipt: {JSON.stringify(commandReceipt)}

); + } + + async function handleMainnetCommand(command: string) { + if (!client) throw new Error("No client available"); + if (!address) throw new Error("No wallet connected"); + + const ieAddress = IE_ADDRESS[mainnet.id]; + + let value = 0n; - if (isAddressEqual(preview[2], ETH_ADDRESS)) { - // sending ether directly - value = preview[1]; - } else { - // consent to spend tokens - const allowance = await client.readContract({ + const preview = await client.readContract({ + address: ieAddress, + abi: IntentsEngineAbi, + functionName: "previewCommand", + args: [command], + }); + + addLine(

Preview: {serialize(preview)}

); + + if (isAddressEqual(preview[2], zeroAddress)) { + // invalid token + throw new Error( + "This token is not supported by the Intents Engine. Did you misspell the token symbol?", + ); + } + + if (isAddressEqual(preview[2], ETH_ADDRESS)) { + // sending ether directly + value = preview[1]; + } else { + // consent to spend tokens + const allowance = await client.readContract({ + address: preview[2], + abi: erc20Abi, + functionName: "allowance", + args: [address, ieAddress], + }); + + if (allowance < preview[1]) { + // we do a lil approve dance + const approveTxHash = await writeContractAsync({ address: preview[2], abi: erc20Abi, - functionName: "allowance", - args: [address, ieAddress], + functionName: "approve", + args: [ieAddress, maxUint256], }); - - if (allowance < preview[1]) { - // we do a lil approve dance - const approveTxHash = await writeContractAsync({ - address: preview[2], - abi: erc20Abi, - functionName: "approve", - args: [ieAddress, maxUint256], - }); - - addLine( -

- Approve TX Hash:{" "} - - {approveTxHash} - -

, - ); - - const allowanceReceipt = await client.waitForTransactionReceipt({ - hash: approveTxHash, - confirmations: 1, - }); - - addLine(

Allowance Set. Receipt: {serialize(allowanceReceipt)}

); - } + + addLine( +

+ Approve TX Hash:{" "} + + {approveTxHash} + +

, + ); + + const allowanceReceipt = await client.waitForTransactionReceipt({ + hash: approveTxHash, + confirmations: 1, + }); + + addLine(

Allowance Set. Receipt: {serialize(allowanceReceipt)}

); } + } - const commandTxHash = await writeContractAsync({ - address: ieAddress, - abi: IntentsEngineAbi, - functionName: "command", - value, - args: [command], - }); + const commandTxHash = await writeContractAsync({ + address: ieAddress, + abi: IntentsEngineAbi, + functionName: "command", + value, + args: [command], + }); - addLine( -

- Command TX Hash:{" "} - - {commandTxHash} - -

, - ); + addLine( +

+ Command TX Hash:{" "} + + {commandTxHash} + +

, + ); - const commandReceipt = await client.waitForTransactionReceipt({ - hash: commandTxHash, - confirmations: 1, - - }); + const commandReceipt = await client.waitForTransactionReceipt({ + hash: commandTxHash, + confirmations: 1, + }); - addLine( -

Command Executed. Receipt: {JSON.stringify(commandReceipt)}

, - ); + addLine(

Command Executed. Receipt: {JSON.stringify(commandReceipt)}

); + } + + async function onSubmit({ command }: z.infer) { + try { + form.reset(); + addCommand({ chainId: chain?.id, user: name ?? address, command }); + if (!client) throw new Error("No client available"); + if (!address) throw new Error("No wallet connected"); + if (!chain) throw new Error("No chain connected"); + + switch (chain.id) { + case arbitrum.id: + await handleArbCommand(command); + break; + case mainnet.id: + await handleMainnetCommand(command); + break; + default: + throw new Error("Unsupported chain"); + } } catch (error) { console.error(error); error instanceof Error @@ -212,7 +325,10 @@ export const Shell = () => { {id} diff --git a/ui/components/version.tsx b/ui/components/version.tsx index fda4813..ca051ca 100644 --- a/ui/components/version.tsx +++ b/ui/components/version.tsx @@ -1,18 +1,15 @@ -'use client' -import { useAccount } from "wagmi" +"use client"; +import { useAccount } from "wagmi"; const versions: { - [key: number]: string + [key: number]: string; } = { - 1: "1.0.0", - 42161: "1.0.1 (nightly)", -} + 1: "1.0.0", + 42161: "1.0.1 (nightly)", +}; export const Version = () => { - const { chain } = useAccount(); - - return - {`[ Version ${versions[chain ? chain.id : 1]} ]`} - -} + const { chain } = useAccount(); + return {`[ Version ${versions[chain ? chain.id : 1]} ]`}; +}; diff --git a/ui/lib/abi/IntentsEngineAbiArb.ts b/ui/lib/abi/IntentsEngineAbiArb.ts index b59158c..000b698 100644 --- a/ui/lib/abi/IntentsEngineAbiArb.ts +++ b/ui/lib/abi/IntentsEngineAbiArb.ts @@ -1,550 +1,549 @@ export const IntentsEngineAbiArb = [ - { - "type": "constructor", - "inputs": [], - "stateMutability": "payable" - }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "receive", - "stateMutability": "payable" - }, - { - "type": "function", - "name": "checkPackedUserOp", - "inputs": [ - { - "name": "intent", - "type": "string", - "internalType": "string" - }, - { - "name": "userOp", - "type": "tuple", - "internalType": "struct IE.PackedUserOperation", - "components": [ - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "accountGasLimits", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "preVerificationGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gasFees", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "paymasterAndData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ] - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "checkUserOp", - "inputs": [ - { - "name": "intent", - "type": "string", - "internalType": "string" - }, - { - "name": "userOp", - "type": "tuple", - "internalType": "struct IE.UserOperation", - "components": [ - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callGasLimit", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "verificationGasLimit", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "preVerificationGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxFeePerGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxPriorityFeePerGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "paymasterAndData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ] - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "command", - "inputs": [ - { - "name": "intent", - "type": "string", - "internalType": "string" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "previewCommand", - "inputs": [ - { - "name": "intent", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minAmountOut", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "executeCallData", - "type": "bytes", - "internalType": "bytes" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "previewSend", - "inputs": [ - { - "name": "to", - "type": "string", - "internalType": "string" - }, - { - "name": "amount", - "type": "string", - "internalType": "string" - }, - { - "name": "token", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "_to", - "type": "address", - "internalType": "address" - }, - { - "name": "_amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "_token", - "type": "address", - "internalType": "address" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "executeCallData", - "type": "bytes", - "internalType": "bytes" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "previewSwap", - "inputs": [ - { - "name": "amountIn", - "type": "string", - "internalType": "string" - }, - { - "name": "amountOutMinimum", - "type": "string", - "internalType": "string" - }, - { - "name": "tokenIn", - "type": "string", - "internalType": "string" - }, - { - "name": "tokenOut", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "_amountIn", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "_amountOut", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "_tokenIn", - "type": "address", - "internalType": "address" - }, - { - "name": "_tokenOut", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "send", - "inputs": [ - { - "name": "to", - "type": "string", - "internalType": "string" - }, - { - "name": "amount", - "type": "string", - "internalType": "string" - }, - { - "name": "token", - "type": "string", - "internalType": "string" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "setName", - "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "name", - "type": "string", - "internalType": "string" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "setNameAndTicker", - "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "swap", - "inputs": [ - { - "name": "amountIn", - "type": "string", - "internalType": "string" - }, - { - "name": "amountOutMinimum", - "type": "string", - "internalType": "string" - }, - { - "name": "tokenIn", - "type": "string", - "internalType": "string" - }, - { - "name": "tokenOut", - "type": "string", - "internalType": "string" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "tokens", - "inputs": [ - { - "name": "name", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "whatIsTheAddressOf", - "inputs": [ - { - "name": "name", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "receiver", - "type": "address", - "internalType": "address" - }, - { - "name": "node", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "whatIsTheBalanceOf", - "inputs": [ - { - "name": "name", - "type": "string", - "internalType": "string" - }, - { - "name": "token", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "balance", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "balanceAdjusted", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "whatIsTheTotalSupplyOf", - "inputs": [ - { - "name": "token", - "type": "string", - "internalType": "string" - } - ], - "outputs": [ - { - "name": "supply", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "supplyAdjusted", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "event", - "name": "NameSet", - "inputs": [ - { - "name": "token", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "name", - "type": "string", - "indexed": false, - "internalType": "string" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "InsufficientSwap", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidCharacter", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidSwap", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidSyntax", - "inputs": [] - }, - { - "type": "error", - "name": "Overflow", - "inputs": [] - } - ] as const; - \ No newline at end of file + { + type: "constructor", + inputs: [], + stateMutability: "payable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "checkPackedUserOp", + inputs: [ + { + name: "intent", + type: "string", + internalType: "string", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct IE.PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "checkUserOp", + inputs: [ + { + name: "intent", + type: "string", + internalType: "string", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct IE.UserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "callGasLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "verificationGasLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "maxFeePerGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "maxPriorityFeePerGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "command", + inputs: [ + { + name: "intent", + type: "string", + internalType: "string", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "previewCommand", + inputs: [ + { + name: "intent", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "to", + type: "address", + internalType: "address", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + { + name: "minAmountOut", + type: "uint256", + internalType: "uint256", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "executeCallData", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "previewSend", + inputs: [ + { + name: "to", + type: "string", + internalType: "string", + }, + { + name: "amount", + type: "string", + internalType: "string", + }, + { + name: "token", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "_to", + type: "address", + internalType: "address", + }, + { + name: "_amount", + type: "uint256", + internalType: "uint256", + }, + { + name: "_token", + type: "address", + internalType: "address", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "executeCallData", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "previewSwap", + inputs: [ + { + name: "amountIn", + type: "string", + internalType: "string", + }, + { + name: "amountOutMinimum", + type: "string", + internalType: "string", + }, + { + name: "tokenIn", + type: "string", + internalType: "string", + }, + { + name: "tokenOut", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "_amountIn", + type: "uint256", + internalType: "uint256", + }, + { + name: "_amountOut", + type: "uint256", + internalType: "uint256", + }, + { + name: "_tokenIn", + type: "address", + internalType: "address", + }, + { + name: "_tokenOut", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "send", + inputs: [ + { + name: "to", + type: "string", + internalType: "string", + }, + { + name: "amount", + type: "string", + internalType: "string", + }, + { + name: "token", + type: "string", + internalType: "string", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "setName", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "name", + type: "string", + internalType: "string", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "setNameAndTicker", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "swap", + inputs: [ + { + name: "amountIn", + type: "string", + internalType: "string", + }, + { + name: "amountOutMinimum", + type: "string", + internalType: "string", + }, + { + name: "tokenIn", + type: "string", + internalType: "string", + }, + { + name: "tokenOut", + type: "string", + internalType: "string", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "tokens", + inputs: [ + { + name: "name", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "whatIsTheAddressOf", + inputs: [ + { + name: "name", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "receiver", + type: "address", + internalType: "address", + }, + { + name: "node", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "whatIsTheBalanceOf", + inputs: [ + { + name: "name", + type: "string", + internalType: "string", + }, + { + name: "token", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "balance", + type: "uint256", + internalType: "uint256", + }, + { + name: "balanceAdjusted", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "whatIsTheTotalSupplyOf", + inputs: [ + { + name: "token", + type: "string", + internalType: "string", + }, + ], + outputs: [ + { + name: "supply", + type: "uint256", + internalType: "uint256", + }, + { + name: "supplyAdjusted", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "NameSet", + inputs: [ + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "name", + type: "string", + indexed: false, + internalType: "string", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "InsufficientSwap", + inputs: [], + }, + { + type: "error", + name: "InvalidCharacter", + inputs: [], + }, + { + type: "error", + name: "InvalidSwap", + inputs: [], + }, + { + type: "error", + name: "InvalidSyntax", + inputs: [], + }, + { + type: "error", + name: "Overflow", + inputs: [], + }, +] as const; diff --git a/ui/lib/constants.ts b/ui/lib/constants.ts index 8e90eb1..690a9e5 100644 --- a/ui/lib/constants.ts +++ b/ui/lib/constants.ts @@ -1,10 +1,10 @@ import { Address } from "viem"; export const IE_ADDRESS: { - [key: number]: Address + [key: number]: Address; } = { - 1: "0x1E00000000Cf8ba83e0005c59c1Bf1C4682C8E00", - 42161: "0x000000001e202b5b84e56400f409800065cb6d3c" + 1: "0x1E00000000Cf8ba83e0005c59c1Bf1C4682C8E00", + 42161: "0x000000001e202b5b84e56400f409800065cb6d3c", }; export const ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";