Neo: Suggestion: Add Map parameter type / return type

Created on 5 Dec 2018  路  13Comments  路  Source: neo-project/neo

Hello,

We accept Map in the smart contract, even in the storage, but we cannot send maps nor return it.
Is there any chance we could add this feature to NEO?

Thanks

discussion

Most helpful comment

@vncoelho this is garbage, I'm closing it!

All 13 comments

You can use object, is enough for you?

@shargon maybe. If I use 0710 as input parameters and send something like "register", [Map], will it work?

If I return a map, will it be serialised and returned as a byte array or as a utf-8 "string" (map)?

It will work. If you use serialize and deserialize this will probably be easier Ricardo... inside methods you can cast from/to map using object, as shargon mentioned. Receiving it from outside world is unecessary if we already have serialization. To be honest, I submit integers directly as bytearray, because afterall, everything is a bytearray :)
But I get your point, it would be nice for interfaces to know that a function expects a Map, the same way is better to inform UInt256 than ByteArray.... its safer and more specific.
This would perhaps change NEP-3 : https://github.com/neo-project/proposals/blob/master/nep-3.mediawiki

Is it possible to deserialise this map just by converting it to from hex to utf-8 string? I think that the maps are being serialised like they are in the SC, using a prefix byte to identify the type.
I'll try again here, for some reason it wasn't working when I returned a map, I had to return a 'flat array' instead 馃

I think that the better way is that you return a byte array in your desire format

Hi @lock9, meu parceiro meu amigo, can this be closed or is it still something that we should consider to be implemented?

@vncoelho this is garbage, I'm closing it!

This is important, lets do it on NEP3 Ammendment.

I told @lock9 in private if he was sure about the garbage...aheuaheuaea

This is very important. Every StackItem on NeoVM should at least have a corresponding item on NEP-3 (and NEP-3 should have even more extra abstract types, such as signatures, addresses, etc).

Hello guys, let me explain:
I think that nodes don't have to return this kind of object because this computation can be done in the client.
What could be done, is some sort of external deserialized, maybe something outside the SC, meaning that consensus nodes don't have to execute it.

What if this is inserted in the manifest file? I don't know, but I'm against putting this kind of computation "mandatory", because it can be done elsewhere (at client level)

Can we move our discussion to #822?

Ok @lock9

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vncoelho picture vncoelho  路  3Comments

canesin picture canesin  路  3Comments

Tommo-L picture Tommo-L  路  4Comments

igormcoelho picture igormcoelho  路  3Comments

realloc picture realloc  路  4Comments