mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-02 13:36:47 +03:00
app_store: UI new connectors, abis, contracts
This commit is contained in:
parent
a2333a7c3b
commit
ff890037da
@ -375,6 +375,7 @@ impl State {
|
||||
// basic plan...
|
||||
// when we get either metadata-uri or metadata-hash, we fetch the other one and see if they match.
|
||||
// if they do, we update the metadata for the package.
|
||||
// note: if either of hash/uri doens't match//errors, we probably shouldn't throw errors except for in verbose mode.
|
||||
|
||||
// TEMP WAIT while we solve kimap_indexer getting race condition
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
@ -391,7 +392,7 @@ impl State {
|
||||
|
||||
let note_str = String::from_utf8_lossy(¬e.note).to_string();
|
||||
|
||||
println!("got note {note_str} for {name}");
|
||||
// println!("got note {note_str} for {name}");
|
||||
// let notehash = note.notehash.to_string();
|
||||
|
||||
// let full_name = format!("{note_str}.{name}");
|
||||
@ -411,8 +412,10 @@ impl State {
|
||||
if let Some(hash_note) = data {
|
||||
let metadata_hash = String::from_utf8_lossy(&hash_note).to_string();
|
||||
println!("got metadata_url, and from that the hash {metadata_url} {metadata_hash}");
|
||||
// let metadata =
|
||||
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||
let metadata =
|
||||
utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||
|
||||
println!("got metadata: {:?}", metadata);
|
||||
|
||||
// if this fails and doesn't check out, do nothing
|
||||
}
|
||||
@ -431,10 +434,10 @@ impl State {
|
||||
if let Some(uri_note) = data {
|
||||
let metadata_url = String::from_utf8_lossy(&uri_note).to_string();
|
||||
println!("got metadata_hash, and from that the url {metadata_hash} {metadata_url}");
|
||||
// let metadata =
|
||||
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||
let metadata =
|
||||
utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||
|
||||
// if this fails and doesn't check out, do nothing
|
||||
println!("got metadata: {:?}", metadata);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
11951
kinode/packages/app_store/ui/package-lock.json
generated
11951
kinode/packages/app_store/ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -17,25 +17,18 @@
|
||||
"@ethersproject/hash": "^5.7.0",
|
||||
"@kinode/client-api": "^0.1.0",
|
||||
"@metamask/jazzicon": "^2.0.0",
|
||||
"@rainbow-me/rainbowkit": "^2.1.2",
|
||||
"@szhsin/react-menu": "^4.1.0",
|
||||
"@web3-react/coinbase-wallet": "^8.2.3",
|
||||
"@web3-react/core": "^8.2.2",
|
||||
"@web3-react/gnosis-safe": "^8.2.4",
|
||||
"@web3-react/injected-connector": "^6.0.7",
|
||||
"@web3-react/metamask": "^8.2.3",
|
||||
"@web3-react/network": "^8.2.3",
|
||||
"@web3-react/types": "^8.2.2",
|
||||
"@web3-react/walletconnect": "^8.2.3",
|
||||
"@web3-react/walletconnect-connector": "^6.2.13",
|
||||
"@web3-react/walletconnect-v2": "^8.5.1",
|
||||
"@tanstack/react-query": "^5.45.1",
|
||||
"classnames": "^2.5.1",
|
||||
"ethers": "^5.7.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-icons": "^5.0.1",
|
||||
"react-router-dom": "^6.21.3",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"unocss": "^0.59.0-beta.1",
|
||||
"viem": "^2.15.1",
|
||||
"wagmi": "^2.10.3",
|
||||
"zustand": "^4.4.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -54,4 +47,4 @@
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.0.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,12 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
||||
import { Web3ReactProvider, Web3ReactHooks } from '@web3-react/core';
|
||||
import type { MetaMask } from '@web3-react/metamask'
|
||||
|
||||
import { PackageStore, PackageStore__factory } from "./abis/types";
|
||||
import StorePage from "./pages/StorePage";
|
||||
import MyAppsPage from "./pages/MyAppsPage";
|
||||
import AppPage from "./pages/AppPage";
|
||||
import { APP_DETAILS_PATH, MY_APPS_PATH, PUBLISH_PATH, STORE_PATH } from "./constants/path";
|
||||
import { ChainId, PACKAGE_STORE_ADDRESSES } from "./constants/chain";
|
||||
import PublishPage from "./pages/PublishPage";
|
||||
import { hooks as metaMaskHooks, metaMask } from './utils/metamask'
|
||||
|
||||
const connectors: [MetaMask, Web3ReactHooks][] = [
|
||||
[metaMask, metaMaskHooks],
|
||||
]
|
||||
|
||||
declare global {
|
||||
interface ImportMeta {
|
||||
@ -34,11 +26,6 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
useProvider,
|
||||
} = metaMaskHooks;
|
||||
|
||||
const RPC_URL = import.meta.env.VITE_OPTIMISM_RPC_URL;
|
||||
const BASE_URL = import.meta.env.BASE_URL;
|
||||
if (window.our) window.our.process = BASE_URL?.replace("/", "");
|
||||
|
||||
@ -51,49 +38,9 @@ const WEBSOCKET_URL = import.meta.env.DEV // eslint-disable-line
|
||||
: undefined;
|
||||
|
||||
function App() {
|
||||
const provider = useProvider();
|
||||
|
||||
const [nodeConnected, setNodeConnected] = useState(true); // eslint-disable-line
|
||||
|
||||
const [packageAbi, setPackageAbi] = useState<PackageStore | undefined>(undefined);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!provider) return;
|
||||
|
||||
const updatePackageAbi = async () => {
|
||||
const network = await provider.getNetwork();
|
||||
if (network.chainId === ChainId.OPTIMISM) {
|
||||
setPackageAbi(PackageStore__factory.connect(
|
||||
PACKAGE_STORE_ADDRESSES[ChainId.OPTIMISM],
|
||||
provider.getSigner())
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
updatePackageAbi();
|
||||
|
||||
}, [provider])
|
||||
|
||||
useEffect(() => {
|
||||
// if (window.our?.node && window.our?.process) {
|
||||
// const api = new KinodeClientApi({
|
||||
// uri: WEBSOCKET_URL,
|
||||
// nodeId: window.our.node,
|
||||
// processId: window.our.process,
|
||||
// onOpen: (_event, _api) => {
|
||||
// console.log("Connected to Kinode");
|
||||
// // api.send({ data: "Hello World" });
|
||||
// },
|
||||
// onMessage: (json, _api) => {
|
||||
// console.log('UNEXPECTED WEBSOCKET MESSAGE', json)
|
||||
// },
|
||||
// });
|
||||
|
||||
// setApi(api);
|
||||
// } else {
|
||||
// setNodeConnected(false);
|
||||
// }
|
||||
}, []);
|
||||
|
||||
if (!nodeConnected) {
|
||||
return (
|
||||
@ -107,21 +54,18 @@ function App() {
|
||||
);
|
||||
}
|
||||
|
||||
const props = { provider, packageAbi };
|
||||
|
||||
return (
|
||||
<div className="flex flex-col c h-screen w-screen max-h-screen max-w-screen overflow-x-hidden special-appstore-background">
|
||||
<Web3ReactProvider connectors={connectors}>
|
||||
<Router basename={BASE_URL}>
|
||||
<Routes>
|
||||
<Route path={STORE_PATH} element={<StorePage />} />
|
||||
<Route path={MY_APPS_PATH} element={<MyAppsPage />} />
|
||||
<Route path={`${APP_DETAILS_PATH}/:id`} element={<AppPage />} />
|
||||
<Route path={PUBLISH_PATH} element={<PublishPage {...props} />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</Web3ReactProvider>
|
||||
</div>
|
||||
<Router basename={BASE_URL}>
|
||||
<Routes>
|
||||
<Route path={STORE_PATH} element={<StorePage />} />
|
||||
<Route path={MY_APPS_PATH} element={<MyAppsPage />} />
|
||||
<Route path={`${APP_DETAILS_PATH}/:id`} element={<AppPage />} />
|
||||
<Route path={PUBLISH_PATH} element={<PublishPage />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,978 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type": "function",
|
||||
"name": "UPGRADE_INTERFACE_VERSION",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "approve",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "apps",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherKnsNodeId",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "balanceOf",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "contractURI",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "getApproved",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "getInitializedVersion",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint64",
|
||||
"internalType": "uint64"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "getPackageId",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherName",
|
||||
"type": "bytes",
|
||||
"internalType": "bytes"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "getPackageInfo",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "package",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "tuple",
|
||||
"internalType": "struct IKinodeAppStore.PackageInfo",
|
||||
"components": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherKnsNodeId",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "getPackageInfo",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherName",
|
||||
"type": "bytes",
|
||||
"internalType": "bytes"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "tuple",
|
||||
"internalType": "struct IKinodeAppStore.PackageInfo",
|
||||
"components": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherKnsNodeId",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "initialize",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_knsResolver",
|
||||
"type": "address",
|
||||
"internalType": "contract KNSRegistryResolver"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "isApprovedForAll",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool",
|
||||
"internalType": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "knsResolver",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address",
|
||||
"internalType": "contract KNSRegistryResolver"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "name",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "owner",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "ownerOf",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "proxiableUUID",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "registerApp",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherName",
|
||||
"type": "bytes",
|
||||
"internalType": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "renounceOwnership",
|
||||
"inputs": [],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "safeTransferFrom",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "safeTransferFrom",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "bytes",
|
||||
"internalType": "bytes"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "setApprovalForAll",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "approved",
|
||||
"type": "bool",
|
||||
"internalType": "bool"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "supportsInterface",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "interfaceId",
|
||||
"type": "bytes4",
|
||||
"internalType": "bytes4"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool",
|
||||
"internalType": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "symbol",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "tokenURI",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "transferFrom",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "transferOwnership",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "unlistPacakge",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "package",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "updateContractURI",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "uri",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "updateMetadata",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "package",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"name": "upgradeToAndCall",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newImplementation",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "bytes",
|
||||
"internalType": "bytes"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"stateMutability": "payable"
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "AppMetadataUpdated",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "package",
|
||||
"type": "uint256",
|
||||
"indexed": true,
|
||||
"internalType": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"indexed": false,
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"indexed": false,
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "AppRegistered",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "package",
|
||||
"type": "uint256",
|
||||
"indexed": true,
|
||||
"internalType": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "packageName",
|
||||
"type": "string",
|
||||
"indexed": false,
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "publisherName",
|
||||
"type": "bytes",
|
||||
"indexed": false,
|
||||
"internalType": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "metadataUrl",
|
||||
"type": "string",
|
||||
"indexed": false,
|
||||
"internalType": "string"
|
||||
},
|
||||
{
|
||||
"name": "metadataHash",
|
||||
"type": "bytes32",
|
||||
"indexed": false,
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "Approval",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "approved",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"indexed": true,
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "ApprovalForAll",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "approved",
|
||||
"type": "bool",
|
||||
"indexed": false,
|
||||
"internalType": "bool"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "Initialized",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "version",
|
||||
"type": "uint64",
|
||||
"indexed": false,
|
||||
"internalType": "uint64"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "OwnershipTransferred",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "previousOwner",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "Transfer",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"indexed": true,
|
||||
"internalType": "uint256"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"name": "Upgraded",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "implementation",
|
||||
"type": "address",
|
||||
"indexed": true,
|
||||
"internalType": "address"
|
||||
}
|
||||
],
|
||||
"anonymous": false
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "AddressEmptyCode",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC1967InvalidImplementation",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "implementation",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC1967NonPayable",
|
||||
"inputs": []
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721IncorrectOwner",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "sender",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InsufficientApproval",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InvalidApprover",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "approver",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InvalidOperator",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InvalidOwner",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InvalidReceiver",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "receiver",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721InvalidSender",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "sender",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "ERC721NonexistentToken",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256",
|
||||
"internalType": "uint256"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "FailedInnerCall",
|
||||
"inputs": []
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "InvalidInitialization",
|
||||
"inputs": []
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "NotInitializing",
|
||||
"inputs": []
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "OwnableInvalidOwner",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "account",
|
||||
"type": "address",
|
||||
"internalType": "address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "UUPSUnauthorizedCallContext",
|
||||
"inputs": []
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "UUPSUnsupportedProxiableUUID",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "slot",
|
||||
"type": "bytes32",
|
||||
"internalType": "bytes32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"name": "Unauthorized",
|
||||
"inputs": []
|
||||
}
|
||||
]
|
22
kinode/packages/app_store/ui/src/abis/index.ts
Normal file
22
kinode/packages/app_store/ui/src/abis/index.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { parseAbi } from "viem";
|
||||
|
||||
// move to constants? // also for anvil/optimism
|
||||
export const KINOMAP: `0x${string}` = "0x0165878A594ca255338adfa4d48449f69242Eb8F";
|
||||
export const MULTICALL: `0x${string}` = "0xcA11bde05977b3631167028862bE2a173976CA11";
|
||||
export const KINO_ACCOUNT_IMPL: `0x${string}` = "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9";
|
||||
|
||||
|
||||
export const multicallAbi = parseAbi([
|
||||
`function aggregate(Call[] calls) external payable returns (uint256 blockNumber, bytes[] returnData)`,
|
||||
`struct Call { address target; bytes callData; }`,
|
||||
]);
|
||||
|
||||
export const kinomapAbi = parseAbi([
|
||||
"function mint(address, bytes calldata, bytes calldata, bytes calldata, address) external returns (address tba)",
|
||||
"function note(bytes calldata,bytes calldata) external returns (bytes32)",
|
||||
])
|
||||
|
||||
export const mechAbi = parseAbi([
|
||||
"function execute(address to, uint256 value, bytes calldata data, uint8 operation) returns (bytes memory returnData)",
|
||||
"function token() external view returns (uint256,address,uint256)"
|
||||
])
|
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { Listener } from "@ethersproject/providers";
|
||||
import type { Event, EventFilter } from "ethers";
|
||||
|
||||
export interface TypedEvent<
|
||||
TArgsArray extends Array<any> = any,
|
||||
TArgsObject = any
|
||||
> extends Event {
|
||||
args: TArgsArray & TArgsObject;
|
||||
}
|
||||
|
||||
export interface TypedEventFilter<_TEvent extends TypedEvent>
|
||||
extends EventFilter {}
|
||||
|
||||
export interface TypedListener<TEvent extends TypedEvent> {
|
||||
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
|
||||
}
|
||||
|
||||
type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
|
||||
|
||||
export interface OnEvent<TRes> {
|
||||
<TEvent extends TypedEvent>(
|
||||
eventFilter: TypedEventFilter<TEvent>,
|
||||
listener: TypedListener<TEvent>
|
||||
): TRes;
|
||||
(eventName: string, listener: Listener): TRes;
|
||||
}
|
||||
|
||||
export type MinEthersFactory<C, ARGS> = {
|
||||
deploy(...a: ARGS[]): Promise<C>;
|
||||
};
|
||||
|
||||
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
|
||||
infer C,
|
||||
any
|
||||
>
|
||||
? C
|
||||
: never;
|
||||
|
||||
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
|
||||
? Parameters<F["deploy"]>
|
||||
: never;
|
@ -1,999 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import { Contract, Signer, utils } from "ethers";
|
||||
import type { Provider } from "@ethersproject/providers";
|
||||
import type { PackageStore, PackageStoreInterface } from "../PackageStore";
|
||||
|
||||
const _abi = [
|
||||
{
|
||||
type: "function",
|
||||
name: "UPGRADE_INTERFACE_VERSION",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "approve",
|
||||
inputs: [
|
||||
{
|
||||
name: "to",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "apps",
|
||||
inputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherKnsNodeId",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "balanceOf",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "contractURI",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "getApproved",
|
||||
inputs: [
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "getInitializedVersion",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "uint64",
|
||||
internalType: "uint64",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "getPackageId",
|
||||
inputs: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherName",
|
||||
type: "bytes",
|
||||
internalType: "bytes",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
stateMutability: "pure",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "getPackageInfo",
|
||||
inputs: [
|
||||
{
|
||||
name: "package",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "tuple",
|
||||
internalType: "struct IKinodeAppStore.PackageInfo",
|
||||
components: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherKnsNodeId",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "getPackageInfo",
|
||||
inputs: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherName",
|
||||
type: "bytes",
|
||||
internalType: "bytes",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "tuple",
|
||||
internalType: "struct IKinodeAppStore.PackageInfo",
|
||||
components: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherKnsNodeId",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "initialize",
|
||||
inputs: [
|
||||
{
|
||||
name: "_knsResolver",
|
||||
type: "address",
|
||||
internalType: "contract KNSRegistryResolver",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "isApprovedForAll",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "operator",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "bool",
|
||||
internalType: "bool",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "knsResolver",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "address",
|
||||
internalType: "contract KNSRegistryResolver",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "name",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "owner",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "ownerOf",
|
||||
inputs: [
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "proxiableUUID",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "registerApp",
|
||||
inputs: [
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherName",
|
||||
type: "bytes",
|
||||
internalType: "bytes",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "renounceOwnership",
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "safeTransferFrom",
|
||||
inputs: [
|
||||
{
|
||||
name: "from",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "to",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "safeTransferFrom",
|
||||
inputs: [
|
||||
{
|
||||
name: "from",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "to",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
{
|
||||
name: "data",
|
||||
type: "bytes",
|
||||
internalType: "bytes",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "setApprovalForAll",
|
||||
inputs: [
|
||||
{
|
||||
name: "operator",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "approved",
|
||||
type: "bool",
|
||||
internalType: "bool",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "supportsInterface",
|
||||
inputs: [
|
||||
{
|
||||
name: "interfaceId",
|
||||
type: "bytes4",
|
||||
internalType: "bytes4",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "bool",
|
||||
internalType: "bool",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "symbol",
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "tokenURI",
|
||||
inputs: [
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
name: "",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "transferFrom",
|
||||
inputs: [
|
||||
{
|
||||
name: "from",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "to",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "transferOwnership",
|
||||
inputs: [
|
||||
{
|
||||
name: "newOwner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "unlistPacakge",
|
||||
inputs: [
|
||||
{
|
||||
name: "package",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "updateContractURI",
|
||||
inputs: [
|
||||
{
|
||||
name: "uri",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "updateMetadata",
|
||||
inputs: [
|
||||
{
|
||||
name: "package",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
name: "upgradeToAndCall",
|
||||
inputs: [
|
||||
{
|
||||
name: "newImplementation",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "data",
|
||||
type: "bytes",
|
||||
internalType: "bytes",
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
stateMutability: "payable",
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "AppMetadataUpdated",
|
||||
inputs: [
|
||||
{
|
||||
name: "package",
|
||||
type: "uint256",
|
||||
indexed: true,
|
||||
internalType: "uint256",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
indexed: false,
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
indexed: false,
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "AppRegistered",
|
||||
inputs: [
|
||||
{
|
||||
name: "package",
|
||||
type: "uint256",
|
||||
indexed: true,
|
||||
internalType: "uint256",
|
||||
},
|
||||
{
|
||||
name: "packageName",
|
||||
type: "string",
|
||||
indexed: false,
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "publisherName",
|
||||
type: "bytes",
|
||||
indexed: false,
|
||||
internalType: "bytes",
|
||||
},
|
||||
{
|
||||
name: "metadataUrl",
|
||||
type: "string",
|
||||
indexed: false,
|
||||
internalType: "string",
|
||||
},
|
||||
{
|
||||
name: "metadataHash",
|
||||
type: "bytes32",
|
||||
indexed: false,
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "Approval",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "approved",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
indexed: true,
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "ApprovalForAll",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "operator",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "approved",
|
||||
type: "bool",
|
||||
indexed: false,
|
||||
internalType: "bool",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "Initialized",
|
||||
inputs: [
|
||||
{
|
||||
name: "version",
|
||||
type: "uint64",
|
||||
indexed: false,
|
||||
internalType: "uint64",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "OwnershipTransferred",
|
||||
inputs: [
|
||||
{
|
||||
name: "previousOwner",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "newOwner",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "Transfer",
|
||||
inputs: [
|
||||
{
|
||||
name: "from",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "to",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
indexed: true,
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "event",
|
||||
name: "Upgraded",
|
||||
inputs: [
|
||||
{
|
||||
name: "implementation",
|
||||
type: "address",
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
anonymous: false,
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "AddressEmptyCode",
|
||||
inputs: [
|
||||
{
|
||||
name: "target",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC1967InvalidImplementation",
|
||||
inputs: [
|
||||
{
|
||||
name: "implementation",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC1967NonPayable",
|
||||
inputs: [],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721IncorrectOwner",
|
||||
inputs: [
|
||||
{
|
||||
name: "sender",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InsufficientApproval",
|
||||
inputs: [
|
||||
{
|
||||
name: "operator",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InvalidApprover",
|
||||
inputs: [
|
||||
{
|
||||
name: "approver",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InvalidOperator",
|
||||
inputs: [
|
||||
{
|
||||
name: "operator",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InvalidOwner",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InvalidReceiver",
|
||||
inputs: [
|
||||
{
|
||||
name: "receiver",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721InvalidSender",
|
||||
inputs: [
|
||||
{
|
||||
name: "sender",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "ERC721NonexistentToken",
|
||||
inputs: [
|
||||
{
|
||||
name: "tokenId",
|
||||
type: "uint256",
|
||||
internalType: "uint256",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "FailedInnerCall",
|
||||
inputs: [],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "InvalidInitialization",
|
||||
inputs: [],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "NotInitializing",
|
||||
inputs: [],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "OwnableInvalidOwner",
|
||||
inputs: [
|
||||
{
|
||||
name: "owner",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "OwnableUnauthorizedAccount",
|
||||
inputs: [
|
||||
{
|
||||
name: "account",
|
||||
type: "address",
|
||||
internalType: "address",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "UUPSUnauthorizedCallContext",
|
||||
inputs: [],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "UUPSUnsupportedProxiableUUID",
|
||||
inputs: [
|
||||
{
|
||||
name: "slot",
|
||||
type: "bytes32",
|
||||
internalType: "bytes32",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "error",
|
||||
name: "Unauthorized",
|
||||
inputs: [],
|
||||
},
|
||||
] as const;
|
||||
|
||||
export class PackageStore__factory {
|
||||
static readonly abi = _abi;
|
||||
static createInterface(): PackageStoreInterface {
|
||||
return new utils.Interface(_abi) as PackageStoreInterface;
|
||||
}
|
||||
static connect(
|
||||
address: string,
|
||||
signerOrProvider: Signer | Provider
|
||||
): PackageStore {
|
||||
return new Contract(address, _abi, signerOrProvider) as PackageStore;
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export { PackageStore__factory } from "./PackageStore__factory";
|
@ -1,6 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type { PackageStore } from "./PackageStore";
|
||||
export * as factories from "./factories";
|
||||
export { PackageStore__factory } from "./factories/PackageStore__factory";
|
@ -2,7 +2,7 @@ export enum ChainId {
|
||||
SEPOLIA = 11155111,
|
||||
OPTIMISM = 10,
|
||||
OPTIMISM_GOERLI = 420,
|
||||
LOCAL = 1337,
|
||||
LOCAL = 31337,
|
||||
}
|
||||
|
||||
export const SEPOLIA_OPT_HEX = '0xaa36a7';
|
||||
|
@ -1,12 +1,44 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App.tsx'
|
||||
import '@rainbow-me/rainbowkit/styles.css';
|
||||
|
||||
import {
|
||||
getDefaultConfig,
|
||||
RainbowKitProvider,
|
||||
} from '@rainbow-me/rainbowkit';
|
||||
import { WagmiProvider } from 'wagmi';
|
||||
import {
|
||||
optimism,
|
||||
anvil
|
||||
} from 'wagmi/chains';
|
||||
import {
|
||||
QueryClientProvider,
|
||||
QueryClient,
|
||||
} from "@tanstack/react-query";
|
||||
|
||||
|
||||
import '@unocss/reset/tailwind.css'
|
||||
import 'uno.css'
|
||||
import './index.css'
|
||||
|
||||
const config = getDefaultConfig({
|
||||
appName: 'Kinode App Store',
|
||||
projectId: 'YOUR_PROJECT_ID', // apparently need project_Id if using wallet_connect
|
||||
chains: [anvil, optimism], // change back to OP main once ready
|
||||
ssr: false, // If your dApp uses server side rendering (SSR)
|
||||
});
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
<WagmiProvider config={config}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<RainbowKitProvider>
|
||||
<App />
|
||||
</RainbowKitProvider>
|
||||
</QueryClientProvider>
|
||||
</WagmiProvider>
|
||||
</React.StrictMode>,
|
||||
)
|
||||
|
@ -6,7 +6,6 @@ import useAppsStore from "../store/apps-store";
|
||||
import ActionButton from "../components/ActionButton";
|
||||
import AppHeader from "../components/AppHeader";
|
||||
import SearchHeader from "../components/SearchHeader";
|
||||
import { PageProps } from "../types/Page";
|
||||
import { appId } from "../utils/app";
|
||||
import { PUBLISH_PATH } from "../constants/path";
|
||||
import HomeButton from "../components/HomeButton";
|
||||
@ -14,7 +13,6 @@ import classNames from "classnames";
|
||||
import { isMobileCheck } from "../utils/dimensions";
|
||||
import { FaGlobe, FaPeopleGroup, FaStar } from "react-icons/fa6";
|
||||
|
||||
interface AppPageProps extends PageProps { }
|
||||
|
||||
export default function AppPage() {
|
||||
// eslint-disable-line
|
||||
|
@ -5,7 +5,6 @@ import { AppInfo, MyApps } from "../types/Apps";
|
||||
import useAppsStore from "../store/apps-store";
|
||||
import AppEntry from "../components/AppEntry";
|
||||
import SearchHeader from "../components/SearchHeader";
|
||||
import { PageProps } from "../types/Page";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { appId } from "../utils/app";
|
||||
import { PUBLISH_PATH } from "../constants/path";
|
||||
|
@ -1,39 +1,107 @@
|
||||
import React, { useState, useCallback, FormEvent, useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import { useWeb3React } from "@web3-react/core";
|
||||
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import { useAccount, useWriteContract, useWaitForTransactionReceipt } from 'wagmi'
|
||||
import { ConnectButton } from '@rainbow-me/rainbowkit';
|
||||
|
||||
|
||||
// todo: some component indexes?
|
||||
import SearchHeader from "../components/SearchHeader";
|
||||
import { PageProps } from "../types/Page";
|
||||
import Jazzicon from "../components/Jazzicon";
|
||||
import { setChain } from "../utils/chain";
|
||||
import { OPTIMISM_OPT_HEX } from "../constants/chain";
|
||||
import { hooks, metaMask } from "../utils/metamask";
|
||||
import Loader from "../components/Loader";
|
||||
import { toDNSWireFormat } from "../utils/dnsWire";
|
||||
import useAppsStore from "../store/apps-store";
|
||||
import MetadataForm from "../components/MetadataForm";
|
||||
import { AppInfo } from "../types/Apps";
|
||||
import Checkbox from "../components/Checkbox";
|
||||
import Jazzicon from "../components/Jazzicon";
|
||||
import { Tooltip } from "../components/Tooltip";
|
||||
import HomeButton from "../components/HomeButton";
|
||||
import classNames from "classnames";
|
||||
import { isMobileCheck } from "../utils/dimensions";
|
||||
|
||||
const { useIsActivating } = hooks;
|
||||
import {
|
||||
createPublicClient, createWalletClient, decodeAbiParameters, encodeAbiParameters,
|
||||
encodePacked, stringToHex, parseAbi, parseAbiParameters, parseAbiItem, encodeFunctionData, http
|
||||
} from 'viem';
|
||||
|
||||
interface PublishPageProps extends PageProps { }
|
||||
import { multicallAbi, kinomapAbi, mechAbi, KINOMAP, MULTICALL, KINO_ACCOUNT_IMPL } from "../abis";
|
||||
|
||||
export default function PublishPage({
|
||||
provider,
|
||||
packageAbi,
|
||||
}: PublishPageProps) {
|
||||
|
||||
// move to helpers.
|
||||
function encodeMulticalls(metadataUri: string, metadataHash: string) {
|
||||
const metadataUriCall = encodeFunctionData({
|
||||
abi: kinomapAbi,
|
||||
functionName: 'note',
|
||||
args: [
|
||||
encodePacked(["bytes"], [stringToHex("~metadata-uri")]),
|
||||
encodePacked(["bytes"], [stringToHex(metadataUri)]),
|
||||
]
|
||||
})
|
||||
|
||||
const metadataHashCall = encodeFunctionData({
|
||||
abi: kinomapAbi,
|
||||
functionName: 'note',
|
||||
args: [
|
||||
encodePacked(["bytes"], [stringToHex("~metadata-hash")]),
|
||||
encodePacked(["bytes"], [stringToHex(metadataHash)]),
|
||||
]
|
||||
})
|
||||
|
||||
const calls = [
|
||||
{ target: KINOMAP, callData: metadataUriCall },
|
||||
{ target: KINOMAP, callData: metadataHashCall }
|
||||
];
|
||||
|
||||
const multicall = encodeFunctionData({
|
||||
abi: multicallAbi,
|
||||
functionName: 'aggregate',
|
||||
args: [calls]
|
||||
});
|
||||
return multicall;
|
||||
}
|
||||
|
||||
function encodeIntoMintCall(multicalls: `0x${string}`, our_address: `0x${string}`, app_name: string) {
|
||||
const initCall = encodeFunctionData({
|
||||
abi: mechAbi,
|
||||
functionName: 'execute',
|
||||
args: [
|
||||
MULTICALL,
|
||||
BigInt(0), // value
|
||||
multicalls,
|
||||
1
|
||||
]
|
||||
});
|
||||
|
||||
const mintCall = encodeFunctionData({
|
||||
abi: kinomapAbi,
|
||||
functionName: 'mint',
|
||||
args: [
|
||||
our_address,
|
||||
encodePacked(["bytes"], [stringToHex(app_name)]),
|
||||
initCall,
|
||||
"0x", // erc721 details? <- encode app_store here? actually might be a slick way to do it.
|
||||
KINO_ACCOUNT_IMPL,
|
||||
]
|
||||
})
|
||||
return mintCall;
|
||||
}
|
||||
|
||||
|
||||
export default function PublishPage() {
|
||||
// get state from router
|
||||
const { state } = useLocation();
|
||||
const { listedApps } = useAppsStore();
|
||||
// TODO: figure out how to handle provider
|
||||
const { account, isActive } = useWeb3React();
|
||||
const isActivating = useIsActivating();
|
||||
|
||||
const { address, isConnected, isConnecting } = useAccount();
|
||||
const { data: hash, writeContract } = useWriteContract()
|
||||
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
||||
useWaitForTransactionReceipt({
|
||||
hash,
|
||||
})
|
||||
|
||||
|
||||
const [loading, setLoading] = useState("");
|
||||
const [publishSuccess, setPublishSuccess] = useState<
|
||||
@ -60,19 +128,10 @@ export default function PublishPage({
|
||||
|
||||
useEffect(() => {
|
||||
setMyPublishedApps(
|
||||
listedApps.filter((app) => app.owner?.toLowerCase() === account?.toLowerCase())
|
||||
listedApps.filter((app) => app.owner?.toLowerCase() === address?.toLowerCase())
|
||||
);
|
||||
}, [listedApps, account])
|
||||
}, [listedApps, address])
|
||||
|
||||
const connectWallet = useCallback(async () => {
|
||||
await metaMask.activate().catch(() => { });
|
||||
|
||||
try {
|
||||
setChain(OPTIMISM_OPT_HEX);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const calculateMetadataHash = useCallback(async () => {
|
||||
if (!metadataUrl) {
|
||||
@ -114,28 +173,31 @@ export default function PublishPage({
|
||||
|
||||
// TODO: have a checkbox to show if it's an update of an existing package
|
||||
|
||||
const tx = await (isUpdate
|
||||
? packageAbi?.updateMetadata(
|
||||
BigNumber.from(
|
||||
utils.solidityKeccak256(
|
||||
["string", "bytes"],
|
||||
[packageName, publisherIdDnsWireFormat]
|
||||
)
|
||||
),
|
||||
metadataUrl,
|
||||
metadata
|
||||
)
|
||||
: packageAbi?.registerApp(
|
||||
packageName,
|
||||
publisherIdDnsWireFormat,
|
||||
metadataUrl,
|
||||
metadata
|
||||
));
|
||||
const multicall = encodeMulticalls(metadataUrl, metadata);
|
||||
|
||||
const args = isUpdate ? multicall : encodeIntoMintCall(multicall, address!, packageName);
|
||||
|
||||
writeContract({
|
||||
abi: mechAbi,
|
||||
address: KINOMAP, // ok nice, now here we need to get the current tba address!
|
||||
functionName: 'execute',
|
||||
args: [
|
||||
KINOMAP,
|
||||
BigInt(0),
|
||||
args,
|
||||
isUpdate ? 1 : 0
|
||||
]
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
setLoading("Publishing package...");
|
||||
await tx?.wait();
|
||||
|
||||
/// make reactive instead? not waiting for hash but something else?
|
||||
// wait for the hash thing.
|
||||
|
||||
|
||||
// await tx?.wait();
|
||||
setPublishSuccess({ packageName, publisherId });
|
||||
setPackageName("");
|
||||
setPublisherId(window.our?.node || publisherId);
|
||||
@ -157,7 +219,7 @@ export default function PublishPage({
|
||||
publisherId,
|
||||
metadataUrl,
|
||||
metadataHash,
|
||||
packageAbi,
|
||||
// packageAbi,
|
||||
setPublishSuccess,
|
||||
setPackageName,
|
||||
setPublisherId,
|
||||
@ -172,18 +234,26 @@ export default function PublishPage({
|
||||
try {
|
||||
await setChain(OPTIMISM_OPT_HEX);
|
||||
|
||||
const tx = await
|
||||
packageAbi?.unlistPacakge(
|
||||
utils.keccak256(utils.solidityPack(
|
||||
["string", "bytes"],
|
||||
[packageName, toDNSWireFormat(publisherName)]
|
||||
))
|
||||
);
|
||||
// ok so based on this, get the appropriate tba, and set the keys to ""?
|
||||
|
||||
const multicall = encodeMulticalls("", "");
|
||||
|
||||
writeContract({
|
||||
abi: mechAbi,
|
||||
address: KINOMAP, // get real TBA!
|
||||
functionName: 'execute',
|
||||
args: [
|
||||
KINOMAP,
|
||||
BigInt(0),
|
||||
multicall,
|
||||
1
|
||||
]
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
setLoading("Unlisting package...");
|
||||
await tx?.wait();
|
||||
// await tx?.wait();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
window.alert(
|
||||
@ -193,7 +263,7 @@ export default function PublishPage({
|
||||
setLoading("");
|
||||
}
|
||||
},
|
||||
[packageAbi, setLoading]
|
||||
[setLoading,] // packageAbi,
|
||||
);
|
||||
|
||||
const checkIfUpdate = useCallback(async () => {
|
||||
@ -225,10 +295,9 @@ export default function PublishPage({
|
||||
/>
|
||||
<div className="flex-center justify-between">
|
||||
<h4>Publish Package</h4>
|
||||
{Boolean(account) && <div className="card flex-center">
|
||||
{Boolean(address) && <div className="card flex-center">
|
||||
<span>Publishing as:</span>
|
||||
<Jazzicon address={account!} className="mx-2" />
|
||||
<span className="font-mono">{account?.slice(0, 4)}...{account?.slice(-4)}</span>
|
||||
<span className="font-mono">{address?.slice(0, 4)}...{address?.slice(-4)}</span>
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
@ -254,14 +323,12 @@ export default function PublishPage({
|
||||
</div>
|
||||
) : showMetadataForm ? (
|
||||
<MetadataForm {...{ packageName, publisherId, app: state?.app }} goBack={() => setShowMetadataForm(false)} />
|
||||
) : !account || !isActive ? (
|
||||
) : !address || !isConnected ? (
|
||||
<>
|
||||
<h4>Please connect your wallet {isMobile && <br />} to publish a package</h4>
|
||||
<button className={`connect-wallet row`} onClick={connectWallet}>
|
||||
Connect Wallet
|
||||
</button>
|
||||
<ConnectButton />
|
||||
</>
|
||||
) : isActivating ? (
|
||||
) : isConnecting ? (
|
||||
<Loader msg="Approve connection in your wallet" />
|
||||
) : (
|
||||
<form
|
||||
|
@ -5,14 +5,12 @@ import { AppInfo } from "../types/Apps";
|
||||
import useAppsStore from "../store/apps-store";
|
||||
import AppEntry from "../components/AppEntry";
|
||||
import SearchHeader from "../components/SearchHeader";
|
||||
import { PageProps } from "../types/Page";
|
||||
import { appId } from "../utils/app";
|
||||
import classNames from 'classnames';
|
||||
import { FaArrowRotateRight } from "react-icons/fa6";
|
||||
import { isMobileCheck } from "../utils/dimensions";
|
||||
import HomeButton from "../components/HomeButton";
|
||||
|
||||
interface StorePageProps extends PageProps { }
|
||||
|
||||
export default function StorePage() {
|
||||
// eslint-disable-line
|
||||
|
@ -1,7 +0,0 @@
|
||||
import { ethers } from "ethers";
|
||||
import { PackageStore } from "../abis/types";
|
||||
|
||||
export interface PageProps {
|
||||
provider?: ethers.providers.Web3Provider;
|
||||
packageAbi?: PackageStore
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
import { SEPOLIA_OPT_HEX, OPTIMISM_OPT_HEX } from "../constants/chain";
|
||||
const CHAIN_NOT_FOUND = "4902"
|
||||
|
||||
// TODO: can remove all of this?
|
||||
//
|
||||
|
||||
export interface Chain {
|
||||
chainId: string, // Replace with the correct chainId for Sepolia
|
||||
chainName: string,
|
||||
|
@ -1,4 +0,0 @@
|
||||
import { initializeConnector } from '@web3-react/core'
|
||||
import { MetaMask } from '@web3-react/metamask'
|
||||
|
||||
export const [metaMask, hooks] = initializeConnector<MetaMask>((actions) => new MetaMask({ actions }))
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user