You can interact with EVM-based blockchains using Ethers.js or Web3.js together with the Wepin Provider.
Supported Networks
Is the blockchain you need not listed? Please team for blockchain support.
Chain ID
Network Name
Network Variable
8217
Kaia Mainnet
klaytn
1001
Kaia Kairos Testnet
klaytn-testnet
Installation
npm install @wepin/provider-js
yarn add @wepin/provider-js
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.
// 1. Import the package
import { WepinProvider } from '@wepin/provider-js'
// 2. Initialization
const WepinProvider = new WepinProvider({
appId: 'your-wepin-app-id',
appKey: 'your-wepin-api-key',
})
Initialization
Here's how to initialize the Wepin Provider.
init
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.
You can send JSON-RPC requests to interact with the Kaia blockchain.
The kaia prefix method has been supported since version 0.0.31.
eth_accounts / klay_accounts / kaia_accounts
Connects to the Wepin wallet and requests the user's permission to share their account address. Once connected, the application can sign messages or request transactions.
Constructs a transaction with the given parameters, signs it with the user's private key, and sends it to the network.
sendTransaction does not support FeeDelegated transactions.
Supported Tx Type
TxType
Version
TxTypeLegacy
TxTypeValueTransfer
≥ v.0.0.31
TxTypeValueTransferMemo
≥ v.0.0.31
TxTypeSmartContractExecution
≥ v.0.0.31
Parameters
Represents the legacy transaction type that existed in Kaia (Klaytn).
from <string> - The sender's account address. An error occurs if it differs from the actual signer.
to <string> - The recipient's address (contract or regular account).
gas <string> - The maximum gas limit for transaction execution (Hex string).
gasPrice<string> - The gas price for the transaction (Hex string).
value <string> - The amount of KLAY to be transferred (Hex string).
data <string> - The contract execution data or empty value. Use 0x for standard transfers.
A transaction type used to transfer KLAY.
typeInt <number> - 8
from <string> - The sender's account address. An error occurs if it differs from the actual signer.
to <string> - The recipient's address.
gas <string> - The maximum gas limit for transaction execution (Hex string).
gasPrice <string> - The gas price for the transaction (Hex string).
value <string> - The amount of KLAY to be transferred (Hex string).
A transaction type used to transfer KLAY with a memo message.
typeInt <number> - 16
from <string> - The sender's account address. An error occurs if it differs from the actual signer.
to <string> - The recipient's address.
gas <string> - The maximum gas limit for transaction execution (Hex string).
gasPrice <string> - The gas price for the transaction (Hex string).
value <string> - The amount of KLAY to be transferred (Hex string).
input <string> - The memo message to be sent along with the transaction (Hex string).
A transaction type used to execute a smart contract.
typeInt <number> - 48
from <string> - The sender's account address. An error occurs if it differs from the actual signer.
to <string> - The recipient's address.
gas <string> - The maximum gas limit for transaction execution (Hex string).
gasPrice <string> - The gas price for the transaction (Hex string).
value <string> - The amount of KLAY to be transferred (Hex string).
input <string> - The data to be sent along with the transaction (Hex string).
For more details on Kaia network, please refer to the link below.
network <string>
The Network Variable value for providers supported by Wepin, such as "klaytn" for Klaytn Mainnet, must be entered in lowercase. For the complete list, please refer to the "."