From 6eeed3de917a3d574d98a968b6a780873911016c Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Wed, 28 Dec 2022 16:13:23 +0530 Subject: [PATCH] hardcode record attributes --- ethereum/eip712/eip712.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index 07566f42..903947ee 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -57,6 +57,13 @@ func WrapTxToTypedData( return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "failed to JSON unmarshal data") } + if txData["msgs"].([]interface{})[0].(map[string]interface{})["value"].(map[string]interface{})["payload"] != nil { + txData["msgs"].([]interface{})[0].(map[string]interface{})["value"].(map[string]interface{})["payload"].(map[string]interface{})["record"].(map[string]interface{})["attributes"] = map[string]interface{}{ + "type_url": "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord", + "value": []interface{}{"10", "15", "104", "116", "116", "112", "115", "58", "47", "47", "99", "101", "114", "99", "46", "105", "111", "18", "46", "81", "109", "83", "110", "117", "87", "109", "120", "112", "116", "74", "90", "100", "76", "74", "112", "75", "82", "97", "114", "120", "66", "77", "83", "50", "74", "117", "50", "111", "65", "78", "86", "114", "103", "98", "114", "50", "120", "87", "98", "105", "101", "57", "98", "50", "68", "26", "46", "81", "109", "80", "56", "106", "84", "71", "49", "109", "57", "71", "83", "68", "74", "76", "67", "98", "101", "87", "104", "86", "83", "86", "103", "69", "122", "67", "80", "80", "119", "88", "82", "100", "67", "82", "117", "74", "116", "81", "53", "84", "122", "57", "75", "99", "57", "34", "46", "81", "109", "98", "87", "113", "120", "66", "69", "75", "67", "51", "80", "56", "116", "113", "115", "75", "99", "57", "56", "120", "109", "87", "78", "122", "114", "122", "68", "116", "82", "76", "77", "105", "77", "80", "76", "56", "119", "66", "117", "84", "71", "115", "77", "110", "82", "42", "25", "87", "101", "98", "115", "105", "116", "101", "82", "101", "103", "105", "115", "116", "114", "97", "116", "105", "111", "110", "82", "101", "99", "111", "114", "100"}, + } + } + domain := apitypes.TypedDataDomain{ Name: "Cosmos Web3", Version: "1.0.0", @@ -83,11 +90,13 @@ func WrapTxToTypedData( } if msgTypes["TypePayloadRecordAttributes"] != nil { msgTypes["TypePayloadRecordAttributes"] = []apitypes.Type{ - {Name: "url", Type: "string"}, - {Name: "repo_registration_record_cid", Type: "string"}, - {Name: "build_artifact_cid", Type: "string"}, - {Name: "tls_cert_cid", Type: "string"}, - {Name: "type", Type: "string"}, + // {Name: "url", Type: "string"}, + // {Name: "repo_registration_record_cid", Type: "string"}, + // {Name: "build_artifact_cid", Type: "string"}, + // {Name: "tls_cert_cid", Type: "string"}, + // {Name: "type", Type: "string"}, + {Name: "type_url", Type: "string"}, + {Name: "value", Type: "uint8[]"}, } delete(msgTypes, "TypePayloadRecordAttributesValue") }