Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #12040 #12041

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
resolves #12040
  • Loading branch information
12ya committed Oct 28, 2024
commit a82bedbcd36c262614969056c4ee8c4be11b7212
2 changes: 1 addition & 1 deletion app/components/UI/AssetIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const AssetIcon = memo((props: Props) => {
if (!props.logo) return null;

const style = [styles.logo, props.customStyle];
const isImageUrl = isUrl(props.logo) || props.logo.substr(0, 4) === 'ipfs';
const isImageUrl = isUrl(props.logo) || props.logo.substring(0, 5) === 'ipfs';
const source: ImageSourcePropType | null = isImageUrl
? { uri: props.logo }
: null;
Expand Down
4 changes: 2 additions & 2 deletions app/components/UI/PaymentRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,9 @@ class PaymentRequest extends PureComponent {
res = this.handleETHPrimaryCurrency(amount?.replace(',', '.'));
}
const { cryptoAmount, symbol } = res;
if (amount && amount[0] === currencySymbol) amount = amount.substr(1);
if (amount && amount[0] === currencySymbol) amount = amount.substring(1);
if (res.secondaryAmount && res.secondaryAmount[0] === currencySymbol)
res.secondaryAmount = res.secondaryAmount.substr(1);
res.secondaryAmount = res.secondaryAmount.substring(1);
if (amount && amount === '0') amount = undefined;
this.setState({
amount,
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/Ramp/components/AccountSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const AccountSelector = () => {
/>
<Text style={styles.accountText} primary centered numberOfLines={1}>
{selectedInternalAccount.metadata.name.length > 13
? `${selectedInternalAccount.metadata.name.substr(0, 13)}...`
? `${selectedInternalAccount.metadata.name.substring(0, 14)}...`
: selectedInternalAccount.metadata.name}{' '}
(
<EthereumAddress
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/SeedPhraseVideo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const styles = StyleSheet.create({

const SeedPhraseVideo = ({ style, onClose }) => {
const [showVideo, setShowVideo] = useState(false);
const language = I18n.locale.substr(0, 2);
const language = I18n.locale.substring(0, 3);

useEffect(() => {
InteractionManager.runAfterInteractions(() => {
Expand Down
2 changes: 1 addition & 1 deletion app/components/Views/QRScanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const QRScanner = ({
) {
shouldReadBarCodeRef.current = false;
data = {
private_key: content.length === 64 ? content : content.substr(2),
private_key: content.length === 64 ? content : content.substring(2),
};
} else if (content.substring(0, 2).toLowerCase() === '0x') {
shouldReadBarCodeRef.current = false;
Expand Down
2 changes: 1 addition & 1 deletion app/components/Views/Settings/GeneralSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Settings extends PureComponent {
};

state = {
currentLanguage: I18n.locale.substr(0, 2),
currentLanguage: I18n.locale.substring(0, 3),
languages: {},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ class TransactionEditor extends PureComponent {
await this.setState({ toFocused: true });
const validated = !(await this.validate());
if (validated) {
if (data && data.substr(0, 2) !== '0x') {
if (data && data.substring(0, 3) !== '0x') {
this.handleUpdateData(addHexPrefix(data));
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/lib/ens-ipfs/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ function getRegistryForChainId(chainId) {

export function isGatewayUrl(urlObj) {
// All IPFS gateway urls start with the path /ipfs/
if (urlObj.pathname.substr(0, 6) === '/ipfs/') return true;
if (urlObj.pathname.substring(0, 7) === '/ipfs/') return true;
// All Swarm gateway urls start with the path /bzz:/
if (urlObj.pathname.substr(0, 6) === '/bzz:/') return true;
if (urlObj.pathname.substring(0, 7) === '/bzz:/') return true;
// All IPNS gateway urls start with the path /ipns/
if (urlObj.pathname.substr(0, 6) === '/ipns/') return true;
if (urlObj.pathname.substring(0, 7) === '/ipns/') return true;

return false;
}
6 changes: 3 additions & 3 deletions app/util/address/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export async function importAccountFromPrivateKey(private_key: string) {
// Import private key
let pkey = private_key;
// Handle PKeys with 0x
if (pkey.length === 66 && pkey.substr(0, 2) === '0x') {
pkey = pkey.substr(2);
if (pkey.length === 66 && pkey.substring(0, 3) === '0x') {
pkey = pkey.substring(2);
}
const importedAccountAddress =
await KeyringController.importAccountWithStrategy(
Expand Down Expand Up @@ -321,7 +321,7 @@ export function isENS(name: string | undefined = undefined) {
const tld =
index &&
index >= OFFSET &&
tlc(name.substr(index + OFFSET, name.length - OFFSET));
tlc(name.substring(index + OFFSET, name.length - OFFSET + 1));
if (index && tld && !!match) return true;
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions app/util/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ export function generateApprovalData(opts) {

export function decodeApproveData(data) {
return {
spenderAddress: addHexPrefix(data.substr(34, 40)),
encodedAmount: data.substr(74, 138),
spenderAddress: addHexPrefix(data.substring(34, 41)),
encodedAmount: data.substring(74, 139),
};
}

Expand Down Expand Up @@ -321,7 +321,7 @@ export async function getMethodData(data) {
return { name: TOKEN_METHOD_INCREASE_ALLOWANCE };
} else if (fourByteSignature === SET_APPROVAL_FOR_ALL_SIGNATURE) {
return { name: TOKEN_METHOD_SET_APPROVAL_FOR_ALL };
} else if (data.substr(0, 32) === CONTRACT_CREATION_SIGNATURE) {
} else if (data.substring(0, 33) === CONTRACT_CREATION_SIGNATURE) {
return { name: CONTRACT_METHOD_DEPLOY };
}
// If it's a new method, use on-chain method registry
Expand Down Expand Up @@ -746,7 +746,7 @@ export const calculateEIP1559Times = ({
}

try {
const language = I18n.locale.substr(0, 2);
const language = I18n.locale.substring(0, 3);

const timeParams = {
language,
Expand Down
Loading