Skip to content

Commit

Permalink
fix: renterd update contract list, walletd types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Nov 20, 2023
1 parent 1af82db commit 141a7e4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-actors-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The contract list now updates after a contract is deleted.
4 changes: 2 additions & 2 deletions apps/walletd/contexts/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export function useEventsMain() {
id: e.ID,
timestamp: 0,
pending: true,
type: e.Type,
amount: new BigNumber(e.Received).minus(e.Sent),
type: e.type,
amount: new BigNumber(e.received).minus(e.sent),
}))
const dataEvents: EventData[] = responseEvents.data.map((e, index) => {
let amount = new BigNumber(0)
Expand Down
9 changes: 7 additions & 2 deletions libs/react-renterd/src/bus.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useSWR from 'swr'
import useSWR, { mutate } from 'swr'
import {
useDeleteFunc,
useGetSwr,
Expand Down Expand Up @@ -400,7 +400,12 @@ export function useContractRenew(
export function useContractDelete(
args?: HookArgsCallback<{ id: string }, void, never>
) {
return useDeleteFunc({ ...args, route: '/bus/contract/:id' })
return useDeleteFunc(
{ ...args, route: '/bus/contract/:id' },
async (mutate) => {
mutate((key) => key.startsWith('/bus/contract'))
}
)
}

export function useContractsets(args?: HookArgsSwr<void, string[][]>) {
Expand Down
10 changes: 5 additions & 5 deletions libs/react-walletd/src/siaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ export type FileContract = {

export type PoolTransaction = {
ID: string
Raw: Transaction
Type: string
Sent: Currency
Received: Currency
Locked: Currency
raw: Transaction
type: string
sent: Currency
received: Currency
locked: Currency
}

// events
Expand Down

0 comments on commit 141a7e4

Please sign in to comment.