Skip to content

Commit

Permalink
fix balances (ordinal + cardinal), fix fee on signPsbt page (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
kieled authored Jul 24, 2024
1 parent ac051f1 commit 808ea94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nintondo-extension",
"version": "0.2.5.1",
"version": "0.2.5.2",
"private": true,
"scripts": {
"dev": "bun build.ts --watch",
Expand Down
9 changes: 5 additions & 4 deletions src/ui/hooks/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const useDecodePsbtInputs = () => {
);

psbt.txOutputs.forEach((f, i) => {
totalOutputValue += f.value / 10 ** 8;
totalOutputValue += f.value;
outputFields.push({
important: currentAccount?.address === f.address,
input: false,
Expand All @@ -139,7 +139,7 @@ export const useDecodePsbtInputs = () => {

let value: IFieldValue;
const inputValue = locationValue[outpoint] / 10 ** 8;
totalInputValue += inputValue;
totalInputValue += locationValue[outpoint];

if (psbt.data.inputs[i].sighashType === 131) {
const foundInscriptions = await apiController.getInscription({
Expand Down Expand Up @@ -177,10 +177,11 @@ export const useDecodePsbtInputs = () => {
return inputFields.concat(outputFields);
});

const fields = await Promise.all(result);
const fee = totalInputValue - totalOutputValue;
return {
fields: await Promise.all(result),
fee: fee < 0 ? "0" : toFixed(fee),
fields,
fee: fee < 0 ? "0" : toFixed(fee / 10 ** 8),
};
}, [apiController, currentAccount, notificationController]);
};
2 changes: 1 addition & 1 deletion src/ui/pages/main/wallet/account-panel/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const AccountPanel = () => {

const cardinalBalance = currentAccount?.balance ?? 0;
const ordinalBalance = currentAccount?.inscriptionBalance ?? 0;
const balance = (cardinalBalance + ordinalBalance) / 10 ** 8;
const balance = (cardinalBalance / 10 ** 8 + ordinalBalance);


return (
Expand Down

0 comments on commit 808ea94

Please sign in to comment.