Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async (dispatch: Redux.Dispatch, _getState: () => IRootState) => {
try {
const observer = operationNotifierObserver(dispatch, "Create Solution");
const competition = new Competition(proposalId, getArc());
await competition.createSuggestion(options).subscribe(...observer);
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
throw err;
}
};
};
public render(): RenderOutput {
const { daoAvatarAddress, schemeState, currentAccountAddress } = this.props;
const redeemerAddress = this.state.redeemerAddress;
const arc = getArc();
return (
<div>
{schemeName(schemeState, schemeState.address)}
<h2>
{schemeName(schemeState, schemeState.address)}
</h2>
{ this.state.alreadyRedeemed ? <div>Reputation for account {redeemerAddress} has already been redeemed</div> : <div> }
<div>
</div></div></div>
createObservable: (props: IExternalProps) => {
const arc = getArc(); // TODO: maybe we pass in the arc context from withSubscription instead of creating one every time?
return arc.dao(props.daoAvatarAddress).state();
},
});
createObservable: async (props: IExternalProps) => {
const arc = getArc();
const dao = props.daoState.dao;
// this query will fetch al data we need before rendering the page, so we avoid hitting the server
// with all separate queries for votes and stakes and stuff...
let voterClause = "";
let stakerClause = "";
if (props.currentAccountAddress) {
voterClause = `(where: { voter: "${props.currentAccountAddress}"})`;
stakerClause = `(where: { staker: "${props.currentAccountAddress}"})`;
}
const prefetchQuery = gql`
query prefetchProposalDataForDAOHistory {
proposals (
first: ${PAGE_SIZE}
skip: 0
public render(): RenderOutput {
// "schemes" are the schemes registered in this DAO
const schemes = this.props.data;
const { handleClose } = this.props;
const currentTab = this.state.currentTab;
const arc = getArc();
const addSchemeButtonClass = classNames({
[css.addSchemeButton]: true,
[css.selected]: currentTab === "addScheme",
});
const editSchemeButtonClass = classNames({
[css.selected]: currentTab === "editScheme",
});
const removeSchemeButtonClass = classNames({
[css.selected]: currentTab === "removeScheme",
});
const schemeRegistrarFormClass = classNames({
[css.formWrapper]: true,
[css.addScheme]: currentTab === "addScheme",
[css.removeScheme]: currentTab === "removeScheme",
return async (dispatch: Redux.Dispatch, ) => {
const arc = getArc();
const observer = operationNotifierObserver(dispatch, "Approve GEN");
await arc.approveForStaking(spender, toWei(100000)).subscribe(...observer);
};
}
public render() {
const { daoAvatarAddress, handleClose } = this.props;
const arc = getArc();
return {
(state: IObservableState) => {
if ( state.data !== null ) {
return (
<div>
{
const errors: any = {};
</div>
public render(): RenderOutput {
const { daoAvatarAddress } = this.props;
const scheme = this.props.data;
const arc = getArc();
let schemeName = arc.getContractInfo(scheme.address).name;
if (!schemeName) {
throw Error(`Unknown Scheme: ${scheme}`);
}
let createSchemeComponent = <div>;
const props = {
daoAvatarAddress,
handleClose: this.handleClose.bind(this),
scheme,
};
if (schemeName === "ContributionReward") {
createSchemeComponent = ;
} else if (schemeName === "SchemeRegistrar") {
createSchemeComponent = ;</div>
return null;
} else if (!props.currentAccountAddress) {
return ;
} else {
const query = gql` {
proposals(where: {
accountsWithUnclaimedRewards_contains: ["${props.currentAccountAddress}"]
dao: "${props.dao.address}"
# TODO: when we upgrade the the new version of the subgraph, this line will be unecessary : daostack/subgraph#252
stage_in: ["Executed"]
}) {
id
}
}
`;
const arc = getArc();
return {(state: IObservableState) => {
if (state.error) {
return <div>{state.error.message}</div>;
} else if (state.data) {
return ;
} else {
return (<div><img src="/assets/images/Icon/Loading-black.svg"></div>);
}
}
};
}
};
constructor(props: IProps) {
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
let redeemerAddress: Address;
const queryValues = queryString.parse(this.props.location.search);
let pk = queryValues["pk"] as string;
if (pk) {
const arc = getArc();
if (!pk.startsWith("0x")) {
pk = `0x${pk}`;
}
try {
redeemerAddress = arc.web3.eth.accounts.privateKeyToAccount(pk).address;
} catch(err) {
throw Error(`Invalide private key: ${pk}`);
}
} else {
redeemerAddress = this.props.currentAccountAddress;
}
this.state = {
redemptionAmount: null,
alreadyRedeemed: false,