UNPKG

@byzantine/operator-sdk

Version:

SDK for integrating operators with Byzantine Finance ecosystem

188 lines (187 loc) 7.25 kB
/** * ByzOperatorClient * * @description Client for interacting with Byzantine Operator services. * This client provides a unified interface for operators to register, * opt-in to networks, and opt-in to vaults. * * The typical integration flow for operators is: * 1. Register as an operator in the Symbiotic ecosystem * 2. Opt into specific networks they want to validate * 3. Opt into vaults they want to receive stake from * 4. Stake allocation (handled by vault administrators) * 5. Network activation (handled by network validators) */ import { TransactionResponse } from "ethers"; import { ByzantineClientOptions, ChainsOptions } from "../types"; export declare class ByzOperatorClient { readonly chainId: ChainsOptions; private provider; private signer?; private symOperatorRegistry; private symNetworkOptInService; private symVaultOptInService; private nativeOperatorRegistry; constructor(options: ByzantineClientOptions); /** * Register as an operator in the Symbiotic ecosystem * This is the first step in the operator integration process * * @returns Transaction response */ registerOperator(): Promise<TransactionResponse>; /** * Check if an address is registered as an operator * * @param operatorAddress - The address to check * @returns Boolean indicating if the address is registered as an operator */ isOperator(operatorAddress: string): Promise<boolean>; /** * Get the total number of registered operators * * @returns The total number of operators */ getTotalOperators(): Promise<number>; /** * Get the operator address at a specific index * * @param index - The index of the operator to retrieve * @returns The operator address */ getOperatorAtIndex(index: number): Promise<string>; /** * Opt-in to a specific network * Allows an operator to indicate intention to validate for a network * This should be done after registering as an operator * * @param networkAddress - The address of the network to opt into * @returns Transaction response */ optInNetwork(networkAddress: string): Promise<TransactionResponse>; /** * Opt-out from a specific network * Allows an operator to stop validating for a network * * @param networkAddress - The address of the network to opt out from * @returns Transaction response */ optOutNetwork(networkAddress: string): Promise<TransactionResponse>; /** * Check if an operator is opted-in to a specific network * * @param operatorAddress - The address of the operator to check * @param networkAddress - The address of the network to check * @returns Boolean indicating if the operator is opted in */ isOptedInNetwork(operatorAddress: string, networkAddress: string): Promise<boolean>; /** * Opt-in to a specific vault * Allows an operator to receive stake from a vault * This should be done after registering as an operator * * @param vaultAddress - The address of the vault to opt into * @returns Transaction response */ optInVault(vaultAddress: string): Promise<TransactionResponse>; /** * Opt-out from a specific vault * Allows an operator to stop receiving stake from a vault * * @param vaultAddress - The address of the vault to opt out from * @returns Transaction response */ optOutVault(vaultAddress: string): Promise<TransactionResponse>; /** * Check if an operator is opted-in to a specific vault * * @param operatorAddress - The address of the operator to check * @param vaultAddress - The address of the vault to check * @returns Boolean indicating if the operator is opted in */ isOptedInVault(operatorAddress: string, vaultAddress: string): Promise<boolean>; /** * Register as an operator in the Native ecosystem * * @param name - Unique name for the operator * @param admin - Address that will administer the operator (default: signer's address) * @param operatorFee - Fee percentage as uint16 (default: 1000 = 10%) * @param managers - Array of manager addresses (default: empty array) * @returns Transaction response with operator index (bytes32) */ registerNativeOperator(name: string, admin?: string, operatorFee?: number, managers?: string[]): Promise<TransactionResponse>; /** * Unregister an operator in the Native ecosystem * * @param operatorIndex - The bytes32 index of the operator * @returns Transaction response */ unregisterNativeOperator(operatorIndex: string): Promise<TransactionResponse>; /** * Check if an operator name is already registered * * @param name - The name to check * @returns Boolean indicating if the operator is registered */ isNativeOperatorRegistered(name: string): Promise<boolean>; /** * Get the operator ID from a name * * @param name - The operator name * @returns Bytes32 ID of the operator */ getNativeOperatorId(name: string): Promise<string>; /** * Get the admin address of an operator * * @param operatorIndex - The bytes32 index of the operator * @returns Admin address */ getNativeOperatorAdmin(operatorIndex: string): Promise<string>; /** * Get the fee percentage of an operator * * @param operatorIndex - The bytes32 index of the operator * @returns Fee percentage as uint16 */ getNativeOperatorFee(operatorIndex: string): Promise<number>; /** * Check if an address is a manager of an operator * * @param operatorIndex - The bytes32 index of the operator * @param address - The address to check * @returns Boolean indicating if the address is a manager */ isNativeOperatorManager(operatorIndex: string, address: string): Promise<boolean>; /** * Set manager status for an operator * * @param operatorIndex - The bytes32 index of the operator * @param managers - Array of manager addresses * @param isManager - Boolean indicating if the addresses should be managers * @returns Transaction response */ setNativeOperatorManager(operatorIndex: string, managers: string[], isManager: boolean): Promise<TransactionResponse>; /** * Transfer the admin role for an operator * * @param operatorIndex - The bytes32 index of the operator * @param newAdmin - Address of the new admin * @returns Transaction response */ transferNativeAdminRole(operatorIndex: string, newAdmin: string): Promise<TransactionResponse>; /** * Update an operator's fee * * @param operatorIndex - The bytes32 index of the operator * @param operatorFee - New fee percentage (as uint16) * @returns Transaction response */ updateNativeOperatorFee(operatorIndex: string, operatorFee: number): Promise<TransactionResponse>; /** * Get the network configuration for the current chain * * @returns Network configuration */ getNetworkConfig(): import("../types").NetworkConfig; }