Skip to content

Commit

Permalink
fix(coinmarket): Fix fetching all contract txs for solana
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeWall authored and tomasklim committed Mar 18, 2024
1 parent ee9d6b1 commit f63ada2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const SendCryptoSelect = () => {
const tokenData = tokens?.find(t => t.symbol === invitySymbol);
if (ethereumTypeNetworkSymbols.includes(token)) {
setValue(CRYPTO_TOKEN, null);
// set own account for non ERC20 transaction
setValue('outputs.0.address', account.descriptor);
} else if (symbol === 'sol') {
setValue(CRYPTO_TOKEN, tokenData?.contract ?? null);
setValue('outputs.0.address', account.descriptor);
} else {
// set the address of the token to the output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const CryptoInput = () => {
cryptoSymbol,
};

const { tokens } = account;
const { symbol, tokens } = account;

const cryptoInputRules = {
validate: {
Expand Down Expand Up @@ -113,18 +113,20 @@ const CryptoInput = () => {
setValue(CRYPTO_INPUT, '');
setValue(FIAT_INPUT, '');
const token = selected.value;
const invitySymbol = invityApiSymbolToSymbol(token).toLowerCase();
const tokenData = tokens?.find(
t =>
t.symbol === invitySymbol &&
t.contract === selected.token?.contract,
);
if (ethereumTypeNetworkSymbols.includes(token)) {
setValue(CRYPTO_TOKEN, null);
// set own account for non ERC20 transaction
setValue('outputs.0.address', account.descriptor);
} else if (symbol === 'sol') {
setValue(CRYPTO_TOKEN, tokenData?.contract ?? null);
setValue('outputs.0.address', account.descriptor);
} else {
// set the address of the token to the output
const symbol = invityApiSymbolToSymbol(token).toLowerCase();
const tokenData = tokens?.find(
t =>
t.symbol === symbol &&
t.contract === selected.token?.contract,
);
setValue(CRYPTO_TOKEN, tokenData?.contract ?? null);
// set token address for ERC20 transaction to estimate the fees more precisely
setValue('outputs.0.address', tokenData?.contract ?? '');
Expand Down

0 comments on commit f63ada2

Please sign in to comment.