1.0.4 • Published 2 years ago

vottun-web3-walletconnect v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Vottun Web3 Login Tool

This project is entirely developed and owned by Vottun.

Available methods

Within this npm package, you can call the following methods:

connectWallet()

Triggers the Metamask window in order to make the user connect its wallet. \ Returns true if the user successfully connects its wallet and false otherwise. \ Disclaimer: the user must be on a non-private window and must have Metamask installed in its browser in order to complete this action.

getWalletInfo()

Asks for the information related to the wallet: address, chainId.\ Returns the information if the wallet is correctly connected, and null otherwise.

signMessage(origin, walletAddress, chainId)

Triggers the Metamask window in order to make the user sign an EIP191 message. Expects the following arguments:

  • origin: The URL of the origin page
  • walletAddress: The address of the connected wallet
  • chainId: The ID of the connected blockchain

Returns an object that contains the signatureHash and the nonce:

  • signatureHash: a hash that represents the result of the signature, which will have to be validated against the server in order to verify the operation
  • nonce: a unique hash used as an operation identifier, used for security purposes

Expected steps

When using this npm package in a web application, the steps that are supposed to be followed in order to achieve a successful Web3 login are: 1. Display a button that calls the connectWallet() method. 2. Retrieve the walletAddress and chainId values 3. Call the signMessage() method 4. Validate the obtained hash against the server 5. Manage the obtained accessToken as desired