Skip to content

Commit a8ac319

Browse files
n8mgrn8maninger
authored andcommitted
add on click for transaction list
1 parent de5a76e commit a8ac319

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

src/api/siacentral.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { sendJSONRequest } from './common';
22

33
const WALLETD_BASE_URL = 'https://api.siascan.com/wallet';
4+
const EXPLORED_BASE_URL = 'https://api.siascan.com';
45

56
export async function broadcastTransaction(txns, v2txns) {
67
const { statusCode, body } = await sendJSONRequest(`${WALLETD_BASE_URL}/txpool/broadcast`, {
@@ -40,4 +41,14 @@ export async function tpoolEvents() {
4041
if (statusCode !== 200)
4142
throw new Error(body || 'Failed to get transaction pool');
4243
return body;
44+
}
45+
46+
export async function search(id) {
47+
const { statusCode, body } = await sendJSONRequest(`${EXPLORED_BASE_URL}/search/${id}`, {
48+
method: 'GET'
49+
});
50+
if (statusCode !== 200)
51+
throw new Error(body || 'Failed to search for ID');
52+
53+
return body;
4354
}

src/components/transactions/TransactionListItem.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<tr :class="transactionClass" @click="$emit('click')">
2+
<tr :class="transactionClass" @click="openSiaScan">
33
<td class="transaction-type fit-text">{{ displayType }}</td>
44
<td class="transaction-spacer" />
55
<td class="transaction-confirms fit-text"><span>{{ displayConfirmations }}</span></td>
@@ -15,6 +15,7 @@
1515
import BigNumber from 'bignumber.js';
1616
import { mapState } from 'vuex';
1717
import { formatPriceString, formatSiafundString } from '@/utils/format';
18+
import { search } from '@/api/siacentral';
1819
1920
export default {
2021
props: {
@@ -145,6 +146,22 @@ export default {
145146
classes[`value-${direction}`] = true;
146147
return classes;
147148
}
149+
},
150+
methods: {
151+
async openSiaScan() {
152+
if (!this.transaction || !this.transaction.id)
153+
return;
154+
155+
const res = await search(this.transaction.id);
156+
switch (res) {
157+
case 'siacoinElement':
158+
window.open(`https://siascan.com/output/${this.transaction.id}`, '_blank');
159+
break;
160+
default:
161+
window.open(`https://siascan.com/tx/${this.transaction.id}`, '_blank');
162+
break;
163+
}
164+
}
148165
}
149166
};
150167
</script>

src/components/wallet/WalletDisplay.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
<transaction-list-item v-for="(transaction, i) in group.transactions"
5252
:key="`${group.date}-${i}`"
5353
:transaction="transaction"
54-
:wallet="wallet"
55-
@click="onSelectTransaction(transaction.transaction_id)" />
54+
:wallet="wallet" />
5655
</template>
5756
</tbody>
5857
</table>
@@ -230,8 +229,6 @@ export default {
230229
},
231230
methods: {
232231
...mapActions(['deleteWallet']),
233-
onSelectTransaction(id) {
234-
},
235232
onQueueWallet() {
236233
try {
237234
this.queueWallet(this.wallet.id, true);

src/translation/languages/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
"contractExpiration": "Contract Expiration",
200200
"contractResolution": "Contract Resolution",
201201
"hostAnnouncement": "Host Announcement",
202-
"contractCompleted": "Contract Completion",
202+
"contractCompleted": "Contract Payout",
203203
"blockReward": "Block Reward",
204204
"siacoinTransaction": "Siacoin Transaction",
205205
"siafundTransaction": "Siafund Transaction",

wasm/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ func getWalletTransactions(w *api.Client, addresses []types.Address) ([]processe
611611
if data.Missed {
612612
processed.Tags = append(processed.Tags, "contract_missed_output")
613613
} else {
614-
processed.Tags = append(processed.Tags, "contract_renewal")
614+
processed.Tags = append(processed.Tags, "contract_valid_output")
615615
}
616616
processed.SiacoinOutputs = data.SiacoinElement.SiacoinOutput.Value
617617
case wallet.EventPayout:

0 commit comments

Comments
 (0)