@astonic-io/astonic-sdk
Version:
Official SDK for interacting with the Astonic Protocol
63 lines (62 loc) • 3.15 kB
TypeScript
import { BigNumberish, Signer, providers } from 'ethers';
import { AstonicGovernor } from '@astonic-io/astonic-bindings-ts';
import { IChainClient } from './interfaces';
export declare class Governance {
private chainClient;
constructor(chainClient: IChainClient);
constructor(signerOrProvider: Signer | providers.Provider);
/**
* This function retrieves the AstonicGovernor contract.
* @returns The AstonicGovernor contract.
*/
getGovernorContract(): Promise<AstonicGovernor>;
/**
* Generates a transaction that submits a proposal to be created to the Astonic Governor contract using the specified values.
* @param targets The addresses of the contracts to be called during proposal execution.
* @param values The values to be passed to the calls to the target contracts.
* @param calldatas The calldata to be passed to the calls to the target contracts.
* @param description A human readable description of the proposal.
* @returns The transaction request.
*/
createProposal(targets: string[], values: BigNumberish[], calldatas: string[], description: string): Promise<providers.TransactionRequest>;
/**
* Generates a transaction that will queue the proposal with the specified id to be executed.
* @param proposalId The id of the proposal to queue.
* @returns The transaction request.
*/
queueProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
/**
* Executes the proposal with the specified id.
* @param proposalId The id of the proposal to execute.
* @returns The transaction request.
*/
executeProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
/**
* Submits a vote to the Astonic Governor contract for the specified proposal.
* @param proposalId The id of the proposal to vote on.
* @param support Whether or not to support the proposal.
* @returns The transaction request.
*/
castVote(proposalId: BigNumberish, support: BigNumberish): Promise<providers.TransactionRequest>;
/**
* Cancels the proposal with the specified id.
* @param proposalId The id of the proposal to vote on.
* @param support Whether or not to support the proposal.
* @returns The transaction request.
*/
cancelProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
/**
* Returns the state of the proposal with the specified id.
* @param proposalId The id of the proposal to get the state of.
* @returns The state of the proposal.
*/
getProposalState(proposalId: BigNumberish): Promise<string>;
/**
* This function validates the args that are to be used in the createProposal function.
* @param targets The addresses of the contracts to be called during proposal execution.
* @param values The values to be passed to the calls to the target contracts.
* @param calldatas The calldata to be passed to the calls to the target contracts.
* @param description A human readable description of the proposal.
*/
private validateProposalArgs;
}