Skip to content

Commit

Permalink
Merge pull request #2169 from daostack/release
Browse files Browse the repository at this point in the history
Release 0.10.17
  • Loading branch information
dkent600 authored Oct 6, 2020
2 parents 5862e77 + a4849e6 commit 3f56370
Show file tree
Hide file tree
Showing 31 changed files with 464 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js: 12.16.2
node_js: 12.18.4
addons:
apt:
update: true
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.17
- Bugs Fixed
- Fixed issues with automated update of blockchain data by switching from a websocket to a polling interface with the subgraph

## 0.10.16
- Features Added
- show account holdings even when out of scope of a DAO
Expand Down
5 changes: 5 additions & 0 deletions data/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
"decimals": 6,
"name": "USD Coin",
"symbol": "USDC"
},
"0x3426d85D140c85C5ebB6E4D343C5be8e4E001869": {
"decimals": 18,
"name": "API3 token",
"symbol": "API3"
}
}
},
Expand Down
15 changes: 4 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alchemy-client",
"version": "0.10.16",
"version": "0.10.17",
"description": "An app for collaborative networks (DAOs), based on the DAO stack.",
"author": "DAOstack",
"license": "GPL-3.0",
Expand All @@ -10,8 +10,8 @@
"url": "git+https://github.com/daostack/alchemy.git"
},
"engines": {
"node": "12.16.2",
"npm": "6.14.4"
"node": "12.18.4",
"npm": "6.14.6"
},
"jest": {
"testURL": "http://127.0.0.1:3000/",
Expand Down Expand Up @@ -79,7 +79,7 @@
"dependencies": {
"3box": "1.17.1",
"@burner-wallet/burner-connect-provider": "^0.1.1",
"@daostack/arc.js": "0.2.73",
"@daostack/arc.js": "0.2.74",
"@dorgtech/daocreator-ui": "^1.0.13",
"@fortawesome/fontawesome-svg-core": "^1.2.10",
"@fortawesome/free-brands-svg-icons": "^5.6.1",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Account/AccountBalances.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, IDAOState, IMemberState } from "@daostack/arc.js";
import { baseTokenName, ethErrorHandler, genName, ethBalance } from "lib/util";
import { baseTokenName, ethErrorHandler, genName, ethBalance, standardPolling } from "lib/util";

import BN = require("bn.js");
import AccountBalance from "components/Account/AccountBalance";
Expand Down Expand Up @@ -69,7 +69,7 @@ export default withSubscription({

return combineLatest(
address,
(address && dao && dao.dao.member(address).state( { subscribe: true })) || of(null),
(address && dao && dao.dao.member(address).state( standardPolling())) || of(null),
ethBalance(address).pipe(ethErrorHandler()),
arc.GENToken().balanceOf(address).pipe(ethErrorHandler()),
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Account/AccountProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ThreeboxModal from "components/Shared/ThreeboxModal";
import withSubscription, { ISubscriptionProps } from "components/Shared/withSubscription";
import { Field, Formik, FormikProps } from "formik";
import Analytics from "lib/analytics";
import { baseTokenName, ethErrorHandler, genName, formatTokens, ethBalance } from "lib/util";
import { baseTokenName, ethErrorHandler, genName, formatTokens, ethBalance, standardPolling } from "lib/util";
import CopyToClipboard, { IconColor } from "components/Shared/CopyToClipboard";
import { Page } from "pages";
import { parse } from "query-string";
Expand Down Expand Up @@ -329,7 +329,7 @@ const SubscribedAccountProfilePage = withSubscription({

return combineLatest(
// subscribe if only to to get DAO reputation supply updates
daoAvatarAddress ? dao.state( {subscribe: true}) : of(null),
daoAvatarAddress ? dao.state( standardPolling()) : of(null),
daoAvatarAddress ? dao.member(accountAddress).state() : of(null),
ethBalance(accountAddress)
.pipe(ethErrorHandler()),
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dao/DaoContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import DaoHistoryPage from "./DaoHistoryPage";
import DaoMembersPage from "./DaoMembersPage";
import * as css from "./Dao.scss";
import DaoLandingPage from "components/Dao/DaoLandingPage";
import { standardPolling } from "lib/util";

type IExternalProps = RouteComponentProps<any>;

Expand Down Expand Up @@ -151,7 +152,7 @@ const SubscribedDaoContainer = withSubscription({
const daoAddress = props.match.params.daoAvatarAddress;
const dao = arc.dao(daoAddress);
const observable = combineLatest(
dao.state({ subscribe: true, fetchAllData: true }), // DAO state
dao.state(standardPolling(true)), // DAO state
dao.members()
);
return observable;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dao/DaoHistoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { first } from "rxjs/operators";
import ProposalHistoryRow from "../Proposal/ProposalHistoryRow";
import * as css from "./DaoHistoryPage.scss";
import { Observable } from "rxjs";
import { standardPolling } from "lib/util";

const PAGE_SIZE = 50;

Expand Down Expand Up @@ -209,7 +210,7 @@ export default withSubscription({
${Scheme.fragments.SchemeFields}
`;

await arc.getObservable(prefetchQuery, { subscribe: true }).pipe(first()).toPromise();
await arc.getObservable(prefetchQuery, standardPolling()).pipe(first()).toPromise();

return proposalsQuery(dao, 0);
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dao/DaoSchemesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { mergeMap } from "rxjs/operators";
import * as css from "./DaoSchemesPage.scss";
import ProposalSchemeCard from "./ProposalSchemeCard";
import SimpleSchemeCard from "./SimpleSchemeCard";
import { standardPolling } from "lib/util";

const Fade = ({ children, ...props }: any) => (
<CSSTransition
Expand Down Expand Up @@ -150,7 +151,7 @@ const SubscribedDaoSchemesPage = withSubscription({
const dao = props.daoState.dao;

return combineLatest(
dao.schemes({ where: { isRegistered: true } }, { fetchAllData: true, subscribe: true }),
dao.schemes({ where: { isRegistered: true } }, standardPolling(true)),
// Find the SchemeManager scheme if this dao has one
Scheme.search(arc, {where: { dao: dao.id, name: "SchemeRegistrar" }}).pipe(mergeMap((scheme: Array<Scheme | CompetitionScheme>): Observable<ISchemeState> => scheme[0] ? scheme[0].state() : of(null)))
);
Expand Down
9 changes: 3 additions & 6 deletions src/components/Dao/ProposalSchemeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import VoteGraph from "components/Proposal/Voting/VoteGraph";
import ProposalCountdown from "components/Shared/ProposalCountdown";
import Loading from "components/Shared/Loading";
import withSubscription, { ISubscriptionProps } from "components/Shared/withSubscription";
import { humanProposalTitle } from "lib/util";
import { humanProposalTitle, standardPolling } from "lib/util";
import { schemeName } from "lib/schemeUtils";
import * as React from "react";
import { Link } from "react-router-dom";
Expand Down Expand Up @@ -91,17 +91,14 @@ export default withSubscription({
const arc = getArc();
const dao = arc.dao(props.dao.address);
return combineLatest(
props.scheme.state(),
props.scheme.state(standardPolling()),
dao.proposals({ where: {
scheme: props.scheme.id,
// eslint-disable-next-line @typescript-eslint/camelcase
stage_in: [IProposalStage.Boosted, IProposalStage.QuietEndingPeriod],
},
orderBy: "boostedAt",
}, {
fetchAllData: true,
subscribe: true, // subscribe to updates of the proposals. We can replace this once https://github.com/daostack/subgraph/issues/326 is done
}) // the list of boosted proposals
}, standardPolling(true)) // the list of boosted proposals
);
},
});
Expand Down
20 changes: 10 additions & 10 deletions src/components/Daos/DaosPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IRootState } from "reducers";
import { combineLatest, of } from "rxjs";
import { first } from "rxjs/operators";
import cn from "classnames";
import { showSimpleMessage } from "lib/util";
import { showSimpleMessage, standardPolling } from "lib/util";
import DaoCard from "./DaoCard";
import * as css from "./Daos.scss";
import BHubReg from "../Buidlhub/Registration";
Expand Down Expand Up @@ -136,8 +136,8 @@ class DaosPage extends React.Component<IProps, IState> {
// Otherwise show registered DAOs
otherDAOs = otherDAOs.filter((d: DAO) => {
return !yourDAOAddresses.includes(d.id) &&
d.staticState.name.toLowerCase().includes(search) &&
d.staticState.register === "registered";
d.staticState.name.toLowerCase().includes(search) &&
d.staticState.register === "registered";
});
}

Expand Down Expand Up @@ -184,8 +184,8 @@ class DaosPage extends React.Component<IProps, IState> {
<h2 data-test-id="header-all-daos">
Your DAOs
{process.env.NETWORK !== "xdai" ?
<i className={cn("fa fa-envelope", css.emailIcon)} onClick={this.registerForMonitoring}/>
: "" }
<i className={cn("fa fa-envelope", css.emailIcon)} onClick={this.registerForMonitoring} />
: ""}
</h2>
</div>
</div>
Expand Down Expand Up @@ -245,21 +245,21 @@ const createSubscriptionObservable = (props: IStateProps, data: SubscriptionData
}
${DAOFieldsFragment}
`;
const memberOfDAOs = currentAccountAddress ? arc.getObservableList(memberDAOsquery, (r: any) => createDaoStateFromQuery(r.dao).dao, { subscribe: true }) : of([]);
const memberOfDAOs = currentAccountAddress ? arc.getObservableList(memberDAOsquery, (r: any) => createDaoStateFromQuery(r.dao).dao, standardPolling()) : of([]);
// eslint-disable-next-line @typescript-eslint/camelcase
const followDAOs = followingDAOs.length ? arc.daos({ where: { id_in: followingDAOs }, orderBy: "name", orderDirection: "asc"}, { fetchAllData: true, subscribe: true }) : of([]);
const followDAOs = followingDAOs.length ? arc.daos({ where: { id_in: followingDAOs }, orderBy: "name", orderDirection: "asc" }, standardPolling(true)) : of([]);

return combineLatest(
arc.daos({ orderBy: "name", orderDirection: "asc", first: PAGE_SIZE, skip: data ? data[0].length : 0}, { fetchAllData: true, subscribe: true }),
arc.daos({ orderBy: "name", orderDirection: "asc", first: PAGE_SIZE, skip: data ? data[0].length : 0 }, standardPolling(true)),
followDAOs,
memberOfDAOs
);
};

const SubscribedDaosPage = withSubscription({
wrappedComponent: DaosPage,
loadingComponent: <div className={css.wrapper}><Loading/></div>,
errorComponent: (props) => <div>{ props.error.message }</div>,
loadingComponent: <div className={css.wrapper}><Loading /></div>,
errorComponent: (props) => <div>{props.error.message}</div>,

// Don't ever update the subscription
checkForUpdate: ["currentAccountAddress", "followingDAOs"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default withSubscription({
* Returns an array of ITagState.
* Ask for `first: 1000` to raise the minimum from the default of 100 to the max of 1000
*/
return arc.tags({ first: 1000 }, { subscribe: false })
return arc.tags({ first: 1000 }, { })
.pipe(
map((tags: Array<TagEntity>) => tags.map(tag => tag.staticState))
);
Expand Down
14 changes: 5 additions & 9 deletions src/components/Proposal/ProposalData.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address, IDAOState, IMemberState, IProposalState, IRewardState, Reward, Stake, Vote } from "@daostack/arc.js";
import { getArc } from "arc";
import { ethErrorHandler, ethBalance } from "lib/util";
import { ethErrorHandler, ethBalance, standardPolling } from "lib/util";

import BN = require("bn.js");
import withSubscription, { ISubscriptionProps } from "components/Shared/withSubscription";
Expand All @@ -20,10 +20,6 @@ interface IExternalProps {
daoState: IDAOState;
proposalId: string;
children(props: IInjectedProposalProps): JSX.Element;
/**
* true to subscribe to changes in votes, stakes and rewards
*/
subscribeToProposalDetails?: boolean;
}

interface IStateProps {
Expand Down Expand Up @@ -129,10 +125,10 @@ export default withSubscription({

if (currentAccountAddress) {
return combineLatest(
proposal.state({ subscribe: props.subscribeToProposalDetails }), // state of the current proposal
proposal.votes({where: { voter: currentAccountAddress }}, { subscribe: props.subscribeToProposalDetails }),
proposal.stakes({where: { staker: currentAccountAddress }}, { subscribe: props.subscribeToProposalDetails }),
proposal.rewards({ where: {beneficiary: currentAccountAddress}}, { subscribe: props.subscribeToProposalDetails })
proposal.state(standardPolling()), // state of the current proposal
proposal.votes({where: { voter: currentAccountAddress }}, standardPolling()),
proposal.stakes({where: { staker: currentAccountAddress }}, standardPolling()),
proposal.rewards({ where: {beneficiary: currentAccountAddress}}, standardPolling())
.pipe(map((rewards: Reward[]): Reward => rewards.length === 1 && rewards[0] || null))
.pipe(mergeMap(((reward: Reward): Observable<IRewardState> => reward ? reward.state() : of(null)))),

Expand Down
2 changes: 1 addition & 1 deletion src/components/Proposal/ProposalDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class ProposalDetailsPage extends React.Component<IProps, IState> {

export default function ProposalDetailsPageData(props: IExternalProps) {
const { currentAccountAddress, daoState, proposalId } = props;
return <ProposalData currentAccountAddress={currentAccountAddress} daoState={daoState} proposalId={proposalId} subscribeToProposalDetails>
return <ProposalData currentAccountAddress={currentAccountAddress} daoState={daoState} proposalId={proposalId}>
{proposalData => <ProposalDetailsPage {...props} {...proposalData} />}
</ProposalData>;
}
4 changes: 2 additions & 2 deletions src/components/Proposal/Voting/VotersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ const voterModalWithSubscriptions = withSubscription({
const dao = arc.dao(props.dao.address);
const proposalId = props.proposal.id;
const proposal = dao.proposal(proposalId);

return proposal.votes({}, { subscribe: false });
// subscribe is false by default
return proposal.votes({}, { });
},
});

Expand Down
9 changes: 5 additions & 4 deletions src/components/Redemptions/RedemptionsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { of } from "rxjs";
import { map } from "rxjs/operators";
import RedemptionsMenu from "./RedemptionsMenu";
import * as css from "./RedemptionsButton.scss";
import { standardPolling } from "lib/util";

interface IExternalProps {
currentAccountAddress?: Address;
Expand All @@ -27,7 +28,7 @@ class RedemptionsButton extends React.Component<IProps, null> {
}

return <div className={css.button} data-test-id="redemptionsButton">
{ document.documentElement.clientWidth < 640 ?
{document.documentElement.clientWidth < 640 ?
this.renderDirectLink()
: this.renderQuickMenuLink()
}
Expand All @@ -38,7 +39,7 @@ class RedemptionsButton extends React.Component<IProps, null> {
const { data: redeemableProposals } = this.props;
return <Link to="/redemptions">
<img src="/assets/images/Icon/menu/redemption.svg" />
{ redeemableProposals.length > 0 ?
{redeemableProposals.length > 0 ?
<span className={css.notification}></span>
: ""}
</Link>;
Expand All @@ -63,7 +64,7 @@ class RedemptionsButton extends React.Component<IProps, null> {
>
<div>
<img src="/assets/images/Icon/menu/redemption.svg" />
{ redeemableProposals.length > 0 ?
{redeemableProposals.length > 0 ?
<span className={css.notification}></span>
: ""}
</div>
Expand Down Expand Up @@ -96,7 +97,7 @@ export default withSubscription({
id
}
}`;
return arc.getObservable(redeemableProposalsQuery, { subscribe: true })
return arc.getObservable(redeemableProposalsQuery, standardPolling())
.pipe(map((result: any) => result.data.proposals));
},
});
Loading

0 comments on commit 3f56370

Please sign in to comment.