Denota SDK

Getting Started


You can install the @denota-labs/denota-sdk package with the following command:
npm install @denota-labs/denota-sdk


The setProvider function initializes the internal state of the library by setting up the provider, signer, account, and other contracts needed for executing transactions. It also retrieves the corresponding contract addresses based on the chain ID. Before performing any transactions, you need to call this function to ensure a smooth and seamless experience.
The function currently accepts a web3 connection, such as window.ethereum, as its input parameter. In the near future, it will be extended to support an ethers provider or a private key, providing greater flexibility for developers.
import { setProvider } from '@denota-labs/denota-sdk';
async function initializeProvider() {
try {
await setProvider(window.ethereum);
console.log("Provider has been set successfully");
} catch (error) {
console.error("Error setting provider:", error);
Before sending funds, use the approveToken function to approve a token for use in writing notas.
import { approveToken } from '@denota-labs/denota-sdk';
async function approve() {
const currency = 'DAI';
const approvalAmount = 100;
await approveToken({ currency, approvalAmount });