Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #534 from conr2d/get-scheduled-transactions
Browse files Browse the repository at this point in the history
Add `get_scheduled_transactions` to jsonrpc
  • Loading branch information
jeffreyssmith2nd authored Apr 13, 2019
2 parents a2c7836 + 0bc28e9 commit e2045ab
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/eosjs-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> {
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,
Expand Down
23 changes: 23 additions & 0 deletions src/tests/eosjs-jsonrpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e2045ab

Please sign in to comment.