@graphprotocol/grc-20 0.1.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/README.md +8 -18
  2. package/package.json +10 -10
package/README.md CHANGED
@@ -102,26 +102,16 @@ Currently the indexer only supports reading a specific gateway. You should use o
102
102
 
103
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
+ We've abstracted the IPFS publishing and binary encoding into a single API.
106
+
105
107
  ```ts
106
- import { EditProposal } from '@graphprotocol/grc-20/proto';
108
+ import { IPFS } from '@graphprotocol/grc-20';
107
109
 
108
- const binaryEncodedEdit = EditProposal.make({
110
+ const cid = await IPFS.publishEdit({
109
111
  name: 'Edit name',
110
112
  ops: ops,
111
- author: '0x000000000000000000000000000000000000',
112
- });
113
-
114
- // Upload binary via Geo API
115
- const blob = new Blob([binaryEncodedEdit], { type: 'application/octet-stream' });
116
- const formData = new FormData();
117
- formData.append('file', blob);
118
-
119
- const result = await fetch('https://geobrowser.io/api/ipfs/upload', {
120
- method: 'POST',
121
- body: formData,
122
- });
123
-
124
- const { cid } = await result.json();
113
+ author: '0x000000000000000000000000000000000000',
114
+ })
125
115
  ```
126
116
 
127
117
  ### Publishing an edit onchain
@@ -138,7 +128,7 @@ const spaceId = 'space-id';
138
128
  const cid = 'ipfs://hash';
139
129
 
140
130
  // This returns the correct contract address and calldata depending on the space id
141
- const result = await fetch(`https://geobrowser.io/space/${spaceId}/edit/calldata`, {
131
+ const result = await fetch(`https://api.geobrowser.io/space/${spaceId}/edit/calldata`, {
142
132
  method: "POST",
143
133
  body: JSON.stringify({ cid }),
144
134
  });
@@ -159,7 +149,7 @@ You can deploy spaces programmatically using the API. Currently there are two ty
159
149
  ```ts
160
150
  const editorAddress = '0x000000000000000000000000000000000000';
161
151
  const spaceName = 'Example-Name';
162
- const spaceId = await fetch("https://geobrowser.io/api/space/deploy", {
152
+ const spaceId = await fetch("https://api.geobrowser.io/deploy", {
163
153
  method: "POST",
164
154
  body: JSON.stringify({ editorAddress, spaceName }),
165
155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/grc-20",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,13 +18,6 @@
18
18
  "./contracts": "./dist/contracts.js",
19
19
  "./abis": "./dist/abis.js"
20
20
  },
21
- "scripts": {
22
- "build": "tsc",
23
- "test": "vitest",
24
- "generate:protobuf": "npx buf generate",
25
- "lint": "biome check --write --unsafe",
26
- "format": "biome check --write --unsafe"
27
- },
28
21
  "dependencies": {
29
22
  "@biomejs/biome": "^1.9.4",
30
23
  "@bufbuild/protobuf": "^1.9.0",
@@ -32,6 +25,7 @@
32
25
  "@ethersproject/abi": "^5.6.4",
33
26
  "@ethersproject/providers": "^5.6.8",
34
27
  "@types/uuid": "^9.0.8",
28
+ "effect": "^3.12.11",
35
29
  "ethers": "^5.7.2",
36
30
  "position-strings": "^2.0.1",
37
31
  "uuid": "^9.0.0",
@@ -46,5 +40,11 @@
46
40
  "prettier": "^3.2.5",
47
41
  "typescript": "^5.4.5"
48
42
  },
49
- "packageManager": "pnpm@9.15.4"
50
- }
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "test": "vitest",
46
+ "generate:protobuf": "npx buf generate",
47
+ "lint": "biome check --write --unsafe",
48
+ "format": "biome check --write --unsafe"
49
+ }
50
+ }