diff --git a/src/components/CashoutModal.tsx b/src/components/CashoutModal.tsx index 7b21c05..c71758c 100644 --- a/src/components/CashoutModal.tsx +++ b/src/components/CashoutModal.tsx @@ -37,7 +37,7 @@ export default function DepositModal() { ) diff --git a/src/hooks/apiHooks.tsx b/src/hooks/apiHooks.tsx index 23f1748..3bf6dce 100644 --- a/src/hooks/apiHooks.tsx +++ b/src/hooks/apiHooks.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; -import type { NodeAddresses, ChequebookAddressResponse, ChequebookBalanceResponse, BalanceResponse, - LastChequesResponse, AllSettlements, LastCashoutActionResponse, Health, Peer, Topology, PingResponse } from '@ethersphere/bee-js' +import { NodeAddresses, ChequebookAddressResponse, ChequebookBalanceResponse, BalanceResponse, + LastChequesResponse, AllSettlements, LastCashoutActionResponse, Health, Peer, Topology, PingResponse, LastChequesForPeerResponse } from '@ethersphere/bee-js' import { beeDebugApi, beeApi } from '../services/bee'; @@ -102,7 +102,7 @@ export const useApiChequebookAddress = () => { setLoading(true) beeDebugApi.chequebook.address() .then(res => { - setChequebookAddress(res.data) + setChequebookAddress(res) }) .catch(error => { setError(error) @@ -146,7 +146,7 @@ export const useApiChequebookBalance = () => { setLoading(true) beeDebugApi.chequebook.balance() .then(res => { - setChequebookBalance(res.data) + setChequebookBalance(res) }) .catch(error => { setError(error) @@ -190,7 +190,7 @@ export const useApiPeerCheques = () => { setLoading(true) beeDebugApi.chequebook.getLastCheques() .then(res => { - setPeerCheques(res.data) + setPeerCheques(res) }) .catch(error => { setError(error) @@ -204,16 +204,7 @@ export const useApiPeerCheques = () => { } export const useApiPeerLastCheque = (peerId: string) => { - const [peerCheque, setPeerCheque] = useState({ peer: '-', chequebook: "", - cumulativePayout: 0, - beneficiary: "", - transactionHash: "", - result: { - recipient: "", - lastPayout: 0, - bounced: false - }} - ) + const [peerCheque, setPeerCheque] = useState(null) const [isLoadingPeerCheque, setLoading] = useState(false) const [error, setError] = useState(null) @@ -221,7 +212,7 @@ export const useApiPeerLastCheque = (peerId: string) => { setLoading(true) beeDebugApi.chequebook.getPeerLastCheques(peerId) .then(res => { - setPeerCheque(res.data) + setPeerCheque(res) }) .catch(error => { setError(error) @@ -288,7 +279,7 @@ export const useApiPeerLastCashout = (peerId: string) => { setLoading(true) beeDebugApi.chequebook.getPeerLastCashout(peerId) .then(res => { - setPeerCashout(res.data) + setPeerCashout(res) }) .catch(error => { setError(error) diff --git a/src/pages/accounting/PeerDetailDrawer.tsx b/src/pages/accounting/PeerDetailDrawer.tsx index f4b24e4..ac9b09a 100644 --- a/src/pages/accounting/PeerDetailDrawer.tsx +++ b/src/pages/accounting/PeerDetailDrawer.tsx @@ -40,7 +40,7 @@ export default function Index(props: any) { setIsLoadingPeerCashout(true) beeDebugApi.chequebook.getPeerLastCashout(peerId) .then(res => { - setPeerCashout(res.data) + setPeerCashout(res) }) .catch(error => { }) @@ -51,7 +51,7 @@ export default function Index(props: any) { setIsLoadingPeerCheque(true) beeDebugApi.chequebook.getPeerLastCheques(peerId) .then(res => { - setPeerCheque(res.data) + setPeerCheque(res) }) .catch(error => { }) diff --git a/src/services/bee.tsx b/src/services/bee.tsx index 855c6c2..1eee2ae 100644 --- a/src/services/bee.tsx +++ b/src/services/bee.tsx @@ -76,22 +76,22 @@ export const beeDebugApi = { }, chequebook: { address() { - return beeDebugApiClient().get(`/chequebook/address`) + return beeJSDebugClient().getChequebookAddress() }, balance() { - return beeDebugApiClient().get(`/chequebook/balance`) + return beeJSDebugClient().getChequebookBalance() }, getLastCheques() { - return beeDebugApiClient().get(`/chequebook/cheque`) + return beeJSDebugClient().getLastCheques() }, peerCashout(peerId: string) { - return beeDebugApiClient().post(`/chequebook/cashout/${peerId}`) + return beeJSDebugClient().cashoutLastCheque(peerId) }, getPeerLastCashout(peerId: string) { - return beeDebugApiClient().get(`/chequebook/cashout/${peerId}`) + return beeJSDebugClient().getLastCashoutAction(peerId) }, getPeerLastCheques(peerId: string) { - return beeDebugApiClient().get(`/chequebook/cheque/${peerId}`) + return beeJSDebugClient().getLastChequesForPeer(peerId) }, withdraw(amount: bigint) { return beeDebugApiClient().post(`/chequebook/withdraw?amount=${amount}`)