Skip to content

Commit 505e99e

Browse files
committed
wip
1 parent 742bae1 commit 505e99e

File tree

5 files changed

+60
-58
lines changed

5 files changed

+60
-58
lines changed

apps/dashboard/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PUBLIC_NETWORK_NAME=stokenet
1+
PUBLIC_NETWORK_NAME=mardunet
22
PUBLIC_APP_ENV=development
33
PUBLIC_AMPLITUDE_API_KEY=32eeaa0d2c0b5ae747777a2406be193d

apps/dashboard/src/lib/recent-transactions/RecentNetworkTransactions.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { getRecentNetworkTransactions } from '@api/_deprecated/gateway'
33
import PaginatedTable from '@components/_base/table/basic-table/PaginatedTable.svelte'
4-
import { createEventDispatcher, type ComponentProps } from 'svelte'
4+
import { type ComponentProps } from 'svelte'
55
import {
66
chevronColumnDefinition,
77
dateAndTxIdColumnDefinition,
@@ -20,7 +20,7 @@
2020
import InfoBar from '@components/info-bar/InfoBar.svelte'
2121
2222
export let queryFunction = (cursor?: string) =>
23-
getRecentNetworkTransactions(cursor).unwrapOr({
23+
getRecentNetworkTransactions({ cursor }).unwrapOr({
2424
items: []
2525
})
2626

apps/dashboard/src/lib/transaction-filters/TransactionFilters.svelte

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
export let affectedEntities: string[] = []
1414
export let transactionType: ManifestClass | undefined = undefined
1515
export let filterPanelOpen = false
16+
export let selectedTransactionStatus: { label: string; value: string } = {
17+
label: 'All',
18+
value: 'All'
19+
}
1620
1721
const dispatch = createEventDispatcher<{
1822
'apply-filters': string
@@ -68,13 +72,18 @@
6872
? `transactionType=${transactionType}`
6973
: undefined
7074
75+
const transactionStatusParam = selectedTransactionStatus
76+
? `transactionStatus=${selectedTransactionStatus.value}`
77+
: undefined
78+
7179
const params = [
7280
withdrawnFromParam,
7381
depositedToParam,
7482
badgesParam,
7583
resourcesParam,
7684
affectedEntitiesParam,
77-
transactionTypeParam
85+
transactionTypeParam,
86+
transactionStatusParam
7887
]
7988
.filter(Boolean)
8089
.join('&')
@@ -147,6 +156,17 @@
147156
]}
148157
/>
149158

159+
<OptionsFilter
160+
title="Transaction Status"
161+
description="Show only transactions with the selected status"
162+
bind:selected={selectedTransactionStatus}
163+
options={[
164+
{ label: 'Success', value: 'Success' },
165+
{ label: 'Failure', value: 'Failure' },
166+
{ label: 'All', value: 'All' }
167+
]}
168+
/>
169+
150170
<EntityFilterCard
151171
title="Withdrawn From Account"
152172
description="Show only transactions with withdrawals from these accounts"
@@ -167,7 +187,7 @@
167187

168188
<EntityFilterCard
169189
title="Resources"
170-
description="Shows only successful transactions which referenced this resource"
190+
description="Shows only transactions which resulted in a non-fee balance change of this resource"
171191
bind:values={resources}
172192
/>
173193

apps/dashboard/src/routes/+page.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { getRecentNetworkTransactions } from '@api/_deprecated/gateway'
22
import type { PageLoad } from './$types'
3-
import type {
4-
ManifestClass,
5-
StreamTransactionsRequestEventFilterItem
6-
} from '@radixdlt/babylon-gateway-api-sdk'
3+
import type { ManifestClass } from '@radixdlt/babylon-gateway-api-sdk'
74

85
export const load: PageLoad = async ({ url }) => {
96
const withdrawnFrom = url.searchParams.get('withdrawnFrom')?.split(',')
107
const depositedTo = url.searchParams.get('depositedTo')?.split(',')
8+
const transactionStatus = url.searchParams.get('transactionStatus') as
9+
| 'Success'
10+
| 'Failure'
11+
| 'All'
12+
| undefined
1113
const badges = url.searchParams.get('badges')?.split(',')
1214
const resources = url.searchParams.get('resources')?.split(',')
1315
const affectedEntities = url.searchParams.get('affectedEntities')?.split(',')
@@ -16,14 +18,18 @@ export const load: PageLoad = async ({ url }) => {
1618
| undefined
1719

1820
const queryFn = (cursor?: string) =>
19-
getRecentNetworkTransactions(cursor, {
20-
withdrawnFrom,
21-
depositedTo,
22-
badges,
23-
resources,
24-
affectedEntities,
25-
transactionType
26-
}).unwrapOr({
21+
getRecentNetworkTransactions(
22+
{ cursor },
23+
{
24+
withdrawnFrom,
25+
depositedTo,
26+
badges,
27+
transactionStatus,
28+
resources,
29+
affectedEntities,
30+
transactionType
31+
}
32+
).unwrapOr({
2733
items: []
2834
})
2935

packages/ui/src/api/_deprecated/gateway.ts

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ManifestClass,
1212
StreamTransactionsRequestEventFilterItemEventEnum
1313
} from '@common/gateway-sdk'
14+
import { get } from 'svelte/store'
1415

1516
export const gatewayApi = GatewayApiClient.initialize({
1617
applicationName: 'Radix Dashboard',
@@ -71,29 +72,33 @@ export const callApi = <T extends keyof typeof api>(
7172
> => fromPromise((api[methodName] as any)(...args), handleError)
7273

7374
export const getRecentTransactions = (
74-
address: string,
75+
address?: string,
7576
cursor?: string,
7677
filters?: {
7778
withdrawnFrom?: string[]
7879
depositedTo?: string[]
7980
badges?: string[]
8081
resources?: string[]
82+
transactionStatus?: 'Success' | 'Failure' | 'All'
8183
affectedEntities?: string[]
8284
transactionType?: ManifestClass
8385
}
8486
) =>
8587
gatewayApi.stream.innerClient.streamTransactions({
8688
streamTransactionsRequest: {
87-
affected_global_entities_filter: [
88-
address,
89-
...(filters?.affectedEntities ?? [])
90-
],
9189
cursor,
90+
limit_per_page: 15,
9291
opt_ins: {
92+
receipt_output: false,
9393
balance_changes: true
9494
},
9595
manifest_badges_presented_filter: filters?.badges,
96-
manifest_resources_filter: filters?.resources,
96+
transaction_status_filter: filters?.transactionStatus,
97+
balance_change_resources: filters?.resources,
98+
affected_global_entities_filter: [
99+
...(address ? [address] : []),
100+
...(filters?.affectedEntities ?? [])
101+
],
97102
events_filter:
98103
filters?.withdrawnFrom || filters?.depositedTo
99104
? [
@@ -119,51 +124,22 @@ export const getRecentTransactions = (
119124
})
120125

121126
export const getRecentNetworkTransactions = (
122-
cursor?: string,
127+
input: {
128+
cursor?: string,
129+
address?: string
130+
} = {},
123131
filters?: {
124132
withdrawnFrom?: string[]
125133
depositedTo?: string[]
126134
badges?: string[]
127135
resources?: string[]
136+
transactionStatus?: 'Success' | 'Failure' | 'All'
128137
affectedEntities?: string[]
129138
transactionType?: ManifestClass
130139
}
131140
) =>
132141
fromPromise(
133-
gatewayApi.stream.innerClient.streamTransactions({
134-
streamTransactionsRequest: {
135-
cursor,
136-
limit_per_page: 15,
137-
opt_ins: {
138-
receipt_output: false,
139-
balance_changes: true
140-
},
141-
manifest_badges_presented_filter: filters?.badges,
142-
manifest_resources_filter: filters?.resources,
143-
affected_global_entities_filter: filters?.affectedEntities,
144-
events_filter:
145-
filters?.withdrawnFrom || filters?.depositedTo
146-
? [
147-
...(filters?.withdrawnFrom || []).map((address) => ({
148-
event:
149-
StreamTransactionsRequestEventFilterItemEventEnum.Withdrawal,
150-
address
151-
})),
152-
...(filters?.depositedTo || []).map((address) => ({
153-
event:
154-
StreamTransactionsRequestEventFilterItemEventEnum.Deposit,
155-
address
156-
}))
157-
]
158-
: undefined,
159-
manifest_class_filter: filters?.transactionType
160-
? {
161-
_class: filters?.transactionType,
162-
match_only_most_specific: true
163-
}
164-
: undefined
165-
}
166-
}),
142+
getRecentTransactions(input.address, input.cursor, filters),
167143
handleError
168144
)
169145

0 commit comments

Comments
 (0)