Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit a87ad0e

Browse files
authored
Merge pull request #82 from ckb-cell/fix/rgbpp-transaction-bug
fix: fix the issue of looking up ckb transactions by txid
2 parents 8201013 + 29bd087 commit a87ad0e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

backend/src/modules/rgbpp/transaction/transaction.service.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class RgbppTransactionService {
2121
private ckbRpcService: CkbRpcWebsocketService,
2222
private bitcoinApiService: BitcoinApiService,
2323
private configService: ConfigService<Env>,
24-
) {}
24+
) { }
2525

2626
public async getLatestTransactions(
2727
page: number,
@@ -61,17 +61,23 @@ export class RgbppTransactionService {
6161
},
6262
script_type: 'lock',
6363
},
64-
'desc',
64+
'asc',
6565
'0x64',
6666
);
6767
}),
6868
);
6969
for (const ckbTx of ckbTxs) {
70-
if (ckbTx.objects.length > 0) {
71-
const [tx] = ckbTx.objects;
70+
if (ckbTx.objects.length === 0) {
71+
continue;
72+
}
73+
74+
for (const tx of ckbTx.objects) {
7275
const response = await this.ckbExplorerService.getTransaction(tx.tx_hash);
7376
if (response.data.attributes.is_rgb_transaction) {
74-
return RgbppTransaction.fromCkbTransaction(response.data.attributes);
77+
const rgbppTx = RgbppTransaction.fromCkbTransaction(response.data.attributes);
78+
if (rgbppTx.btcTxid === txid) {
79+
return rgbppTx;
80+
}
7581
}
7682
}
7783
}

0 commit comments

Comments
 (0)