WEPIN Developer Documentation
WepinBlogContact
English
English
  • Get Started
    • Introduction
  • Wepin
    • Features
    • Architecture
      • Key Generation
      • Signing
      • Key Backup
    • Workspace
      • App Registration and Key Issuance
      • Networks and Assets Addition
      • Widget Design
    • Supported blockchains
    • Account Abstraction
  • login
    • Overview
    • Social Login Auth Providers
      • Email/Password
      • Google
      • Apple
      • Discord
      • Naver
      • Facebook
      • Line
      • Kakao
    • User Interface
    • Simplified Login
    • Resource
  • Widget Integration
    • Prerequisites
    • Web: JavaScript SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • Ethereum Provider
        • Kaia Provider
        • Solana Provider
        • Wagmi Connector
      • Wallet Adapter
        • Solana Wallet Adapter
    • Android: Java & Kotlin SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • Installation
        • Initialization
        • Methods
    • iOS: Swift SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • installation
        • initialization
        • Methods
    • Flutter SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
    • React Native SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
    • Unity SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Compose Multiplatform SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
  • API
    • Overview
    • Registration
    • Login
    • Wallet
    • Token and NFT
    • Transaction
  • Deprecated
    • Web: JavaScript SDK
      • SDK
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • EVM-Compatible Networks
      • Wagmi Connector
    • Android: Java & Kotlin SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • iOS: Swift SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Flutter SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • React Native SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
      • Providers
        • Ethereum Providers
  • MISC
    • Logo & Brand
Powered by GitBook
On this page
  • Supported Networks
  • Installation
  • Initialize Web3.js
  • Methods
  • Get Accounts
  • Get Balance
  • Send Transaction
  • Contract Call

Was this helpful?

  1. Deprecated
  2. Web: JavaScript SDK
  3. Provider

EVM-Compatible Networks

Using Ethers.js or Web3.js with the Wepin Provider allows you to interact with EVM-compatible blockchain networks.

Supported Networks

Chain ID
Network Name
Network Variable

1

Ethereum Mainnet

ethereum

5

Ethereum Goerli Testnet

evmeth-goerli

11155111

Ethereum Sepolia Testnet

evmeth-sepolia

19

Songbird Canary Network

evmsongbird

137

Polygon Mainnet

evmpolygon

80002

Polygon Amoy

evmpolygon-amoy

1001

Klaytn Testnet

klaytn-testnet

8217

Klaytn Mainnet

klaytn

2731

TimeNetwork Testnet

evmtimenetwork-testnet

Installation

First, import @wepin/widget-sdk and @wepin/provider into your peoject.

// You must import the widget-sdk first.
import '@wepin/widget-sdk'
import '@wepin/provider'

Initialize Web3.js

First, initialize Wepin, then obtain the provider to initialize web3.js.

// Import the web3.js first.
import Web3 from 'web3';

const appId = 'app_id_eg12sf3491azgs520' // Test App ID
const appKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key
const attributes = {
	type: 'show'
}
// Initialize Wepin
await Wepin.init(appId, appKey, attributes)
// Obtain the provider from the initialized Wepin.
const provider = Wepin.getProvider({ network: 'ethereum' });

// Initialize web3 using the Wepin provider.
const web3 = new Web3(provider) 

Methods

Get Accounts

Through the initialized web3, you can retrieve account information.

const accounts = await web3.eth.getAccounts()

Get Balance

Using the account information, you can query the balance.

const balance = await web3.eth.getBalance(accounts[0])

You can refer to the link below to query not only the balance but also fee information, block number, etc.

Send Transaction

You can send transactions.

const accounts = await web3.eth.getAccounts()
const tx = {
    from: accounts[0],
    gasPrice: "2000000000",
    gas: "21000",
    to: '0x11f4d0A3c1......13F7E19D048276DAe',
    value: "10000000000000000",
}
const response = await web3.eth.sendTransaction(tx)

Contract Call

You can perform contract calls.

const callObject = {
	to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', //contract address
	data: '0xc6888fa10000000000000000000000000000000000000000000000000000000000000003'
}
const response = await web3.eth.call(callObject)

For more details on the Ethereum-compatible network provider, please refer to the link below.

PreviousProviderNextWagmi Connector

Last updated 9 months ago

Was this helpful?

Getting Started — web3.js 1.0.0 documentation
Logo
EIP-1193: Ethereum Provider JavaScript APIEthereum Improvement Proposals