Skip to content

Commit 64f87d6

Browse files
authored
update api endpoint (#102)
1 parent 2601a68 commit 64f87d6

File tree

7 files changed

+20
-10
lines changed

7 files changed

+20
-10
lines changed

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.21.5
4+
5+
### Patch Changes
6+
7+
- 9ca687a: update testnet API endpoint and expose it under Graph.TESTNET_API_ORIGIN
8+
39
## 0.21.4
410

511
### Patch Changes

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import { Graph } from '@graphprotocol/grc-20';
6161
// create a property
6262
const propertyResult = Graph.createProperty({
6363
name: 'name of the property',
64-
type: 'TEXT', // TEXT | NUMBER | TIME | POINT | CHECKBOX | RELATION,
64+
dataType: 'TEXT', // TEXT | NUMBER | TIME | POINT | CHECKBOX | RELATION,
6565
});
6666

6767
// create a type
@@ -173,14 +173,14 @@ const ops: Array<Op> = [];
173173

174174
// create an age property
175175
const { id: agePropertyId, ops: createAgePropertyOps } = Graph.createProperty({
176-
type: 'NUMBER',
176+
dataType: 'NUMBER',
177177
name: 'Age',
178178
});
179179
ops.push(...createAgePropertyOps);
180180

181181
// create a likes property
182182
const { id: likesPropertyId, ops: createLikesPropertyOps } = Graph.createProperty({
183-
type: 'RELATION',
183+
dataType: 'RELATION',
184184
name: 'Likes',
185185
});
186186
ops.push(...createLikesPropertyOps);
@@ -270,13 +270,15 @@ The calldata used to write the edit onchain depends on the governance structure
270270
We expose an API for fetching the appropriate calldata for the correct contract addresses for each space.
271271

272272
```ts
273+
import { Graph } from '@graphprotocol/grc-20';
274+
273275
// You'll need to know your space id and have an IPFS hash ahead of time
274276
const spaceId = 'space-id';
275277
const cid = 'ipfs://hash';
276-
const API_ORIGIN = 'https://hypergraph-v2-testnet.up.railway.app'; // or 'https://hypergraph-v2.up.railway.app'
277278

278279
// This returns the correct contract address and calldata depending on the space id
279-
const result = await fetch(`${API_ORIGIN}/space/${spaceId}/edit/calldata`, {
280+
// You can also use Graph.MAINNET_API_ORIGIN for mainnet (currently not working)
281+
const result = await fetch(`${Graph.TESTNET_API_ORIGIN}/space/${spaceId}/edit/calldata`, {
280282
method: "POST",
281283
body: JSON.stringify({ cid }),
282284
});
@@ -406,7 +408,7 @@ const { cid } = await Ipfs.publishEdit({
406408

407409
console.log('cid', cid);
408410

409-
const result = await fetch(`https://hypergraph-v2-testnet.up.railway.app/space/${spaceId}/edit/calldata`, {
411+
const result = await fetch(`${Graph.TESTNET_API_ORIGIN}/space/${spaceId}/edit/calldata`, {
410412
method: 'POST',
411413
body: JSON.stringify({ cid }),
412414
});

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export {
1414
getCalldataForSpaceGovernanceType,
1515
getProcessGeoProposalArguments,
1616
getRemoveEditorArguments,
17-
getRemoveSubspaceArguments,
17+
getRemoveSubspaceArguments
1818
} from './src/encodings/index.js';
1919

2020
/**

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.21.4",
3+
"version": "0.21.5",
44
"license": "MIT",
55
"module": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/full-flow-test.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { privateKeyToAccount } from 'viem/accounts';
22
import { it } from 'vitest';
33
import { Ipfs } from '../index.js';
4+
import { TESTNET_API_ORIGIN } from './graph/constants.js';
45
import { createEntity } from './graph/create-entity.js';
56
import { createSpace } from './graph/create-space.js';
67
import { getWalletClient } from './smart-wallet.js';
@@ -39,7 +40,7 @@ it.skip('should create a space', async () => {
3940

4041
console.log('cid', cid);
4142

42-
const result = await fetch(`https://hypergraph-v2-testnet.up.railway.app/space/${spaceId}/edit/calldata`, {
43+
const result = await fetch(`${TESTNET_API_ORIGIN}/space/${spaceId}/edit/calldata`, {
4344
method: 'POST',
4445
body: JSON.stringify({ cid }),
4546
});

src/graph/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const MAINNET_API_ORIGIN = 'https://hypergraph-v2.up.railway.app';
2-
export const TESTNET_API_ORIGIN = 'https://hypergraph-v2-testnet.up.railway.app';
2+
export const TESTNET_API_ORIGIN = 'https://api-testnet.geobrowser.io';

src/graph/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export { MAINNET_API_ORIGIN, TESTNET_API_ORIGIN } from './constants.js';
12
export * from './create-entity.js';
23
export * from './create-image.js';
34
export * from './create-property.js';

0 commit comments

Comments
 (0)