Skip to content

Commit 31a707b

Browse files
committed
Update @streamr/sdk to 102.0.0. Add version identifier to the node table.
1 parent ce120e2 commit 31a707b

File tree

10 files changed

+247
-296
lines changed

10 files changed

+247
-296
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@sentry/react": "^8.34.0",
4848
"@streamr/config": "^5.4.0",
4949
"@streamr/hub-contracts": "^1.1.2",
50-
"@streamr/sdk": "^101.1.2",
50+
"@streamr/sdk": "^102.0.0",
5151
"@streamr/streamr-icons": "^0.1.9",
5252
"@streamr/streamr-layout": "^2.5.3",
5353
"@tanstack/react-query": "^5.51.21",
@@ -100,8 +100,7 @@
100100
"rich-markdown-editor": "^11.21.3",
101101
"storybook": "^8.3.3",
102102
"stream-browserify": "^3.0.0",
103-
"streamr-client-protocol": "^13.0.0",
104-
"streamr-client-react": "^3.1.0-internal.5",
103+
"streamr-client-react": "^3.3.0",
105104
"stringify-object": "^5.0.0",
106105
"styled-components": "^5.3.10",
107106
"toasterhea": "^1.0.4",

src/hooks/useInterceptHeartbeats.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ export function useInterceptHeartbeats(operatorId: string | undefined) {
3333
}
3434

3535
const {
36-
parsedContent: { peerDescriptor },
36+
parsedContent: { peerDescriptor, applicationVersion },
3737
messageId: { timestamp },
3838
} = message as HeartbeatMessage
3939

4040
setHeartbeats((prev) => ({
4141
...prev,
42-
[peerDescriptor.nodeId]: { ...peerDescriptor, timestamp },
42+
[peerDescriptor.nodeId]: {
43+
...peerDescriptor,
44+
timestamp,
45+
applicationVersion,
46+
},
4347
}))
4448
},
4549
},
@@ -54,6 +58,7 @@ const HeartbeatMessage = z.object({
5458
}),
5559
parsedContent: z.object({
5660
msgType: z.literal('heartbeat'),
61+
applicationVersion: z.string().optional(),
5762
peerDescriptor: z.object({
5863
nodeId: z.string(),
5964
type: z.optional(z.nativeEnum(NetworkNodeType)),
@@ -78,4 +83,5 @@ function isHeartbeatMessage(arg: unknown): arg is HeartbeatMessage {
7883

7984
export type Heartbeat = HeartbeatMessage['parsedContent']['peerDescriptor'] & {
8085
timestamp: number
86+
applicationVersion: string | undefined
8187
}

src/pages/OperatorPage/LiveNodesTable.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export function LiveNodesTable({
4848
valueMapper: ({ timestamp }) =>
4949
moment(timestamp).format('YYYY-MM-DD HH:mm'),
5050
},
51+
{
52+
align: 'start',
53+
displayName: 'Version',
54+
isSticky: false,
55+
key: 'version',
56+
valueMapper: ({ applicationVersion }) => applicationVersion || 'N/A',
57+
},
5158
{
5259
align: 'start',
5360
displayName: 'Host',

src/pages/OperatorPage/UndelegationQueue.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function UndelegationQueue({ operatorId }: Props) {
154154
),
155155
align: 'end',
156156
isSticky: false,
157-
key: 'requestDate',
157+
key: 'requestTime',
158158
},
159159
{
160160
displayName: '',

src/pages/StreamPage/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ function StreamEntityForm(props: StreamEntityFormProps) {
294294
* and, if so, invalidate associated stream abilities.
295295
*/
296296

297-
if ('user' in assignment && assignment.user.toLowerCase() === account) {
297+
if (
298+
'userId' in assignment &&
299+
assignment.userId.toLowerCase() === account
300+
) {
298301
invalidateAbilities(streamId, account)
299302

300303
break

src/parsers/StreamParser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export function parseStream(value: unknown, options: ParseStreamOptions) {
3434
const permissions: Record<string, number | null | undefined> = {}
3535

3636
permissionAssignments.forEach((assignment) => {
37-
const user = 'user' in assignment ? assignment.user.toLowerCase() : address0
37+
const user =
38+
'userId' in assignment ? assignment.userId.toLowerCase() : address0
3839

3940
permissions[user] = assignment.permissions.reduce(
4041
(memo, permission) => memo | Bits[permission],

src/shared/components/StreamPreview/index.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,8 @@ const UnstyledStreamPreview: FunctionComponent<StreamPreviewPros> = ({
6969
)
7070
const [partition, setPartition] = useState<number>(activePartition)
7171
const [loading, setIsLoading] = useState<boolean>()
72-
const [stream, setStream] = useState<Stream>()
73-
const { partitions } = stream?.getMetadata() || {}
74-
const partitionOptions = useMemo(
75-
() =>
76-
partitions ? [...new Array(partitions)].map((_, index) => index) : undefined,
77-
[partitions],
78-
)
72+
const [_, setStream] = useState<Stream>()
73+
const [partitions, setPartitions] = useState<number>()
7974
const streamData = useStreamData(selectedStreamId, {
8075
tail: 20,
8176
partition,
@@ -85,14 +80,26 @@ const UnstyledStreamPreview: FunctionComponent<StreamPreviewPros> = ({
8580
const loadStreamData = async () => {
8681
if (client) {
8782
setIsLoading(true)
88-
const result = await client.getStream(selectedStreamId)
89-
setIsLoading(false)
90-
setStream(result)
83+
try {
84+
const result = await client.getStream(selectedStreamId)
85+
setStream(result)
86+
const metadata = await result.getMetadata()
87+
const partitionCount = metadata.partitions as number
88+
setPartitions(partitionCount)
89+
} finally {
90+
setIsLoading(false)
91+
}
9192
}
9293
}
9394
loadStreamData()
9495
}, [selectedStreamId, client])
9596

97+
const partitionOptions = useMemo(
98+
() =>
99+
partitions ? [...new Array(partitions)].map((_, index) => index) : undefined,
100+
[partitions],
101+
)
102+
96103
return (
97104
<>
98105
<LoadingIndicator loading={loading} />

src/shared/stores/streamAbilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const useStreamAbilitiesStore = create<Store>((set, get) => {
105105
public: true,
106106
}
107107
: {
108-
user: account,
108+
userId: account,
109109
permission,
110110
allowPublic: true,
111111
},

src/stores/streamDraft.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function useStreamEntityQuery() {
9696
throw new StreamNotFoundError(streamId)
9797
}
9898

99-
const metadata = stream.getMetadata()
99+
const metadata = await stream.getMetadata()
100100

101101
let storageNodes: string[] | undefined
102102

@@ -215,7 +215,7 @@ export function usePersistStreamDraft(options: UsePersistStreamDraftOptions = {}
215215
}
216216

217217
permissionAssignments.push({
218-
user: account,
218+
userId: account,
219219
permissions,
220220
})
221221
}
@@ -419,10 +419,11 @@ export function usePersistStreamDraft(options: UsePersistStreamDraftOptions = {}
419419

420420
await checkBalance(client)
421421

422-
return client.updateStream({
422+
await client.setStreamMetadata(streamId, {
423423
...finalMetadata,
424-
id: streamId,
425424
})
425+
426+
return client.getStream(streamId)
426427
}
427428

428429
client = await getStreamrClientInstance(chainId)
@@ -431,10 +432,11 @@ export function usePersistStreamDraft(options: UsePersistStreamDraftOptions = {}
431432
})()
432433

433434
const currentStreamId = stream.id
435+
const currentMetadata = await stream.getMetadata()
434436

435437
const newMetadata = parseStream(stream, {
436438
chainId,
437-
metadata: stream.getMetadata(),
439+
metadata: currentMetadata,
438440
}).metadata
439441

440442
update((hot, cold) => {

0 commit comments

Comments
 (0)