fix vc api

This commit is contained in:
Agnish Ghosh 2024-10-31 11:53:29 +05:30
parent 51780ab5b0
commit be592e02fe
2 changed files with 50 additions and 1 deletions

View File

@ -26,7 +26,8 @@ type
bellatrix.SignedBeaconBlock |
capella.SignedBeaconBlock |
DenebSignedBlockContents |
ElectraSignedBlockContents
ElectraSignedBlockContents |
FuluSignedBlockContents
proc getGenesis*(): RestResponse[GetGenesisResponse] {.
rest, endpoint: "/eth/v1/beacon/genesis",
@ -163,6 +164,11 @@ proc publishBlock*(body: ElectraSignedBlockContents): RestPlainResponse {.
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
proc publishBlock*(body: FuluSignedBlockContents): RestPlainResponse {.
rest, endpoint: "/eth/v1/beacon/blocks",
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
proc publishSszBlock*(
client: RestClientRef,
blck: ForkySignedBeaconBlock
@ -217,6 +223,14 @@ proc publishBlockV2(
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
proc publishBlockV2(
broadcast_validation: Option[BroadcastValidationType],
body: FuluSignedBlockContents
): RestPlainResponse {.rest, endpoint: "/eth/v2/beacon/blocks",
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
proc publishBlockV2*(
client: RestClientRef,
broadcast_validation: Option[BroadcastValidationType],
@ -229,6 +243,8 @@ proc publishBlockV2*(
ConsensusFork.Deneb.toString()
elif blck is ElectraSignedBlockContents:
ConsensusFork.Electra.toString()
elif blck is FuluSignedBlockContents:
ConsensusFork.Fulu.toString()
else:
typeof(blck).kind.toString()
client.publishBlockV2(
@ -248,6 +264,8 @@ proc publishSszBlockV2*(
ConsensusFork.Deneb.toString()
elif blck is ElectraSignedBlockContents:
ConsensusFork.Electra.toString()
elif blck is FuluSignedBlockContents:
ConsensusFork.Fulu.toString()
else:
typeof(blck).kind.toString()
client.publishBlockV2(
@ -290,6 +308,12 @@ proc publishBlindedBlock*(body: electra_mev.SignedBlindedBeaconBlock):
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishBlindedBlock*(body: fulu_mev.SignedBlindedBeaconBlock):
RestPlainResponse {.
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishSszBlindedBlock*(
client: RestClientRef,
blck: ForkySignedBeaconBlock
@ -344,6 +368,13 @@ proc publishBlindedBlockV2*(
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishBlindedBlockV2*(
broadcast_validation: Option[BroadcastValidationType],
body: fulu_mev.SignedBlindedBeaconBlock
): RestPlainResponse {.rest, endpoint: "/eth/v2/beacon/blinded_blocks",
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishBlindedBlockV2*(
client: RestClientRef,
broadcast_validation: Option[BroadcastValidationType],

View File

@ -2511,6 +2511,8 @@ proc publishBlockV2*(
publishBlockV2(it, some(broadcast_validation), data.denebData)
of ConsensusFork.Electra:
publishBlockV2(it, some(broadcast_validation), data.electraData)
of ConsensusFork.Fulu:
publishBlockV2(it, some(broadcast_validation), data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()
@ -2562,6 +2564,8 @@ proc publishBlockV2*(
publishBlockV2(it, some(broadcast_validation), data.denebData)
of ConsensusFork.Electra:
publishBlockV2(it, some(broadcast_validation), data.electraData)
of ConsensusFork.Fulu:
publishBlockV2(it, some(broadcast_validation), data.fuluData)
do:
if apiResponse.isErr():
@ -2627,6 +2631,8 @@ proc publishBlock*(
publishBlock(it, data.denebData)
of ConsensusFork.Electra:
publishBlock(it, data.electraData)
of ConsensusFork.Fulu:
publishBlock(it, data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()
@ -2675,6 +2681,8 @@ proc publishBlock*(
publishBlock(it, data.denebData)
of ConsensusFork.Electra:
publishBlock(it, data.electraData)
of ConsensusFork.Fulu:
publishBlock(it, data.fuluData)
do:
if apiResponse.isErr():
@ -2841,6 +2849,9 @@ proc publishBlindedBlockV2*(
of ConsensusFork.Electra:
publishBlindedBlockV2(it, some(broadcast_validation),
data.electraData)
of ConsensusFork.Fulu:
publishBlindedBlockV2(it, some(broadcast_validation),
data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()
@ -2897,6 +2908,9 @@ proc publishBlindedBlockV2*(
of ConsensusFork.Electra:
publishBlindedBlockV2(it, some(broadcast_validation),
data.electraData)
of ConsensusFork.Fulu:
publishBlindedBlockV2(it, some(broadcast_validation),
data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()
@ -2960,6 +2974,8 @@ proc publishBlindedBlock*(
publishBlindedBlock(it, data.denebData)
of ConsensusFork.Electra:
publishBlindedBlock(it, data.electraData)
of ConsensusFork.Fulu:
publishBlindedBlock(it, data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()
@ -3007,6 +3023,8 @@ proc publishBlindedBlock*(
publishBlindedBlock(it, data.denebData)
of ConsensusFork.Electra:
publishBlindedBlock(it, data.electraData)
of ConsensusFork.Fulu:
publishBlindedBlock(it, data.fuluData)
do:
if apiResponse.isErr():
handleCommunicationError()