graphprotocol / support

Community support for the Hosted Service of The Graph
https://thegraph.com/
10 stars 3 forks source link

Suggestion: Allow more types in TypedMap #22

Open iherger opened 5 years ago

iherger commented 5 years ago

TypedMap currently doesn't allow for Address key type. It might be useful to allow Address and other types as key types.

There is no compiler error or graph-node warning, the TypedMap object just returns null for a get request with the correct key of type Address.

Alternatively, the documentation should be updated as to which types are currently allowed as key types.

leoyvens commented 5 years ago

It should work with any key that supports ==. I don't see why it wouldn't work with Address which is a byte array, if you have a sample of the code you tried that would help debug.

iherger commented 5 years ago

This is the code we are using currently, https://github.com/melonproject/melon-subgraph/blob/master/src/mappings/PriceSource.ts#L175

We are now using string as the key type, Address didn't seem to work.