Added debit settlement amount calculation
This commit is contained in:
@@ -56,6 +56,7 @@ func WithNetworks(networks []shared.Network) Option {
|
||||
clone.TokenConfigs[i].Symbol = strings.ToUpper(strings.TrimSpace(clone.TokenConfigs[i].Symbol))
|
||||
clone.TokenConfigs[i].ContractAddress = strings.ToLower(strings.TrimSpace(clone.TokenConfigs[i].ContractAddress))
|
||||
}
|
||||
clone.Name = network.Name
|
||||
s.networks[clone.Name.String()] = clone
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package shared
|
||||
|
||||
import "strings"
|
||||
|
||||
// NetworkRegistry provides network configuration lookup by name.
|
||||
type NetworkRegistry struct {
|
||||
networks map[string]Network
|
||||
}
|
||||
|
||||
// NewNetworkRegistry creates a NetworkRegistry from a slice of network configs.
|
||||
func NewNetworkRegistry(networks []Network) *NetworkRegistry {
|
||||
m := make(map[string]Network, len(networks))
|
||||
for _, n := range networks {
|
||||
if n.Name.IsValid() {
|
||||
m[strings.ToLower(n.Name.String())] = n
|
||||
}
|
||||
}
|
||||
return &NetworkRegistry{networks: m}
|
||||
}
|
||||
|
||||
// Network returns the configuration for the named network.
|
||||
func (r *NetworkRegistry) Network(name string) (Network, bool) {
|
||||
if r == nil || r.networks == nil {
|
||||
return Network{}, false
|
||||
}
|
||||
n, ok := r.networks[strings.ToLower(strings.TrimSpace(name))]
|
||||
return n, ok
|
||||
}
|
||||
|
||||
// Networks returns all configured networks.
|
||||
func (r *NetworkRegistry) Networks() map[string]Network {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
return r.networks
|
||||
}
|
||||
Reference in New Issue
Block a user