-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2655 from princesinha19/pending_transaction
getPendingTransactions implemented in web3-core-methods
- Loading branch information
Showing
7 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/web3-core-method/src/methods/transaction/GetPendingTransactionsMethod.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
This file is part of web3.js. | ||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/** | ||
* @file GetPendingTransactionsMethod.js | ||
* @author Prince Sinha <sinhaprince013@gmail.com> | ||
* @date 2018 | ||
*/ | ||
|
||
import AbstractMethod from '../../../lib/methods/AbstractMethod'; | ||
|
||
export default class GetPendingTransactionsMethod extends AbstractMethod { | ||
/** | ||
* @param {Utils} utils | ||
* @param {Object} formatters | ||
* @param {AbstractWeb3Module} moduleInstance | ||
* | ||
* @constructor | ||
*/ | ||
constructor(utils, formatters, moduleInstance) { | ||
super('eth_pendingTransactions', 0, utils, formatters, moduleInstance); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/web3-core-method/tests/src/methods/transaction/GetPendingTransactionsMethodTest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {formatters} from 'web3-core-helpers'; | ||
import AbstractMethod from '../../../../lib/methods/AbstractMethod'; | ||
import GetPendingTransactionsMethod from '../../../../src/methods/transaction/GetPendingTransactionsMethod'; | ||
|
||
// Mocks | ||
jest.mock('web3-core-helpers'); | ||
|
||
/** | ||
* GetPendingTransactionsMethod test | ||
*/ | ||
describe('GetPendingTransactionsMethodTest', () => { | ||
let method; | ||
|
||
beforeEach(() => { | ||
method = new GetPendingTransactionsMethod(null, formatters, {}); | ||
}); | ||
|
||
it('constructor check', () => { | ||
expect(method).toBeInstanceOf(AbstractMethod); | ||
|
||
expect(method.rpcMethod).toEqual('eth_pendingTransactions'); | ||
|
||
expect(method.parametersAmount).toEqual(0); | ||
|
||
expect(method.utils).toEqual(null); | ||
|
||
expect(method.formatters).toEqual(formatters); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters