Introduction
K2 SDK is a typescript SDK which can be used to interact with the K2 Lending protocol.
Installation
To install the SDK use the command npm i @blockswaplab/k2-sdk
Using the K2 SDK
One of the ways to import and initialise the SDK is:
For using the fundSplitter
sub-class, the SDK instance can be initialised with the fund splitter contract address as follows:
The SDK supports both
goerli
(until it is deprecated) 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 returnsBigNumbers
for the smart contract view functions that might returnuint
.
Also note that K2 SDK v2 uses ethers v6(recommended). If you are using K2 SDK v1 which makes use of ethers v5, please create the signer and provider instances in the following way:
The SDK exposed following sub-classes: