emeraldpay / emerald-vault

Secure account management for Ethereum blockchains
https://emerald.cash
Apache License 2.0
54 stars 25 forks source link

`emerald_import*` & `emerald_export*` doesn't embedded JSON objects as plain string values #197

Open ghost opened 7 years ago

ghost commented 7 years ago

https://stackoverflow.com/questions/7750399/how-to-encode-json-embedded-within-json

Like "abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sendLoyaltyPoints\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"familyMember\",\"type\":\"address\"}],\"name\":\"registerFamilyMember\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"EmiratesLoyaltyPoints\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"}]".

ghost commented 7 years ago

I think it's more straightforward way always use JSON embeddable string representation for embedded JSON objects, that's very usual for import & export sort of stuff. @elaineo what do you think about it?

elaineo commented 7 years ago

what's wrong with embedding nested JSON objects? as long as the encoders/decoders can handle it, either way is fine with me.

ghost commented 7 years ago

For me not fully consistent, for example, abi should be just single string field, because it can be several different incompatible versions, better just to separate JSON-RPC method parameters from import & export JSON objects, not to mix them with each other.

elaineo commented 7 years ago

ok, makes sense 👍