Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte kit #7

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ceff822
Start with heavy refactor towards Svelte Kit
acuarica Dec 2, 2021
5699b46
Add wallet store to manage MetaMask
acuarica Dec 2, 2021
d351f71
Add MetaMask providers to use its type definition
acuarica Dec 3, 2021
d9d07e5
Enhance vite env typings and docs
acuarica Dec 3, 2021
d03f583
Fix type conversion
acuarica Dec 3, 2021
e2072b5
Export chain id
acuarica Dec 3, 2021
e977bc8
Improve wallet reactivity
acuarica Dec 3, 2021
c88f871
Improve warning look&feel
acuarica Dec 3, 2021
9bdef40
Move inside `pools/` route
acuarica Dec 5, 2021
42461e5
Set up vite mode
acuarica Dec 5, 2021
962a453
Add new info endpoints
acuarica Dec 5, 2021
d93615a
Add new env types
acuarica Dec 5, 2021
257c58e
Add storybook
acuarica Dec 5, 2021
40adce8
Refactor to decouple from store
acuarica Dec 5, 2021
0463352
Add network info component
acuarica Dec 5, 2021
1e56b21
Fix deposit/withdraw routes
acuarica Dec 5, 2021
f3d64e1
Import without $lib
acuarica Dec 5, 2021
4efebce
Import without $lib
acuarica Dec 5, 2021
48a623b
Use RenPool address from env
acuarica Dec 5, 2021
04385a0
Add component stories
acuarica Dec 5, 2021
b32578c
Improve error handling
acuarica Dec 5, 2021
2fd15b4
Add some jsdoc
acuarica Dec 5, 2021
2d90d67
Remove comments
acuarica Dec 5, 2021
12a71dc
Add ren allowance PoC
acuarica Dec 5, 2021
68e2fd3
Remove hardhat
acuarica Dec 6, 2021
34909b1
Decouple components from env
acuarica Dec 7, 2021
fa60d50
Refactor main layout into component
acuarica Dec 7, 2021
6c0bf43
Rename to support jest testing
acuarica Dec 8, 2021
af98ce2
Add jest packages and config
acuarica Dec 8, 2021
3fdcb0e
Allows ide support when import .svelte files
acuarica Dec 8, 2021
ac34993
Add some tests
acuarica Dec 8, 2021
d00f886
Separate constants from config
acuarica Dec 9, 2021
0664fda
Fix config/bond imports
acuarica Dec 9, 2021
4e03eb8
Add address type alias
acuarica Dec 9, 2021
8de489c
Refactor to use types
acuarica Dec 9, 2021
9a06c0f
Use context instead of module variable
acuarica Dec 9, 2021
17a4bab
Showcase multiple Howtos in one page
acuarica Dec 9, 2021
8cb4534
Use context for EtherscanLink
acuarica Dec 9, 2021
70ef0a2
Use prop instead of module variable
acuarica Dec 9, 2021
e106237
Unify contract usage
acuarica Dec 9, 2021
3185cdd
moving h1 and h2 tags to global theme (#10)
fede-rodes Dec 11, 2021
02f1c9f
introducing Chip component (#11)
fede-rodes Dec 13, 2021
7baa4cf
moving Chip to lib folder
fede-rodes Dec 13, 2021
23b5160
Feat/format (#12)
fede-rodes Dec 13, 2021
dc47301
adding missing dep (#13)
fede-rodes Dec 14, 2021
b7c81fb
Feat/format2 (#14)
fede-rodes Dec 15, 2021
a7bcbae
fix import
fede-rodes Dec 23, 2021
56f75f9
update storybook config to only process svelte files
fede-rodes Dec 23, 2021
54bdffb
Feat/comp lib (#15)
fede-rodes Dec 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_CHAIN_ID=42
REACT_APP_INFURA_PROJECT_ID=XXX
VITE_CHAIN_ID=
INFURA_PROJECT_ID=
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2019
},
env: {
browser: true,
es2017: true,
node: true
}
};
34 changes: 0 additions & 34 deletions .eslintrc.js

This file was deleted.

19 changes: 5 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
/.svelte-kit
/node_modules/

# testing
/coverage
Expand All @@ -12,13 +8,8 @@
/build

# misc
.DS_Store
.env
.env.kovan
.env.dev

npm-debug.log*
yarn-debug.log*
yarn-error.log*
/.env
/.env.kovan
/.env.dev

/.netlify
37 changes: 37 additions & 0 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

const preprocess = require('svelte-preprocess');

module.exports = {
// export default {
core: {
builder: "storybook-builder-vite",
},

async viteFinal(config, { configType }) {
// customize the Vite config here
config.resolve.alias.foo = 'bar';
config.mode = 'kovan'

// return the customized config
return config;
},

"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx|svelte)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-svelte-csf"
],
"framework": "@storybook/svelte",
"svelteOptions": {
// "preprocess": config.preprocess,
preprocess: [
preprocess({
postcss: true,
}),
],
}
}
11 changes: 11 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../src/app.css";

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,78 @@
# renpool-app

RenPool's client app

## Manually deploy client app

[https://www.freecodecamp.org/news/how-to-deploy-a-react-application-to-netlify-363b8a98a985/](https://www.freecodecamp.org/news/how-to-deploy-a-react-application-to-netlify-363b8a98a985/)

Install Netlify CLI: `npm install netlify-cli -g`.

```bash
>> yarn run setEnv:<TARGET_NETWORK>
>> yarn run deploy
```

The app is deployed to [https://renpool.netlify.app/](https://renpool.netlify.app/)

## Usage

1. Open the Brownie console. Starting the console launches a fresh [Ganache](https://www.trufflesuite.com/ganache) instance in the background.

```bash
$ brownie console
Brownie v1.9.0 - Python development framework for Ethereum

ReactMixProject is the active project.
Launching 'ganache-cli'...
Brownie environment is ready.
```

2. Run the [deployment script](scripts/deploy.py) to deploy the project's smart contracts.

```python
>>> run("deploy")
Running 'scripts.deploy.main'...
Transaction sent: 0xd1000d04fe99a07db864bcd1095ddf5cb279b43be8e159f94dbff9d4e4809c70
Gas price: 0.0 gwei Gas limit: 6721975
SolidityStorage.constructor confirmed - Block: 1 Gas used: 110641 (1.65%)
SolidityStorage deployed at: 0xF104A50668c3b1026E8f9B0d9D404faF8E42e642

Transaction sent: 0xee112392522ed24ac6ab8cc8ba09bfe51c5d699d9d1b39294ba87e5d2a56212c
Gas price: 0.0 gwei Gas limit: 6721975
VyperStorage.constructor confirmed - Block: 2 Gas used: 134750 (2.00%)
VyperStorage deployed at: 0xB8485421abC325D172652123dBd71D58b8117070
```

3. While Brownie is still running, start the React app in a different terminal.

```bash
# make sure to use a different terminal, not the brownie console
cd client
yarn start
```

4. Connect Metamask to the local Ganache network. In the upper right corner, click the network dropdown menu. Select `Localhost 8545`, or:

```bash
New Custom RPC
http://localhost:8545
```

5. Interact with the smart contracts using the web interface or via the Brownie console.

```python
# get the newest vyper storage contract
>>> vyper_storage = VyperStorage[-1]

# the default sender of the transaction is the contract creator
>>> vyper_storage.set(1337)
```

Any changes to the contracts from the console should show on the website after a refresh, and vice versa.

## Ending a Session

When you close the Brownie console, the Ganache instance also terminates and the deployment artifacts are deleted.

To retain your deployment artifacts (and their functionality) you can launch Ganache yourself prior to launching Brownie. Brownie automatically attaches to the ganache instance where you can deploy the contracts. After closing Brownie, the chain and deployment artifacts will persist.
1 change: 0 additions & 1 deletion _redirects

This file was deleted.

23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

114 changes: 41 additions & 73 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,50 @@
{
"name": "client",
"version": "0.1.0",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:watch": "yarn run test --watch",
"eject": "react-scripts eject",
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"setEnv:dev": "cp .env.dev .env",
"setEnv:kovan": "cp .env.kovan .env",
"setEnv:rinkeby": "cp .env.rinkeby .env",
"deploy": "yarn run build && cp ./_redirects ./build && netlify deploy --dir build --prod"
},
"dependencies": {
"renpool-contracts": "https://github.com/renpool/renpool-contracts",
"@ethersproject/address": "^5.4.0",
"@ethersproject/bignumber": "^5.4.0",
"@ethersproject/contracts": "^5.4.0",
"@ethersproject/providers": "^5.4.1",
"@ethersproject/strings": "^5.4.0",
"@ethersproject/units": "^5.4.0",
"@renproject/react-components": "^1.0.0-alpha.10",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/bs58": "^4.0.1",
"@types/jest": "^26.0.15",
"@types/lodash": "^4.14.170",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/styled-components": "^5.1.11",
"@web3-react/core": "^6.1.9",
"@web3-react/injected-connector": "^6.0.7",
"@web3-react/network-connector": "^6.1.9",
"bs58": "^4.0.1",
"lodash": "^4.17.21",
"react": "^17.0.2",
"react-device-detect": "^1.17.0",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"rimble-ui": "^0.14.0",
"styled-components": "^5.3.0",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
"dev": "yarn dev:kovan",
"dev:kovan": "MODE=kovan svelte-kit dev",
"dev:kovan-fork": "MODE=kovan-fork svelte-kit dev",
"dev:mainnet": "MODE=mainnet svelte-kit dev",
"dev:mainnet-fork": "MODE=mainnet-fork svelte-kit dev",
"build": "svelte-kit build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"@metamask/providers": "^8.1.1",
"@storybook/addon-actions": "^6.4.7",
"@storybook/addon-essentials": "^6.4.7",
"@storybook/addon-links": "^6.4.7",
"@storybook/addon-svelte-csf": "^1.1.0",
"@storybook/svelte": "^6.4.7",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"autoprefixer": "^10.4.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^3.2.1",
"hardhat": "^2.7.0",
"postcss": "^8.4.4",
"storybook-builder-vite": "^0.1.10",
"svelte": "^3.44.2",
"svelte-check": "^2.2.6",
"svelte-preprocess": "^4.9.4",
"tailwindcss": "^2.2.19",
"tslib": "^2.3.1",
"typescript": "^4.4.3"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"testMatch": [
"**/?(*.)(spec|test).ts?(x)"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"<rootDir>/Tests/Setup.js",
"<rootDir>/Tests/Mocks/*"
]
"type": "module",
"dependencies": {
"ethers": "^5.5.1",
"renpool-contracts": "https://github.com/renpool/renpool-contracts"
}
}
6 changes: 6 additions & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
Binary file removed public/favicon.ico
Binary file not shown.
Loading