Data Union Observation
You can get stats regarding your members and the earnings connected to your Data Union.
const dataUnion = await DU.getDataUnion(
DATA_UNION_CONTRACT_ADDRESS
);
const stats = await dataUnion.getStats()
The returned stats object would look something like this:
{
"activeMemberCount": BigNumber {_hex: '0x00', _isBigNumber: true}
"inactiveMemberCount": BigNumber {_hex: '0x00', _isBigNumber: true}
"joinPartAgentCount": BigNumber {_hex: '0x02', _isBigNumber: true}
"lifetimeMemberEarnings": BigNumber {_hex: '0x00', _isBigNumber: true}
"totalAdminFees": BigNumber {_hex: '0x00', _isBigNumber: true}
"totalDataUnionFees": BigNumber {_hex: '0x00', _isBigNumber: true}
"totalEarnings": BigNumber {_hex: '0x00', _isBigNumber: true}
"totalRevenue": BigNumber {_hex: '0x00', _isBigNumber: true}
"totalWithdrawable": BigNumber {_hex: '0x00', _isBigNumber: true}
}
dataUnion.getActiveMemberCount();
// returns contract address of the data union
dataUnion.getAddress();
dataUnion.getAdminAddress();
// Get data union admin fee fraction (between 0.0 and 1.0) that admin gets from each revenue event
dataUnion.getAdminFee();
dataUnion.getChainName();
dataUnion.getMemberStats("$memberAddress")
/**
returns:
{
earningsBeforeLastJoin: BigNumber {_hex: '0x00', _isBigNumber: true}
status: "ACTIVE"
totalEarnings: BigNumber {_hex: '0x00', _isBigNumber: true}
withdrawableEarnings: BigNumber {_hex: '0x00', _isBigNumber: true}
}
*/
dataUnion.getMetadata();
dataUnion.getNewMemberStipend();
dataUnion.getWithdrawableEarnings("$memberAddress");
If you deployed with Streamr the Streamr Core app provides monitoring functions for Admins, showing subscriber numbers, total revenue, join requests and more.
Data unions are listed along with the data products in Core > Products. Data unions are marked by a data union badge and a members badge showing the current amount of approved members. Click the tile menu to access the data union stats and manage members.
The stats view provides an overview of the data union as well as its members and subscribers over time. The members view allows you to manage manual member join requests (requests that did not contain a shared secret).