Skip to content

Commit

Permalink
Merge pull request #260 from forbole/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
calvinkei committed Sep 6, 2021
2 parents 65b9962 + db4fa90 commit 0954107
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 41 deletions.
44 changes: 21 additions & 23 deletions components/AccountBalanceCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import useTranslation from 'next-translate/useTranslation'
import React from 'react'
import get from 'lodash/get'
import { PieChart, Pie, Cell, ResponsiveContainer } from 'recharts'
import { PieChart, Pie, Cell } from 'recharts'
import useStyles from './styles'
import { CustomTheme } from '../../misc/theme'
import { formatCrypto, formatCurrency } from '../../misc/utils'
Expand Down Expand Up @@ -78,28 +78,26 @@ const AccountBalanceCard: React.FC<AccountBalanceCardProps> = ({ accountBalance,
<Card className={classes.container}>
<Typography variant="h4">{t('balance')}</Typography>
<Box display="flex" my={2} alignItems="center">
<ResponsiveContainer height={theme.spacing(20)} width={theme.spacing(20)}>
<PieChart>
<Pie
data={data.filter((d) => !!d.value)}
innerRadius={theme.spacing(8.5)}
outerRadius={theme.spacing(8.5)}
paddingAngle={12}
dataKey="value"
>
{data
.filter((d) => !!d.value)
.map((d) => (
<Cell
key={d.name}
strokeLinejoin="round"
strokeWidth={theme.spacing(1.5)}
stroke={d.color}
/>
))}
</Pie>
</PieChart>
</ResponsiveContainer>
<PieChart height={theme.spacing(20)} width={theme.spacing(20)}>
<Pie
data={data.filter((d) => !!d.value)}
innerRadius={theme.spacing(8.5)}
outerRadius={theme.spacing(8.5)}
paddingAngle={12}
dataKey="value"
>
{data
.filter((d) => !!d.value)
.map((d) => (
<Cell
key={d.name}
strokeLinejoin="round"
strokeWidth={theme.spacing(1.5)}
stroke={d.color}
/>
))}
</Pie>
</PieChart>
<Box flex={1} ml={10}>
{data.map((d) => (
<Box key={d.name} display="flex" alignItems="center" justifyContent="space-between">
Expand Down
2 changes: 2 additions & 0 deletions graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Object.keys(cryptocurrencies).forEach((crypto) => {
uri: cryptocurrencies[crypto].graphqlWsUrl,
options: {
reconnect: true,
lazy: true,
inactivityTimeout: 30000,
},
webSocketImpl: WebSocket,
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forbole-x",
"version": "0.4.5",
"version": "0.4.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
1 change: 1 addition & 0 deletions pages/account/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Account: React.FC = () => {
const account = accounts.find((a) => a.address === router.query.address)
const wallet = wallets.filter((x) => x.id === account?.walletId)[0]
const crypto = account ? cryptocurrencies[account.crypto] : Object.values(cryptocurrencies)[0]

const { data: validatorsData } = useSubscription(
gql`
${getValidators(crypto.name)}
Expand Down
6 changes: 3 additions & 3 deletions patches/@cosmjs+stargate+0.26.0.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@cosmjs/stargate/build/accounts.js b/node_modules/@cosmjs/stargate/build/accounts.js
index 55753d0..849f1ec 100644
index 55753d0..ec8b325 100644
--- a/node_modules/@cosmjs/stargate/build/accounts.js
+++ b/node_modules/@cosmjs/stargate/build/accounts.js
@@ -58,6 +58,11 @@ function accountFromAny(input) {
Expand All @@ -8,8 +8,8 @@ index 55753d0..849f1ec 100644
}
+ // custom
+ case "/desmos.profiles.v1beta1.Profile": {
+ const baseAccount = auth_1.ProfileAccount.decode(value).baseAccount;
+ return accountFromBaseAccount(baseAccount);
+ const account = auth_1.ProfileAccount.decode(value).account;
+ return accountFromAny(account);
+ }
default:
throw new Error(`Unsupported type: '${typeUrl}'`);
Expand Down
85 changes: 71 additions & 14 deletions patches/cosmjs-types+0.2.0.patch
Original file line number Diff line number Diff line change
@@ -1,31 +1,88 @@
diff --git a/node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js b/node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js
index 0673e21..adc499d 100644
index 0673e21..41ebbd1 100644
--- a/node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js
+++ b/node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js
@@ -355,4 +355,25 @@ if (minimal_1.default.util.Long !== long_1.default) {
@@ -8,6 +8,7 @@ exports.Params = exports.ModuleAccount = exports.BaseAccount = exports.protobufP
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const any_1 = require("../../../google/protobuf/any");
+const timestamp_1 = require("../../../google/protobuf/timestamp");
exports.protobufPackage = "cosmos.auth.v1beta1";
const baseBaseAccount = { address: "", accountNumber: long_1.default.UZERO, sequence: long_1.default.UZERO };
exports.BaseAccount = {
@@ -355,4 +356,74 @@ if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
+
+exports.ProfileAccount = {
+// Desmos Profile
+
+function fromTimestamp(t) {
+ let millis = t.seconds * 1_000
+ millis += t.nanos / 1_000_000
+ return new Date(millis)
+}
+
+const Pictures = {
+ decode(input, length) {
+ const basePictures = { profile: '', cover: '' }
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = Object.assign({}, baseModuleAccount);
+ message.permissions = [];
+ let end = length === undefined ? reader.len : reader.pos + length
+ const message = { ...basePictures }
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ const tag = reader.uint32()
+ switch (tag >>> 3) {
+ case 1:
+ message.baseAccount = exports.BaseAccount.decode(any_1.Any.decode(reader, reader.uint32()).value);
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ case 1:
+ message.profile = reader.string()
+ break
+ case 2:
+ message.cover = reader.string()
+ break
+ default:
+ reader.skipType(tag & 7)
+ break
+ }
+ }
+ return message;
+ return message
+ },
+}
+
+exports.ProfileAccount = {
+ decode(input, length) {
+ const baseProfile = { dtag: '', nickname: '', bio: '' }
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length
+ const message = { ...baseProfile }
+ while (reader.pos < end) {
+ const tag = reader.uint32()
+ switch (tag >>> 3) {
+ case 1:
+ message.account = any_1.Any.decode(reader, reader.uint32())
+ break
+ case 2:
+ message.dtag = reader.string()
+ break
+ case 3:
+ message.nickname = reader.string()
+ break
+ case 4:
+ message.bio = reader.string()
+ break
+ case 5:
+ message.pictures = Pictures.decode(reader, reader.uint32())
+ break
+ case 6:
+ message.creationDate = fromTimestamp(
+ timestamp_1.Timestamp.decode(reader, reader.uint32())
+ )
+ break
+ default:
+ reader.skipType(tag & 7)
+ break
+ }
+ }
+ return message
+ },
+};
//# sourceMappingURL=auth.js.map
\ No newline at end of file

0 comments on commit 0954107

Please sign in to comment.