diff options
author | aaronbuchwald <[email protected]> | 2020-11-30 12:22:29 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-30 12:22:29 -0500 |
commit | cfc11729d0f24b8e42a3f9cbcf7534e2db09d720 (patch) | |
tree | 9478961d310c5b69ca65fc9551ef9976b1d01da5 /plugin/evm/static_service.go | |
parent | ae4541f42a666fb5ae1c36d6f7423c3d9eb2c875 (diff) | |
parent | 415b1eb564efc70cf7e673358286e19de8551fbf (diff) |
Merge pull request #62 from ava-labs/devv0.3.15
Dev
Diffstat (limited to 'plugin/evm/static_service.go')
-rw-r--r-- | plugin/evm/static_service.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/plugin/evm/static_service.go b/plugin/evm/static_service.go index 1e48734..7b0fa8b 100644 --- a/plugin/evm/static_service.go +++ b/plugin/evm/static_service.go @@ -7,16 +7,32 @@ import ( "context" "encoding/json" - "github.com/ava-labs/coreth/core" "github.com/ava-labs/avalanchego/utils/formatting" + "github.com/ava-labs/coreth/core" ) // StaticService defines the static API services exposed by the evm type StaticService struct{} +// BuildGenesisReply is the reply from BuildGenesis +type BuildGenesisReply struct { + Bytes string `json:"bytes"` + Encoding formatting.Encoding `json:"encoding"` +} + // BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is // referenced in the UTXO. -func (*StaticService) BuildGenesis(_ context.Context, args *core.Genesis) (formatting.CB58, error) { +func (*StaticService) BuildGenesis(_ context.Context, args *core.Genesis) (*BuildGenesisReply, error) { bytes, err := json.Marshal(args) - return formatting.CB58{Bytes: bytes}, err + if err != nil { + return nil, err + } + bytesStr, err := formatting.Encode(formatting.Hex, bytes) + if err != nil { + return nil, err + } + return &BuildGenesisReply{ + Bytes: bytesStr, + Encoding: formatting.Hex, + }, nil } |