Skip to main content

AlgoWCButton

A button to connect to WalletConnect. Generates an embedded QR code to scan with phone camera. Upon success, returns the first wallet address.

Some Fallback Content


Accessing returned address#

The returned address can be accessed several different ways. Setting the context prop to {this} and the returnTo prop to a state key (as string) will return the address directly to your parent component's state without the need for additional callback or event handler code. The address can also be accessed with Pipeline.address:

componentDidMount() {      this.interval = setInterval(() => this.setState({address: Pipeline.address}), 1000);    }

or with an onChange handler:

handleChange = (value) =>{    this.setState({myAddress: value})  }
  render(){    return <AlgoWCButton onChange={this.handleChange}/>  }

Use Example#

import React, { Component } from 'react';import { AlgoWCButton, Pipeline} from 'pipeline-ui';

class TestButton extends Component {
  constructor(props) {    super(props);    this.state = {      Algaddress: ""    }  }    myAlgoWallet = Pipeline.init();
  render() {    return <div>      <AlgoWCButton             context={this}             returnTo={"Algaddress"}             />      <h1>{this.state.Algaddress}</h1>    </div>  }}
export default TestButton;

Props#

PropTypeDefaultDescription
contextreference
returnTostringempty stringkey in state to return fetched address
onChangefunctionenables callback (see example above)