@graphprotocol/grc-20 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Knowledge Graph SDK
|
|
2
2
|
|
|
3
|
-
A collection of tools for interacting with
|
|
3
|
+
A collection of tools for interacting with The Graph.
|
|
4
4
|
|
|
5
5
|
## Installing
|
|
6
6
|
|
|
@@ -54,7 +54,7 @@ Entities throughout The Graph are referenced via globally unique identifiers. Th
|
|
|
54
54
|
```ts
|
|
55
55
|
import { ID } from 'graphprotocol/grc-20';
|
|
56
56
|
|
|
57
|
-
const newId = ID.
|
|
57
|
+
const newId = ID.generate();
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Making ops
|
|
@@ -130,14 +130,18 @@ Once you've uploaded the binary encoded Edit to IPFS and have correctly formed `
|
|
|
130
130
|
|
|
131
131
|
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.
|
|
132
132
|
|
|
133
|
-
We expose an API for fetching the appropriate calldata for the correct contract
|
|
133
|
+
We expose an API for fetching the appropriate calldata for the correct contract addresses for each space.
|
|
134
134
|
|
|
135
135
|
```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
|
|
137
137
|
const spaceId = 'space-id';
|
|
138
|
+
const cid = 'ipfs://hash';
|
|
138
139
|
|
|
139
140
|
// This returns the correct contract address and calldata depending on the space id
|
|
140
|
-
const result = await fetch(`https://geobrowser.io/
|
|
141
|
+
const result = await fetch(`https://geobrowser.io/space/${spaceId}/edit/calldata`, {
|
|
142
|
+
method: "POST",
|
|
143
|
+
body: JSON.stringify({ cid }),
|
|
144
|
+
});
|
|
141
145
|
|
|
142
146
|
const { to, data } = await result.json();
|
|
143
147
|
|
|
@@ -150,14 +154,13 @@ const txResult = await walletClient.sendTransaction({
|
|
|
150
154
|
|
|
151
155
|
### Deploying a space
|
|
152
156
|
|
|
153
|
-
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.
|
|
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.
|
|
154
158
|
|
|
155
159
|
```ts
|
|
156
160
|
const editorAddress = '0x000000000000000000000000000000000000';
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
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
|
+
});
|
|
160
166
|
```
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
### Smart accounts
|