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

Add get_scheduled_transactions to jsonrpc #534

Merged
merged 2 commits into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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