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

New metaport architecture #184

Merged
merged 55 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2a9202b
New metaport architecture
dmytrotkk Aug 7, 2023
4809ea9
Merge develop branch
dmytrotkk Aug 7, 2023
6e646b1
Update skale-network
dmytrotkk Aug 7, 2023
517e451
Fix path to regression icons
dmytrotkk Aug 7, 2023
186ba3b
Comment out metamask wallet
dmytrotkk Aug 7, 2023
e3e0025
Update webpack-cli, move packages to dependencies, add regression
dmytrotkk Aug 8, 2023
c467f56
Update webpack config
dmytrotkk Aug 11, 2023
1a28ee3
Update React imports
dmytrotkk Aug 11, 2023
4fea232
Migrate builder to rollup.js
dmytrotkk Aug 14, 2023
b7b85e7
Split injected metaport and mp component
dmytrotkk Aug 14, 2023
fda6a4b
Add chain icons support for vite
dmytrotkk Aug 14, 2023
476a9d4
Add token icons in vite build
dmytrotkk Aug 14, 2023
dc2dce7
Add prepare_meta script
dmytrotkk Aug 14, 2023
1f201fb
Run prettier
dmytrotkk Aug 14, 2023
1bee1af
Move theming logic to metaport provider
dmytrotkk Aug 14, 2023
4c3f9d1
Make tokenIcon exportable, add external interfaces
dmytrotkk Aug 15, 2023
035c133
Fix storybook build - add react-dom
dmytrotkk Aug 15, 2023
b8d45b4
Update vercel build command
dmytrotkk Aug 15, 2023
2c4c4fe
Remove reduntant scss ts modules, add transfer ETA and ETF modules
dmytrotkk Aug 16, 2023
de8a4c1
New amount input, export amount error module
dmytrotkk Aug 16, 2023
69baad4
Add dest token balance module
dmytrotkk Aug 17, 2023
b3333d6
Fix dest token balance, export proxy endpoints
dmytrotkk Aug 17, 2023
90078c7
Update dest chains filtering logic, update config
dmytrotkk Aug 18, 2023
c2546e4
Update styling system, add community pool management
dmytrotkk Aug 22, 2023
a390b5f
Add recharge community pool function
dmytrotkk Aug 22, 2023
d55550f
Update storybook, update vercel script
dmytrotkk Aug 22, 2023
d7bd049
Use default token icons
dmytrotkk Aug 22, 2023
78234c8
Fix community pool logic for hub chains
dmytrotkk Aug 22, 2023
f4d687c
Add sFUEL station, fix community pool errors
dmytrotkk Aug 23, 2023
a463b13
PoW sFUEL faucet
dmytrotkk Aug 28, 2023
4eb413f
Remove web3-utils
dmytrotkk Aug 28, 2023
480fa55
Optimize miner script, update prettier rules
dmytrotkk Aug 28, 2023
6a9889f
Drop bn.js requirement
dmytrotkk Aug 28, 2023
5219de7
Update miner scirpt
dmytrotkk Aug 28, 2023
69d6ac6
Update sFUEL logic, add vibrant mode
dmytrotkk Aug 29, 2023
b76537a
Add ETH M2S, S2M methods, add ETH balance check
dmytrotkk Aug 30, 2023
7540661
Update eth unlock step, update wallet connector
dmytrotkk Aug 31, 2023
e890973
Run prettier
dmytrotkk Aug 31, 2023
7ea7643
Add wrapped tokens module
dmytrotkk Sep 5, 2023
4fd6009
Run prettier
dmytrotkk Sep 5, 2023
abe40aa
Add an ability to select apps
dmytrotkk Sep 7, 2023
ff97ca4
Update dependencies
dmytrotkk Sep 8, 2023
d4b47d0
Refactor tokens and chains state
dmytrotkk Sep 10, 2023
ef5b195
Fix get ETH token balance
dmytrotkk Sep 10, 2023
e074d18
Update prettier rules, fix routed ETH transfers
dmytrotkk Sep 11, 2023
4dcf13b
Add unwrap for eth token
dmytrotkk Sep 11, 2023
c9c04fe
Restructure CSS imports
dmytrotkk Sep 11, 2023
b3c224d
Update components folder structure
dmytrotkk Sep 11, 2023
f0aba33
Integrate addToken module
dmytrotkk Sep 11, 2023
ae6ec21
Add transfer history, add transaction logs
dmytrotkk Sep 14, 2023
788fefd
Add dynamic skale chains support, move chains metadata
dmytrotkk Sep 15, 2023
08042cb
Restructure imports
dmytrotkk Sep 15, 2023
2c47869
Update submodules
dmytrotkk Sep 20, 2023
e51339a
Minor changes
dmytrotkk Sep 21, 2023
53c91ae
Update WS endpoint func, general cleanup
dmytrotkk Sep 22, 2023
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
16 changes: 0 additions & 16 deletions .babelrc.json

This file was deleted.

20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['plugin:react/recommended', 'standard-with-typescript', 'prettier', 'plugin:storybook/recommended'],
overrides: [],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['react'],
rules: {
'react/jsx-key': 'off',
'react/react-in-jsx-scope': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'no-console': 'warn',
},
}
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Update submodules
run: |
git submodule update --remote
- name: Prepare metadata
run: |
bash prepare_meta.sh
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ test.mjs


src/meta/
src/icons/index.ts

metaportConfig.json
metaportConfigMainnet.json

storybook-static/
.vercel
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
[submodule "skale-network"]
path = skale-network
url = https://github.com/skalenetwork/skale-network.git
branch = add-additional-metadata
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 100,
"endOfLine": "auto",
"bracketSpacing": true
}
96 changes: 15 additions & 81 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,88 +1,22 @@
const path = require("path");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
import type { StorybookConfig } from "@storybook/react-webpack5";
import type { StorybookConfig } from '@storybook/react-vite'
const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
core: {},
addons: ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/preset-create-react-app", "@storybook/addon-interactions"],
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-styling',
],
framework: {
name: "@storybook/react-webpack5",
name: '@storybook/react-vite',
options: {
builder: {
lazyCompilation: true
}
}
viteConfigPath: '.storybook/vite.config.ts',
},
},
},
docs: {
autodocs: "tag"
autodocs: 'tag',
},
staticDirs: ["../build"],
webpackFinal: async config => {
if (config.resolve && config.resolve.alias) {
const {
global,
...alias
} = config.resolve.alias;
// config.resolve.alias['global'] = undefined;
// const { ...alias } = config.resolve.alias
config.resolve.alias = alias;
}
if (config.module && config.module.rules) {
config.module.rules.push({
test: /\.scss$/,
use: ["style-loader", {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 2,
esModule: false
}
}, "sass-loader"],
include: path.resolve(__dirname, "../")
});
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve("babel-loader"),
options: {
presets: [["react-app", {
flow: false,
typescript: true,
runtime: 'automatic'
}]]
}
});
config.module.rules.push({
test: /\.svg$/,
use: [{
loader: 'svg-url-loader',
options: {
limit: 10000
}
}]
});
}
if (config.plugins) {
config.plugins.push(new NodePolyfillPlugin());
}
if (config.resolve && config.resolve.extensions) {
config.resolve.extensions.push(".ts", ".tsx");
}
if (config.resolve && config.resolve.fallback) {
config.resolve.fallback = {
path: require.resolve('path-browserify'),
os: "os-browserify/browser",
"fs": false,
"https": require.resolve("https-browserify"),
"http": require.resolve("stream-http"),
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"buffer": require.resolve("buffer")
//...config.resolve.fallback,
};
}

return config;
}
};
export default config;
}
export default config
7 changes: 0 additions & 7 deletions .storybook/manager.js

This file was deleted.

18 changes: 14 additions & 4 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import type { Preview } from "@storybook/react";
import type { Preview } from '@storybook/react'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
grid: true,
backgrounds: {
default: 'dark',
values: [
{
name: 'dark',
value: '#222425',
}
]
},
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};
}

export default preview;
export default preview
16 changes: 16 additions & 0 deletions .storybook/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vitest/config'
import { UserConfigExport } from 'vite'

const app = async (): Promise<UserConfigExport> => {
return defineConfig({
plugins: [react()],
css: {
postcss: {
plugins: [],
},
},
})
}
// https://vitejs.dev/config/
export default app
44 changes: 44 additions & 0 deletions generate-imports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const fs = require('fs');
const path = require('path');

const rootDir = process.argv[2];

if (!rootDir) {
console.error('Please provide a root directory as an argument.');
process.exit(1);
}

const getSvgFilesInDir = (dir) => {
return fs.readdirSync(dir).filter(file => path.extname(file) === '.svg').map(file => path.join(dir, file));
};

const generateNamespaceExportsForDir = (dir) => {
const svgFiles = getSvgFilesInDir(dir);

if (svgFiles.length === 0) return; // Skip folders without SVGs

const namespaceExports = svgFiles.map(file => {
const variableName = path.basename(file, '.svg').replace(/-([a-z])/g, (_, g) => g.toUpperCase()); // Convert kebab-case to camelCase
return `export * as ${variableName} from './${path.basename(file)}';`;
}).join('\n');

const outputPath = path.join(dir, 'index.ts');
fs.writeFileSync(outputPath, namespaceExports, 'utf-8');
};

const walkDirectories = (dir) => {
const items = fs.readdirSync(dir);

for (const item of items) {
const itemPath = path.join(dir, item);
const stat = fs.statSync(itemPath);

if (stat && stat.isDirectory()) {
generateNamespaceExportsForDir(itemPath);
walkDirectories(itemPath);
}
}
};

generateNamespaceExportsForDir(rootDir); // Generate for rootDir itself
walkDirectories(rootDir); // Then walk its subdirectories
2 changes: 1 addition & 1 deletion helper-scripts
Loading