nem-voting
Version:
60 lines (59 loc) • 1.85 kB
TypeScript
import { Address, TransferTransaction } from "nem-library";
import { Observable } from "rxjs";
/**
* Represents the info from a poll header sent to an index
*/
interface IPollHeader {
title: string;
type: number;
doe: number;
address: Address;
creator: Address;
whitelist?: Address[];
}
/**
* Contains the info for a poll index, public or private
*/
declare class PollIndex {
/**
* Poll Index Address
*/
address: Address;
/**
* true if the index is private. On private indexes only the creator can send valid polls
*/
isPrivate: boolean;
/**
* the creator of the poll, only needed for private indexes
*/
creator?: Address;
/**
* array of broadcasted header polls for the index
*/
headers: IPollHeader[];
lastId?: number;
/**
* Gets a poll index from its address with all of its broadcasted polls
* @param address - the index account address
* @return Observable<PollIndex>
*/
static fromAddress: (address: Address, lastId?: number | undefined) => Observable<PollIndex>;
fetchNextPage: () => Observable<IPollHeader[]>;
/**
* Creates a new poll Index
* @param isPrivate - will create a private index if true
* @param creatorAddress - needed only if the index is private
* @return Observable<PollIndex>
*/
static create: (isPrivate: boolean, creatorAddress?: Address | undefined) => {
address: Address;
transaction: TransferTransaction;
};
}
/**
* Gets the addresses for all the poll indexes created by an address
* @param creator - the address of the creator of the indexes we want
* @return Observable<Address[]>
*/
declare const getCreatedIndexAddresses: (creator: Address) => Observable<Address[]>;
export { PollIndex, IPollHeader, getCreatedIndexAddresses };