github.com/MetalBlockchain/metalgo@v1.11.9/vms/avm/config.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package avm 5 6 import ( 7 "encoding/json" 8 9 "github.com/MetalBlockchain/metalgo/vms/avm/network" 10 ) 11 12 var DefaultConfig = Config{ 13 Network: network.DefaultConfig, 14 IndexTransactions: false, 15 IndexAllowIncomplete: false, 16 ChecksumsEnabled: false, 17 } 18 19 type Config struct { 20 Network network.Config `json:"network"` 21 IndexTransactions bool `json:"index-transactions"` 22 IndexAllowIncomplete bool `json:"index-allow-incomplete"` 23 ChecksumsEnabled bool `json:"checksums-enabled"` 24 } 25 26 func ParseConfig(configBytes []byte) (Config, error) { 27 if len(configBytes) == 0 { 28 return DefaultConfig, nil 29 } 30 31 config := DefaultConfig 32 err := json.Unmarshal(configBytes, &config) 33 return config, err 34 }