mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-29 15:24:30 +03:00
copy changes, kinomap->kimap
This commit is contained in:
parent
c9f0566955
commit
652dc76063
@ -170,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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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)",
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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)",
|
||||
|
@ -3,7 +3,7 @@ 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 -)";
|
||||
@ -80,8 +80,8 @@ function EnterKnsName({
|
||||
// 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]
|
||||
})
|
||||
|
@ -102,7 +102,7 @@ function CommitDotOsName({
|
||||
<>
|
||||
<h3 className="form-label">
|
||||
<Tooltip text="Kinodes need an onchain node identity in order to communicate with other nodes in the network.">
|
||||
Choose a name for your computer
|
||||
Choose a name for your node
|
||||
</Tooltip>
|
||||
</h3>
|
||||
<EnterKnsName {...enterOsNameProps} />
|
||||
|
@ -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 && <p className="error-message">{pwErr}</p>}
|
||||
{pwDebounced && !pwVet && 6 <= pw.length && (
|
||||
<p className="error-message">Password is incorrect</p>
|
||||
<p className="error-message">Password is incorrect!</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -132,7 +132,7 @@ function ImportKeyfile({
|
||||
{keyErrs.map((x, i) => (
|
||||
<p key={i} className="error-message">{x}</p>
|
||||
))}
|
||||
<button type="submit" className="button">Import Keyfile</button>
|
||||
<button type="submit" className="button">Boot Node</button>
|
||||
</div>
|
||||
<p className="text-sm mt-2">
|
||||
Please note: if the original node was booted as a direct node
|
||||
|
@ -27,12 +27,12 @@ function KinodeHome({ knsName }: OsHomeProps) {
|
||||
{previouslyBooted ? (
|
||||
<div className="text-center">
|
||||
<h2 className="mb-2">Welcome back!</h2>
|
||||
<button onClick={loginRedir} className="button">Login</button>
|
||||
<button onClick={loginRedir} className="button">Log in</button>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<h2 className="text-center mb-2">Welcome to Kinode</h2>
|
||||
<h4 className="text-center mb-2">New here? Register a username to get started</h4>
|
||||
<h4 className="text-center mb-2">New here? Register a name to get started</h4>
|
||||
<div className="button-group">
|
||||
<button onClick={registerRedir} className="button">
|
||||
Register .os Name
|
||||
@ -40,14 +40,14 @@ function KinodeHome({ knsName }: OsHomeProps) {
|
||||
</div>
|
||||
<h4 className="text-center mt-2 mb-2">Other options</h4>
|
||||
<div className="button-group">
|
||||
<button onClick={resetRedir} className="button secondary">
|
||||
Reset Kinode Name
|
||||
</button>
|
||||
<button onClick={importKeyfileRedir} className="button secondary">
|
||||
Import Keyfile
|
||||
</button>
|
||||
<button onClick={resetRedir} className="button secondary">
|
||||
Reset Existing Name
|
||||
</button>
|
||||
<button onClick={customRegisterRedir} className="button secondary">
|
||||
Register non-.os Name (Advanced)
|
||||
Register Non-.os Name (Advanced)
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
|
@ -115,14 +115,14 @@ function Login({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button type="submit">Login</button>
|
||||
<button type="submit">Log in</button>
|
||||
|
||||
<div className="additional-options">
|
||||
<button
|
||||
className="secondary"
|
||||
onClick={() => navigate('/reset')}
|
||||
>
|
||||
Reset Node & Networking Info
|
||||
Reset Password & Networking Info
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -125,6 +125,9 @@ function MintCustom({
|
||||
<Loader msg={isConfirming ? 'Minting name...' : 'Please confirm the transaction in your wallet'} />
|
||||
) : (
|
||||
<>
|
||||
<p className="form-label">
|
||||
Register a name on a different top-level zone -- this will likely fail if that zone's requirements are not met
|
||||
</p>
|
||||
<input type="text" name="name" placeholder="Enter kimap name" />
|
||||
<input type="text" name="full-kns-name" placeholder="Enter full KNS name" />
|
||||
<input type="text" name="tba" placeholder="Enter TBA to mint under" />
|
||||
|
@ -116,19 +116,19 @@ function MintDotOsName({
|
||||
{
|
||||
<form className="form" onSubmit={handleMint}>
|
||||
{isPending || isConfirming ? (
|
||||
<Loader msg={isConfirming ? 'Minting .os name...' : 'Please confirm the transaction in your wallet'} />
|
||||
<Loader msg={isConfirming ? 'Minting name...' : 'Please confirm the transaction in your wallet'} />
|
||||
) : (
|
||||
<>
|
||||
<div className="button-group">
|
||||
<button type="submit" className="button">
|
||||
Mint pre-committed .os name
|
||||
Mint name {knsName}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{isError && (
|
||||
<p className="error-message">
|
||||
Error: {error?.message || 'There was an error minting your dot-os-name, please try again.'}
|
||||
Error: {error?.message || 'There was an error minting your name, please try again.'}
|
||||
</p>
|
||||
)}
|
||||
</form>
|
||||
|
@ -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({
|
||||
) : (
|
||||
<form className="form" onSubmit={handleSubmit}>
|
||||
<div className="form-group">
|
||||
<Tooltip text="This password will be used to log in if you restart your node or switch browsers.">
|
||||
<label className="form-label" htmlFor="password">New Password</label>
|
||||
<Tooltip text="This password will be used to log in when you restart your node or switch browsers.">
|
||||
<label className="form-label" htmlFor="password">Set Password</label>
|
||||
</Tooltip>
|
||||
<input
|
||||
type="password"
|
||||
@ -140,7 +140,7 @@ function SetPassword({
|
||||
required
|
||||
minLength={6}
|
||||
name="password"
|
||||
placeholder="Min 6 characters"
|
||||
placeholder="6 characters minimum"
|
||||
value={pw}
|
||||
onChange={(e) => setPw(e.target.value)}
|
||||
autoFocus
|
||||
@ -154,7 +154,7 @@ function SetPassword({
|
||||
required
|
||||
minLength={6}
|
||||
name="confirm-password"
|
||||
placeholder="Min 6 characters"
|
||||
placeholder="6 characters minimum"
|
||||
value={pw2}
|
||||
onChange={(e) => setPw2(e.target.value)}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user