How to use @walletconnect/qrcode-modal - 10 common examples

To help you get started, we’ve selected a few @walletconnect/qrcode-modal 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 trustwallet / platform / src / ui / components / App.tsx View on Github external
const connect = async (): Promise => {
  // Check if connection is already established
  if (!walletConnector.connected) {
    createConnector();
    // create new session
    await walletConnector.createSession();
    // get uri for QR Code modal
    const uri = walletConnector.uri;
    // display QR Code modal
    WalletConnectQRCodeModal.open(uri, () => {
      console.log('QR Code Modal closed');
    });

    subscribe();
  } else {
    await walletConnector.killSession();
  }
};
github WalletConnect / walletconnect-example-dapp / src / App.tsx View on Github external
await this.setState({ walletConnector });

    // check if already connected
    if (!walletConnector.connected) {
      // create new session
      await walletConnector.createSession();

      // get uri for QR Code modal
      const uri = walletConnector.uri;

      // console log the uri for development
      console.log(uri); // tslint:disable-line

      // display QR Code modal
      WalletConnectQRCodeModal.open(uri, () => {
        console.log("QR Code Modal closed"); // tslint:disable-line
      });
    }
    // subscribe to events
    await this.subscribeToEvents();
  };
  public subscribeToEvents = () => {
github trustwallet / platform / src / app / auth / services / providers / wallet-connect / wallet-connect.service.ts View on Github external
switchMap(() => {
          const result = new Subject();
          const uri = this.connector.uri;
          console.log(uri);
          let ignoreClose = false;
          // display QR Code modal
          WalletConnectQRCodeModal.open(uri, () => {
            if (!ignoreClose) {
              result.error(Errors.REJECTED_BY_USER);
            }
          });
          // hack to make QR code window above ng-bootstrap windows
          document.getElementById("walletconnect-qrcode-modal").style.zIndex =
            "9999999999";
          this.connector.on("connect", (error, payload) => {
            if (error) {
              result.error(error);
            }

            ignoreClose = true;

            // Close QR Code Modal
            WalletConnectQRCodeModal.close();
github WalletConnect / walletconnect-monorepo / packages / eth-provider / src / connection.ts View on Github external
this.wc.on('connect', (err: Error | null, payload: any) => {
      if (err) {
        this.emit('error', err)
        return
      }

      this.connected = true

      if (this.qrcode) {
        WCQRCode.close() // Close QR Code Modal
      }

      // Handle session update
      this.updateState(payload.params[0])

      // Emit connect event
      this.emit('connect')
    })
github WalletConnect / walletconnect-monorepo / packages / web3-subprovider / src / connection.ts View on Github external
this.wc.on('connect', (err: Error | null, payload: any) => {
      if (err) {
        this.emit('error', err)
        return
      }

      this.connected = true

      if (this.qrcode) {
        WCQRCode.close() // Close QR Code Modal
      }

      // Handle session update
      this.updateState(payload.params[0])

      // Emit connect event
      this.emit('connect')
    })
github WalletConnect / walletconnect-monorepo / packages / web3-provider / src / index.js View on Github external
wc.on('connect', (error, payload) => {
              if (this.qrcode) {
                WalletConnectQRCodeModal.close()
              }
              if (error) {
                this.isConnecting = false
                return reject(error)
              }
              this.isConnecting = false
              this.connected = true

              if (payload) {
                // Handle session update
                this.updateState(payload.params[0])
              }
              // Emit connect event
              this.emit('connect')

              this.triggerConnect(wc)
github trustwallet / platform / src / ui / components / App.tsx View on Github external
walletConnector.on('connect', (error: string) => {
    if (error) {
      console.log('Error on connect:' + error);
    }
    // Close QR Code Modal
    WalletConnectQRCodeModal.close();
  });
github WalletConnect / walletconnect-monorepo / packages / web3-provider / src / index.js View on Github external
.then(() => {
            if (this.qrcode) {
              WalletConnectQRCodeModal.open(wc.uri, () => {
                reject(new Error('User closed WalletConnect modal'))
              })
            }
            wc.on('connect', (error, payload) => {
              if (this.qrcode) {
                WalletConnectQRCodeModal.close()
              }
              if (error) {
                this.isConnecting = false
                return reject(error)
              }
              this.isConnecting = false
              this.connected = true

              if (payload) {
                // Handle session update
github trustwallet / platform / src / app / auth / services / providers / wallet-connect / wallet-connect.service.ts View on Github external
this.connector.on("connect", (error, payload) => {
            if (error) {
              result.error(error);
            }

            ignoreClose = true;

            // Close QR Code Modal
            WalletConnectQRCodeModal.close();

            result.next(true);
          });
          return result;
github WalletConnect / walletconnect-monorepo / packages / channel-provider / src / connection.ts View on Github external
public openQRCode () {
    const uri = this.wc ? this.wc.uri : ''
    if (uri) {
      WCQRCode.open(uri, () => {
        this.emit('error', new Error('User close WalletConnect QR Code modal'))
      })
    }
  }
  public create () {

@walletconnect/qrcode-modal

QR Code Modal for WalletConnect

Apache-2.0
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Popular @walletconnect/qrcode-modal functions