@@ -997,11 +997,13 @@ export class ChainRpc {
997997 * Gets pending transactions that have the insertion timestamp within the given range.
998998 * @param from The lower bound of the insertion timestamp.
999999 * @param to The upper bound of the insertion timestamp.
1000+ * @param futureIncluded Including the future transactions. If true, future transactions are included.
10001001 * @returns List of SignedTransaction, with each tx has null for blockNumber/blockHash/transactionIndex.
10011002 */
10021003 public getPendingTransactions (
10031004 from ?: number | null ,
1004- to ?: number | null
1005+ to ?: number | null ,
1006+ futureIncluded : boolean = false
10051007 ) : Promise < {
10061008 transactions : SignedTransaction [ ] ;
10071009 lastTimestamp : number | null ;
@@ -1017,11 +1019,21 @@ export class ChainRpc {
10171019 `Expected the second argument of getPendingTransactions to be a non-negative integer but found ${ to } `
10181020 ) ;
10191021 }
1022+ if ( typeof futureIncluded !== "boolean" ) {
1023+ throw Error (
1024+ `Expected the third argument to be a boolean but found ${ futureIncluded } `
1025+ ) ;
1026+ }
1027+
10201028 return new Promise ( ( resolve , reject ) => {
10211029 this . rpc
1022- . sendRpcRequest ( "mempool_getPendingTransactions" , [ from , to ] , {
1023- fallbackServers
1024- } )
1030+ . sendRpcRequest (
1031+ "mempool_getPendingTransactions" ,
1032+ [ from , to , futureIncluded ] ,
1033+ {
1034+ fallbackServers
1035+ }
1036+ )
10251037 . then ( result => {
10261038 try {
10271039 const resultTransactions = result . transactions ;
@@ -1363,11 +1375,13 @@ export class ChainRpc {
13631375 * Gets the count of the pending transactions within the given range from the transaction queues.
13641376 * @param from The lower bound of collected pending transactions. If null, there is no lower bound.
13651377 * @param to The upper bound of collected pending transactions. If null, there is no upper bound.
1378+ * @param futureIncluded Counting the future transactions. If true, future transactions are counted.
13661379 * @returns The count of the pending transactions.
13671380 */
13681381 public getPendingTransactionsCount (
13691382 from ?: number | null ,
1370- to ?: number | null
1383+ to ?: number | null ,
1384+ futureIncluded : boolean = false
13711385 ) : Promise < number > {
13721386 const fallbackServers = this . fallbackServers ;
13731387 if ( from != null && ! isNonNegativeInterger ( from ) ) {
@@ -1380,11 +1394,16 @@ export class ChainRpc {
13801394 `Expected the second argument of getPendingTransactions to be a non-negative integer but found ${ to } `
13811395 ) ;
13821396 }
1397+ if ( typeof futureIncluded !== "boolean" ) {
1398+ throw Error (
1399+ `Expected the third argument to be a boolean but found ${ futureIncluded } `
1400+ ) ;
1401+ }
13831402 return new Promise ( ( resolve , reject ) => {
13841403 this . rpc
13851404 . sendRpcRequest (
13861405 "mempool_getPendingTransactionsCount" ,
1387- [ from , to ] ,
1406+ [ from , to , futureIncluded ] ,
13881407 { fallbackServers }
13891408 )
13901409 . then ( result => {
0 commit comments