@graphprotocol/grc-20 0.7.0 → 0.8.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 CHANGED
@@ -278,16 +278,17 @@ const txResult = await walletClient.sendTransaction({
278
278
 
279
279
  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.
280
280
 
281
- The API only supports deploying to TESTNET for now.
281
+ The API supports deploying to both testnet and mainnet. By default it will deploy to mainnet.
282
282
 
283
283
  ```ts
284
+ import { Graph } from '@graphprotocol/grc-20';
284
285
  const editorAddress = '0x000000000000000000000000000000000000';
285
286
  const spaceName = 'Example-Name';
286
287
 
287
- const result = await fetch("https://api-testnet.grc-20.thegraph.com/deploy", {
288
- method: "POST",
289
- body: JSON.stringify({ initialEditorAddress, spaceName }),
288
+ const spaceId = await Graph.createSpace({
289
+ initialEditorAddress,
290
+ spaceName,
291
+ // Optionally specify TESTNET or MAINNET. Defaults to MAINNET
292
+ network: 'TESTNET',
290
293
  });
291
-
292
- const { spaceId } = await result.json();
293
294
  ```
@@ -1,6 +1,7 @@
1
1
  type Params = {
2
2
  editorAddress: string;
3
3
  name: string;
4
+ network?: 'TESTNET' | 'MAINNET';
4
5
  };
5
6
  /**
6
7
  * Creates a space with the given name and editor address.
@@ -1 +1 @@
1
- {"version":3,"file":"create-space.d.ts","sourceRoot":"","sources":["../../../src/graph/create-space.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,WAAkB,MAAM;;EAe/C,CAAC"}
1
+ {"version":3,"file":"create-space.d.ts","sourceRoot":"","sources":["../../../src/graph/create-space.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,WAAkB,MAAM;;EAgB/C,CAAC"}
@@ -9,6 +9,7 @@ export const createSpace = async (params) => {
9
9
  body: JSON.stringify({
10
10
  spaceName: params.name,
11
11
  initialEditorAddress: params.editorAddress,
12
+ network: params.network ?? 'MAINNET',
12
13
  }),
13
14
  headers: {
14
15
  'Content-Type': 'application/json',
@@ -1 +1 @@
1
- {"version":3,"file":"create-space.js","sourceRoot":"","sources":["../../../src/graph/create-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,gBAAgB,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,SAAS,EAAE;QAC9C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,SAAS,EAAE,MAAM,CAAC,IAAI;YACtB,oBAAoB,EAAE,MAAM,CAAC,aAAa;SAC3C,CAAC;QACF,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACzB,CAAC,CAAC"}
1
+ {"version":3,"file":"create-space.js","sourceRoot":"","sources":["../../../src/graph/create-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQlD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,gBAAgB,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,SAAS,EAAE;QAC9C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,SAAS,EAAE,MAAM,CAAC,IAAI;YACtB,oBAAoB,EAAE,MAAM,CAAC,aAAa;YAC1C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,SAAS;SACrC,CAAC;QACF,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACzB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/grc-20",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",