-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LIVE-10249] Bugfix - Cardano invalid data supplied (#6682)
* handle tx with no utxos * remove debug log * fix: disable undelegate on amount error * show rewards with decimals at delegation info - handle balance error at undelegate screen * fix: add unit in useMemo hook * fix: Alert component to display error * remove cancel button * unit test for tx status with no utxos * add changeset * fix: error position update --------- Co-authored-by: pavanvora <pavanvora.cs@gmail.com> Co-authored-by: Prashanth <prashanthsoordelu@gmail.com> Co-authored-by: mehulcs <mehul.becs@gmail.com>
- Loading branch information
1 parent
ede5b43
commit 10df676
Showing
9 changed files
with
142 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
"live-mobile": minor | ||
"@ledgerhq/live-common": minor | ||
--- | ||
|
||
Fixed bug regarding invalid data supplied to ledger and added error message for mobile and desktop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libs/ledger-live-common/src/families/cardano/js-getTransactionStatus.unit.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import BigNumber from "bignumber.js"; | ||
import getTransactionStatus from "./js-getTransactionStatus"; | ||
import { CardanoAccount, Transaction } from "./types"; | ||
|
||
describe("getTransactionStatus", () => { | ||
it("should return not enough funds error when there are no utxos", async () => { | ||
const initialAccount = { | ||
pendingOperations: [], | ||
cardanoResources: { | ||
utxos: [], | ||
}, | ||
} as unknown as CardanoAccount; | ||
|
||
const sendTx: Transaction = { | ||
amount: new BigNumber(1000000), | ||
recipient: | ||
"addr1qxqm3nxwzf70ke9jqa2zrtrevjznpv6yykptxnv34perjc8a7zgxmpv5pgk4hhhe0m9kfnlsf5pt7d2ahkxaul2zygrq3nura9", | ||
mode: "send", | ||
family: "cardano", | ||
poolId: undefined, | ||
}; | ||
const sendTxRes = await getTransactionStatus(initialAccount, sendTx); | ||
expect(sendTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds"); | ||
|
||
const delegateTx: Transaction = { | ||
amount: new BigNumber(0), | ||
recipient: "", | ||
mode: "delegate", | ||
family: "cardano", | ||
poolId: "d0f48f07e4e5eb8040a988085f7ea3bd32d71a2e2998d53e9bbc959a", | ||
}; | ||
const delegateTxRes = await getTransactionStatus(initialAccount, delegateTx); | ||
expect(delegateTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds"); | ||
|
||
const undelegateTx: Transaction = { | ||
amount: new BigNumber(0), | ||
recipient: "", | ||
mode: "undelegate", | ||
family: "cardano", | ||
poolId: undefined, | ||
}; | ||
const undelegateTxRes = await getTransactionStatus(initialAccount, undelegateTx); | ||
expect(undelegateTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters