diff --git a/components/Preview.tsx b/components/Preview.tsx index e4a29cb1..3632f3eb 100644 --- a/components/Preview.tsx +++ b/components/Preview.tsx @@ -20,6 +20,7 @@ import Confirm from '../components/Confirm' import * as constants from '../utils/constants' import { KEYGEN } from '../utils/keygen' import * as Name from 'w3name' +import * as Nam3 from '@namesys-eth/w3name-client' import * as ed25519v2 from 'ed25519-2.0.0' // @noble/ed25519 v2.0.0 import * as ensContent from '../utils/contenthash' import * as verifier from '../utils/verifier' @@ -2218,7 +2219,7 @@ const Preview: React.FC = ({ show, onClose, _ENS_, chain, handlePare resolve() } else { setTimeout(checkGas, 100) - } + } } checkGas() }) @@ -2226,25 +2227,40 @@ const Preview: React.FC = ({ show, onClose, _ENS_, chain, handlePare // Handle W3Name publish let key = constants.formatkey(keypairIPNS) let w3name: Name.WritableName + let w3nam3: Nam3.WritableName const keygen = async () => { w3name = await Name.from(ed25519v2.etc.hexToBytes(key)) + w3nam3 = await Nam3.from(ed25519v2.etc.hexToBytes(key)) const pin = async () => { - if (data.response.ipfs && w3name && gas) { + if (data.response.ipfs && w3name && w3nam3 && gas) { setHashIPFS(data.response.ipfs.split('ipfs://')[1]) const toPublish = '/ipfs/' + data.response.ipfs.split('ipfs://')[1] // @W3Name broadcast let _revision: Name.Revision + let revision_: Nam3.Revision if (!history.revision) { _revision = await Name.v0(w3name, toPublish) + revision_ = await Nam3.v0(w3nam3, toPublish) } else { let _revision_ = Revision.decode(new Uint8Array(Object.values(JSON.parse(JSON.stringify(history.revision))))) - _revision = await Name.increment(_revision_, toPublish) + if (Number(data.response.timestamp) < constants.w3timestamp) { + _revision = await Name.increment(_revision_, toPublish) + revision_ = _revision + } else { + _revision = await Name.increment(_revision_, toPublish) + revision_ = await Nam3.increment(_revision_, toPublish) + } } setTimestamp(data.response.timestamp) // Write revision to database & user directory await writeRevision(_revision, gas, data.response.timestamp, data.response.ipfs.split('ipfs://')[1]) // Publish IPNS - await Name.publish(_revision, w3name.key) + if (Number(data.response.timestamp) < constants.w3timestamp) { + await Name.publish(_revision, w3name.key) + } else { + await Name.publish(_revision, w3name.key) + await Nam3.publish(revision_, w3nam3.key) + } // Wrap up setGas(gas) setGasModal(true) diff --git a/components/Stealth.tsx b/components/Stealth.tsx index 56f6e6d1..52dd6904 100644 --- a/components/Stealth.tsx +++ b/components/Stealth.tsx @@ -15,6 +15,7 @@ import Success from '../components/Success' import * as constants from '../utils/constants' import { KEYGEN, RSAGEN } from '../utils/keygen' import * as Name from 'w3name' +import * as Nam3 from '@namesys-eth/w3name-client' import * as ed25519v2 from 'ed25519-2.0.0' // @noble/ed25519 v2.0.0 import * as ensContent from '../utils/contenthash' import * as verifier from '../utils/verifier' @@ -1746,25 +1747,40 @@ const Stealth: React.FC = ({ show, onClose, _ENS_, chain, handlePare // Handle W3Name publish let key = constants.formatkey(keypairIPNS) let w3name: Name.WritableName + let w3nam3: Nam3.WritableName const keygen = async () => { w3name = await Name.from(ed25519v2.etc.hexToBytes(key)) + w3nam3 = await Nam3.from(ed25519v2.etc.hexToBytes(key)) const pin = async () => { - if (data.response.ipfs && w3name && gas) { + if (data.response.ipfs && w3name && w3nam3 && gas) { setHashIPFS(data.response.ipfs.split('ipfs://')[1]) const toPublish = '/ipfs/' + data.response.ipfs.split('ipfs://')[1] // @W3Name broadcast let _revision: Name.Revision + let revision_: Nam3.Revision if (!history.revision) { _revision = await Name.v0(w3name, toPublish) + revision_ = await Nam3.v0(w3nam3, toPublish) } else { let _revision_ = Revision.decode(new Uint8Array(Object.values(JSON.parse(JSON.stringify(history.revision))))) - _revision = await Name.increment(_revision_, toPublish) + if (Number(data.response.timestamp) < constants.w3timestamp) { + _revision = await Name.increment(_revision_, toPublish) + revision_ = _revision + } else { + _revision = await Name.increment(_revision_, toPublish) + revision_ = await Nam3.increment(_revision_, toPublish) + } } setTimestamp(data.response.timestamp) // Write revision to database await writeRevision(_revision, gas, data.response.timestamp, data.response.ipfs.split('ipfs://')[1]) // Publish IPNS - await Name.publish(_revision, w3name.key) + if (Number(data.response.timestamp) < constants.w3timestamp) { + await Name.publish(_revision, w3name.key) + } else { + await Name.publish(_revision, w3name.key) + await Nam3.publish(revision_, w3nam3.key) + } // Wrap up setGas(gas) setStates([]) diff --git a/package.json b/package.json index 5970ddc1..fe42a231 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "NameSys.eth", + "name": "@namesys-eth/namesys-client", "homepage": "https://namesys.eth.limo", "version": "1.0.0", "scripts": { @@ -22,6 +22,7 @@ "@ensdomains/eth-ens-namehash": "^2.0.15", "@ethersproject/providers": "^5.7.2", "@ipld/dag-pb": "^4.0.2", + "@namesys-eth/w3name-client": "^0.0.3-beta", "@noble/curves": "^1.2.0", "@noble/hashes": "1.2.0", "@rainbow-me/rainbowkit": "^1.0.8", diff --git a/pages/account.tsx b/pages/account.tsx index 003bd1a1..b616ba32 100644 --- a/pages/account.tsx +++ b/pages/account.tsx @@ -31,7 +31,7 @@ import Export from '../components/Export' import * as constants from '../utils/constants' import * as verifier from '../utils/verifier' import { KEYGEN } from '../utils/keygen' -import * as Name from 'w3name' +import * as Name from '@namesys-eth/w3name-client' import * as ed25519_2 from 'ed25519-2.0.0' // @noble/ed25519 v2.0.0 import * as ensContent from '../utils/contenthash' @@ -1602,7 +1602,7 @@ const Account: NextPage = () => { setHelpModal(true) setIcon('info') setColor('cyan') - setHelp('This list does not contain Wrapped Names or Subdomains or Legacy Names that you Manage but do not Own. Please use the Search tab to find names in these categories') + setHelp('This list does not contain Wrapped Names or Freshly Registered Names or Subdomains or Legacy Names that you Manage but do not Own. Please use the Search tab to find missing names.') }} data-tooltip='Enlighten me' > diff --git a/pages/global.css b/pages/global.css index 8e446a6d..39f76965 100644 --- a/pages/global.css +++ b/pages/global.css @@ -73,7 +73,7 @@ body { .heading { background-image: url('/shadow.svg'); - background-size: 4%; + background-size: 2.5%; background-repeat: no-repeat; background-position-x: 50%; background-position-y: 10%; diff --git a/pages/index.tsx b/pages/index.tsx index 8c11e3c6..0b82f860 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -650,7 +650,7 @@ const Home: NextPage = () => { > {'v'} - {'1.1'} + {'1.2'} { marginLeft: '2px' }} > - {'-beta'} + {''}