Skip to content

Commit

Permalink
/da/transaction and /batch/transacation too
Browse files Browse the repository at this point in the history
  • Loading branch information
shidaxi committed Dec 22, 2023
1 parent 867ec53 commit 44819a9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/data-transport-layer/src/services/server/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,16 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
this._registerRoute(
'get',
'/batch/transaction/index/:index',
async (req): Promise<TransactionBatchResponse> => {
async (req): Promise<[TransactionBatchResponse, HttpCodes]> => {
const batch = await this.state.db.getTransactionBatchByIndex(
BigNumber.from(req.params.index).toNumber()
)

if (batch === null) {
return {
return [{
batch: null,
transactions: [],
}
}, HttpCodes.NOT_FOUND]
}

const transactions =
Expand All @@ -591,10 +591,10 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
BigNumber.from(batch.size).toNumber()
)

return {
return [{
batch,
transactions,
}
}, HttpCodes.OK]
}
)

Expand Down Expand Up @@ -943,21 +943,21 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
this._registerRoute(
'get',
'/da/transaction/index/:index',
async (req): Promise<TransactionResponse> => {
async (req): Promise<[TransactionResponse, HttpCodes]> => {
const transactionEntry = await this.state.db.getDaTransactionByIndex(
BigNumber.from(req.params.index).toNumber()
)

if (transactionEntry === null) {
return {
return [{
transaction: null,
batch: null,
}
}, HttpCodes.NOT_FOUND]
}
return {
return [{
transaction: transactionEntry,
batch: null,
}
}, HttpCodes.OK]
}
)

Expand Down

0 comments on commit 44819a9

Please sign in to comment.