Skip to content

Commit

Permalink
Merge branch 'main' into feat/stake-803-integrate-unstake-method-from…
Browse files Browse the repository at this point in the history
…-sdk
  • Loading branch information
Matt561 authored Oct 24, 2024
2 parents 4a839dd + ea176e9 commit ccebe9b
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 15 deletions.
9 changes: 7 additions & 2 deletions .detoxrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/** @type {Detox.DetoxConfig} */
module.exports = {
artifacts: {
rootDir: "./artifacts/screenshots",
rootDir: "./artifacts",
plugins: {
screenshot: {
shouldTakeAutomaticSnapshots: true,
keepOnlyFailedTestsArtifacts: true,
takeWhen: {
testStart: false,
testDone: false,
}
},
},
video: {
enabled: true, // Enable video recording
keepOnlyFailedTestsArtifacts: true, // Keep only failed tests' videos
},
},
},

testRunner: {
args: {
$0: 'jest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ export class NetworkSettings extends PureComponent {
blockExplorerUrls: [],
selectedRpcEndpointIndex: 0,
blockExplorerUrl: undefined,
blockExplorerUrlForm: undefined,
nickname: undefined,
chainId: undefined,
ticker: undefined,
Expand Down Expand Up @@ -714,7 +715,11 @@ export class NetworkSettings extends PureComponent {
// in an error message in the form.
if (!formChainId.startsWith('0x')) {
try {
endpointChainId = new BigNumber(endpointChainId, 16).toString(10);
const endpointChainIdNumber = new BigNumber(endpointChainId, 16);
if (endpointChainIdNumber.isNaN()) {
throw new Error('Invalid endpointChainId');
}
endpointChainId = endpointChainIdNumber.toString(10);
} catch (err) {
Logger.error(err, {
endpointChainId,
Expand Down Expand Up @@ -1288,10 +1293,21 @@ export class NetworkSettings extends PureComponent {
};

onBlockExplorerItemAdd = async (url) => {
// If URL is empty or undefined, return early
if (!url) {
return;
}

// Check if the URL already exists in blockExplorerUrls
const { blockExplorerUrls } = this.state;
const urlExists = blockExplorerUrls.includes(url);

if (urlExists) {
// If the URL already exists, return early
return;
}

// If the URL doesn't exist, proceed with adding it
await this.setState((prevState) => ({
blockExplorerUrls: [...prevState.blockExplorerUrls, url],
}));
Expand Down Expand Up @@ -1351,6 +1367,7 @@ export class NetworkSettings extends PureComponent {
onBlockExplorerUrlChange = async (url) => {
const { addMode } = this.state;
await this.setState({
blockExplorerUrlForm: url,
blockExplorerUrl: url,
});

Expand Down Expand Up @@ -1486,7 +1503,10 @@ export class NetworkSettings extends PureComponent {
};

closeAddBlockExplorerRpcForm = () => {
this.setState({ showAddBlockExplorerForm: { isVisible: false } });
this.setState({
showAddBlockExplorerForm: { isVisible: false },
blockExplorerUrlForm: undefined,
});
};

closeRpcModal = () => {
Expand Down Expand Up @@ -1603,6 +1623,7 @@ export class NetworkSettings extends PureComponent {
rpcUrlForm,
rpcNameForm,
rpcName,
blockExplorerUrlForm,
} = this.state;
const { route, networkConfigurations } = this.props;
const isCustomMainnet = route.params?.isCustomMainnet;
Expand Down Expand Up @@ -2204,6 +2225,7 @@ export class NetworkSettings extends PureComponent {
ref={this.inputBlockExplorerURL}
style={inputStyle}
autoCapitalize={'none'}
value={blockExplorerUrlForm}
autoCorrect={false}
onChangeText={this.onBlockExplorerUrlChange}
placeholder={strings(
Expand All @@ -2214,23 +2236,28 @@ export class NetworkSettings extends PureComponent {
onSubmitEditing={this.toggleNetworkDetailsModal}
keyboardAppearance={themeAppearance}
/>
{blockExplorerUrl && !isUrl(blockExplorerUrl) && (
<View>
{blockExplorerUrl &&
(!isUrl(blockExplorerUrl) ||
blockExplorerUrls.includes(blockExplorerUrlForm)) && (
<Text style={styles.warningText}>
{strings('app_settings.invalid_block_explorer_url')}
</Text>
</View>
)}
)}

<View style={styles.addRpcNameButton}>
<ButtonPrimary
label={strings('app_settings.add_block_explorer_url')}
size={ButtonSize.Lg}
onPress={() => {
this.onBlockExplorerItemAdd(blockExplorerUrl);
this.onBlockExplorerItemAdd(blockExplorerUrlForm);
}}
width={ButtonWidthTypes.Full}
labelTextVariant={TextVariant.DisplayMD}
isDisabled={!blockExplorerUrl || !isUrl(blockExplorerUrl)}
isDisabled={
!blockExplorerUrl ||
!blockExplorerUrlForm ||
!isUrl(blockExplorerUrl)
}
/>
</View>
</SafeAreaView>
Expand Down
Loading

0 comments on commit ccebe9b

Please sign in to comment.