UNPKG

@byzantine/vault-sdk

Version:

Byzantine Vault SDK for creating and managing vaults on Ethereum for restaking strategies

1,028 lines (1,027 loc) 43.6 kB
"use strict"; // @ts-check var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ByzantineClient = void 0; /** * ByzantineClient * * Client for interacting with the Byzantine contract * Provides methods to create different types of vaults: * - Eigenlayer ERC20 vaults * - Eigenlayer Native vaults * - Symbiotic ERC20 vaults * - SuperVault ERC20 vaults */ const ethers_1 = require("ethers"); const networks_1 = require("../constants/networks"); const abis_1 = require("../constants/abis"); const viem_1 = require("viem"); const viem_2 = require("viem"); const chains_1 = require("viem/chains"); // Import vault creator functions const curators_1 = require("./curators"); // Import specialized clients const staker_1 = require("./staker"); // Import curator functions const curatorFunctions = __importStar(require("./curators")); // Import shares vault functions const sharesVaultFunctions = __importStar(require("./curators/SharesVault")); class ByzantineClient { /** * Initialize a new ByzantineClient * @param options Client configuration options */ constructor(options) { this.chainId = options.chainId; // Get network configuration const networkConfig = (0, networks_1.getNetworkConfig)(this.chainId); if (!networkConfig) { throw new Error(`Unsupported chain ID: ${this.chainId}`); } this.contractAddress = networkConfig.byzantineFactoryAddress; // Set up provider and signer if (options.provider) { this.provider = options.provider; if (options.signer) { this.signer = options.signer; } } else { throw new Error("Provider is required"); } // Initialize contract instance this.contract = new ethers_1.ethers.Contract(this.contractAddress, abis_1.BYZANTINE_FACTORY_ABI, this.signer || this.provider); // Set up viem clients if not using ethers if (!this.provider && !this.signer) { //&& !this.config this.publicClient = (0, viem_1.createPublicClient)({ chain: chains_1.mainnet, transport: (0, viem_2.http)(), }); } // Initialize specialized clients this.depositClient = new staker_1.DepositClient(this.provider, this.signer); this.withdrawClient = new staker_1.WithdrawClient(this.provider, this.signer); this.eigenLayerClient = new staker_1.EigenLayerClient(this.provider, this.signer); this.symbioticClient = new staker_1.SymbioticClient(this.provider, this.signer); this.vaultTypeClient = new staker_1.VaultTypeClient(this.provider); this.accessControlClient = new curators_1.AccessControlClient(this.provider, this.signer); } // =========================== // Create Vaults Functions // =========================== /** * Create an Eigenlayer ERC20 vault * @param params The vault parameters * @param options Optional transaction options to override defaults * @returns Transaction response */ async createEigenlayerERC20Vault(params, options) { if (!this.signer) { throw new Error("Signer is required for this operation"); } return (0, curators_1.createEigenlayerERC20Vault)(this.contract, params, options); } /** * Create an Eigenlayer Native vault * @param params The vault parameters * @param options Optional transaction options to override defaults * @returns Transaction response */ async createEigenlayerNativeVault(params, options) { if (!this.signer) { throw new Error("Signer is required for this operation"); } return (0, curators_1.createEigenlayerNativeVault)(this.contract, params, options); } /** * Create a Symbiotic ERC20 vault * @param params The vault parameters * @param options Optional transaction options to override defaults * @returns Transaction response */ async createSymbioticERC20Vault(params, options) { if (!this.signer) { throw new Error("Signer is required for this operation"); } return (0, curators_1.createSymbioticERC20Vault)(this.contract, params, options); } /** * Create a SuperVault ERC20 vault * @param params The vault parameters * @param options Optional transaction options to override defaults * @returns Transaction response */ async createSuperVaultERC20(params, options) { if (!this.signer) { throw new Error("Signer is required for this operation"); } return (0, curators_1.createSuperVaultERC20)(this.contract, params, options); } /** * Set the token to Eigen strategy mapping * @param tokens The array of ERC20 token addresses * @param strategies The array of EigenLayer strategy addresses * @param options Optional transaction options * @returns Transaction response */ async setTokenToEigenStrategy(tokens, strategies, options) { if (!this.signer) { throw new Error("Signer is required for this operation"); } return (0, curators_1.setTokenToEigenStrategy)(this.contract, tokens, strategies, options); } /** * Get a vault contract instance * @param vaultAddress The address of the vault * @returns Vault contract instance */ getVaultContract(vaultAddress) { return new ethers_1.ethers.Contract(vaultAddress, abis_1.ERC20_VAULT_ABI, this.signer || this.provider); } // =========================== // Curator Functions // =========================== // Whitelist Management /** * Check if an address is whitelisted for a vault * @param vaultAddress The address of the vault * @param address The address to check * @returns True if the address is whitelisted */ async isAddressWhitelisted(vaultAddress, address) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.isAddressWhitelisted(vaultContract, address); } /** * Check if a vault is private * @param vaultAddress The address of the vault * @returns True if the vault is private */ async isVaultPrivate(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.isVaultPrivate(vaultContract); } /** * Set whitelist status for multiple addresses * @param vaultAddress The address of the vault * @param addresses The addresses to update * @param canDeposit Whether the addresses can deposit * @returns Transaction response */ async setAddressesWhitelistStatus(vaultAddress, addresses, canDeposit) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setAddressesWhitelistStatus(this.signer, vaultContract, addresses, canDeposit); } /** * Set the private status of a vault * @param vaultAddress The address of the vault * @param isPrivate Whether the vault should be private * @returns Transaction response */ async setVaultPrivateStatus(vaultAddress, isPrivate) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setVaultPrivateStatus(this.signer, vaultContract, isPrivate); } // Deposit Limit Management /** * Get the deposit limit of a vault * @param vaultAddress The address of the vault * @returns The deposit limit */ async getVaultDepositLimit(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.getVaultDepositLimit(vaultContract); } /** * Check if a vault has a deposit limit enabled * @param vaultAddress The address of the vault * @returns True if the vault has a deposit limit */ async isDepositLimitEnabled(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.isDepositLimitEnabled(vaultContract); } /** * Set the deposit limit for a vault * @param vaultAddress The address of the vault * @param limit The new deposit limit * @returns Transaction response */ async setVaultDepositLimit(vaultAddress, limit) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setVaultDepositLimit(this.signer, vaultContract, limit); } /** * Enable or disable deposit limits for a vault * @param vaultAddress The address of the vault * @param enabled Whether deposit limits should be enabled * @returns Transaction response */ async setDepositLimitStatus(vaultAddress, enabled) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setDepositLimitStatus(this.signer, vaultContract, enabled); } // =========================== // Metadata Management // =========================== /** * Get the metadata of a vault * @param vaultAddress The address of the vault * @returns The metadata object * * @example * // Get vault metadata * const metadata = await byzantineClient.getVaultMetadata("0x123..."); * console.log(metadata.name); // "My Vault" * console.log(metadata.description); // "This is a description of my vault" * console.log(metadata.image); // "https://example.com/image.png" */ async getVaultMetadata(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.getVaultMetadata(vaultContract); } /** * Update the metadata of a vault * @param vaultAddress The address of the vault * @param metadata The new metadata object, or URI * @returns Transaction response * * @example * // Update vault metadata * const metadata = { * name: "My Vault", * description: "An updated description of my vault", * image_url: "https://example.com/new-image.png", * social_twitter: "https://x.com/byzantine_fi", * social_discord: "https://discord.gg/byzantine", * social_telegram: "https://t.me/byzantine", * social_website: "https://byzantine.fi", * social_github: "https://github.com/Byzantine-Finance/", * }; * * * const tx = await byzantineClient.updateVaultMetadata("0x123...", metadata); * await tx.wait(); */ async updateVaultMetadata(vaultAddress, metadata) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setMetadata(vaultContract, metadata); } // Fee Management /** * Get the curator fee of a vault * @param vaultAddress The address of the vault * @returns The curator fee in basis points, e.g. 1.4% = 140 */ async getCuratorFee(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.getCuratorFee(vaultContract); } /** * Get the unclaimed fees of a vault * @param vaultAddress The address of the vault * @returns The unclaimed fees */ async getUnclaimedFees(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.getUnclaimedFees(vaultContract); } /** * Set the curator fee for a vault. Max is 10_000 (100%) * @param vaultAddress The address of the vault * @param newFee The new curator fee in basis points, e.g. 1.4% = 140 * @returns Transaction response */ async setCuratorFee(vaultAddress, newFee) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.setVaultFeePercentage(vaultContract, newFee); } /** * Claim the fees from a vault * @param vaultAddress The address of the vault * @returns Transaction response */ async claimVaultFees(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await curatorFunctions.claimVaultFees(vaultContract); } // SuperVault Management /** * Get the distribution ratio of a supervault * @param supervaultAddress The address of the supervault * @returns The distribution ratio */ async getDistributionRatio(supervaultAddress) { const supervaultContract = this.getVaultContract(supervaultAddress); return await curatorFunctions.getDistributionRatio(supervaultContract); } /** * Get the underlying vaults of a supervault * @param supervaultAddress The address of the supervault * @returns The underlying vault addresses */ async getUnderlyingVaults(supervaultAddress) { const supervaultContract = this.getVaultContract(supervaultAddress); return await curatorFunctions.getUnderlyingVaults(supervaultContract); } /** * Update the distribution ratio of a supervault * @param supervaultAddress The address of the supervault * @param ratio The new distribution ratio * @returns Transaction response */ async updateDistributionRatio(supervaultAddress, ratio) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const supervaultContract = this.getVaultContract(supervaultAddress); return await curatorFunctions.updateDistributionRatio(this.signer, supervaultContract, ratio); } /** * Force a rebalance of a supervault * @param supervaultAddress The address of the supervault * @returns Transaction response */ async forceRebalance(supervaultAddress) { if (!this.signer) { throw new Error("Signer is required for this operation"); } const supervaultContract = this.getVaultContract(supervaultAddress); return await curatorFunctions.forceRebalance(this.signer, supervaultContract); } // =========================== // Shares Functions // =========================== /** * Check if the vault's shares are tokenized * @param vaultAddress The address of the vault * @returns True if shares can be transferred like ERC20 tokens */ async isSharesTokenized(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.isTokenized(vaultContract); } /** * Get the name of the vault share token * @param vaultAddress The address of the vault * @returns The name of the share token */ async getSharesName(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.getSharesName(vaultContract); } /** * Get the symbol of the vault share token * @param vaultAddress The address of the vault * @returns The symbol of the share token */ async getSharesSymbol(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.getSharesSymbol(vaultContract); } /** * Get the total supply of vault shares * @param vaultAddress The address of the vault * @returns The total supply of shares */ async getTotalShares(vaultAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.getTotalShares(vaultContract); } /** * Get the balance of shares for a specific address * @param vaultAddress The address of the vault * @param userAddress The address to check balance for * @returns The balance of shares for the address */ async getSharesBalance(vaultAddress, userAddress) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.getSharesBalance(vaultContract, userAddress); } /** * Convert a given amount of assets to shares * @param vaultAddress The address of the vault * @param assets The amount of assets to convert * @returns The equivalent amount of shares */ async convertToShares(vaultAddress, assets) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.convertToShares(vaultContract, assets); } /** * Convert a given amount of shares to assets * @param vaultAddress The address of the vault * @param shares The amount of shares to convert * @returns The equivalent amount of assets */ async convertToAssets(vaultAddress, shares) { const vaultContract = this.getVaultContract(vaultAddress); return await sharesVaultFunctions.convertToAssets(vaultContract, shares); } // =========================== // Staker Functions // =========================== // Deposit Functions /** * Get the asset address of a vault * @param vaultAddress The address of the vault * @returns The asset address */ async getVaultAsset(vaultAddress) { return await this.depositClient.getVaultAsset(vaultAddress); } /** * Get the balance of assets in a user's wallet * @param assetAddress The address of the asset * @param userAddress The address of the user * @returns The user's wallet balance */ async getUserWalletBalance(assetAddress, userAddress) { return await this.depositClient.getUserWalletBalance(assetAddress, userAddress); } /** * Get the balance of a user in a vault * @param vaultAddress The address of the vault * @param userAddress The address of the user * @returns The user's vault balance */ async getUserVaultBalance(vaultAddress, userAddress) { return await this.depositClient.getUserVaultBalance(vaultAddress, userAddress); } /** * Get the total value locked in a vault * @param vaultAddress The address of the vault * @returns The total value locked */ async getVaultTVL(vaultAddress) { return await this.depositClient.getVaultTVL(vaultAddress); } /** * Get the allowance of a user for a vault * @param assetAddress The address of the asset * @param userAddress The address of the user * @param vaultAddress The address of the vault * @returns The user's allowance */ async getUserAllowance(assetAddress, userAddress, vaultAddress) { return await this.depositClient.getUserAllowance(assetAddress, userAddress, vaultAddress); } /** * Approve a vault to spend user's tokens * @param assetAddress The address of the asset * @param vaultAddress The address of the vault * @param amount The amount to approve * @returns Transaction response */ async approveVault(assetAddress, vaultAddress, amount) { return await this.depositClient.approveVault(assetAddress, vaultAddress, amount); } /** * Deposit assets into a vault * @param vaultAddress The address of the vault * @param amount The amount to deposit * @param autoApprove Whether to automatically approve if needed, false by default * @returns Transaction response */ async depositToVault(vaultAddress, amount, autoApprove = false) { return await this.depositClient.depositToVault(vaultAddress, amount, autoApprove); } // Withdraw Functions /** * Withdraw assets from a vault * @param vaultAddress The address of the vault * @param amount The amount of assets to withdraw * @returns Transaction response */ async withdrawFromVault(vaultAddress, amount) { return await this.withdrawClient.withdrawFromVault(vaultAddress, amount); } /** * Redeem shares from a vault * @param vaultAddress The address of the vault * @param shares The amount of shares to redeem * @returns Transaction response */ async redeemSharesFromVault(vaultAddress, shares) { return await this.withdrawClient.redeemSharesFromVault(vaultAddress, shares); } /** * Check if a withdrawal request is claimable * @param vaultAddress The address of the vault * @param requestId The ID of the withdrawal request * @returns True if the request is claimable */ async isClaimable(vaultAddress, requestId) { return await this.withdrawClient.isClaimable(vaultAddress, requestId); } /** * Complete a withdrawal request * @param vaultAddress The address of the vault * @param requestId The ID of the withdrawal request * @returns Transaction response */ async completeWithdrawal(vaultAddress, requestId) { return await this.withdrawClient.completeWithdrawal(vaultAddress, requestId); } /** * Get a withdrawal request * @param vaultAddress The address of the vault * @param requestId The ID of the withdrawal request * @returns Transaction response */ async getWithdrawalRequest(vaultAddress, requestId) { return await this.withdrawClient.getWithdrawalRequest(vaultAddress, requestId); } // =========================== // EigenLayer Functions // =========================== /** * Get the Eigen Operator of a vault * @param vaultAddress The address of the vault * @returns The Eigen Operator */ async getEigenOperator(vaultAddress) { return await this.eigenLayerClient.getEigenOperator(vaultAddress); } /** * Set the Eigen Operator of a vault * @param vaultAddress The address of the vault * @param operator The new Eigen Operator * @param approverSignatureAndExpiry The signature and expiry for the approver * @param approverSalt The salt for the approver * @param options Optional transaction parameters like gas limit, gas price, etc. * @returns Transaction response */ async setEigenOperator(vaultAddress, operator, approverSignatureAndExpiry, approverSalt, options) { return await this.eigenLayerClient.setEigenOperator(vaultAddress, operator, approverSignatureAndExpiry, approverSalt, options); } // =========================== // Symbiotic Functions // =========================== /** * Get the epoch at a specific timestamp for a Symbiotic vault * @param vaultAddress The address of the vault * @param timestamp The timestamp to check * @returns The epoch number */ async getEpochAt(vaultAddress, timestamp) { return await this.symbioticClient.getEpochAt(vaultAddress, timestamp); } /** * Get the epoch duration for a Symbiotic vault * @param vaultAddress The address of the vault * @returns The epoch duration */ async getEpochDuration(vaultAddress) { return await this.symbioticClient.getEpochDuration(vaultAddress); } /** * Get the current epoch for a Symbiotic vault * @param vaultAddress The address of the vault * @returns The current epoch number */ async getCurrentEpoch(vaultAddress) { return await this.symbioticClient.getCurrentEpoch(vaultAddress); } /** * Get the start timestamp of the current epoch for a Symbiotic vault * @param vaultAddress The address of the vault * @returns The start timestamp of the current epoch */ async getCurrentEpochStart(vaultAddress) { return await this.symbioticClient.getCurrentEpochStart(vaultAddress); } /** * Get the start timestamp of the previous epoch for a Symbiotic vault * @param vaultAddress The address of the vault * @returns The start timestamp of the previous epoch */ async getPreviousEpochStart(vaultAddress) { try { return await this.symbioticClient.getPreviousEpochStart(vaultAddress); } catch (error) { return 0; } } /** * Get the start timestamp of the next epoch for a Symbiotic vault * @param vaultAddress The address of the vault * @returns The start timestamp of the next epoch */ async getNextEpochStart(vaultAddress) { return await this.symbioticClient.getNextEpochStart(vaultAddress); } /** * Get the sym vault address of a Symbiotic vault * @param vaultAddress The address of the vault * @returns The sym vault address */ async getSymVaultAddress(vaultAddress) { return await this.symbioticClient.getSymVaultAddress(vaultAddress); } /** * Get the delegator address of a Symbiotic vault * @param vaultAddress The address of the vault * @returns The delegator address */ async getDelegatorAddress(vaultAddress) { return await this.symbioticClient.getDelegatorAddress(vaultAddress); } /** * Get the slasher address of a Symbiotic vault * @param vaultAddress The address of the vault * @returns The slasher address */ async getSlasherAddress(vaultAddress) { return await this.symbioticClient.getSlasherAddress(vaultAddress); } /** * Get the burner address of a Symbiotic vault * @param vaultAddress The address of the vault * @returns The burner address */ async getBurnerAddress(vaultAddress) { return await this.symbioticClient.getBurnerAddress(vaultAddress); } /** * Get the delegator operator for a vault * @param vaultAddress The address of the vault * @returns The delegator operator */ async getDelegatorOperator(vaultAddress) { return await this.symbioticClient.getDelegatorOperator(vaultAddress); } /** * Get the delegator network for a vault * @param vaultAddress The address of the vault * @returns The delegator network */ async getDelegatorNetwork(vaultAddress) { return await this.symbioticClient.getDelegatorNetwork(vaultAddress); } /** * Get the delegator type of a Symbiotic vault * @param vaultAddress The address of the vault * @returns The delegator type */ async getDelegatorType(vaultAddress) { return await this.symbioticClient.getDelegatorType(vaultAddress); } // =========================== // Vault Type Functions // =========================== /** * Check if a vault is a Symbiotic vault * @param vaultAddress The address of the vault to check * @returns True if the vault is a Symbiotic vault, false otherwise */ async isSymbioticVault(vaultAddress) { return await this.vaultTypeClient.isSymbioticVault(vaultAddress); } /** * Check if a vault is an EigenLayer vault * @param vaultAddress The address of the vault to check * @returns True if the vault is an EigenLayer vault, false otherwise */ async isEigenVault(vaultAddress) { return await this.vaultTypeClient.isEigenVault(vaultAddress); } /** * Check if a vault is a SuperVault * @param vaultAddress The address of the vault to check * @returns True if the vault is a SuperVault, false otherwise */ async isSupervault(vaultAddress) { return await this.vaultTypeClient.isSupervault(vaultAddress); } /** * Get the type of vault * @param vaultAddress The address of the vault to check * @returns The type of the vault (Symbiotic, EigenLayer, Supervault), or undefined if unknown */ async getVaultType(vaultAddress) { return await this.vaultTypeClient.getVaultType(vaultAddress); } // =========================== // Access Control Functions // =========================== /** * Check if a user has a specific role * @param vaultAddress The address of the vault * @param roleType The role type * @param address The address of the user to check * @returns True if the user has the role, false otherwise */ async isManager(vaultAddress, roleType, address) { return await this.accessControlClient.isManager(vaultAddress, roleType, address); } /** * Set a manager for a vault * @param vaultAddress The address of the vault * @param roleType The role type * @param address The address of the user to set the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response */ async setManager(vaultAddress, roleType, address, enable) { return await this.accessControlClient.setManager(vaultAddress, roleType, address, enable); } /** * Check if a user has the default admin role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the default admin role */ async isRoleManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.DEFAULT_ADMIN_ROLE, userAddress); } /** * Grant or revoke the role manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setRoleManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.DEFAULT_ADMIN_ROLE, userAddress, enable); } /** * Check if a user has the validators manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the validators manager role */ async isValidatorsManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.VALIDATORS_MANAGER, userAddress); } /** * Grant or revoke the validators manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setValidatorsManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.VALIDATORS_MANAGER, userAddress, enable); } /** * Check if a user has the version manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the version manager role */ async isVersionManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.VERSION_MANAGER, userAddress); } /** * Grant or revoke the version manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setVersionManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.VERSION_MANAGER, userAddress, enable); } /** * Check if a user has the whitelist manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the whitelist manager role */ async isWhitelistManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.WHITELIST_MANAGER, userAddress); } /** * Grant or revoke the whitelist manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setWhitelistManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.WHITELIST_MANAGER, userAddress, enable); } /** * Check if a user has the limit manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the limit manager role */ async isLimitManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.LIMIT_MANAGER, userAddress); } /** * Grant or revoke the limit manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setLimitManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.LIMIT_MANAGER, userAddress, enable); } /** * Check if a user has the delegation manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the delegation manager role */ async isDelegationManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.DELEGATION_MANAGER, userAddress); } /** * Grant or revoke the delegation manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setDelegationManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.DELEGATION_MANAGER, userAddress, enable); } /** * Check if a user has the operator network shares manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the operator network shares manager role */ async isOperatorNetworkSharesManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.OPERATOR_NETWORK_SHARES_SET, userAddress); } /** * Grant or revoke the operator network shares manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setOperatorNetworkSharesManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.OPERATOR_NETWORK_SHARES_SET, userAddress, enable); } /** * Check if a user has the operator network limit manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the operator network limit manager role */ async isOperatorNetworkLimitManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.OPERATOR_NETWORK_LIMIT_SET, userAddress); } /** * Grant or revoke the operator network limit manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setOperatorNetworkLimitManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.OPERATOR_NETWORK_LIMIT_SET, userAddress, enable); } /** * Check if a user has the network limit manager role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the network limit manager role */ async isNetworkLimitManager(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.NETWORK_LIMIT_SET, userAddress); } /** * Grant or revoke the network limit manager role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setNetworkLimitManager(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.NETWORK_LIMIT_SET, userAddress, enable); } /** * Check if a user has the curator role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the curator role */ async isCurator(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.CURATOR, userAddress); } /** * Grant or revoke the curator role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setCurator(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.CURATOR, userAddress, enable); } /** * Check if a user has the curator fee claimer role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the curator fee claimer role */ async isCuratorFeeClaimer(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.CURATOR_FEE_CLAIMER, userAddress); } /** * Grant or revoke the curator fee claimer role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setCuratorFeeClaimer(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.CURATOR_FEE_CLAIMER, userAddress, enable); } /** * Check if a user has the curator fee claimer admin role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the curator fee claimer admin role */ async isCuratorFeeClaimerAdmin(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.CURATOR_FEE_CLAIMER_ADMIN, userAddress); } /** * Grant or revoke the curator fee claimer admin role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setCuratorFeeClaimerAdmin(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.CURATOR_FEE_CLAIMER_ADMIN, userAddress, enable); } /** * Check if a user has the owner burner role * @param vaultAddress The address of the vault to check * @param userAddress The address of the user to check * @returns True if the user has the owner burner role */ async isOwnerBurner(vaultAddress, userAddress) { return await this.accessControlClient.isManager(vaultAddress, curators_1.RoleType.OWNER_BURNER, userAddress); } /** * Grant or revoke the owner burner role for a user * @param vaultAddress The address of the vault to modify * @param userAddress The address of the user to grant/revoke the role for * @param enable True to grant the role, false to revoke it * @returns Transaction response from the blockchain */ async setOwnerBurner(vaultAddress, userAddress, enable) { return await this.accessControlClient.setManager(vaultAddress, curators_1.RoleType.OWNER_BURNER, userAddress, enable); } } exports.ByzantineClient = ByzantineClient;