Skip to content

Commit a44bddd

Browse files
committed
updates
1 parent 5b5d852 commit a44bddd

21 files changed

+2799
-586
lines changed

.eslintignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# folders
2+
artifacts/
3+
build/
4+
cache/
5+
coverage/
6+
dist/
7+
lib/
8+
node_modules/
9+
typechain/
10+
11+
# files
12+
.solcover.js
13+
coverage.json

.eslintrc.js

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
module.exports = {
2+
extends: [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:import/typescript",
6+
"plugin:prettier/recommended",
7+
"plugin:react/recommended",
8+
"plugin:@next/next/recommended",
9+
],
10+
rules: {
11+
// typescript
12+
"@typescript-eslint/ban-ts-comment": [
13+
"error",
14+
{
15+
// future defaults
16+
"ts-expect-error": "allow-with-description",
17+
minimumDescriptionLength: 10,
18+
},
19+
],
20+
"@typescript-eslint/ban-types": [
21+
"error",
22+
{
23+
types: {
24+
"{}": false,
25+
},
26+
},
27+
],
28+
"@typescript-eslint/explicit-module-boundary-types": "off",
29+
"@typescript-eslint/no-empty-interface": "off",
30+
"@typescript-eslint/no-explicit-any": "off",
31+
"@typescript-eslint/no-non-null-assertion": "error",
32+
"@typescript-eslint/no-parameter-properties": "error",
33+
"@typescript-eslint/no-unused-vars": "warn",
34+
// import
35+
"import/first": "error",
36+
"import/newline-after-import": "error",
37+
"import/no-cycle": "error",
38+
"import/no-default-export": "off",
39+
"import/no-useless-path-segments": "error",
40+
// react
41+
"react/forbid-dom-props": ["error", { forbid: ["className", "style"] }],
42+
"react/no-children-prop": "off",
43+
"react/prop-types": "off",
44+
// react-hooks
45+
"react-hooks/rules-of-hooks": "error",
46+
"react-hooks/exhaustive-deps": "error",
47+
// eslint
48+
curly: "error",
49+
eqeqeq: "error",
50+
"getter-return": "off",
51+
"key-spacing": [
52+
"error",
53+
{ beforeColon: false, afterColon: true, mode: "strict" },
54+
],
55+
"keyword-spacing": ["error", { before: true, after: true }],
56+
"line-comment-position": "error",
57+
"new-cap": "error",
58+
"no-alert": "error",
59+
"no-case-declarations": "off",
60+
61+
"no-duplicate-imports": "error",
62+
"no-eval": "error",
63+
"no-floating-decimal": "error",
64+
"no-implicit-coercion": ["error", { boolean: false }],
65+
"no-implied-eval": "error",
66+
"no-irregular-whitespace": "error",
67+
"no-label-var": "error",
68+
"no-multiple-empty-lines": "error",
69+
"no-octal-escape": "error",
70+
"no-restricted-globals": ["error", "xdescribe", "fit", "fdescribe"],
71+
// has false positives
72+
"no-shadow": "off",
73+
// replaced with this
74+
"@typescript-eslint/no-shadow": "error",
75+
"no-tabs": "error",
76+
"no-template-curly-in-string": "error",
77+
"no-throw-literal": "error",
78+
"no-trailing-spaces": "error",
79+
"no-undef": "off",
80+
"no-unused-expressions": "error",
81+
"no-useless-computed-key": "error",
82+
"no-whitespace-before-property": "error",
83+
"object-curly-spacing": ["error", "always"],
84+
"object-shorthand": ["error", "always"],
85+
"prefer-const": "error",
86+
"prefer-object-spread": "error",
87+
"prefer-template": "error",
88+
"quote-props": ["error", "as-needed"],
89+
// 'sort-imports': ['warn', { ignoreDeclarationSort: true }],
90+
// 'sort-keys': ['warn', 'asc', { natural: true }],
91+
"spaced-comment": ["error", "always", { markers: ["/ <reference"] }],
92+
"symbol-description": "error",
93+
"template-curly-spacing": ["error", "never"],
94+
"use-isnan": "error",
95+
"valid-typeof": "error",
96+
semi: ["warn", "always"],
97+
// Inclusive
98+
"inclusive-language/use-inclusive-words": "error",
99+
// turn off deprecated things?
100+
"react/react-in-jsx-scope": "off",
101+
},
102+
parser: "@typescript-eslint/parser",
103+
plugins: [
104+
"@typescript-eslint",
105+
"import",
106+
"inclusive-language",
107+
"react",
108+
"react-hooks",
109+
],
110+
parserOptions: {
111+
ecmaVersion: 2019,
112+
ecmaFeatures: {
113+
impliedStrict: true,
114+
jsx: true,
115+
},
116+
warnOnUnsupportedTypeScriptVersion: true,
117+
},
118+
settings: {
119+
react: {
120+
createClass: "createReactClass",
121+
pragma: "React",
122+
version: "detect",
123+
},
124+
},
125+
overrides: [
126+
// enable rule specifically for TypeScript files
127+
{
128+
files: ["*.ts", "*.tsx"],
129+
rules: {
130+
"@typescript-eslint/explicit-module-boundary-types": ["off"],
131+
},
132+
},
133+
// disable mandatory display-names in non-production code
134+
{
135+
files: ["package-examples/**", "prototyper/**"],
136+
rules: {
137+
"react/display-name": "off",
138+
},
139+
},
140+
141+
// in test files, allow null assertions and anys and eslint is sometimes weird about the react-scope thing
142+
{
143+
files: ["*test.ts?(x)"],
144+
rules: {
145+
"@typescript-eslint/no-non-null-assertion": "off",
146+
"@typescript-eslint/no-explicit-any": "off",
147+
148+
"react/display-name": "off",
149+
},
150+
},
151+
// allow requires in non-transpiled JS files and logical key ordering in config files
152+
{
153+
files: [
154+
"babel-node.js",
155+
"*babel.config.js",
156+
"env.config.js",
157+
"next.config.js",
158+
"webpack.config.js",
159+
"packages/mobile-web/package-builder/**",
160+
],
161+
rules: {},
162+
},
163+
164+
// setupTests can have separated imports for logical grouping
165+
{
166+
files: ["setupTests.ts"],
167+
rules: {
168+
"import/newline-after-import": "off",
169+
},
170+
},
171+
],
172+
env: {
173+
browser: true,
174+
node: true,
175+
},
176+
};

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
.parcel-cache
33
.DS_Store
44
dist/
5-
esout/
5+
esout/
6+
yarn-error.log

.prettierignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# folders
2+
artifacts/
3+
build/
4+
cache/
5+
coverage/
6+
dist/
7+
lib/
8+
node_modules/
9+
typechain/
10+
scripts/
11+
12+
# files
13+
coverage.json

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
3+
"singleQuote": false,
4+
"trailingComma": "all"
5+
}

dev-iframe.html

+46-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,51 @@
11
<!DOCTYPE html>
22
<html>
33
<head> </head>
4-
<body>
5-
<iframe
6-
src="http://localhost:1234/"
7-
width="1100px"
8-
height="1100px"
9-
frameborder="0"
10-
></iframe>
4+
<body style="font-family: sans-serif">
5+
<div
6+
style="
7+
display: flex;
8+
flex-direction: column;
9+
gap: 20px;
10+
width: 100%;
11+
height: 100%;
12+
margin: 20px;
13+
align-items: center;
14+
"
15+
>
16+
<div style="gap: 5px; width: 600px;">
17+
<h2>Preview 600x600</h2>
18+
<iframe
19+
src="http://localhost:1234/?contract=0xe525ea4532903916782c7644c4a3D7d3020bf308&chainId=137"
20+
width="600px"
21+
height="600px"
22+
frameborder="0"
23+
></iframe>
24+
</div>
25+
<div style="gap: 5px; width: 600px;">
26+
<h2>Properties</h2>
27+
<div>
28+
<div>
29+
<label style="gap: 5px;">
30+
<span>Contract:</span>
31+
<input
32+
type="text"
33+
value="0xe525ea4532903916782c7644c4a3D7d3020bf308"
34+
style="width: 100%"
35+
/>
36+
</label>
37+
</div>
38+
<div>
39+
<label>
40+
<span>Chain ID:</span>
41+
<input
42+
type="text"
43+
value="137"
44+
style="width: 100%"
45+
/>
46+
</label>
47+
</div>
48+
</div>
49+
</div>
1150
</body>
1251
</html>

package.json

+18-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "",
55
"scripts": {
66
"build": "node scripts/build.js",
7-
"dev": "parcel serve parcel-build.html"
7+
"dev": "parcel serve parcel-build.html",
8+
"gen:theme-typings": "chakra-cli tokens src/shared/theme/index.ts",
9+
"postinstall": "yarn gen:theme-typings"
810
},
911
"repository": {
1012
"type": "git",
@@ -18,24 +20,36 @@
1820
"homepage": "https://github.com/nftlabs/widgets#readme",
1921
"browserslist": "> 0.5%, last 2 versions, not dead",
2022
"devDependencies": {
23+
"@chakra-ui/cli": "^1.5.3",
24+
"@types/flat": "^5.0.2",
2125
"@types/react": "^17.0.37",
2226
"@types/react-dom": "^17.0.11",
2327
"esbuild": "^0.14.2",
2428
"esbuild-serve": "^1.0.1",
25-
"parcel": "^2.0.1"
29+
"eslint": "<8.0.0",
30+
"eslint-config-prettier": "^8.3.0",
31+
"eslint-plugin-import": "^2.25.2",
32+
"eslint-plugin-inclusive-language": "^2.1.1",
33+
"eslint-plugin-prettier": "^4.0.0",
34+
"parcel": "^2.0.1",
35+
"prettier": "^2.4.1",
36+
"prettier-plugin-organize-imports": "^2.3.4",
37+
"typescript": "^4.4.4"
2638
},
2739
"dependencies": {
2840
"@3rdweb/hooks": "^1.3.3",
2941
"@3rdweb/react": "^1.3.1",
30-
"@3rdweb/sdk": "1.21.0",
42+
"@3rdweb/sdk": "1.23.1-0",
3143
"@chakra-ui/react": "^1.7.2",
3244
"@emotion/react": "^11",
3345
"@emotion/styled": "^11",
3446
"ethers": "^5.5.2",
47+
"flat": "^5.0.2",
3548
"framer-motion": "^4",
3649
"react": "^17.0.2",
3750
"react-dom": "^17.0.2",
38-
"react-icons": "^4.3.1"
51+
"react-icons": "^4.3.1",
52+
"react-query": "^3.34.1"
3953
},
4054
"resolutions": {
4155
"ansi-regex": "^5.0.1"

parcel-build.html

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
<meta charset="utf-8" />
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
55
<title>Parcel</title>
6+
<link rel="preconnect" href="https://fonts.googleapis.com" />
7+
<link
8+
rel="preconnect"
9+
href="https://fonts.gstatic.com"
10+
crossOrigin="anonymous"
11+
/>
12+
<link
13+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap"
14+
rel="stylesheet"
15+
></link>
16+
<link
17+
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;402;500;600;700;800;900&display=swap"
18+
rel="stylesheet"
19+
></link>
620
</head>
721
<body>
822
<div id="root"></div>

scripts/build.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ require("esbuild")
2222
.then((result) => {
2323
for (const file of result.outputFiles) {
2424
const fileContents = new TextDecoder().decode(file.contents);
25-
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body><div id="root"></div><script type="module">${fileContents}</script></body></html>`;
26-
if (!fs.existsSync("./dist")) {
27-
fs.mkdirSync("./dist");
25+
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" /><link rel="preconnect" href="https://fonts.googleapis.com" /><link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous"/><link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap"rel="stylesheet"></link><linkhref="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;402;500;600;700;800;900&display=swap" rel="stylesheet"></link></head><body><div id="root"></div><script type="module">${fileContents}</script></body></html>`;
26+
if (!fs.existsSync("./dist")) {
27+
fs.mkdirSync("./dist");
2828
}
2929
const pathSplit = file.path.split("/");
3030
fs.writeFileSync(

src/shared/commonRPCUrls.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const ChainIDToRPCMap: Record<number, string> = {
2+
137: "https://polygon-rpc.com",
3+
}

0 commit comments

Comments
 (0)