@ardier16/q-js-sdk
Version:
Typescript Library to interact with Q System Contracts
103 lines (102 loc) • 4.53 kB
TypeScript
import Web3 from 'web3';
import { TransactionReceipt } from 'web3-eth';
import { Roots } from '../../../web3-contracts/Roots';
import { QNonPayableTx, QPayableTx, TimeLockEntry, RootNodesWithdrawalInfo, VotingLockInfo } from '../../../types';
import { SystemContractInstance } from '../../SystemContractInstance';
import { VotingWeightProxyInstance } from '../VotingWeightProxyInstance';
import BN from 'bn.js';
export interface Stake {
root: string;
value: string;
}
/**
* Root nodes instance to interact with Root nodes contract.
* See [onchain documentation](@system-contracts-repo/@network/Roots/) for more details.
* An instance of this class for a deployed network can be obtained via {@link ContractRegistryInstance.rootNodes}
*/
export declare class RootNodesInstance extends SystemContractInstance<Roots> {
static readonly registryKey = "governance.rootNodes";
static readonly abi = "Roots.json";
/**
* VotingWeightProxy instance. Used by local methods.
*/
votingWeightProxy: VotingWeightProxyInstance;
private timeLockHelper;
constructor(web3: Web3, address: string);
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getlockinfo)
*/
getLockInfo(who: string): Promise<VotingLockInfo>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getslashingproposalids)
*/
getSlashingProposalIds(root: string): Promise<string[]>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#applyslashing)
*/
applySlashing(proposalId: number | string | BN, root: string, amountToSlash: number | string | BN, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#addslashingproposal)
*/
addSlashingProposal(root: string, slashingProposalId: number | string | BN, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getmembers)
*/
getMembers(): Promise<string[]>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#ismember)
*/
isMember(user: string): Promise<boolean>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getsize)
*/
getSize(): Promise<string>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getlimit)
*/
getLimit(): Promise<string>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getrootnodestake)
*/
getRootNodeStake(root: string): Promise<string>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#getstakes)
*/
getStakes(): Promise<Stake[]>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#commitstake)
*/
commitStake(txOptions?: QPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#announcewithdrawal)
*/
announceWithdrawal(amount: string, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#withdraw)
*/
withdraw(amount: string, payTo: string, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](@system-contracts-repo/@network/Roots/#withdrawals)
*/
getWithdrawalInfo(address: string): Promise<RootNodesWithdrawalInfo>;
/**
* {@link TimeLockHelperInstance.depositOnBehalfOf | Internal documentation}
*/
depositOnBehalfOf(account: string, start: number | string | BN, end: number | string | BN, txOptions?: QPayableTx): Promise<TransactionReceipt>;
/**
* {@link TimeLockHelperInstance.getTimeLocks | Internal documentation}
*/
getTimeLocks(account: string): Promise<TimeLockEntry[]>;
/**
* {@link TimeLockHelperInstance.getMinimumBalance | Internal documentation}
*/
getMinimumBalance(account: string, timestamp: number | BN | string): Promise<string>;
/**
* {@link TimeLockHelperInstance.purgeTimeLocks | Internal documentation}
*/
purgeTimeLocks(account: string, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
/**
* [External documentation](https://q-dev.gitlab.io/system-contracts/latest/Roots/#purgependingslashings)
*/
purgePendingSlashings(root: string, txOptions?: QNonPayableTx): Promise<TransactionReceipt>;
}