diff --git a/dapp/manifests/ledger-live/ledger-live-manifest-development.json b/dapp/manifests/ledger-live/ledger-live-manifest-development.json index fbea240e6..649115b55 100644 --- a/dapp/manifests/ledger-live/ledger-live-manifest-development.json +++ b/dapp/manifests/ledger-live/ledger-live-manifest-development.json @@ -23,6 +23,7 @@ "account.list", "bitcoin.getAddress", "bitcoin.getPublicKey", + "transaction.signAndBroadcast", "custom.acre.messageSign", "custom.acre.transactionSignAndBroadcast" ], diff --git a/dapp/manifests/ledger-live/ledger-live-manifest-mainnet.json b/dapp/manifests/ledger-live/ledger-live-manifest-mainnet.json index eb892f6cc..a24319deb 100644 --- a/dapp/manifests/ledger-live/ledger-live-manifest-mainnet.json +++ b/dapp/manifests/ledger-live/ledger-live-manifest-mainnet.json @@ -23,6 +23,7 @@ "account.list", "bitcoin.getAddress", "bitcoin.getPublicKey", + "transaction.signAndBroadcast", "custom.acre.messageSign", "custom.acre.transactionSignAndBroadcast" ], diff --git a/dapp/manifests/ledger-live/ledger-live-manifest-testnet.json b/dapp/manifests/ledger-live/ledger-live-manifest-testnet.json index 9e5c4bf86..06dc73564 100644 --- a/dapp/manifests/ledger-live/ledger-live-manifest-testnet.json +++ b/dapp/manifests/ledger-live/ledger-live-manifest-testnet.json @@ -23,6 +23,7 @@ "account.list", "bitcoin.getAddress", "bitcoin.getPublicKey", + "transaction.signAndBroadcast", "custom.acre.messageSign", "custom.acre.transactionSignAndBroadcast" ], diff --git a/dapp/manifests/ledger-live/ledger-manifest-template.json b/dapp/manifests/ledger-live/ledger-manifest-template.json index 5dc0d624f..6a4bc80ee 100644 --- a/dapp/manifests/ledger-live/ledger-manifest-template.json +++ b/dapp/manifests/ledger-live/ledger-manifest-template.json @@ -23,6 +23,7 @@ "account.list", "bitcoin.getAddress", "bitcoin.getPublicKey", + "transaction.signAndBroadcast", "custom.acre.messageSign", "custom.acre.transactionSignAndBroadcast" ], diff --git a/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/AcrePointsRewardEstimation.tsx b/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/AcrePointsRewardEstimation.tsx index 2307b625d..a09463405 100644 --- a/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/AcrePointsRewardEstimation.tsx +++ b/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/AcrePointsRewardEstimation.tsx @@ -13,7 +13,7 @@ import { H4, TextMd } from "#/components/shared/Typography" import { numberToLocaleString } from "#/utils" import { IconChevronDown } from "@tabler/icons-react" import { TOKEN_AMOUNT_FIELD_NAME } from "#/components/shared/TokenAmountForm/TokenAmountFormBase" -import { useFormField } from "#/hooks" +import { useFormField, useMinDepositAmount } from "#/hooks" import { ONE_MONTH_IN_DAYS, ONE_WEEK_IN_DAYS } from "#/constants" const ACRE_POINTS_DATA = { @@ -48,7 +48,10 @@ function AcrePointsRewardEstimation(props: StackProps) { const { value = 0n } = useFormField( TOKEN_AMOUNT_FIELD_NAME, ) - const baseReward = Number(value) + const minDepositAmount = useMinDepositAmount() + const amount = value >= minDepositAmount ? value : 0n + + const baseReward = Number(amount) const pointsRate = 10000 const estimatedReward = useMemo( diff --git a/dapp/src/utils/orangekit/ledger-live/bitcoin-provider.ts b/dapp/src/utils/orangekit/ledger-live/bitcoin-provider.ts index 742281234..5ed054a88 100644 --- a/dapp/src/utils/orangekit/ledger-live/bitcoin-provider.ts +++ b/dapp/src/utils/orangekit/ledger-live/bitcoin-provider.ts @@ -173,16 +173,15 @@ export default class AcreLedgerLiveBitcoinProvider throw new Error("Connect first") } + // TODO: In the current version of Acre module, sending Bitcoin transactions + // is not supported. Use the custom Acre module to send Bitcoin transaction + // once it works correctly. const txHash = await tryRequest()(() => - this.#walletApiClient.custom.acre.transactionSignAndBroadcast( - this.#account!.id, - { - family: "bitcoin", - amount: new BigNumber(satoshis), - recipient: to, - }, - { hwAppId: this.#hwAppId }, - ), + this.#walletApiClient.transaction.signAndBroadcast(this.#account!.id, { + family: "bitcoin", + amount: new BigNumber(satoshis), + recipient: to, + }), ) return txHash diff --git a/dapp/src/utils/orangekit/ledger-live/tests/bitcoin-provider.test.ts b/dapp/src/utils/orangekit/ledger-live/tests/bitcoin-provider.test.ts index d45294b28..80f782406 100644 --- a/dapp/src/utils/orangekit/ledger-live/tests/bitcoin-provider.test.ts +++ b/dapp/src/utils/orangekit/ledger-live/tests/bitcoin-provider.test.ts @@ -42,6 +42,9 @@ describe("AcreLedgerLiveBitcoinProvider", () => { messageSign: vi.fn(), }, }, + transaction: { + signAndBroadcast: vi.fn(), + }, account: { list: vi.fn(), request: vi.fn(), @@ -79,7 +82,7 @@ describe("AcreLedgerLiveBitcoinProvider", () => { let result: string beforeAll(async () => { - mockedWalletApiClient.custom.acre.transactionSignAndBroadcast.mockResolvedValue( + mockedWalletApiClient.transaction.signAndBroadcast.mockResolvedValue( mockedTxHash, ) @@ -88,16 +91,12 @@ describe("AcreLedgerLiveBitcoinProvider", () => { it("should send transaction via Acre custom module", () => { expect( - mockedWalletApiClient.custom.acre.transactionSignAndBroadcast, - ).toHaveBeenCalledWith( - mockedAccount.id, - { - family: "bitcoin", - amount: new BigNumber(satoshis), - recipient: bitcoinAddress, - }, - { hwAppId }, - ) + mockedWalletApiClient.transaction.signAndBroadcast, + ).toHaveBeenCalledWith(mockedAccount.id, { + family: "bitcoin", + amount: new BigNumber(satoshis), + recipient: bitcoinAddress, + }) }) it("should return transaction hash", () => {