Skip to content

Commit

Permalink
Merge pull request #4 from nachopiris/master
Browse files Browse the repository at this point in the history
General Improvements
  • Loading branch information
Agusx1211 authored Sep 26, 2024
2 parents c4d6e91 + 7bc6179 commit e9d315a
Show file tree
Hide file tree
Showing 42 changed files with 2,235 additions and 662 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
- name: Install
run: pnpm install

- name: Lint
run: pnpm lint

- name: Spellcheck
run: pnpm spellcheck

- name: Build
run: pnpm build

Expand Down
10 changes: 10 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2",
"language": "en",
"dictionaries": ["typescript", "softwareTerms", "filetypes", "npm", "fonts", "css", "html"],
"ignorePaths": [
"**/node_modules/**",
"pnpm-lock.yaml"
],
"words": ["xsequence", "subdigest", "predecorate", "arrayify", "signhub", "hexlify", "viem", "wagmi", "transactionish", "delphiview", "numberish", "tabler", "keccak", "wordlists", "connectkit", "ipfs", "godmode"]
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint .",
"spellcheck": "cspell '**'",
"preview": "vite preview"
},
"dependencies": {
"@0xsequence/account": "^1.9.13",
"@0xsequence/core": "^1.9.13",
"@0xsequence/signhub": "^1.9.13",
"@0xsequence/indexer": "^2.0.4",
"@0xsequence/network": "^1.9.13",
"@0xsequence/sessions": "^1.9.13",
"@0xsequence/signhub": "^1.9.13",
"@mantine/core": "^7.7.1",
"@mantine/form": "^7.7.1",
"@mantine/hooks": "^7.7.1",
Expand All @@ -37,6 +39,7 @@
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"cspell": "^8.14.2",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
Expand Down
735 changes: 718 additions & 17 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { ConnectKitButton } from 'connectkit';
import { Transaction } from './sections/Transaction';
import { Message } from './sections/Message';
import { Transactions } from './sections/Transactions';
import { useImport } from './sections/Import';
import { useImport } from './hooks/Import';
import { ImportWallet } from './sections/ImportWallet';
import { useWallets } from './stores/db/Wallets';
import { Update } from './sections/Update';
import { Updates } from './sections/Updates';
import { UpdateDetail } from './sections/UpdateDetail';
import { Messages } from './sections/Messages';

declare var __COMMIT_HASH__: string
declare const __COMMIT_HASH__: string

export function App() {
const importModal = useImport()
Expand Down Expand Up @@ -84,7 +84,9 @@ export function App() {
<Divider />
<NativeSelect
description="Selected wallet"
data={['Select wallet', ...wallets.map(w => w.address)]}
data={['Select wallet', ...wallets.map(w => {
return {label: `${w.name} (${w.address})`, value: w.address}
})]}
mt="md"
mb="md"
onChange={(event) => {
Expand Down
4 changes: 2 additions & 2 deletions src/Names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export const nameForAddress = (address: string): string => {
}

export const nameGenerator = (seed: string, length: number): string => {
const wordlistSize = 2048
const wordListSize = 2048
const words = ethers.wordlists.en

let output = ''
let subSeed = ethers.utils.keccak256(seed)
for (let i = 0; i < length; i++) {
const index = ethers.BigNumber.from(subSeed).mod(wordlistSize).toNumber()
const index = ethers.BigNumber.from(subSeed).mod(wordListSize).toNumber()
output = `${words.getWord(index)} ${output}`
subSeed = ethers.utils.keccak256(subSeed)
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function parseFunctionSelector(selector: string): ParsedFunctionSelector
}

for (const input of res.inputs) {
if (!/^(address|uint\d+|int\d+|bool|bytes\d*|string)$/.test(input.type)) {
if (!/^(address|uint\d+|int\d+|bool|bytes\d*|string|uint256\[\])$/.test(input.type)) {
throw new Error('Invalid type: ' + input.type)
}
}
Expand Down
18 changes: 8 additions & 10 deletions src/components/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { Text, Table, Box } from "@mantine/core";
import { TransactionsEntry } from "../stores/db/Transactions";

export function Actions(props: { transaction: TransactionsEntry}) {
export function Actions(props: { transaction: TransactionsEntry }) {
const rows = props.transaction.transactions.map((element, i) => (
<Table.Tr key={i} style={{ verticalAlign: "text-top" }}>
<Table.Td>{element.to}</Table.Td>
<Table.Td>{element.value || "0"}</Table.Td>
<Table.Td>
<Box>
<Text style={{ lineBreak: "anywhere"}}>
<p>
{element.data || "0x"}
</p>
</Text>
<Text style={{ lineBreak: "anywhere" }}>{element.data || "0x"}</Text>
</Box>
</Table.Td>
<Table.Td>{element.gasLimit || element.revertOnError ? "Auto" : "0"}</Table.Td>
<Table.Td>
{element.gasLimit || element.revertOnError ? "Auto" : "0"}
</Table.Td>
<Table.Td>{element.revertOnError ? "Yes" : "No"}</Table.Td>
<Table.Td>{element.delegateCall ? "Yes" : "No"}</Table.Td>
<Table.Td>{element.delegateCall ? "Yes" : "No"}</Table.Td>
</Table.Tr>
))
));

return (
<Table>
Expand All @@ -35,5 +33,5 @@ export function Actions(props: { transaction: TransactionsEntry}) {
</Table.Thead>
<Table.Tbody>{rows}</Table.Tbody>
</Table>
)
);
}
4 changes: 2 additions & 2 deletions src/components/ActionsDecoded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function ActionArguments(props: { action: FlatTransaction, signature: Fun
return <>
{decoded && <Box>
{decoded.args?.map((input, i) => <Box key={i}>
- <b>{parsed?.inputs[i]?.name || i.toString()}</b>: {(input as any).toString()}
- <b>{parsed?.inputs[i]?.name || i.toString()}</b>: {String(input)}
</Box>)}
</Box>}
{error && <Box>
Expand Down Expand Up @@ -132,7 +132,7 @@ export function ActionsDecoded(props: { transaction: TransactionsEntry, state: {

return <>
<Space h="md" />
{transaction.transactions.map((action, i) => <Box>
{transaction.transactions.map((action, i) => <Box key={i}>
<Title order={6}>Action #{i}</Title>
<ActionDecode key={i} action={action} state={state} />
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/components/MiniCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export function MiniCard(args: {
try {
await navigator.clipboard.writeText(args.value);
notifications.show({
title: "Text copied",
message: "Text successfully copied to clipboard",
title: `${args.title} copied`,
message: `${args.title} successfully copied to clipboard`,
color: "green",
});
} catch (error) {
Expand Down
8 changes: 6 additions & 2 deletions src/components/SignerEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export type SignerEditorEntry = {

export type SignerEditorProps<T> = {
form: UseFormReturnType<T>,
formKey: string
formKey: "signers"
}

export type FormValues = {
signers: SignerEditorEntry[],
}

export function SignerEditorValidator() {
Expand Down Expand Up @@ -38,7 +42,7 @@ export function SignerEditorValidator() {

export function SignerEditor<T>(props: SignerEditorProps<T>) {
const { form, formKey } = props
const values = form.values as any
const values = form.values as FormValues

return <>
{ (values[formKey] as SignerEditorEntry[]).map((_, index) => (
Expand Down
Loading

0 comments on commit e9d315a

Please sign in to comment.