📦 Parabol SDKParabol Core SDKOverivew

Parabol Core SDK

The @parabolfi/core package is the foundation of the Parabol SDK, providing essential functionality for interacting with the Parabol protocol. This core SDK enables developers to integrate Parabol’s features into their applications, including lending, claiming, and managing partnerships.

Installation

npm install @parabolfi/core

Key Features

  • Blockchain Interaction: Direct interaction with the blockchain using private keys or calldata generation for external signing.
  • Account Management: Create and manage Parabol accounts for various operations.
  • Lending and Claiming: Easily lend paraUSD and claim your revenue.
  • Partnership Handling: Create and manage partnerships within the Parabol ecosystem. See Parabol Partner Program for more information.
  • Flexible Configuration: Support for multiple networks and easy configuration of contract addresses.
  • Type-Safe Operations: Fully typed API for a safer development experience.
  • Error Handling: Comprehensive error handling and custom error types for easier debugging.

Main Components

ParabolAccount

The ParabolAccount class is the primary interface for direct blockchain interactions. It provides methods for:

  • Creating partnerships
  • Approving paraUSD and note positions
  • Lending paraUSD
  • Claiming revenue
  • Retrieving account information and allowances

Calldata Utilities

The Calldata utilities is a singleton functions for generating calldata for various Parabol operations. It’s useful for applications that handle signing externally. Key functionalities include:

  • Generating calldata for lending, claiming, and approvals
  • Preparing permit signatures for gasless transactions

Configuration

The SDK uses a global configuration for supported networks, contract addresses, and network information. This allows for easy customization and support for multiple blockchain networks.

⚠️

The parabolData option is necessary for lending operations.

Helpers and Utilities

The SDK includes helper functions and utilities for:

  • Calldata generation
  • Permit signature generation
  • Contract interactions
  • Note filtering and processing

Basic Usage

Here’s a quick example of how to create a ParabolAccount and perform a lending operation:

import { ParabolAccount, SupportedChainIds } from "@parabolfi/core";
import { parabolServer } from "@parabolfi/server";
 
const parabolServer = new ParabolServer({
  apiKey,
});
 
const chainId = SupportedChainIds.ZKSYNC;
const parabolData = await parabolServer.fetchLendParameters(chainId);
 
const account = await ParabolAccount.fromPrivateKey({
  privateKey,
  chainId,
  parabolData,
});
 
const tx = await account.lend({
  principal: "1000", // 1000 paraUSD
  maturity: 5, // 5 days
});

Also, you can use the Calldata utilities to generate calldata for lending, claiming, and approvals.

Let’s see an example of how to generate calldata for claiming:

import { lendCalldata } from "@parabolfi/core";
 
// ...
 
const calldata = lendCalldata({
  walletAddress,
  maturity: 5, // 5 days
  principal: "1000", // 1000 paraUSD
  parabolData,
  partnerConfig, // optional
});

Response

0x1949f17e...
đź’ˇ

If you are integrating Parabol into your mobile crypto wallet, you can use the Calldata utilities. If you are integrating it into a dApp, Parabol’s React-supported SDK is currently in development, and we will announce it soon.