UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

167 lines (166 loc) 10.9 kB
import { type Address, type ProviderRpcClient, type SendInternalParams, type Subscriber, type Transaction } from 'everscale-inpage-provider'; import { SmartContractModel } from '../../core'; import { type TvmTokenWalletTransferAbiParams } from '../../models/tvm-token-wallet'; import { type VoteEscrowAverage, type VoteEscrowCalcVeMintAbiParams, type VoteEscrowCastVoteAbiParams, type VoteEscrowCastVoteWithReasonAbiParams, type VoteEscrowCurrentEpochDetails, type VoteEscrowCurrentVotingVotes, type VoteEscrowDecodedEvent, type VoteEscrowDetails, type VoteEscrowEncodeDepositPayloadAbiParams, type VoteEscrowEncodeWhitelistPayloadAbiParams, type VoteEscrowEnvVotingAbiParams, type VoteEscrowGaugeDaoApproved, type VoteEscrowGaugeWhitelist, type VoteEscrowNormalizedVoting, type VoteEscrowUnlockCastedVotesAbiParams, type VoteEscrowUnlockVoteTokensAbiParams, VoteEscrowUtils, type VoteEscrowVoteEpochAbiParams, type VoteEscrowVotes, type VoteEscrowVotingDetails, type VoteEscrowWithdrawAbiParams } from '../../models/vote-escrow/VoteEscrowUtils'; import { type CallId, type Forceable, type SendMessageCallback, type Silentable, type Syncable, type TransactionCallbacks, type TransactionFailureReason, type TransactionSentDetails, type TransactionSuccessResult, type Watchable } from '../../types'; type VoteEscrowCallbacks<SendParams = any, SuccessParams = any, FailureParams = any> = SendMessageCallback<SendParams> & TransactionCallbacks<TransactionSuccessResult<SuccessParams>, TransactionFailureReason<FailureParams>, TransactionSentDetails>; export interface VoteEscrowDepositSuccessResult { amount: string; key: string; lockTime: number; user: Address; veAmount: string; } export interface VoteEscrowDepositCallbacks extends VoteEscrowCallbacks<unknown, VoteEscrowDepositSuccessResult> { } export interface VoteEscrowDepositParams extends Partial<Omit<TvmTokenWalletTransferAbiParams, 'recipient'>>, Partial<CallId>, VoteEscrowDepositCallbacks { amount: string | number; depositOwner: Address | string; recipient?: Address | string; tokenWalletAddress: Address | string; } export interface VoteEscrowWithdrawSuccessResult { amount: string; user: Address; } export interface VoteEscrowWithdrawCallbacks extends VoteEscrowCallbacks<unknown, VoteEscrowWithdrawSuccessResult> { } export interface VoteEscrowWithdrawParams extends Pick<VoteEscrowWithdrawAbiParams, 'meta'>, Partial<CallId>, VoteEscrowWithdrawCallbacks { } export interface VoteEscrowVoteEpochSuccessResult { user: Address; votes: VoteEscrowVotes[]; } export interface VoteEscrowVoteEpochCallbacks extends VoteEscrowCallbacks<unknown, VoteEscrowVoteEpochSuccessResult> { } export interface VoteEscrowVoteEpochParams extends VoteEscrowVoteEpochAbiParams, Partial<CallId>, VoteEscrowVoteEpochCallbacks { } export interface VoteEscrowEndVotingSuccessResult { newEpoch: number; newEpochEnd: number; newEpochStart: number; totalVotes: string; treasuryVotes: string; votes: VoteEscrowVotes[]; } export interface VoteEscrowEndVotingCallbacks extends VoteEscrowCallbacks<unknown, VoteEscrowEndVotingSuccessResult> { } export interface VoteEscrowEndVotingParams extends VoteEscrowEnvVotingAbiParams, Partial<CallId>, VoteEscrowEndVotingCallbacks { } export interface VoteEscrowCastVoteCallbacks extends SendMessageCallback, TransactionCallbacks<TransactionSuccessResult, TransactionFailureReason, TransactionSentDetails> { } export interface VoteEscrowCastVoteParams extends VoteEscrowCastVoteAbiParams, Partial<CallId>, VoteEscrowCastVoteCallbacks { ownerAddress?: Address | string; voteEscrowAccount?: Address | string; } export interface VoteEscrowCastVoteWithReasonParams extends VoteEscrowCastVoteWithReasonAbiParams, Partial<CallId>, VoteEscrowCastVoteCallbacks { ownerAddress?: Address | string; voteEscrowAccount?: Address | string; } export interface VoteEscrowUnlockCastedVotesCallbacks extends SendMessageCallback, TransactionCallbacks<TransactionSuccessResult, TransactionFailureReason, TransactionSentDetails> { } export interface VoteEscrowUnlockCastedVotesParams extends VoteEscrowUnlockCastedVotesAbiParams, Partial<CallId>, VoteEscrowUnlockCastedVotesCallbacks { ownerAddress?: Address | string; voteEscrowAccount?: Address | string; } export interface VoteEscrowUnlockVoteTokensCallbacks extends SendMessageCallback, TransactionCallbacks<TransactionSuccessResult, TransactionFailureReason, TransactionSentDetails> { } export interface VoteEscrowUnlockVoteTokensParams extends VoteEscrowUnlockVoteTokensAbiParams, Partial<CallId>, VoteEscrowUnlockVoteTokensCallbacks { ownerAddress?: Address | string; voteEscrowAccount?: Address | string; } export interface VoteEscrowCtorOptions { watchDebounceDelay?: number; } export interface VoteEscrowCreateOptions extends VoteEscrowCtorOptions, Syncable, Watchable { watchCallback?: VoidFunction; } export interface VoteEscrowData extends VoteEscrowDetails, VoteEscrowAverage, VoteEscrowCurrentEpochDetails, VoteEscrowCurrentVotingVotes, VoteEscrowNormalizedVoting, VoteEscrowVotingDetails { distributionSchedule: string[]; distributionScheme: string[]; gaugeDaoApproved: VoteEscrowGaugeDaoApproved; gaugeWhitelist: VoteEscrowGaugeWhitelist; } export declare class VoteEscrow extends SmartContractModel<VoteEscrowData> { protected readonly _connection: ProviderRpcClient; protected readonly options?: Readonly<VoteEscrowCtorOptions> | undefined; protected readonly _provider?: ProviderRpcClient | undefined; static Utils: typeof VoteEscrowUtils; /** * @param {ProviderRpcClient} _connection Standalone RPC client that doesn't require connection * to the TVM wallet provider * @param {Address | string} address VoteEscrow root address * @param {Readonly<VoteEscrowCtorOptions>} [options] (optional) VoteEscrow Smart Contract * Model options * @param {ProviderRpcClient} [_provider] (optional) RPC provider that require connection to * the TVM wallet */ constructor(_connection: ProviderRpcClient, address: Address | string, options?: Readonly<VoteEscrowCtorOptions> | undefined, _provider?: ProviderRpcClient | undefined); /** * @param {ProviderRpcClient} connection Standalone RPC client that doesn't require connection * to the TVM wallet provider * @param {Address | string} address VoteEscrow root address * @param {Readonly<VoteEscrowCreateOptions>} [options] (optional) VoteEscrow Smart Contract * Model options * @param {ProviderRpcClient} [provider] (optional) RPC provider that require connection to the * TVM wallet */ static create(connection: ProviderRpcClient, address: Address | string, options?: VoteEscrowCreateOptions, provider?: ProviderRpcClient): Promise<VoteEscrow>; sync(options?: Forceable & Silentable): Promise<void>; watch(callback?: VoidFunction): Promise<Subscriber>; unwatch(): Promise<void>; deposit(params: VoteEscrowDepositParams, args?: Partial<SendInternalParams>): Promise<Transaction>; withdraw(params: VoteEscrowWithdrawParams, args?: Partial<SendInternalParams>): Promise<Transaction>; voteEpoch(params: VoteEscrowVoteEpochParams, args?: Partial<SendInternalParams>): Promise<Transaction>; endVoting(params: VoteEscrowEndVotingParams, args?: Partial<SendInternalParams>): Promise<Transaction>; tryUnlockCastedVotes(params: VoteEscrowUnlockCastedVotesParams, args: Pick<SendInternalParams, 'from'> & Omit<Partial<SendInternalParams>, 'from'>): Promise<Transaction>; tryUnlockVoteTokens(params: VoteEscrowUnlockVoteTokensParams, args: Pick<SendInternalParams, 'from'> & Omit<Partial<SendInternalParams>, 'from'>): Promise<Transaction>; castVote(params: VoteEscrowCastVoteParams, args: Partial<SendInternalParams>): Promise<Transaction>; castVoteWithReason(params: VoteEscrowCastVoteWithReasonParams, args: Partial<SendInternalParams>): Promise<Transaction>; getVoteEscrowAccountAddress(ownerAddress: Address | string): Promise<Address>; calculateVeMint(params: VoteEscrowCalcVeMintAbiParams): Promise<string>; calculateGasForEndVoting(): Promise<string>; get currentEpoch(): VoteEscrowData['currentEpoch']; get currentEpochEndTime(): VoteEscrowData['currentEpochEndTime']; get currentEpochStartTime(): VoteEscrowData['currentEpochStartTime']; get currentVotingEndTime(): VoteEscrowData['currentVotingEndTime']; get currentVotingStartTime(): VoteEscrowData['currentVotingStartTime']; get currentVotingVotes(): VoteEscrowData['currentVotingVotes']; get dao(): VoteEscrowData['dao']; get distribution(): VoteEscrowData['distribution']; get distributionSchedule(): VoteEscrowData['distributionSchedule']; get distributionScheme(): VoteEscrowData['distributionScheme']; get distributionSupply(): VoteEscrowData['distributionSupply']; get emergency(): VoteEscrowData['emergency']; get emissionDebt(): VoteEscrowData['emissionDebt']; get epochTime(): VoteEscrowData['epochTime']; get gaugeMaxVotesRatio(): VoteEscrowData['gaugeMaxVotesRatio']; get gaugeMinVotesRatio(): VoteEscrowData['gaugeMinVotesRatio']; get gaugeDaoApproved(): VoteEscrowData['gaugeDaoApproved']; get gaugeWhitelist(): VoteEscrowData['gaugeWhitelist']; get gaugeWhitelistPrice(): VoteEscrowData['gaugeWhitelistPrice']; get maxGaugesPerVote(): VoteEscrowData['maxGaugesPerVote']; get initialized(): VoteEscrowData['initialized']; get lastUpdateTime(): VoteEscrowData['lastUpdateTime']; get manager(): VoteEscrowData['manager']; get normalizedVotes(): VoteEscrowData['normalizedVotes']; get owner(): VoteEscrowData['owner']; get paused(): VoteEscrowData['paused']; get qube(): VoteEscrowData['qube']; get qubeBalance(): VoteEscrowData['qubeBalance']; get qubeMaxLockTime(): VoteEscrowData['qubeMaxLockTime']; get qubeMinLockTime(): VoteEscrowData['qubeMinLockTime']; get qubeWallet(): VoteEscrowData['qubeWallet']; get teamTokens(): VoteEscrowData['teamTokens']; get timeBeforeVoting(): VoteEscrowData['timeBeforeVoting']; get treasuryTokens(): VoteEscrowData['treasuryTokens']; get veQubeAverage(): VoteEscrowData['veQubeAverage']; get veQubeAveragePeriod(): VoteEscrowData['veQubeAveragePeriod']; get veQubeBalance(): VoteEscrowData['veQubeBalance']; get whitelistPayments(): VoteEscrowData['whitelistPayments']; decodeMethodInput(payload: string, method: string | string[]): Promise<any>; decodeTransactionEvents(transaction: Transaction): Promise<VoteEscrowDecodedEvent[]>; encodeDepositPayload(params: VoteEscrowEncodeDepositPayloadAbiParams): Promise<string>; encodeWhitelistPayload(params: VoteEscrowEncodeWhitelistPayloadAbiParams): Promise<string>; } export {};