aboutsummaryrefslogtreecommitdiffstats
path: root/mascara/example
diff options
context:
space:
mode:
Diffstat (limited to 'mascara/example')
-rw-r--r--mascara/example/app.js38
-rw-r--r--mascara/example/app/index.html17
-rw-r--r--mascara/example/server.js31
3 files changed, 0 insertions, 86 deletions
diff --git a/mascara/example/app.js b/mascara/example/app.js
deleted file mode 100644
index 7b6421fdc..000000000
--- a/mascara/example/app.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const EthQuery = require('ethjs-query')
-
-window.addEventListener('load', loadProvider)
-window.addEventListener('message', console.warn)
-
-async function loadProvider () {
- const ethereumProvider = window.metamask.createDefaultProvider({ host: 'http://localhost:9001' })
- const ethQuery = new EthQuery(ethereumProvider)
- const accounts = await ethQuery.accounts()
- window.METAMASK_ACCOUNT = accounts[0] || 'locked'
- logToDom(accounts.length ? accounts[0] : 'LOCKED or undefined', 'account')
- setupButtons(ethQuery)
-}
-
-
-function logToDom (message, context) {
- document.getElementById(context).innerText = message
- console.log(message)
-}
-
-function setupButtons (ethQuery) {
- const accountButton = document.getElementById('action-button-1')
- accountButton.addEventListener('click', async () => {
- const accounts = await ethQuery.accounts()
- window.METAMASK_ACCOUNT = accounts[0] || 'locked'
- logToDom(accounts.length ? accounts[0] : 'LOCKED or undefined', 'account')
- })
- const txButton = document.getElementById('action-button-2')
- txButton.addEventListener('click', async () => {
- if (!window.METAMASK_ACCOUNT || window.METAMASK_ACCOUNT === 'locked') return
- const txHash = await ethQuery.sendTransaction({
- from: window.METAMASK_ACCOUNT,
- to: window.METAMASK_ACCOUNT,
- data: '',
- })
- logToDom(txHash, 'cb-value')
- })
-}
diff --git a/mascara/example/app/index.html b/mascara/example/app/index.html
deleted file mode 100644
index 8afb6f3f2..000000000
--- a/mascara/example/app/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!doctype html>
-
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <script src="http://localhost:9001/metamascara.js"></script>
- <title>MetaMask ZeroClient Example</title>
-</head>
-
-<body>
- <button id="action-button-1">GET ACCOUNT</button>
- <div id="account"></div>
- <button id="action-button-2">SEND TRANSACTION</button>
- <div id="cb-value" ></div>
- <script src="./app.js"></script>
-</body>
-</html> \ No newline at end of file
diff --git a/mascara/example/server.js b/mascara/example/server.js
deleted file mode 100644
index bdb1efa16..000000000
--- a/mascara/example/server.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const express = require('express')
-const path = require('path')
-const createMetamascaraServer = require('../server/')
-const createBundle = require('../server/util').createBundle
-const serveBundle = require('../server/util').serveBundle
-//
-// Iframe Server
-//
-
-const mascaraServer = createMetamascaraServer()
-
-// start the server
-const mascaraPort = 9001
-mascaraServer.listen(mascaraPort)
-console.log(`Mascara service listening on port ${mascaraPort}`)
-
-
-//
-// Dapp Server
-//
-
-const dappServer = express()
-
-// serve dapp bundle
-serveBundle(dappServer, '/app.js', createBundle(require.resolve('./app.js')))
-dappServer.use(express.static(path.join(__dirname, '/app/')))
-
-// start the server
-const dappPort = '9002'
-dappServer.listen(dappPort)
-console.log(`Dapp listening on port ${dappPort}`)