mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-03 06:11:01 +03:00
add buffer polyfill to fix name claim checks
This commit is contained in:
parent
912e96c86c
commit
e582db8f0f
File diff suppressed because one or more lines are too long
135
kinode/src/register-ui/build/assets/index-KlEDwcBC.js
Normal file
135
kinode/src/register-ui/build/assets/index-KlEDwcBC.js
Normal file
File diff suppressed because one or more lines are too long
@ -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>
|
||||
|
||||
|
@ -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",
|
||||
@ -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",
|
||||
@ -76,4 +78,4 @@
|
||||
"inline-source-cli": "^2.0.0"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 = {
|
||||
@ -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");
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
2
kinode/src/register-ui/src/declarations.d.ts
vendored
2
kinode/src/register-ui/src/declarations.d.ts
vendored
@ -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;
|
||||
}
|
||||
|
@ -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],
|
||||
]
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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: [
|
||||
|
@ -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"
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user