diff --git a/README.md b/README.md index bdc04e28..d444b67e 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,6 @@ $ npm install steem --save ## RPC Servers https://api.steemit.com By Default
-https://node.steem.ws
-https://this.piston.rocks
## Examples ### Broadcast Vote @@ -107,7 +105,7 @@ steem.api.setOptions({ The Chain ID could change. If it does, it may not be reflected here, but will be documented on any testnet launch announcements. ## Contributions -Patches are welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list or on Steemit Chat channel #steemjs https://steemit.chat/channel/steemjs. +Patches are welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list. ## Issues When you find issues, please report them! diff --git a/src/api/index.js b/src/api/index.js index 1a39f299..3f1a4652 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -31,9 +31,15 @@ class Steem extends EventEmitter { const methodParams = method.params || []; this[`${methodName}With`] = (options, callback) => { + let params; + if (!method.is_object) { + params = methodParams.map(param => options[param]); + } else { + params = options; + } return this.send(method.api, { method: method.method, - params: methodParams.map(param => options[param]) + params: params }, callback); }; @@ -46,7 +52,7 @@ class Steem extends EventEmitter { return this[`${methodName}With`](options, callback); }; - this[`${methodName}WithAsync`] = Promise.promisify(this[`${methodName}With`]); + this[`${methodName}WithAsync`] = Promise.promisify(this[`${methodName}With`]); this[`${methodName}Async`] = Promise.promisify(this[methodName]); }); this.callAsync = Promise.promisify(this.call); diff --git a/src/api/methods.js b/src/api/methods.js index 99e40368..4e15a93e 100644 --- a/src/api/methods.js +++ b/src/api/methods.js @@ -510,5 +510,11 @@ export default [ "api": "condenser_api", "method": "get_nai_pool", "params": [] - } + }, + { + "api": "rc_api", + "method": "find_rc_accounts", + "params": ["accounts"], + "is_object": true + }, ]; diff --git a/test/api.test.js b/test/api.test.js index 574a07bc..c23bbbc8 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -323,4 +323,16 @@ describe('steem.api:', function () { it('does not retry non-retriable operations'); }); + describe('getRC', () => { + describe('getting a RC of an account', () => { + it('works', async () => { + const result = await steem.api.findRcAccountsAsync(["justinsunsteemit"]); + result.should.have.properties("rc_accounts"); + result["rc_accounts"][0].should.have.properties("rc_manabar"); + }); + it('clears listeners', async () => { + steem.api.listeners('message').should.have.lengthOf(0); + }); + }); + }); });