Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/autz experiment: DO NOT MERGE #1146

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8fef5ae
fix(hfr): refactor
dimakorzhovnik Mar 15, 2024
878b934
fix(hfr): slider, resourceToken
dimakorzhovnik Mar 15, 2024
36aa09d
refactor(hfr): folder, index
dimakorzhovnik Mar 15, 2024
a6c8bb9
fix(hfr): position relative
dimakorzhovnik Mar 15, 2024
de9696a
Merge branch 'master' of https://github.com/cybercongress/dot-cyber i…
dimakorzhovnik Mar 19, 2024
ab35c53
refactor(mint): actionBar
dimakorzhovnik Mar 20, 2024
683db43
refactor(app): config
dimakorzhovnik Mar 21, 2024
576105d
refactor(config): update docker
dimakorzhovnik Mar 21, 2024
ef250a1
refactor(type): update Networks
dimakorzhovnik Mar 21, 2024
5f90dde
refactor(app): update config
dimakorzhovnik Mar 21, 2024
8141810
Merge branch 'master' into fix/hfr-update
dimakorzhovnik Mar 21, 2024
b1075af
refactor(app): utils/config
dimakorzhovnik Mar 21, 2024
361f8c8
fix(app): config
dimakorzhovnik Mar 21, 2024
fd7b60c
refactor(minor): some cleanup, cyblog into neuron api
dasein108 Mar 22, 2024
2241e11
fix(app): rename denom to base denom
dimakorzhovnik Mar 22, 2024
7dade99
Merge branch 'refactoring/zerg-rush' into fix/hfr-update
dimakorzhovnik Mar 22, 2024
a9acab4
refactor hfr (#1125)
dimakorzhovnik Mar 22, 2024
5f3483f
feat(api): add gql codegen
dasein108 Mar 23, 2024
c74a4d2
feat(api): rm gql dependency
dasein108 Mar 23, 2024
c3bf31d
feat(api): add gql codegen
dasein108 Mar 23, 2024
b721a3b
Merge branch 'refactoring/zerg-rush' of github.com:cybercongress/cyb …
dasein108 Mar 23, 2024
0aaeaf6
refactor(timeline): use codegen graphql
dasein108 Mar 23, 2024
b68c4b1
refactor(gql): codegen tx subscription
dasein108 Mar 23, 2024
d4dcc2d
refactor(app): rnaming consts, small clenup
dasein108 Mar 23, 2024
f6724d8
feat(lcd): lcd autogenerated typescript defenitions
dasein108 Mar 23, 2024
09e5113
feat(lcd): lcd autogenerated typescript defenitions AXIOS
dasein108 Mar 23, 2024
d781272
feat(lcd): example of lcd api usage
dasein108 Mar 23, 2024
d956931
feat(lcd): remove
dasein108 Mar 23, 2024
0bb0a58
refactor(app): modular api, cleanup
dasein108 Mar 24, 2024
d2cfdbe
refactor(backend): add graphql types, remove unused, restruct
dasein108 Mar 24, 2024
f1ca9c0
refactor(app): minor fixes
dasein108 Mar 24, 2024
4894367
refactor(app): reorder soft3
dasein108 Mar 24, 2024
30cfdba
refactor(tx): minor
dasein108 Mar 24, 2024
d37bc20
fix(backend): multitab service statuses
dasein108 Mar 26, 2024
f48dae8
refactor(gql): upyime, cyberlinkByCid, wasm
dimakorzhovnik Mar 26, 2024
5a56f2c
refactor(gql): val page
dimakorzhovnik Mar 27, 2024
e899cf4
refactor(gql): cyberlink, acc, contracts
dimakorzhovnik Mar 27, 2024
201d772
refactor(gql): cyberlink count by cid
dimakorzhovnik Mar 27, 2024
d689fff
refactor(gql): block, cyberlink
dimakorzhovnik Mar 28, 2024
9797382
refactor(comp): txTable
dimakorzhovnik Mar 29, 2024
9573865
feat(autz): grant cyberlink
dasein108 Mar 30, 2024
ead55d2
feat(autz): grant cyberlink rights test
dasein108 Apr 2, 2024
6ec46ba
feat(autz): grant cyberlink rights test
dasein108 Apr 2, 2024
dd9490c
fix(autz): rm unused
dasein108 Apr 2, 2024
01037b2
Merge branch 'refactoring/zerg-rush' into feat/autz-experiment
dasein108 Apr 3, 2024
5a19294
fix(app): config
dasein108 Apr 4, 2024
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
23 changes: 23 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -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;
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
23 changes: 11 additions & 12 deletions src/components/BandwidthBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ 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,
formatCurrency,
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 = [
{
Expand Down Expand Up @@ -55,26 +54,26 @@ function ContentTooltip({ bwRemained, bwMaxValue, amounPower, countLink }) {
{text}
<Link
to={
CYBER.CHAIN_ID === Networks.BOSTROM
CHAIN_ID === Networks.BOSTROM
? routes.search.getLink('get BOOT')
: routes.teleport.path
}
>
Get {CYBER.DENOM_CYBER.toUpperCase()}
Get {BASE_DENOM.toUpperCase()}
</Link>
</Text>
</Pane>
</Pane>
);
}

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();
Expand Down
4 changes: 2 additions & 2 deletions src/components/MusicalAddress/utils.js
Original file line number Diff line number Diff line change
@@ -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' },
Expand Down
11 changes: 11 additions & 0 deletions src/components/TableTxs/ActionTx.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

function ActionTx() {
return (
<div>

</div>
)
}

export default ActionTx
99 changes: 99 additions & 0 deletions src/components/TableTxs/TableTxs.tsx
Original file line number Diff line number Diff line change
@@ -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]: (
<TextTable>
<img
style={{ width: '20px', height: '20px', marginRight: '5px' }}
src={item.transaction.success ? statusTrueImg : statusFalseImg}
alt="status"
/>
</TextTable>
),
[ColumnsTable.type]: (
<div style={{ maxWidth: '100px' }}>
<MsgType type={typeTx} />
</div>
),
[ColumnsTable.timestamp]: (
<TextTable>{timeSince(timeAgoInMS)} ago</TextTable>
),
[ColumnsTable.tx]: (
<TextTable>
<Link to={routes.txExplorer.getLink(item.transaction_hash)}>
{trimString(item.transaction_hash, 6, 6)}
</Link>
</TextTable>
),
// [ColumnsTable.action]: (),
};
});
}, []);

return (
<Display noPaddingX>
<InfiniteScroll
dataLength={(data?.messages_by_address || []).length}
next={fetchMoreData}
hasMore={hasMore}
loader={
<p>
Loading <Dots />
</p>
}
style={{ display: 'grid', gap: '15px' }}
>
<Table
data={tableData}
columns={Object.values(ColumnsTable).map((item) => ({
header: item,
accessorKey: item,
cell: (info) => info.getValue(),
}))}
/>
</InfiniteScroll>
</Display>
);
}

export default TableTxs;
4 changes: 2 additions & 2 deletions src/components/TokenChange/TokenChange.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,7 +25,7 @@ function TokenChange({ total, change = 0, className }: Props) {
</div>
)}

<FormatNumberTokens value={total} text={CYBER.DENOM_LIQUID_TOKEN} />
<FormatNumberTokens value={total} text={DENOM_LIQUID} />
</div>
);
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/account/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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)
),
}
);
Expand Down Expand Up @@ -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}`;
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/actionBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');

Expand Down Expand Up @@ -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 &&
Expand Down
6 changes: 3 additions & 3 deletions src/components/contentIpfs/contentIpfs.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -22,14 +22,14 @@ function OtherItem({
<TextMarkdown preview={search}>{content || `${cid} (n/a)`}</TextMarkdown>
);
}
return <GatewayContent url={`${CYBER.CYBER_GATEWAY}/ipfs/${cid}`} />;
return <GatewayContent url={`${CYBER_GATEWAY}/ipfs/${cid}`} />;
}

function DownloadableItem({ cid, search }: { cid: string; search?: boolean }) {
if (search) {
return <div>{`${cid} (gateway)`}</div>;
}
return <GatewayContent url={`${CYBER.CYBER_GATEWAY}/ipfs/${cid}`} />;
return <GatewayContent url={`${CYBER_GATEWAY}/ipfs/${cid}`} />;
}

type ContentTabProps = {
Expand Down
Loading