Skip to content

Commit 4df9b84

Browse files
Added Heartbeat transaction (#376)
* feat: spike adding heartbeat mappers * chore: testing and extending heartbeat support * chore: added testing for heartbeat txn * chore: support heartbeats in block polling via subscriber * fix: failed heartbeat test and updated color * fix: Updated missing heartbeat txn types * fix: Updated fixture to newScope and fixed description assertion values --------- Co-authored-by: Neil Campbell <[email protected]>
1 parent 9aaa373 commit 4df9b84

30 files changed

+699
-46
lines changed

package-lock.json

Lines changed: 13 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"postinstall": "patch-package"
2525
},
2626
"dependencies": {
27-
"@algorandfoundation/algokit-subscriber": "^2.1.0",
27+
"@algorandfoundation/algokit-subscriber": "^2.2.0",
2828
"@algorandfoundation/algokit-utils": "^7.0.0",
2929
"@auth0/auth0-react": "^2.2.4",
3030
"@blockshake/defly-connect": "^1.1.6",
@@ -60,7 +60,7 @@
6060
"@txnlab/use-wallet": "^3.11.0",
6161
"@txnlab/use-wallet-react": "^3.11.0",
6262
"@xstate/react": "^4.1.1",
63-
"algosdk": "2.9.0",
63+
"algosdk": "2.10.0",
6464
"class-variance-authority": "^0.7.0",
6565
"clsx": "^2.1.0",
6666
"cmdk": "^1.0.0",
@@ -197,4 +197,4 @@
197197
"ws@>7.0.0 <7.5.9": "7.5.10",
198198
"path-to-regexp@>= 0.2.0 <8.0.0": "8.0.0"
199199
}
200-
}
200+
}

src/features/app-interfaces/pages/create-app-interface-page.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getByRole } from '@testing-library/react'
1717

1818
describe('create-app-interface', () => {
1919
const localnet = algorandFixture()
20-
beforeEach(localnet.beforeEach, 10e6)
20+
beforeEach(localnet.newScope, 10e6)
2121
afterEach(() => {
2222
vitest.clearAllMocks()
2323
})

src/features/applications/components/application-method-definitions.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('application-method-definitions', () => {
3232
const localnet = algorandFixture()
3333
let appId: ApplicationId
3434

35-
beforeEach(localnet.beforeEach, 10e6)
35+
beforeEach(localnet.newScope, 10e6)
3636
afterEach(() => {
3737
vitest.clearAllMocks()
3838
})

src/features/applications/pages/application-page-localnet.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('application-page on localnet', () => {
2020
vitest.clearAllMocks()
2121
})
2222

23-
beforeEach(localnet.beforeEach, 10e6)
23+
beforeEach(localnet.newScope, 10e6)
2424
afterEach(() => {
2525
vitest.clearAllMocks()
2626
})

src/features/common/components/badge.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import { cva, type VariantProps } from 'class-variance-authority'
33
import { cn } from '@/features/common/utils'
4-
import { CircleDollarSign, SquareArrowRight, Bolt, Snowflake, ShieldCheck, Key, Parentheses } from 'lucide-react'
4+
import { CircleDollarSign, SquareArrowRight, Bolt, Snowflake, ShieldCheck, Key, Parentheses, HeartPulse } from 'lucide-react'
55
import { TransactionType } from '@/features/transactions/models'
66

77
const badgeVariants = cva(
@@ -20,6 +20,7 @@ const badgeVariants = cva(
2020
[TransactionType.AssetFreeze]: 'border-transparent bg-asset-freeze text-primary-foreground',
2121
[TransactionType.StateProof]: 'border-transparent bg-state-proof text-primary-foreground',
2222
[TransactionType.KeyReg]: 'border-transparent bg-key-registration text-primary-foreground',
23+
[TransactionType.Heartbeat]: 'border-transparent bg-heartbeat text-primary-foreground',
2324
},
2425
},
2526
defaultVariants: {
@@ -40,6 +41,7 @@ const transactionTypeBadgeIcon = new Map([
4041
[TransactionType.AssetFreeze.toString(), <Snowflake className={iconClasses} />],
4142
[TransactionType.StateProof.toString(), <ShieldCheck className={iconClasses} />],
4243
[TransactionType.KeyReg.toString(), <Key className={iconClasses} />],
44+
[TransactionType.Heartbeat.toString(), <HeartPulse className={iconClasses} />],
4345
])
4446

4547
function Badge({ className, variant, children, ...props }: BadgeProps) {

src/features/transaction-wizard/transaction-wizard-page.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { groupSendResultsLabel } from './components/group-send-results'
1212

1313
describe('transaction-wizard-page', () => {
1414
const localnet = algorandFixture()
15-
beforeEach(localnet.beforeEach, 10e6)
15+
beforeEach(localnet.newScope, 10e6)
1616
afterEach(() => {
1717
vitest.clearAllMocks()
1818
})

src/features/transaction-wizard/utils/transactions-url-search-params.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const renderTxnsWizardPageWithSearchParams = ({ searchParams }: { searchParams:
2727

2828
describe('Render transactions page with search params', () => {
2929
const localnet = algorandFixture()
30-
beforeEach(localnet.beforeEach, 10e6)
30+
beforeEach(localnet.newScope, 10e6)
3131
afterEach(() => {
3232
vitest.clearAllMocks()
3333
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<div>
2+
<div
3+
aria-label="Visual representation of transactions"
4+
class="w-min bg-card"
5+
>
6+
<div
7+
class="relative grid"
8+
style="grid-template-columns: minmax(100px, 100px) repeat(1, 140px);"
9+
>
10+
<div />
11+
<div
12+
class="p-2 flex justify-center"
13+
>
14+
<div
15+
class="text-l font-semibold w-full"
16+
>
17+
<div
18+
class="grid text-center"
19+
>
20+
<div
21+
class="flex gap-0.5 items-center justify-center overflow-hidden"
22+
>
23+
<div
24+
class="shrink-0 basis-4"
25+
/>
26+
<div
27+
class="flex items-center overflow-hidden"
28+
>
29+
<a
30+
class="text-primary underline truncate"
31+
href="/localnet/account/HEARTBEATADDRESS123456789ABCDEFGHIJKLMNOPQRSTUVW"
32+
>
33+
<abbr
34+
class="tracking-wide"
35+
title="HEARTBEATADDRESS123456789ABCDEFGHIJKLMNOPQRSTUVW"
36+
>
37+
HEAR…TUVW
38+
</abbr>
39+
</a>
40+
</div>
41+
<div
42+
class="shrink-0 basis-4"
43+
>
44+
<div
45+
class="flex size-4 items-center justify-center overflow-hidden rounded-full border border-primary text-[0.6rem] text-primary"
46+
>
47+
1
48+
</div>
49+
</div>
50+
</div>
51+
</div>
52+
</div>
53+
</div>
54+
</div>
55+
<div
56+
class="relative grid"
57+
style="grid-template-columns: minmax(100px, 100px) repeat(1, 140px); grid-template-rows: repeat(1, 40px);"
58+
>
59+
<div
60+
class="absolute left-0"
61+
>
62+
<div>
63+
<div
64+
class="p-0"
65+
/>
66+
<div
67+
class="p-0"
68+
style="height: 40px; width: 140px;"
69+
>
70+
<div
71+
class="grid h-full"
72+
style="grid-template-columns: minmax(100px, 100px) repeat(1, 140px); height: 40px;"
73+
>
74+
<div />
75+
<div
76+
class="flex justify-center"
77+
>
78+
<div
79+
class="border h-full border-dashed"
80+
style="border-left-width: 1px;"
81+
/>
82+
</div>
83+
</div>
84+
</div>
85+
</div>
86+
</div>
87+
<div
88+
class="p-0 relative"
89+
>
90+
<div
91+
class="relative h-full p-0 flex items-center px-0"
92+
style="margin-left: 0px;"
93+
>
94+
<div
95+
class="inline"
96+
style="margin-left: 0px;"
97+
>
98+
<div
99+
class="flex items-center"
100+
>
101+
<a
102+
class="text-primary underline inline"
103+
href="/localnet/transaction/HEARTBEAT1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
104+
>
105+
<abbr
106+
class="tracking-wide text-primary"
107+
title="HEARTBEAT1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
108+
>
109+
HEARTBE…
110+
</abbr>
111+
</a>
112+
</div>
113+
</div>
114+
</div>
115+
</div>
116+
<div
117+
class="flex items-center justify-center relative z-10"
118+
data-state="closed"
119+
style="grid-column-start: 2; grid-column-end: 3;"
120+
>
121+
<div
122+
class="inline-flex relative size-5 items-center justify-center overflow-hidden rounded-full border text-[0.6rem] border-heartbeat bg-card"
123+
/>
124+
</div>
125+
</div>
126+
</div>
127+
<div
128+
class="sticky bottom-0 left-full z-50 flex size-0 overflow-visible"
129+
>
130+
<button
131+
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-transparent hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2 absolute bottom-1 right-0 w-32"
132+
id="download-transactions-visual"
133+
>
134+
<svg
135+
class="lucide lucide-download mr-2 size-4"
136+
fill="none"
137+
height="24"
138+
stroke="currentColor"
139+
stroke-linecap="round"
140+
stroke-linejoin="round"
141+
stroke-width="2"
142+
viewBox="0 0 24 24"
143+
width="24"
144+
xmlns="http://www.w3.org/2000/svg"
145+
>
146+
<path
147+
d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
148+
/>
149+
<polyline
150+
points="7 10 12 15 17 10"
151+
/>
152+
<line
153+
x1="12"
154+
x2="12"
155+
y1="15"
156+
y2="3"
157+
/>
158+
</svg>
159+
Download
160+
</button>
161+
</div>
162+
</div>

0 commit comments

Comments
 (0)