From 0e15e7e6a67b1b20009d6fa409e323cd97a936ce Mon Sep 17 00:00:00 2001 From: Franck Date: Tue, 21 Dec 2021 15:17:23 +1100 Subject: [PATCH] Setup mainnet example with DAI --- packages/mainnet-poll-example/.eslintrc.json | 5 + packages/mainnet-poll-example/.mocharc.json | 8 ++ packages/mainnet-poll-example/README.md | 72 +++++++++++++++ packages/mainnet-poll-example/package.json | 62 +++++++++++++ .../mainnet-poll-example/prettier.config.js | 1 + packages/mainnet-poll-example/src/_redirects | 1 + .../src/assets/assets.d.ts | 14 +++ .../src/assets/images/pollingIcon.png | Bin 0 -> 24674 bytes .../src/components/WakuPolling.tsx | 79 ++++++++++++++++ packages/mainnet-poll-example/src/index.html | 16 ++++ packages/mainnet-poll-example/src/index.tsx | 87 ++++++++++++++++++ .../mainnet-poll-example/test/index.test.ts | 7 ++ packages/mainnet-poll-example/test/setup.ts | 0 packages/mainnet-poll-example/tsconfig.json | 25 +++++ 14 files changed, 377 insertions(+) create mode 100644 packages/mainnet-poll-example/.eslintrc.json create mode 100644 packages/mainnet-poll-example/.mocharc.json create mode 100644 packages/mainnet-poll-example/README.md create mode 100644 packages/mainnet-poll-example/package.json create mode 100644 packages/mainnet-poll-example/prettier.config.js create mode 100644 packages/mainnet-poll-example/src/_redirects create mode 100644 packages/mainnet-poll-example/src/assets/assets.d.ts create mode 100644 packages/mainnet-poll-example/src/assets/images/pollingIcon.png create mode 100644 packages/mainnet-poll-example/src/components/WakuPolling.tsx create mode 100644 packages/mainnet-poll-example/src/index.html create mode 100644 packages/mainnet-poll-example/src/index.tsx create mode 100644 packages/mainnet-poll-example/test/index.test.ts create mode 100644 packages/mainnet-poll-example/test/setup.ts create mode 100644 packages/mainnet-poll-example/tsconfig.json diff --git a/packages/mainnet-poll-example/.eslintrc.json b/packages/mainnet-poll-example/.eslintrc.json new file mode 100644 index 0000000..128cd29 --- /dev/null +++ b/packages/mainnet-poll-example/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "../../.eslintrc.json" + ] +} diff --git a/packages/mainnet-poll-example/.mocharc.json b/packages/mainnet-poll-example/.mocharc.json new file mode 100644 index 0000000..59d511f --- /dev/null +++ b/packages/mainnet-poll-example/.mocharc.json @@ -0,0 +1,8 @@ +{ + "spec": "test/**/*.test.{ts,tsx}", + "require": "ts-node/register", + "watchExtensions": "ts", + "extension": "ts", + "timeout": 3000, + "file": "./test/setup.ts" +} diff --git a/packages/mainnet-poll-example/README.md b/packages/mainnet-poll-example/README.md new file mode 100644 index 0000000..c5b4ee9 --- /dev/null +++ b/packages/mainnet-poll-example/README.md @@ -0,0 +1,72 @@ +# DappConnect Poll SDK Example + +This package is example usage of WakuPolling + +Example uses usedapp for exposing web3 provider + +For using usedapp please see usedapp docs + +## creating WakuPolling object + +to create waku polling object you can just use react hook + +``` +const wakuPolling = useWakuPolling( + appName, + tokenaddress, + library, + multicallAddress + ) +``` + +it is a good idea for token address and multicall address to be dependent on current chainId. + +useWakuPolling creates a new WakuPolling object whenever chainId changes. + +## creating new poll + +to create new poll you can use `createTimedPoll` function from WakuPolling class + +``` +wakuPolling.createTimedPoll( + question, + answers, + selectedType, + undefined, + endTime + ) +``` + +If you want you can use already created modal component for creating polls + +``` +const [showPollCreation, setShowPollCreation] = useState(false) +. +. +. +{showPollCreation && ( + + )} +``` + +### showing polls + +to show list of polls you can either use `PollList` component from polling-component + +``` + +``` + +If you want to create your own react component please use + +``` +usePollList(wakuPolling: WakuPolling | undefined) +``` + +Which returns memoized DetailedTimedPoll[] array. + +Waku polling also exposes `getDetailedTimedPolls` + +``` +const DetailedTimedPolls = await wakuPolling.getDetailedTimedPolls() +``` diff --git a/packages/mainnet-poll-example/package.json b/packages/mainnet-poll-example/package.json new file mode 100644 index 0000000..6fe1de5 --- /dev/null +++ b/packages/mainnet-poll-example/package.json @@ -0,0 +1,62 @@ +{ + "name": "@dappconnect/mainnet-poll-sdk-example", + "version": "0.1.0", + "main": "dist/cjs/src/index.js", + "module": "dist/esm/src/index.js", + "types": "dist/esm/src/index.d.ts", + "license": "MIT", + "watch": { + "build": { + "patterns": ["src"], + "extensions": "ts,tsx", + "runOnChangeOnly": false + } + }, + "scripts": { + "watch": "yarn npm-watch", + "clean:all": "yarn clean && rimraf node_modules/", + "clean": "rimraf dist/", + "copy-assets": "yarn copy-files:cjs && yarn copy-files:esm", + "copy-files:cjs": "copyfiles -u 1 src/**/*.svg src/**/*.png dist/cjs/src", + "copy-files:esm": "copyfiles -u 1 src/**/*.svg src/**/*.png dist/esm/src", + "build": "yarn build:all && yarn copy-assets", + "build:all": "yarn run build:esm && yarn run build:cjs", + "build:esm": "tsc --module es2020 --target es2017 --outDir dist/esm", + "build:cjs": "tsc --outDir dist/cjs", + "test": "mocha -r jsdom-global/register", + "lint": "yarn lint:prettier --check && yarn lint:eslint", + "lint:fix": "yarn lint:prettier --write && yarn lint:eslint --fix", + "lint:eslint": "eslint './{src,test}/**/*.{ts,tsx}'", + "lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'" + }, + "dependencies": { + "@dappconnect/vote-poll-sdk-core": "^0.1.0", + "@dappconnect/poll-sdk-react-components": "^0.1.0", + "@dappconnect/poll-sdk-react-hooks": "^0.1.0", + "@dappconnect/vote-poll-sdk-react-components": "^0.1.0", + "@usedapp/core": "^0.4.7", + "ethers": "^5.4.4", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-router-dom": "^5.2.0", + "styled-components": "^5.3.0" + }, + "devDependencies": { + "@types/chai": "^4.2.21", + "@types/mocha": "^9.0.0", + "@types/react": "^17.0.16", + "@types/styled-components": "^5.1.12", + "@typescript-eslint/eslint-plugin": "^4.29.0", + "@typescript-eslint/parser": "^4.29.0", + "chai": "^4.3.4", + "copyfiles": "^2.4.1", + "eslint": "^7.32.0", + "jsdom": "^16.7.0", + "jsdom-global": "^3.0.2", + "mocha": "^9.0.3", + "npm-watch": "^0.11.0", + "rimraf": "^3.0.2", + "ts-node": "^10.1.0", + "typescript": "^4.3.5" + } +} diff --git a/packages/mainnet-poll-example/prettier.config.js b/packages/mainnet-poll-example/prettier.config.js new file mode 100644 index 0000000..3bcd29e --- /dev/null +++ b/packages/mainnet-poll-example/prettier.config.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json') diff --git a/packages/mainnet-poll-example/src/_redirects b/packages/mainnet-poll-example/src/_redirects new file mode 100644 index 0000000..ad37e2c --- /dev/null +++ b/packages/mainnet-poll-example/src/_redirects @@ -0,0 +1 @@ +/* /index.html 200 diff --git a/packages/mainnet-poll-example/src/assets/assets.d.ts b/packages/mainnet-poll-example/src/assets/assets.d.ts new file mode 100644 index 0000000..4ce4da1 --- /dev/null +++ b/packages/mainnet-poll-example/src/assets/assets.d.ts @@ -0,0 +1,14 @@ +declare module '*.svg' { + const url: string + export default url +} + +declare module '*.jpg' { + const url: string + export default url +} + +declare module '*.png' { + const url: string + export default url +} diff --git a/packages/mainnet-poll-example/src/assets/images/pollingIcon.png b/packages/mainnet-poll-example/src/assets/images/pollingIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..153425035c4504a1078569919ff44531380c3762 GIT binary patch literal 24674 zcmZ6zcRbba{|9_1B|=KbELzAa+c6^aA$umrETt2Yb!>@bH&il?6^Cq+c@CMCICOB7 zP4+nU!7=XZ9H-y?z3)FhkLvxt-q-co6gP+dKE`C~^QwT3p zQ92G&$98(--BB2VV(06IA`q%^WJ$;?2#15nt}AWM|oXeO|Spd zu~`iFhF&lA^qzd-iUXq|4f&O=QYcE*-5xdLg!e4Egjkfnp)^a{8xWzReD_Wl!60=Z z%j4v@j}Adml>jIR{5qGm_rf@Bt@{y_o zrp&gU$4I*hxAr9cs}o0Nc#w`zN^6HDWqsNcFC^_7Z6RJSn0N2v|M_eJNc+5zHi%-9#wUGS_lS_OuWb2LI;jd|5gE-%>Yxg0kJ1c zsb>sa2kX-C@pt|)${UI*w)NHhtwvq&=mfHXc1C*Q*gq2h|8AI;zNbZ1q6M1J8wjx# zdQ#-1Ep*g|a2PdzmN>eHG}=B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zcy}SlB`0%K1DRQQ7HM89g68QYx0Ansj4L<>MnG7lP&C*o)(>!nr#m6lLFJHO3V!Y` z^n-&$MH02S2&&=T#BdR8Ddz&UE)d`goN*O}quQLk98h0^9mH_%YA}2Nc0kH~-p~v8 zU$A4Qz$+B}Ni(_--zV8W|Dve7&>)DD&A3dJI@p$u{cZ5AI?#|OI*v;=vwc0Ux^s{H E2NHk + {showPollCreation && signer && ( + + )} + {account ? ( + setShowPollCreation(true)}> + Create a poll + + ) : ( + { + if ((window as any)?.ethereum) { + activateBrowserWallet() + } else setSelectConnect(true) + }} + > + Connect to vote + + )} + {selectConnect && ( + + + + )} + + + + ) +} + +const Wrapper = styled.div` + display: flex; + flex-direction: column; + align-items: center; + max-width: 1146px; + position: relative; + margin: 0 auto; + padding: 150px 32px 50px; + width: 100%; + @media (max-width: 1146px) { + max-width: 780px; + } + @media (max-width: 600px) { + padding: 132px 16px 32px; + } + @media (max-width: 425px) { + padding: 96px 16px 84px; + } +` diff --git a/packages/mainnet-poll-example/src/index.html b/packages/mainnet-poll-example/src/index.html new file mode 100644 index 0000000..067de06 --- /dev/null +++ b/packages/mainnet-poll-example/src/index.html @@ -0,0 +1,16 @@ + + + + + + + + + Polling Dapp + + +
+ + + + diff --git a/packages/mainnet-poll-example/src/index.tsx b/packages/mainnet-poll-example/src/index.tsx new file mode 100644 index 0000000..1b72691 --- /dev/null +++ b/packages/mainnet-poll-example/src/index.tsx @@ -0,0 +1,87 @@ +import React, { useEffect, useState } from 'react' +import styled from 'styled-components' +import { DAppProvider, ChainId, useEthers } from '@usedapp/core' +import { DEFAULT_CONFIG } from '@usedapp/core/dist/cjs/src/model/config/default' +import { WakuPolling } from './components/WakuPolling' +import { TopBar, GlobalStyle } from '@dappconnect/vote-poll-sdk-react-components' +import pollingIcon from './assets/images/pollingIcon.png' +import { JsonRpcSigner } from '@ethersproject/providers' +import { orangeTheme } from '@dappconnect/vote-poll-sdk-react-components/dist/esm/src/style/themes' +import ReactDOM from "react-dom" +import {BrowserRouter} from "react-router-dom" +import {Route, Switch} from "react-router" + +const daiTokenContract = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; + +const config = { + readOnlyChainId: ChainId.Mainnet, + readOnlyUrls: { + [ChainId.Mainnet]: 'https://infura.io/v3/b4451d780cc64a078ccf2181e872cfcf', + }, + multicallAddresses: { + 1: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441', + 3: '0x53c43764255c17bd724f74c4ef150724ac50a3ed', + 1337: process.env.GANACHE_MULTICALL_CONTRACT ?? '0x0000000000000000000000000000000000000000', + }, + supportedChains: [...DEFAULT_CONFIG.supportedChains, 1337], + notifications: { + checkInterval: 500, + expirationPeriod: 50000, + }, +} + +export function Polling({tokenAddress}: {tokenAddress: string}) { + const { account, library, activateBrowserWallet, deactivate } = useEthers() + const [signer, setSigner] = useState(undefined) + + useEffect(() => { + setSigner(library?.getSigner()) + }, [account]) + + return ( + + + + + ) +} + +export function DaiPollingPage() { + return ( + + + + + + + ) +} + +const Page = styled.div` + height: 100%; + width: 100%; +` + +const Wrapper = styled.div` + height: 100%; + width: 100%; +` + +ReactDOM.render( +
+ + + + + +
, + document.getElementById('root') +) diff --git a/packages/mainnet-poll-example/test/index.test.ts b/packages/mainnet-poll-example/test/index.test.ts new file mode 100644 index 0000000..1dba999 --- /dev/null +++ b/packages/mainnet-poll-example/test/index.test.ts @@ -0,0 +1,7 @@ +import { expect } from 'chai' + +describe('test react-components', () => { + it('foo', async () => { + expect('Hello world').to.eq('Hello world') + }) +}) diff --git a/packages/mainnet-poll-example/test/setup.ts b/packages/mainnet-poll-example/test/setup.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/mainnet-poll-example/tsconfig.json b/packages/mainnet-poll-example/tsconfig.json new file mode 100644 index 0000000..4bd6269 --- /dev/null +++ b/packages/mainnet-poll-example/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "outDir": "dist", + "jsx":"react", + "esModuleInterop": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "skipLibCheck": true, + "downlevelIteration": true, + "strict": true, + "composite": true, + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "target": "es6", + "typeRoots": [ "./types", "./node_modules/@types", "../../node_modules/@types"] + }, + "include": [ + "src", + "src/**/*.json", + "test" + ] +}