How to use the arc.getArc function in arc

To help you get started, we’ve selected a few arc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github daostack / alchemy / src / components / Scheme / ContributionRewardExtRewarders / Competition / utils.ts View on Github external
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;
    }
  };
};
github daostack / alchemy / src / components / Scheme / ReputationFromToken.tsx View on Github external
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>
github daostack / alchemy / src / components / Proposal / Create / SchemeForms / CreateContributionRewardProposal.tsx View on Github external
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();
  },
});
github daostack / alchemy / src / components / Dao / DaoHistoryPage.tsx View on Github external
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
github daostack / alchemy / src / components / Proposal / Create / SchemeForms / CreateSchemeRegistrarProposal.tsx View on Github external
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",
github daostack / alchemy / src / actions / arcActions.ts View on Github external
return async (dispatch: Redux.Dispatch, ) =&gt; {
    const arc = getArc();
    const observer = operationNotifierObserver(dispatch, "Approve GEN");
    await arc.approveForStaking(spender, toWei(100000)).subscribe(...observer);
  };
}
github daostack / alchemy / src / components / CreateProposal / SchemeForms / CreateUnknownGenericSchemeProposal.tsx View on Github external
public render() {
    const {  daoAvatarAddress, handleClose } = this.props;
    const arc = getArc();

    return {
      (state: IObservableState) =&gt; {
        if ( state.data !== null ) {
          return (
            <div>
               {
                  const errors: any = {};
</div>
github daostack / alchemy / src / components / Proposal / Create / CreateProposalPage.tsx View on Github external
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>
github daostack / alchemy / src / components / ViewDao / DaoSidebar.tsx View on Github external
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) =&gt; {
      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>);
      }
    }
    };
  }
};
github daostack / alchemy / src / components / Scheme / ReputationFromToken.tsx View on Github external
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,