Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_RPC=
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"axios": "^1.6.7",
"cross-env": "^7.0.3",
"flowbite": "^2.3.0",
"flowbite-react": "^0.7.2",
"jdenticon": "^3.2.0",
Expand Down
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
29 changes: 28 additions & 1 deletion public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Common/Operation/CommentReward/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ClaimRewardBalance = ({data, trx_id, timestamp, headBlockNumber}) => {

<div className="action">
<span className="account">{author}</span>
comment_reward
{` comment_reward `}
<table className="table table-condensed hash3 ultra-condensed">
<tbody>
<tr>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Common/Operation/CurationReward/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {Link} from "react-router-dom"
const CurationReward = ({data, trx_id, timestamp, headBlockNumber}) => {

const {
author,
reward,
curator,
permlink,
comment_author,
comment_permlink,
// payout_must_be_claimed,
Expand All @@ -22,8 +24,8 @@ const CurationReward = ({data, trx_id, timestamp, headBlockNumber}) => {
{` curation reward: `}
{vestToHive(reward, totalVestingShares, totalVestingFundHive).toFixed(3)}
{` HP for `}
<Link to={`/@${comment_author}/${comment_permlink}`} className="keychainify-checked">
{`@${comment_author}/${comment_permlink}`}
<Link to={`/@${comment_author || author}/${comment_permlink || permlink}`} className="keychainify-checked">
{`@${comment_author || author}/${comment_permlink || permlink}`}
</Link>
</div>

Expand Down
41 changes: 41 additions & 0 deletions src/components/Common/Operation/FillOrder/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import PropTypes from "prop-types"
import {timeAgo} from "../../../../utils/helper.js"
import TrimTxId from "../../TrimTxId/index.jsx"
import {Link} from "react-router-dom"

const FillOrder = ({data, trx_id, timestamp, headBlockNumber}) => {

const {
open_pays,
open_owner,
current_pays,
// open_orderid,
current_owner,
// current_orderid,
} = data

return <div className="op op-mini" id={trx_id}>
<TrimTxId trx_id={trx_id}/>

<div className="action">
<span className="account">{current_owner}</span>
{` paid ${current_pays} for ${open_pays} from `}
<Link className="account keychainify-checked" to={`/@${open_owner}`}>{`${open_owner}`}</Link>
</div>

<div className="foot">
<Link to={`/b/${headBlockNumber}#${trx_id}`} className="keychainify-checked">
<time className="timeago2" dateTime={timestamp} title={timestamp}>{timeAgo(timestamp)}</time>
</Link>
</div>
</div>
}

FillOrder.propTypes = {
data: PropTypes.object.isRequired,
trx_id: PropTypes.string.isRequired,
timestamp: PropTypes.string.isRequired,
headBlockNumber: PropTypes.number.isRequired,
}

export default FillOrder
4 changes: 2 additions & 2 deletions src/components/Common/Operation/Transfer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const Transfer = ({data, trx_id, timestamp, headBlockNumber}) => {
<TrimTxId trx_id={trx_id} />

<div className="action">
<Link className="account keychainify-checked" to={`/@${from}`}>{`@${from}`}</Link>
<span className="account">{from}</span>
{` transfer ${amount} to `}
<span className="account">{to}</span>
<Link className="account keychainify-checked" to={`/@${to}`}>{`@${to}`}</Link>
{` `}
<code>{memo}</code>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/components/Common/Operation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import CreateClaimedAccount from "./CreateClaimedAccount/index.jsx"
import LimitOrderCancel from "./LimitOrderCancel/index.jsx"
import LimitOrderCreate from "./LimitOrderCreate/index.jsx"
import WitnessSetProperties from "./WitnessSetProperties/index.jsx"
import FillOrder from "./FillOrder/index.jsx";

const Operation = ({
opType,
Expand All @@ -30,6 +31,8 @@ const Operation = ({
totalVestingShares
}) => {

console.log(opType, opData)

opData['totalVestingShares'] = totalVestingShares
opData['totalVestingFundHive'] = totalVestingFundHive

Expand Down Expand Up @@ -233,6 +236,16 @@ const Operation = ({
/>
}

if (opType === 'fill_order') {
return <FillOrder
data={opData}
timestamp={timestamp}
trx_id={transaction_id}
headBlockNumber={headBlockNumber}
key={index}
/>
}

return <p key={index}>{opType}</p>
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/Pages/Block/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const BlockPage = () => {
loading,
timestamp,
count,
error,
blockError,
} = useGetBlocks(headBlockNumber)
const {
headBlockNumber: lastestHeadBlockNumber,
Expand All @@ -30,10 +30,10 @@ const BlockPage = () => {
</div>
}

if (error) {
if (blockError) {
return <div className="container">
<div className='row'>
<h2>{error}</h2>
<h2>{JSON.stringify(blockError)}</h2>
<p>
The latest head_block_number is <b>{lastestHeadBlockNumber}</b>
</p>
Expand Down
11 changes: 11 additions & 0 deletions src/components/Pages/Home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ const HomePage = () => {
currentHbdSupply,
virtualSupply,
loading: dynamicGlobalLoading,
dynamicGlobalError,
} = useDynamicGlobalProperties()

const {
timestamp,
transactions,
loading: blockLoading,
blockError,
} = useGetBlocks(headBlockNumber)

if (dynamicGlobalLoading && blockLoading && !headBlockNumber) {
Expand All @@ -33,6 +35,15 @@ const HomePage = () => {
</div>
}

if (dynamicGlobalError || blockError) {
return <div className="container">
<div className='row'>
{JSON.stringify(dynamicGlobalError)}
{JSON.stringify(blockError)}
</div>
</div>
}

return (
<div className="container">
<PageTitle title={'Latest block | Dbuzz - Explorer'} />
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useDynamicGlobalProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const handleGetDynamicGlobalProperties = async () => {

const useDynamicGlobalProperties = () => {
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)

const [headBlockNumber, setHeadBlockNumber] = useState(null)
const [headBlockId, setHeadBlockId] = useState(null)
Expand Down Expand Up @@ -167,6 +168,7 @@ const useDynamicGlobalProperties = () => {
setLoading(false)
} catch (error) {
console.error('Error fetching dynamic global properties:', error)
setError(error)
setLoading(false)
}
}
Expand Down Expand Up @@ -220,7 +222,8 @@ const useDynamicGlobalProperties = () => {
maxRecurrentTransferEndDate,
minRecurrentTransfersRecurrence,
maxOpenRecurrentTransfers,
loading
loading,
dynamicGlobalError: error,
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useGetBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const useGetBlocks = (headBlockNumber) => {
setLoading(false)
} catch (error) {
console.error('Error fetching blocks:', error)
setError(error)
setLoading(false)
}
}
Expand All @@ -96,7 +97,7 @@ const useGetBlocks = (headBlockNumber) => {
transactionIds,
loading,
count,
error,
blockError: error,
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/utils/api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// /utils/api.js
// const BASE_URL = 'https://rpc.d.buzz/'
// const BASE_URL = 'https://api.hive.blog'
const BASE_URL = 'https://rpc.d.buzz'
const BASE_URL = import.meta.env.VITE_RPC || 'https://api.hive.blog'


// Example function for making a GET request
export const fetchData = async (endpoint) => {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,14 @@ core-util-is@^1.0.3, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==

cross-spawn@^7.0.0, cross-spawn@^7.0.2:
cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down