github.com/dim4egster/coreth@v0.10.2/plugin/evm/static_service.go (about) 1 // (c) 2019-2020, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package evm 5 6 import ( 7 "context" 8 "encoding/json" 9 10 "github.com/dim4egster/qmallgo/utils/formatting" 11 "github.com/dim4egster/coreth/core" 12 ) 13 14 // StaticService defines the static API services exposed by the evm 15 type StaticService struct{} 16 17 // BuildGenesisReply is the reply from BuildGenesis 18 type BuildGenesisReply struct { 19 Bytes string `json:"bytes"` 20 Encoding formatting.Encoding `json:"encoding"` 21 } 22 23 // BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is 24 // referenced in the UTXO. 25 func (*StaticService) BuildGenesis(_ context.Context, args *core.Genesis) (*BuildGenesisReply, error) { 26 bytes, err := json.Marshal(args) 27 if err != nil { 28 return nil, err 29 } 30 bytesStr, err := formatting.Encode(formatting.Hex, bytes) 31 if err != nil { 32 return nil, err 33 } 34 return &BuildGenesisReply{ 35 Bytes: bytesStr, 36 Encoding: formatting.Hex, 37 }, nil 38 }