From dcaa6672e6bae569ee3d32e264f4732a2ef2461f Mon Sep 17 00:00:00 2001 From: Jeeyong Um Date: Fri, 12 Apr 2019 12:55:51 +0900 Subject: [PATCH 1/2] add get_scheduled_transactions to eosjs --- src/eosjs-jsonrpc.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/eosjs-jsonrpc.ts b/src/eosjs-jsonrpc.ts index 8dbbe5aae..2a0c1265b 100644 --- a/src/eosjs-jsonrpc.ts +++ b/src/eosjs-jsonrpc.ts @@ -125,6 +125,11 @@ export class JsonRpc implements AuthorityProvider, AbiProvider { return { accountName: rawCodeAndAbi.account_name, abi }; } + /** Raw call to `/v1/chain/get_scheduled_transactions` */ + public async get_scheduled_transactions(json = true, lowerBound = '', limit = 50): Promise { + return await this.fetch('/v1/chain/get_scheduled_transactions', { json, lower_bound: lowerBound, limit }); + } + /** Raw call to `/v1/chain/get_table_rows` */ public async get_table_rows({ json = true, From 0bc28e938e8ebd29696df0e820dac03efc056b22 Mon Sep 17 00:00:00 2001 From: Jeeyong Um Date: Fri, 12 Apr 2019 13:02:24 +0900 Subject: [PATCH 2/2] add get_scheduled_transactions test --- src/tests/eosjs-jsonrpc.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/eosjs-jsonrpc.test.ts b/src/tests/eosjs-jsonrpc.test.ts index 32c81d6e2..cb6e8cc9f 100644 --- a/src/tests/eosjs-jsonrpc.test.ts +++ b/src/tests/eosjs-jsonrpc.test.ts @@ -341,6 +341,29 @@ describe('JSON RPC', () => { expect(fetch).toBeCalledWith(endpoint + expPath, expParams); }); + it('calls get_scheduled_transactions', async () => { + const expPath = '/v1/chain/get_scheduled_transactions'; + const json = true; + const lowerBound = ''; + const limit = 50; + const expReturn = { data: '12345' }; + const expParams = { + body: JSON.stringify({ + json, + lower_bound: lowerBound, + limit, + }), + method: 'POST', + }; + + fetchMock.once(JSON.stringify(expReturn)); + + const response = await jsonRpc.get_scheduled_transactions(); + + expect(response).toEqual(expReturn); + expect(fetch).toBeCalledWith(endpoint + expPath, expParams); + }); + it('calls get_table_rows with all params', async () => { const expPath = '/v1/chain/get_table_rows'; const json = false;