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(nameguard-react): canonical badge #170

Merged
merged 3 commits into from
Nov 30, 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
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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is_canoncial is not in ConsolidatedGraphemeGuardReport, we need new type: ConfusableGuardReport extends ConsolidatedGraphemeGuardReport

}

/**
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