Skip to content

Commit acdaa58

Browse files
committed
refactor: rename "ckbRawTx" to "ckbVirtualTx" in the IsomorphicTransaction type
1 parent 7d7a32f commit acdaa58

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/routes/rgbpp/address.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ const addressRoutes: FastifyPluginCallback<Record<never, never>, Server, ZodType
281281

282282
async function getIsomorphicTx(btcTx: BTCTransaction) {
283283
const isomorphicTx: IsomorphicTransaction = {
284-
ckbRawTx: undefined,
284+
ckbVirtualTx: undefined,
285285
ckbTx: undefined,
286286
status: { confirmed: false },
287287
};
@@ -293,13 +293,13 @@ const addressRoutes: FastifyPluginCallback<Record<never, never>, Server, ZodType
293293
const job = await fastify.transactionProcessor.getTransactionRequest(btcTx.txid);
294294
if (job) {
295295
const { ckbRawTx } = job.data.ckbVirtualResult;
296-
isomorphicTx.ckbRawTx = ckbRawTx;
296+
isomorphicTx.ckbVirtualTx = ckbRawTx;
297297
// if the job is completed, get the ckb tx hash and fetch the ckb tx
298298
const state = await job.getState();
299299
if (state === 'completed') {
300300
const ckbTx = await fastify.ckb.rpc.getTransaction(job.returnvalue);
301301
// remove ckbRawTx to reduce response size
302-
isomorphicTx.ckbRawTx = undefined;
302+
isomorphicTx.ckbVirtualTx = undefined;
303303
setCkbTxAndStatus(ckbTx);
304304
}
305305
return isomorphicTx;
@@ -381,19 +381,19 @@ const addressRoutes: FastifyPluginCallback<Record<never, never>, Server, ZodType
381381
let txs = await Promise.all(
382382
btcTxs.map(async (btcTx) => {
383383
const isomorphicTx = await getIsomorphicTx(btcTx);
384-
const isRgbpp = isomorphicTx.ckbRawTx || isomorphicTx.ckbTx;
384+
const isRgbpp = isomorphicTx.ckbVirtualTx || isomorphicTx.ckbTx;
385385
if (!isRgbpp) {
386386
return {
387387
btcTx,
388388
isRgbpp: false,
389389
} as const;
390390
}
391391

392-
const inputs = isomorphicTx.ckbRawTx?.inputs || isomorphicTx.ckbTx?.inputs || [];
392+
const inputs = isomorphicTx.ckbVirtualTx?.inputs || isomorphicTx.ckbTx?.inputs || [];
393393
const inputCells = await fastify.ckb.getInputCellsByOutPoint(inputs.map((input) => input.previousOutput!));
394394
const inputCellOutputs = inputCells.map((cell) => cell.cellOutput);
395395

396-
const outputs = isomorphicTx.ckbRawTx?.outputs || isomorphicTx.ckbTx?.outputs || [];
396+
const outputs = isomorphicTx.ckbVirtualTx?.outputs || isomorphicTx.ckbTx?.outputs || [];
397397

398398
return {
399399
btcTx,

src/routes/rgbpp/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const XUDTBalance = XUDTTypeInfo.merge(
114114
export type XUDTBalance = z.infer<typeof XUDTBalance>;
115115

116116
export const IsomorphicTransaction = z.object({
117-
ckbRawTx: CKBRawTransaction.optional(),
117+
ckbVirtualTx: CKBRawTransaction.optional(),
118118
ckbTx: CKBTransaction.optional(),
119119
inputs: z.array(OutputCell).optional(),
120120
outputs: z.array(OutputCell).optional(),

0 commit comments

Comments
 (0)