Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { getRecentNetworkTransactions } from '@api/_deprecated/gateway'
import PaginatedTable from '@components/_base/table/basic-table/PaginatedTable.svelte'
import { createEventDispatcher, type ComponentProps } from 'svelte'
import { type ComponentProps } from 'svelte'
import {
chevronColumnDefinition,
dateAndTxIdColumnDefinition,
Expand All @@ -20,7 +20,7 @@
import InfoBar from '@components/info-bar/InfoBar.svelte'

export let queryFunction = (cursor?: string) =>
getRecentNetworkTransactions(cursor).unwrapOr({
getRecentNetworkTransactions({ cursor }).unwrapOr({
items: []
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
export let affectedEntities: string[] = []
export let transactionType: ManifestClass | undefined = undefined
export let filterPanelOpen = false
export let selectedTransactionStatus: { label: string; value: string } = {
label: 'All',
value: 'All'
}

const dispatch = createEventDispatcher<{
'apply-filters': string
Expand Down Expand Up @@ -68,13 +72,18 @@
? `transactionType=${transactionType}`
: undefined

const transactionStatusParam = selectedTransactionStatus
? `transactionStatus=${selectedTransactionStatus.value}`
: undefined

const params = [
withdrawnFromParam,
depositedToParam,
badgesParam,
resourcesParam,
affectedEntitiesParam,
transactionTypeParam
transactionTypeParam,
transactionStatusParam
]
.filter(Boolean)
.join('&')
Expand Down Expand Up @@ -147,6 +156,17 @@
]}
/>

<OptionsFilter
title="Transaction Status"
description="Show only transactions with the selected status"
bind:selected={selectedTransactionStatus}
options={[
{ label: 'Success', value: 'Success' },
{ label: 'Failure', value: 'Failure' },
{ label: 'All', value: 'All' }
]}
/>

<EntityFilterCard
title="Withdrawn From Account"
description="Show only transactions with withdrawals from these accounts"
Expand All @@ -167,7 +187,7 @@

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

Expand Down
30 changes: 18 additions & 12 deletions apps/dashboard/src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { getRecentNetworkTransactions } from '@api/_deprecated/gateway'
import type { PageLoad } from './$types'
import type {
ManifestClass,
StreamTransactionsRequestEventFilterItem
} from '@radixdlt/babylon-gateway-api-sdk'
import type { ManifestClass } from '@radixdlt/babylon-gateway-api-sdk'

export const load: PageLoad = async ({ url }) => {
const withdrawnFrom = url.searchParams.get('withdrawnFrom')?.split(',')
const depositedTo = url.searchParams.get('depositedTo')?.split(',')
const transactionStatus = url.searchParams.get('transactionStatus') as
| 'Success'
| 'Failure'
| 'All'
| undefined
const badges = url.searchParams.get('badges')?.split(',')
const resources = url.searchParams.get('resources')?.split(',')
const affectedEntities = url.searchParams.get('affectedEntities')?.split(',')
Expand All @@ -16,14 +18,18 @@ export const load: PageLoad = async ({ url }) => {
| undefined

const queryFn = (cursor?: string) =>
getRecentNetworkTransactions(cursor, {
withdrawnFrom,
depositedTo,
badges,
resources,
affectedEntities,
transactionType
}).unwrapOr({
getRecentNetworkTransactions(
{ cursor },
{
withdrawnFrom,
depositedTo,
badges,
transactionStatus,
resources,
affectedEntities,
transactionType
}
).unwrapOr({
items: []
})

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@floating-ui/dom": "^1.5.3",
"@radixdlt/babylon-core-api-sdk": "^1.2.3",
"@radixdlt/babylon-gateway-api-sdk": "^1.8.1",
"@radixdlt/babylon-gateway-api-sdk": "^1.10.1",
"@radixdlt/radix-dapp-toolkit": "^2.2.1",
"@radixdlt/radix-engine-toolkit": "^1.0.5",
"@radixdlt/rola": "^2.1.0",
Expand Down
58 changes: 17 additions & 41 deletions packages/ui/src/api/_deprecated/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ManifestClass,
StreamTransactionsRequestEventFilterItemEventEnum
} from '@common/gateway-sdk'
import { get } from 'svelte/store'

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

export const getRecentTransactions = (
address: string,
address?: string,
cursor?: string,
filters?: {
withdrawnFrom?: string[]
depositedTo?: string[]
badges?: string[]
resources?: string[]
transactionStatus?: 'Success' | 'Failure' | 'All'
affectedEntities?: string[]
transactionType?: ManifestClass
}
) =>
gatewayApi.stream.innerClient.streamTransactions({
streamTransactionsRequest: {
affected_global_entities_filter: [
address,
...(filters?.affectedEntities ?? [])
],
cursor,
limit_per_page: 15,
opt_ins: {
receipt_output: false,
balance_changes: true
},
manifest_badges_presented_filter: filters?.badges,
manifest_resources_filter: filters?.resources,
transaction_status_filter: filters?.transactionStatus,
balance_change_resources_filter: filters?.resources,
affected_global_entities_filter: [
...(address ? [address] : []),
...(filters?.affectedEntities ?? [])
],
events_filter:
filters?.withdrawnFrom || filters?.depositedTo
? [
Expand All @@ -119,51 +124,22 @@ export const getRecentTransactions = (
})

export const getRecentNetworkTransactions = (
cursor?: string,
input: {
cursor?: string
address?: string
} = {},
filters?: {
withdrawnFrom?: string[]
depositedTo?: string[]
badges?: string[]
resources?: string[]
transactionStatus?: 'Success' | 'Failure' | 'All'
affectedEntities?: string[]
transactionType?: ManifestClass
}
) =>
fromPromise(
gatewayApi.stream.innerClient.streamTransactions({
streamTransactionsRequest: {
cursor,
limit_per_page: 15,
opt_ins: {
receipt_output: false,
balance_changes: true
},
manifest_badges_presented_filter: filters?.badges,
manifest_resources_filter: filters?.resources,
affected_global_entities_filter: filters?.affectedEntities,
events_filter:
filters?.withdrawnFrom || filters?.depositedTo
? [
...(filters?.withdrawnFrom || []).map((address) => ({
event:
StreamTransactionsRequestEventFilterItemEventEnum.Withdrawal,
address
})),
...(filters?.depositedTo || []).map((address) => ({
event:
StreamTransactionsRequestEventFilterItemEventEnum.Deposit,
address
}))
]
: undefined,
manifest_class_filter: filters?.transactionType
? {
_class: filters?.transactionType,
match_only_most_specific: true
}
: undefined
}
}),
getRecentTransactions(input.address, input.cursor, filters),
handleError
)

Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/api/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ export const isAllowed =

const getEntryInfo = (entry: ComponentEntityRoleAssignmentEntry) => {
const assignment = entry.assignment
const rule = assignment.explicit_rule as AccessRule | undefined
const rule =
assignment.resolution === 'Explicit' &&
(assignment.explicit_rule as AccessRule | undefined)

const roleKey = entry.role_key.name
const module = entry.role_key.module
Expand Down
Loading