UNPKG

@collabland/staking-contracts

Version:
74 lines (73 loc) 3.17 kB
import { AssetType, AssetTypeParams } from '@collabland/chain'; import { BigNumber } from 'ethers'; import { StackingContractAdapter, StakingContractMetadata } from '../staking.js'; export declare class StakingContractsService { private adapters; /** * Staking contracts */ readonly stakingContracts: StakingContractMetadata[]; constructor(adapters: StackingContractAdapter[]); private getStakingContracts; /** * Check if a given contract address is a supported staking contract * @param contractAddress - Contract address * @param chainId - Chain id, default to `1` * @returns */ isStakingContract(contractAddress: string, chainId?: number): boolean; getStakingAssetTypes(contractAddress: string, chainId?: number): string[]; /** * Find staking contracts that support the given asset type to be staked * @param assetType - CAIP asset type * @returns */ findStakingContractByAssetType(assetType: string | AssetTypeParams): StakingContractMetadata[]; private getAdapter; private getAdaptersByAssetType; /** * Get staked token ids for the given asset type * @param owner - Owner address * @param chainId - Chain id * @param assetName - Asset name of the original token * @returns */ getStakedTokenIdsByAssetType(owner: string, chainId: number | undefined, assetName: string): Promise<BigNumber[]>; /** * Get staked token balance for the given asset type * @param owner - Owner address * @param chainId - Chain id * @param assetName - Asset name of the original token * @returns */ getStakedBalanceByAssetType(owner: string, chainId: number | undefined, assetName: string): Promise<BigNumber>; /** * Get a list of token ids staked by the owner * @param owner - Owner's wallet address * @param contractAddress - Contract address of the staking contract * @param chainId - Chain id, default to `1` * @param name - Optional name of the asset if the staking contract * supports multiple assets * @returns */ getStakedTokenIds(owner: string, contractAddress: string, chainId?: number, name?: string): Promise<BigNumber[] | undefined>; /** * Get the number of token ids staked by the owner * @param owner - Owner's wallet address * @param contractAddress - Contract address of the staking contract * @param chainId - Chain id, default to `1` * @param name - Optional name of the asset if the staking contract * supports multiple assets * @returns */ getStakedTokenBalance(owner: string, contractAddress: string, chainId?: number, name?: string): Promise<BigNumber | undefined>; /** * Get the staking asset type for a given staking contract and asset name * @param contractAddress - Staking contract address * @param chainId - Chain id, default to `11 * @param name - Optional name of the asset if the staking contract * supports multiple assets * @returns */ getStakingAssetType(contractAddress: string, chainId?: number, name?: string): AssetType | undefined; }