Skip to content

Commit

Permalink
Fix delegation (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangoree authored Jun 24, 2024
1 parent 0e5b59d commit 726dfcb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions apps/council-ui/src/ui/vaults/ChangeDelegateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useDisplayName } from "src/ui/base/formatting/useDisplayName";
import { Input } from "src/ui/base/forms/Input";
import { VoterAddress } from "src/ui/voters/VoterAddress";
import { zeroAddress } from "viem";
import { normalize } from "viem/ens";
import { useEnsResolver } from "wagmi";

interface ChangeDelegateFormProps {
Expand All @@ -24,11 +25,16 @@ export function ChangeDelegateForm({
const isDelegateZeroAddress = currentDelegate === zeroAddress;

const [newDelegate, setNewDelegate] = useState<string>("");
const { data: newDelegateAddress } = useEnsResolver({
name: newDelegate,
const { data: resolvedEnsAddress } = useEnsResolver({
name: normalize(newDelegate),
});
const isNotNew = newDelegate === currentDelegate;

const newDelegateAddress =
resolvedEnsAddress && resolvedEnsAddress !== zeroAddress
? resolvedEnsAddress
: (newDelegate as `0x${string}`);

return (
<div className="daisy-card flex h-fit basis-1/2 flex-col gap-y-4 bg-base-200 p-4">
<div className="text-2xl font-bold">Change Delegate</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/council-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"ajv": "^8.12.0",
"cfonts": "^3.2.0",
"cli-table": "^0.3.11",
"clide-js": "^0.1.3",
"clide-js": "^0.1.5",
"clide-plugin-command-menu": "^0.0.7",
"colors": "^1.4.0",
"dotenv": "^16.4.5",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4217,10 +4217,10 @@ cli-truncate@^4.0.0:
slice-ansi "^5.0.0"
string-width "^7.0.0"

clide-js@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/clide-js/-/clide-js-0.1.3.tgz#6f500578d453714c8e51f32acd59ddc743e5e3c0"
integrity sha512-D8qIBdg4ZwD+zsoliDc079h1Dm0hIf1219jppPZeINmG/qIoi5CZCJVA7ToHIf74h4oVON5IEObszFd0pG5XPg==
clide-js@^0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/clide-js/-/clide-js-0.1.5.tgz#e884b6536e5972969f1ddd2d0fb0b21ab47856ee"
integrity sha512-BP//lZ6kSHNfRkPKP5rN+qfy6GP3acYbWV8JJYXXgjENKGnIyvYy3COZn47Gqm7TchRWCilA9Ph7tTG1x6fJ+w==
dependencies:
cliui "^8.0.1"
prompts "^2.4.2"
Expand Down

0 comments on commit 726dfcb

Please sign in to comment.