diff --git a/codegen.ts b/codegen.ts
new file mode 100644
index 000000000..2af3e5fe1
--- /dev/null
+++ b/codegen.ts
@@ -0,0 +1,23 @@
+import { CodegenConfig } from '@graphql-codegen/cli';
+
+const schemaUrl = 'https://index.bostrom.cybernode.ai/v1/graphql'; //process.env.NEXT_PUBLIC_GRAPHQL_HOST;
+
+const config: CodegenConfig = {
+ overwrite: true,
+ schema: schemaUrl,
+ documents: ['src/**/*.graphql'],
+ config: {
+ withHooks: true,
+ },
+ generates: {
+ 'src/generated/graphql.ts': {
+ plugins: [
+ 'typescript',
+ 'typescript-operations',
+ 'typescript-react-apollo',
+ ],
+ },
+ },
+};
+
+export default config;
diff --git a/docker-compose.yml b/docker-compose.yml
index d0ff2ef2e..8b0768b85 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,10 +9,14 @@ services:
environment:
- NODE_OPTIONS=--max-old-space-size=8192
- CHAIN_ID=bostrom
- - CYBER_NODE_URL_API=https://rpc.bostrom.cybernode.ai
- - CYBER_NODE_URL_WS=wss://rpc.bostrom.cybernode.ai/websocket
- - CYBER_NODE_URL_LCD=https://lcd.bostrom.cybernode.ai
- - CYBER_INDEX_HTTPS=https://index.bostrom.cybernode.ai/v1/graphql
- - CYBER_INDEX_WEBSOCKET=wss://index.bostrom.cybernode.ai/v1/graphql
+ - RPC_URL=https://rpc.bostrom.cybernode.ai
+ - LCD_URL=https://lcd.bostrom.cybernode.ai
+ - WEBSOCKET_URL=wss://rpc.bostrom.cybernode.ai/websocket
+ - INDEX_HTTPS=https://index.bostrom.cybernode.ai/v1/graphql
+ - INDEX_WEBSOCKET=wss://index.bostrom.cybernode.ai/v1/graphql
- CYBER_GATEWAY=https://gateway.bostrom.cybernode.ai
+ - BASE_DENOM=boot
+ - DENOM_LIQUID=hydrogen
+ - BECH32_PREFIX=bostrom
+
command: npx serve -s build
diff --git a/package.json b/package.json
index 077a9bb23..983e2bf01 100644
--- a/package.json
+++ b/package.json
@@ -21,12 +21,14 @@
"stylelint:lint": "stylelint \"**/*.*css\"",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
- "test": "jest --transformIgnorePatterns --verbose"
+ "test": "jest --transformIgnorePatterns --verbose",
+ "generate-graphql-types": "yarn graphql-codegen --config ./codegen.ts",
+ "generate-lcd-types": "npx swagger-typescript-api -p https://lcd.bostrom.cybernode.ai/swagger/swagger.yaml -o ./src/generated -n lcd.ts --axios --modular "
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"license": "ISC",
"devDependencies": {
- "@babel/core": "7.21.0",
+ "@babel/core": "^7.24.3",
"@babel/eslint-parser": "^7.16.5",
"@babel/helper-compilation-targets": "^7.21.4",
"@babel/plugin-proposal-class-properties": "7.18.6",
@@ -36,6 +38,10 @@
"@babel/preset-typescript": "^7.21.0",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
+ "@graphql-codegen/cli": "^5.0.2",
+ "@graphql-codegen/typescript": "^4.0.6",
+ "@graphql-codegen/typescript-operations": "^4.2.0",
+ "@graphql-codegen/typescript-react-apollo": "^4.3.0",
"@keplr-wallet/types": "^0.11.52",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@rjsf/core": "^3.2.1",
@@ -82,6 +88,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-typescript": "^0.14.0",
"file-loader": "^6.2.0",
+ "graphql-tag": "^2.12.6",
"history": "^4.9.0",
"html-webpack-plugin": "^5.5.0",
"https-browserify": "^1.0.0",
@@ -122,6 +129,7 @@
"stylelint-config-standard": "^33.0.0",
"stylelint-config-standard-scss": "^9.0.0",
"stylelint-order": "^6.0.3",
+ "swagger-typescript-api": "^13.0.3",
"swr": "^1.0.1",
"terser-webpack-plugin": "4.2.3",
"ts-migrate": "^0.1.35",
@@ -176,6 +184,7 @@
"bignumber.js": "^9.0.0",
"blockstore-core": "^4.3.4",
"blockstore-idb": "^1.1.4",
+ "buffer": "^6.0.3",
"cjs-to-es6": "^2.0.1",
"classnames": "^2.3.1",
"comlink": "^4.4.1",
diff --git a/src/components/BandwidthBar/index.tsx b/src/components/BandwidthBar/index.tsx
index 045878520..84954b397 100644
--- a/src/components/BandwidthBar/index.tsx
+++ b/src/components/BandwidthBar/index.tsx
@@ -3,8 +3,10 @@ import { Battery, Pane, Text } from '@cybercongress/gravity';
import { Link } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import { useQueryClient } from 'src/contexts/queryClient';
+import { Networks } from 'src/types/networks';
+import { routes } from 'src/routes';
+import { CHAIN_ID, BASE_DENOM } from 'src/constants/config';
import Tooltip from '../tooltip/tooltip';
-import { CYBER } from '../../utils/config';
import {
coinDecimals,
convertResources,
@@ -12,9 +14,6 @@ import {
reduceBalances,
} from '../../utils/utils';
import { setBandwidth } from '../../redux/actions/bandwidth';
-import { useSigningClient } from 'src/contexts/signerClient';
-import { Networks } from 'src/types/networks';
-import { routes } from 'src/routes';
const PREFIXES = [
{
@@ -55,12 +54,12 @@ function ContentTooltip({ bwRemained, bwMaxValue, amounPower, countLink }) {
{text}
- Get {CYBER.DENOM_CYBER.toUpperCase()}
+ Get {BASE_DENOM.toUpperCase()}
@@ -68,13 +67,13 @@ function ContentTooltip({ bwRemained, bwMaxValue, amounPower, countLink }) {
);
}
-function BandwidthBar({ tooltipPlacement }) // bwRemained = 0,
-// bwMaxValue = 0,
-// countLink = 0,
-// amounPower,
-// ...props
+function BandwidthBar({ tooltipPlacement }) {
+ // bwRemained = 0,
+ // bwMaxValue = 0,
+ // countLink = 0,
+ // amounPower,
+ // ...props
-{
const [linkPrice] = useState(4);
const queryClient = useQueryClient();
diff --git a/src/components/MusicalAddress/utils.js b/src/components/MusicalAddress/utils.js
index 871dfa964..9a5a6cc26 100644
--- a/src/components/MusicalAddress/utils.js
+++ b/src/components/MusicalAddress/utils.js
@@ -1,13 +1,13 @@
/* eslint-disable no-restricted-syntax */
import * as Tone from 'tone';
import {
+ PATTERN_CYBER,
PATTERN_ETH,
PATTERN_COSMOS,
PATTERN_OSMOS,
PATTERN_TERRA,
PATTERN_CYBER_VALOPER,
-} from '../../utils/config';
-import { PATTERN_CYBER } from 'src/constants/app';
+} from 'src/constants/patterns';
const DICTIONARY_ABC = {
a: { note: 'E3', height: 16, gain: 1, color: '#36D6AE' },
diff --git a/src/components/TableTxs/ActionTx.tsx b/src/components/TableTxs/ActionTx.tsx
new file mode 100644
index 000000000..1a7ed9d78
--- /dev/null
+++ b/src/components/TableTxs/ActionTx.tsx
@@ -0,0 +1,11 @@
+import React from 'react'
+
+function ActionTx() {
+ return (
+
+
+
+ )
+}
+
+export default ActionTx
diff --git a/src/components/TableTxs/TableTxs.tsx b/src/components/TableTxs/TableTxs.tsx
new file mode 100644
index 000000000..e663b69c3
--- /dev/null
+++ b/src/components/TableTxs/TableTxs.tsx
@@ -0,0 +1,99 @@
+import InfiniteScroll from 'react-infinite-scroll-component';
+import { MessagesByAddressQuery } from 'src/generated/graphql';
+import { useMemo } from 'react';
+import statusTrueImg from 'src/image/ionicons_svg_ios-checkmark-circle.svg';
+import statusFalseImg from 'src/image/ionicons_svg_ios-close-circle.svg';
+import { getNowUtcTime, timeSince, trimString } from 'src/utils/utils';
+import { Link } from 'react-router-dom';
+import { routes } from 'src/routes';
+import Display from '../containerGradient/Display/Display';
+import Table from '../Table/Table';
+import { Dots } from '../ui/Dots';
+import TextTable from '../text/textTable';
+import MsgType from '../msgType/msgType';
+
+type Props = {
+ hasMore: boolean;
+ fetchMoreData: () => void;
+ data: MessagesByAddressQuery | undefined;
+ accountUser: string;
+};
+
+enum ColumnsTable {
+ status = 'status',
+ type = 'type',
+ timestamp = 'timestamp',
+ tx = 'tx',
+ action = 'action',
+}
+
+function TableTxs({ hasMore, fetchMoreData, data, accountUser }: Props) {
+ const tableData = useMemo(() => {
+ return data?.messages_by_address.map((item) => {
+ let typeTx = item.type;
+ if (
+ typeTx.includes('MsgSend') &&
+ item?.value?.to_address === accountUser
+ ) {
+ typeTx = 'Receive';
+ }
+ const timeAgoInMS =
+ getNowUtcTime() - Date.parse(item.transaction.block.timestamp);
+
+ return {
+ [ColumnsTable.status]: (
+
+
+
+ ),
+ [ColumnsTable.type]: (
+
+
+
+ ),
+ [ColumnsTable.timestamp]: (
+ {timeSince(timeAgoInMS)} ago
+ ),
+ [ColumnsTable.tx]: (
+
+
+ {trimString(item.transaction_hash, 6, 6)}
+
+
+ ),
+ // [ColumnsTable.action]: (),
+ };
+ });
+ }, []);
+
+ return (
+
+
+ Loading
+
+ }
+ style={{ display: 'grid', gap: '15px' }}
+ >
+ ({
+ header: item,
+ accessorKey: item,
+ cell: (info) => info.getValue(),
+ }))}
+ />
+
+
+ );
+}
+
+export default TableTxs;
diff --git a/src/components/TokenChange/TokenChange.tsx b/src/components/TokenChange/TokenChange.tsx
index b986c0ebc..8a1b30ee0 100644
--- a/src/components/TokenChange/TokenChange.tsx
+++ b/src/components/TokenChange/TokenChange.tsx
@@ -1,8 +1,8 @@
-import { CYBER } from 'src/utils/config';
import { formatNumber } from 'src/utils/utils';
import cx from 'classnames';
import styles from './TokenChange.module.scss';
import FormatNumberTokens from '../FormatNumberTokens/FormatNumberTokens';
+import { DENOM_LIQUID } from 'src/constants/config';
export type Props = {
total: number;
@@ -25,7 +25,7 @@ function TokenChange({ total, change = 0, className }: Props) {
)}
-
+
);
}
diff --git a/src/components/account/account.tsx b/src/components/account/account.tsx
index 7397851a7..985c9e78d 100644
--- a/src/components/account/account.tsx
+++ b/src/components/account/account.tsx
@@ -5,8 +5,8 @@ import { useQueryClient } from 'src/contexts/queryClient';
import { routes } from 'src/routes';
import usePassportByAddress from 'src/features/passport/hooks/usePassportByAddress';
import cx from 'classnames';
+import { BECH32_PREFIX_VALOPER } from 'src/constants/config';
import { trimString } from '../../utils/utils';
-import { CYBER } from '../../utils/config';
import { AvataImgIpfs } from '../../containers/portal/components/avataIpfs';
import styles from './account.module.scss';
@@ -25,9 +25,7 @@ function useGetValidatorInfo(address: string) {
},
{
enabled: Boolean(
- queryClient &&
- address &&
- address.includes(CYBER.BECH32_PREFIX_ACC_ADDR_CYBERVALOPER)
+ queryClient && address && address.includes(BECH32_PREFIX_VALOPER)
),
}
);
@@ -77,7 +75,7 @@ function Account({
}, [address, trimAddressParam]);
const linkAddress = useMemo(() => {
- if (address?.includes(CYBER.BECH32_PREFIX_ACC_ADDR_CYBERVALOPER)) {
+ if (address?.includes(BECH32_PREFIX_VALOPER)) {
return `/network/bostrom/hero/${address}`;
}
diff --git a/src/components/actionBar/index.tsx b/src/components/actionBar/index.tsx
index c71b22152..78b7f9567 100644
--- a/src/components/actionBar/index.tsx
+++ b/src/components/actionBar/index.tsx
@@ -2,7 +2,6 @@ import React from 'react';
import { $TsFixMeFunc } from 'src/types/tsfix';
import { routes } from 'src/routes';
-import { CYBER } from 'src/utils/config';
import { useLocation } from 'react-router-dom';
import { Networks } from 'src/types/networks';
import usePassportByAddress from 'src/features/passport/hooks/usePassportByAddress';
@@ -13,6 +12,7 @@ import styles from './styles.module.scss';
import Button from '../btnGrd';
import { useSigningClient } from 'src/contexts/signerClient';
import { trimString } from 'src/utils/utils';
+import { CHAIN_ID } from 'src/constants/config';
const back = require('../../image/arrow-left-img.svg');
@@ -59,7 +59,7 @@ function ActionBar({ children, text, onClickBack, button }: Props) {
const { passport } = usePassportByAddress(address);
const noAccount = !defaultAccount.account;
- const noPassport = CYBER.CHAIN_ID === Networks.BOSTROM && !passport;
+ const noPassport = CHAIN_ID === Networks.BOSTROM && !passport;
const exception =
(location.pathname !== routes.keys.path &&
diff --git a/src/components/contentIpfs/contentIpfs.tsx b/src/components/contentIpfs/contentIpfs.tsx
index c74274e83..ba762538e 100644
--- a/src/components/contentIpfs/contentIpfs.tsx
+++ b/src/components/contentIpfs/contentIpfs.tsx
@@ -1,5 +1,5 @@
import { IPFSContentDetails, IPFSContentMaybe } from 'src/services/ipfs/ipfs';
-import { CYBER } from 'src/utils/config';
+import { CYBER_GATEWAY } from 'src/constants/config';
import VideoPlayerGatewayOnly from '../VideoPlayer/VideoPlayerGatewayOnly';
import GatewayContent from './component/gateway';
import TextMarkdown from '../TextMarkdown';
@@ -22,14 +22,14 @@ function OtherItem({
{content || `${cid} (n/a)`}
);
}
- return ;
+ return ;
}
function DownloadableItem({ cid, search }: { cid: string; search?: boolean }) {
if (search) {
return {`${cid} (gateway)`}
;
}
- return ;
+ return ;
}
type ContentTabProps = {
diff --git a/src/components/governance/governance.jsx b/src/components/governance/governance.jsx
index 17e115d93..4ebe5c3dd 100644
--- a/src/components/governance/governance.jsx
+++ b/src/components/governance/governance.jsx
@@ -1,6 +1,7 @@
import { Pane, Text } from '@cybercongress/gravity';
+import { ProposalStatus } from 'cosmjs-types/cosmos/gov/v1beta1/gov';
+import { BASE_DENOM } from 'src/constants/config';
import { formatNumber } from '../../utils/search/utils';
-import { CYBER, PROPOSAL_STATUS } from '../../utils/config';
import Tooltip from '../tooltip/tooltip';
const submitted = require('../../image/ionicons_svg_ios-battery-full.svg');
@@ -161,27 +162,27 @@ export function IconStatus({ status, size, text, ...props }) {
let statusText = '';
switch (status) {
- case PROPOSAL_STATUS.PROPOSAL_STATUS_DEPOSIT_PERIOD: {
+ case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: {
imgIcon = submitted;
statusText = 'deposit period';
break;
}
- case PROPOSAL_STATUS.PROPOSAL_STATUS_VOTING_PERIOD: {
+ case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: {
imgIcon = voting;
statusText = 'voting period';
break;
}
- case PROPOSAL_STATUS.PROPOSAL_STATUS_PASSED: {
+ case ProposalStatus.PROPOSAL_STATUS_PASSED: {
imgIcon = passed;
statusText = 'passed';
break;
}
- case PROPOSAL_STATUS.PROPOSAL_STATUS_REJECTED: {
+ case ProposalStatus.PROPOSAL_STATUS_REJECTED: {
imgIcon = rejected;
statusText = 'rejected';
break;
}
- case PROPOSAL_STATUS.PROPOSAL_STATUS_FAILED: {
+ case ProposalStatus.PROPOSAL_STATUS_FAILED: {
imgIcon = failed;
statusText = 'failed';
break;
@@ -241,7 +242,7 @@ export function Deposit({ totalDeposit, minDeposit }) {
className="tooltip-text-deposit"
>
Total Deposit {formatNumber(totalDeposit)}{' '}
- {CYBER.DENOM_CYBER.toUpperCase()}
+ {BASE_DENOM.toUpperCase()}
diff --git a/src/components/ledger/stageActionBar.jsx b/src/components/ledger/stageActionBar.jsx
index e8e7c6730..e815a14f1 100644
--- a/src/components/ledger/stageActionBar.jsx
+++ b/src/components/ledger/stageActionBar.jsx
@@ -1,4 +1,3 @@
-import { useState, useEffect, useRef } from 'react';
import LocalizedStrings from 'react-localization';
import { Link } from 'react-router-dom';
import {
@@ -9,6 +8,8 @@ import {
IconButton,
} from '@cybercongress/gravity';
+import { BondStatus } from 'cosmjs-types/cosmos/staking/v1beta1/staking';
+import { useBackend } from 'src/contexts/backend/backend';
import { ContainetLedger } from './container';
import { Dots } from '../ui/Dots';
import Account from '../account/account';
@@ -17,17 +18,13 @@ import { formatNumber, trimString, selectNetworkImg } from '../../utils/utils';
import { i18n } from '../../i18n/en';
-import { CYBER, BOND_STATUS } from '../../utils/config';
import Button from '../btnGrd';
import { InputNumber, Input } from '../Input';
import ActionBarContainer from '../actionBar';
import ButtonIcon from '../buttons/ButtonIcon';
import { Color } from '../LinearGradientContainer/LinearGradientContainer';
import AddFileButton from '../buttons/AddFile/AddFile';
-import { useBackend } from 'src/contexts/backend/backend';
-import useDelegation from 'src/features/staking/delegation/useDelegation';
-
-const { DENOM_CYBER } = CYBER;
+import { CHAIN_ID, BASE_DENOM } from 'src/constants/config';
const param = {
slashing: [
@@ -161,10 +158,12 @@ export function Confirmed({ txHash, txHeight, cosmos, onClickBtnClose }) {
{trimString(txHash, 6, 6)}
)}{' '}
-
- was included in the block
at height{' '}
- {formatNumber(parseFloat(txHeight))}
-
+ {txHeight && (
+
+ was included in the block
at height{' '}
+ {formatNumber(parseFloat(txHeight))}
+
+ )}