@byzantine/vault-sdk
Version:
Byzantine Vault SDK for creating and managing vaults on Ethereum for restaking strategies
78 lines (77 loc) • 2.9 kB
TypeScript
import { ethers } from "ethers";
export declare enum RoleType {
DEFAULT_ADMIN_ROLE = "RoleManager",
VERSION_MANAGER = "VersionManager",
WHITELIST_MANAGER = "WhitelistManager",
LIMIT_MANAGER = "LimitManager",
CURATOR_FEE_CLAIMER = "CuratorFeeClaimer",
CURATOR_FEE_CLAIMER_ADMIN = "CuratorFeeClaimerAdmin",
VALIDATORS_MANAGER = "ValidatorsManager",
CURATOR = "Curator",
DELEGATION_MANAGER = "DelegationManager",
OPERATOR_NETWORK_SHARES_SET = "OperatorNetworkSharesSet",
OPERATOR_NETWORK_LIMIT_SET = "OperatorNetworkLimitSet",
NETWORK_LIMIT_SET = "NetworkLimitSet",
OWNER_BURNER = "OwnerBurner"
}
export declare class AccessControlClient {
private provider;
private signer?;
private contractProvider;
constructor(provider: ethers.Provider, signer?: ethers.Signer);
private getVaultContract;
/**
* Get delegator contract for a vault
* @param vaultAddress The address of the vault
* @returns The delegator contract instance
*/
private getDelegatorContract;
/**
* Get burner contract for a vault
* @param vaultAddress The address of the vault
* @returns The burner contract instance
*/
private getBurnerContract;
/**
* Check if an address has a specific role for a vault
* @param vaultAddress The address of the vault to check
* @param roleType The type of role to check (e.g., RoleType.CURATOR, RoleType.LIMIT_MANAGER)
* @param address The address to check for the role
* @returns True if the address has the specified role, false otherwise
* @example
* // Check if an address is a curator
* const isCurator = await client.isManager(
* "0x123...vault",
* RoleType.CURATOR,
* "0x456...address"
* );
*/
isManager(vaultAddress: string, roleType: RoleType, address: string): Promise<boolean>;
/**
* Set or revoke a role for an address
* @param vaultAddress The address of the vault to modify roles for
* @param roleType The type of role to set (e.g., RoleType.CURATOR, RoleType.LIMIT_MANAGER)
* @param address The address to grant or revoke the role for
* @param enable True to grant the role, false to revoke it
* @returns Transaction response from the blockchain
* @example
* // Grant curator role to an address
* const tx = await client.setManager(
* "0x123...vault",
* RoleType.CURATOR,
* "0x456...address",
* true
* );
* await tx.wait();
*
* // Revoke limit manager role from an address
* const tx = await client.setManager(
* "0x123...vault",
* RoleType.LIMIT_MANAGER,
* "0x456...address",
* false
* );
* await tx.wait();
*/
setManager(vaultAddress: string, roleType: RoleType, address: string, enable: boolean): Promise<ethers.TransactionResponse>;
}