|
|
@ -245,6 +245,10 @@ func TestDomainChainId(t *testing.T) { |
|
|
|
if _, ok := withoutChainID.Domain.Map()["chainId"]; ok { |
|
|
|
if _, ok := withoutChainID.Domain.Map()["chainId"]; ok { |
|
|
|
t.Errorf("Expected the chainId key to not be present in the domain map") |
|
|
|
t.Errorf("Expected the chainId key to not be present in the domain map") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// should encode successfully
|
|
|
|
|
|
|
|
if _, err := withoutChainID.HashStruct("EIP712Domain", withoutChainID.Domain.Map()); err != nil { |
|
|
|
|
|
|
|
t.Errorf("Expected the typedData to encode the domain successfully, got %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
withChainID := core.TypedData{ |
|
|
|
withChainID := core.TypedData{ |
|
|
|
Types: core.Types{ |
|
|
|
Types: core.Types{ |
|
|
|
"EIP712Domain": []core.Type{ |
|
|
|
"EIP712Domain": []core.Type{ |
|
|
@ -261,6 +265,10 @@ func TestDomainChainId(t *testing.T) { |
|
|
|
if _, ok := withChainID.Domain.Map()["chainId"]; !ok { |
|
|
|
if _, ok := withChainID.Domain.Map()["chainId"]; !ok { |
|
|
|
t.Errorf("Expected the chainId key be present in the domain map") |
|
|
|
t.Errorf("Expected the chainId key be present in the domain map") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// should encode successfully
|
|
|
|
|
|
|
|
if _, err := withChainID.HashStruct("EIP712Domain", withChainID.Domain.Map()); err != nil { |
|
|
|
|
|
|
|
t.Errorf("Expected the typedData to encode the domain successfully, got %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestHashStruct(t *testing.T) { |
|
|
|
func TestHashStruct(t *testing.T) { |
|
|
|