Skip to content

Commit 9f23d79

Browse files
authored
fix(nami): use same collateral check as in Lace [LW-11900] (#1573)
1 parent da34232 commit 9f23d79

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

apps/browser-extension-wallet/src/views/nami-mode/NamiView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export const NamiView = withDappContext((): React.ReactElement => {
9090
isInitializing,
9191
initializeCollateralTx,
9292
submitCollateralTx,
93-
txBuilder: collateralTxBuilder
93+
txBuilder: collateralTxBuilder,
94+
hasEnoughAda: hasEnoughAdaForCollateral
9495
} = useCollateral();
9596

9697
const [isCompatibilityMode, setIsCompatibilityMode] = useState<boolean>();
@@ -191,6 +192,7 @@ export const NamiView = withDappContext((): React.ReactElement => {
191192
isCompatibilityMode,
192193
handleAnalyticsChoice,
193194
handleCompatibilityModeChoice,
195+
hasEnoughAdaForCollateral,
194196
createWallet: createWalletFromPrivateKey,
195197
getMnemonic,
196198
deleteWallet,

packages/nami/src/features/outside-handles-provider/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export interface OutsideHandlesContextValue {
4141
handleCompatibilityModeChoice: (
4242
isCompatibilityMode: boolean,
4343
) => Promise<void>;
44+
hasEnoughAdaForCollateral: boolean;
4445
createWallet: (
4546
args: Readonly<CreateWalletParams>,
4647
) => Promise<Wallet.CardanoWallet>;

packages/nami/src/ui/app/components/transactionBuilder.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const TransactionBuilder = (undefined, ref) => {
118118
isInitializingCollateral,
119119
initializeCollateralTx: initializeCollateral,
120120
collateralFee,
121+
hasEnoughAdaForCollateral,
121122
buildDelegation,
122123
setSelectedStakePool,
123124
delegationTxFee,
@@ -248,12 +249,8 @@ const TransactionBuilder = (undefined, ref) => {
248249
}
249250
collateralRef.current?.openModal();
250251

251-
const available = await firstValueFrom(
252-
inMemoryWallet.balance.utxo.available$,
253-
);
254-
255252
try {
256-
if (available.coins < BigInt(5_000_000)) {
253+
if (!hasEnoughAdaForCollateral) {
257254
setData(d => ({
258255
...d,
259256
error: 'Transaction not possible (maybe insufficient balance)',

0 commit comments

Comments
 (0)