Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perfect-cobras-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/grc-20': patch
---

Add docs for deploying space and generating calldata to publish edits.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphprotocol/grc-20

## 0.0.9

### Patch Changes

- Add docs on deploying a personal space and generating calldata to publish.

## 0.0.7

### Patch Changes
Expand Down
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const blob = new Blob([binaryEncodedEdit], { type: 'application/octet-stream' })
const formData = new FormData();
formData.append('file', blob);

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

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.

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

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

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

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

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

### Deploying a space

### Smart accounts
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.

```ts
const editorAddress = '0x000000000000000000000000000000000000';
const spaceName = 'Example-Name';
const spaceId = await fetch("https://geobrowser.io/api/space/deploy", {
method: "POST",
body: JSON.stringify({ editorAddress, spaceName }),
});
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphprotocol/grc-20",
"version": "0.0.7",
"version": "0.0.9",
"license": "MIT",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
Loading