Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions composables/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const transactionsByPactCodeQuery = `
canonical
chainId
creationTime
badResult
gas
gasLimit
gasPrice
Expand Down Expand Up @@ -398,21 +399,16 @@ export function useSearch () {

const edges = codeResponse?.data?.transactionsByPactCode?.edges || [];
if (currentQuery === data.query && edges.length) {
// TEMP: convert unix seconds to ISO for creationTime until API returns ISO
const toIso = (v: any): string => {
if (typeof v === 'number') return new Date(v * 1000).toISOString();
if (typeof v === 'string' && /^\d+$/.test(v)) return new Date(parseInt(v, 10) * 1000).toISOString();
return new Date(v).toISOString();
};

const codeItems = edges.map((edge: any) => {
const n = edge.node;
const resultString = '{"status":"success","badResult":null}';
const resultString = (n?.badResult !== null && n?.badResult !== undefined)
? `{"status":"error","badResult":${JSON.stringify(n.badResult)}}`
: '{"status":"success","badResult":null}';
return {
requestkey: n.requestKey,
chainId: n.chainId,
height: n.height,
creationTime: toIso(n.creationTime),
creationTime: n.creationTime,
result: resultString,
};
});
Expand Down
11 changes: 3 additions & 8 deletions composables/useTransactionsByPactCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const GQL_QUERY = `
canonical
chainId
creationTime
badResult
gas
gasLimit
gasPrice
Expand Down Expand Up @@ -91,22 +92,16 @@ export const useTransactionsByPactCode = () => {
}

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

transactions.value = rawTxs.map((edge: any) => {
const n = edge.node;
return {
requestKey: n.requestKey,
height: n.height,
canonical: n.canonical,
badResult: null,
badResult: n.badResult,
chainId: n.chainId,
time: formatRelativeTime(toIso(n.creationTime)),
time: formatRelativeTime(n.creationTime),
sender: n.sender,
gasPrice: formatGasPrice(parseFloat(n.gasPrice)),
rawGasPrice: n.gasPrice,
Expand Down
6 changes: 1 addition & 5 deletions pages/transactions/[requestKey].vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ const formattedGasInfo = computed(() => {

// Execution Result badge mapping (Good/Bad)
const executionResultBadge = computed(() => {
console.log('transactionExecutionResult', transactionExecutionResult.value)
if (!transactionExecutionResult?.value) return null
if (transactionExecutionResult.value.type === 'badResult') {
return {
Expand Down Expand Up @@ -783,11 +784,6 @@ onUnmounted(() => {
<div class="flex-1 text-[#fafafa]">
{{ transactionExecutionResult.value }}
</div>
<!-- <textarea
readonly
:value="transactionExecutionResult.value"
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"
></textarea> -->
</div>
</template>
</LabelValue>
Expand Down