0.0.33 • Published 3 months ago

@wepin/provider-js v0.0.33

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

@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

  • Solana 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 \ 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

  • \
    • true if Wepin Provider is already initialized.

changeLanguage

wepinProvider.changeLanguage(attributes)

Change the language and currency of the widget.

Parameters

  • attributes \
    • language \ - The language to be displayed on the widget. Currently, only 'ko', 'en' and 'ja' are supported.
    • currency \ - 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 \
    • Available chains Wepin helps provide. It should be lowercase.

Returns

  • Promise\ - A EIP-1193 provider

Example

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

finalize

await wepinProvider.finalize()

The finalize() method finalizes the Wepin Provider.

Parameters

  • Promise\

Returns

  • void

Example

await wepinProvider.finalize()
0.0.33

3 months ago

0.0.31

4 months ago

0.0.32

4 months ago

0.0.30

6 months ago

0.0.29

6 months ago

0.0.25

6 months ago

0.0.26

6 months ago

0.0.27

6 months ago

0.0.28

6 months ago

0.0.23

7 months ago

0.0.24

7 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.20

8 months ago

0.0.18

8 months ago

0.0.19

8 months ago

0.0.17

8 months ago

0.0.13

8 months ago

0.0.10

10 months ago

0.0.11

9 months ago

0.0.12

9 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.5

11 months ago

0.0.6

11 months ago

0.0.3

12 months ago

0.0.4

11 months ago

0.0.2

1 year ago

0.0.1

1 year ago