UNPKG

@everstake/wallet-sdk

Version:

Everstake Wallet SDK for Javascript

1,575 lines (1,570 loc) 75.9 kB
import BigNumber from 'bignumber.js'; import { Contract } from 'web3'; import { PublicKey, AccountInfo, ParsedAccountData, VersionedTransaction, Lockup, TransactionInstruction, Signer, EpochInfo } from '@solana/web3.js'; import * as superstruct from 'superstruct'; import { Infer } from 'superstruct'; /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ declare const ABI_CONTRACT_ACCOUNTING: readonly [{ readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "InvalidParam"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "InvalidValue"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "ZeroValue"; readonly type: "error"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "round"; readonly type: "uint256"; }]; readonly name: "ActivateRound"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "AddWithdrawRequest"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "Autocompound"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "int256"; readonly name: ""; readonly type: "int256"; }]; readonly name: "ChangeExpectValidatorsToStop"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "ClaimPoolFee"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "ClaimWithdrawRequest"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "DepositPending"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "newFee"; readonly type: "uint256"; }]; readonly name: "FeeUpdated"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "oldGovernor"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "address"; readonly name: "newGovernor"; readonly type: "address"; }]; readonly name: "GovernorChanged"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint8"; readonly name: "version"; readonly type: "uint8"; }]; readonly name: "Initialized"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "InterchangeDeposit"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "InterchangeWithdraw"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "previousOwner"; readonly type: "address"; }, { readonly indexed: true; readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "OwnershipTransferred"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "superAdmin"; readonly type: "address"; }]; readonly name: "SetSuperAdmin"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "rewarderBalance"; readonly type: "uint256"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "reward"; readonly type: "uint256"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "fee"; readonly type: "uint256"; }]; readonly name: "Update"; readonly type: "event"; }, { readonly inputs: readonly []; readonly name: "BEACON_AMOUNT"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "FEE_DENOMINATOR"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "governor"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "owner"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "renounceOwnership"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "value"; readonly type: "address"; }]; readonly name: "setSuperAdmin"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "superAdmin"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "transferOwnership"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "poolFee"; readonly type: "uint256"; }, { readonly internalType: "address"; readonly name: "rewardsTreasury"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "withdrawTreasury"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "accountingGovernor"; readonly type: "address"; }]; readonly name: "initialize"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "depositToPendingValue"; readonly type: "uint256"; }]; readonly name: "deposit"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "interchangedAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "activatedSlots"; readonly type: "uint256"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "balance"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "pendingDepositedBalance"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "pendingBalance"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "autocompoundBalanceOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "autocompoundBalance"; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "depositedBalanceOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "pendingDepositedBalanceOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "pendingBalanceOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly name: "withdrawPending"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "withdraw"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "withdrawFromPendingAmount"; readonly type: "uint256"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "claimPoolFee"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "getPoolFee"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "feeBalance"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "update"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "feeValue"; readonly type: "uint256"; }]; readonly name: "setFee"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "autocompound"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "pendingRestakedRewards"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "pendingRestakedRewardOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "account"; readonly type: "address"; }]; readonly name: "restakedRewardOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "withdrawRequestQueueParams"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }]; readonly name: "withdrawRequest"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "claimWithdrawRequest"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "readyforAutocompoundRewardsAmount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "unclaimedReward"; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "closeValidatorsStat"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "stakeAmount"; readonly type: "uint256"; }]; readonly name: "setMinRestakeAmount"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "activatedValidatorNum"; readonly type: "uint256"; }]; readonly name: "activateValidators"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; declare const ABI_CONTRACT_POOL: readonly [{ readonly inputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "constructor"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "InvalidAmount"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "InvalidParam"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "InvalidValue"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "Paused"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly internalType: "string"; readonly name: "field"; readonly type: "string"; }]; readonly name: "ZeroValue"; readonly type: "error"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "oldGovernor"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "address"; readonly name: "newGovernor"; readonly type: "address"; }]; readonly name: "GovernorChanged"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint8"; readonly name: "version"; readonly type: "uint8"; }]; readonly name: "Initialized"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "previousOwner"; readonly type: "address"; }, { readonly indexed: true; readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "OwnershipTransferStarted"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "previousOwner"; readonly type: "address"; }, { readonly indexed: true; readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "OwnershipTransferred"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly name: "PauseStaking"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly name: "PauseWithdraw"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "bytes"; readonly name: "oldPendingValidatorPubKey"; readonly type: "bytes"; }, { readonly indexed: false; readonly internalType: "bytes"; readonly name: "newPendingValidatorPubKey"; readonly type: "bytes"; }]; readonly name: "PendingValidatorReplaced"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly name: "Restake"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "SetMinStakeAmount"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "superAdmin"; readonly type: "address"; }]; readonly name: "SetSuperAdmin"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "StakeActivated"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }, { readonly indexed: false; readonly internalType: "uint64"; readonly name: "source"; readonly type: "uint64"; }]; readonly name: "StakeAdded"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "StakeCanceled"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "bytes"; readonly name: "validator"; readonly type: "bytes"; }]; readonly name: "StakeDeposited"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "staker"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }, { readonly indexed: false; readonly internalType: "uint64"; readonly name: "source"; readonly type: "uint64"; }]; readonly name: "Unstake"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly internalType: "bytes"; readonly name: "validator"; readonly type: "bytes"; }]; readonly name: "ValidatorMarkedAsExited"; readonly type: "event"; }, { readonly inputs: readonly []; readonly name: "BEACON_AMOUNT"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "acceptOwnership"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "governor"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "owner"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "pendingOwner"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "renounceOwnership"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "value"; readonly type: "address"; }]; readonly name: "setSuperAdmin"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "superAdmin"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "transferOwnership"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "depositContract"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "accountingContract"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "withdrawTreasury"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "rewardsTreasury"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "poolGovernor"; readonly type: "address"; }]; readonly name: "initialize"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint64"; readonly name: "source"; readonly type: "uint64"; }]; readonly name: "stake"; readonly outputs: readonly []; readonly stateMutability: "payable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly name: "unstakePending"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }, { readonly internalType: "uint16"; readonly name: "allowedInterchangeNum"; readonly type: "uint16"; }, { readonly internalType: "uint64"; readonly name: "source"; readonly type: "uint64"; }]; readonly name: "unstake"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "unstakeFromPendingValue"; readonly type: "uint256"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "activateStake"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "activatedSlots"; readonly type: "uint256"; }]; readonly name: "restake"; readonly outputs: readonly []; readonly stateMutability: "payable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly components: readonly [{ readonly internalType: "bytes"; readonly name: "pubkey"; readonly type: "bytes"; }, { readonly internalType: "bytes"; readonly name: "signature"; readonly type: "bytes"; }, { readonly internalType: "bytes32"; readonly name: "deposit_data_root"; readonly type: "bytes32"; }]; readonly internalType: "struct ValidatorList.DepositData[]"; readonly name: "pendingValidators"; readonly type: "tuple[]"; }]; readonly name: "setPendingValidators"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "getPendingValidatorCount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "index"; readonly type: "uint256"; }]; readonly name: "getPendingValidator"; readonly outputs: readonly [{ readonly internalType: "bytes"; readonly name: ""; readonly type: "bytes"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "getValidatorCount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "index"; readonly type: "uint256"; }]; readonly name: "getValidator"; readonly outputs: readonly [{ readonly internalType: "bytes"; readonly name: ""; readonly type: "bytes"; }, { readonly internalType: "enum ValidatorList.ValidatorStatus"; readonly name: ""; readonly type: "uint8"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "index"; readonly type: "uint256"; }, { readonly components: readonly [{ readonly internalType: "bytes"; readonly name: "pubkey"; readonly type: "bytes"; }, { readonly internalType: "bytes"; readonly name: "signature"; readonly type: "bytes"; }, { readonly internalType: "bytes32"; readonly name: "deposit_data_root"; readonly type: "bytes32"; }]; readonly internalType: "struct ValidatorList.DepositData"; readonly name: "pendingValidator"; readonly type: "tuple"; }]; readonly name: "replacePendingValidator"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "num"; readonly type: "uint256"; }]; readonly name: "markValidatorsAsExited"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "index"; readonly type: "uint256"; }]; readonly name: "markValidatorAsExited"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "reorderPending"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "bool"; readonly name: "pause"; readonly type: "bool"; }]; readonly name: "pauseStaking"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "bool"; readonly name: "pause"; readonly type: "bool"; }]; readonly name: "pauseWithdraw"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "newGovernor"; readonly type: "address"; }]; readonly name: "setGovernor"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly inputs: readonly []; readonly name: "minStakeAmount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "stakeAmount"; readonly type: "uint256"; }]; readonly name: "setMinStakeAmount"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ type EthNetworkType = 'mainnet' | 'holesky'; interface EthNetworkAddresses { addressContractAccounting: string; addressContractPool: string; addressContractWithdrawTreasury: string; rpcUrl: string; } type EthNetworkAddressesMap = { [K in EthNetworkType]: EthNetworkAddresses; }; type EthTransaction = { from: string; to: string; value: number; gasLimit: number; data: string; }; declare enum ValidatorStatus { Unknown = 0, Pending = 1, Deposited = 2 } interface AggregatedBalances { [key: string]: string; } /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ /** * `WalletSDKError` is a custom error class that extends the built-in `Error` class. * It provides additional properties for error handling within the Wallet SDK. * * @remarks * This class is needed to provide additional context for errors, such as a code * and the original error, if any. * * @public * * @param message - The error message. * @param code - A string representing the error code. * @param originalError - The original error that caused this error, if any. */ declare class WalletSDKError extends Error { code: string; originalError?: Error | undefined; constructor(message: string, code: string, originalError?: Error | undefined); } /** * `Blockchain` is an abstract class that provides a structure for blockchain-specific classes. * It includes methods for error handling and throwing errors. * * @remarks * This class should be extended by classes that implement blockchain-specific functionality. * The extending classes should provide their own `ERROR_MESSAGES` and `ORIGINAL_ERROR_MESSAGES`. * * @property ERROR_MESSAGES - An object that maps error codes to error messages. * @property ORIGINAL_ERROR_MESSAGES - An object that maps original error messages to user-friendly error messages. * * * **/ declare abstract class Blockchain { protected abstract ERROR_MESSAGES: { [key: string]: string; }; protected abstract ORIGINAL_ERROR_MESSAGES: { [key: string]: string; }; /** * Handles errors that occur within the Ethereum class. * * @param {keyof typeof ERROR_MESSAGES} code - The error code associated with the error. * @param {Error | WalletSDKError | unknown} originalError - The original error that was thrown. * * If the original error is an instance of WalletSDKError, it is thrown as is. * If the original error is an instance of the built-in Error class, a new WalletSDKError is thrown with the original error as the cause. * If the original error is not an instance of WalletSDKError or Error, a new WalletSDKError is thrown with a generic message and code. */ handleError(code: keyof typeof this.ERROR_MESSAGES, originalError: Error | WalletSDKError | unknown): void; /** * Throws a WalletSDKError with a specified error code and message. * * @param {keyof typeof ERROR_MESSAGES} code - The error code associated with the error. * @param {...string[]} values - The values to be inserted into the error message. * * The method retrieves the error message template associated with the provided code from the ERROR_MESSAGES object. * It then replaces placeholders in the message template with provided values and throws a WalletSDKError with the final message and the provided code. */ throwError(code: keyof typeof this.ERROR_MESSAGES, ...values: string[]): void; /** * Check if the URL is valid * * @param {string} url - URL * @returns a bool type result. * */ isValidURL(url: string): boolean; } /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ /** * The `Ethereum` class extends the `Blockchain` class and provides methods for interacting with the Ethereum network. * * It allows you to select a network, initialize it, and retrieve the balance of the contract. * * @property {provider} rpcUrl - The RPC URL of the Ethereum network. * @property {Web3} web3 - The Web3 instance used for interacting with the Ethereum network. * @property {string} addressContractAccounting - The address of the accounting contract. * @property {string} addressContractPool - The address of the pool contract. * @property {string} addressContractWithdrawTreasury - The address of the withdraw treasury contract. * @property {Contract} contractAccounting - The accounting contract instance. * @property {Contract} contractPool - The pool contract instance. * @property ERROR_MESSAGES - The error messages for the Ethereum class. * @property ORIGINAL_ERROR_MESSAGES - The original error messages for the Ethereum class. * */ declare class Ethereum extends Blockchain { addressContractAccounting: string; addressContractPool: string; addressContractWithdrawTreasury: string; contractAccounting: Contract<typeof ABI_CONTRACT_ACCOUNTING>; contractPool: Contract<typeof ABI_CONTRACT_POOL>; private rpcUrl; private web3; private minAmount; protected ERROR_MESSAGES: { BALANCE_ERROR: string; PENDING_BALANCE_ERROR: string; PENDING_DEPOSITED_BALANCE_ERROR: string; PENDING_RESTAKED_REWARDS_ERROR: string; READY_FOR_AUTOCOMPOUND_REWARDS_AMOUNT_ERROR: string; PENDING_BALANCE_OF_ERROR: string; PENDING_DEPOSITED_BALANCE_OF_ERROR: string; DEPOSITED_BALANCE_OF_ERROR: string; PENDING_RESTAKED_REWARD_OF_ERROR: string; RESTAKED_REWARD_OF_ERROR: string; GET_POOL_FEE_ERROR: string; MIN_STAKE_AMOUNT_ERROR: string; GET_VALIDATOR_ERROR: string; GET_VALIDATOR_COUNT_ERROR: string; GET_PENDING_VALIDATOR_ERROR: string; GET_PENDING_VALIDATOR_COUNT_ERROR: string; ACTIVATE_STAKE_ERROR: string; MIN_AMOUNT_ERROR: string; UNSTAKE_PENDING_ERROR: string; INSUFFICIENT_PENDING_BALANCE_ERROR: string; ZERO_UNSTAKE_MESSAGE: string; AMOUNT_GREATER_THAN_PENDING_BALANCE_ERROR: string; NETWORK_NOT_SUPPORTED: string; NO_REWARDS_MESSAGE: string; AUTOCOMPOUND_ERROR: string; AUTOCOMPOUND_BALANCE_OF_ERROR: string; WITHDRAW_REQUEST_QUEUE_PARAMS_ERROR: string; WITHDRAW_REQUEST_ERROR: string; ZERO_UNSTAKE_ERROR: string; NOT_FILLED_UNSTAKE_MESSAGE: string; WRONG_TYPE_MESSAGE: string; CLAIM_WITHDRAW_REQUEST_ERROR: string; CLOSE_VALIDATORS_STAT_ERROR: string; STAKE_ERROR: string; UNSTAKE_ERROR: string; SIMULATE_UNSTAKE_ERROR: string; MAX_AMOUNT_FOR_UNSTAKE_ERROR: string; ADDRESS_FORMAT_ERROR: string; USER_BALANCES_ERROR: string; POOL_BALANCES_ERROR: string; }; protected ORIGINAL_ERROR_MESSAGES: { 'InvalidValue: remainder': string; 'InvalidValue: amount': string; 'InvalidValue: pending balance': string; 'ZeroValue: pending': string; 'ZeroValue: claim': string; 'InvalidParam: index': string; 'InvalidParam: caller': string; 'InvalidValue: zero amount': string; 'InvalidValue: share': string; 'InvalidValue: withdrawable balance': string; 'Paused: withdraw claim': string; 'Paused: staking': string; 'Paused: withdraw': string; 'InvalidAmount: small stake': string; 'Pending validator': string; 'Returned error: execution reverted': string; }; constructor(network?: EthNetworkType, url?: string); /** * Retrieves the balance of the contract. * * This method calls the `balance` method on the `contractAccounting` contract, * converts the result from Wei to Ether, and returns the result as a `BigNumber`. * * @returns A promise that resolves to the balance of the contract as a `BigNumber`. * * @throws Will throw an error if the contract call fails. */ balance(): Promise<BigNumber>; /** * Fetches the pool pending balance. This balance is always less than 32 ETH. * * @returns A Promise that resolves to the pending balance in ether. * * @throws Will throw an Error if the contract call fails. */ pendingBalance(): Promise<BigNumber>; /** * Fetches the pool pending deposited balance. This is the balance deposited into the Beacon deposit contract but validators are still not active. * * @returns A Promise that resolves to the pending deposited balance in ether. * * @throws Will throw an Error if the contract call fails. */ pendingDepositedBalance(): Promise<BigNumber>; /** * Fetches the pool restaked rewards which are in pending status. * * @returns A Promise that resolves to the pending restaked rewards amount in ether. * * @throws Will throw an Error if the contract call fails. */ pendingRestakedRewards(): Promise<BigNumber>; /** * Fetches the pool unclaimed rewards amount which can be restaked. * * @returns A Promise that resolves to the unclaimed rewards amount in ether. * * @throws Will throw an Error if the contract call fails. */ readyforAutocompoundRewardsAmount(): Promise<BigNumber>; /** * Fetches the pending balance of a given address. * * @param address - The address to fetch the pending balance for. * * @returns A Promise that resolves to the pending balance in ether. * * @throws Will throw an Error if the contract call fails or address is not valid. */ pendingBalanceOf(address: string): Promise<BigNumber>; /** * Fetches the user's pending deposited balance. This is the balance deposited into the validator but not active yet. * Pending deposited balance can't be unstaked till validator activation. * * @param address - The address to fetch the pending deposited balance for. * * @returns A Promise that resolves to the pending deposited balance in ether. * * @throws Will throw an Error if the contract call fails. */ pendingDepositedBalanceOf(address: string): Promise<BigNumber>; /** * Fetches the user's active origin deposited balance. * * @param address - The address to fetch the deposited balance for. * * @returns A Promise that resolves to the deposited balance in ether. * * @throws Will throw an Error if the contract call fails. */ depositedBalanceOf(address: string): Promise<BigNumber>; /** * Fetches the user's restaked rewards in pending state. * * @param address - The address to fetch the pending restaked rewards for. * * @returns A Promise that resolves to the pending restaked rewards in ether. * * @throws Will throw an Error if the contract call fails. */ pendingRestakedRewardOf(address: string): Promise<BigNumber>; /** * Returns total user restaked rewards. Includes rewards in pending state. * * @param address - The address to fetch the restaked rewards for. * * @returns A Promise that resolves to the restaked rewards in ether. * * @throws Will throw an Error if the contract call fails. */ restakedRewardOf(address: string): Promise<BigNumber>; /** * Fetches the pool fee in bips (1/10000). * * @returns A Promise that resolves to the pool fee. * * @throws Will throw an Error if the contract call fails. */ getPoolFee(): Promise<BigNumber>; /** * Claims all pool rewards and restakes it into the pool. * * @param address - The address to perform the autocompound operation for. * * @returns A Promise that resolves to a transaction object. * * @throws Will throw an Error if the contract call fails or there are no rewards. */ autocompound(address: string): Promise<EthTransaction>; /** * Returns total user autocompound balance. Part of this balance could be in pending state after rewards autocompound. * * @param address - The address to fetch the autocompound balance for. * * @returns A Promise that resolves to the autocompound balance in ether. * * @throws Will throw an Error if the contract call fails. */ autocompoundBalanceOf(address: string): Promise<BigNumber>; /** * Returns info about withdraw requests queue. * Includes totally all-time requested withdraw amount, * actual allowed for interchange with deposits amount, * all-time withdraw treasury filled amount, * and all-time claimed