@graphprotocol/grc-20 0.0.4 → 0.0.6
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 +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A collection of tools for interacting with the The Graph.
|
|
|
5
5
|
## Installing
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @graphprotocol/grc-20
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
@@ -52,7 +52,7 @@ When writing data, these ops are grouped into a logical set called an "Edit." An
|
|
|
52
52
|
Entities throughout The Graph are referenced via globally unique identifiers. The SDK exposes APIs for creating these IDs.
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
|
-
import { ID } from '
|
|
55
|
+
import { ID } from 'graphprotocol/grc-20';
|
|
56
56
|
|
|
57
57
|
const newId = ID.make();
|
|
58
58
|
```
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
Relation,
|
|
70
70
|
type SetTripleOp,
|
|
71
71
|
Triple,
|
|
72
|
-
} from '@
|
|
72
|
+
} from '@graphprotocol/grc-20';
|
|
73
73
|
|
|
74
74
|
const setTripleOp: SetTripleOp = Triple.make({
|
|
75
75
|
entityId: 'id of entity',
|
|
@@ -98,12 +98,12 @@ const deleteRelationOp: DeleteRelationOp = Relation.remove('id of relation');
|
|
|
98
98
|
|
|
99
99
|
Once you have a set of ops ready to publish, you'll need to binary encode them into an Edit and upload the Edit to IPFS.
|
|
100
100
|
|
|
101
|
-
Currently the indexer only supports reading
|
|
101
|
+
Currently the indexer only supports reading a specific gateway. You should use our IPFS API to guarantee data availability for your published data while in early access.
|
|
102
102
|
|
|
103
|
-
Additionally, the indexer expects that IPFS CIDs be prefixed with `ipfs://` so it knows how to process it correctly.
|
|
103
|
+
Additionally, the indexer expects that IPFS CIDs be prefixed with `ipfs://` so it knows how to process it correctly. The API already returns the CID prefixed with `ipfs://`.
|
|
104
104
|
|
|
105
105
|
```ts
|
|
106
|
-
import { EditProposal } from '@
|
|
106
|
+
import { EditProposal } from '@graphprotocol/grc-20/proto';
|
|
107
107
|
|
|
108
108
|
const binaryEncodedEdit = EditProposal.make({
|
|
109
109
|
name: 'Edit name',
|
|
@@ -116,7 +116,7 @@ const blob = new Blob([binaryEncodedEdit], { type: 'application/octet-stream' })
|
|
|
116
116
|
const formData = new FormData();
|
|
117
117
|
formData.append('file', blob);
|
|
118
118
|
|
|
119
|
-
const result = await fetch('https://geobrowser.io/api/ipfs/upload-binary, {
|
|
119
|
+
const result = await fetch('https://geobrowser.io/api/ipfs/upload-binary', {
|
|
120
120
|
method: 'POST',
|
|
121
121
|
body: formData,
|
|
122
122
|
});
|