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();
}
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
Ethers.js or Web3.js can be used with Wepin Provider to interoperate with EVM compatible blockchains.
Please refer to the following link for detailed information on the supported network list: wepin provider - supported network list
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>
Using npm or yarn:
import { WepinProvider } from '@wepin/provider-js'
Using CDN:
const { WepinProvider } = window.WepinProvider
const wepinProvider = new WepinProvider({
appId: 'wepinAppId',
appKey: 'wepinAppKey',
})
await wepinProvider.init(attributes?)
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.await wepinProvider.init({
defaultLanguage: 'ko',
defaultCurrency: 'KRW',
})
wepinProvider.isInitialized()
The isInitialized()
method checks Wepin Provider is initialized.
wepinProvider.changeLanguage(attributes)
Change the language and currency of the widget.
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.wepinProvider.changeLanguage({
currency: 'KRW',
language: 'ko'
})
Methods can be used after initialization of Wepin Provider.
await wepinProvider.getProvider(network)
It returns a Provider by given network
network
<string>
const provider = await wepinProvider.getProvider('ethereum')
await wepinProvider.finalize()
The finalize()
method finalizes the Wepin Provider.
await wepinProvider.finalize()