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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@shynnhuy/dmtp-sdk-react

v1.3.2

Published

DMTP sdk for react

Downloads

10

Readme

Requirements

  • Node.js 16.x.x
  • React 18.x.x

Install

NPM

npm install --save dmtp-sdk-react

Yarn

yarn add dmtp-sdk-react

Quick Start

Setup DMTPProvider

import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import { DMTPProvider } from 'dmtp-sdk-react'

ReactDOM.render(
  <DMTPProvider APIKey='YOUR_DMTP_API_KEY' dappAddress='YOUR_DAPP_WALLET_ADDRESS>
    <App />
  </DMTPProvider>,
  document.getElementById('root')
)

DMTPProvider Props

| Props | Type | Description | Require | Default | | ------------ | ------- | --------------------------------------------------- | ------- | ------- | | APIKey | string | Apikey that was generated from dmtp | true | | | dappAddress | string | A wallet address that will be friend with the users | true | | | isDev | boolean | Get all log from SDK | false | false |

useConnectDMTP

| Props | Type | Description | Require | Default | | ------------- | ------------------------------- | ------------------------------ | ------- | ------- | | isConnectDMTP | boolean | Check is SDK connected to DMTP | | | | connectDMTP | function return Promise< void > | Make SDK start connect to DMTP | | |

import { useConnectDMTP } from 'dmtp-sdk-react'

const App = () => {
  const { isConnectDMTP, connectDMTP } = useConnectDMTP()
  return (
    <>
      <h1>DMTP SDK</h1>
      <h3>useConnectDMTP</h3>
      <div>isConnectDMTP: {isConnectDMTP}</div>
      <button onClick={() => connectDMTP()}>connect DMTP</button>
    </>
  )
}

useSendMessage

  • connectDMTP() before useSendMessage | Props | Type | Description | Require | Default | |-------------|------------------------------------------------------|--------------------------|---------|---------| | sendMessage | (message:string, to_address:string) => Promise< void > | Sending message with SDK | | |
import { useSendMessage } from 'dmtp-sdk-react'

const Message = () => {
  const sendMessage = useSendMessage()

  const [message, setMessage] = useState('')
  const [toAddress, setToAddress] = React.useState(
    ''
  )

  return (
    <>
      <h3>useSendMessage</h3>
      <input
        value={message}
        onChange={(e) => setMessage(e.target.value)}
        placeholder='Enter your message'
      />
      <input
        value={toAddress}
        onChange={(e) => setToAddress(e.target.value)}
        placeholder='To address'
      />
      <button onClick={() => sendMessage(message, toAddress)}>
        Send Message
      </button>
    </>
  )
}

useSNS

  • connectDMTP() before useSNS | Props | Type | Description | Require | Default | |----------------|--------------------------------------------------|-----------------------------------------------------------------|---------|---------| | show | () => void | Show SNS connection UI | | | | hide | () => void | Hide SNS connection UI | | | | verifyTelegram | (otp: string) => Promise< void > | Verify with from url params when telegram bot open redirect url | | | | snsData | { discord: boolean; telegram: boolean; } | null | The data of SNS from DMTP | | |

Change YOUR_WEBPAGE_URL

import { useSNS, DmtpSNS } from 'dmtp-sdk-react'

const SNS = () => {
  const { show, hide, verifyTelegram, snsData } = useSNS()
  const { isConnectDMTP } = useConnectDMTP()

  // get telegram code from url
  useEffect(() => {
    if (isConnectDMTP) {
      const query = new URLSearchParams(window.location.search)
      const telegramCode = query.get('code')
      if (telegramCode) {
        verifyTelegram(telegramCode)
      }
    }
  }, [isConnectDMTP])
  return (
    <>
      <h3>useSNS</h3>
      <DmtpSNS redirect_uri_telegram='YOUR_WEBPAGE_URL' />
      <div>Telegram: {snsData?.telegram}</div>
      <div>Discord: {snsData?.discord}</div>
      <button onClick={show}>Show SNS</button>
      <p />
      <button onClick={hide}>Hide SNS</button>
    </>
  )
}

License

MIT © DMTP