signer/core: move EIP-712 types to package apitypes (#24029)
Fixes #23972
This commit is contained in:
committed by
GitHub
parent
93f196c4b0
commit
619a3e7085
@ -34,15 +34,15 @@ type GnosisSafeTx struct {
|
||||
}
|
||||
|
||||
// ToTypedData converts the tx to a EIP-712 Typed Data structure for signing
|
||||
func (tx *GnosisSafeTx) ToTypedData() TypedData {
|
||||
func (tx *GnosisSafeTx) ToTypedData() apitypes.TypedData {
|
||||
var data hexutil.Bytes
|
||||
if tx.Data != nil {
|
||||
data = *tx.Data
|
||||
}
|
||||
gnosisTypedData := TypedData{
|
||||
Types: Types{
|
||||
"EIP712Domain": []Type{{Name: "verifyingContract", Type: "address"}},
|
||||
"SafeTx": []Type{
|
||||
gnosisTypedData := apitypes.TypedData{
|
||||
Types: apitypes.Types{
|
||||
"EIP712Domain": []apitypes.Type{{Name: "verifyingContract", Type: "address"}},
|
||||
"SafeTx": []apitypes.Type{
|
||||
{Name: "to", Type: "address"},
|
||||
{Name: "value", Type: "uint256"},
|
||||
{Name: "data", Type: "bytes"},
|
||||
@ -55,11 +55,11 @@ func (tx *GnosisSafeTx) ToTypedData() TypedData {
|
||||
{Name: "nonce", Type: "uint256"},
|
||||
},
|
||||
},
|
||||
Domain: TypedDataDomain{
|
||||
Domain: apitypes.TypedDataDomain{
|
||||
VerifyingContract: tx.Safe.Address().Hex(),
|
||||
},
|
||||
PrimaryType: "SafeTx",
|
||||
Message: TypedDataMessage{
|
||||
Message: apitypes.TypedDataMessage{
|
||||
"to": tx.To.Address().Hex(),
|
||||
"value": tx.Value.String(),
|
||||
"data": data,
|
||||
|
Reference in New Issue
Block a user