select first token of the list instead of SRM

This commit is contained in:
juan 2021-03-11 16:17:40 -05:00
parent 684d922ab3
commit 25f678add6
3 changed files with 4 additions and 4 deletions

View File

@ -145,7 +145,6 @@ export const TokenSelectModal = (props: {
)} )}
</AutoSizer> </AutoSizer>
</div> </div>
{/*<div className={'assets-scroll'}>{[...renderTokensChain]}</div>*/}
</Modal> </Modal>
</> </>
); );

View File

@ -161,7 +161,7 @@ export const Transfer = () => {
<Button <Button
type="primary" type="primary"
className="swap-button" className="swap-button"
style={{ paddingLeft: '11px' }} style={{ padding: 0 }}
disabled={false} disabled={false}
onClick={() => { onClick={() => {
const from = A.chain; const from = A.chain;

View File

@ -50,7 +50,7 @@ export const toChainSymbol = (chain: number | null) => {
function getDefaultTokens(tokens: TokenInfo[], search: string) { function getDefaultTokens(tokens: TokenInfo[], search: string) {
let defaultChain = 'ETH'; let defaultChain = 'ETH';
let defaultToken = 'SRM'; let defaultToken = tokens[0].symbol;
const nameToToken = tokens.reduce((map, item) => { const nameToToken = tokens.reduce((map, item) => {
map.set(item.symbol, item); map.set(item.symbol, item);
@ -61,7 +61,7 @@ function getDefaultTokens(tokens: TokenInfo[], search: string) {
const urlParams = new URLSearchParams(search); const urlParams = new URLSearchParams(search);
const from = urlParams.get('from'); const from = urlParams.get('from');
defaultChain = from === 'SOL' ? from : 'ETH'; defaultChain = from === 'SOL' ? from : 'ETH';
const token = urlParams.get('token') || 'SRM'; const token = urlParams.get('token') || defaultToken;
if (nameToToken.has(token) || isValidAddress(token)) { if (nameToToken.has(token) || isValidAddress(token)) {
defaultToken = token; defaultToken = token;
} }
@ -137,6 +137,7 @@ export function TokenChainPairProvider({ children = null as any }) {
// Updates tokens on location change // Updates tokens on location change
useEffect(() => { useEffect(() => {
if ( if (
!tokens.length ||
(!location.search && mintAddress) || (!location.search && mintAddress) ||
location.pathname.indexOf('move') < 0 location.pathname.indexOf('move') < 0
) { ) {