How to use the arc.getCurrentAccountAddress 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 / layouts / AppContainer.tsx View on Github external
public async componentWillMount() {
    let metamask: any;
    const currentAddress = await getCurrentAccountAddress();
    if (currentAddress)  {
      console.log(`using address from web3 connection: ${currentAddress}`);
      this.props.cookies.set("currentAddress", currentAddress, { path: "/"});
      this.props.setCurrentAccount(currentAddress);
    } else {
      const currentAddressFromCookie = this.props.cookies.get("currentAddress");
      if (currentAddressFromCookie) {
        console.log(`using address from cookie: ${currentAddressFromCookie}`);
        this.props.setCurrentAccount(currentAddressFromCookie);
      } else {
        this.props.cookies.set("currentAddress", "", { path: "/"});
        this.props.setCurrentAccount(undefined);
      }
    }

    try {