fixes for 19.0.1 (#1305)
* fixes for 19.0.1 * changelog * changelog Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
parent
524e25c038
commit
c9fe1d1913
@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
recompute eth tx hashes in JSON-RPC APIs to fix old blocks.
|
recompute eth tx hashes in JSON-RPC APIs to fix old blocks.
|
||||||
* (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade cosmos-sdk to v0.46.
|
* (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade cosmos-sdk to v0.46.
|
||||||
* (feemarket) [#1194](https://github.com/evmos/ethermint/pull/1194) Apply feemarket to native cosmos tx.
|
* (feemarket) [#1194](https://github.com/evmos/ethermint/pull/1194) Apply feemarket to native cosmos tx.
|
||||||
|
* (eth) [#1305](https://github.com/evmos/ethermint/pull/1305) Added support for optional params, basic types arrays and `time` type on eip712.
|
||||||
|
|
||||||
### API Breaking
|
### API Breaking
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
"golang.org/x/text/cases"
|
"golang.org/x/text/cases"
|
||||||
@ -232,6 +233,11 @@ func traverseFields(
|
|||||||
// then continue as normal
|
// then continue as normal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If its a nil pointer, do not include in types
|
||||||
|
if fieldType.Kind() == reflect.Ptr && field.IsNil() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if fieldType.Kind() == reflect.Ptr {
|
if fieldType.Kind() == reflect.Ptr {
|
||||||
fieldType = fieldType.Elem()
|
fieldType = fieldType.Elem()
|
||||||
@ -296,6 +302,11 @@ func traverseFields(
|
|||||||
|
|
||||||
ethTyp := typToEth(fieldType)
|
ethTyp := typToEth(fieldType)
|
||||||
if len(ethTyp) > 0 {
|
if len(ethTyp) > 0 {
|
||||||
|
// Support array of uint64
|
||||||
|
if isCollection && fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array {
|
||||||
|
ethTyp += "[]"
|
||||||
|
}
|
||||||
|
|
||||||
if prefix == typeDefPrefix {
|
if prefix == typeDefPrefix {
|
||||||
typeMap[rootType] = append(typeMap[rootType], apitypes.Type{
|
typeMap[rootType] = append(typeMap[rootType], apitypes.Type{
|
||||||
Name: fieldName,
|
Name: fieldName,
|
||||||
@ -381,6 +392,7 @@ var (
|
|||||||
bigIntType = reflect.TypeOf(big.Int{})
|
bigIntType = reflect.TypeOf(big.Int{})
|
||||||
cosmIntType = reflect.TypeOf(sdkmath.Int{})
|
cosmIntType = reflect.TypeOf(sdkmath.Int{})
|
||||||
cosmosAnyType = reflect.TypeOf(&codectypes.Any{})
|
cosmosAnyType = reflect.TypeOf(&codectypes.Any{})
|
||||||
|
timeType = reflect.TypeOf(time.Time{})
|
||||||
)
|
)
|
||||||
|
|
||||||
// typToEth supports only basic types and arrays of basic types.
|
// typToEth supports only basic types and arrays of basic types.
|
||||||
@ -425,6 +437,7 @@ func typToEth(typ reflect.Type) string {
|
|||||||
}
|
}
|
||||||
case reflect.Ptr:
|
case reflect.Ptr:
|
||||||
if typ.Elem().ConvertibleTo(bigIntType) ||
|
if typ.Elem().ConvertibleTo(bigIntType) ||
|
||||||
|
typ.Elem().ConvertibleTo(timeType) ||
|
||||||
typ.Elem().ConvertibleTo(cosmIntType) {
|
typ.Elem().ConvertibleTo(cosmIntType) {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
@ -432,6 +445,7 @@ func typToEth(typ reflect.Type) string {
|
|||||||
if typ.ConvertibleTo(hashType) ||
|
if typ.ConvertibleTo(hashType) ||
|
||||||
typ.ConvertibleTo(addressType) ||
|
typ.ConvertibleTo(addressType) ||
|
||||||
typ.ConvertibleTo(bigIntType) ||
|
typ.ConvertibleTo(bigIntType) ||
|
||||||
|
typ.ConvertibleTo(timeType) ||
|
||||||
typ.ConvertibleTo(cosmIntType) {
|
typ.ConvertibleTo(cosmIntType) {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user