Skip to content

Commit

Permalink
feat(nameguard-react): canonical badge (#170)
Browse files Browse the repository at this point in the history
* feat: canonical badge

* refactor: canonical badge

* bump deps
  • Loading branch information
notrab authored Nov 30, 2023
1 parent 850ca37 commit 43fad09
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/nameguard-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@namehash/nameguard-react",
"version": "0.0.7",
"version": "0.0.11",
"scripts": {
"build": "tsup",
"dev": "tsup --watch --clean=false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const ConfusableListItem = ({ item }: ConfusableListItemProps) => {
</div>
<div className="md:grid md:grid-cols-7 md:gap-4 col-span-7 md:col-span-11">
<div className="md:col-span-3">
{item.is_canonical && (
<div className="mb-1.5 -mt-4 relative text-green-800 text-xs font-medium rounded-full px-2 py-0.5 bg-green-100 inline-block">
Canonical
</div>
)}
<p className="text-black text-sm font-medium">{item.grapheme_name}</p>
<p className="hidden md:inline-block text-gray-500 text-sm font-normal">
{item.grapheme_description}
Expand Down
2 changes: 0 additions & 2 deletions packages/nameguard-react/src/components/Shield/Shield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export const Shield = ({ name }: ShieldProps) => {
(n: string) => nameguard.bulkInspectNames([parseName(n).outputName.name])
);

console.log({ data });

// const [result] = data.results;
const result = data.results[0];

Expand Down
1 change: 1 addition & 0 deletions packages/nameguard-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export { useChatModalStore } from "./stores/chat";
export { useSearchStore } from "./stores/search";

export { NameBadge } from "./components/NameBadge/NameBadge";
export { NameShield } from "./components/NameShield";
export { Shield } from "./components/Shield/Shield";
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@namehash/nameguard",
"version": "0.0.12",
"version": "0.0.14",
"type": "module",
"exports": {
".": {
Expand Down
20 changes: 17 additions & 3 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ export interface ConsolidatedGraphemeGuardReport extends ConsolidatedReport {
* A user-friendly description of the grapheme type.
* */
grapheme_description: string;

/**
* The canonical status for the current grapheme.
* */
is_canonical: boolean;
}

/**
Expand Down Expand Up @@ -527,7 +532,10 @@ class NameGuard {
): Promise<SecurePrimaryNameResult> {
const network_name = options?.network || this.network;

const url = new URL(`secure-primary-name/${network_name}/${address}`, this.endpoint);
const url = new URL(
`secure-primary-name/${network_name}/${address}`,
this.endpoint
);

const response = await fetch(url);

Expand All @@ -548,7 +556,10 @@ class NameGuard {
): Promise<FakeEthNameCheckResult> {
const network_name = options?.network || this.network;

const url = new URL(`fake-eth-name-check/${network_name}/${contract_address}/${token_id}`, this.endpoint);
const url = new URL(
`fake-eth-name-check/${network_name}/${contract_address}/${token_id}`,
this.endpoint
);

const response = await fetch(url);

Expand Down Expand Up @@ -649,7 +660,10 @@ class NameGuard {

const network = options?.network || this.network;

const url = new URL(`inspect-namehash/${network}/${namehash}`, this.endpoint);
const url = new URL(
`inspect-namehash/${network}/${namehash}`,
this.endpoint
);

const response = await fetch(url);

Expand Down

0 comments on commit 43fad09

Please sign in to comment.