# Ethereum Provider

You can interact with EVM-based blockchains using Ethers.js or Web3.js together with the Wepin Provider.

## Supported Networks

{% hint style="info" %}
Is the blockchain you need not listed? Please [contact the Wepin](https://wepinwallet.typeform.com/WEPIN-Wallet-EN) team for blockchain support.
{% endhint %}

<table><thead><tr><th width="172.33333333333331">Chain ID</th><th>Network Name</th><th>Network Variable</th></tr></thead><tbody><tr><td>1</td><td>Ethereum Mainnet</td><td>ethereum</td></tr><tr><td>5</td><td>Ethereum Goerli Testnet</td><td>evmeth-goerli</td></tr><tr><td>8217</td><td>Kaia Mainnet</td><td>klaytn</td></tr><tr><td>1001</td><td>Kaia Kairos Testnet</td><td>klaytn-testnet</td></tr><tr><td>19</td><td>Songbird Canary Network</td><td>evmsongbird</td></tr><tr><td>137</td><td>Polygon Mainnet</td><td>evmpolygon</td></tr><tr><td>248</td><td>Oasys</td><td>evmoasys-games</td></tr><tr><td>34</td><td>XPLA Mainnet</td><td>evmxpla</td></tr><tr><td>7300</td><td>XPLA Verse Mainnet</td><td>evmxpla-verse</td></tr><tr><td>2731</td><td>TimeNetwork Testnet</td><td>evmtime-elizabeth</td></tr><tr><td>11155111</td><td>Ethereum Sepolia Testnet</td><td>evmeth-sepolia</td></tr><tr><td>80002</td><td>Polygon Amoy Testnet</td><td>evmpolygon-amoy</td></tr><tr><td>9372</td><td>Oasys Testnet</td><td>evmoasys-games-testnet</td></tr><tr><td>47</td><td>XPLA Testnet</td><td>evmxpla-testnet</td></tr><tr><td>2225</td><td>XPLA Verse Testnet</td><td>evmxpla-verse-testnet</td></tr><tr><td>204</td><td>opBNB Mainnet</td><td>evmopbnb</td></tr><tr><td>56</td><td>Binance Smart Chain</td><td>evmbsc</td></tr><tr><td>97</td><td>BSC-TESTNET</td><td>evmbsc-testnet</td></tr><tr><td>5611</td><td>opBNB Testnet</td><td>evmopbnb-testnet</td></tr><tr><td>656476</td><td>Open Campus Testnet</td><td>evmopencampus-testnet</td></tr><tr><td>43114</td><td>Avalanche</td><td>evmavax-c-chain</td></tr><tr><td>4613</td><td>VERY Mainnet</td><td>evmvery</td></tr></tbody></table>

## Installation

{% tabs %}
{% tab title="npm" %}

```bash
npm install @wepin/provider-js
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @wepin/provider-js
```

{% endtab %}
{% endtabs %}

Once the installation is complete, initialize the WepinProvider instance using the app ID and app key assigned after registering the app. This will enable the use of WepinProvider.

<pre class="language-javascript"><code class="lang-javascript"><strong>// 1. Import the package
</strong>import { WepinProvider } from '@wepin/provider-js'
<strong>
</strong>// 2. Initialization
const WepinProvider = new WepinProvider({
    appId: 'your-wepin-app-id',
    appKey: 'your-wepin-api-key',
})
</code></pre>

## Initialization

Here's how to initialize the Wepin Provider.&#x20;

## init

```javascript
await wepinProvider.init(attributes?)
```

### **Parameters**

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

### **Return value**

* `Promise`\<void>

### **Example**

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

## isInitialized&#x20;

It checks if WepinProvider is initialized properly.

```javascript
wepinProvider.isInitialized()
```

### **Parameters**

* `<void>`

### **Return value**

* `<boolean>`\
  Returns `true` if init was successful, otherwise returns `false`.

### **Example**

```javascript
if(wepinProvider.isInitialized()) {
  console.log('wepinProvider is initialized!')
}
```

## changeLanguage

It allows changing the language and currency of the widget.

```javascript
wepinProvider.changeLanguage(attributes)
```

### **Parameters**

* `attributes` \<object>
  * `language` \<string>\
    It specifies the language to be displayed on the widget. Currently supported languages are `en` , `ko` and `ja`.
  * `currency` \<string>\
    It specifies the currency to be displayed on the widget. Currently supported currencies are `USD` , `KRW` and `JPY`.

### **Return value**

* \<boolean>\
  It returns `true` if the change was successful, otherwise returns `false`.

### **Example**

```javascript
if(wepinProvider.isInitialized()) {
  console.log('wepinProvider is initialized!')
}
```

## Methods

Methods can be used after initializing the Wepin Provider.

## getProvider

It returns the provider for the specified network.

```jsx
await wepinProvider.getProvider(network)
```

### **Parameters**

* `network` \<string> \
  The Network Variable value for providers supported by Wepin, such as "ethereum" for Ethereum Mainnet, must be entered in lowercase. For the complete list, please refer to the "[Supported Networks for Ethereum Provider](#supported-networks)."

### **Return value**

* `Promise`\<BaseProvider> - A EIP-1193 provider

### **Example**

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

### finalize

It terminates the use of WepinProvider.

```javascript
wepinProvider.finalize()
```

### **Parameters**

* `<void>`

### **Return value**

* `<void>`

### **Example**

```javascript
wepinProvider.finalize()
```

For more details on EVM-compatible network providers, please refer to the link below.

{% embed url="<https://eips.ethereum.org/EIPS/eip-1193>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/en/widget-integration/web-javascript-sdk/provider/ethereum-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
