UNPKG

@temple-wallet/everstake-wallet-sdk-polygon

Version:
1,578 lines (1,568 loc) 49.4 kB
import { Abi, HttpTransport, FallbackTransport } from 'viem'; import BigNumber from 'bignumber.js'; /** * 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): never; /** * 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[]): never; /** * Check if the URL is valid * * @param {string} url - URL * @returns a bool type result. * */ isValidURL(url: string): boolean; } declare const ABI_CONTRACT_APPROVE: readonly [{ readonly constant: true; readonly inputs: readonly []; readonly name: "name"; readonly outputs: readonly [{ readonly name: ""; readonly type: "string"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "spender"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }]; readonly name: "approve"; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "totalSupply"; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "from"; readonly type: "address"; }, { readonly name: "to"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }]; readonly name: "transferFrom"; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "decimals"; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint8"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "spender"; readonly type: "address"; }, { readonly name: "addedValue"; readonly type: "uint256"; }]; readonly name: "increaseAllowance"; readonly outputs: readonly [{ readonly name: "success"; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "unpause"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly name: "account"; readonly type: "address"; }]; readonly name: "isPauser"; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "paused"; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "renouncePauser"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly name: "owner"; readonly type: "address"; }]; readonly name: "balanceOf"; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "account"; readonly type: "address"; }]; readonly name: "addPauser"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "pause"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "symbol"; readonly outputs: readonly [{ readonly name: ""; readonly type: "string"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "spender"; readonly type: "address"; }, { readonly name: "subtractedValue"; readonly type: "uint256"; }]; readonly name: "decreaseAllowance"; readonly outputs: readonly [{ readonly name: "success"; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly name: "to"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }]; readonly name: "transfer"; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly name: "owner"; readonly type: "address"; }, { readonly name: "spender"; readonly type: "address"; }]; readonly name: "allowance"; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly inputs: readonly [{ readonly name: "name"; readonly type: "string"; }, { readonly name: "symbol"; readonly type: "string"; }, { readonly name: "decimals"; readonly type: "uint8"; }, { readonly name: "totalSupply"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "constructor"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly name: "account"; readonly type: "address"; }]; readonly name: "Paused"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: false; readonly name: "account"; readonly type: "address"; }]; readonly name: "Unpaused"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly name: "account"; readonly type: "address"; }]; readonly name: "PauserAdded"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly name: "account"; readonly type: "address"; }]; readonly name: "PauserRemoved"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly name: "from"; readonly type: "address"; }, { readonly indexed: true; readonly name: "to"; readonly type: "address"; }, { readonly indexed: false; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "Transfer"; readonly type: "event"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly name: "owner"; readonly type: "address"; }, { readonly indexed: true; readonly name: "spender"; readonly type: "address"; }, { readonly indexed: false; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "Approval"; readonly type: "event"; }]; declare const ABI_CONTRACT_STAKING: readonly [{ readonly constant: true; readonly inputs: readonly []; readonly name: "currentEpoch"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }]; declare const ABI_CONTRACT_BUY: readonly [{ readonly inputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "constructor"; }, { readonly anonymous: false; readonly inputs: readonly [{ readonly indexed: true; readonly internalType: "address"; readonly name: "owner"; readonly type: "address"; }, { readonly indexed: true; readonly internalType: "address"; readonly name: "spender"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "Approval"; 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: "from"; readonly type: "address"; }, { readonly indexed: true; readonly internalType: "address"; readonly name: "to"; readonly type: "address"; }, { readonly indexed: false; readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "Transfer"; readonly type: "event"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "bool"; readonly name: "pol"; readonly type: "bool"; }]; readonly name: "_restake"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "claimAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "maximumSharesToBurn"; readonly type: "uint256"; }, { readonly internalType: "bool"; readonly name: "pol"; readonly type: "bool"; }]; readonly name: "_sellVoucher_new"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "activeAmount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "owner"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "spender"; readonly type: "address"; }]; readonly name: "allowance"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "spender"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "approve"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "owner"; readonly type: "address"; }]; readonly name: "balanceOf"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "_amount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "_minSharesToMint"; readonly type: "uint256"; }]; readonly name: "buyVoucher"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amountToDeposit"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "_amount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "_minSharesToMint"; readonly type: "uint256"; }]; readonly name: "buyVoucherPOL"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amountToDeposit"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "_amount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "_minSharesToMint"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "deadline"; readonly type: "uint256"; }, { readonly internalType: "uint8"; readonly name: "v"; readonly type: "uint8"; }, { readonly internalType: "bytes32"; readonly name: "r"; readonly type: "bytes32"; }, { readonly internalType: "bytes32"; readonly name: "s"; readonly type: "bytes32"; }]; readonly name: "buyVoucherWithPermit"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amountToDeposit"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "commissionRate_deprecated"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "spender"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "subtractedValue"; readonly type: "uint256"; }]; readonly name: "decreaseAllowance"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "delegation"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "token"; readonly type: "address"; }, { readonly internalType: "address payable"; readonly name: "destination"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly name: "drain"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "eventsHub"; readonly outputs: readonly [{ readonly internalType: "contract EventsHub"; readonly name: ""; readonly type: "address"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "exchangeRate"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "user"; readonly type: "address"; }]; readonly name: "getLiquidRewards"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "getRewardPerShare"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "user"; readonly type: "address"; }]; readonly name: "getTotalStake"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "spender"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "addedValue"; readonly type: "uint256"; }]; readonly name: "increaseAllowance"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly name: "initalRewardPerShare"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "_validatorId"; readonly type: "uint256"; }, { readonly internalType: "address"; readonly name: "_stakingLogger"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "_stakeManager"; readonly type: "address"; }]; readonly name: "initialize"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "isOwner"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "lastCommissionUpdate_deprecated"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "lock"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "locked"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "user"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly name: "migrateIn"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "user"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "amount"; readonly type: "uint256"; }]; readonly name: "migrateOut"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "minAmount"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "owner"; readonly outputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "polToken"; readonly outputs: readonly [{ readonly internalType: "contract IERC20Permit"; readonly name: ""; readonly type: "address"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "renounceOwnership"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "restake"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "restakePOL"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "rewardPerShare"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "claimAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "maximumSharesToBurn"; readonly type: "uint256"; }]; readonly name: "sellVoucher"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "claimAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "maximumSharesToBurn"; readonly type: "uint256"; }]; readonly name: "sellVoucherPOL"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "claimAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "maximumSharesToBurn"; readonly type: "uint256"; }]; readonly name: "sellVoucher_new"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "claimAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "maximumSharesToBurn"; readonly type: "uint256"; }]; readonly name: "sellVoucher_newPOL"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "validatorStake"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "delegatedAmount"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "totalAmountToSlash"; readonly type: "uint256"; }]; readonly name: "slash"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "stakeManager"; readonly outputs: readonly [{ readonly internalType: "contract IStakeManager"; readonly name: ""; readonly type: "address"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "stakingLogger"; readonly outputs: readonly [{ readonly internalType: "contract StakingInfo"; readonly name: ""; readonly type: "address"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "totalStake_deprecated"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "totalSupply"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "to"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "transfer"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "from"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "to"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "transferFrom"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "newOwner"; readonly type: "address"; }]; readonly name: "transferOwnership"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "to"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "value"; readonly type: "uint256"; }]; readonly name: "transferPOL"; readonly outputs: readonly [{ readonly internalType: "bool"; readonly name: ""; readonly type: "bool"; }]; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly name: "unbondNonces"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }]; readonly name: "unbonds"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "shares"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "withdrawEpoch"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly [{ readonly internalType: "address"; readonly name: ""; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly name: "unbonds_new"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "shares"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "withdrawEpoch"; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "unlock"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "unstakeClaimTokens"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "unstakeClaimTokensPOL"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "unbondNonce"; readonly type: "uint256"; }]; readonly name: "unstakeClaimTokens_new"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "uint256"; readonly name: "unbondNonce"; readonly type: "uint256"; }]; readonly name: "unstakeClaimTokens_newPOL"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly [{ readonly internalType: "bool"; readonly name: "_delegation"; readonly type: "bool"; }]; readonly name: "updateDelegation"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "validatorId"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "validatorRewards_deprecated"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "withdrawExchangeRate"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "withdrawPool"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "withdrawRewards"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: false; readonly inputs: readonly []; readonly name: "withdrawRewardsPOL"; readonly outputs: readonly []; readonly payable: false; readonly stateMutability: "nonpayable"; readonly type: "function"; }, { readonly constant: true; readonly inputs: readonly []; readonly name: "withdrawShares"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: ""; readonly type: "uint256"; }]; readonly payable: false; readonly stateMutability: "view"; readonly type: "function"; }]; type HexString = `0x${string}`; type TransactionRequest = { from: HexString; to: HexString; gasLimit: bigint; data: HexString; }; type UnbondInfo = { amount: BigNumber; withdrawEpoch: bigint; unbondNonces: bigint; }; /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ declare const MIN_AMOUNT: BigNumber; declare const WITHDRAW_EPOCH_DELAY = 80n; /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ declare function setApiUrl(url: string): void; declare const createToken: (name: string, type: string) => Promise<any>; /** * Copyright (c) 2025, Everstake. * Licensed under the BSD-3-Clause License. See LICENSE file for details. */ interface ContractProps<T extends Abi> { abi: T; address: HexString; } /** * The `Polygon` class extends the `Blockchain` class and provides methods for interacting with the Polygon network. * * It handles initialization of Web3 and multiple contract instances, including approval contracts, * buy contracts, and staking contracts. It also manages error messages related to contract operations. * * @property {Web3} web3 - The Web3 instance used for interacting with the Polygon network. * @property {Contract} contract_approve - The contract instance for token approval. * @property {Contract} contract_approve_pol - The contract instance for POL token approval. * @property {Contract} contract_buy - The contract instance for token purchase logic. * @property {Contract} contract_staking - The contract instance for staking logic. * @property ERROR_MESSAGES - The standardized error messages for the Polygon class. * @property ORIGINAL_ERROR_MESSAGES - The raw/original error messages for internal mapping or debugging. * * @constructor * Creates an instance of the `Polygon` class. * @param {string} [rpc=RPC_URL] - The RPC URL of the Polygon network. */ declare class Polygon extends Blockchain { contract_approve: ContractProps<typeof ABI_CONTRACT_APPROVE>; contract_approve_pol: ContractProps<typeof ABI_CONTRACT_APPROVE>; contract_buy: ContractProps<typeof ABI_CONTRACT_BUY>; contract_staking: ContractProps<typeof ABI_CONTRACT_STAKING>; private client; protected ERROR_MESSAGES: { TRANSACTION_LOADING_ERR: string; APPROVE_ERR: string; DELEGATE_ERR: string; GET_ALLOWANCE_ERR: string; UNDELEGATE_ERR: string; GET_TOTAL_DELEGATE_ERR: string; GET_UNBOND_ERR: string; GET_UNBOND_NONCE_ERR: string; GET_REWARD_ERR: string; ALLOWANCE_ERR: string; DELEGATED_BALANCE_ERR: string; }; protected ORIGINAL_ERROR_MESSAGES: {}; constructor(rpcOrTransport?: string | HttpTransport | FallbackTransport); /** * Checks if a transaction is still pending or has been confirmed. * * @param {HexString} hash - The transaction hash to check. * @returns {Promise<{ result: boolean }>} * * @throws {Error} Throws an error with code `'TRANSACTION_LOADING_ERR'` if an issue occurs while fetching the transaction status. * */ isTransactionLoading(hash: HexString): Promise<{ result: boolean; }>; /** approve returns TX loading status * @param {HexString} address - user's address * @param {string} amount - amount for approve * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object the result of boolean type */ approve(address: HexString, amount: string, isPOL?: boolean): Promise<TransactionRequest>; /** delegate makes unsigned delegation TX * @param {string} token - auth token * @param {HexString} address - user's address * @param {string} amount - amount for approve * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object represents the unsigned TX object */ delegate(token: string, address: HexString, amount: string, isPOL?: boolean): Promise<TransactionRequest>; /** undelegate makes unsigned undelegate TX * @param {string} token - auth token * @param {HexString} address - user's address * @param {string} amount - amount for approve * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object represents the unsigned TX object */ undelegate(token: string, address: HexString, amount: string, isPOL?: boolean): Promise<TransactionRequest>; /** claimUndelegate makes unsigned claim undelegate TX * @param {HexString} address - user's address * @param {bigint} unbondNonce - unbound nonce * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object represents the unsigned TX object */ claimUndelegate(address: HexString, unbondNonce?: bigint, isPOL?: boolean): Promise<TransactionRequest>; /** reward makes unsigned claim reward TX * @param {string} address - user's address * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object represents the unsigned TX object */ reward(address: HexString, isPOL?: boolean): Promise<TransactionRequest>; /** restake makes unsigned restake reward TX * @param {string} address - user's address * @param {boolean} isPOL - is POL token (false - old MATIC) * @returns {Promise<Object>} Promise object represents the unsigned TX object */ restake(address: HexString, isPOL?: boolean): Promise<TransactionRequest>; /** getReward returns reward number * @param {HexString} address - user's address * @returns {Promise<BigNumber>} Promise with number of the reward */ getReward(address: HexString): Promise<BigNumber>; /** getAllowance returns allowed number for spender * @param {string} owner - tokens owner * @param {boolean} isPOL - is POL token (false - old MATIC) * @param {string} spender - contract spender * @returns {Promise<bigint>} Promise allowed bigint for spender */ getAllowance(owner: HexString, isPOL?: boolean, spender?: HexString): Promise<bigint>; /** getTotalDelegate returns total delegated number * @param {string} address - user's address * @returns {Promise<BigNumber>} Promise with BigNumber of the delegation */ getTotalDelegate(address: HexString): Promise<BigNumber>; /** getUnbond returns unbound data * @param {HexString} address - user's address * @param {bigint} unbondNonce - unbound nonce * @returns {Promise<Object>} Promise Object with unbound data */ getUnbond(address: HexString, unbondNonce?: bigint): Promise<UnbondInfo>; /** getUnbondNonces returns unbound nonce * @param {HexString} address - user's address * @returns {Promise<bigint>} Promise with unbound nonce bigint */ getUnbondNonces(address: HexString): Promise<bigint>; /** getCurrentEpoch returns current epoch * @returns {Promise<bigint>} Promise with current epoch bigint */ getCurrentEpoch(): Promise<bigint>; private getTransaction; } export { MIN_AMOUNT as POLYGON_MIN_AMOUNT, WITHDRAW_EPOCH_DELAY as POLYGON_WITHDRAW_EPOCH_DELAY, Polygon, type TransactionRequest as PolygonTransactionRequest, createToken, setApiUrl };