Skip to content

Add support to visually represent addresses and hashes with 'blo' #44

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

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d7d58ea
add support to visually represent hashes to ease hash comparison.
Archethect Feb 27, 2025
4286c0c
update package-lock
Archethect Feb 27, 2025
04b5d6c
sync head
Archethect Mar 26, 2025
045a1f8
add blo support for addresses and hashes
Archethect Mar 26, 2025
a88dfde
use single quotes
Archethect Mar 26, 2025
258c9b6
remove hash avatars + change pixel size to 20
Archethect Mar 26, 2025
6f0555e
change hexValue to address
Archethect Mar 27, 2025
fc0032a
change hexValue to address on PixelAvatar uses
Archethect Mar 27, 2025
5336509
Merge branch 'main' into main
ferrabled May 6, 2025
1b3d4fe
sign commit
Archethect May 6, 2025
45590fc
add support to visually represent hashes to ease hash comparison.
Archethect Feb 27, 2025
3350385
update package-lock
Archethect Feb 27, 2025
324e8ce
Update README.md
juan-dawson-neufeld Mar 3, 2025
6094290
add new workflows and remove unused one
josepchetrit12 Mar 3, 2025
9ef2c45
convert repo name to lowercase
josepchetrit12 Mar 3, 2025
86a65bb
chore: Add deploy step to ecs after release
tirumerla Mar 4, 2025
082af3b
revisit ui and add ga
xaler5 Mar 3, 2025
a5bce24
update disclaimer
xaler5 Mar 3, 2025
e2a5611
address feedback
xaler5 Mar 3, 2025
e7db071
add decoding, foldable items
xaler5 Mar 4, 2025
f000bf9
fix address parsing
xaler5 Mar 4, 2025
75aa3a6
fix tables length
josepchetrit12 Mar 4, 2025
001a3c8
Rename Optimism (#15)
ericglau Mar 5, 2025
7d3e21f
UI tooltips (#20)
josepchetrit12 Mar 5, 2025
81c1a8a
fix build (#21)
josepchetrit12 Mar 5, 2025
5968bcf
fix api issue (#22)
josepchetrit12 Mar 7, 2025
66f3687
Add openzeppelin navbar (#23)
josepchetrit12 Mar 10, 2025
9900298
fix issue with address input (#24)
josepchetrit12 Mar 10, 2025
fdca7b9
Fix encode data in api method (#25)
josepchetrit12 Mar 10, 2025
9051c4f
Add subtitle (#26)
xaler5 Mar 11, 2025
fe658fb
Add thumbnail (#28)
josepchetrit12 Mar 12, 2025
c1693a1
feat: Add attestations and github environment gate (#27)
tirumerla Mar 12, 2025
b456c66
add the metadata base (#30)
josepchetrit12 Mar 12, 2025
dca1222
Move image to public folder (#31)
josepchetrit12 Mar 13, 2025
5fce4e2
add request audit button (#32)
josepchetrit12 Mar 18, 2025
7b9f3db
Bump axios from 1.8.1 to 1.8.2 in /app (#35)
dependabot[bot] Mar 18, 2025
0387a2e
Improve Result output (#36)
josepchetrit12 Mar 19, 2025
78ac40f
Fetch safe version in api (#37)
josepchetrit12 Mar 20, 2025
549ee1e
update the packages (#38)
josepchetrit12 Mar 22, 2025
8913394
add more networks (#40)
josepchetrit12 Mar 25, 2025
c5b285c
fix: PR Sign Comment (#42)
tirumerla Mar 25, 2025
8995e1c
fix: Condition messaging (#43)
tirumerla Mar 26, 2025
1508d76
add blo support for addresses and hashes
Archethect Mar 26, 2025
79d92dc
use single quotes
Archethect Mar 26, 2025
9f06c4a
remove hash avatars + change pixel size to 20
Archethect Mar 26, 2025
91fd2a2
change hexValue to address
Archethect Mar 27, 2025
2bc56f4
change hexValue to address on PixelAvatar uses
Archethect Mar 27, 2025
78ba14b
fix: Use aws credentials actions (#45)
tirumerla Mar 27, 2025
6d87946
Bump next from 14.2.25 to 14.2.26 in /app (#49)
dependabot[bot] Apr 24, 2025
1eb1b6f
Fix #41 change hash ordering (#48)
engn33r Apr 24, 2025
67fe849
sign commit
Archethect May 6, 2025
8e0af32
Merge branch 'main' of github.com:Archethect/safe-utils
Archethect May 7, 2025
5cba054
remove blockies from package lock
Archethect May 7, 2025
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
42 changes: 11 additions & 31 deletions app/components/pixel-avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
import React, { useMemo } from 'react';
import {blo} from 'blo';

interface PixelAvatarProps {
address: string;
size?: number;
}

const PixelAvatar: React.FC<PixelAvatarProps> = ({ address, size = 20 }) => {
const generateColor = () => {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
return `rgb(${r},${g},${b})`;
};

const pixels = useMemo(() => {
const seed = parseInt(address.slice(2, 10), 16);
const pixelArray = [];
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
if ((seed >> (i * 5 + j)) & 1) {
pixelArray.push(
<rect
key={`${i}-${j}`}
x={i * 4}
y={j * 4}
width="4"
height="4"
fill={generateColor()}
/>
);
}
}
const style = useMemo(() => {
const blockie = blo(address as `0x${string}`)
return {
backgroundImage: `url(${blockie})`,
backgroundSize: 'contain',
borderRadius: '50%',
width: `${size}px`,
height: `${size}px`,
}
return pixelArray;
}, [address]);
}, [address, size]);

return (
<svg width={size} height={size} viewBox="0 0 20 20">
<rect width="20" height="20" fill="#f0f0f0" />
{pixels}
</svg>
<div style={style} />
);
};

Expand Down
4 changes: 2 additions & 2 deletions app/components/result/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export default function InputField({
<div className="text-gray-500 dark:text-gray-300 text-lg">{label}</div>
{isAddress ? (
<div className="flex items-center gap-2">
<div className="flex h-5 w-5">
<div className="flex h-7.5 w-7.5">
<PixelAvatar address={value} />
</div>
<div className="text-md break-all mt-1">
<div className="text-md break-all">
{value}
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions app/components/transaction/AdvancedParamsStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { Input } from "@/components/ui/input";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@radix-ui/react-tooltip";
import { HelpCircle } from "lucide-react";
import PixelAvatar from "@/components/pixel-avatar";

interface AdvancedParamsStepProps {
form: UseFormReturn<FormData>;
Expand Down Expand Up @@ -89,7 +90,7 @@ export default function AdvancedParamsStep({ form }: AdvancedParamsStepProps) {
<FormItem>
<FormLabel>Gas token</FormLabel>
<FormControl>
<Input placeholder="Enter gasToken address" {...field} />
<Input placeholder="Enter gasToken address" leftIcon={<PixelAvatar address={field.value} />} {...field} />
</FormControl>
</FormItem>
)}
Expand All @@ -102,7 +103,7 @@ export default function AdvancedParamsStep({ form }: AdvancedParamsStepProps) {
<FormItem>
<FormLabel>Refund receiver</FormLabel>
<FormControl>
<Input placeholder="Enter refundReceiver address" {...field} />
<Input placeholder="Enter refundReceiver address" leftIcon={<PixelAvatar address={field.value} />} {...field} />
</FormControl>
</FormItem>
)}
Expand Down
13 changes: 10 additions & 3 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"react-dom": "^18",
"react-hook-form": "^7.53.1",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7"
"tailwindcss-animate": "^1.0.7",
"blo": "^1.1.1"
},
"devDependencies": {
"@types/node": "^20.17.19",
Expand Down