This repository was archived by the owner on May 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +13
-70
lines changed Expand file tree Collapse file tree 5 files changed +13
-70
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,19 @@ for (const tx of batchResults) {
248
248
}
249
249
```
250
250
251
+ ### ` getTransactionStatus(txHash: string): Promise<RPCResponse<TransactionStatusObj> `
252
+
253
+ Returns the status of a specified transaction. This API is available from Zilliqa V7.0.0 onwards and supports all transaction statuses (unconfirmed, confirmed, and rejected).
254
+
255
+ ** Parameters**
256
+ - ` txHash ` : ` string ` - Specified TX id to check for the status.
257
+
258
+ ** Returns**
259
+
260
+ - ` Promise<RPCResponse<TransactionStatusObj> ` - Status code of the transaction. Refer to [ GetTransactionStatus] ( https://dev.zilliqa.com/docs/apis/api-transaction-get-transaction-status ) for the full list of status code.
261
+
262
+ * Note: This API is available only on https://api.zilliqa.com/ . It is disabled for community-hosted or private-hosted seed nodes.*
263
+
251
264
### ` getTxnBodiesForTxBlock(txBlock: number): Promise<RPCResponse<TransactionObj[], string>> `
252
265
253
266
Returns the validated transactions (in verbose form) included within a specified final transaction block.
Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ import {
25
25
DsBlockObj ,
26
26
GET_TX_ATTEMPTS ,
27
27
TransactionStatusObj ,
28
- TransactionStatus ,
29
- PendingTxns ,
30
28
Provider ,
31
29
RPCMethod ,
32
30
RPCResponse ,
@@ -649,31 +647,6 @@ export class Blockchain implements ZilliqaModule {
649
647
return this . provider . send < string , string > ( RPCMethod . GetMinimumGasPrice ) ;
650
648
}
651
649
652
- /**
653
- * getPendingTxns
654
- *
655
- * Returns the pending status of all unvalidated Transactions.
656
- *
657
- */
658
- async getPendingTxns ( ) : Promise < PendingTxns > {
659
- try {
660
- const response = await this . provider . send ( RPCMethod . GetPendingTxns ) ;
661
- if ( response . error ) {
662
- return Promise . reject ( response . error ) ;
663
- }
664
-
665
- if ( response . result . Txns . length ) {
666
- response . result . Txns . forEach ( ( txn : TransactionStatus ) => {
667
- txn . info = this . pendingErrorMap [ txn . code ] ;
668
- } ) ;
669
- }
670
-
671
- return response . result ;
672
- } catch ( err ) {
673
- throw err ;
674
- }
675
- }
676
-
677
650
/**
678
651
* getBalance
679
652
*
Original file line number Diff line number Diff line change @@ -308,37 +308,6 @@ describe('Module: Blockchain', () => {
308
308
expect ( result . statusMessage ) . toEqual ( 'Confirmed' ) ;
309
309
} ) ;
310
310
311
- it ( 'should receive pending transaction list' , async ( ) => {
312
- const responses = [
313
- {
314
- id : 1 ,
315
- jsonrpc : '2.0' ,
316
- result : {
317
- Txns : [
318
- {
319
- code : 1 ,
320
- TxnHash :
321
- 'ec5ef8110a285563d0104269081aa77820058067091a9b3f3ae70f38b94abda3' ,
322
- } ,
323
- ] ,
324
- } ,
325
- } ,
326
- ] . map ( ( res ) => [ JSON . stringify ( res ) ] as [ string ] ) ;
327
-
328
- fetch . mockResponses ( ...responses ) ;
329
- const result = await blockchain . getPendingTxns ( ) ;
330
- expect ( result . Txns ) . toBeDefined ( ) ;
331
- // @ts -ignore
332
- expect ( result . Txns ) . toEqual ( [
333
- {
334
- code : 1 ,
335
- TxnHash :
336
- 'ec5ef8110a285563d0104269081aa77820058067091a9b3f3ae70f38b94abda3' ,
337
- info : 'Pending - Dispatched' ,
338
- } ,
339
- ] ) ;
340
- } ) ;
341
-
342
311
it ( 'should receive miner info' , async ( ) => {
343
312
const responses = [
344
313
{
Original file line number Diff line number Diff line change @@ -58,8 +58,6 @@ export enum RPCMethod {
58
58
GetNumTxnsTxEpoch = 'GetNumTxnsTxEpoch' ,
59
59
GetNumTxnsDSEpoch = 'GetNumTxnsDSEpoch' ,
60
60
GetMinimumGasPrice = 'GetMinimumGasPrice' ,
61
- GetPendingTxn = 'GetPendingTxn' ,
62
- GetPendingTxns = 'GetPendingTxns' ,
63
61
64
62
// Contract-related methods
65
63
GetSmartContracts = 'GetSmartContracts' ,
Original file line number Diff line number Diff line change @@ -258,22 +258,12 @@ export interface EventParam {
258
258
value : any ;
259
259
}
260
260
261
- export interface PendingTxns {
262
- Txns : TransactionStatus [ ] ;
263
- }
264
-
265
261
export interface TransactionStatus {
266
262
code : number ;
267
263
TxnHash : string ;
268
264
info : string ;
269
265
}
270
266
271
- export interface PendingTxnResult {
272
- code : number ;
273
- confirmed : boolean ;
274
- pending : boolean ;
275
- }
276
-
277
267
export interface MinerInfo {
278
268
dscommittee : string [ ] ;
279
269
shards : ShardInfo [ ] ;
You can’t perform that action at this time.
0 commit comments