mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-17 20:16:47 +01:00
Mohammed Sohail
cf1f9f34c3
* fallback to custom ethereum checksum validator -> https://github.com/go-playground/validator/issues/1073 * decouple jetsream emitter to separate package * refactor task handlers into individual files * add error handler for echo to capture unexpected errors and log them * move handler dependencies into single struct container -> custodialContainer * replace signer to use EIP 1559 signer -> celoutils v1 * Add 1 minutes timeout to all custodial tasks
27 lines
514 B
Go
27 lines
514 B
Go
package api
|
|
|
|
import (
|
|
"github.com/celo-org/celo-blockchain/common"
|
|
"github.com/go-playground/validator/v10"
|
|
)
|
|
|
|
type Validator struct {
|
|
ValidatorProvider *validator.Validate
|
|
}
|
|
|
|
func (v *Validator) Validate(i interface{}) error {
|
|
if err := v.ValidatorProvider.Struct(i); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func EthChecksumValidator(fl validator.FieldLevel) bool {
|
|
addr, err := common.NewMixedcaseAddressFromString(fl.Field().String())
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
return addr.ValidChecksum()
|
|
}
|