-
Notifications
You must be signed in to change notification settings - Fork 51
wallet-porfolio #1183
base: development
Are you sure you want to change the base?
wallet-porfolio #1183
Changes from 5 commits
a284929
c328ac8
703288b
b282444
80ac66e
c885bc3
2a9c3ef
c67a23f
1aa76f6
edb371e
8833e1a
4e06397
2907956
37739d6
ecf9e74
43480a1
7e31c80
8a5607a
30ec4d7
5a80234
56df71e
a38aee5
95ac4e2
23fbe1e
fdcb288
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,3 +71,19 @@ export const fetchGif = async (query: string | null, limit: string, offset: stri | |
| } | ||
| return gifs; | ||
| }; | ||
|
|
||
| export const marketInfo = async (): Promise<number> => { | ||
|
|
||
| const url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=hive%2C%20hive_dollar&order=market_cap_desc&per_page=100&page=1&sparkline=false`; | ||
| const data = await axios.get(url) | ||
| .then((r: any) => r.data) | ||
| return data; | ||
| }; | ||
|
|
||
| export const marketChart = async (token: string): Promise<number> => { | ||
|
|
||
| const url = `https://api.coingecko.com/api/v3/coins/${token}/market_chart?vs_currency=usd&days=30`; | ||
| const data = await axios.get(url) | ||
| .then((r: any) => r.data) | ||
| return data; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, do not use |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { getMetrics } from "../../api/hive-engine"; | |
|
|
||
| export const EngineTokensEstimated = (props: any) => { | ||
| const { tokens: userTokens, dynamicProps } = props; | ||
| // console.log(userTokens) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove please |
||
| const [estimated, setEstimated] = useState(`${_t("wallet.calculating")}...`); | ||
|
|
||
| useEffect(() => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import React, { useEffect, useState } from 'react' | ||
| import { Button, FormControl } from 'react-bootstrap' | ||
| import { _t } from '../../i18n' | ||
| import { cashCoinSvg } from "../../img/svg"; | ||
| import TwoUserAvatar from "../two-user-avatar"; | ||
|
|
||
| import { | ||
| getTransactions, | ||
| getOtherTransactions | ||
| } from "../../api/hive-engine"; | ||
| import LinearProgress from '../linear-progress'; | ||
|
|
||
| export const EngineTransactionList = (props: any) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not an |
||
|
|
||
| const { global, account, params } = props | ||
|
|
||
| const [transactions, setTransactions] = useState([]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify types please |
||
| const [otherTransactions, setOtherTransactions] = useState([]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify types please |
||
| const [loading, setLoading] = useState(false); | ||
| const [loadLimit, setLoadLimit] = useState(10) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed semicolons |
||
|
|
||
| useEffect(() => { | ||
| otherTokenTransactions(); | ||
| getMainTransactions() | ||
| }, []) | ||
|
|
||
| const getMainTransactions = async () => { | ||
| const transactions = await getTransactions(params, account.name, 200); | ||
| console.log(transactions) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove please |
||
|
|
||
| }; | ||
|
|
||
| const otherTokenTransactions = async () => { | ||
| setLoading(true) | ||
| const otherTransactions = await getOtherTransactions(account.name, 200, params.toUpperCase()); | ||
| console.log(otherTransactions) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove please |
||
| setOtherTransactions(otherTransactions); | ||
| setLoading(false) | ||
| } | ||
|
|
||
| const getTransactionTime = (timestamp: number) => { | ||
| let date: any = new Date(timestamp * 1000) | ||
| return date.toDateString(); | ||
| } | ||
|
|
||
| const loadMore = () => { | ||
| const moreItems = loadLimit + 10; | ||
| setLoadLimit(moreItems); | ||
| }; | ||
|
|
||
| const optionChanged = (e: React.ChangeEvent<typeof FormControl & HTMLInputElement>) => { | ||
| console.log(e.target) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you use this function?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I haven't used it yet, I'll use it, I'm not done with issue yet, I want to be sure all actions/logic works then I will refactor where necessary |
||
| } | ||
|
|
||
| return ( | ||
| <div className="transaction-list"> | ||
| <div className="transaction-list-header"> | ||
| <h2>{_t("transactions.title")} </h2> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra space at the end of tag content |
||
| <FormControl as="select" value="group" onChange={optionChanged} > | ||
| <option value="">{_t("transactions.group-all")}</option> | ||
| {["transfers", "market-orders", "interests", "stake-operations", "rewards"].map((x) => ( | ||
| <option key={x} value={x}> | ||
| {_t(`transactions.group-${x}`)} | ||
| </option> | ||
| ))} | ||
| </FormControl> | ||
| </div> | ||
| {loading && <LinearProgress />} | ||
| {otherTransactions?.slice(0, loadLimit).map((t: any) => { | ||
| return ( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip: You can replace with No need to use extra return |
||
| otherTransactions?.length === 0 ? <p key={t?.id} className="text-muted empty-list">{_t("g.empty-list")}</p> : | ||
| <div className="transaction-list-item" key={t?.id}> | ||
| <div className="transaction-icon"> | ||
| {t?.operation === "tokens_transfer" || t?.operation === "tokens_stake" || t?.operation === "tokens_delegate" ? | ||
| TwoUserAvatar({ global: global, from: t?.from, to: t?.to, size: "small" }) : | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its a component, use as element please |
||
| cashCoinSvg } | ||
| </div> | ||
| <div className="transaction-title"> | ||
| <div className="transaction-name">{t?.operation.replace("_", " ")}</div> | ||
| <div className="transaction-date">{getTransactionTime(t?.timestamp)}</div> | ||
| </div> | ||
| <div className="transaction-numbers">{`${t?.quantity} ${t?.symbol}`}</div> | ||
| <div className="transaction-details"> | ||
| {t?.memo} | ||
| <p> | ||
| {t?.operation === "tokens_transfer" ? | ||
| <span> | ||
| <strong>@{t.from}</strong> -> <strong>@{t.to}</strong> | ||
| </span> : | ||
| <span> | ||
| <strong>{`Txn Id: ${t.transactionId}`}</strong> | ||
| <p className='mt-2'> | ||
| <strong>{`Block Id: ${t.blockNumber}`}</strong> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These texts should be translated |
||
| </p> | ||
| </span> | ||
| } | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ) | ||
| })} | ||
| {!loading && otherTransactions.length > loadLimit && | ||
| <Button disabled={false} block={true} onClick={loadMore} className="mt-2"> | ||
| {_t("g.load-more")} | ||
| </Button>} | ||
| </div> | ||
| ) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may leave just
urlinstead ofurl: urlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, that's true,
Thanks🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still didn't fixed