npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dripfi/drip-sdk

v2.0.1

Published

Drip SDK

Readme

Drip SDK

Introduction

The Drip SDK is a TypeScript library designed to interact with the Perq protocol. It provides methods to retrieve information about Perq Vaults, manage user authentication, and fetch user balances.

Table of Contents

Installation

To use the Drip SDK in your project, you can install it via npm or yarn:

npm i @dripfi/drip-sdk

Usage

import { PerqSdk, PRODUCTION, DEVELOPMENT } from '@dripfi/drip-sdk';
import { ethers } from 'ethers';

Initialization

The SDK now requires a two-step initialization process:

// Step 1: Create the SDK instance with configuration
const perqConfig = PRODUCTION; // Use DEVELOPMENT for testnet

const perqSdk = new PerqSdk(perqConfig);

// Step 2: Initialize with a provider (required before making blockchain calls)
const provider = new ethers.providers.JsonRpcProvider('YOUR_RPC_URL');
// Or if using Web3Provider from browser wallet:
// const provider = new ethers.providers.Web3Provider(window.ethereum);

await perqSdk.init(provider);

Updating the Provider

When the user switches networks or wallets, update the SDK:

await perqSdk.updateDripSdk(newProvider);

[!IMPORTANT] The init() method must be called before using any blockchain operations.

Modules

Automatic Deposit Type Detection

The SDK automatically determines the deposit type based on the provided parameters:

  • Direct Deposit: When sourceTokenSymbol equals vaultTokenSymbol
  • Wrap Deposit: When sourceTokenSymbol is "ETH" / "S" or any other native token
  • Swap Deposit: When sourceTokenSymbol differs from vaultTokenSymbol only possible on certain sdkType vaults

Supported SDK Types

  • Yelay: Supports direct deposits, ETH deposits, and swap deposits
  • Silo: Supports standard ERC20 deposits and withdrawals

Vault Handler

Access vault methods through sdk.vault:

| Method | Description | | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | | getAllowance(params: VaultOperationParams): Promise<boolean> | Checks if the user's allowance is sufficient for the depositAmount | | approveAllowance(params: VaultOperationParams): Promise<string> | Approves the allowance for the depositAmount for the selected Vault | | deposit(params: VaultOperationParams): Promise<string> | Deposits the depositAmount into the selected vault | | withdraw(params: VaultOperationParams): Promise<string> | Withdraws the specified amount from the selected vault | | getBalance(vaultAddress: string, tokenAddress?: string, onChainProjectId?: number): Promise<string> | Gets the user's balance for the specified vault |

Legacy Methods

For backward compatibility, the original methods are still available:

Core SDK

Core methods available directly on the SDK instance:

| Method | Description | | -------------------------------------------------------------- | ------------------------------------------------------------------------------ | | init(provider: ethers.providers.JsonRpcProvider): Promise<void> | Initializes the SDK with a provider. Required before making blockchain calls. | | updateDripSdk(provider?: ethers.providers.JsonRpcProvider): Promise<void> | Updates the SDK with a new provider when user switches networks or wallets. |

Lite Vaults

Access Lite vault methods through sdk.lite:

| Method | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | deposit(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string> | Deposits into Lite vault. | | withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string> | Withdraws from Lite vault. | | swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, amount: string, vaultAddress: string, onChainProjectId: number): Promise<string> | Swaps and deposits into Lite vault. (Currently disabled pending 1inch KYC) | | wrapAndDepositEth(vaultAddress: string, onChainProjectId: number, amount: string): Promise<string> | Wraps native token (ETH/S) and deposits. | | getSwapAndDepositAllowance(tokenAddress: string): Promise<string> | Fetches the allowance for swap and deposit operations. | | approveSwapAndDeposit(tokenAddress: string, amount: string): Promise<string> | Approves a token for swap and deposit operations. | | getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number, chainId: PerqSupportedChainId): Promise<string> | Calculates the expected result of a swap operation on a specific chain. | | getMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]> | Fetches available migration options for a vault position. | | migrateDepositToOtherProject(tokenAddress: string, vaultAddress: string, fromProjectId: number, toProjectId: number, amount: string): Promise<string> | Migrates a deposit from one project to another. | | getHistoricalTvl(projectName: string): Promise<ProjectHistoricalTvl> | Fetches historical TVL data for a project. |

Loyalty Cards

Access loyalty card methods through sdk.loyaltyCards:

| Method | Description | | ----------------------------------------------------------------------------- | ------------------------------------------------- | | getBeansBalance(): Promise<BeansBalance> | Gets user's beans balance. | | getBeansHistory(): Promise<BeanEntry[]> | Gets user's beans history. | | getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo> | Gets swap info for Perq to beans. | | upgradeLoyaltyCard(index: number): Promise<LoyaltyCard> | Upgrades loyalty card. | | claimSpecialEditionCard(cardId: string): Promise<SpecialEditionLoyaltyCard> | Claims special edition loyalty card. | | getOwnedLoyaltyCard(): Promise<LoyaltyCard> | Gets user's owned loyalty card. | | getOwnedSpecialEditionCards(): Promise<SpecialEditionLoyaltyCard[]> | Gets user's owned special edition loyalty cards. | | getAllLoyaltyCards(): Promise<LoyaltyCard[]> | Gets all available loyalty cards. | | getAllSpecialEditionCards(): Promise<SpecialEditionLoyaltyCard[]> | Gets all available special edition loyalty cards. |

Vesting

Access vesting methods through sdk.vesting:

| Method | Description | | ----------------------------------------------------------------------------------------------------- | ----------------------------- | | getVestingStart(): Promise<string> | Gets vesting start time. | | getVestingEnd(): Promise<string> | Gets vesting end time. | | getVestedAmount(beneficiary: string): Promise<string> | Gets vested amount. | | getReleasableAmount(beneficiary: string): Promise<string> | Gets releasable amount. | | getReleasableTotalAmount(beneficiary: string): Promise<string> | Gets total releasable amount. | | getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo> | Gets all vesting info. | | claimVestedPerq(amount: string): Promise<string> | Claims vested Perq. | | burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string> | Burns vested Perq. |

Pools

Access pools methods through sdk.pools:

| Method | Description | | ------------------------------------------------------------------------------------- | ---------------------------------------------------- | | getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<string> | Fetches the user's balance in a specific pool. | | getAllPools(): Promise<VaultData[]> | Fetches all available pools. | | getMyPerqBalance(): Promise<MyPerqData[]> | Fetches the user's Perq balance. | | getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData> | Fetches the details of a specific pool. | | getAllProjects(): Promise<ReducedProjectData[]> | Fetches all available projects. | | getProjectDetails(projectName: string): Promise<DetailedProjectData> | Fetches the details of a specific project. | | getPoolStats(): Promise<VaultStats> | Fetches the statistics of a pool. | | getOverallStats(): Promise<OverallStats> | Fetches different stats | | getRewardsPerHour(vaultAddress: string): Promise<number> | Calculates the rewards per hour for a specific pool. | | getUserBoostedNfts(vaultAddress: string): Promise<string[]> | Fetches the user's boosted NFTs for a specific pool. | | getRewards(): Promise<UserRewards> | Fetches the user's rewards. |

User

Access user methods through sdk.user:

| Method | Description | | ------------------------------------------------------------------------------ | ----------------------------------------------------------- | | linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean> | Links a Sui wallet with an Ethereum wallet. | | linkNearWalletWithEthWallet(nearWalletAddress: string): Promise<boolean> | Links a Near wallet with an Ethereum wallet. | | linkSolanaWalletWithEthWallet(solanaWalletAddress: string): Promise<boolean> | Links a Solana wallet with an Ethereum wallet. | | getLinkedPodWallets(): Promise<LinkedPodWallets> | Retrieves all wallets linked to the user's Ethereum wallet. | | getEarnings(projectName: string): Promise<Earnings> | Retrieves the user earnings for each project's vaults |

Recycler

Access recycler methods through sdk.recycler:

| Method | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber> | Retrieves the token allowance for the recycler contract. | | getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber> | Retrieves the token allowance for the swap and recycler contract. | | async recycleTokens(tokenAddress: string = this.perqSdk.perqConfig.perqTokenAddress,amountToRecycle: string,beneficiary: string = ethers.constants.AddressZero,price: string,deadline: string,signature: string): Promise<string> | Initiates the recycling of tokens for a given beneficiary, price, and deadline. | | swapAndRecycleETH(beneficiary: string,path: string[],minAmountOutWithDecimals: string,amountOfEth: string,price: string,deadline: string,signature: string): Promise<string> | Executes a swap and recycling operation for ETH. | | swapAndRecycleERC20(beneficiary: string,path: string[],minAmountOutWithDecimals: string,amountInWithDecimals: string,price: string, deadline: string,signature: string): Promise<string> | Executes a swap and recycling operation for ERC20 tokens. | | approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string> | Approves a token for use with the recycler contract. | | approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string> | Approves a token for use with the swap and recycler contract. |

Token Utils

Access token utils methods through sdk.tokenUtils:

| Method | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | | getTokenPrice(tokenName: string): Promise<number> | Fetches the current price of a given token. "perq", "weth", "eth" and "wbtc" are supported | | getAllowance(tokenAddress: string, spender: string): Promise<string> | Retrieves the current allowance for a token. | | approveAllowance(tokenAddress: string, amount: string, spenderAddress: string): Promise<string> | Approves a specific amount of tokens for use by a spender. | | transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string> | Transfers a specified amount of ERC20 tokens to a receiver. | | wrapEther(amount: string, tokenAddress: string): Promise<string> | Wraps a specified amount of Ether into a WETH token. | | getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber> | Retrieves the allowance for a specific ERC20 token. | | getPerqTokenContractAddress(): string | Returns the contract address of the Perq token. | | parseAmountWithDecimals(amount: string, tokenAddress: string): Promise<BigNumber> | Parses a human-readable amount to BigNumber with correct token decimals. | | formatAmountWithDecimals(amount: BigNumber, tokenAddress: string): Promise<string> | Formats a BigNumber amount to human-readable string with correct decimals. |

Sign Handler

Access signing methods through sdk.signHandler:

| Method | Description | | -------------------------------------------------------------------- | -------------------------------------- | | signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>> | Signs a payload with nonce enrichment. |

Silo

Access silo methods through sdk.silo:

| Method | Description | | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | deposit(assetAmount: string, vaultAddress: string): Promise<string \| undefined> | Deposits into a Silo Vault. | | withdraw(assetAmount: string, vaultAddress: string): Promise<string \| undefined> | Withdraws from a Silo Vault. Recommended for partial withdrawals. | | redeem(sharesAmount: string, vaultAddress: string): Promise<string \| undefined> | Withdraws from a Silo Vault. Recommended for full withdraws. | | getBalanceInShares(vaultAddress: string): Promise<BigNumber> | Get the users balance in Shares. | | getBalanceInAssets(vaultAddress: string): Promise<BigNumber> | Get the users balance in the vaults currency/asset. | | getTotalSupply(vaultAddress: string): Promise<BigNumber> | Retrieves the total amounts of shares in the Vault. | | getTotalAssets(vaultAddress: string): string | Returns the total balance in the vaults currency/asset. |

Examples

SDK Initialization

import { PerqSdk, PRODUCTION } from '@dripfi/drip-sdk';
import { ethers } from 'ethers';

// Create SDK instance
const perqSdk = new PerqSdk(PRODUCTION);

// Initialize with Web3Provider (browser wallet)
const provider = new ethers.providers.Web3Provider(window.ethereum);
await perqSdk.init(provider);

// Now you can use all SDK methods
const pools = await perqSdk.pools.getAllPools();

deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>

I want to deposit 100 USDC in a USDC vault:

USDC_TOKEN_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"    --> USDC contract address in tenderly environment

you can get vault token address from the vault.depositToken.tokenAddress

VAULT_ADDRESS = "0x...c167" --> Check vaults returned by getAllVaults() and get vault address like: vault.vaultAddress

const txHash = await deposit(USDC_TOKEN_ADDRESS, VAULT_ADDRESS, '100')

[!NOTE] User will be prompted with 2 tx: 1st to approve token usage 2nd to deposit the funds in the vault

[!NOTE] Allowance is calculated by the deposit method, based on the current allowance and the required

[!IMPORTANT] Amount should be formatted, not parsed. In the example we want to deposit 100 USDC so we just input that value instead of adding 6 decimals (100000000)


swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, onChainProjectId: number): Promise<string>

I want to deposit 1.5 ETH in a WETH vault:

WETH_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"    --> WETH contract address example

// For depositing ETH into WETH pool you have to provide the WETH tokens address as a toTokenAddress as ETH itself doesn't have an address
const txHash = await swapAndDeposit(WETH_TOKEN_ADDRESS, WETH_TOKEN_ADDRESS, '0', vaultAddress, '1.5')

I want to deposit 100 DAI in a USDC vault:

DAI_TOKEN_ADDRESS = "0x6b175474e89094c44da98b954eedeac495271d0f"    --> DAI contract address example

// Assuming you already have the data of the vault
const txHash = await swapAndDeposit(DAI_TOKEN_ADDRESS, vault.depositToken.tokenAdrress, '100', vault.vaultAddress, vault.onChainProjectId)

[!IMPORTANT] ethAmount and fromTokenAmount should be formatted, not parsed. In the example we want to deposit 1.5 WETH so we just input that value instead of adding 18 decimals (1500000000000000000)


migrateDepositToOtherProject(tokenAddress: string, vaultAddress: string, onChainProjectId: number, targetOnChainProjectId, amount: string): Promise<string>

I want to migrate 50 USDC from projectA to projectB. ---> Let's assume we already fetched the data for these projects and selected the USDC pool of projectA which is called selectedPool in this example

const txHash = await lite.migrateDepositToOtherProject(
	selectedPool.depositToken.tokenAddress,
	selectedPool.vaultAddress,
	selectedPool.onChainProjectId,
	projectB.onChainProjectId || -1,
	'50',
);

withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>

const userBalanceObject = await getUserBalance();
const balance = userBalanceObject.userbalance;

[!NOTE] If i check balance, that is the max amount I can withdraw

I want to withdraw 100 USDC from the 1st vault fetched. ---> Let's assume the first vault is a USDC vault for simplicity Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (100 in this example)

const txHash = await lite.withdraw(
	vaultToWithdrawFrom.depositToken.tokenAddress,
	vaultToWithdrawFrom.vaultAddress,
	vaultToWithdrawFrom.onChainProjectId,
	'100',
);

I want to withdraw 3.55 WETH from the 1st vault fetched. ---> Let's assume the first vault is a WETH vault for simplicity Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (3.55 in this example)

const vaults = await sdk.pools.getAllPools();
const vaultToWithdrawFrom = vaults[0];

const txHash = await lite.withdraw(
	vaultToWithdrawFrom.depositToken.tokenAddress,
	vaultToWithdrawFrom.vaultAddress,
	vaultToWithdrawFrom.onChainProjectId,
	'3.55',
);

checkMainnetToSonicBridgeApproval(amount: string): Promise<boolean>

I want to check if the User approved the bridge contract to bridge 10 PERQ from MAINNET to SONIC

const hasApprovedAmount = await dripSdk.bridge.checkMainnetToSonicBridgeApproval('10');

approveMainnetToSonicBridge(amount: string): Promise<string>

I want to approve to bridge 10 PERQ from MAINNET to SONIC

const txHash = await dripSdk.bridge.approveMainnetToSonicBridge('10');

bridgeMainnetToSonic(amount: string): Promise<string>

I want to bridge 10 PERQ from MAINNET to SONIC

const txHash = await dripSdk.bridge.bridgeMainnetToSonic('10');

bridgeSonicToMainnet(amount: string): Promise<string>

I want to bridge 10 PERQ from SONIC to MAINNET

const txHash = await dripSdk.bridge.bridgeSonicToMainnet('10');

Types

type Asset = {
	decimals: number;
	symbol: string;
};

type BeanEntry = {
	address: string;
	reason: string;
	recycledAmount: string;
	beansAmount: string;
	beansSum: string;
	amountDepositedInUsd: string;
	createdAt: string;
	chainId: number;
	nonce: number;
};

type BeansBalance = {
	balance: string;
	bonusesClaimed: string[];
};

type DeployedProject = {
	id: number | undefined;
	projectName: string;
	owners: string[];
	logo: string;
	telegramLink: string;
	twitterLink: string;
	mediumLink: string;
	deckLink: string;
	roadmapLink: string;
	economicsLink: string;
	discordLink: string;
	docsLink: string;
	whitepaperLink: string;
	litepaperLink: string;
	websiteLink: string;
	supplyAtLaunch: number;
	fdv: number;
	latestRoundPriceInUsd: number;
	totalSupply: number;
	disabledTgePrice: boolean;
	backers: ProjectBacker[];
	networks: string[];
	content: string;
	tgeDate?: string;
	tgePrice?: number;
	vAPY?: number;
	wikiLink: string;
	youTubeLink: string;
	tikTokLink: string;
	stretchGoals: StretchGoal[];
	projectInfoText: string;
	projectRewardText: string;
	coingeckoId?: string;
	projectType: string;
	isFeatured: boolean;
	yelayVersion: YelayVersion;
	bannerImage?: string;
	rewardImage?: string;
	rewardTooltipName?: string;
};

type DeployedVault = {
	projectId: number;
	vaultAddress: string;
	liveUntil: string;
	liveFrom: string;
	type: VaultType;
	depositTokenId: string;
	rewards: VaultReward[];
	project?: DeployedProject;
	coingeckoId?: string;
	expectedTge?: string;
};

type DepositToken = {
	name: string;
	symbol: string;
	roundingDecimals: number;
	precisionDecimals: number;
	tokenAddress: string;
};

type DepositType = 'direct' | 'swap' | 'wrap';

enum ELoyaltyCardTier {
	White = 'White',
	Ivory = 'Ivory',
	Dune = 'Dune',
	Amber = 'Amber',
	Sienna = 'Sienna',
	Umber = 'Umber',
	Black = 'Black',
}

interface VaultOperations {
	getAllowance(params: VaultOperationParams): Promise<boolean>;
	approveAllowance(params: VaultOperationParams): Promise<string>;
	deposit(params: VaultOperationParams): Promise<string>;
	withdraw(params: WithdrawParams): Promise<string>;
	getBalance(vaultAddress: string, tokenAddress?: string, onChainProjectId?: number): Promise<string>;
}

type LoyaltyCard = {
	id: string;
	tier: ELoyaltyCardTier;
	level: number;
	cost: number;
	boost: number;
};

type MyPerqBalance = {
	currentlyDeposited: number;
	earnedRewards: number;
	earnedRewardsUsd: number;
	rewardsPerHour: number;
};

type MyPerqData = VaultData & MyPerqBalance {
	ethPrice: number;
	btcPrice: number;
	distributionType: VaultType;
	projectTvl: number;
};

type NFTBoost = {
	url: string;
	tokenAddress: string;
	multiplier: number;
	nftAddress: string;
	network: string;
	initialBlock: number;
	imagePath: string;
};

type BasePayload<T> = {
	payload: T;
};

type LinkedPodWallets = {
	suiWalletAddr: string;
	nearWalletAddr: string;
	solanaWalletAddr: string;
};

type NonceEnrichedPayload<T> = T & {
	deadline: number;
	signature: string;
};

type NonceEnrichedSignedPayload<T> = {
	signature: string;
	signerAddress: string;
	payload: NonceEnrichedPayload<T>;
};

type PerqConfig = {
	route: string;
	perqTokenAddress: string;
	perqTokenRecyclerAddress: string;
	perqSwapAndRecyclerAddress: string;
	slotBurnTokenAddress: string;
	perqVestingAddress: string;
	swapAndDepositContractAddress: string;
	ethereumSwapperAddress: string;
	smartVaultManagerContractAddress: string;
	bridgeMainnetPerqToSonicAddress: string;
	bridgeSonicPerqToMainnetAddress: string;
};

type PerqToBeansSwapInfo = {
	perqPrice: number;
	price: number;
	priceInFloat: number;
	deadline: number;
	signature: string;
};

type ProjectBacker = {
	name: string;
	image: string;
	link: string;
};

type QLFastRedeem = {
	assetsWithdrawn: {
		asset: {
			decimals: number;
			id: string;
			name: string;
			symbol: string;
		};
		claimed: string;
		id: string;
	}[];
	blockNumber: number;
	id: string;
	svtWithdrawn: string;
};

type SdkType = 'yelay' | 'silo';

type SpecialEditionLoyaltyCard = {
	id: string;
	name: string;
	boost: number;
	projects: number[];
	startDate: Date;
	endDate: Date;
};

type Strategy = {
	address: string;
	lastDoHardWorkTime: number | null;
	lastDoHardWorkBlock: number | null;
	name: string;
	assetGroupId: number;
	apy: number;
};

interface StretchGoal {
	threshhold: number;
	amountOfTokens: number;
}

type SwapInfo = {
	swapTarget: any;
	token: string;
	swapCallData: any;
};

type UpgradeLoyaltyCardPayload = {
	index: number;
};

type ClaimSpecialEditionLoyaltyCardPayload = {
	cardId: string;
};

type UserRewards = {
	// vaultAddress => pointsName => rewardsAmount
	[vaultAddress: string]: { [rewardPointsName: string]: number };
};

type VaultData = {
	tvlUsd: number;
	depositToken: DepositToken;
	vaultAddress: string;
	projectName: string;
	projectLogo: string;
	projectType: string;
	liveFrom: string;
	liveUntil: string;
	apy: number;
	tokenPrice: number;
	change24h: number;
	volume24h: number;
	onChainProjectId: number;
	isActive: boolean;
	owners: string[];
	coingeckoId?: string;
	expectedTge?: string;
	chainId: ChainId;
	distributionType: VaultType;
	strategies: Strategy[];
	rewards: VaultReward[];
	stretchGoals: StretchGoal[];
};

type VaultData = {
	depositToken: DepositToken;
	vaultAddress: string;
	projectName: string;
	projectLogo: string;
	projectType: string;
	liveFrom: string;
	liveUntil: string;
	apy: number;
	tvlUsd: number;
	avgTvl: number;
	tokenPrice: number;
	change24h: number;
	volume24h: number;
	peakTvl: number;
	onChainProjectId: number;
	combinedTvl: number;
	isActive: boolean;
	owners: string[];
	coingeckoId?: string;
	expectedTge?: string;
	chainId: ChainId;
	strategies: Strategy[];
	stretchGoals: StretchGoal[];
	rewards: VaultReward[];
	rewardTooltipName: string;
	sdkType: SdkType;
};

type VaultReward = {
	id: number | undefined;
	type: RewardType;
	name: string;
	symbol: string;
	decimals: number;
	tokenAddress: string;
	monthlyEmissionRate: number;
	blockNumber: number;
	rewardRate: number;
	timestamp: number;
	endTime: number;
};

type VaultStats = {
	totalTVL: number;
	totalUsers: number;
	activeVaults: number;
};

type VaultType = 'launch' | 'earn' | 'airdrop';

interface WithdrawParams {
	amount: string;
	sdkType: SdkType;
	tokenAddress: string;
	vaultAddress: string;
	// Optional parameters that may be needed for specific SDK implementations
	onChainProjectId?: number; // needed for yelay SDK
}

interface VaultOperationParams {
	sourceTokenAddress: string;
	vaultTokenAddress: string;
	vaultAddress: string;
	amount: string;
	sdkType: SdkType;
	onChainProjectId?: number;
	sourceTokenSymbol?: string;
	vaultTokenSymbol?: string;
}

type VestingInfo = {
	startTimestamp: string;
	endTimestamp: string;
	vested: string;
	releasable: string;
	releasableTotal: string;
};

type YelayVersion = 'v2' | 'lite';

type MigrationOption = {
	projectName: string;
	projectLogo: string;
	onChainProjectId: number;
};

type ProjectHistoricalTvl = {
	[timestamp: number]: number;
};

// Additional Types:

type ReducedProjectData = {
	tvlUsd: number;
	peakTvlUsd: number;
	projectName: string;
	logo: string;
	bannerImage: string;
	rewardImage: string;
	rewardTooltipName: string;
	projectInfoText: string;
	projectType: string;
	distributionType: VaultType;
	liveUntil: string;
	liveFrom: string;
	vAPY: number;
	chainIds: number[];
	isFeatured: boolean;
	currencies: DepositToken[];
	isHidden: boolean;
};

type DetailedProjectData = ReducedProjectData & {
	supplyAtLaunch: number;
	fdv: number;
	totalSupply: number;
	content: string;
	telegramLink: string;
	twitterLink: string;
	mediumLink: string;
	deckLink: string;
	roadmapLink: string;
	economicsLink: string;
	discordLink: string;
	docsLink: string;
	whitepaperLink: string;
	litepaperLink: string;
	websiteLink: string;
	projectType: string;
	wikiLink: string;
	youTubeLink: string;
	tikTokLink: string;
	projectRewardText: string;
	networks: string[];
	protocols: string[];
	yelayVersion: YelayVersion;
	stretchGoals: StretchGoal[];
	backers: ProjectBacker[];
	vaults: VaultData[];
}

type RewardType = 'token' | 'points';

const BASE_CHAIN_ID = 8453;
const ETHEREUM_CHAIN_ID = 1;
const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
const ARBITRUM_CHAIN_ID = 42161;
const SONIC_CHAIN_ID = 146;
const AVALANCHE_CHAIN_ID = 42161;

type ChainId =
	| typeof BASE_CHAIN_ID
	| typeof ETHEREUM_CHAIN_ID
	| typeof ETHEREUM_SEPOLIA_CHAIN_ID
	| typeof ARBITRUM_CHAIN_ID
	| typeof SONIC_CHAIN_ID
	| typeof AVALANCHE_CHAIN_ID ;

type Earnings = {
	[vaultAddress: string]: {
		onChainProjectId: number;
		precisionDecimals: number;
		amountEarned: string;
		symbol: string;
		deposit: string;
		earningPerHour: string;
	};
};

type OverallStats = {
	activeProjects: number;
	totalTvl: number;
	totalYieldUsd: number;
	totalUsers: number;
};

Abis

  • PERQ_SWAP_AND_RECYCLER_ABI
  • WETH_TOKEN_ABI
  • PERQ_TOKEN_ABI
  • TOKEN_RECYCLER_ABI
  • PERQ_VESTING_ABI
  • BRIDGE_SONIC_PERQ_TO_MAINNET_ABI
  • BRIDGE_MAINNET_PERQ_TO_SONIC_ABI