Skip to content

Commit

Permalink
[Issue-1824] Implement TAO inapp staking
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Oct 24, 2024
1 parent e6ded0b commit 2c91f4c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-release-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
17 changes: 16 additions & 1 deletion patches/@subwallet+extension-base+1.2.29-0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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}`;
}
7 changes: 6 additions & 1 deletion src/components/Field/ValidatorSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const textStyle: StyleProp<any> = {
lineHeight: 22,
...FontSemiBold,
color: 'rgba(255, 255, 255, 0.85)',
flex: 1,
};

export const ValidatorSelectorField = ({
Expand Down Expand Up @@ -76,7 +77,11 @@ export const ValidatorSelectorField = ({
return <Text style={textStyle}>{i18n.formatString(i18n.message.selectedXValidator, valueList.length)}</Text>;
}

return <Text style={textStyle}>{valueList[0].split('___')[1] || toShort(valueList[0].split('___')[0])}</Text>;
return (
<Text numberOfLines={1} style={textStyle}>
{valueList[0].split('___')[1] || toShort(valueList[0].split('___')[0])}
</Text>
);
};

return (
Expand Down
12 changes: 11 additions & 1 deletion src/screens/Transaction/Earn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<EarningProps> = (props: EarningProps) => {
const {
route: {
Expand All @@ -118,6 +123,7 @@ const EarnTransaction: React.FC<EarningProps> = (props: EarningProps) => {
const defaultTarget = useRef<string | undefined>(target);
const redirectFromPreviewRef = useRef(!!redirectFromPreview);
const autoCheckCompoundRef = useRef<boolean>(true);
console.log('slug', slug);
const {
title,
form: {
Expand Down Expand Up @@ -692,7 +698,11 @@ const EarnTransaction: React.FC<EarningProps> = (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${
Expand Down

0 comments on commit 2c91f4c

Please sign in to comment.