From 2c91f4ce35c2746cb64cb8bd05838e33b83385aa Mon Sep 17 00:00:00 2001 From: dominhquang Date: Thu, 24 Oct 2024 19:30:07 +0700 Subject: [PATCH] [Issue-1824] Implement TAO inapp staking --- .github/workflows/build-internal.yml | 2 +- .github/workflows/build-release-mac.yml | 2 +- .../@subwallet+extension-base+1.2.29-0.patch | 17 ++++++++++++++++- .../Field/ValidatorSelector/index.tsx | 7 ++++++- src/screens/Transaction/Earn/index.tsx | 12 +++++++++++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-internal.yml b/.github/workflows/build-internal.yml index 74c140c0a..e8f20997c 100644 --- a/.github/workflows/build-internal.yml +++ b/.github/workflows/build-internal.yml @@ -84,7 +84,7 @@ jobs: # Build IPA file - name: iOS Build Action - uses: yukiarrr/ios-build-action@v1.11.0 + uses: yukiarrr/ios-build-action@v1.12.0 with: project-path: ios/SubWalletMobile.xcodeproj export-method: 'ad-hoc' diff --git a/.github/workflows/build-release-mac.yml b/.github/workflows/build-release-mac.yml index 849faf800..bca69c68d 100644 --- a/.github/workflows/build-release-mac.yml +++ b/.github/workflows/build-release-mac.yml @@ -81,7 +81,7 @@ jobs: # Build IPA file - name: iOS Build Action - uses: yukiarrr/ios-build-action@v1.11.0 + uses: yukiarrr/ios-build-action@v1.12.0 with: project-path: ios/SubWalletMobile.xcodeproj export-method: 'app-store' diff --git a/patches/@subwallet+extension-base+1.2.29-0.patch b/patches/@subwallet+extension-base+1.2.29-0.patch index 719622b8f..b87617cca 100644 --- a/patches/@subwallet+extension-base+1.2.29-0.patch +++ b/patches/@subwallet+extension-base+1.2.29-0.patch @@ -26,7 +26,7 @@ index 0706b51..2ec3b17 100644 export const MaxEraRewardPointsEras = 14; diff --git a/node_modules/@subwallet/extension-base/services/earning-service/utils/index.js b/node_modules/@subwallet/extension-base/services/earning-service/utils/index.js -index ecd2e34..8a4e973 100644 +index ecd2e34..c97682f 100644 --- a/node_modules/@subwallet/extension-base/services/earning-service/utils/index.js +++ b/node_modules/@subwallet/extension-base/services/earning-service/utils/index.js @@ -103,6 +103,8 @@ export function isActionFromValidator(stakingType, chain) { @@ -83,3 +83,18 @@ index 1b57d06..e4132af 100644 }; export const SWAP_QUOTE_TIMEOUT_MAP = { // in milliseconds +diff --git a/node_modules/@subwallet/extension-base/services/transaction-service/utils.js b/node_modules/@subwallet/extension-base/services/transaction-service/utils.js +index 10b1267..c1e9eba 100644 +--- a/node_modules/@subwallet/extension-base/services/transaction-service/utils.js ++++ b/node_modules/@subwallet/extension-base/services/transaction-service/utils.js +@@ -45,6 +45,10 @@ function getBlockExplorerTxRoute(chainInfo) { + export function getExplorerLink(chainInfo, value, type) { + const explorerLink = _getBlockExplorerFromChain(chainInfo); + if (explorerLink && type === 'account') { ++ if (chainInfo.slug === 'bittensor') { ++ return undefined; ++ } ++ + const route = getBlockExplorerAccountRoute(explorerLink); + return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${value}`; + } diff --git a/src/components/Field/ValidatorSelector/index.tsx b/src/components/Field/ValidatorSelector/index.tsx index 0aaa70aba..ccc7b309e 100644 --- a/src/components/Field/ValidatorSelector/index.tsx +++ b/src/components/Field/ValidatorSelector/index.tsx @@ -35,6 +35,7 @@ const textStyle: StyleProp = { lineHeight: 22, ...FontSemiBold, color: 'rgba(255, 255, 255, 0.85)', + flex: 1, }; export const ValidatorSelectorField = ({ @@ -76,7 +77,11 @@ export const ValidatorSelectorField = ({ return {i18n.formatString(i18n.message.selectedXValidator, valueList.length)}; } - return {valueList[0].split('___')[1] || toShort(valueList[0].split('___')[0])}; + return ( + + {valueList[0].split('___')[1] || toShort(valueList[0].split('___')[0])} + + ); }; return ( diff --git a/src/screens/Transaction/Earn/index.tsx b/src/screens/Transaction/Earn/index.tsx index f8cf4408e..f495bc8d8 100644 --- a/src/screens/Transaction/Earn/index.tsx +++ b/src/screens/Transaction/Earn/index.tsx @@ -99,6 +99,11 @@ const SHOW_WARNING_CASES = [ 'KSM___native_staking___kusama', ]; +const DO_NOT_SHOW_VALIDATOR_ALERT_CASES = [ + 'TAO___native_staking___bittensor', + 'TAO___native_staking___bittensor_devnet', +]; + const EarnTransaction: React.FC = (props: EarningProps) => { const { route: { @@ -118,6 +123,7 @@ const EarnTransaction: React.FC = (props: EarningProps) => { const defaultTarget = useRef(target); const redirectFromPreviewRef = useRef(!!redirectFromPreview); const autoCheckCompoundRef = useRef(true); + console.log('slug', slug); const { title, form: { @@ -692,7 +698,11 @@ const EarnTransaction: React.FC = (props: EarningProps) => { const maxCount = poolInfo?.statistic?.maxCandidatePerFarmer ?? 1; const userSelectedPoolCount = poolTarget.split(',').length ?? 1; const label = getValidatorLabel(chain); - if (userSelectedPoolCount < maxCount && label === 'Validator') { + if ( + userSelectedPoolCount < maxCount && + label === 'Validator' && + !DO_NOT_SHOW_VALIDATOR_ALERT_CASES.includes(slug) + ) { return Alert.alert( 'Pay attention!', `You are recommended to choose ${maxCount} validators to optimize your earnings. Do you wish to continue with ${userSelectedPoolCount} validator${