From 0ebb1427d6b990aed3430bd741bebe8825b88171 Mon Sep 17 00:00:00 2001 From: Daniel Hines Date: Wed, 23 Nov 2022 12:52:38 -0500 Subject: [PATCH] drop unused example code --- examples/tutorial/.dockerignore | 2 -- examples/tutorial/.gitignore | 2 -- examples/tutorial/Dockerfile | 18 ----------- examples/tutorial/README.md | 10 ------ examples/tutorial/docker-compose.yml | 47 ---------------------------- examples/tutorial/package.json | 34 -------------------- examples/tutorial/public/index.html | 11 ------- examples/tutorial/src/index.jsx | 44 -------------------------- examples/tutorial/start.sh | 33 ------------------- examples/tutorial/vm.js | 34 -------------------- examples/tutorial/wallet.json | 4 --- package.json | 1 - 12 files changed, 240 deletions(-) delete mode 100644 examples/tutorial/.dockerignore delete mode 100644 examples/tutorial/.gitignore delete mode 100644 examples/tutorial/Dockerfile delete mode 100644 examples/tutorial/README.md delete mode 100644 examples/tutorial/docker-compose.yml delete mode 100644 examples/tutorial/package.json delete mode 100644 examples/tutorial/public/index.html delete mode 100644 examples/tutorial/src/index.jsx delete mode 100755 examples/tutorial/start.sh delete mode 100644 examples/tutorial/vm.js delete mode 100644 examples/tutorial/wallet.json diff --git a/examples/tutorial/.dockerignore b/examples/tutorial/.dockerignore deleted file mode 100644 index de4d1f007d..0000000000 --- a/examples/tutorial/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -node_modules diff --git a/examples/tutorial/.gitignore b/examples/tutorial/.gitignore deleted file mode 100644 index de4d1f007d..0000000000 --- a/examples/tutorial/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -node_modules diff --git a/examples/tutorial/Dockerfile b/examples/tutorial/Dockerfile deleted file mode 100644 index 90ec319aad..0000000000 --- a/examples/tutorial/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# We'll use the official nodejs -# image as our base, but you should be able -# to use any image. -FROM node - -# Copy the deku-node and it's required system libraries -# into your image. -COPY --from=ghcr.io/marigold-dev/deku:latest /nix /nix/ -COPY --from=ghcr.io/marigold-dev/deku:latest /bin/deku-node /bin - -WORKDIR /app - -# Build your Deku VM -COPY package.json /app -RUN npm install -COPY ./vm.js . -COPY ./start.sh . -CMD /app/start.sh diff --git a/examples/tutorial/README.md b/examples/tutorial/README.md deleted file mode 100644 index 1004ce264d..0000000000 --- a/examples/tutorial/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Deku-P Example Project - -See the tutorial at https://deku.marigold.dev/docs/Deku-P/dekup_quickstart - -## tl;dr - -``` -docker build . -t my-sidechain -docker compose up -d --force-recreate -``` diff --git a/examples/tutorial/docker-compose.yml b/examples/tutorial/docker-compose.yml deleted file mode 100644 index 5233c9c305..0000000000 --- a/examples/tutorial/docker-compose.yml +++ /dev/null @@ -1,47 +0,0 @@ -version: "3.6" -services: - # We run a full Tezos sandbox network using Flextesa (https://tezos.gitlab.io/flextesa/). - # The deku-flextesa image has already been pre-populated with a Deku bridge contract - # configured for these nodes. - flextesa: - container_name: deku_flextesa - # FIXME: publish this image somewhere - image: ghcr.io/marigold-dev/deku-fextesa:latest - command: kathmandubox start - environment: - - block_time=4 - - flextesa_node_cors_origin=* - ports: - - 127.0.0.1:20000:20000 - deku-node-0: - container_name: deku-node-0 - image: my-sidechain - environment: - # A b58-encoded Ed25519 secret used to sign blocks - - DEKU_SECRET=edsk4UWkJqpZrAm26qvJE8uY9ZFGFqQiFuBcDyEPASXeHxuD68WvvF - - DEKU_PORT=4440 - # We'll enable the API for a single node on port 8080 - - DEKU_API_ENABLED=true - - DEKU_API_PORT=8080 - network_mode: "host" - deku-node-1: - container_name: deku-node-1 - image: my-sidechain - environment: - - DEKU_SECRET=edsk2mbL2Z7bAmRnuYbmsRe8Yu9rgAq1h993SDxoZncmqyMHDECyBa - - DEKU_PORT=4441 - network_mode: "host" - deku-node-2: - container_name: deku-node-2 - image: my-sidechain - environment: - - DEKU_SECRET=edsk3dx8ZfcaBXsuLsk8fawS1qxjHbZtEoEdpAwxhsjmYTQhoEUxFk - - DEKU_PORT=4442 - network_mode: "host" - deku-node-3: - container_name: deku-node-3 - image: my-sidechain - environment: - - DEKU_SECRET=edsk3MwFfcGp5FsZgrX8FGiBiDutX2kfAuPzU6VdZpKYLyDRVPb879 - - DEKU_PORT=4443 - network_mode: "host" diff --git a/examples/tutorial/package.json b/examples/tutorial/package.json deleted file mode 100644 index cab824d208..0000000000 --- a/examples/tutorial/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "my-app", - "version": "0.1.0", - "private": true, - "dependencies": { - "@marigold-dev/deku-p-sdk": "0.1.3", - "@airgap/beacon-sdk": "^3.1.3", - "@marigold-dev/deku-toolkit": "0.1.11", - "@taquito/beacon-wallet": "^13.0.1", - "@taquito/signer": "^13.0.1", - "@taquito/taquito": "^13.0.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-scripts": "^2.1.3", - "web-vitals": "^2.1.4" - }, - "devDependencies": { - "@tsconfig/node16": "^1.0.3", - "@types/express": "^4.17.14", - "@types/node": "^16.11.49", - "@types/react": "^18.0.17", - "@types/react-dom": "^18.0.6" - }, - "scripts": { - "start": "set port=9090 && react-scripts start" - }, - "browserslist": { - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} diff --git a/examples/tutorial/public/index.html b/examples/tutorial/public/index.html deleted file mode 100644 index b2d2a3e7fc..0000000000 --- a/examples/tutorial/public/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Deku-P App - - - -
- - - diff --git a/examples/tutorial/src/index.jsx b/examples/tutorial/src/index.jsx deleted file mode 100644 index 65ab80c4bf..0000000000 --- a/examples/tutorial/src/index.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React, { useState, useEffect } from "react"; -import ReactDOM from "react-dom"; - -import { DekuToolkit } from "@marigold-dev/deku-toolkit"; -import { InMemorySigner } from "@taquito/signer"; - -// The DekuClient uses Taquito for signing operations. -// Taquito supports a variety of hardware- and browser-based -// wallets, but for this demo we'll simply use a hard-coded private key -// and the InMemory signer. -const signer = new InMemorySigner( - "edsk3ym86W81aL2gfZ25WuWQrisJM5Vu8cEayCR6BGsRNgfRWos8mR" -); - -const deku = new DekuToolkit({ - signer, - dekuRPC: "http://localhost:8080", - tezosRPC: "http://localhost:20000", -}); - -const MyFirstDApp = () => { - const [counter, setCounter] = useState(null); - const [delta, setDelta] = useState(1); - const handleInputChange = (event) => setDelta(event.target.value); - const handleIncrement = () => deku.tx(JSON.stringify(["Increment", delta])); - const handleDecrement = () => deku.tx(JSON.stringify(["Decrement", delta])); - useEffect(() => { - deku.subscribeToKey("counter", (counterState) => - setCounter(JSON.parse(counterState)) - ); - }); - return ( -
-

- Current Counter State: {counter} -

- - - -
- ); -}; - -ReactDOM.render(, document.getElementById("root")); diff --git a/examples/tutorial/start.sh b/examples/tutorial/start.sh deleted file mode 100755 index 471a8ff90b..0000000000 --- a/examples/tutorial/start.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -# A list of of the tz1 public key hashes for each validator in this network -# (derived from their secret keys) -export DEKU_VALIDATORS=tz1fpf9DffkGAnzT6UKMDoS4hZjNmoEKhGsK,tz1PYdVbnLwiqKo3fLFXTKxw6K7BhpddQPh8,tz1Pv4viWq7ye4R6cr9SKR3tXiZGvpK34SKi,tz1cXKCCxLwYCHDSrx9hfD5Qmbs4W8w2UKDw -export DEKU_VALIDATOR_URIS=localhost:4440,localhost:4441,localhost:4442,localhost:4443 - -export DEKU_TEZOS_RPC_NODE=http://flextesa:20000 - -# The secret key of a Tezos with which to post updates to Tezos. In Flextesa networks -# this wallet is pre-seeded with funds. -export DEKU_TEZOS_SECRET=edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq - -# The address of the bridge contract deployed to the deku-flextesa Tezos network. -export DEKU_TEZOS_CONSENSUS_ADDRESS=KT1LHcxdRTgyFp1TdrgodVekLFkQwzFnTJcY - -# During local development, it is sometimes useful to use smaller block sizes -# and to artificially throttle the block rate so as to not consume all the CPU's resources. -export DEKU_DEFAULT_BLOCK_SIZE=5000 - -# Enable Debug logging for the NodeJS SDK -export DEKU_VM_DEBUG_LOGGING=true -# Set the verbosity of the Deku node -export DEKU_LOG_VERBOSITY=info - -# Wait for Flextesa to start -sleep 5 - -# Start the deku-node in the background with the path -# to the pipe for communicating with the VM -deku-node --named-pipe-path /run/deku/pipe & - -node ./vm.js /run/deku/pipe diff --git a/examples/tutorial/vm.js b/examples/tutorial/vm.js deleted file mode 100644 index 6db1d558bf..0000000000 --- a/examples/tutorial/vm.js +++ /dev/null @@ -1,34 +0,0 @@ -const { main, get, set } = require("@marigold-dev/deku-p-sdk"); - -const transition = (tx) => { - // Parse the operation data - const operation = JSON.parse(tx.operation); - console.log("Parsed operation:", operation); - const [operationKind, value] = operation; - - // Retrieve the current state of the 'counter' key. - // This is an in-memory lookup - no IO required. - const counter = JSON.parse(get("counter")); - console.log("Current state:", counter); - - switch (operation[0]) { - case "Increment": - set("counter", JSON.stringify(counter + value)); - break; - case "Decrement": - set("counter", JSON.stringify(counter - value)); - default: - const error = `Unrecognized operation kind: ${operationKind}`; - console.error(error); - // Signal an error to the user by returning a string - return error; - } -}; - -// Here we define the initial state of blockchain's key-value -// store on the genesis block. -const initialState = { - counter: JSON.stringify(42), -}; - -main(initialState, transition); diff --git a/examples/tutorial/wallet.json b/examples/tutorial/wallet.json deleted file mode 100644 index eea050cee1..0000000000 --- a/examples/tutorial/wallet.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "address": "tz1YCm2e83y4fWJG2Enf1EZVf3mSQykQJYMD", - "priv_key": "edsk39MdNey5uvHeoHTJaBdHg23jrDpeAaraje9gKTTEtQeFwevB9t" -} diff --git a/package.json b/package.json index 011c517f24..dc32b78625 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "deku-p/deku-toolkit/examples/nodejs", "deku-p/deku-toolkit/examples/react", "deku-p/sdks/typescript-sdk", - "examples/tutorial", "deku-c/deku-c-toolkit", "deku-c/deku-cli", "website"