Skip to content

Commit 04947bf

Browse files
authored
Merge pull request #1943 from streamr-dev/front-1926-update-hub-streamr-sdk
FRONT-1926: Post-SDK-update adjustments
2 parents d8031aa + 77da6e3 commit 04947bf

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

src/generated/gql/network.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,8 +4306,10 @@ export type StreamPermission = {
43064306
stream?: Maybe<Stream>;
43074307
/** subscribeExpires timestamp tells until what time this address may subscribe to the stream */
43084308
subscribeExpiration?: Maybe<Scalars['BigInt']['output']>;
4309-
/** Ethereum address, owner of this permission */
4310-
userAddress: Scalars['Bytes']['output'];
4309+
/** [DEPRECATED] Ethereum address, owner of this permission; only if permission granting didn't use *forUserId functions */
4310+
userAddress?: Maybe<Scalars['Bytes']['output']>;
4311+
/** Ethereum address or other ID, owner of this permission */
4312+
userId: Scalars['Bytes']['output'];
43114313
};
43124314

43134315
export type StreamPermission_Filter = {
@@ -4382,6 +4384,16 @@ export type StreamPermission_Filter = {
43824384
userAddress_not?: InputMaybe<Scalars['Bytes']['input']>;
43834385
userAddress_not_contains?: InputMaybe<Scalars['Bytes']['input']>;
43844386
userAddress_not_in?: InputMaybe<Array<Scalars['Bytes']['input']>>;
4387+
userId?: InputMaybe<Scalars['Bytes']['input']>;
4388+
userId_contains?: InputMaybe<Scalars['Bytes']['input']>;
4389+
userId_gt?: InputMaybe<Scalars['Bytes']['input']>;
4390+
userId_gte?: InputMaybe<Scalars['Bytes']['input']>;
4391+
userId_in?: InputMaybe<Array<Scalars['Bytes']['input']>>;
4392+
userId_lt?: InputMaybe<Scalars['Bytes']['input']>;
4393+
userId_lte?: InputMaybe<Scalars['Bytes']['input']>;
4394+
userId_not?: InputMaybe<Scalars['Bytes']['input']>;
4395+
userId_not_contains?: InputMaybe<Scalars['Bytes']['input']>;
4396+
userId_not_in?: InputMaybe<Array<Scalars['Bytes']['input']>>;
43854397
};
43864398

43874399
export enum StreamPermission_OrderBy {
@@ -4396,7 +4408,8 @@ export enum StreamPermission_OrderBy {
43964408
StreamMetadata = 'stream__metadata',
43974409
StreamUpdatedAt = 'stream__updatedAt',
43984410
SubscribeExpiration = 'subscribeExpiration',
4399-
UserAddress = 'userAddress'
4411+
UserAddress = 'userAddress',
4412+
UserId = 'userId'
44004413
}
44014414

44024415
export type Stream_Filter = {
@@ -5311,14 +5324,14 @@ export type GetProjectSubscriptionsQueryVariables = Exact<{
53115324

53125325
export type GetProjectSubscriptionsQuery = { __typename?: 'Query', project?: { __typename?: 'Project', subscriptions: Array<{ __typename?: 'ProjectSubscription', userAddress: any, endTimestamp?: any | null }> } | null };
53135326

5314-
export type StreamFieldsFragment = { __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userAddress: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null };
5327+
export type StreamFieldsFragment = { __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userId: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null };
53155328

53165329
export type GetStreamByIdQueryVariables = Exact<{
53175330
streamId: Scalars['ID']['input'];
53185331
}>;
53195332

53205333

5321-
export type GetStreamByIdQuery = { __typename?: 'Query', stream?: { __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userAddress: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null } | null };
5334+
export type GetStreamByIdQuery = { __typename?: 'Query', stream?: { __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userId: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null } | null };
53225335

53235336
export type GetPagedStreamsQueryVariables = Exact<{
53245337
first?: InputMaybe<Scalars['Int']['input']>;
@@ -5328,7 +5341,7 @@ export type GetPagedStreamsQueryVariables = Exact<{
53285341
}>;
53295342

53305343

5331-
export type GetPagedStreamsQuery = { __typename?: 'Query', streams: Array<{ __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userAddress: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null }> };
5344+
export type GetPagedStreamsQuery = { __typename?: 'Query', streams: Array<{ __typename?: 'Stream', id: string, metadata: string, permissions?: Array<{ __typename?: 'StreamPermission', id: string, canGrant?: boolean | null, canEdit?: boolean | null, canDelete?: boolean | null, userId: any, subscribeExpiration?: any | null, publishExpiration?: any | null }> | null }> };
53325345

53335346
export type SponsorshipDailyBucketFieldsFragment = { __typename?: 'SponsorshipDailyBucket', id: string, operatorCount: number, projectedInsolvency?: any | null, spotAPY: any, totalStakedWei: any, remainingWei: any, date: any, sponsorship: { __typename?: 'Sponsorship', id: string } };
53345347

@@ -5521,7 +5534,7 @@ export const StreamFieldsFragmentDoc = gql`
55215534
canGrant
55225535
canEdit
55235536
canDelete
5524-
userAddress
5537+
userId
55255538
subscribeExpiration
55265539
publishExpiration
55275540
}

src/hooks/streams.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export async function getStreamsFromIndexer(
117117
const where: Stream_Filter = {
118118
permissions_: {
119119
stream_contains_nocase: search,
120-
userAddress: owner,
120+
userId: owner,
121121
},
122122
}
123123

@@ -221,7 +221,7 @@ async function getStreamsFromGraph(
221221
const where: Stream_Filter = {
222222
permissions_: {
223223
stream_contains_nocase: search,
224-
userAddress: owner,
224+
userId: owner,
225225
},
226226
[`id_${orderOperator}`]: lastId,
227227
id_in: streamIds,
@@ -231,8 +231,8 @@ async function getStreamsFromGraph(
231231
delete where.permissions_?.stream_contains_nocase
232232
}
233233

234-
if (!where.permissions_?.userAddress) {
235-
delete where.permissions_?.userAddress
234+
if (!where.permissions_?.userId) {
235+
delete where.permissions_?.userId
236236
}
237237

238238
if (Object.keys(where.permissions_ || {}).length === 0) {
@@ -369,7 +369,7 @@ function getStatsFromPermissions(
369369
let publisherCount: number | undefined = 0
370370

371371
permissions.forEach((perm) => {
372-
if (perm.userAddress === address0) {
372+
if (perm.userId === address0) {
373373
/**
374374
* If stream has public permissions (zero address), return `undefined`
375375
* for counts. It means anyone can publish and subscribe.

src/queries/network.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ gql`
394394
canGrant
395395
canEdit
396396
canDelete
397-
userAddress
397+
userId
398398
subscribeExpiration
399399
publishExpiration
400400
}

src/services/streams.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getGraphClient } from '~/getters/getGraphClient'
1818
import { OrderDirection } from '~/types'
1919

2020
export type TheGraphStreamPermission = {
21-
userAddress: string
21+
userId: string
2222
canEdit: boolean
2323
canGrant: boolean
2424
canDelete: boolean
@@ -51,7 +51,7 @@ const calculatePubSubCount = (permissions: StreamPermission[]) => {
5151
permissions.forEach((perm) => {
5252
// If stream has public permissions (zero address), return null for counts which means that anyone can
5353
// publish or subscribe
54-
if (perm.userAddress === address0) {
54+
if (perm.userId === address0) {
5555
if (perm.subscribeExpiration >= Math.round(Date.now() / 1000)) {
5656
subscriberCount = null
5757
}
@@ -145,7 +145,7 @@ export const getPagedStreams = async (
145145
let where: Stream_Filter = {
146146
permissions_: {
147147
stream_contains_nocase: search,
148-
userAddress: owner,
148+
userId: owner,
149149
},
150150
[`id_${orderOperator}`]: lastId,
151151
}
@@ -219,7 +219,7 @@ export const getStreamsOwnedBy = async (
219219
result = result.filter(
220220
(s) =>
221221
s.permissions.find(
222-
(p) => p.userAddress.toLowerCase() === address0.toLowerCase(),
222+
(p) => p.userId.toLowerCase() === address0.toLowerCase(),
223223
) != null,
224224
)
225225
}

0 commit comments

Comments
 (0)