@lodestar/types 1.45.0-dev.f535421f29 → 1.45.0-dev.f6c521a123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gloas/sszTypes.d.ts +646 -150
- package/lib/gloas/sszTypes.d.ts.map +1 -1
- package/lib/gloas/sszTypes.js +199 -61
- package/lib/gloas/sszTypes.js.map +1 -1
- package/lib/gloas/types.d.ts +27 -1
- package/lib/gloas/types.d.ts.map +1 -1
- package/lib/sszTypes.d.ts +2548 -2664
- package/lib/sszTypes.d.ts.map +1 -1
- package/lib/types.d.ts +12 -12
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/typeguards.d.ts.map +1 -1
- package/lib/utils/typeguards.js +5 -3
- package/lib/utils/typeguards.js.map +1 -1
- package/lib/utils/validatorStatus.d.ts +9 -1
- package/lib/utils/validatorStatus.d.ts.map +1 -1
- package/lib/utils/validatorStatus.js +13 -0
- package/lib/utils/validatorStatus.js.map +1 -1
- package/package.json +5 -5
- package/src/gloas/sszTypes.ts +277 -70
- package/src/gloas/types.ts +31 -1
- package/src/types.ts +12 -12
- package/src/utils/typeguards.ts +5 -2
- package/src/utils/validatorStatus.ts +20 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {FAR_FUTURE_EPOCH} from "@lodestar/params";
|
|
2
|
-
import {Epoch, phase0} from "../types.js";
|
|
2
|
+
import {Epoch, gloas, phase0} from "../types.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ)
|
|
@@ -53,6 +53,25 @@ export function getValidatorStatus(validator: phase0.Validator, currentEpoch: Ep
|
|
|
53
53
|
throw new Error("ValidatorStatus unknown");
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Statuses as defined in https://github.com/ethereum/beacon-APIs/pull/614
|
|
58
|
+
*/
|
|
59
|
+
export type BuilderStatus = "pending" | "active" | "exited";
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the status of the builder, `finalizedEpoch` refers to `state.finalized_checkpoint.epoch`
|
|
63
|
+
*/
|
|
64
|
+
export function getBuilderStatus(builder: gloas.Builder, finalizedEpoch: Epoch): BuilderStatus {
|
|
65
|
+
if (builder.withdrawableEpoch !== FAR_FUTURE_EPOCH) {
|
|
66
|
+
return "exited";
|
|
67
|
+
}
|
|
68
|
+
// Same as is_active_builder check with withdrawable epoch already confirmed to be FAR_FUTURE_EPOCH
|
|
69
|
+
if (builder.depositEpoch < finalizedEpoch) {
|
|
70
|
+
return "active";
|
|
71
|
+
}
|
|
72
|
+
return "pending";
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
export function mapToGeneralStatus(subStatus: ValidatorStatus): GeneralValidatorStatus {
|
|
57
76
|
switch (subStatus) {
|
|
58
77
|
case "active_ongoing":
|