@temple-wallet/everstake-wallet-sdk
Version:
Everstake Wallet SDK for Javascript
2,772 lines (2,766 loc) • 189 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Berrachain: () => Berrachain,
Blockchain: () => Blockchain,
ETH_GAS_RESERVE: () => ETH_GAS_RESERVE,
ETH_MIN_AMOUNT: () => ETH_MIN_AMOUNT,
ETH_NETWORK_ADDRESSES: () => ETH_NETWORK_ADDRESSES,
Ethereum: () => Ethereum,
MULTICALL_CONTRACT_ADDRESS: () => MULTICALL_CONTRACT_ADDRESS,
POLYGON_MIN_AMOUNT: () => MIN_AMOUNT,
POLYGON_WITHDRAW_EPOCH_DELAY: () => WITHDRAW_EPOCH_DELAY,
Polygon: () => Polygon,
UINT16_MAX: () => UINT16_MAX,
ValidatorStatus: () => ValidatorStatus,
WalletSDKError: () => WalletSDKError,
checkToken: () => checkToken,
createToken: () => createToken,
getAssets: () => getAssets,
getEthValidatorsQueueStats: () => getEthValidatorsQueueStats,
setApiUrl: () => setApiUrl,
setStats: () => setStats
});
module.exports = __toCommonJS(index_exports);
// berrachain/src/index.ts
var import_bignumber = __toESM(require("bignumber.js"));
var import_viem = require("viem");
var import_utils = require("viem/utils");
// utils/constants/errors.ts
var COMMON_ERROR_MESSAGES = {
UNKNOWN_ERROR: "An unknown error occurred",
TOKEN_ERROR: "Please create or use correct token"
};
// utils/index.ts
var WalletSDKError = class extends Error {
constructor(message, code, originalError) {
super(message);
this.code = code;
this.originalError = originalError;
Object.setPrototypeOf(this, new.target.prototype);
}
};
var Blockchain = class {
/**
* 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, originalError) {
const message = this.ERROR_MESSAGES[code];
if (originalError instanceof WalletSDKError || !message || !code) {
throw originalError;
}
if (originalError instanceof Error) {
const newMessage = Object.entries(this.ORIGINAL_ERROR_MESSAGES).find(
([originalMessage]) => originalError.message.includes(originalMessage)
)?.[1];
const errorMessage = newMessage || this.ERROR_MESSAGES[code] || COMMON_ERROR_MESSAGES["UNKNOWN_ERROR"];
throw new WalletSDKError(errorMessage, String(code), originalError);
}
throw new WalletSDKError(
COMMON_ERROR_MESSAGES["UNKNOWN_ERROR"],
"UNKNOWN_ERROR"
);
}
/**
* 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, ...values) {
let message = this.ERROR_MESSAGES[code];
values.forEach((value, index) => {
message = message?.replace(`{${index}}`, value);
});
if (!message) {
throw new WalletSDKError(
COMMON_ERROR_MESSAGES["UNKNOWN_ERROR"],
"UNKNOWN_ERROR"
);
}
throw new WalletSDKError(message, String(code));
}
/**
* Check if the URL is valid
*
* @param {string} url - URL
* @returns a bool type result.
*
*/
isValidURL(url) {
let urlClass;
try {
urlClass = new URL(url);
} catch (_) {
return false;
}
return urlClass.protocol === "http:" || urlClass.protocol === "https:";
}
};
// berrachain/src/bgt_mainnet.ts
var MAINNET_ABI = [
{
inputs: [],
name: "AmountLessThanMinIncentiveRate",
type: "error"
},
{
inputs: [],
name: "CannotRecoverIncentiveToken",
type: "error"
},
{
inputs: [],
name: "CannotRecoverRewardToken",
type: "error"
},
{
inputs: [],
name: "CannotRecoverStakingToken",
type: "error"
},
{
inputs: [],
name: "CheckpointUnorderedInsertion",
type: "error"
},
{
inputs: [],
name: "DepositNotMultipleOfGwei",
type: "error"
},
{
inputs: [],
name: "DepositValueTooHigh",
type: "error"
},
{
inputs: [],
name: "DonateAmountLessThanPayoutAmount",
type: "error"
},
{
inputs: [],
name: "ECDSAInvalidSignature",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "length",
type: "uint256"
}
],
name: "ECDSAInvalidSignatureLength",
type: "error"
},
{
inputs: [
{
internalType: "bytes32",
name: "s",
type: "bytes32"
}
],
name: "ECDSAInvalidSignatureS",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "increasedSupply",
type: "uint256"
},
{
internalType: "uint256",
name: "cap",
type: "uint256"
}
],
name: "ERC20ExceededSafeSupply",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "allowance",
type: "uint256"
},
{
internalType: "uint256",
name: "needed",
type: "uint256"
}
],
name: "ERC20InsufficientAllowance",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
},
{
internalType: "uint256",
name: "balance",
type: "uint256"
},
{
internalType: "uint256",
name: "needed",
type: "uint256"
}
],
name: "ERC20InsufficientBalance",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "approver",
type: "address"
}
],
name: "ERC20InvalidApprover",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "receiver",
type: "address"
}
],
name: "ERC20InvalidReceiver",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
}
],
name: "ERC20InvalidSender",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
}
],
name: "ERC20InvalidSpender",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "timepoint",
type: "uint256"
},
{
internalType: "uint48",
name: "clock",
type: "uint48"
}
],
name: "ERC5805FutureLookup",
type: "error"
},
{
inputs: [],
name: "ERC6372InconsistentClock",
type: "error"
},
{
inputs: [],
name: "IncentiveRateTooHigh",
type: "error"
},
{
inputs: [],
name: "IndexOutOfRange",
type: "error"
},
{
inputs: [],
name: "InsolventReward",
type: "error"
},
{
inputs: [],
name: "InsufficientDelegateStake",
type: "error"
},
{
inputs: [],
name: "InsufficientDeposit",
type: "error"
},
{
inputs: [],
name: "InsufficientSelfStake",
type: "error"
},
{
inputs: [],
name: "InsufficientStake",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "uint256",
name: "currentNonce",
type: "uint256"
}
],
name: "InvalidAccountNonce",
type: "error"
},
{
inputs: [],
name: "InvalidActivateBoostDelay",
type: "error"
},
{
inputs: [],
name: "InvalidBaseRate",
type: "error"
},
{
inputs: [],
name: "InvalidBoostMultiplier",
type: "error"
},
{
inputs: [],
name: "InvalidCredentialsLength",
type: "error"
},
{
inputs: [],
name: "InvalidDropBoostDelay",
type: "error"
},
{
inputs: [],
name: "InvalidInitialization",
type: "error"
},
{
inputs: [],
name: "InvalidMaxIncentiveTokensCount",
type: "error"
},
{
inputs: [],
name: "InvalidMinBoostedRewardRate",
type: "error"
},
{
inputs: [],
name: "InvalidProof",
type: "error"
},
{
inputs: [],
name: "InvalidPubKeyLength",
type: "error"
},
{
inputs: [],
name: "InvalidRewardAllocationWeights",
type: "error"
},
{
inputs: [],
name: "InvalidRewardConvexity",
type: "error"
},
{
inputs: [],
name: "InvalidRewardRate",
type: "error"
},
{
inputs: [],
name: "InvalidSignatureLength",
type: "error"
},
{
inputs: [],
name: "InvalidStartBlock",
type: "error"
},
{
inputs: [],
name: "InvalidateDefaultRewardAllocation",
type: "error"
},
{
inputs: [],
name: "InvariantCheckFailed",
type: "error"
},
{
inputs: [],
name: "MaxNumWeightsPerRewardAllocationIsZero",
type: "error"
},
{
inputs: [],
name: "MinIncentiveRateIsZero",
type: "error"
},
{
inputs: [],
name: "NotAContract",
type: "error"
},
{
inputs: [],
name: "NotApprovedSender",
type: "error"
},
{
inputs: [],
name: "NotBGT",
type: "error"
},
{
inputs: [],
name: "NotBlockRewardController",
type: "error"
},
{
inputs: [],
name: "NotDelegate",
type: "error"
},
{
inputs: [],
name: "NotDistributor",
type: "error"
},
{
inputs: [],
name: "NotEnoughBalance",
type: "error"
},
{
inputs: [],
name: "NotEnoughBoostedBalance",
type: "error"
},
{
inputs: [],
name: "NotEnoughTime",
type: "error"
},
{
inputs: [],
name: "NotFactoryVault",
type: "error"
},
{
inputs: [],
name: "NotFeeCollector",
type: "error"
},
{
inputs: [],
name: "NotIncentiveManager",
type: "error"
},
{
inputs: [],
name: "NotInitializing",
type: "error"
},
{
inputs: [],
name: "NotNewOperator",
type: "error"
},
{
inputs: [],
name: "NotOperator",
type: "error"
},
{
inputs: [],
name: "NotWhitelistedVault",
type: "error"
},
{
inputs: [],
name: "OperatorAlreadySet",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
inputs: [],
name: "PayoutAmountIsZero",
type: "error"
},
{
inputs: [],
name: "RewardAllocationAlreadyQueued",
type: "error"
},
{
inputs: [],
name: "RewardAllocationBlockDelayTooLarge",
type: "error"
},
{
inputs: [],
name: "RewardCycleNotEnded",
type: "error"
},
{
inputs: [],
name: "RewardsDurationIsZero",
type: "error"
},
{
inputs: [
{
internalType: "uint8",
name: "bits",
type: "uint8"
},
{
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "SafeCastOverflowedUintDowncast",
type: "error"
},
{
inputs: [],
name: "StakeAmountIsZero",
type: "error"
},
{
inputs: [],
name: "TimestampAlreadyProcessed",
type: "error"
},
{
inputs: [],
name: "TokenAlreadyWhitelistedOrLimitReached",
type: "error"
},
{
inputs: [],
name: "TokenNotWhitelisted",
type: "error"
},
{
inputs: [],
name: "TooManyWeights",
type: "error"
},
{
inputs: [],
name: "TotalSupplyOverflow",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "expiry",
type: "uint256"
}
],
name: "VotesExpiredSignature",
type: "error"
},
{
inputs: [],
name: "WithdrawAmountIsZero",
type: "error"
},
{
inputs: [],
name: "ZeroAddress",
type: "error"
},
{
inputs: [],
name: "ZeroOperatorOnFirstDeposit",
type: "error"
},
{
inputs: [],
name: "ZeroPercentageWeight",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "ActivateBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint32",
name: "newDelay",
type: "uint32"
}
],
name: "ActivateBoostDelayChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "owner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "spender",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "Approval",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "newTermsAndConditions",
type: "string"
}
],
name: "BgtTermsAndConditionsChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "CancelBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "CancelDropBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "delegator",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "fromDelegate",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "toDelegate",
type: "address"
}
],
name: "DelegateChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "delegate",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "previousVotes",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newVotes",
type: "uint256"
}
],
name: "DelegateVotesChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "DropBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint32",
name: "newDelay",
type: "uint32"
}
],
name: "DropBoostDelayChanged",
type: "event"
},
{
anonymous: false,
inputs: [],
name: "EIP712DomainChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "caller",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "ExceedingReservesBurnt",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint64",
name: "version",
type: "uint64"
}
],
name: "Initialized",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previous",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "current",
type: "address"
}
],
name: "MinterChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "QueueBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "user",
type: "address"
},
{
indexed: true,
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
indexed: false,
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "QueueDropBoost",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "receiver",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "Redeem",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
},
{
indexed: false,
internalType: "bool",
name: "approved",
type: "bool"
}
],
name: "SenderWhitelisted",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previous",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "current",
type: "address"
}
],
name: "StakerChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "to",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "Transfer",
type: "event"
},
{
inputs: [],
name: "CLOCK_MODE",
outputs: [
{
internalType: "string",
name: "",
type: "string"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "user",
type: "address"
},
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "activateBoost",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "activateBoostDelay",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
},
{
internalType: "address",
name: "spender",
type: "address"
}
],
name: "allowance",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "approve",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "balanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "bgtTermsAndConditions",
outputs: [
{
internalType: "string",
name: "",
type: "string"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "boosted",
outputs: [
{
internalType: "uint128",
name: "",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "boostedQueue",
outputs: [
{
internalType: "uint32",
name: "blockNumberLast",
type: "uint32"
},
{
internalType: "uint128",
name: "balance",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "boostees",
outputs: [
{
internalType: "uint128",
name: "",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "boosts",
outputs: [
{
internalType: "uint128",
name: "",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "burnExceedingReserves",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "cancelBoost",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "cancelDropBoost",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "uint32",
name: "pos",
type: "uint32"
}
],
name: "checkpoints",
outputs: [
{
components: [
{
internalType: "uint48",
name: "_key",
type: "uint48"
},
{
internalType: "uint208",
name: "_value",
type: "uint208"
}
],
internalType: "struct Checkpoints.Checkpoint208",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "clock",
outputs: [
{
internalType: "uint48",
name: "",
type: "uint48"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "decimals",
outputs: [
{
internalType: "uint8",
name: "",
type: "uint8"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "delegatee",
type: "address"
}
],
name: "delegate",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "delegatee",
type: "address"
},
{
internalType: "uint256",
name: "nonce",
type: "uint256"
},
{
internalType: "uint256",
name: "expiry",
type: "uint256"
},
{
internalType: "uint8",
name: "v",
type: "uint8"
},
{
internalType: "bytes32",
name: "r",
type: "bytes32"
},
{
internalType: "bytes32",
name: "s",
type: "bytes32"
}
],
name: "delegateBySig",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "delegates",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "user",
type: "address"
},
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "dropBoost",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "dropBoostDelay",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "dropBoostQueue",
outputs: [
{
internalType: "uint32",
name: "blockNumberLast",
type: "uint32"
},
{
internalType: "uint128",
name: "balance",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "eip712Domain",
outputs: [
{
internalType: "bytes1",
name: "fields",
type: "bytes1"
},
{
internalType: "string",
name: "name",
type: "string"
},
{
internalType: "string",
name: "version",
type: "string"
},
{
internalType: "uint256",
name: "chainId",
type: "uint256"
},
{
internalType: "address",
name: "verifyingContract",
type: "address"
},
{
internalType: "bytes32",
name: "salt",
type: "bytes32"
},
{
internalType: "uint256[]",
name: "extensions",
type: "uint256[]"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "timepoint",
type: "uint256"
}
],
name: "getPastTotalSupply",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "uint256",
name: "timepoint",
type: "uint256"
}
],
name: "getPastVotes",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "getVotes",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_owner",
type: "address"
}
],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
}
],
name: "isWhitelistedSender",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "distributor",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "mint",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "minter",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes[]",
name: "data",
type: "bytes[]"
}
],
name: "multicall",
outputs: [
{
internalType: "bytes[]",
name: "",
type: "bytes[]"
}
],
stateMutability: "payable",
type: "function"
},
{
inputs: [],
name: "name",
outputs: [
{
internalType: "string",
name: "",
type: "string"
}
],
stateMutability: "pure",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "nonces",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
}
],
name: "normalizedBoost",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "numCheckpoints",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "queueBoost",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pubkey",
type: "bytes"
},
{
internalType: "uint128",
name: "amount",
type: "uint128"
}
],
name: "queueDropBoost",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "queuedBoost",
outputs: [
{
internalType: "uint128",
name: "",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "receiver",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "redeem",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint32",
name: "_activateBoostDelay",
type: "uint32"
}
],
name: "setActivateBoostDelay",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "string",
name: "_bgtTermsAndConditions",
type: "string"
}
],
name: "setBgtTermsAndConditions",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint32",
name: "_dropBoostDelay",
type: "uint32"
}
],
name: "setDropBoostDelay",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_minter",
type: "address"
}
],
name: "setMinter",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_staker",
type: "address"
}
],
name: "setStaker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "staker",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "symbol",
outputs: [
{
internalType: "string",
name: "",
type: "string"
}
],
stateMutability: "pure",
type: "function"
},
{
inputs: [],
name: "totalBoosts",
outputs: [
{
internalType: "uint128",
name: "",
type: "uint128"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "totalSupply",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "to",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "transfer",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "from",
type: "address"
},
{
internalType: "address",
name: "to",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "transferFrom",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "unboostedBalanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
},
{
internalType: "bool",
name: "approved",
type: "bool"
}
],
name: "whitelistSender",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}
];
// berrachain/src/bgt_testnet.ts
var TESTNET_ABI = [
{
inputs: [],
name: "CannotRecoverIncentiveToken",
type: "error"
},
{
inputs: [],
name: "AmountLessThanMinIncentiveRate",
type: "error"
},
{
inputs: [],
name: "CommissionChangeAlreadyQueued",
type: "error"
},
{
inputs: [],
name: "CommissionChangeDelayMoreThanMax",
type: "error"
},
{
inputs: [],
name: "CannotRecoverRewardToken",
type: "error"
},
{
inputs: [],
name: "CannotRecoverStakingToken",
type: "error"
},
{
inputs: [],
name: "CheckpointUnorderedInsertion",
type: "error"
},
{
inputs: [],
name: "CommissionChangeDelayNotPassed",
type: "error"
},
{
inputs: [],
name: "DepositNotMultipleOfGwei",
type: "error"
},
{
inputs: [],
name: "DepositValueTooHigh",
type: "error"
},
{
inputs: [],
name: "DonateAmountLessThanPayoutAmount",
type: "error"
},
{
inputs: [],
name: "ECDSAInvalidSignature",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "length",
type: "uint256"
}
],
name: "ECDSAInvalidSignatureLength",
type: "error"
},
{
inputs: [
{
internalType: "bytes32",
name: "s",
type: "bytes32"
}
],
name: "ECDSAInvalidSignatureS",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "increasedSupply",
type: "uint256"
},
{
internalType: "uint256",
name: "cap",
type: "uint256"
}
],
name: "ERC20ExceededSafeSupply",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "allowance",
type: "uint256"
},
{
internalType: "uint256",
name: "needed",
type: "uint256"
}
],
name: "ERC20InsufficientAllowance",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
},
{
internalType: "uint256",
name: "balance",
type: "uint256"
},
{
internalType: "uint256",
name: "needed",
type: "uint256"
}
],
name: "ERC20InsufficientBalance",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "approver",
type: "address"
}
],
name: "ERC20InvalidApprover",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "receiver",
type: "address"
}
],
name: "ERC20InvalidReceiver",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "sender",
type: "address"
}
],
name: "ERC20InvalidSender",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
}
],
name: "ERC20InvalidSpender",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "timepoint",
type: "uint256"
},
{
internalType: "uint48",
name: "clock",
type: "uint48"
}
],
name: "ERC5805FutureLookup",
type: "error"
},
{
inputs: [],
name: "ERC6372InconsistentClock",
type: "error"
},
{
inputs: [],
name: "IncentiveRateTooHigh",
type: "error"
},
{
inputs: [],
name: "IndexOutOfRange",
type: "error"
},
{
inputs: [],
name: "InsolventReward",
type: "error"
},
{
inputs: [],
name: "InsufficientDelegateStake",
type: "error"
},
{
inputs: [],
name: "InsufficientDeposit",
type: "error"
},
{
inputs: [],
name: "InsufficientIncentiveTokens",
type: "error"
},
{
inputs: [],
name: "InsufficientSelfStake",
type: "error"
},
{
inputs: [],
name: "InsufficientStake",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
},
{
internalType: "uint256",
name: "currentNonce",
type: "uint256"
}
],
name: "InvalidAccountNonce",
type: "error"
},
{
inputs: [],
name: "InvalidActivateBoostDelay",
type: "error"
},
{
inputs: [],
name: "InvalidArray",
type: "error"
},
{
inputs: [],
name: "InvalidBaseRate",
type: "error"
},
{
inputs: [],
name: "InvalidBoostMultiplier",
type: "error"
},
{
inputs: [],
name: "InvalidCommissionValue",
type: "error"
},
{
inputs: [],
name: "InvalidCredentialsLength",
type: "error"
},
{
inputs: [],
name: "InvalidDistribution",
type: "error"
},
{
inputs: [],
name: "InvalidDropBoostDelay",
type: "error"
},
{
inputs: [],
name: "InvalidInitialization",
type: "error"
},
{
inputs: [],
name: "InvalidMaxIncentiveTokensCount",
type: "error"
},
{
inputs: [],
name: "InvalidMerkleRoot",
type: "error"
},
{
inputs: [],
name: "InvalidMinBoostedRewardRate",
type: "error"
},
{
inputs: [],
name: "InvalidProof",
type: "error"
},
{
inputs: [],
name: "InvalidPubKeyLength",
type: "error"
},
{
inputs: [],
name: "InvalidRewardAllocationWeights",
type: "error"
},
{
inputs: [],
name: "InvalidRewardClaimDelay",
type: "error"
},
{
inputs: [],
name: "InvalidRewardConvexity",
type: "error"
},
{
inputs: [],
name: "InvalidRewardRate",
type: "error"
},
{
inputs: [],
name: "InvalidSignatureLength",
type: "error"
},
{
inputs: [],
name: "InvalidStartBlock",
type: "error"
},
{
inputs: [],
name: "InvalidateDefaultRewardAllocation",
type: "error"
},
{
inputs: [],
name: "InvariantCheckFailed",
type: "error"
},
{
inputs: [],
name: "MaxNumWeightsPerRewardAllocationIsZero",
type: "error"
},
{
inputs: [],
name: "MinIncentiveRateIsZero",
type: "error"
},
{
inputs: [],
name: "NotAContract",
type: "error"
},
{
inputs: [],
name: "NotApprovedSender",
type: "error"
},
{
inputs: [],
name: "NotBGT",
type: "error"
},
{
inputs: [],
name: "NotBlockRewardController",
type: "error"
},
{
inputs: [],
name: "NotDelegate",
type: "error"
},
{
inputs: [],
name: "NotDistributor",
type: "error"
},
{
inputs: [],
name: "NotEnoughBalance",
type: "error"
},
{
inputs: [],
name: "NotEnoughBoostedBalance",
type: "error"
},
{
inputs: [],
name: "NotEnoughTime",
type: "error"
},
{
inputs: [],
name: "NotFeeCollector",
type: "error"
},
{
inputs: [],
name: "NotFactoryVault",
type: "error"
},
{
inputs: [],
name: "NotIncentiveManager",
type: "error"
},
{
inputs: [],
name: "NotInitializing",
type: "error"
},
{
inputs: [],
name: "NotOperator",
type: "error"
},
{
inputs: [],
name: "NotNewOperator",
type: "error"
},
{
inputs: [],
name: "NotWhitelistedVault",
type: "error"
},
{
inputs: [],
name: "OperatorAlreadySet",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
inputs: [],
name: "PayoutAmountIsZero",
type: "error"
},
{
inputs: [],
name: "RewardAllocationAlreadyQueued",
type: "error"
},
{
inputs: [],
name: "RewardAllocationBlockDelayTooLarge",
type: "error"
},
{
inputs: [],
name: "RewardInactive",
type: "error"
},
{
inputs: [],
name: "RewardCycleNotEnded",
type: "error"
},
{
inputs: [],
name: "RewardsDurationIsZero",
type: "error"
},
{
inputs: [
{
internalType: "uint8",
name: "bits",
type: "uint8"
},
{
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "SafeCastOverflowedUintDowncast",
type: "error"
},
{
inputs: [],
name: "StakeAmountIsZero",
type: "error"
},
{
inputs: [],
name: "TimestampAlreadyProcessed",
type: "error"
},
{
inputs: [],
name: "TokenAlreadyWhitelistedOrLimitReached",
type: "error"
},
{
inputs: [],
name: "TokenNotWhitelisted",
type: "error"
},
{
inputs: [],
name: "TooManyWeights",
type: "error"
},
{
inputs: [],
name: "TotalSupplyOverflow",
type: "error"
},
{
inputs: [],
name: "ZeroPercentageWeight",
type: "error"
},
{
inputs: [],
name: "ZeroOperatorOnFirstDeposit",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "expiry",
type: "uint256"
}
],
name: "VotesExpiredSignature",
type: "error"
},
{
inputs: [],
name: "WithdrawAmountIsZero",
type: "error"
},
{
inputs: [],
name: "ZeroAddress",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
},
{
indexed: true,
internalType: