getSharesByShareholder()
/**
* Get the number of shares of the Collective Portrait that a shareholder has.
* @param {CollectivePortraitName | number} identity - The name of the Collective Portrait that the user would like to get the number of shares for.
* @param {UserPortraitAddress | UserPortraitENSName} shareholder - The address or ENS name of the shareholder that the user would like to get the number of shares for.
* @returns {number} - The number of shares of the Collective Portrait that the shareholder has.
* @beta
* @async
*/
getSharesByShareholder(
identity: CollectivePortraitName | number,
shareholder: UserPortraitAddress | UserPortraitENSName,
): number {
const id =
typeof identity === 'number' ? identity : this.getTokenIdByName(identity);
const shareholderAddress = isAddress(shareholder)
? shareholder
: this.portrait.defaultProvider.resolveName(shareholder);
return this.portrait.portraitCollectiveContract.balanceOf(
id,
shareholderAddress,
);
}
Last updated