Skip to content

Commit

Permalink
review: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel committed Nov 29, 2023
1 parent 557dd6e commit 50a6543
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions go/host/rpc/clientapi/client_api_obscuro.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ func (api *ObscuroAPI) Health() (*host.HealthCheck, error) {
}

// Config returns the config status of obscuro host + enclave + db
func (api *ObscuroAPI) Config() (*JSONFriendlyObscuroNetworkInfo, error) {
func (api *ObscuroAPI) Config() (*ChecksumFormattedObscuroNetworkConfig, error) {
config, err := api.host.ObscuroConfig()
if err != nil {
return nil, err
}
return jsonFriendly(config), nil
return checksumFormatted(config), nil
}

// JSONFriendlyObscuroNetworkInfo is a JSON-friendly version of ObscuroNetworkInfo.
// In particular, it serialises the addresses as EIP55 checksum addresses.
type JSONFriendlyObscuroNetworkInfo struct {
// ChecksumFormattedObscuroNetworkConfig serialises the addresses as EIP55 checksum addresses.
type ChecksumFormattedObscuroNetworkConfig struct {
ManagementContractAddress gethcommon.AddressEIP55
L1StartHash gethcommon.Hash
SequencerID gethcommon.AddressEIP55
Expand All @@ -42,12 +41,12 @@ type JSONFriendlyObscuroNetworkInfo struct {
ImportantContracts map[string]gethcommon.AddressEIP55 // map of contract name to address
}

func jsonFriendly(info *common.ObscuroNetworkInfo) *JSONFriendlyObscuroNetworkInfo {
func checksumFormatted(info *common.ObscuroNetworkInfo) *ChecksumFormattedObscuroNetworkConfig {
importantContracts := make(map[string]gethcommon.AddressEIP55)
for name, addr := range info.ImportantContracts {
importantContracts[name] = gethcommon.AddressEIP55(addr)
}
return &JSONFriendlyObscuroNetworkInfo{
return &ChecksumFormattedObscuroNetworkConfig{
ManagementContractAddress: gethcommon.AddressEIP55(info.ManagementContractAddress),
L1StartHash: info.L1StartHash,
SequencerID: gethcommon.AddressEIP55(info.SequencerID),
Expand Down

0 comments on commit 50a6543

Please sign in to comment.