Skip to content

Commit

Permalink
Merge pull request #3626 from Emurgo/fix/YOEXT-1372/pool-update
Browse files Browse the repository at this point in the history
[5.3.120] pool update fix
  • Loading branch information
vsubhuman authored Sep 13, 2024
2 parents ef246f9 + 4b1c2c7 commit b6b5890
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export const networks = Object.freeze({
NetworkName: 'Cardano Mainnet',
NetworkFeatureName: 'mainnet',
Backend: {
BackendService: environment.isTest() ? 'http://localhost:21000' : 'https://api.yoroiwallet.com',
TokenInfoService: 'https://cdn.yoroiwallet.com',
BackendServiceZero: 'https://yoroi-backend-zero-mainnet.emurgornd.com',
BackendService: environment.isTest()
? 'http://localhost:21000'
: 'https://api.yoroiwallet.com',
TokenInfoService:
'https://cdn.yoroiwallet.com',
BackendServiceZero: 'https://zero.yoroiwallet.com',
},
BaseConfig: ([
Object.freeze({
Expand Down Expand Up @@ -86,8 +89,11 @@ export const networks = Object.freeze({
NetworkName: 'Cardano Preprod Testnet',
NetworkFeatureName: 'preprod',
Backend: {
BackendService: environment.isTest() ? 'http://localhost:21000' : 'https://preprod-backend.yoroiwallet.com',
TokenInfoService: 'https://stage-cdn.yoroiwallet.com',
BackendService: environment.isTest()
? 'http://localhost:21000'
: 'https://preprod-backend.yoroiwallet.com',
TokenInfoService:
'https://stage-cdn.yoroiwallet.com',
BackendServiceZero: 'https://yoroi-backend-zero-preprod.emurgornd.com',
},
BaseConfig: ([
Expand Down Expand Up @@ -122,7 +128,9 @@ export const networks = Object.freeze({
NetworkName: 'Cardano Preview Testnet',
NetworkFeatureName: 'preview',
Backend: {
BackendService: environment.isTest() ? 'http://localhost:21000' : 'https://preview-backend.emurgornd.com',
BackendService: environment.isTest()
? 'http://localhost:21000'
: 'https://preview-backend.emurgornd.com',
TokenInfoService: 'https://stage-cdn.yoroiwallet.com',
BackendServiceZero: 'https://yoroi-backend-zero-preview.emurgornd.com',
},
Expand Down Expand Up @@ -158,8 +166,11 @@ export const networks = Object.freeze({
NetworkName: 'Cardano Sancho Testnet',
NetworkFeatureName: 'sanchonet',
Backend: {
BackendService: environment.isTest() ? 'http://localhost:21000' : 'https://sanchonet-backend.yoroiwallet.com',
TokenInfoService: 'https://stage-cdn.yoroiwallet.com',
BackendService: environment.isTest()
? 'http://localhost:21000'
: 'https://sanchonet-backend.yoroiwallet.com',
TokenInfoService:
'https://stage-cdn.yoroiwallet.com',
BackendServiceZero: 'https://yoroi-backend-zero-sanchonet.emurgornd.com',
},
BaseConfig: ([
Expand Down Expand Up @@ -191,13 +202,10 @@ export const networks = Object.freeze({
}: NetworkRow),
});

export function isTestnet(network: $ReadOnly<NetworkRow>): boolean {
return (
network.NetworkId === networks.CardanoTestnet.NetworkId ||
network.NetworkId === networks.CardanoPreprodTestnet.NetworkId ||
network.NetworkId === networks.CardanoPreviewTestnet.NetworkId ||
network.NetworkId === networks.CardanoSanchoTestnet.NetworkId
);
export function isTestnet(
network: $ReadOnly<NetworkRow>,
): boolean {
return network.NetworkId !== networks.CardanoMainnet.NetworkId;
}

// <TODO:PENDING_REMOVAL> LEGACY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ Object {
Object {
"Backend": Object {
"BackendService": "https://api.yoroiwallet.com",
"BackendServiceZero": "https://yoroi-backend-zero-mainnet.emurgornd.com",
"BackendServiceZero": "https://zero.yoroiwallet.com",
"TokenInfoService": "https://cdn.yoroiwallet.com",
},
"BaseConfig": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ReactComponent as InvalidURIImg } from '../../../assets/images/uri/inva
import ErrorBlock from '../../../components/widgets/ErrorBlock';
import AnnotatedLoader from '../../../components/transfer/AnnotatedLoader';
import DelegationSuccessDialog from '../../../components/wallet/staking/DelegationSuccessDialog';
import type { PoolMeta } from '../../../stores/toplevel/DelegationStore';
import type { PoolMeta, PoolTransition } from '../../../stores/toplevel/DelegationStore';
import { WalletTypeOption } from '../../../api/ada/lib/storage/models/ConceptualWallet/interfaces';
import DelegationTxDialog from '../../../components/wallet/staking/DelegationTxDialog';
import StakePool from '../../../components/wallet/staking/dashboard/StakePool';
Expand All @@ -38,6 +38,7 @@ import { isTestnet } from '../../../api/ada/lib/storage/database/prepackaged/net
type Props = {|
...StoresAndActionsProps,
urlTemplate: ?string,
poolTransition: ?PoolTransition,
|};
type InjectedLayoutProps = {|
+renderLayoutComponent: LayoutComponentMap => Node,
Expand Down Expand Up @@ -68,6 +69,16 @@ class CardanoStakingPage extends Component<AllProps, State> {
this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: true });
};

UNSAFE_componentWillMount(): * {
const suggestedPoolId = this.props.poolTransition?.suggestedPool?.hash;
if (suggestedPoolId != null) {
runInAction(() => {
this.setState(s =>
({ ...s, selectedPoolId: suggestedPoolId }));
});
}
}

async componentWillUnmount() {
this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: false });
this.props.stores.delegation.poolInfoQuery.reset();
Expand Down Expand Up @@ -365,6 +376,9 @@ class CardanoStakingPage extends Component<AllProps, State> {
</Dialog>
);
}
if (this.props.stores.delegation.poolInfoQuery.error != null) {
return this._errorDialog(this.props.stores.delegation.poolInfoQuery.error);
}
if (delegationTransaction.createDelegationTx.isExecuting) {
return (
<Dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class StakingPageContent extends Component<AllProps> {
stores={this.props.stores}
actions={this.props.actions}
urlTemplate={CONFIG.poolExplorer.simpleTemplate}
poolTransition={delegationStore.getPoolTransitionInfo(publicDeriver)}
/>

{uiDialogs.isOpen(OverviewModal) ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export const allCategoriesRevamp: Array<SidebarCategoryRevamp> = [
icon: governanceIcon,
label: globalMessages.sidebarGovernance,
isVisible: ({ selected }) => selected != null && !isTrezorTWallet(selected.getParent()),
featureFlagName: 'governance',
},
{
className: 'settings',
Expand Down
Loading

0 comments on commit b6b5890

Please sign in to comment.