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

feat: support custom testnet #2112

Merged
merged 57 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e91a86d
wip
cs1707 Mar 8, 2024
9b8126e
wip
cs1707 Mar 11, 2024
ebfc428
wip: ts update
cs1707 Mar 12, 2024
19d7187
wip
cs1707 Mar 15, 2024
01558ae
wip
cs1707 Mar 15, 2024
4810f3f
feat: testnet asset list
cs1707 Mar 18, 2024
7c4660c
wip: sendToken
cs1707 Mar 18, 2024
6a1d8f9
feat: send token
cs1707 Mar 19, 2024
365f900
fix: submit
cs1707 Mar 19, 2024
e250eba
fix
cs1707 Mar 20, 2024
fe5156f
select chain
cs1707 Mar 21, 2024
a9f73d3
fix: chain
cs1707 Mar 21, 2024
3cad5b4
fix: chain
cs1707 Mar 21, 2024
40ab5a9
feat: update rabby-api
cs1707 Mar 21, 2024
0ea2941
fix: signTypedData
cs1707 Mar 22, 2024
afb49ae
chore: fix some bugs
cs1707 Mar 22, 2024
866c355
feat: sync mainnet
cs1707 Mar 22, 2024
5cd035b
feat: fix sign
cs1707 Mar 25, 2024
7f97262
feat: signTypedData
cs1707 Mar 25, 2024
05c6668
feat: i18n
cs1707 Mar 25, 2024
530d3a8
chore: fix some bugs
cs1707 Mar 25, 2024
ba7984e
chore: fix some bugs
cs1707 Mar 26, 2024
a6bfac8
merge
cs1707 Mar 26, 2024
001d93f
fix: merge
cs1707 Mar 26, 2024
fecd482
chore: fix tips
cs1707 Mar 26, 2024
6adfe6b
chore: remove console
cs1707 Mar 26, 2024
1ebceae
fix: testnet openapi
cs1707 Mar 27, 2024
55193aa
chore: fix some bugs
cs1707 Mar 27, 2024
d741c43
chore: fix some bugs
cs1707 Mar 28, 2024
37cfdf2
feat: merge
cs1707 Mar 28, 2024
155b8e4
feat: update rabby-api
cs1707 Mar 28, 2024
fc24e30
chore: fix some bugs
cs1707 Mar 28, 2024
ce2bb01
fix: scan link
cs1707 Mar 28, 2024
7a8388a
fix: sync mainnet list
cs1707 Mar 28, 2024
7173e06
Merge branch 'develop' into feat/custom-chain-ts
vvvvvv1vvvvvv Mar 28, 2024
4d6d16e
feat: lock
cs1707 Mar 28, 2024
9dd6d6c
Merge branch 'feat/custom-chain-ts' of github.com:RabbyHub/Rabby into…
cs1707 Mar 28, 2024
3f0d20e
fix: gas
cs1707 Mar 28, 2024
04d0299
fix: tooltip
cs1707 Mar 28, 2024
cac536a
feat: alarm sync chain
cs1707 Mar 28, 2024
4a05374
fix: sync chain
cs1707 Mar 28, 2024
0ecb4c3
fix: sync mainnet chain list
cs1707 Mar 28, 2024
8837aa9
feat: update rabby-api
cs1707 Mar 28, 2024
945a4af
fix: sign
cs1707 Mar 28, 2024
83bf1eb
chore: fix some bugs
cs1707 Mar 29, 2024
6ddd1ff
fix: findChain
cs1707 Mar 29, 2024
163da8c
feat: debug
cs1707 Mar 29, 2024
6d3a06c
fix: findChain
cs1707 Mar 29, 2024
9444b11
Merge branch 'develop' into feat/custom-chain-ts
vvvvvv1vvvvvv Mar 29, 2024
d0a23c3
chore: i18n
cs1707 Mar 29, 2024
c975d3c
Merge branch 'feat/custom-chain-ts' of github.com:RabbyHub/Rabby into…
cs1707 Mar 29, 2024
06dc0e1
feat: update page-provider
cs1707 Mar 29, 2024
6d2b202
feat: hide custom rpc for testnet
cs1707 Mar 29, 2024
7bc7371
feat: + changelog
vvvvvv1vvvvvv Mar 29, 2024
ca189a1
Merge branch 'feat/custom-chain-ts' of github.com:RabbyHub/Rabby into…
vvvvvv1vvvvvv Mar 29, 2024
91c9ffc
fix: custom rpc
cs1707 Mar 29, 2024
5e6a2aa
Merge branch 'feat/custom-chain-ts' of github.com:RabbyHub/Rabby into…
cs1707 Mar 29, 2024
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
6 changes: 2 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"react"
],
"plugins": ["@typescript-eslint", "react"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand All @@ -15,6 +12,7 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"prettier/prettier": [
"error",
{
Expand Down
51 changes: 48 additions & 3 deletions _raw/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@
"currentLanguage": "Current Language",
"enableTestnets": "Enable Testnets",
"toggleThemeMode": "Theme Mode",
"themeMode": "Theme Mode"
"themeMode": "Theme Mode",
"customTestnet": "Custom Testnet"
},
"aboutUs": "About us",
"currentVersion": "Current Version",
Expand Down Expand Up @@ -1103,7 +1104,18 @@
"customLinkText": "Search address to add custom token",
"customDescription": "Custom token added by you will be shown here",
"comingSoon": "Coming Soon...",
"searchPlaceholder": "Tokens"
"searchPlaceholder": "Tokens",
"AddTestnetToken": {
"title": "Add Testnet Token",
"selectChain": "Select chain",
"searching": "Searching Token",
"tokenAddress": "Token Address",
"notFound": "Token not found"
},
"TestnetAssetListContainer": {
"add": "add token"
},
"noTestnetAssets": "No Testnet Assets"
},
"hd": {
"howToConnectLedger": "How to Connect Ledger",
Expand Down Expand Up @@ -1587,6 +1599,10 @@
"title": "Edit RPC",
"rpcUrl": "RPC URL",
"rpcUrlPlaceholder": "Enter the RPC URL"
},
"EditCustomTestnetModal": {
"title": "Add Testnet",
"quickAdd": "Quick add from Chainlist"
}
},
"requestDebankTestnetGasToken": {
Expand Down Expand Up @@ -1820,6 +1836,34 @@
}
},
"code-set-successfully": "Referral code set successfully"
},
"customTestnet": {
"title": "Custom Testnet",
"desc": "Rabby cannot verify the security of custom testnets. Please add trusted networks only.",
"add": "Add Testnet",
"empty": "No Custom Testnet",
"currency": "Currency",
"id": "ID",
"CustomTestnetForm": {
"id": "Chain ID",
"name": "Network name",
"rpcUrl": "RPC URL",
"idRequired": "Please input chain id",
"nameRequired": "Please input network name",
"rpcUrlRequired": "Please input RPC URL",
"nativeTokenSymbol": "Currency symbol",
"nativeTokenSymbolRequired": "Please input currency symbol",
"blockExplorerUrl": "Block explorer URL (Optional)"
},
"AddFromChainList": {
"title": "Quick add from Chainlist",
"search": "Search Testnet name or ID",
"empty": "No chains found",
"tips": {
"added": "You've already added this chain",
"supported": "Chain already supported by Rabby Wallet"
}
}
}
},
"component": {
Expand Down Expand Up @@ -1913,7 +1957,8 @@
},
"ChainSelectorModal": {
"searchPlaceholder": "Search chain",
"noChains": "No chains"
"noChains": "No chains",
"addTestnet": "Custom Testnet"
},
"TokenSelector": {
"listTableHead": {
Expand Down
3 changes: 2 additions & 1 deletion _raw/locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@
"enableTestnets": "启用测试网",
"currentLanguage": "当前语言",
"toggleThemeMode": "主题模式",
"themeMode": "主题模式"
"themeMode": "主题模式",
"customTestnet": "自定义测试网"
},
"supportedChains": "支持的链",
"testnetBackendServiceUrl": "测试网后端服务 URL",
Expand Down
1 change: 1 addition & 0 deletions changeLogs/09260.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Supported custom testnet in "More" > "Custom Testnet"
1 change: 1 addition & 0 deletions changeLogs/zh_CN/09260.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 支持添加自定义测试网,点击"更多">"自定义测试网"添加
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"build:pro": "cross-env ENABLE_MV3=true npm run build:pro:default",
"build:debug": "cross-env ENABLE_MV3=true npm run build:debug:default",
"build:sourcemap": "npm run clean && npm run make-theme && webpack --progress --env config=sourcemap",
"sync-chain": "node ./scripts/sync-support-chain.js",
"lint:fix": "eslint --fix --ext .js,.jsx,.ts,.tsx ./src",
"test": "jest",
"pub": "node build/release.js",
"postinstall": "patch-package"
"postinstall": "patch-package && npm run sync-chain"
},
"dependencies": {
"@coinbase/wallet-sdk": "3.8.0-beta.3",
Expand Down Expand Up @@ -54,8 +55,8 @@
"@rabby-wallet/eth-walletconnect-keyring": "2.1.1",
"@rabby-wallet/eth-watch-keyring": "1.0.0",
"@rabby-wallet/gnosis-sdk": "1.3.6",
"@rabby-wallet/page-provider": "^0.3.0",
"@rabby-wallet/rabby-api": "0.7.9",
"@rabby-wallet/page-provider": "0.3.1",
"@rabby-wallet/rabby-api": "0.7.11",
"@rabby-wallet/rabby-security-engine": "1.1.18",
"@rabby-wallet/rabby-swap": "0.0.32",
"@rabby-wallet/widgets": "1.0.9",
Expand Down Expand Up @@ -136,6 +137,7 @@
"ts-toolbelt": "9.6.0",
"url": "0.11.3",
"uuid": "9.0.0",
"viem": "2.9.4",
"web3-eth-abi": "1.7.0",
"web3-utils": "1.7.0",
"webextension-polyfill": "0.7.0"
Expand All @@ -155,8 +157,9 @@
"@types/semver-compare": "1.0.1",
"@types/sinon": "10.0.13",
"@types/webextension-polyfill": "0.10.2",
"@typescript-eslint/eslint-plugin": "5.13.0",
"@typescript-eslint/parser": "4.22.1",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"@typescript-eslint/typescript-estree": "7.1.1",
"@welldone-software/why-did-you-render": "6.2.1",
"antd-dayjs-webpack-plugin": "1.0.6",
"autoprefixer": "latest",
Expand All @@ -165,7 +168,7 @@
"cross-env": "^7.0.3",
"css-loader": "5.1.3",
"enquirer": "2.3.6",
"eslint": "8.10.0",
"eslint": "8.57.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-react-app": "6.0.0",
"eslint-plugin-import": "2.22.1",
Expand Down Expand Up @@ -198,9 +201,9 @@
"ts-jest": "29.1.1",
"ts-loader": "9.1.1",
"tsconfig-paths-webpack-plugin": "3.5.1",
"typescript": "4.5.4",
"typescript": "5.3.3",
"typescript-plugin-styled-components": "2.0.0",
"typescript-transform-paths": "3.0.0",
"typescript-transform-paths": "^3.4.7",
"url-loader": "4.1.1",
"webpack": "5.76.0",
"webpack-bundle-analyzer": "4.4.0",
Expand Down
24 changes: 24 additions & 0 deletions scripts/sync-support-chain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');

const child_process = require('child_process');
const targetPath = path.join(
__dirname,
'../src/constant/default-support-chains.json'
);

const res = child_process.execSync(
'curl -s https://static.debank.com/supported_chains.json'
);
let supported_chains_list = [];
try {
supported_chains_list = JSON.parse(res);
} catch (err) {
console.error('parse remote chain data failed:', err);
}

fs.writeFileSync(targetPath, res);

console.info('finished.');
2 changes: 1 addition & 1 deletion src/@types/i18next.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module 'i18next' {
defaultNS: 'translations';
// custom resources type
resources: {
translations: typeof translations;
translations: typeof translations & Record<string, string>;
};
// other
}
Expand Down
Loading
Loading