UNPKG

@byzantine/operator-sdk

Version:

SDK for integrating operators with Byzantine Finance ecosystem

101 lines (100 loc) 3.73 kB
/** * Native OperatorRegistry * * Client for interacting with the Native Operator Registry contract * This service allows operators to register in the Byzantine native ecosystem */ import { ethers, TransactionResponse } from "ethers"; import { ChainsOptions } from "../../types"; export declare class NativeOperatorRegistry { private readonly provider; private readonly signer; private readonly chainId; private contract; constructor(provider: ethers.Provider, signer: ethers.Signer, chainId: ChainsOptions); /** * Validate operator parameters to avoid common errors * * @param name - Name for the operator * @param operatorFee - Fee percentage */ private validateOperatorParams; /** * Register as an operator in the Native ecosystem * * @param name - Unique name for the operator * @param admin - Address that will administer the operator * @param operatorFee - Fee percentage (as uint16) * @param managers - Array of manager addresses * @returns Transaction response with index (bytes32) of the registered operator */ registerOperator(name: string, admin: string, operatorFee: number, managers: string[]): Promise<TransactionResponse>; /** * Unregister an operator * * @param operatorIndex - The bytes32 index of the operator * @returns Transaction response */ unregisterOperator(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 */ isOperatorRegistered(name: string): Promise<boolean>; /** * Get the operator ID from a name * * @param name - The operator name * @returns Bytes32 ID */ getOperatorId(name: string): Promise<string>; /** * Get the admin address of an operator * * @param operatorIndex - The bytes32 index of the operator * @returns Admin address */ getOperatorAdmin(operatorIndex: string): Promise<string>; /** * Get the fee percentage of an operator * * @param operatorIndex - The bytes32 index of the operator * @returns Fee percentage as uint16 */ getOperatorFee(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 */ isManagerOfOperator(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 */ setOperatorManager(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 */ transferAdminRole(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 */ updateOperatorFee(operatorIndex: string, operatorFee: number): Promise<TransactionResponse>; }