kETH SDK
The kETH SDK is a typescript SDK which can be used to interact with the kETH protocol.
Installation
To install the SDK use the command npm i @blockswaplab/keth-sdk
or yarn add @blockswaplab/keth-sdk
to install using yarn.
Using the KETH SDK
One of the ways to import and initialise the SDK is:
import { KETH } from "@blockswaplab/keth-sdk";
import { ethers } from "ethers";
const provider = new ethers.InfuraProvider(
"mainnet",
INFURA_PROJECT_ID,
INFURA_PROJECT_SECRET
);
const signer = new ethers.Wallet(PRIV_KEY, provider);
const sdk = new KETH(signer);
The SDK supports both
holesky
andmainnet
, hence the user should choose the network as per the need.
Please note that the SDK is an
ethers.js
based SDK and hence requiresethers
based signer instance. It also returns values inethers.js
supported format. For example, it returnsBigInt
for the smart contract view functions that might returnuint
(BigNumber
in case of ethers v5).
Also note that KETH SDK uses ethers v6. If you are using ethers v5 (not recommended), please create the signer and provider instances in the following way:
const provider = new ethers.providers.InfuraProvider("mainnet", {
projectId: INFURA_PROJECT_ID,
projectSecret: INFURA_PROJECT_SECRET
});
const signer = new ethers.Wallet(PRIV_KEY, provider);
Sub-classes
The SDK exposes following sub-classes that can be used to access the functions on the different smart contracts of the kETH protocol: