@wepin/provider-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

wepin logo


@wepin/provider-js

npm version npm downloads

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

⏩ 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

npm install @wepin/provider-js

or

yarn add @wepin/provider-js

⏩ Import SDK

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

⏩ 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: 'ko') Currently, only 'ko' and 'en' are supported.
    • defaultCurrency: The currency to be displayed on the widget (default: 'KRW')

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' and 'en' are supported.
    • currency <string> - The currency to be displayed on the widget.

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, chainId.

Parameters

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

Returns

  • Promise<BaseProvider> - A EIP-1193 provider

Example

const provider = await wepinProvider.getProvider()

finalize

wepinProvider.finalize()

The finalize() method finalizes the Wepin Provider.

Parameters

  • void

Returns

  • void

Example

wepinProvider.finalize()

Package Sidebar

Install

npm i @wepin/provider-js

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

3.69 MB

Total Files

35

Last publish

Collaborators

  • ke.kim
  • wepin.dev