1.0.6 • Published 1 year ago

near-wallet-validator v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Licence npm version Downloads

near-wallet-validator

Checks if a near wallet exists.

Installation

npm i near-wallet-validator

Live Demo

https://codesandbox.io/s/near-wallet-validator-example-3r2lyo

Example

import "./styles.css";
import { NearRPC, nearWalletExists } from "near-wallet-validator";
import { useEffect, useState } from "react";

export default function App() {
  const [walletExists, setWalletExists] = useState(false);
  const checkWallet = async () => {
    const res = await nearWalletExists("1.testnet", NearRPC.TESTNET);
    setWalletExists(res);
  };

  useEffect(() => {
    checkWallet();
  }, []);

  return (
    <div className="App">
      <h1>near-wallet-validator</h1>
      <p>Does 1.testnet exists in testnet?</p>
      <span>{walletExists ? "Yes" : "No"}</span>
    </div>
  );
}

API

PropertyTypeDescription
walletstringWallet name.
rpcNearRPCTESTNET or MAINNET.