From 9710ddc6e2d4c312128e0a7de0358ae548c80d50 Mon Sep 17 00:00:00 2001 From: duhcompuder Date: Sat, 4 Feb 2023 12:17:54 -0500 Subject: [PATCH 1/3] add scripts to retrieve datadao deploy info --- blockchain-util/OperatingDeploymentInfo.json | 428 +++++++++++++++++++ data-dao | 2 +- package.json | 3 +- 3 files changed, 431 insertions(+), 2 deletions(-) create mode 100644 blockchain-util/OperatingDeploymentInfo.json diff --git a/blockchain-util/OperatingDeploymentInfo.json b/blockchain-util/OperatingDeploymentInfo.json new file mode 100644 index 0000000..9a8cce0 --- /dev/null +++ b/blockchain-util/OperatingDeploymentInfo.json @@ -0,0 +1,428 @@ +{ + "DataDaoManager": { + "97": { + "networkId": 97, + "contractABI": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "creator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeCreated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "nameOfInstitution", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "addressOfInstitution", + "type": "address" + } + ], + "name": "CreatedNewInstitution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "addedNewCID", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "addCID", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allInstitutions", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "provider", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "authorizeData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "cidInfo", + "outputs": [ + { + "internalType": "bool", + "name": "cidSet", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "cidSizes", + "type": "uint256" + }, + { + "internalType": "address", + "name": "fromInstitution", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "cidProviders", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address[]", + "name": "initialOwners", + "type": "address[]" + } + ], + "name": "createNewInstitutionDAO", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "createdInstitutions", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "contractAddress": "0x317F9c056c6Abb5dbB2c5769DeD05EAF9Afed35d" + }, + "3141": { + "networkId": 3141, + "contractABI": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "creator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeCreated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "nameOfInstitution", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "addressOfInstitution", + "type": "address" + } + ], + "name": "CreatedNewInstitution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "addedNewCID", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "addCID", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allInstitutions", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "cidraw", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "provider", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "authorizeData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "cidInfo", + "outputs": [ + { + "internalType": "bool", + "name": "cidSet", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "cidSizes", + "type": "uint256" + }, + { + "internalType": "address", + "name": "fromInstitution", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "cidProviders", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address[]", + "name": "initialOwners", + "type": "address[]" + } + ], + "name": "createNewInstitutionDAO", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "createdInstitutions", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "contractAddress": "0xA4044fC851ec5Fc2571fdEcF73c5A05bBd0D11c4" + } + } +} \ No newline at end of file diff --git a/data-dao b/data-dao index 919de58..9b65b85 160000 --- a/data-dao +++ b/data-dao @@ -1 +1 @@ -Subproject commit 919de583d654da09c6ba1589d56e784256ea48cf +Subproject commit 9b65b85b97dcaa5fcc39c4ffc727a7c326eb6f2f diff --git a/package.json b/package.json index c548296..ef20248 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "next build", "start": "next start", "lint": "next lint", - "get:deploy-info": "cp ./data-dao/src/deployment/OperatingDeploymentInfo.json ./blockchain-util/OperatingDeploymentInfo.json" + "get:deploy-info": "mkdir -p blockchain-util && cp ./data-dao/src/deployment/OperatingDeploymentInfo.json ./blockchain-util/OperatingDeploymentInfo.json", + "update:data-dao": "git submodule update --remote data-dao" }, "workspaces": [ "data-dao" From 91cc7d8cefd19b06342306e01fa1529cad2ad7a2 Mon Sep 17 00:00:00 2001 From: duhcompuder Date: Sun, 5 Feb 2023 00:35:34 -0500 Subject: [PATCH 2/3] added wallet connection --- src/components/dashboard/navigation.tsx | 17 +++++++-- src/components/web3Wrap.tsx | 51 +++++++++++++++++++++++++ src/pages/_app.tsx | 5 ++- 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 src/components/web3Wrap.tsx diff --git a/src/components/dashboard/navigation.tsx b/src/components/dashboard/navigation.tsx index 14814db..ef5fb8a 100644 --- a/src/components/dashboard/navigation.tsx +++ b/src/components/dashboard/navigation.tsx @@ -5,8 +5,9 @@ import { MagnifyingGlassIcon } from "@heroicons/react/20/solid"; import { Bars3Icon, BellIcon, XMarkIcon } from "@heroicons/react/24/outline"; import Avatar from "boring-avatars"; import Link from "next/link"; -import { Fragment } from "react"; +import { Fragment, useContext } from "react"; import { Button } from "../button"; +import { TransactionContext } from '../../components/web3Wrap' const navigation = [ { name: "Dashboard", href: Routes.dashboard.landing, current: true }, @@ -20,9 +21,8 @@ const userNavigation = [ ]; export function Navigation() { - const connectWallet = () => { - console.log("connect wallet: todo manuel"); - }; + const { connectWallet, connectedAccount } = useContext(TransactionContext); + return ( {({ open }) => ( @@ -75,12 +75,21 @@ export function Navigation() {
{/* Connect Wallet */} + {!connectedAccount && ( + )} + {connectedAccount && ( + + )} {/*