Skip to content

Commit

Permalink
Merge branch 'main' into release/android
Browse files Browse the repository at this point in the history
  • Loading branch information
juanolmedo1 committed Jul 5, 2023
2 parents adc30ed + ddbe4ce commit 6ba2784
Show file tree
Hide file tree
Showing 44 changed files with 501 additions and 1,230 deletions.
30 changes: 30 additions & 0 deletions source/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AvalancheChainId, AvalancheChainValue, BSCChainId, BSCChainValue, EthChainId, EthChainValue, PolygonChainId, PolygonChainValue } from 'scripts/Background/controllers/EVMChainController/types';
import { StargazerChain } from 'scripts/common';
import {
isProd,
isNative,
Expand Down Expand Up @@ -41,6 +42,7 @@ export const DAG_NETWORK: {
testnet: boolean;
explorer: string;
chainId: number;
hexChainId: string;
logo: string;
network: string;
config: {
Expand All @@ -58,6 +60,7 @@ export const DAG_NETWORK: {
testnet: false,
explorer: 'https://mainnet.dagexplorer.io',
chainId: 1,
hexChainId: '0x1',
logo: CONSTELLATION_LOGO,
network: 'Constellation',
config: {
Expand All @@ -73,6 +76,7 @@ export const DAG_NETWORK: {
testnet: true,
explorer: 'https://testnet.dagexplorer.io',
chainId: 3,
hexChainId: '0x3',
logo: CONSTELLATION_LOGO,
network: 'Constellation',
config: {
Expand All @@ -90,11 +94,13 @@ export const ETH_NETWORK: {
label: string;
explorer: string;
chainId: number;
hexChainId: string;
rpcEndpoint: string;
explorerAPI: string;
nativeToken: string;
mainnet: string;
network: string;
networkId: string;
logo: string;
};
} = {
Expand All @@ -106,9 +112,11 @@ export const ETH_NETWORK: {
explorer: 'https://etherscan.io/',
explorerAPI: 'https://api.etherscan.io',
chainId: 1,
hexChainId: '0x1',
nativeToken: 'ETH',
mainnet: 'mainnet',
network: 'Ethereum',
networkId: StargazerChain.ETHEREUM,
logo: ETHEREUM_LOGO,
},
goerli: {
Expand All @@ -119,9 +127,11 @@ export const ETH_NETWORK: {
explorer: 'https://goerli.etherscan.io/',
explorerAPI: 'https://api-goerli.etherscan.io',
chainId: 5,
hexChainId: '0x5',
nativeToken: 'ETH',
mainnet: 'mainnet',
network: 'Ethereum',
networkId: StargazerChain.ETHEREUM,
logo: ETHEREUM_LOGO,
},
};
Expand All @@ -133,11 +143,13 @@ export const AVALANCHE_NETWORK: {
label: string;
explorer: string;
chainId: number;
hexChainId: string;
rpcEndpoint: string;
explorerAPI: string;
nativeToken: string;
mainnet: string;
network: string;
networkId: string;
logo: string;
};
} = {
Expand All @@ -149,9 +161,11 @@ export const AVALANCHE_NETWORK: {
explorer: 'https://snowtrace.io/',
explorerAPI: 'https://api.snowtrace.io',
chainId: 43114,
hexChainId: '0xa86a',
nativeToken: 'AVAX',
mainnet: 'avalanche-mainnet',
network: 'Avalanche',
networkId: StargazerChain.AVALANCHE,
logo: AVALANCHE_LOGO,
},
['avalanche-testnet']: {
Expand All @@ -162,9 +176,11 @@ export const AVALANCHE_NETWORK: {
explorer: 'https://testnet.snowtrace.io/',
explorerAPI: 'https://api-testnet.snowtrace.io',
chainId: 43113,
hexChainId: '0xa869',
nativeToken: 'AVAX',
mainnet: 'avalanche-mainnet',
network: 'Avalanche',
networkId: StargazerChain.AVALANCHE,
logo: AVALANCHE_LOGO,
},
};
Expand All @@ -176,11 +192,13 @@ export const BSC_NETWORK: {
label: string;
explorer: string;
chainId: number;
hexChainId: string;
rpcEndpoint: string;
explorerAPI: string;
nativeToken: string;
mainnet: string;
network: string;
networkId: string;
logo: string;
};
} = {
Expand All @@ -192,9 +210,11 @@ export const BSC_NETWORK: {
explorer: 'https://bscscan.com/',
explorerAPI: 'https://api.bscscan.com',
chainId: 56,
hexChainId: '0x38',
nativeToken: 'BNB',
mainnet: 'bsc',
network: 'BSC',
networkId: StargazerChain.BSC,
logo: BSC_LOGO,
},
['bsc-testnet']: {
Expand All @@ -205,9 +225,11 @@ export const BSC_NETWORK: {
explorer: 'https://testnet.bscscan.com/',
explorerAPI: 'https://api-testnet.bscscan.com',
chainId: 97,
hexChainId: '0x61',
nativeToken: 'BNB',
mainnet: 'bsc',
network: 'BSC',
networkId: StargazerChain.BSC,
logo: BSC_LOGO,
},
};
Expand All @@ -219,11 +241,13 @@ export const POLYGON_NETWORK: {
label: string;
explorer: string;
chainId: number;
hexChainId: string;
rpcEndpoint: string;
explorerAPI: string;
nativeToken: string;
mainnet: string;
network: string;
networkId: string;
logo: string;
};
} = {
Expand All @@ -235,9 +259,11 @@ export const POLYGON_NETWORK: {
explorer: 'https://polygonscan.com/',
explorerAPI: 'https://api.polygonscan.com',
chainId: 137,
hexChainId: '0x89',
nativeToken: 'MATIC',
mainnet: 'matic',
network: 'Polygon',
networkId: StargazerChain.POLYGON,
logo: POLYGON_LOGO,
},
maticmum: {
Expand All @@ -248,9 +274,11 @@ export const POLYGON_NETWORK: {
explorer: 'https://mumbai.polygonscan.com/',
explorerAPI: 'https://api-testnet.polygonscan.com',
chainId: 80001,
hexChainId: '0x13881',
nativeToken: 'MATIC',
mainnet: 'matic',
network: 'Polygon',
networkId: StargazerChain.POLYGON,
logo: POLYGON_LOGO,
},
};
Expand Down Expand Up @@ -280,6 +308,8 @@ export const ALL_EVM_CHAINS = {
...POLYGON_NETWORK
};

export const SUPPORTED_HEX_CHAINS = ['0x1', '0x5', '0xa86a', '0xa869', '0x89', '0x13881', '0x38', '0x61'];

export const ASSET_PRICE_API = 'https://pro-api.coingecko.com/api/v3/simple/price';
export const TOKEN_INFO_API =
'https://pro-api.coingecko.com/api/v3/coins';
Expand Down
4 changes: 2 additions & 2 deletions source/native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ android {
applicationId "com.stargazer"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 45
versionName "1.7.2"
versionCode 47
versionName "1.7.3"
missingDimensionStrategy 'react-native-camera', 'general'
}
lintOptions {
Expand Down
2 changes: 1 addition & 1 deletion source/native/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -711,4 +711,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 01d71cb6b5ae3009064aff818e13ad54c5e76ad5

COCOAPODS: 1.12.0
COCOAPODS: 1.12.1
8 changes: 4 additions & 4 deletions source/native/ios/Stargazer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 68;
CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = 2GT6926NM6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Stargazer/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.7.2;
MARKETING_VERSION = 1.7.3;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -556,14 +556,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 68;
CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = 2GT6926NM6;
INFOPLIST_FILE = Stargazer/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.7.2;
MARKETING_VERSION = 1.7.3;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
26 changes: 10 additions & 16 deletions source/scenes/external/SignatureRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ import styles from './index.module.scss';

import walletsSelectors from 'selectors/walletsSelectors'
import { StargazerProvider, StargazerSignatureRequest } from 'scripts/Provider/StargazerProvider';
import { StargazerChain } from 'scripts/common';
import { EthereumProvider } from 'scripts/Provider/EthereumProvider';
import { PolygonProvider } from 'scripts/Provider/PolygonProvider';
import { BinanceSmartChainProvider } from 'scripts/Provider/BinanceSmartChainProvider';
import { AvalancheProvider } from 'scripts/Provider/AvalancheProvider';
import { ProtocolProvider } from 'scripts/common';
import { EVMProvider } from 'scripts/Provider/EVMProvider';

//////////////////////
// Component
Expand All @@ -43,18 +40,15 @@ const SignatureRequest = () => {

const { data: stringData } = queryString.parse(location.search);

const { signatureRequestEncoded, asset, chain, chainLabel }:
{ signatureRequestEncoded: string, asset: string, chain: string, chainLabel: string } = JSON.parse(stringData as string);
const { signatureRequestEncoded, asset, provider, chainLabel }:
{ signatureRequestEncoded: string, asset: string, provider: string, chainLabel: string } = JSON.parse(stringData as string);
// TODO-349: Check how signature should work here
const PROVIDERS: { [chain: string]: StargazerProvider | EthereumProvider | PolygonProvider | BinanceSmartChainProvider | AvalancheProvider } = {
[StargazerChain.CONSTELLATION]: controller.stargazerProvider,
[StargazerChain.ETHEREUM]: controller.ethereumProvider,
[StargazerChain.POLYGON]: controller.polygonProvider,
[StargazerChain.BSC]: controller.bscProvider,
[StargazerChain.AVALANCHE]: controller.avalancheProvider,
const PROVIDERS: { [provider: string]: StargazerProvider | EVMProvider } = {
[ProtocolProvider.CONSTELLATION]: controller.stargazerProvider,
[ProtocolProvider.ETHEREUM]: controller.ethereumProvider,
}
const provider = PROVIDERS[chain];
const account = provider.getAssetByType(asset === 'DAG' ? AssetType.Constellation : AssetType.Ethereum);
const providerInstance = PROVIDERS[provider];
const account = providerInstance.getAssetByType(asset === 'DAG' ? AssetType.Constellation : AssetType.Ethereum);
const signatureRequest = JSON.parse(window.atob(signatureRequestEncoded)) as StargazerSignatureRequest;


Expand All @@ -75,7 +69,7 @@ const SignatureRequest = () => {

const onPositiveButtonClick = async () => {
const message = asset === 'DAG' ? signatureRequestEncoded : signatureRequest.content;
const signature = provider.signMessage(message);
const signature = providerInstance.signMessage(message);

const background = await browser.runtime.getBackgroundPage();

Expand Down
3 changes: 1 addition & 2 deletions source/scenes/home/Home/Home.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const HomeContainer: FC<IHome> = ({ navigation, route }) => {
const [balanceObject] = useTotalBalance();

const { supportedAssets }: IProvidersState = useSelector((state: RootState) => state.providers);
const { activeWallet, wallets, currentNetwork }: IVaultState = useSelector((state: RootState) => state.vault);
const { activeWallet, wallets }: IVaultState = useSelector((state: RootState) => state.vault);
const linkTo = useLinkTo();
const accountController = getAccountController();
const isDagOnlyWallet = (activeWallet?.assets?.length === 1 && activeWallet?.assets[0]?.type === AssetType.Constellation);
Expand Down Expand Up @@ -98,7 +98,6 @@ const HomeContainer: FC<IHome> = ({ navigation, route }) => {
isDagOnlyWallet={isDagOnlyWallet}
multiChainWallets={multiChainWallets}
privateKeyWallets={privateKeyWallets}
currentNetwork={currentNetwork}
/>
</Container>
);
Expand Down
35 changes: 0 additions & 35 deletions source/scenes/home/Home/Home.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import BackgroundTimer from 'react-native-background-timer';
///////////////////////////

import WalletsModal from './WalletsModal';
// import NetworksModal from './NetworksModal';
import Sheet from 'components/Sheet';
// import NetworkPicker from 'components/NetworkPicker';
import ButtonV3, { BUTTON_TYPES_ENUM, BUTTON_SIZES_ENUM } from 'components/ButtonV3';
import TextV3 from 'components/TextV3';
import AssetsPanel from './AssetsPanel';
Expand Down Expand Up @@ -51,7 +49,6 @@ import {
BUY_STRING,
SWAP_STRING
} from './constants';
// import { ALL_MAINNET_CHAINS, ALL_TESTNETS_CHAINS, ALL_CHAINS } from 'constants/index';

const ACTIVITY_INDICATOR_SIZE = 'large';
const ACTIVITY_INDICATOR_COLOR = '#FFF';
Expand All @@ -71,13 +68,11 @@ const Home: FC<IHome> = ({
isDagOnlyWallet,
multiChainWallets,
privateKeyWallets,
currentNetwork,
onBuyPressed,
onSwapPressed
}) => {

const [isWalletSelectorOpen, setIsWalletSelectorOpen] = useState(false);
// const [isNetworkSelectorOpen, setIsNetworkSelectorOpen] = useState(false);

const accountController = getAccountController();
const walletController = getWalletController();
Expand All @@ -90,11 +85,6 @@ const Home: FC<IHome> = ({
await walletController.notifyWalletChange(accounts);
};

// const handleSwitchActiveNetwork = async (chainId: string) => {
// setIsNetworkSelectorOpen(false);
// await walletController.switchActiveNetwork(chainId);
// }

const renderHeaderTitle = () => {
const ArrowIcon = isWalletSelectorOpen ? ArrowUpIcon : ArrowDownIcon;
return (
Expand Down Expand Up @@ -155,22 +145,11 @@ const Home: FC<IHome> = ({
}
}, [AppState.currentState]);

// const networkTitle = ALL_MAINNET_CHAINS?.find((chain) => chain.id === currentNetwork)?.network || ALL_TESTNETS_CHAINS?.find((chain) => chain.id === currentNetwork)?.label;
// const networkLogo = ALL_CHAINS.find((chain) => chain.id === currentNetwork)?.logo;

return (
<View style={styles.container}>
<ScrollView style={styles.scrollView} contentContainerStyle={styles.scrollViewContentContainer}>
{activeWallet ? (
<>
{/* <View style={styles.networkPickerContainer}>
<NetworkPicker
title={networkTitle}
icon={networkLogo}
onPress={() => setIsNetworkSelectorOpen(true)}
isOpen={isNetworkSelectorOpen}
/>
</View> */}
<View style={styles.fiatBalanceContainer}>
<View style={styles.fiatBalance}>
<TextV3.Body extraStyles={styles.fiatType}>{balanceObject.symbol}</TextV3.Body>
Expand Down Expand Up @@ -224,20 +203,6 @@ const Home: FC<IHome> = ({
handleSwitchWallet={handleSwitchWallet}
/>
</Sheet>
{/* <Sheet
isVisible={isNetworkSelectorOpen}
onClosePress={() => setIsNetworkSelectorOpen(false)}
height='65%'
title={{
label: 'Switch network',
align: 'left',
}}
>
<NetworksModal
currentNetwork={currentNetwork}
handleSwitchActiveNetwork={handleSwitchActiveNetwork}
/>
</Sheet> */}
</View>
);
};
Expand Down
Loading

0 comments on commit 6ba2784

Please sign in to comment.