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
130 changes: 0 additions & 130 deletions kinode/src/register-ui/build/assets/index-2wTC9S_W.js

This file was deleted.

135 changes: 135 additions & 0 deletions kinode/src/register-ui/build/assets/index-KlEDwcBC.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kinode/src/register-ui/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" />
<script type="module" crossorigin src="/assets/index-2wTC9S_W.js"></script>
<script type="module" crossorigin src="/assets/index-KlEDwcBC.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B00cPdAQ.css">
</head>

Expand Down
6 changes: 4 additions & 2 deletions kinode/src/register-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"proxy": "http://localhost:8080",
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@ensdomains/eth-ens-namehash": "^2.0.15",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@ethersproject/hash": "^5.7.0",
"@typechain/ethers-v5": "^11.1.1",
"@types/node": "^16.18.50",
Expand All @@ -25,11 +27,11 @@
"buffer": "^6.0.3",
"classnames": "^2.5.1",
"eslint-config-react-app": "^7.0.1",
"eth-ens-namehash": "^2.0.8",
"ethers": "^5.7.2",
"idna-uts46-hx": "^6.0.4",
"is-valid-domain": "^0.1.6",
"jazzicon": "^1.5.0",
"punycode": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
Expand Down Expand Up @@ -76,4 +78,4 @@
"inline-source-cli": "^2.0.0"
},
"type": "module"
}
}
2 changes: 1 addition & 1 deletion kinode/src/register-ui/src/components/EnterEthName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useRef } from "react";
import { hooks } from "../connectors/metamask";
import { NameWrapper, ENSRegistry } from "../abis/types";
import isValidDomain from 'is-valid-domain'
import { hash } from 'eth-ens-namehash'
import { hash } from '@ensdomains/eth-ens-namehash';
import { toAscii } from 'idna-uts46-hx'

const {
Expand Down
15 changes: 9 additions & 6 deletions kinode/src/register-ui/src/components/EnterKnsName.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef } from "react";
import { DotOsRegistrar } from "../abis/types";
import isValidDomain from "is-valid-domain";
import { hash } from "eth-ens-namehash";
import hash from "@ensdomains/eth-ens-namehash";
import { toAscii } from "idna-uts46-hx";

type ClaimOsNameProps = {
Expand Down Expand Up @@ -46,7 +46,7 @@ function EnterKnsName({
if (index === -1) validities.push(NAME_LENGTH);
} else if (index !== -1) validities.splice(index, 1);

let normalized: string;
let normalized = ''
index = validities.indexOf(NAME_INVALID_PUNY);
try {
normalized = toAscii(name + ".os");
Expand All @@ -56,18 +56,21 @@ function EnterKnsName({
}

// only check if name is valid punycode
if (normalized! !== undefined) {
if (normalized && normalized !== '.os') {
index = validities.indexOf(NAME_URL);
if (name !== "" && !isValidDomain(normalized)) {
if (index === -1) validities.push(NAME_URL);
} else if (index !== -1) validities.splice(index, 1);

index = validities.indexOf(NAME_CLAIMED);
if (validities.length === 0 || index !== -1) {

if (validities.length === 0 || index !== -1 && normalized.length > 2) {
try {
await dotOs?.ownerOf(hash(normalized));
if (index === -1) validities.push(NAME_CLAIMED);
const namehash = hash.hash(normalized)
const owner = await dotOs?.ownerOf(namehash);
if (owner && index === -1) validities.push(NAME_CLAIMED);
} catch (e) {
console.error({ e })
if (index !== -1) validities.splice(index, 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion kinode/src/register-ui/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module 'eth-ens-namehash' {
declare module '@ensdomains/eth-ens-namehash' {
export function hash(name: string): string;
export function normalize(name: string): string;
}
Expand Down
3 changes: 3 additions & 0 deletions kinode/src/register-ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import '@unocss/reset/tailwind.css'
import 'uno.css'
import './index.css';

import { Buffer } from 'buffer';
window.Buffer = Buffer;

const connectors: [MetaMask, Web3ReactHooks][] = [
[metaMask, metaMaskHooks],
]
Expand Down
2 changes: 1 addition & 1 deletion kinode/src/register-ui/src/pages/RegisterEthName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import KinodeHeader from "../components/KnsHeader";
import { NetworkingInfo, PageProps } from "../lib/types";
import { ipToNumber } from "../utils/ipToNumber";
import { getNetworkName, setChain } from "../utils/chain";
import { hash } from "eth-ens-namehash";
import { hash } from "@ensdomains/eth-ens-namehash";
import DirectCheckbox from "../components/DirectCheckbox";
import { MAINNET_OPT_HEX, OPTIMISM_OPT_HEX } from "../constants/chainId";
import { KinodeTitle } from "../components/KinodeTitle";
Expand Down
2 changes: 1 addition & 1 deletion kinode/src/register-ui/src/pages/ResetKnsName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { hooks } from "../connectors/metamask";
import { useNavigate } from "react-router-dom";
import { namehash } from "ethers/lib/utils";
import { toAscii } from "idna-uts46-hx";
import { hash } from "eth-ens-namehash";
import { hash } from "@ensdomains/eth-ens-namehash";
import isValidDomain from "is-valid-domain";
import Loader from "../components/Loader";
import KinodeHeader from "../components/KnsHeader";
Expand Down
4 changes: 4 additions & 0 deletions kinode/src/register-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import UnoCSS from '@unocss/vite'
import { presetUno, presetWind, presetIcons, transformerDirectives } from 'unocss'
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';

export default defineConfig({
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true
}),
UnoCSS({
presets: [presetUno(), presetWind(), presetIcons()],
shortcuts: [
Expand Down
35 changes: 10 additions & 25 deletions kinode/src/register-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,16 @@
"@babel/helper-validator-identifier" "^7.24.5"
to-fast-properties "^2.0.0"

"@ensdomains/eth-ens-namehash@^2.0.15":
version "2.0.15"
resolved "https://registry.yarnpkg.com/@ensdomains/eth-ens-namehash/-/eth-ens-namehash-2.0.15.tgz#5e5f2f24ba802aff8bc19edd822c9a11200cdf4a"
integrity sha512-JRDFP6+Hczb1E0/HhIg0PONgBYasfGfDheujmfxaZaAv/NAH4jE6Kf48WbqfRZdxt4IZI3jl3Ri7sZ1nP09lgw==

"@esbuild-plugins/node-globals-polyfill@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz#0e4497a2b53c9e9485e149bc92ddb228438d6bcf"
integrity sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==

"@esbuild/aix-ppc64@0.20.2":
version "0.20.2"
resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537"
Expand Down Expand Up @@ -4830,14 +4840,6 @@ esutils@^2.0.2:
resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==

eth-ens-namehash@^2.0.8:
version "2.0.8"
resolved "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz"
integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==
dependencies:
idna-uts46-hx "^2.3.1"
js-sha3 "^0.5.7"

ethers@^5.7.2:
version "5.7.2"
resolved "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz"
Expand Down Expand Up @@ -5311,13 +5313,6 @@ idb-keyval@^6.2.1:
resolved "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz"
integrity sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==

idna-uts46-hx@^2.3.1:
version "2.3.1"
resolved "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz"
integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==
dependencies:
punycode "2.1.0"

idna-uts46-hx@^6.0.4:
version "6.0.4"
resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-6.0.4.tgz#25f9f8af628bd4150b36340e99a1f9532c815905"
Expand Down Expand Up @@ -5686,11 +5681,6 @@ js-sha3@0.8.0, js-sha3@^0.8.0:
resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz"
integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==

js-sha3@^0.5.7:
version "0.5.7"
resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz"
integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
Expand Down Expand Up @@ -6603,11 +6593,6 @@ proxy-compare@2.5.1:
resolved "https://registry.npmjs.org/proxy-compare/-/proxy-compare-2.5.1.tgz"
integrity sha512-oyfc0Tx87Cpwva5ZXezSp5V9vht1c7dZBhvuV/y3ctkgMVUmiAGDVeeB0dKhGSyT0v1ZTEQYpe/RXlBVBNuCLA==

punycode@2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz"
integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==

punycode@^2.1.1, punycode@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
Expand Down