Skip to content

Commit

Permalink
fix: [ADN-400] Fix transfer not working on additional accounts (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss authored Jan 31, 2024
2 parents bc28add + 65ca99e commit be36531
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ const TransferSummaryContainer: React.FC = () => {
if (!isNativeTokenModel(tokenMetainfo)) {
return;
}
const sendAmount = `${BigNumber(transferAmount.value).shiftedBy(tokenMetainfo.decimals)}${
tokenMetainfo.denom
}`;
const sendAmount = `${BigNumber(transferAmount.value).shiftedBy(tokenMetainfo.decimals)}${tokenMetainfo.denom
}`;
return TransactionMessage.createMessageOfBankSend({
fromAddress: currentAddress || '',
toAddress,
Expand Down Expand Up @@ -97,8 +96,13 @@ const TransferSummaryContainer: React.FC = () => {
return null;
}

const { signed } = await transactionService.createTransaction(wallet, document);
return transactionService.sendTransaction(wallet, currentAccount, signed);
const walletInstance = wallet.clone();
walletInstance.currentAccountId = currentAccount.id;
const { signed } = await transactionService.createTransaction(walletInstance, document);
return transactionService.sendTransaction(walletInstance, currentAccount, signed).catch(e => {
console.error(e);
return null;
});
}, [summaryInfo, currentAccount, currentNetwork]);

const hasNetworkFee = useCallback(async () => {
Expand Down Expand Up @@ -131,8 +135,10 @@ const TransferSummaryContainer: React.FC = () => {

const transferByCommon = useCallback(async () => {
try {
await createTransaction();
navigate(RoutePath.History);
const result = await createTransaction();
if (result) {
navigate(RoutePath.History);
}
} catch (e) {
if (!(e instanceof Error)) {
return false;
Expand Down

0 comments on commit be36531

Please sign in to comment.