eigenlayer-tools
v1.0.3
Published
## Tools - [getOperatorDelegatorsHistory](#getoperatordelegatorshistory) - history of increasing and decreasing restakes to operator
Downloads
17
Readme
The list of common tools for EigenLayer
Tools
- getOperatorDelegatorsHistory - history of increasing and decreasing restakes to operator
Contacts | ethers-v5
- delegationManagerContract - get delegationManagerContract contract instance
getOperatorDelegatorsHistory
Usage
import { getOperatorDelegatorsHistory } from "common-crypto-tools/eigenlayer";
const provider = new ethers.providers.JsonRpcProvider(
"https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY"
);
const data = await getOperatorDelegatorsHistory(provider, {
fromBlock: 19576120,
operator: "OPERATOR_CONTRACT",
}); // Map<string, Map<string, OperatorReStakerAction[]>>
Params
- provider:
ethers.providers.JsonRpcProvider
- options:
Options
Options
type Options = {
fromBlock?: number;
toBlock?: number;
operator: string;
delegationContract?: string; // By default it's EigenLayerDelegationContract: 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A
}
Return value
// key is delegator address
Map<string, OperatorReStakerAction>
type OperatorReStakerAction = {
amount: BigNumber;
block: BigNumber;
action:
| typeof OperatorSharesDecreasedAction
| typeof OperatorSharesIncreasedAction;
};
Examples
import { getOperatorDelegatorsHistory } from "common-crypto-tools/eigenlayer";
const data = await getOperatorDelegatorsHistory(provider, {
fromBlock: 19576120,
operator: "0xd172a86a0f250aec23ee19c759a8e73621fe3c10",
});
const history = data.get("0x3877fbDe425d21f29F4cB3e739Cf75CDECf8EdCE");
delegationManagerContract
Usage
import { delegationManagerContract } from "common-crypto-tools/eigenlayer";
const provider = new ethers.providers.JsonRpcProvider(
"https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY"
);
const contract = delegationManagerContract(provider);
// example
const data = await contract.getDelegatableShares("0x3877fbDe425d21f29F4cB3e739Cf75CDECf8EdCE");