Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: decoded calldata #52

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ public/initializeTheme.*
*.njsproj
*.sln
*.sw?

# Foundry
test/contracts/cache
test/contracts/out
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
</head>
<body>
<div id="root"></div>
<script type="module" src="./test-dapp/main.tsx"></script>
<script type="module" src="./test/dapp/main.tsx"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"build:ds": "vite build -c src/design-system/vite.config.ts",
"build:inpage": "vite build -c vite.config.inpage.ts",
"clean": "rimraf dist",
"contracts:build": "forge build --config-path test/contracts/foundry.toml && bun scripts/generate-typed-artifacts.ts",
"contracts:deploy": "bun scripts/deploy-contracts.ts",
"dev": "cross-env NODE_ENV=development bun run build:inpage && vite --open",
"format": "biome format . --write",
"lint": "biome check .",
Expand All @@ -19,20 +21,24 @@
"postinstall": "patch-package",
"prepare": "bun run build:ds",
"symbols": "bun scripts/symbols.ts",
"sync": "git submodule init && git submodule update",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@capsizecss/core": "^3.1.0",
"@capsizecss/vanilla-extract": "^1.0.0",
"@fastify/deepmerge": "^1.3.0",
"@lukeed/uuid": "^2.0.1",
"@openchainxyz/abi-guesser": "^1.0.2",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-form": "^0.0.3",
"@radix-ui/react-polymorphic": "^0.0.14",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@shazow/whatsabi": "^0.8.2",
"@tanstack/query-async-storage-persister": "5.0.0-alpha.42",
"@tanstack/react-query": "5.0.0-alpha.42",
"@tanstack/react-query-persist-client": "5.0.0-alpha.42",
Expand All @@ -41,8 +47,10 @@
"@vanilla-extract/css-utils": "^0.1.3",
"@vanilla-extract/dynamic": "^2.0.3",
"@vanilla-extract/sprinkles": "^1.6.0",
"abitype": "^0.9.8",
"chroma-js": "^2.4.2",
"clsx": "^1.2.1",
"ethers": "^6.7.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need ethers until @openchainxyz/abi-guesser is rewritten/migrated to viem 😅

"eventemitter3": "^5.0.1",
"human-id": "^4.0.0",
"mipd": "^0.0.5",
Expand Down Expand Up @@ -74,6 +82,7 @@
"@vitejs/plugin-react": "^4.0.0-beta.0",
"bun-types": "^1.0.1",
"cross-env": "^7.0.3",
"globby": "^13.2.2",
"opentype.js": "^1.3.4",
"patch-package": "^8.0.0",
"rimraf": "^5.0.1",
Expand Down
Binary file added public/fonts/SFMono-Medium.woff2
Binary file not shown.
Binary file added public/fonts/SFMono-Regular.woff2
Binary file not shown.
Binary file added public/fonts/SFMono-Semibold.woff2
Binary file not shown.
31 changes: 31 additions & 0 deletions scripts/deploy-contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { join } from 'node:path'
import { globby } from 'globby'
;(async () => {
const rpcUrl = process.argv[2] || 'http://127.0.0.1:8545'
const privateKey =
process.argv[3] ||
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' // anvil private key before you ask

const contractsPaths = await globby(
join(__dirname, '../test/contracts/src/**/*.sol'),
)

contractsPaths.forEach((contractPath) => {
const contract = contractPath.split('/')
const contractName = contract[contract.length - 1].replace('.sol', '')
console.log('Deploying: ', contractName)
Bun.spawnSync(
[
'forge',
'create',
'--rpc-url',
rpcUrl,
'--private-key',
privateKey,
`${contractPath}:${contractName}`,
],
{ stdout: 'inherit' },
)
})
console.log('Deployed contracts.')
})()
28 changes: 28 additions & 0 deletions scripts/generate-typed-artifacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { join } from 'node:path'
import { globby } from 'globby'

const generatedPath = join(import.meta.dir, '../test/contracts/generated.ts')
Bun.write(generatedPath, '')

const generated = Bun.file(generatedPath)
const writer = generated.writer()

const paths = await globby([
join(import.meta.dir, '../test/contracts/out/**/*.json'),
])

await Promise.all(
paths.map(async (path) => {
const fileName = path.split('/').pop()?.replace('.json', '')
const json = await Bun.file(path, { type: 'application/json' }).json()
writer.write(
`export const ${fileName} = ${JSON.stringify(
json,
null,
2,
)} as const;\n\n`,
)
}),
)

writer.end()
11 changes: 9 additions & 2 deletions src/components/LabelledContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ import type { ReactNode } from 'react'
import { Box, Stack, Text } from '~/design-system'

import type { StackProps } from '../design-system/components/Stack'
import type { TextStyles } from '../design-system/components/Text.css'

export function LabelledContent({
children,
label,
labelColor = 'text/tertiary',
width,
}: { children: ReactNode; label: string; width?: StackProps['width'] }) {
}: {
children: ReactNode
label: string
labelColor?: TextStyles['color']
width?: StackProps['width']
}) {
return (
<Stack gap="8px" width={width}>
<Text color="text/tertiary" size="9px" wrap={false}>
<Text color={labelColor} size="9px" wrap={false}>
{label.toUpperCase()}
</Text>
<Box>{children}</Box>
Expand Down
12 changes: 6 additions & 6 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import { Box, Text } from '~/design-system'

export type TooltipProps = {
children: ReactNode
enabled?: boolean
label: string | ReactNode
side?: 'top' | 'bottom' | 'left' | 'right'
}

export function Tooltip({ children, label }: TooltipProps) {
export function Tooltip({ children, enabled, label, side }: TooltipProps) {
return (
<Provider>
<Root delayDuration={300}>
<Root delayDuration={300} open={enabled === false ? false : undefined}>
<Trigger asChild>
<Box testId="haha" tabIndex={0}>
{children}
</Box>
<Box>{children}</Box>
</Trigger>
<Portal>
<Content asChild side="bottom" sideOffset={8}>
<Content asChild side={side} sideOffset={8}>
<Box
backgroundColor="surface/secondary/elevated"
borderWidth="1px"
Expand Down
Loading