Skip to content

Commit

Permalink
Update web-runner 1.2.21
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Jul 24, 2024
1 parent 3d6b4d2 commit 4cbd977
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 49 deletions.
2 changes: 1 addition & 1 deletion html/Web.bundle/site/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>SubWallet</title><script inline inline-asset="fallback.js$" inline-asset-delete></script><script inline inline-asset="web-runner.js$" inline-asset-delete></script><script defer="defer" src="fallback-0b81a7f9f3a8fbf3b257.js"></script><script defer="defer" src="web-runner-7ffaa80ed28b67d14b5a.js"></script></head><body><div id="root">SubWallet</div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>SubWallet</title><script inline inline-asset="fallback.js$" inline-asset-delete></script><script inline inline-asset="web-runner.js$" inline-asset-delete></script><script defer="defer" src="fallback-0b81a7f9f3a8fbf3b257.js"></script><script defer="defer" src="web-runner-746f989ae41f8239a235.js"></script></head><body><div id="root">SubWallet</div></body></html>

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"@react-navigation/native": "^6.1.2",
"@react-navigation/native-stack": "^6.9.8",
"@reduxjs/toolkit": "^1.9.2",
"@subwallet/extension-chains": "1.2.18-1",
"@subwallet/extension-dapp": "1.2.18-1",
"@subwallet/extension-chains": "1.2.21-0",
"@subwallet/extension-dapp": "1.2.21-0",
"@subwallet/extension-inject": "^1.2.1",
"@subwallet/keyring": "0.1.5",
"@subwallet/react-ui": "^5.1.2-b77",
Expand Down Expand Up @@ -148,8 +148,8 @@
"@polkadot/types": "^12.0.2",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.11",
"@subwallet/chain-list": "0.2.77",
"@subwallet/extension-base": "1.2.18-1",
"@subwallet/chain-list": "0.2.78",
"@subwallet/extension-base": "1.2.21-0",
"@tsconfig/react-native": "^3.0.0",
"@types/humanize-duration": "^3.27.3",
"@types/jest": "^29.2.3",
Expand Down Expand Up @@ -201,8 +201,8 @@
"@polkadot/api": "^12.0.2",
"@polkadot/util-crypto": "^12.6.2",
"@polkadot/types": "^12.0.2",
"@subwallet/chain-list": "0.2.77",
"@subwallet/extension-base": "1.2.18-1",
"@subwallet/chain-list": "0.2.78",
"@subwallet/extension-base": "1.2.21-0",
"react-native-svg": "^13.6.0",
"sails-js": "0.1.6"
},
Expand Down
32 changes: 19 additions & 13 deletions src/components/Modal/Earning/EarningPoolSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import BigN from 'bignumber.js';
import { FullSizeSelectModal } from 'components/common/SelectModal';
import { EmptyValidator } from 'components/EmptyValidator';
import { getValidatorLabel } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
import { PREDEFINED_EARNING_POOL } from 'constants/stakingScreen';
import { SectionItem } from 'components/LazySectionList';
import { SectionListData } from 'react-native/Libraries/Lists/SectionList';
import { FontSemiBold } from 'styles/sharedStyles';
import { RootState } from 'stores/index';
import { useSelector } from 'react-redux';
import { YieldPoolType } from '@subwallet/extension-base/types';
import DotBadge from 'components/design-system-ui/badge/DotBadge';
import { fetchStaticData } from 'utils/fetchStaticData';

enum EarningPoolGroup {
RECOMMEND = 'recommend',
Expand Down Expand Up @@ -97,8 +97,6 @@ const filterFunction = (items: NominationPoolDataType[], filters: string[]) => {
});
};

const defaultPoolMap = Object.assign({}, PREDEFINED_EARNING_POOL);

const sortingOptions: SortOption[] = [
{
desc: false,
Expand Down Expand Up @@ -164,6 +162,7 @@ export const EarningPoolSelector = forwardRef(
const nominationPoolValueList = useMemo((): string[] => {
return compound?.nominations.map(item => item.validatorAddress) || [];
}, [compound]);
const [defaultPoolMap, setDefaultPoolMap] = useState<Record<string, number[]>>({});

const EarningPoolGroupNameMap = useMemo(
() => ({
Expand All @@ -173,7 +172,7 @@ export const EarningPoolSelector = forwardRef(
[],
);

const defaultSelectPool = defaultPoolMap[chain];
const defaultSelectPool = defaultPoolMap?.[chain];

const groupBy = useMemo(
() => (item: NominationPoolDataTypeItem) => {
Expand All @@ -195,7 +194,7 @@ export const EarningPoolSelector = forwardRef(

const renderSectionHeader = useCallback(
(info: { section: SectionListData<NominationPoolDataTypeItem> }) => {
if (defaultSelectPool) {
if (defaultPoolMap?.[chain] && defaultPoolMap?.[chain].length) {
return (
<View
style={{
Expand Down Expand Up @@ -226,7 +225,7 @@ export const EarningPoolSelector = forwardRef(
return <></>;
}
},
[defaultSelectPool, theme],
[chain, defaultPoolMap, theme],
);

const grouping = useMemo(() => {
Expand All @@ -251,9 +250,9 @@ export const EarningPoolSelector = forwardRef(
return [...items]
.filter(item => item.state !== 'Blocked')
.sort((a: NominationPoolDataType, b: NominationPoolDataType) => {
if (defaultSelectPool) {
const isRecommendedA = defaultSelectPool.includes(a.id);
const isRecommendedB = defaultSelectPool.includes(b.id);
if (defaultPoolMap?.[chain] && defaultPoolMap?.[chain].length) {
const isRecommendedA = defaultPoolMap?.[chain].includes(a.id);
const isRecommendedB = defaultPoolMap?.[chain].includes(b.id);

switch (sortSelection) {
case SortKey.MEMBER:
Expand Down Expand Up @@ -307,14 +306,13 @@ export const EarningPoolSelector = forwardRef(
}
})
.map(item => {
if (PREDEFINED_EARNING_POOL[chain] && PREDEFINED_EARNING_POOL[chain].includes(item.id)) {
if (defaultPoolMap?.[chain] && defaultPoolMap?.[chain].includes(item.id)) {
return { ...item, group: EarningPoolGroup.RECOMMEND };
} else {
return { ...item, group: EarningPoolGroup.OTHERS };
}
});
}, [chain, defaultSelectPool, items, sortSelection]);

}, [chain, defaultPoolMap, items, sortSelection]);
const isDisabled = useMemo(
() => disabled || !!nominationPoolValueList.length || !items.length,
[disabled, items.length, nominationPoolValueList.length],
Expand Down Expand Up @@ -384,6 +382,14 @@ export const EarningPoolSelector = forwardRef(
[onSelectItem],
);

useEffect(() => {
fetchStaticData<Record<string, number[]>>('nomination-pool-recommendation')
.then(earningPoolRecommendation => {
setDefaultPoolMap(earningPoolRecommendation);
})
.catch(console.error);
}, []);

useEffect(() => {
let defaultValue = '';
if (defaultValidatorAddress) {
Expand Down Expand Up @@ -432,7 +438,7 @@ export const EarningPoolSelector = forwardRef(
item={selectedPool}
label={i18n.inputLabel.pool}
loading={poolLoading}
recommendIds={defaultSelectPool}
recommendIds={defaultPoolMap?.[chain]}
/>
)}>
<>
Expand Down
6 changes: 6 additions & 0 deletions src/constants/stakingScreen.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fetchStaticData } from 'utils/fetchStaticData';

export const CHAIN_TYPE_MAP = {
relay: [
'polkadot',
Expand Down Expand Up @@ -34,3 +36,7 @@ export const PREDEFINED_EARNING_POOL: Record<string, number[]> = {
availTuringTest: [11],
avail_mainnet: [30, 12, 4],
};

export const PREDEFINED_EARNING_POOL_PROMISE = fetchStaticData<Record<string, number[]>>(
'nomination-pool-recommendation',
);
54 changes: 27 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4929,19 +4929,19 @@
resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.46.0.tgz#bfe3e6a30d39929f57ecc178acde4e74a773e2b6"
integrity sha512-rBvWnlrBeFTd5LVG7oX3rOHzR16yqyffOFHKmUiVcblpXI3D89CXOvAljW9tWlA1H/2/FegaZnHPhdObPsvi+w==

"@subwallet/[email protected].77":
version "0.2.77"
resolved "https://registry.yarnpkg.com/@subwallet/chain-list/-/chain-list-0.2.77.tgz#436657e3fd91618795766809651ad7fe58c558e8"
integrity sha512-RCjjyD4fV6crNMV0cdZ91obIlIfZmi9aVDFFPABGVHnUUmlvTTfzPCMP4/JSJMvh/qX6QP5VH4EPhRUiIQgIWw==
"@subwallet/[email protected].78":
version "0.2.78"
resolved "https://registry.yarnpkg.com/@subwallet/chain-list/-/chain-list-0.2.78.tgz#e5b3a4769cdbd0442793835978b75a4cb0cd6770"
integrity sha512-lIkGD7S9CKBvRXZykQLkov01t0PJY7pG1WKNiLVegkvSSckDWJoTEMTLSiUBSYZJoXrYmtU4n14SjoYLxONeNw==
dependencies:
"@polkadot/dev" "0.67.167"
"@polkadot/util" "^12.5.1"
eventemitter3 "^5.0.1"

"@subwallet/[email protected].18-1", "@subwallet/extension-base@^1.2.18-1":
version "1.2.18-1"
resolved "https://registry.yarnpkg.com/@subwallet/extension-base/-/extension-base-1.2.18-1.tgz#f0e7f51d49b3d8628498857c057e854a03116d7e"
integrity sha512-XP5EEq7Qi49cth3ZXaB8bGn3JIXzSyQ+NcOsH4ozK1uLmo9pG+FLC767WehfFXipZGmuqkLX41Ihbc6HOFmN7g==
"@subwallet/[email protected].21-0", "@subwallet/extension-base@^1.2.21-0":
version "1.2.21-0"
resolved "https://registry.yarnpkg.com/@subwallet/extension-base/-/extension-base-1.2.21-0.tgz#990e66ad0214fcf05bd4935821672d4397192796"
integrity sha512-5aVGyacG4eOkbWIaAPIbL9O4RMNJE0GzL1K0KFAvHa1Xt8sBD17xwngiJvxV6TYhLKYzJm4uscWkaS6+CETnWg==
dependencies:
"@acala-network/api" "^5.0.2"
"@apollo/client" "^3.7.14"
Expand Down Expand Up @@ -4977,11 +4977,11 @@
"@reduxjs/toolkit" "^1.9.1"
"@sora-substrate/type-definitions" "^1.17.7"
"@substrate/connect" "^0.8.9"
"@subwallet/chain-list" "0.2.77"
"@subwallet/extension-base" "^1.2.18-1"
"@subwallet/extension-chains" "^1.2.18-1"
"@subwallet/extension-dapp" "^1.2.18-1"
"@subwallet/extension-inject" "^1.2.18-1"
"@subwallet/chain-list" "0.2.78"
"@subwallet/extension-base" "^1.2.21-0"
"@subwallet/extension-chains" "^1.2.21-0"
"@subwallet/extension-dapp" "^1.2.21-0"
"@subwallet/extension-inject" "^1.2.21-0"
"@subwallet/keyring" "^0.1.5"
"@subwallet/ui-keyring" "^0.1.5"
"@walletconnect/keyvaluestorage" "^1.1.1"
Expand Down Expand Up @@ -5020,26 +5020,26 @@
web3-eth-contract "^1.10.0"
web3-utils "^1.10.0"

"@subwallet/[email protected].18-1", "@subwallet/extension-chains@^1.2.18-1":
version "1.2.18-1"
resolved "https://registry.yarnpkg.com/@subwallet/extension-chains/-/extension-chains-1.2.18-1.tgz#372e7362b7bd526321b8746172bf817205259011"
integrity sha512-xKB6zc9/EdK+pzBHCpcWd1So5JNciqJxqFrCBeUyyDT6DiWPfaNNcx5Hp+1X9JStWuJY0+4nLCgPXWsWRfIp6Q==
"@subwallet/[email protected].21-0", "@subwallet/extension-chains@^1.2.21-0":
version "1.2.21-0"
resolved "https://registry.yarnpkg.com/@subwallet/extension-chains/-/extension-chains-1.2.21-0.tgz#fc1020ae61cd7783aedaf23460d6a6d3aa1f137d"
integrity sha512-iFDkABxMrqr1l+dzk0TPxscS4xLDqfPV4FomctQBM0a1dlCR49sbkgxyzxYsAf+x8FF0Q//E6NcJbjqsQMEc4w==
dependencies:
"@babel/runtime" "^7.20.6"
"@polkadot/networks" "^12.6.2"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
"@subwallet/extension-inject" "^1.2.18-1"
"@subwallet/extension-inject" "^1.2.21-0"

"@subwallet/[email protected].18-1", "@subwallet/extension-dapp@^1.2.18-1":
version "1.2.18-1"
resolved "https://registry.yarnpkg.com/@subwallet/extension-dapp/-/extension-dapp-1.2.18-1.tgz#96d99cfef68762f6298e1cbab3147f70da364d9d"
integrity sha512-H64nlHq/5/2/ki7nr+M1m42fVFhfk7SSKv/7F8fZtE1HhV9fvnd1YK2BYq1Pc+TryuNe5jxpJ3H/AhMyX4MGOg==
"@subwallet/[email protected].21-0", "@subwallet/extension-dapp@^1.2.21-0":
version "1.2.21-0"
resolved "https://registry.yarnpkg.com/@subwallet/extension-dapp/-/extension-dapp-1.2.21-0.tgz#665d9226b8e03a7ec691756d97c795eb2d5afe34"
integrity sha512-268LzuL997cJ6bpF7rZJPBRLIV6f160tff5zjd65HFRaNdZpLKpkOxqORMZaNumxpwkrjI9ctfH5K0pYlDEnAw==
dependencies:
"@babel/runtime" "^7.20.6"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
"@subwallet/extension-inject" "^1.2.18-1"
"@subwallet/extension-inject" "^1.2.21-0"

"@subwallet/extension-inject@^1.2.1":
version "1.2.1"
Expand All @@ -5054,10 +5054,10 @@
"@polkadot/x-global" "^12.2.1"
web3-core "^1.10.0"

"@subwallet/extension-inject@^1.2.18-1":
version "1.2.18-1"
resolved "https://registry.yarnpkg.com/@subwallet/extension-inject/-/extension-inject-1.2.18-1.tgz#5f807ca064a8ec23d0ac27494df212601c3fb804"
integrity sha512-PZsxuGqgBmJRI1CHxLx5rbgmSPCZkQQ2pp9RFTXP96Bw57iuJMs5sadk8IkTS7kKDdY4c8nQU8so681JFnCXmw==
"@subwallet/extension-inject@^1.2.21-0":
version "1.2.21-0"
resolved "https://registry.yarnpkg.com/@subwallet/extension-inject/-/extension-inject-1.2.21-0.tgz#67a416e0d270b0191e77b287f75b38570646c00f"
integrity sha512-1vXranGiaOMt/cnZ2RnUnihLpek1J0IWL9CoiWKahSv4SlCM8jOqGUnUZEtokHmbDRSJsOnlnDEvlXA0Pbyu8A==
dependencies:
"@babel/runtime" "^7.20.6"
"@polkadot/rpc-provider" "^11.0.3"
Expand Down

0 comments on commit 4cbd977

Please sign in to comment.