diff --git a/css/kinode.css b/css/kinode.css
index d2370582a..c1911dd44 100644
--- a/css/kinode.css
+++ b/css/kinode.css
@@ -20,7 +20,7 @@ input,
button,
textarea,
select {
- font: inherit;
+ font-family: var(--font-family-main);
}
/* Variables */
@@ -38,6 +38,8 @@ select {
--maroon: #4f0000;
--gray: #657b83;
--tasteful-dark: #1f1f1f;
+
+ --font-family-main: 'Kode Mono', monospace;
}
/* Typography */
@@ -49,10 +51,16 @@ h5,
h6,
p,
label,
-li {
+li,
+span {
+ font-family: var(--font-family-main);
color: light-dark(var(--off-black), var(--off-white));
}
+p {
+ font-size: 0.8em;
+}
+
h1 {
font-size: 2em;
}
@@ -78,6 +86,7 @@ h6 {
}
a {
+ font-family: var(--font-family-main);
color: light-dark(var(--blue), var(--orange));
text-decoration: none;
}
@@ -89,7 +98,6 @@ a:hover {
/* Layout */
body {
- font-family: var(--font-family-main, sans-serif);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
background-color: light-dark(var(--tan), var(--tasteful-dark));
@@ -162,7 +170,7 @@ button:disabled {
}
button.secondary {
- background-color: white;
+ background-color: light-dark(var(--off-white), var(--off-black));
color: var(--orange);
border: 2px solid var(--orange);
}
diff --git a/kinode/packages/app_store/ui/src/abis/helpers.ts b/kinode/packages/app_store/ui/src/abis/helpers.ts
index 099227f2f..9917108e6 100644
--- a/kinode/packages/app_store/ui/src/abis/helpers.ts
+++ b/kinode/packages/app_store/ui/src/abis/helpers.ts
@@ -1,9 +1,9 @@
-import { multicallAbi, kinomapAbi, mechAbi, KINOMAP, MULTICALL, KINO_ACCOUNT_IMPL } from "./";
+import { multicallAbi, kimapAbi, mechAbi, KIMAP, MULTICALL, KINO_ACCOUNT_IMPL } from "./";
import { encodeFunctionData, encodePacked, stringToHex } from "viem";
export function encodeMulticalls(metadataUri: string, metadataHash: string) {
const metadataHashCall = encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~metadata-hash")]),
@@ -12,7 +12,7 @@ export function encodeMulticalls(metadataUri: string, metadataHash: string) {
})
const metadataUriCall = encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~metadata-uri")]),
@@ -21,8 +21,8 @@ export function encodeMulticalls(metadataUri: string, metadataHash: string) {
})
const calls = [
- { target: KINOMAP, callData: metadataHashCall },
- { target: KINOMAP, callData: metadataUriCall },
+ { target: KIMAP, callData: metadataHashCall },
+ { target: KIMAP, callData: metadataUriCall },
];
const multicall = encodeFunctionData({
@@ -46,7 +46,7 @@ export function encodeIntoMintCall(multicalls: `0x${string}`, our_address: `0x${
});
const mintCall = encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'mint',
args: [
our_address,
diff --git a/kinode/packages/app_store/ui/src/abis/index.ts b/kinode/packages/app_store/ui/src/abis/index.ts
index 9bab299de..d54a900f5 100644
--- a/kinode/packages/app_store/ui/src/abis/index.ts
+++ b/kinode/packages/app_store/ui/src/abis/index.ts
@@ -2,7 +2,7 @@ import { parseAbi } from "viem";
export { encodeMulticalls, encodeIntoMintCall } from "./helpers";
-export const KINOMAP: `0x${string}` = "0xAfA2e57D3cBA08169b416457C14eBA2D6021c4b5";
+export const KIMAP: `0x${string}` = "0xAfA2e57D3cBA08169b416457C14eBA2D6021c4b5";
export const MULTICALL: `0x${string}` = "0xcA11bde05977b3631167028862bE2a173976CA11";
export const KINO_ACCOUNT_IMPL: `0x${string}` = "0xd30217e86A4910f4D7cB3E73fC3CfD28a2C33e4e";
@@ -12,7 +12,7 @@ export const multicallAbi = parseAbi([
`struct Call { address target; bytes callData; }`,
]);
-export const kinomapAbi = parseAbi([
+export const kimapAbi = parseAbi([
"function mint(address, bytes calldata, bytes calldata, bytes calldata, address) external returns (address tba)",
"function note(bytes calldata,bytes calldata) external returns (bytes32)",
"function get(bytes32 node) external view returns (address tokenBoundAccount, address tokenOwner, bytes memory note)",
diff --git a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx
index 16bf642e6..57fa0a05d 100644
--- a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx
+++ b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx
@@ -3,7 +3,7 @@ import { useLocation } from "react-router-dom";
import { useAccount, useWriteContract, useWaitForTransactionReceipt, usePublicClient } from 'wagmi'
import { ConnectButton, useConnectModal } from '@rainbow-me/rainbowkit';
import { keccak256, toBytes } from 'viem';
-import { mechAbi, KINOMAP, encodeIntoMintCall, encodeMulticalls, kinomapAbi, MULTICALL } from "../abis";
+import { mechAbi, KIMAP, encodeIntoMintCall, encodeMulticalls, kimapAbi, MULTICALL } from "../abis";
import { kinohash } from '../utils/kinohash';
import useAppsStore from "../store";
import { AppInfo } from "../types/Apps";
@@ -71,8 +71,8 @@ export default function PublishPage() {
try {
// Check if the package already exists and get its TBA
let data = await publicClient.readContract({
- abi: kinomapAbi,
- address: KINOMAP,
+ abi: kimapAbi,
+ address: KIMAP,
functionName: 'get',
args: [kinohash(`${packageName}.${publisherId}`)]
});
@@ -84,8 +84,8 @@ export default function PublishPage() {
// If the package doesn't exist, check for the publisher's TBA
if (!currentTBA) {
data = await publicClient.readContract({
- abi: kinomapAbi,
- address: KINOMAP,
+ abi: kimapAbi,
+ address: KIMAP,
functionName: 'get',
args: [kinohash(publisherId)]
});
@@ -108,10 +108,10 @@ export default function PublishPage() {
writeContract({
abi: mechAbi,
- address: currentTBA || KINOMAP,
+ address: currentTBA || KIMAP,
functionName: 'execute',
args: [
- isUpdate ? MULTICALL : KINOMAP,
+ isUpdate ? MULTICALL : KIMAP,
BigInt(0),
args,
isUpdate ? 1 : 0
@@ -141,8 +141,8 @@ export default function PublishPage() {
}
const data = await publicClient.readContract({
- abi: kinomapAbi,
- address: KINOMAP,
+ abi: kimapAbi,
+ address: KIMAP,
functionName: 'get',
args: [kinohash(`${packageName}.${publisherName}`)]
});
@@ -161,7 +161,7 @@ export default function PublishPage() {
address: tba as `0x${string}`,
functionName: 'execute',
args: [
- KINOMAP,
+ KIMAP,
BigInt(0),
multicall,
1
diff --git a/kinode/src/http/login.html b/kinode/src/http/login.html
index 9a5ff601e..0e5481b54 100644
--- a/kinode/src/http/login.html
+++ b/kinode/src/http/login.html
@@ -143,7 +143,7 @@
oninput="document.getElementById('password-err').style.display = 'none';" value="" class="self-stretch mb-2">
Incorrect Password
@@ -156,20 +156,27 @@ Logging in...
diff --git a/kinode/src/register-ui/index.html b/kinode/src/register-ui/index.html
index ad784d8a0..c31db166e 100644
--- a/kinode/src/register-ui/index.html
+++ b/kinode/src/register-ui/index.html
@@ -11,6 +11,7 @@
+
diff --git a/kinode/src/register-ui/src/abis/helpers.ts b/kinode/src/register-ui/src/abis/helpers.ts
index 7846b29b9..f96fdc965 100644
--- a/kinode/src/register-ui/src/abis/helpers.ts
+++ b/kinode/src/register-ui/src/abis/helpers.ts
@@ -2,7 +2,7 @@
import { NetworkingInfo } from "../lib/types";
import { kinohash } from "../utils/kinohash";
import { ipToBytes, portToBytes } from "../utils/kns_encoding";
-import { multicallAbi, kinomapAbi, mechAbi, KINOMAP, MULTICALL } from "./";
+import { multicallAbi, kimapAbi, mechAbi, KIMAP, MULTICALL } from "./";
import { encodeFunctionData, encodePacked, stringToHex, bytesToHex } from "viem";
// Function to encode router names into keccak256 hashes
@@ -58,7 +58,7 @@ export const generateNetworkingKeys = async ({
console.log("networking_key: ", networking_key);
const netkeycall = encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~net-key")]),
@@ -68,7 +68,7 @@ export const generateNetworkingKeys = async ({
const ws_port_call =
encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~ws-port")]),
@@ -78,7 +78,7 @@ export const generateNetworkingKeys = async ({
const tcp_port_call =
encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~tcp-port")]),
@@ -88,7 +88,7 @@ export const generateNetworkingKeys = async ({
const ip_address_call =
encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~ip")]),
@@ -100,7 +100,7 @@ export const generateNetworkingKeys = async ({
const router_call =
encodeFunctionData({
- abi: kinomapAbi,
+ abi: kimapAbi,
functionName: 'note',
args: [
encodePacked(["bytes"], [stringToHex("~routers")]),
@@ -111,13 +111,13 @@ export const generateNetworkingKeys = async ({
});
const calls = direct ? [
- { target: KINOMAP, callData: netkeycall },
- { target: KINOMAP, callData: ws_port_call },
- { target: KINOMAP, callData: tcp_port_call },
- { target: KINOMAP, callData: ip_address_call },
+ { target: KIMAP, callData: netkeycall },
+ { target: KIMAP, callData: ws_port_call },
+ { target: KIMAP, callData: tcp_port_call },
+ { target: KIMAP, callData: ip_address_call },
] : [
- { target: KINOMAP, callData: netkeycall },
- { target: KINOMAP, callData: router_call },
+ { target: KIMAP, callData: netkeycall },
+ { target: KIMAP, callData: router_call },
];
const multicalls = encodeFunctionData({
@@ -143,7 +143,7 @@ export const generateNetworkingKeys = async ({
// to mint a subname of your own, you would do something like this.
// const mintCall = encodeFunctionData({
- // abi: kinomapAbi,
+ // abi: kimapAbi,
// functionName: 'mint',
// args: [
// our_address,
diff --git a/kinode/src/register-ui/src/abis/index.ts b/kinode/src/register-ui/src/abis/index.ts
index 2a7430f3d..bffab2480 100644
--- a/kinode/src/register-ui/src/abis/index.ts
+++ b/kinode/src/register-ui/src/abis/index.ts
@@ -3,7 +3,7 @@ import { parseAbi } from "viem";
export { generateNetworkingKeys } from "./helpers";
// move to constants? // also for anvil/optimism
-export const KINOMAP: `0x${string}` = "0xcA92476B2483aBD5D82AEBF0b56701Bb2e9be658";
+export const KIMAP: `0x${string}` = "0xcA92476B2483aBD5D82AEBF0b56701Bb2e9be658";
export const MULTICALL: `0x${string}` = "0xcA11bde05977b3631167028862bE2a173976CA11";
export const KINO_ACCOUNT_IMPL: `0x${string}` = "0x38766C70a4FB2f23137D9251a1aA12b1143fC716";
export const DOTOS: `0x${string}` = "0x9BD054E4c7753791FA0C138b9713319F62ed235D";
@@ -13,7 +13,7 @@ export const multicallAbi = parseAbi([
`struct Call { address target; bytes callData; }`,
]);
-export const kinomapAbi = parseAbi([
+export const kimapAbi = parseAbi([
"function mint(address, bytes calldata, bytes calldata, bytes calldata, address) external returns (address tba)",
"function note(bytes calldata,bytes calldata) external returns (bytes32)",
"function get(bytes32 node) external view returns (address tokenBoundAccount, address tokenOwner, bytes memory note)",
diff --git a/kinode/src/register-ui/src/components/DirectTooltip.tsx b/kinode/src/register-ui/src/components/DirectTooltip.tsx
index 4958e7c74..f41cb7252 100644
--- a/kinode/src/register-ui/src/components/DirectTooltip.tsx
+++ b/kinode/src/register-ui/src/components/DirectTooltip.tsx
@@ -1,3 +1,5 @@
import { Tooltip } from "./Tooltip";
-export const DirectTooltip: React.FC = () =>
\ No newline at end of file
+export const DirectTooltip: React.FC = () =>
+ ⓘ
+
\ No newline at end of file
diff --git a/kinode/src/register-ui/src/components/EnterKnsName.tsx b/kinode/src/register-ui/src/components/EnterKnsName.tsx
index a12f07952..61bcd07de 100644
--- a/kinode/src/register-ui/src/components/EnterKnsName.tsx
+++ b/kinode/src/register-ui/src/components/EnterKnsName.tsx
@@ -1,9 +1,9 @@
-import React, { useEffect, useRef } from "react";
+import React, { useEffect, useRef, useState } from "react";
import isValidDomain from "is-valid-domain";
import { toAscii } from "idna-uts46-hx";
import { usePublicClient } from 'wagmi'
-import { KINOMAP, kinomapAbi } from '../abis'
+import { KIMAP, kimapAbi } from '../abis'
import { kinohash } from "../utils/kinohash";
export const NAME_URL = "Name must contain only valid characters (a-z, 0-9, and -)";
@@ -14,33 +14,38 @@ export const NAME_NOT_OWNER = "Name already exists and does not belong to this w
export const NAME_NOT_REGISTERED = "Name is not registered";
type ClaimOsNameProps = {
+ address?: `0x${string}`;
name: string;
setName: React.Dispatch>;
nameValidities: string[];
setNameValidities: React.Dispatch>;
triggerNameCheck: boolean;
+ setTba?: React.Dispatch>;
isReset?: boolean;
};
function EnterKnsName({
+ address,
name,
setName,
nameValidities,
setNameValidities,
triggerNameCheck,
+ setTba,
isReset = false,
}: ClaimOsNameProps) {
const client = usePublicClient();
const debouncer = useRef(null);
- useEffect(() => {
- if (isReset) return;
+ const [isPunyfied, setIsPunyfied] = useState('');
+ useEffect(() => {
if (debouncer.current) clearTimeout(debouncer.current);
debouncer.current = setTimeout(async () => {
let index: number;
- let validities = [...nameValidities];
+ let validities: string[] = [];
+ setIsPunyfied('');
const len = [...name].length;
index = validities.indexOf(NAME_LENGTH);
@@ -57,6 +62,8 @@ function EnterKnsName({
if (index === -1) validities.push(NAME_INVALID_PUNY);
}
+ if (normalized !== (name + ".os")) setIsPunyfied(normalized);
+
// only check if name is valid punycode
if (normalized && normalized !== '.os') {
index = validities.indexOf(NAME_URL);
@@ -66,46 +73,57 @@ function EnterKnsName({
index = validities.indexOf(NAME_CLAIMED);
+ // only check if name is valid and long enough
if (validities.length === 0 || index !== -1 && normalized.length > 2) {
try {
const namehash = kinohash(normalized)
// maybe separate into helper function for readability?
// also note picking the right chain ID & address!
const data = await client?.readContract({
- address: KINOMAP,
- abi: kinomapAbi,
+ address: KIMAP,
+ abi: kimapAbi,
functionName: "get",
args: [namehash]
})
+ const tba = data?.[0];
+ if (tba !== undefined) {
+ setTba ? (setTba(tba)) : null;
+ } else {
+ validities.push(NAME_NOT_REGISTERED);
+ }
+
const owner = data?.[1];
const owner_is_zero = owner === "0x0000000000000000000000000000000000000000";
- if (!owner_is_zero && index === -1) validities.push(NAME_CLAIMED);
+ if (!owner_is_zero && !isReset) validities.push(NAME_CLAIMED);
+
+ if (!owner_is_zero && isReset && address && owner !== address) validities.push(NAME_NOT_OWNER);
+
+ if (isReset && owner_is_zero) validities.push(NAME_NOT_REGISTERED);
} catch (e) {
console.error({ e })
if (index !== -1) validities.splice(index, 1);
}
}
}
-
setNameValidities(validities);
- }, 100);
+ }, 500);
}, [name, triggerNameCheck, isReset]);
- const noDots = (e: any) =>
- e.target.value.indexOf(".") === -1 && setName(e.target.value);
+ const noDotsOrSpaces = (e: any) =>
+ e.target.value.indexOf(".") === -1 && e.target.value.indexOf(" ") === -1 && setName(e.target.value);
return (
.os
@@ -113,6 +131,7 @@ function EnterKnsName({
{nameValidities.map((x, i) => (
{x}
))}
+ {isPunyfied !== '' &&
special characters will be converted to punycode: {isPunyfied}
}
);
}
diff --git a/kinode/src/register-ui/src/index.css b/kinode/src/register-ui/src/index.css
index ae0dbf510..6a14edeb7 100644
--- a/kinode/src/register-ui/src/index.css
+++ b/kinode/src/register-ui/src/index.css
@@ -29,6 +29,7 @@
}
.tooltip-text {
+ font-size: 0.8em;
visibility: hidden;
width: 200px;
background-color: #555;
@@ -127,13 +128,14 @@
.kns-input {
flex-grow: 1;
padding: 0.5rem;
+ font-size: 1.2em;
border: 1px solid var(--gray);
border-radius: 4px 0 0 4px;
}
.kns-suffix {
padding: 0.5rem;
- background-color: var(--gray);
+ background-color: var(--blue);
border: 1px solid var(--tasteful-dark);
border-left: none;
border-radius: 0 4px 4px 0;
@@ -148,6 +150,7 @@
.error-message {
color: var(--ansi-red);
margin-top: 0.5rem;
+ overflow-wrap: break-word;
}
.direct-checkbox {
@@ -215,6 +218,7 @@
.checkbox-label {
margin-left: 10px;
+ font-size: 0.9em;
}
.file-input-label {
@@ -235,4 +239,8 @@
.file-input-label:hover .button {
background-color: var(--dark-orange);
color: var(--off-white);
+}
+
+button.secondary {
+ width: 100%;
}
\ No newline at end of file
diff --git a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
index 8b09ce24b..8cb8b97ef 100644
--- a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx
@@ -51,7 +51,13 @@ function CommitDotOsName({
useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address])
- const enterOsNameProps = { name, setName, nameValidities, setNameValidities, triggerNameCheck }
+ const enterOsNameProps = { address, name, setName, nameValidities, setNameValidities, triggerNameCheck }
+
+ useEffect(() => {
+ if (!address) {
+ openConnectModal?.();
+ }
+ }, [address, openConnectModal]);
let handleCommit = useCallback(async (e: FormEvent) => {
e.preventDefault()
@@ -88,15 +94,15 @@ function CommitDotOsName({
return (
- {Boolean(address) && (
+ {
>
)}
{isError && (
- Error: {error?.message || 'There was an error registering your dot-os-name, please try again.'}
+ Error: {error?.message || 'There was an error registering your name, please try again.'}
)}
- )}
+ }
);
diff --git a/kinode/src/register-ui/src/pages/ImportKeyfile.tsx b/kinode/src/register-ui/src/pages/ImportKeyfile.tsx
index 79b2491fa..4021e9544 100644
--- a/kinode/src/register-ui/src/pages/ImportKeyfile.tsx
+++ b/kinode/src/register-ui/src/pages/ImportKeyfile.tsx
@@ -118,13 +118,13 @@ function ImportKeyfile({
required
minLength={6}
name="password"
- placeholder="Min 6 characters"
+ placeholder=""
value={pw}
onChange={(e) => setPw(e.target.value)}
/>
{pwErr && {pwErr}
}
{pwDebounced && !pwVet && 6 <= pw.length && (
- Password is incorrect
+ Password is incorrect!
)}
@@ -132,7 +132,7 @@ function ImportKeyfile({
{keyErrs.map((x, i) => (
{x}
))}
- Import Keyfile
+ Boot Node
Please note: if the original node was booted as a direct node
diff --git a/kinode/src/register-ui/src/pages/KinodeHome.tsx b/kinode/src/register-ui/src/pages/KinodeHome.tsx
index 172909f7a..621cef203 100644
--- a/kinode/src/register-ui/src/pages/KinodeHome.tsx
+++ b/kinode/src/register-ui/src/pages/KinodeHome.tsx
@@ -27,12 +27,12 @@ function KinodeHome({ knsName }: OsHomeProps) {
{previouslyBooted ? (
Welcome back!
- Login
+ Log in
) : (
<>
Welcome to Kinode
- New here? Register a username to get started
+ New here? Register a name to get started
Register .os Name
@@ -40,14 +40,14 @@ function KinodeHome({ knsName }: OsHomeProps) {
Other options
-
- Reset Kinode Name
-
Import Keyfile
+
+ Reset Existing Name
+
- Register non-.os Name (Advanced)
+ Register Non-.os Name (Advanced)
>
diff --git a/kinode/src/register-ui/src/pages/Login.tsx b/kinode/src/register-ui/src/pages/Login.tsx
index e4f021e09..f8a22c8dc 100644
--- a/kinode/src/register-ui/src/pages/Login.tsx
+++ b/kinode/src/register-ui/src/pages/Login.tsx
@@ -3,6 +3,7 @@ import { PageProps, UnencryptedIdentity } from "../lib/types";
import Loader from "../components/Loader";
import { useNavigate } from "react-router-dom";
import { sha256, toBytes } from "viem";
+import { Tooltip } from "../components/Tooltip";
interface LoginProps extends PageProps { }
@@ -89,8 +90,9 @@ function Login({
>
-
{knsName}
- ({isDirect ? "direct" : "indirect"} node)
+
+ {knsName}
+
)}
-
Login
+
Log in
navigate('/reset')}
>
- Reset Node & Networking Info
+ Reset Password & Networking Info
diff --git a/kinode/src/register-ui/src/pages/MintCustom.tsx b/kinode/src/register-ui/src/pages/MintCustom.tsx
index 7c2754a9b..6ab4b9f46 100644
--- a/kinode/src/register-ui/src/pages/MintCustom.tsx
+++ b/kinode/src/register-ui/src/pages/MintCustom.tsx
@@ -48,6 +48,12 @@ function MintCustom({
useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address])
+ useEffect(() => {
+ if (!address) {
+ openConnectModal?.();
+ }
+ }, [address, openConnectModal]);
+
let handleMint = useCallback(async (e: FormEvent) => {
e.preventDefault()
e.stopPropagation()
@@ -113,12 +119,15 @@ function MintCustom({
return (
- {Boolean(address) && (
+ {
- )}
+ }
);
diff --git a/kinode/src/register-ui/src/pages/MintDotOsName.tsx b/kinode/src/register-ui/src/pages/MintDotOsName.tsx
index daf94befe..a60e14bb0 100644
--- a/kinode/src/register-ui/src/pages/MintDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/MintDotOsName.tsx
@@ -44,6 +44,12 @@ function MintDotOsName({
useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address])
+ useEffect(() => {
+ if (!address) {
+ openConnectModal?.();
+ }
+ }, [address, openConnectModal]);
+
let handleMint = useCallback(async (e: FormEvent) => {
e.preventDefault()
e.stopPropagation()
@@ -107,26 +113,26 @@ function MintDotOsName({
return (
- {Boolean(address) && (
+ {
- )}
+ }
);
diff --git a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx b/kinode/src/register-ui/src/pages/ResetDotOsName.tsx
index fa926b2fb..42d96c821 100644
--- a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx
+++ b/kinode/src/register-ui/src/pages/ResetDotOsName.tsx
@@ -2,24 +2,18 @@ import {
FormEvent,
useCallback,
useEffect,
- useRef,
useState,
} from "react";
import { useNavigate } from "react-router-dom";
-import { toAscii } from "idna-uts46-hx";
-import isValidDomain from "is-valid-domain";
import Loader from "../components/Loader";
import { PageProps } from "../lib/types";
-import { KINOMAP, MULTICALL, generateNetworkingKeys, kinomapAbi, mechAbi } from "../abis";
+import { MULTICALL, generateNetworkingKeys, mechAbi } from "../abis";
import { Tooltip } from "../components/Tooltip";
import DirectCheckbox from "../components/DirectCheckbox";
import EnterKnsName from "../components/EnterKnsName";
-import { useAccount, usePublicClient, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
+import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
import { useConnectModal, useAddRecentTransaction } from "@rainbow-me/rainbowkit";
-import { kinohash } from "../utils/kinohash";
-
-import { NAME_URL, NAME_INVALID_PUNY, NAME_NOT_OWNER, NAME_NOT_REGISTERED } from "../components/EnterKnsName";
interface ResetProps extends PageProps { }
@@ -28,7 +22,6 @@ function ResetKnsName({
setDirect,
setReset,
knsName,
- setKnsName,
setNetworkingKey,
setIpAddress,
setWsPort,
@@ -37,7 +30,6 @@ function ResetKnsName({
}: ResetProps) {
const { address } = useAccount();
const navigate = useNavigate();
- const client = usePublicClient();
const { openConnectModal } = useConnectModal();
const { data: hash, writeContract, isPending, isError, error } = useWriteContract({
@@ -54,7 +46,6 @@ function ResetKnsName({
const addRecentTransaction = useAddRecentTransaction();
const [name, setName] = useState
(knsName.slice(0, -3));
- const [nameVets, setNameVets] = useState([]);
const [nameValidities, setNameValidities] = useState([])
const [tba, setTba] = useState("");
const [triggerNameCheck, setTriggerNameCheck] = useState(false);
@@ -67,80 +58,11 @@ function ResetKnsName({
// so inputs will validate once wallet is connected
useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address]); // eslint-disable-line react-hooks/exhaustive-deps
-
- // TODO: separate this whole namechecking thing into helper function
- // boolean to branch whether to check for occupied or to match against our_address.
-
- const nameDebouncer = useRef(null);
useEffect(() => {
- if (nameDebouncer.current) clearTimeout(nameDebouncer.current);
-
- nameDebouncer.current = setTimeout(async () => {
- setNameVets([]);
-
-
- if (name === "") return;
-
- let index: number;
- let vets = [...nameVets];
-
- let normalized: string;
- index = vets.indexOf(NAME_INVALID_PUNY);
- try {
- normalized = toAscii(name + ".os");
- if (index !== -1) vets.splice(index, 1);
- } catch (e) {
- if (index === -1) vets.push(NAME_INVALID_PUNY);
- }
-
- // only check if name is valid punycode
- if (normalized! !== undefined) {
- index = vets.indexOf(NAME_URL);
- if (name !== "" && !isValidDomain(normalized)) {
- if (index === -1) vets.push(NAME_URL);
- } else if (index !== -1) vets.splice(index, 1);
-
- try {
- const namehash = kinohash(normalized)
- console.log('normalized', normalized)
- console.log('namehash', namehash)
- // maybe separate into helper function for readability?
- // also note picking the right chain ID & address!
- const data = await client?.readContract({
- address: KINOMAP,
- abi: kinomapAbi,
- functionName: "get",
- args: [namehash]
- })
- const tba = data?.[0];
- const owner = data?.[1];
-
-
- console.log('GOT data', data)
- console.log('GOT tba', tba)
-
- index = vets.indexOf(NAME_NOT_OWNER);
- if (owner === address && index !== -1) vets.splice(index, 1);
- else if (index === -1 && owner !== address)
- vets.push(NAME_NOT_OWNER);
-
- index = vets.indexOf(NAME_NOT_REGISTERED);
- if (index !== -1) vets.splice(index, 1);
-
- if (tba !== undefined) {
- setTba(tba);
- }
- } catch (e) {
- index = vets.indexOf(NAME_NOT_REGISTERED);
- if (index === -1) vets.push(NAME_NOT_REGISTERED);
- }
-
- if (nameVets.length === 0) setKnsName(normalized);
- }
-
- setNameVets(vets);
- }, 500);
- }, [name, triggerNameCheck]); // eslint-disable-line react-hooks/exhaustive-deps
+ if (!address) {
+ openConnectModal?.();
+ }
+ }, [address, openConnectModal]);
const handleResetRecords = useCallback(
async (e: FormEvent) => {
@@ -152,8 +74,6 @@ function ResetKnsName({
return;
}
-
-
try {
const data = await generateNetworkingKeys({
direct,
@@ -167,10 +87,6 @@ function ResetKnsName({
reset: true,
});
- console.log('data', data)
-
- console.log('tba', tba)
-
writeContract({
address: tba as `0x${string}`,
abi: mechAbi,
@@ -202,19 +118,22 @@ function ResetKnsName({
return (
- {Boolean(address) && (
+ {
- )}
+ }
);
diff --git a/kinode/src/register-ui/src/pages/SetPassword.tsx b/kinode/src/register-ui/src/pages/SetPassword.tsx
index 285e3536b..279a1732a 100644
--- a/kinode/src/register-ui/src/pages/SetPassword.tsx
+++ b/kinode/src/register-ui/src/pages/SetPassword.tsx
@@ -4,7 +4,7 @@ import { downloadKeyfile } from "../utils/download-keyfile";
import { Tooltip } from "../components/Tooltip";
import { sha256, toBytes } from "viem";
import { useSignTypedData, useAccount, useChainId } from 'wagmi'
-import { KINOMAP } from "../abis";
+import { KIMAP } from "../abis";
type SetPasswordProps = {
direct: boolean;
@@ -61,7 +61,7 @@ function SetPassword({
name: "Kimap",
version: "1",
chainId: chainId,
- verifyingContract: KINOMAP,
+ verifyingContract: KIMAP,
},
types: {
Boot: [
@@ -131,8 +131,8 @@ function SetPassword({
) : (