diff --git a/libs/ledger-live-common/src/families/solana/__snapshots__/bridge.integration.test.ts.snap b/libs/ledger-live-common/src/families/solana/__snapshots__/bridge.integration.test.ts.snap index 9f6a8560ac59..eb97168910d8 100644 --- a/libs/ledger-live-common/src/families/solana/__snapshots__/bridge.integration.test.ts.snap +++ b/libs/ledger-live-common/src/families/solana/__snapshots__/bridge.integration.test.ts.snap @@ -157,7 +157,7 @@ exports[`solana currency bridge scanAccounts solana seed 1 2`] = ` "blockHeight": 108521109, "contract": undefined, "extra": {}, - "fee": "0", + "fee": "5000", "hasFailed": false, "hash": "A29zPnK1jPr2tGziTnaAvSnadYR2kLCv9sPywj9FJsaEFjtpwmUonspN3WJgz4u6XWmjtVpoFsDrygEnvW51cgk", "id": "js:2:solana:AQbkEagmPgmsdAfS4X8V8UyJnXXjVPMvjeD15etqQ3Jh:solanaMain+8RtwWeqdFz4EFuZU3MAadfYMWSdRMamjFrfq6BXkHuNN-A29zPnK1jPr2tGziTnaAvSnadYR2kLCv9sPywj9FJsaEFjtpwmUonspN3WJgz4u6XWmjtVpoFsDrygEnvW51cgk-IN", diff --git a/libs/ledger-live-common/src/families/solana/js-synchronization.ts b/libs/ledger-live-common/src/families/solana/js-synchronization.ts index a6e72f1c0bfd..e39d2eb717bd 100644 --- a/libs/ledger-live-common/src/families/solana/js-synchronization.ts +++ b/libs/ledger-live-common/src/families/solana/js-synchronization.ts @@ -438,10 +438,16 @@ function txToTokenAccOperation( return undefined; } + const { message } = tx.parsed.transaction; const assocTokenAccIndex = tx.parsed.transaction.message.accountKeys.findIndex(v => v.pubkey.equals(assocTokenAcc.onChainAcc.pubkey), ); + const accountOwner = assocTokenAcc.info.owner.toBase58(); + const accountOwnerIndex = message.accountKeys.findIndex( + pma => pma.pubkey.toBase58() === accountOwner, + ); + if (assocTokenAccIndex < 0) { return undefined; } @@ -456,9 +462,13 @@ function txToTokenAccOperation( new BigNumber(preTokenBalance?.uiTokenAmount.amount ?? 0), ); + const isFeePayer = accountOwnerIndex === 0; + const txFee = new BigNumber(tx.parsed.meta.fee); + const opType = getTokenAccOperationType({ tx: tx.parsed.transaction, delta }); const txHash = tx.info.signature; + const opFee = isFeePayer ? txFee : new BigNumber(0); const { senders, recipients } = getTokenSendersRecipients(tx); @@ -469,7 +479,7 @@ function txToTokenAccOperation( hash: txHash, date: new Date(tx.info.blockTime * 1000), blockHeight: tx.info.slot, - fee: new BigNumber(0), + fee: opFee, recipients, senders, value: delta.abs(),