Skip to content
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
23 changes: 20 additions & 3 deletions apps/api.nameai.io/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# NameAI

## API

The API extends the NameGuard API and is fully compatible with it.

NameAI-specific endpoints are under the `https://api.nameai.io` path prefix and
Expand All @@ -11,10 +12,13 @@ API documentation is available at [api.nameai.io/docs](https://api.nameai.io/doc
Lambda is publicly accessible under given domain [api.nameai.io](https://api.nameai.io)

## SDK

The NameAI SDK provides a convenient way to interact with the NameAI API in your JavaScript/TypeScript applications. You can find the SDK implementation and documentation at [github.com/namehash/namekit/tree/main/packages/nameai-sdk](https://github.com/namehash/namekit/tree/main/packages/nameai-sdk).

# AWS deploy

## Requirements

- Poetry - Python package management
- Docker - building image for lambda

Expand All @@ -23,9 +27,11 @@ The NameAI SDK provides a convenient way to interact with the NameAI API in your
Before you can use the `deploy_lambda.sh` script to deploy your AWS Lambda function, you need to ensure that several prerequisites are met. This section outlines the necessary steps and configurations required for a successful deployment.

### 1. AWS Account Setup

You must have an active AWS account. If you do not have one, you can create it at [AWS Free Tier](https://aws.amazon.com/free/).

### 2. AWS IAM Permissions

Ensure that the AWS user or role executing the script has the necessary permissions to interact with AWS Lambda, ECR (Elastic Container Registry), and Route 53. The following permissions are typically required:

- `lambda:*` - for managing Lambda functions.
Expand All @@ -36,6 +42,7 @@ Ensure that the AWS user or role executing the script has the necessary permissi
For detailed guidance on creating IAM policies, refer to the [AWS IAM documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html).

### 3. AWS Certificate Manager (ACM)

You need to create an AWS certificate in AWS Certificate Manager (ACM) for your Lambda function. This certificate is used for HTTPS communication. Follow these steps:

- Go to the [AWS Certificate Manager](https://console.aws.amazon.com/acm/home).
Expand All @@ -45,6 +52,7 @@ You need to create an AWS certificate in AWS Certificate Manager (ACM) for your
For more information, refer to the guide on [Requesting a Public Certificate in AWS Certificate Manager](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html).

### 4. Amazon Route 53 Setup

You must have a hosted zone created in Amazon Route 53 to manage your domain's DNS settings. Follow these steps:

- Go to the [Route 53 console](https://console.aws.amazon.com/route53/home).
Expand All @@ -53,18 +61,21 @@ You must have a hosted zone created in Amazon Route 53 to manage your domain's D
For guidance, refer to the documentation on [Creating a Hosted Zone in Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html).

### 5. Relationship Between AWS Certificate and Hosted Zone

After creating the certificate and hosted zone, you need to validate the certificate and ensure that the domain name associated with the certificate is correctly configured in the hosted zone. Follow the guides on:

- [Validating an ACM Certificate](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate.html).
- [Using Route 53 to Route Traffic to Your Resources](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-resources.html).

### 6. Docker and AWS CLI Installation

Ensure that Docker and the AWS CLI are installed and configured on your machine. Follow these steps:

- **Install Docker**: Follow the instructions on [Get Docker](https://docs.docker.com/get-docker/).
- **Install AWS CLI**: Follow the instructions on [Installing the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).

### 7. Environment Variables

You need to set up the following environment variables before running the script:

- `PROVIDER_URI_MAINNET`
Expand All @@ -77,6 +88,7 @@ You need to set up the following environment variables before running the script
These variables should be populated with the appropriate values for your application.

### 8. GitHub Secrets Configuration

If you are using GitHub Actions for deployment, you need to configure the following secrets in your GitHub repository:

- `AWS_ROLE` - The IAM role to assume for AWS actions.
Expand All @@ -91,28 +103,33 @@ If you are using GitHub Actions for deployment, you need to configure the follow
You can add these secrets in your GitHub repository settings under the "Secrets" section.

## Dockerfile

1. Uses an ARM64 Python 3.11 base image optimized for AWS Lambda
2. Installs necessary dependencies
3. Copies the project files into the image
4. Sets the entry point for the Lambda function


# Getting Started

This section is describing how to setup running NameAI instance on local environment

## Environment variables

NameAI requires certain env variables propagated for it's NameGuard subcomponent.
Those variables are defined and described in [.env.example](./.env.example) file which is a point of reference.
Script responsible for running local NameAI instance is expecting those variables to be poulated in .env file before execution.

## Requirements

python3 with pip installed on local env

## Scripts

Running [start-local.sh](./start-local.sh) script will result in creating running NameAI instance on local environment.
This instance can be reached under [localhost:8000](localhost:8000)
This instance can be reached under [localhost:8000](localhost:8000)

## Static data generation

Static data is generated by running [generate_static_data.py](./nameai/generate_static_data.py) script.
This script can be run manually with `poetry run python -m nameai.generate_static_data`.

Expand All @@ -128,4 +145,4 @@ Visit our [website](https://namehashlabs.org/) to get in contact.

Licensed under the MIT License, Copyright © 2023-present [NameHash Labs](https://namehashlabs.org).

See [LICENSE](./LICENSE) for more information.
See [LICENSE](./LICENSE) for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export default async function Page({
}) {
const { address } = params;

const data = await nameguard.getSecurePrimaryName(address, { returnNameGuardReport: true });
const data = await nameguard.getSecurePrimaryName(address, {
returnNameGuardReport: true,
});

return (
<div className="flex w-full flex-col h-screen overflow-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,31 @@ export async function SecurePrimaryName({ address }: Props) {
headers();

// This function does not use the NameGuard API server
const data = await nameguard.getSecurePrimaryName(address,
{ returnNameGuardReport: true });
const data = await nameguard.getSecurePrimaryName(address, {
returnNameGuardReport: true,
});

const pillColor =
data.impersonation_estimate === "potential" ?
"bg-red-300" :
data.impersonation_estimate === "unlikely" ?
"bg-green-300" :
"bg-yellow-300";
data.impersonation_estimate === "potential"
? "bg-red-300"
: data.impersonation_estimate === "unlikely"
? "bg-green-300"
: "bg-yellow-300";

const pillText =
data.impersonation_estimate === "potential" ?
"Potential impersonation!" :
data.impersonation_estimate === "unlikely" ?
"Name is secure" :
"No primary name!";
data.impersonation_estimate === "potential"
? "Potential impersonation!"
: data.impersonation_estimate === "unlikely"
? "Name is secure"
: "No primary name!";

return (
<div className="flex flex-col items-start flex-1 overflow-hidden">
<div className="text-xs">
{data.display_name}
</div>
<div className="text-xs">{data.display_name}</div>

<div className="self-stretch truncate">
{address}
</div>
<div className="self-stretch truncate">{address}</div>

<div className={"text-xs rounded-full px-2 " + pillColor}>
{pillText}
</div>
<div className={"text-xs rounded-full px-2 " + pillColor}>{pillText}</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export function SecurePrimaryNameLoading({ address }: Props) {
<div className="flex flex-col items-start flex-1 overflow-hidden">
<div className="rounded-full bg-gradient-to-r from-gray-300 to-gray-200 animate-pulse h-4 w-16" />

<div className="self-stretch truncate">
{address}
</div>
<div className="self-stretch truncate">{address}</div>

<div className="rounded-full bg-gradient-to-r from-gray-300 to-gray-200 animate-pulse h-4 w-32" />
</div>
Expand Down
31 changes: 0 additions & 31 deletions apps/nameai.io/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,6 @@ export default function Page() {
<>
<div className="w-full">
<div className="w-screen h-[calc(100vh-65px)] pt-1 bg-white overflow-hidden relative">
{/* Integration Example Panel */}
<div className="w-full px-4 sm:px-5 absolute z-20 left-1/2 -translate-x-1/2 top-5 sm:bottom-[20%] max-w-[1216px] mx-auto">
<div className="w-full bg-black flex-col sm:flex-row gap-6 sm:gap-4 rounded-lg p-6 sm:px-8 sm:py-4 flex items-center justify-between">
<div className="flex items-center gap-4 w-full sm:w-auto">
<div className="p-3 sm:p-4 rounded-full bg-gray-700 shrink-0">
<BoltIcon className="w-5 h-5 text-white" />
</div>

<div className="flex flex-col min-w-0">
<span className="text-white text-base font-semibold truncate">
Example ENS ecosystem integration
</span>
<span className="text-gray-400 text-sm">
Powering VisionScore
</span>
</div>
</div>
<Button
variant="secondary"
className="w-full sm:w-auto items-center justify-center text-center"
asChild
>
<NextLink
target="_blank"
href="https://docs.vision.io/profile-features/vision-score-beta"
>
About VisionScore
</NextLink>
</Button>
</div>
</div>
<div
className="w-screen h-[calc(100vh-65px)] absolute top-0 left-0 z-10"
style={{
Expand Down
2 changes: 1 addition & 1 deletion apps/nameai.io/components/service-provider-badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const ServiceProviderBadge = (
props: React.HTMLAttributes<HTMLDivElement>
props: React.HTMLAttributes<HTMLDivElement>,
) => {
return (
<svg
Expand Down
3 changes: 0 additions & 3 deletions apps/namegraph.dev/app/name/[name]/name-details-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import Skeleton from "@/components/skeleton";
import { analyzeLabel } from "@/components/name-ai/actions";
import { NLPLabelAnalysis } from "@namehash/nameai";
import { EnsOutlineIcon } from "@/components/nft-avatar/ens-outline-icon";
import { EnsVisionIcon } from "@/components/name/vision-icon";
import { OtherCategories } from "@/components/collections/other-categories";

export const NameDetailsPage = ({ name }: { name: string }) => {
Expand Down Expand Up @@ -758,8 +757,6 @@ const getIconForExternalLinkHost = (host: ExternalLinkHosts): JSX.Element => {
switch (host) {
case ExternalLinkHosts.ENSDomains:
return <EnsOutlineIcon className="w-8 h-8 hover:scale-110 transition" />;
case ExternalLinkHosts.Vision:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We want to replace the link to Vision with a link (and icon) for OpenSea instead.

return <EnsVisionIcon className="w-16 h-16 hover:scale-110 transition" />;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please:

  1. Also remove this EnsVisionIcon component.
  2. Search all our files (both file names and file contents) for "vision" or "Vision" or etc.. to find anything else we missed.

default:
return <></>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export const CollectionCard = ({
className="ml-3 flex justify-center items-center rounded-md bg-background h-[72px] w-[72px] bg-gray-100"
>
<div className="relative flex items-center justify-center overflow-hidden">
<p className={`text-3xl ${notoBlack.className}`}>{collection.avatar_emoji}</p>
<p className={`text-3xl ${notoBlack.className}`}>
{collection.avatar_emoji}
</p>
</div>
</div>
<div className="flex-1 overflow-hidden flex flex-col items-start">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const ServiceProviderBadge = (
props: React.HTMLAttributes<HTMLDivElement>
props: React.HTMLAttributes<HTMLDivElement>,
) => {
return (
<svg
Expand Down
33 changes: 0 additions & 33 deletions apps/namegraph.dev/components/homepage/homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,39 +116,6 @@ export const HomePage = () => {
<HeroStartCommand />
</div>
</div>
{/* Integration Example Panel */}
<div className="w-full z-20 mx-auto mt-10 mb-2 px-4 sm:px-0">
<div className="w-full bg-black max-w-5xl mx-auto flex-col sm:flex-row gap-6 sm:gap-4 rounded-lg p-6 sm:px-8 sm:py-4 flex items-center justify-between">
<div className="flex items-center gap-4 w-full sm:w-auto">
<div className="p-3 sm:p-4 rounded-full bg-gray-700 shrink-0">
<BoltIcon className="w-5 h-5 text-white" />
</div>

<div className="flex flex-col min-w-0">
<span className="text-white text-base font-semibold">
<Balancer>Example ENS ecosystem integration</Balancer>
</span>
<span className="text-gray-400 text-sm">
<Balancer>
powering related name suggestions at Vision{" "}
</Balancer>
</span>
</div>
</div>
<Button
variant="secondary"
className="w-full items-center justify-center sm:w-auto text-center"
asChild
>
<NextLink
target="_blank"
href="https://x.com/ensvision/status/1902711055802933619"
>
Learn more
</NextLink>
</Button>
</div>
</div>

<div className="max-w-[1216px] mx-auto flex flex-col items-center justify-start bg-gray-50 rounded-xl p-10 mt-10 w-full">
<div className="flex flex-col items-center justify-center gap-3">
Expand Down
Loading
Loading