diff --git a/.env b/.env new file mode 100644 index 0000000..90bf817 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_RPC= diff --git a/package.json b/package.json index 8286cf5..8157dc0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/_redirects b/public/_redirects new file mode 100644 index 0000000..ad37e2c --- /dev/null +++ b/public/_redirects @@ -0,0 +1 @@ +/* /index.html 200 diff --git a/public/vite.svg b/public/vite.svg index e7b8dfb..b91a5ff 100644 --- a/public/vite.svg +++ b/public/vite.svg @@ -1 +1,28 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + diff --git a/src/components/Common/Operation/CommentReward/index.jsx b/src/components/Common/Operation/CommentReward/index.jsx index e649391..a0ac148 100644 --- a/src/components/Common/Operation/CommentReward/index.jsx +++ b/src/components/Common/Operation/CommentReward/index.jsx @@ -19,7 +19,7 @@ const ClaimRewardBalance = ({data, trx_id, timestamp, headBlockNumber}) => {
{author} - comment_reward + {` comment_reward `} diff --git a/src/components/Common/Operation/CurationReward/index.jsx b/src/components/Common/Operation/CurationReward/index.jsx index 224b415..bf8c007 100644 --- a/src/components/Common/Operation/CurationReward/index.jsx +++ b/src/components/Common/Operation/CurationReward/index.jsx @@ -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, @@ -22,8 +24,8 @@ const CurationReward = ({data, trx_id, timestamp, headBlockNumber}) => { {` curation reward: `} {vestToHive(reward, totalVestingShares, totalVestingFundHive).toFixed(3)} {` HP for `} - - {`@${comment_author}/${comment_permlink}`} + + {`@${comment_author || author}/${comment_permlink || permlink}`} diff --git a/src/components/Common/Operation/FillOrder/index.jsx b/src/components/Common/Operation/FillOrder/index.jsx new file mode 100644 index 0000000..1cddc7e --- /dev/null +++ b/src/components/Common/Operation/FillOrder/index.jsx @@ -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
+ + +
+ {current_owner} + {` paid ${current_pays} for ${open_pays} from `} + {`${open_owner}`} +
+ +
+ + + +
+
+} + +FillOrder.propTypes = { + data: PropTypes.object.isRequired, + trx_id: PropTypes.string.isRequired, + timestamp: PropTypes.string.isRequired, + headBlockNumber: PropTypes.number.isRequired, +} + +export default FillOrder diff --git a/src/components/Common/Operation/Transfer/index.jsx b/src/components/Common/Operation/Transfer/index.jsx index 639fa0f..b1b1537 100644 --- a/src/components/Common/Operation/Transfer/index.jsx +++ b/src/components/Common/Operation/Transfer/index.jsx @@ -15,9 +15,9 @@ const Transfer = ({data, trx_id, timestamp, headBlockNumber}) => {
- {`@${from}`} + {from} {` transfer ${amount} to `} - {to} + {`@${to}`} {` `} {memo}
diff --git a/src/components/Common/Operation/index.jsx b/src/components/Common/Operation/index.jsx index badd551..6f09d05 100644 --- a/src/components/Common/Operation/index.jsx +++ b/src/components/Common/Operation/index.jsx @@ -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, @@ -30,6 +31,8 @@ const Operation = ({ totalVestingShares }) => { + console.log(opType, opData) + opData['totalVestingShares'] = totalVestingShares opData['totalVestingFundHive'] = totalVestingFundHive @@ -233,6 +236,16 @@ const Operation = ({ /> } + if (opType === 'fill_order') { + return + } + return

{opType}

} diff --git a/src/components/Pages/Block/index.jsx b/src/components/Pages/Block/index.jsx index 280e22c..7064b4b 100644 --- a/src/components/Pages/Block/index.jsx +++ b/src/components/Pages/Block/index.jsx @@ -14,7 +14,7 @@ const BlockPage = () => { loading, timestamp, count, - error, + blockError, } = useGetBlocks(headBlockNumber) const { headBlockNumber: lastestHeadBlockNumber, @@ -30,10 +30,10 @@ const BlockPage = () => { } - if (error) { + if (blockError) { return
-

{error}

+

{JSON.stringify(blockError)}

The latest head_block_number is {lastestHeadBlockNumber}

diff --git a/src/components/Pages/Home/index.jsx b/src/components/Pages/Home/index.jsx index 1444888..ab53ade 100644 --- a/src/components/Pages/Home/index.jsx +++ b/src/components/Pages/Home/index.jsx @@ -17,12 +17,14 @@ const HomePage = () => { currentHbdSupply, virtualSupply, loading: dynamicGlobalLoading, + dynamicGlobalError, } = useDynamicGlobalProperties() const { timestamp, transactions, loading: blockLoading, + blockError, } = useGetBlocks(headBlockNumber) if (dynamicGlobalLoading && blockLoading && !headBlockNumber) { @@ -33,6 +35,15 @@ const HomePage = () => {
} + if (dynamicGlobalError || blockError) { + return
+
+ {JSON.stringify(dynamicGlobalError)} + {JSON.stringify(blockError)} +
+
+ } + return (
diff --git a/src/hooks/useDynamicGlobalProperties.js b/src/hooks/useDynamicGlobalProperties.js index 3178a96..e7f1522 100644 --- a/src/hooks/useDynamicGlobalProperties.js +++ b/src/hooks/useDynamicGlobalProperties.js @@ -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) @@ -167,6 +168,7 @@ const useDynamicGlobalProperties = () => { setLoading(false) } catch (error) { console.error('Error fetching dynamic global properties:', error) + setError(error) setLoading(false) } } @@ -220,7 +222,8 @@ const useDynamicGlobalProperties = () => { maxRecurrentTransferEndDate, minRecurrentTransfersRecurrence, maxOpenRecurrentTransfers, - loading + loading, + dynamicGlobalError: error, } } diff --git a/src/hooks/useGetBlocks.js b/src/hooks/useGetBlocks.js index e4c1794..acb2106 100644 --- a/src/hooks/useGetBlocks.js +++ b/src/hooks/useGetBlocks.js @@ -74,6 +74,7 @@ const useGetBlocks = (headBlockNumber) => { setLoading(false) } catch (error) { console.error('Error fetching blocks:', error) + setError(error) setLoading(false) } } @@ -96,7 +97,7 @@ const useGetBlocks = (headBlockNumber) => { transactionIds, loading, count, - error, + blockError: error, } } diff --git a/src/utils/api.js b/src/utils/api.js index c00e872..3fc0846 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -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) => { diff --git a/yarn.lock b/yarn.lock index c7d5554..7e28d03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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==