Skip to content

Commit f8035bf

Browse files
authored
feat: add docs for deploying space and generating edit calldata (#16)
* feat: add docs for deploying space and generating edit calldata * feat: add changeset
1 parent 159b7af commit f8035bf

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/grc-20': patch
3+
---
4+
5+
Add docs for deploying space and generating calldata to publish edits.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @graphprotocol/grc-20
22

3+
## 0.0.9
4+
5+
### Patch Changes
6+
7+
- Add docs on deploying a personal space and generating calldata to publish.
8+
39
## 0.0.7
410

511
### Patch Changes

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const blob = new Blob([binaryEncodedEdit], { type: 'application/octet-stream' })
116116
const formData = new FormData();
117117
formData.append('file', blob);
118118

119-
const result = await fetch('https://geobrowser.io/api/ipfs/upload-binary', {
119+
const result = await fetch('https://geobrowser.io/api/ipfs/upload', {
120120
method: 'POST',
121121
body: formData,
122122
});
@@ -130,14 +130,18 @@ Once you've uploaded the binary encoded Edit to IPFS and have correctly formed `
130130

131131
The calldata used to write the edit onchain depends on the governance structure of the space. Currently The Graph supports two governance modes, one with voting and one without. The API exposes metadata about each space, its governance structure, and what smart contracts exist for it.
132132

133-
We expose an API for fetching the appropriate calldata for the correct contract address based for each space.
133+
We expose an API for fetching the appropriate calldata for the correct contract addresses for each space.
134134

135135
```ts
136-
// You'll need to know your space id ahead of time
136+
// You'll need to know your space id and have an IPFS hash ahead of time
137137
const spaceId = 'space-id';
138+
const cid = 'ipfs://hash';
138139

139140
// This returns the correct contract address and calldata depending on the space id
140-
const result = await fetch(`https://geobrowser.io/api/edit-calldata?spaceId=${spaceId}&cid=${cid}`);
141+
const result = await fetch(`https://geobrowser.io/space/${spaceId}/edit/calldata`, {
142+
method: "POST",
143+
body: JSON.stringify({ cid }),
144+
});
141145

142146
const { to, data } = await result.json();
143147

@@ -150,4 +154,13 @@ const txResult = await walletClient.sendTransaction({
150154

151155
### Deploying a space
152156

153-
### Smart accounts
157+
You can deploy spaces programmatically using the API. Currently there are two types of governance modes for spaces: one with voting and one without. They're called PUBLIC or PERSONAL spaces respectively. The API only supports deploying the PERSONAL governance mode currently.
158+
159+
```ts
160+
const editorAddress = '0x000000000000000000000000000000000000';
161+
const spaceName = 'Example-Name';
162+
const spaceId = await fetch("https://geobrowser.io/api/space/deploy", {
163+
method: "POST",
164+
body: JSON.stringify({ editorAddress, spaceName }),
165+
});
166+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/grc-20",
3-
"version": "0.0.7",
3+
"version": "0.0.9",
44
"license": "MIT",
55
"module": "./dist/index.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)