0

I have to compose a protobuf message which should have object with N key:value pairs.

{ "0xc02aaa39b223fe8d4a0e5c4f27ead9083c756cc2": "73185315951404654", "0x111111111117dc0aa78b770fa6a738034120c302": "90483392540197705773", "0xdac17f958d2ee523a2206206944597c13d831ec7": "2599292593", "0x6b175474e89094c44da98b954eedeac495271d0f": "2887251922547121516", "0xa0b86991c6218b36c1d19d224a2e9eb0ce06eb48": "1995436171", "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": "152669472", "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e": "78565917807540502", "0x888888888889c00c67689029d7856aac1065ec11": "10015330752170299581" }

Is there a way to compose this JSON?

I tried to use map:

message Reply { map<string, string> balances = 1; }

but ended up with this error message: Object literal may only specify known properties, and '0xc02aaa39b223fe8d4a0e5c4f27ead9083c756cc2' does not exist in type 'Reply'.

MantasFam
  • 101
  • 1
  • Your question is vague and would benefit from your including the specific steps you took to create the error. The JSON shown is valid. You are correct in using `map` to represent the structure. You should include the code sample that throws the error but it appears you're trying to assign a value (`0xc02aaa...`) to `Reply` but `Reply` contains a map called `balances` and it is to `balances` that you would add keys (such as `0xc02aaa..`) and values. – DazWilkin Nov 24 '22 at 21:19

0 Answers0