This guide outlines the steps for performing a liquid delegation to a preferred node operator as a user of the Node Cloud.
The SDK uses version 6 of the ethers.js library and it is recommended to use this library to create a provider and a signer instance, required for signing the transaction. You can use any provider API that you want from this list. For this tutorial, Infura is used.
Once the provider
and signer
instances are created, next initialize the K2 SDK.
The K2 SDK also takes other parameters as input but they are optional, only the Signer is required for liquid delegation.
Before liquid delegation, you must approve the lien contract by passing the lien contract address to the following function:
Once this transaction is successful, we can proceed with the liquid delegation.
For liquid delegation to either a different PNO or yourself, the following functions from the pno
sub-class can be used:
You can delegate your K2 LP to a PNO by calling the following function:
where amount is the amount of K2 LP to be delegated in string.
Assuming your signer wallet address is the same as the one used for registering your validator, you can delegate to yourself by calling:
If the validator was registered using a different address, please use that address in place of
signer.address
The max liquid delegation you can give to any PNO is 24 ETH * number of native delegations.
For liquid delegation to either a different PNO or yourself from Native Delegation balance, the following functions from the pno
sub-class can be used:
You can delegate to a PNO by calling the following function:
Assuming your signer wallet address is the same as the one used for registering your validator, you can delegate to yourself by calling:
If the validator was registered using a different address, please use that address in place of
signer.address
This guide outlines the steps for performing a liquid delegation to a preferred node operator as a user of the Node Cloud.
The SDK uses version 6 of the ethers.js library and it is recommended to use this library to create a provider and a signer instance, required for signing the transaction. You can use any provider API that you want from this list. For this tutorial, Infura is used.
Once the provider
and signer
instances are created, next initialize the K2 SDK.
The K2 SDK also takes other parameters as input but they are optional, only the Signer is required for liquid delegation.
Before liquid delegation, you must approve the lien contract by passing the lien contract address to the following function:
Once this transaction is successful, we can proceed with the liquid delegation.
For liquid delegation to either a different PNO or yourself, the following functions from the pno
sub-class can be used:
You can delegate your K2 LP to a PNO by calling the following function:
where amount is the amount of K2 LP to be delegated in string.
Assuming your signer wallet address is the same as the one used for registering your validator, you can delegate to yourself by calling:
If the validator was registered using a different address, please use that address in place of
signer.address
The max liquid delegation you can give to any PNO is 24 ETH * number of native delegations.
For liquid delegation to either a different PNO or yourself from Native Delegation balance, the following functions from the pno
sub-class can be used:
You can delegate to a PNO by calling the following function:
Assuming your signer wallet address is the same as the one used for registering your validator, you can delegate to yourself by calling:
If the validator was registered using a different address, please use that address in place of
signer.address