Skip to content

Commit

Permalink
fix: activity value should be positive
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Aug 1, 2023
1 parent d43d4dc commit c291d4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/screens/Activity/ActivityDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ const LightningActivityDetail = ({
return (
<>
<Money
sats={value}
sats={total}
unitType="secondary"
size="caption13Up"
color="gray1"
Expand Down
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const persistConfig = {
key: 'root',
storage: mmkvStorage,
// increase version after store shape changes
version: 14,
version: 15,
stateReconciler: autoMergeLevel2,
blacklist: ['ui'],
migrate: createMigrate(migrations, { debug: __ENABLE_MIGRATION_DEBUG__ }),
Expand Down
11 changes: 11 additions & 0 deletions src/store/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,26 @@ const migrations = {
};
},
15: (state): PersistedState => {
// remove old unit settings
delete state.settings.bitcoinUnit;
delete state.settings.balanceUnit;

// LN activity value should be positive
const items = state.activity.items.map((item: { value: number }) => ({
...item,
value: Math.abs(item.value),
}));

return {
...state,
settings: {
...state.settings,
unit: 'satoshi',
},
activity: {
...state.activity,
items,
},
};
},
};
Expand Down

0 comments on commit c291d4b

Please sign in to comment.