npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aptos-labs/aptos-names-connector

v0.0.2

Published

Aptos names service connector

Downloads

245

Readme

Integrate with Aptos Names Service

The Aptos Name Service provides a React UI package that offers developers a customizable button and modal to enable users to search for and mint Aptos names directly from their website.

Prerequisites

  • React project
  • Supporting dependencies installed in the root directory of your React project with npm or yarn:
    • npm install @emotion/styled @emotion/react
    • yarn add @emotion/styled @emotion/react react-copy-to-clipboard

Use Aptos Names Service Connector

  1. Open a terminal session and navigate to the root directory of your React project.
  2. Install the aptos-names-connector package using npm or yarn:
    • npm install "@aptos-labs/aptos-names-connector"
    • yarn add "@aptos-labs/aptos-names-connector"
  3. Once you have installed the package, you can import the AptosNamesConnector component and use it in your React application (by default in ./src/App.js):
    import { AptosNamesConnector } from "@aptos-labs/aptos-names-connector";
    
    function MyComponent() {
      const handleSignTransaction = async () => {
        // Handle signing of transaction
      };
    
      return (
        <AptosNamesConnector
          onSignTransaction={handleSignTransaction}
          isWalletConnected={true}
          network="mainnet"
          buttonLabel="Claim"
        />
      );
    }
  4. To see your changes, start a development server using npm or yarn. The following commands will open the React application in your default web browser (typically to localhost:3000):
    • npm start
    • yarn start

Configure AptosNamesConnector properties

The AptosNamesConnector component accepts the following props:

  • onSignTransaction: A required callback function that is called when the user clicks the "Mint" button in the modal. This function should handle the signing of the transaction.
  • isWalletConnected: A boolean value that indicates whether the user's wallet is connected.
  • network: A string value that specifies whether the component should connect to the mainnet or testnet.
  • buttonLabel: A string value that specifies the text to display on the button.

Customize button label and appearance

The button label can be customized by passing a string value to the buttonLabel prop. The appearance of the button in the AptosNamesConnector component can be customized to fit in your website. The button has the CSS class name of ans_connector_button:

.ans-connector-button {
  background-color: #000000;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  padding: 12px 16px;
}

To use ans_connector_button in your React application, add import "@aptos-labs/aptos-names-connector/dist/index.css"; to the top of your App.js file and reference it with <button className="ans_connector_button"></button>

Supported networks

The AptosNamesConnector component supports both mainnet and testnet. To connect to the mainnet, set the network prop to "mainnet". To connect to the testnet, set the network prop to "testnet".