Installation
To install the SDK use the commandnpm i @blockswaplab/k2-sdk
Using the K2 SDK
One of the ways to import and initialise the SDK is:fundSplitter sub-class, the SDK instance can be initialised with the fund splitter contract address as follows:
The SDK supports bothgoerli(until it is deprecated) andmainnet, hence the user should choose the network as per the need.
Please note that the SDK is anethers.jsbased SDK and hence requiresethersbased signer instance. It also returns values inethers.jssupported format. For example, it returnsBigNumbersfor 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: