github.com/stafiprotocol/go-substrate-rpc-client@v1.4.7/types/serde.go (about) 1 package types 2 3 import "sync" 4 5 // SerDeOptions are serialise and deserialize options for types 6 type SerDeOptions struct { 7 // NoPalletIndices enable this to work with substrate chains that do not have indices pallet in runtime 8 NoPalletIndices bool 9 } 10 11 var defaultOptions = SerDeOptions{} 12 var mu sync.RWMutex 13 14 // SetSerDeOptions overrides default serialise and deserialize options 15 func SetSerDeOptions(so SerDeOptions) { 16 defer mu.Unlock() 17 mu.Lock() 18 defaultOptions = so 19 } 20 21 // SerDeOptionsFromMetadata returns Serialise and deserialize options from metadata 22 func SerDeOptionsFromMetadata(meta *Metadata) SerDeOptions { 23 var opts SerDeOptions 24 if !meta.ExistsModuleMetadata("Indices") { 25 opts.NoPalletIndices = true 26 } 27 return opts 28 }