@parifi/sdk
Version:
Parifi SDK with common utility functions
129 lines (126 loc) • 3.81 kB
text/typescript
import { StandardMerkleTree } from '@openzeppelin/merkle-tree';
type RewardList = Record<string, Record<number, {
address: string;
amount: string;
}[]>>;
declare class RewardDistribution {
rewards: RewardList;
constructor(_rewards?: RewardList);
/**
* Sets the reward list.
* @param rewards The reward list to set.
*/
setRewardList(rewards: RewardList): void;
/**
* Gets the reward contract address and ABI for a specific token.
* @param tokenSymbol The symbol of the token.
* @returns The reward contract address and ABI.
*/
getRewardContract(tokenSymbol: string): Promise<{
address: `0x${string}`;
abi: ({
inputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
name?: undefined;
anonymous?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
stateMutability?: undefined;
anonymous?: undefined;
outputs?: undefined;
} | {
anonymous: boolean;
inputs: {
indexed: boolean;
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
stateMutability?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
}>;
/**
* Gets the Merkle tree for a specific token and round.
* @param tokenSymbol The symbol of the token.
* @param round The round number.
* @returns The Merkle tree for the specified token and round.
*/
getTree(tokenSymbol: string, round: number): Promise<StandardMerkleTree<string[]>>;
getUserData(user: string, tokenSymbol: string, round: number): Promise<{
userData: {
address: string;
amount: string;
} | undefined;
indexOf: number;
tree: StandardMerkleTree<string[]>;
}>;
/**
* Claims rewards for a user in multiple rounds.
* @param user The address of the user.
* @param rounds The array of round numbers.
* @param tokenSymbol The symbol of the token.
* @returns An array of transactions to be sent.
*/
claimRewards({ user, rounds, tokenSymbol }: {
user: string;
rounds: number[];
tokenSymbol: string;
}): Promise<{
tx: {
to: `0x${string}`;
data: `0x${string}`;
value: string;
};
amount: string;
}[]>;
/**
* Claims the reward for a user in a specific round.
* @param user The address of the user.
* @param round The round number.
* @param tokenSymbol The symbol of the token.
* @returns An array of transactions to be sent.
*/
claimReward({ user, round, tokenSymbol }: {
user: string;
tokenSymbol: string;
round: number;
}): Promise<{
tx: {
to: `0x${string}`;
data: `0x${string}`;
value: string;
};
amount: string;
}[]>;
}
export { RewardDistribution, type RewardList };