Skip to content

Commit 2be924c

Browse files
authored
add name prop to publishOps (#177)
1 parent fccfaa1 commit 2be924c

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

apps/events/src/components/create-properties-and-types.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ const createPropertiesAndTypes = async ({
3434
});
3535
ops.push(...createTodoTypeOps);
3636

37-
const result = await publishOps({ ops, walletClient: smartAccountWalletClient, space });
37+
const result = await publishOps({
38+
ops,
39+
walletClient: smartAccountWalletClient,
40+
space,
41+
name: 'Create properties and types',
42+
});
3843
return { result, todoTypeId, checkedPropertyId, userId, assigneesRelationTypeId };
3944
};
4045

apps/events/src/components/todo/todos-public-geo.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ export const TodosPublicGeo = () => {
5151
throw new Error('Missing smartAccountWalletClient');
5252
}
5353
const ops = await _generateDeleteOps({ id: todo.id, space });
54-
const result = await publishOps({ ops, walletClient: smartAccountWalletClient, space });
54+
const result = await publishOps({
55+
ops,
56+
walletClient: smartAccountWalletClient,
57+
space,
58+
name: 'Delete Todo',
59+
});
5560
console.log('result', result);
5661
}}
5762
>
@@ -70,7 +75,12 @@ export const TodosPublicGeo = () => {
7075
console.log('todo', todo);
7176
const { ops } = generateCreateOps(todo);
7277
console.log('ops', ops);
73-
const result = await publishOps({ ops, walletClient: smartAccountWalletClient, space });
78+
const result = await publishOps({
79+
ops,
80+
walletClient: smartAccountWalletClient,
81+
space,
82+
name: 'Create Todo',
83+
});
7484
console.log('result', result);
7585
}}
7686
>

apps/events/src/components/todo/todos-public-kg.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ export const TodosPublicKg = () => {
3232
throw new Error('Missing smartAccountWalletClient');
3333
}
3434
const ops = await _generateDeleteOps({ id: todo.id, space });
35-
const result = await publishOps({ ops, walletClient: smartAccountWalletClient, space });
35+
const result = await publishOps({
36+
ops,
37+
walletClient: smartAccountWalletClient,
38+
space,
39+
name: 'Delete Todo',
40+
});
3641
console.log('result', result);
3742
}}
3843
>

apps/events/src/components/todos2.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export const Todos2 = () => {
220220
ops,
221221
walletClient: smartAccountWalletClient,
222222
space,
223+
name: 'Update users and todos',
223224
});
224225
console.log('publishOpsResult', publishOpsResult);
225226
setIsPublishDiffModalOpen(false);

apps/events/src/components/users/users-public-geo.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ export const UsersPublicGeo = () => {
2727
throw new Error('Missing smartAccountWalletClient');
2828
}
2929
const ops = await _generateDeleteOps({ id: user.id, space });
30-
const result = await publishOps({ ops, walletClient: smartAccountWalletClient, space });
30+
const result = await publishOps({
31+
ops,
32+
walletClient: smartAccountWalletClient,
33+
space,
34+
name: 'Delete User',
35+
});
3136
console.log('result', result);
3237
}}
3338
>

packages/hypergraph-react/src/publish-ops.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Ipfs } from '@graphprotocol/grc-20';
33
import type { Hash } from 'viem';
44

55
type PublishParams = {
6+
name: string;
67
ops: Op[];
78
walletClient: GeoSmartAccount;
89
space: string;
@@ -15,14 +16,14 @@ type PublishResult = {
1516
cid: string;
1617
};
1718

18-
export const publishOps = async ({ ops, walletClient, space }: PublishParams): Promise<PublishResult> => {
19+
export const publishOps = async ({ name, ops, walletClient, space }: PublishParams): Promise<PublishResult> => {
1920
const address = walletClient.account?.address;
2021
if (!address) {
2122
throw new Error('No address found');
2223
}
2324

2425
const publishResult = await Ipfs.publishEdit({
25-
name: 'Update todos',
26+
name,
2627
ops: ops,
2728
author: address,
2829
});

0 commit comments

Comments
 (0)