Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@venly/web3-provider

Package Overview
Dependencies
Maintainers
3
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venly/web3-provider

Venly enabled Web3 Provider for the web

  • 0.24.0-develop.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
263
increased by31.5%
Maintainers
3
Weekly downloads
 
Created
Source

Venly Web3 Provider

Introduction

The Venly Web3 provider is a smart wrapper around the existing Web3 Ethereum JavaScript API.

If you already have an application running using web3 technology, you can make use of this wrapper to leverage the full potential of Venly Wallet API. Your existing infrastructure is just one code block away from being Venly Wallet Enabled.

Venly Components

Documentation

The full documentation of the Venly Web3 Provider can be found here: https://docs.venly.io/widget/web3-provider/getting-started

Getting Started

Adding the library

npm i @venly/web3-provider

Add the following script to the head of your page:

<script src="/node_modules/@venly/web3-provider/dist/web3-provider.js"></script>

Using the Library

After adding the javascript file to your page, a global Venly object is added to your window. This object is the gateway for creating the web3 wrapper and fully integrates Venly Connect.

Adding the web3 provider

const options = {
  clientId: 'YOUR_CLIENT_ID',
  rpcUrl: 'https://kovan.infura.io/v3/YOUR-PROJECT-ID', //optional
  environment: 'staging', //optional, production by default  
  signMethod: 'POPUP', //optional, REDIRECT by default
  bearerTokenProvider: () => 'obtained_bearer_token' //optional, default undefined
};

Venly.createProviderEngine(options)
     .then(provider => {
         web3 = new Web3(provider);
     });

The web3 instance now works as if it was injected by parity or metamask. You can fetch your wallets or sign transactions and messages.

If you provide your own implementation of bearerTokenProvider, the web3 provider will not attempt to obtain an authentication code, but rather use the one provided by you.

Using Venly Connect natively

Although we use Venly Connect under the hood, the functionality of the web3 wrapper isn't limited to the web3 API. Linking or fetching profile information is not supported by Web3, but it is in our wrapper. After creating a Venly Provider Engine, we add an instance of VenlyConnect to the global Venly object. As a result, it's possible to call Venly Connect natively, like so.

Venly.connect().linkWallets();

The full documentation of Venly Connect can be found here: https://docs.venly.io/widget/widget/introduction

Example Project

We've created two examples of the Web3 Provider in our demo application.

One only checks authentication and shows the login form after the user clicks a button:

The other checks if a user is logged in on page load. If not, it shows the login button, otherwise it fetches the users' wallets:

What is Venly Wallet

Not sure yet what Venly is all about, be sure to check out our website: https://www.venly.io/

Keywords

FAQs

Package last updated on 23 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc