Closed sneurlax closed 6 years ago
Could we merge it @sneurlax ?
I've been using this for awhile. You may want to test it, but I really prefer it, honestly. Instead of looking up the expected order, you can just provide them in whatever order you want, and leave out the ones you don't want to set--but the old method still works. Win-win.
This pull request adds the optional (backwards-compatible) ability for the wallet and daemon RPC classes to be initialized with/parameters passed in as objects/dictionaries (associative arrays.) After this pull request, RPC classes can be initialized in any of the following ways:
or
The last example demonstrates how parameters can be passed in in any order or combination, with parameters using their default values if they're not defined.
This pull request isn't necessary at the moment but it does add the capability needed to pass in
['autoconnect' => true]
, which is the next functionality I'm adding (see https://github.com/sneurlax/moneronodejs/commit/9f17be53cf43e9e1136536d5527b738af330a3e5 for the autoconnect functionality I'm going to port over here.)This is optional and backwards-compatible, ie. nobody has to change what they're doing now; all current code will continue working as normal.