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

@wepin/provider-js

v0.0.24

Published

Wepin EVM/Solana Provider for Web

Downloads

389

Readme

@wepin/provider-js

npm version npm downloads

Wepin Provider V1 for Web. This package is exclusively available for use in web environments.

⚠️ Notice:

This package is only available for web environments and cannot be used in Android or iOS hybrid apps (Webview).

If you are using this package in a Server Side Rendering (SSR) environment, make sure to load the package only on the Client Side Rendering (CSR) side.

Please refer to the following code for implementation:

const initWepinProvider = async () => {
   const { WepinProvider } = await import('@wepin/provider-js');
   const wepinProvider = new WepinProvider({
       appKey: '',
       appId: '',
   });
   await wepinProvider.init();
}

⏩ Requirements

  • Node version 20.17 or newer is required.

⏩ Document

typedoc

⏩ Get App ID and Key

After signing up for Wepin Workspace, go to the development tools menu and enter the information for each app platform to receive your App ID and App Key.

Wepin supports providers that return JSON-RPC request responses to connect with blockchain networks in webs. With Wepin Provider, you can easily connect to various networks supported by Wepin.

The providers supported by Wepin are as follows.

  • EVM compatible Networks
  • Klaytn Network

EVM compatible Networks

Ethers.js or Web3.js can be used with Wepin Provider to interoperate with EVM compatible blockchains.

Support Networks

Please refer to the following link for detailed information on the supported network list: wepin provider - supported network list

⏩ Install

To install the Wepin Provider, you can use npm, yarn, or a CDN: Using npm:

npm install @wepin/provider-js

Using yarn:

yarn add @wepin/provider-js

Using CDN: You can also include the library directly via CDN by adding the following script tag to your HTML file:

<script src="https://cdn.jsdelivr.net/npm/@wepin/provider-js/dist/umd/wepin-provider.umd.js"></script>

⏩ Import SDK

Using npm or yarn:

import { WepinProvider } from '@wepin/provider-js'

Using CDN:

const { WepinProvider } = window.WepinProvider

⏩ Initialize

const wepinProvider = new WepinProvider({
    appId: 'wepinAppId',
    appKey: 'wepinAppKey',
})

init

await wepinProvider.init(attributes?)

Parameters

  • attributes <object> optional
    • defaultLanguage: The language to be displayed on the widget (default: 'en') Currently, only 'ko', 'en' and 'ja' are supported.
    • defaultCurrency: The currency to be displayed on the widget (default: 'USD') Currently, only 'KRW', 'USD' and 'JPY' are supported.

Example

await wepinProvider.init({
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
})

isInitialized

wepinProvider.isInitialized()

The isInitialized() method checks Wepin Provider is initialized.

Returns

  • <boolean>
    • true if Wepin Provider is already initialized.

changeLanguage

wepinProvider.changeLanguage(attributes)

Change the language and currency of the widget.

Parameters

  • attributes <object>
    • language <string> - The language to be displayed on the widget. Currently, only 'ko', 'en' and 'ja' are supported.
    • currency <string> - The currency to be displayed on the widget. Currently, only 'KRW' , 'USD' and 'JPY' are supported.

Returns

  • void

Example

wepinProvider.changeLanguage({
   currency: 'KRW',
   language: 'ko'
})

⏩ Method

Methods can be used after initialization of Wepin Provider.

getProvider

await wepinProvider.getProvider(network)

It returns a Provider by given network

Parameters

  • network <string>
    • Available chains Wepin helps provide. It should be lowercase.

Returns

  • Promise<BaseProvider> - A EIP-1193 provider

Example

const provider = await wepinProvider.getProvider('ethereum')

finalize

await wepinProvider.finalize()

The finalize() method finalizes the Wepin Provider.

Parameters

  • Promise<void>

Returns

  • void

Example

await wepinProvider.finalize()