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

Adjust transaction list #3488

Merged
merged 3 commits into from
Feb 6, 2025
Merged
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
2 changes: 1 addition & 1 deletion src/popup/components/Tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineComponent({
* Array of tokens that is returned by the transactionTokenInfoResolvers
*/
tokens: { type: Array as PropType<ITokenResolved[]>, required: true },
symbolLength: { type: Number, default: 11 },
symbolLength: { type: Number, default: 10 },
doubleSymbolLength: { type: Number, default: 5 },
/**
* TODO if protocol is not set, assume AE, but this should be set correctly
Expand Down
2 changes: 2 additions & 0 deletions src/popup/components/TransactionAssetRows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export default defineComponent({

.amount {
@extend %face-sans-18-regular;

font-size: var(--font-size);
}
}
}
Expand Down
39 changes: 32 additions & 7 deletions src/protocols/aeternity/helpers/transactionTokenInfoResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,40 @@ const sell: TransactionResolver = (transaction, tokens = null, tokenAddressMappe
const createCommunity: TransactionResolver = (
transaction,
tokens = null,
tokenAddressMapper = undefined,
) => {
const isConfirm = !transaction.tx.return;
const token = {
amount: transaction.tx.arguments?.[2]?.value,
const { internalEvents } = transaction.tx;
const additionalTokenEvents = internalEvents?.filter(({ type, payload: { recipientId } }) => (
ACTIVITIES_TYPES.aex9TransferEvent === type
&& transaction.tx.callerId === recipientId
));

let receivedTokens = additionalTokenEvents?.map(({
payload: {
tokenSymbol, amount, contractId,
},
}) => ({
amount,
...defaultToken,
symbol: transaction.tx.arguments?.[1]?.value,
...(isConfirm ? {} : tokens?.[transaction.tx.log?.[2]?.address]),
symbol: tokenSymbol,
...(tokens?.[contractId] || {}),
isReceived: true,
};
}));

const tokenAddress: string | undefined = tokenAddressMapper?.(
transaction.tx.return?.value[1]?.value,
);

if (!receivedTokens?.length) {
receivedTokens = [{
amount: transaction.tx.arguments?.[2]?.value,
...defaultToken,
symbol: transaction.tx.arguments?.[1]?.value,
...(tokenAddress ? tokens?.[tokenAddress] : {}),
isReceived: true,
}];
}

const aeToken = {
...defaultToken,
assetType: ASSET_TYPES.coin,
Expand All @@ -456,7 +481,7 @@ const createCommunity: TransactionResolver = (
isReceived: false,
};
return {
tokens: [token, aeToken],
tokens: [...(receivedTokens || []), aeToken],
};
};

Expand Down
7 changes: 6 additions & 1 deletion src/protocols/aeternity/views/TransactionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ import {
import {
useAccounts,
useFungibleTokens,
useLatestTransactionList,
useMultisigAccounts,
useTransactionData,
useTransactionList,
Expand Down Expand Up @@ -247,6 +248,7 @@ export default defineComponent({
const { activeAccount, isLocalAccountAddress } = useAccounts();
const { setLoaderVisible } = useUi();
const { getTxAmountTotal, tokenBalances } = useFungibleTokens();
const { allLatestTransactions } = useLatestTransactionList();

const hash = route.params.hash as string;
const transactionOwner = route.params.transactionOwner as Encoded.AccountAddress;
Expand Down Expand Up @@ -342,7 +344,10 @@ export default defineComponent({
});

onMounted(async () => {
let rawTransaction: ITransaction | undefined = transactionsLoaded.value
let rawTransaction: ITransaction | undefined = [
...transactionsLoaded.value,
...allLatestTransactions.value,
]
.find((tx) => tx.hash === hash) as ITransaction;

// Claim transactions have missing data that needs to be fetched from the middleware
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function calculateFontSize(amountValue: BigNumber | number | string) {
return '16px';
}
if (amountLength <= 14) {
return '14px';
return '13px';
}
return '12px';
}
Expand Down
Loading