Skip to content

Commit 229d17b

Browse files
committed
fix: search with code query new params
1 parent eaed88c commit 229d17b

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

composables/search.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const transactionsByPactCodeQuery = `
8787
canonical
8888
chainId
8989
creationTime
90+
badResult
9091
gas
9192
gasLimit
9293
gasPrice
@@ -398,21 +399,16 @@ export function useSearch () {
398399

399400
const edges = codeResponse?.data?.transactionsByPactCode?.edges || [];
400401
if (currentQuery === data.query && edges.length) {
401-
// TEMP: convert unix seconds to ISO for creationTime until API returns ISO
402-
const toIso = (v: any): string => {
403-
if (typeof v === 'number') return new Date(v * 1000).toISOString();
404-
if (typeof v === 'string' && /^\d+$/.test(v)) return new Date(parseInt(v, 10) * 1000).toISOString();
405-
return new Date(v).toISOString();
406-
};
407-
408402
const codeItems = edges.map((edge: any) => {
409403
const n = edge.node;
410-
const resultString = '{"status":"success","badResult":null}';
404+
const resultString = (n?.badResult !== null && n?.badResult !== undefined)
405+
? `{"status":"error","badResult":${JSON.stringify(n.badResult)}}`
406+
: '{"status":"success","badResult":null}';
411407
return {
412408
requestkey: n.requestKey,
413409
chainId: n.chainId,
414410
height: n.height,
415-
creationTime: toIso(n.creationTime),
411+
creationTime: n.creationTime,
416412
result: resultString,
417413
};
418414
});

composables/useTransactionsByPactCode.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const GQL_QUERY = `
1616
canonical
1717
chainId
1818
creationTime
19+
badResult
1920
gas
2021
gasLimit
2122
gasPrice
@@ -91,22 +92,16 @@ export const useTransactionsByPactCode = () => {
9192
}
9293

9394
const rawTxs = result.edges;
94-
// TEMP: convert unix seconds to ISO until API returns ISO
95-
const toIso = (v: any): string => {
96-
if (typeof v === 'number') return new Date(v * 1000).toISOString();
97-
if (typeof v === 'string' && /^\d+$/.test(v)) return new Date(parseInt(v, 10) * 1000).toISOString();
98-
return new Date(v).toISOString();
99-
};
10095

10196
transactions.value = rawTxs.map((edge: any) => {
10297
const n = edge.node;
10398
return {
10499
requestKey: n.requestKey,
105100
height: n.height,
106101
canonical: n.canonical,
107-
badResult: null,
102+
badResult: n.badResult,
108103
chainId: n.chainId,
109-
time: formatRelativeTime(toIso(n.creationTime)),
104+
time: formatRelativeTime(n.creationTime),
110105
sender: n.sender,
111106
gasPrice: formatGasPrice(parseFloat(n.gasPrice)),
112107
rawGasPrice: n.gasPrice,

pages/transactions/[requestKey].vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ const formattedGasInfo = computed(() => {
329329
330330
// Execution Result badge mapping (Good/Bad)
331331
const executionResultBadge = computed(() => {
332+
console.log('transactionExecutionResult', transactionExecutionResult.value)
332333
if (!transactionExecutionResult?.value) return null
333334
if (transactionExecutionResult.value.type === 'badResult') {
334335
return {
@@ -783,11 +784,6 @@ onUnmounted(() => {
783784
<div class="flex-1 text-[#fafafa]">
784785
{{ transactionExecutionResult.value }}
785786
</div>
786-
<!-- <textarea
787-
readonly
788-
:value="transactionExecutionResult.value"
789-
class="flex-1 w-full min-w-0 bg-[#151515] border border-[#222222] rounded-lg text-[#bbbbbb] text-sm px-[10px] py-[8px] outline-none font-mono whitespace-pre-wrap overflow-auto break-all resize-none"
790-
></textarea> -->
791787
</div>
792788
</template>
793789
</LabelValue>

0 commit comments

Comments
 (0)