Skip to content

Commit a6fa1da

Browse files
authored
feat: update id generation fn to "generate" (#17)
* feat: update id generation from "make" to "generate" * changeset * fix: id test * fix: update references to ID.make
1 parent f8035bf commit a6fa1da

File tree

13 files changed

+30
-25
lines changed

13 files changed

+30
-25
lines changed

.changeset/perfect-cobras-destroy.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @graphprotocol/grc-20
22

3+
## 0.1.0
4+
5+
### Minor Changes
6+
7+
- Update ID generation fn name from make -> generate
8+
9+
### Patch Changes
10+
11+
- f8035bf: Add docs for deploying space and generating calldata to publish edits.
12+
313
## 0.0.9
414

515
### Patch Changes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Entities throughout The Graph are referenced via globally unique identifiers. Th
5454
```ts
5555
import { ID } from 'graphprotocol/grc-20';
5656

57-
const newId = ID.make();
57+
const newId = ID.generate();
5858
```
5959

6060
### Making ops

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

src/core/account.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @since 0.0.6
66
*/
77

8-
import { make as makeId } from '../id.js';
8+
import { generate } from '../id.js';
99
import { Relation } from '../relation.js';
1010
import type { CreateRelationOp, SetTripleOp } from '../types.js';
1111
import { getChecksumAddress } from './get-checksum-address.js';
@@ -32,7 +32,7 @@ type MakeAccountReturnType = {
3232
* @returns ops – The ops for the Account entity: {@link MakeAccountReturnType}
3333
*/
3434
export function make(address: string): MakeAccountReturnType {
35-
const accountId = makeId();
35+
const accountId = generate();
3636
const checkedAddress = getChecksumAddress(address);
3737

3838
return {

src/core/base58.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('base58', () => {
1010

1111
const encoded = encodeBase58(given);
1212

13-
// We check the length should be 22 in the ID.make() function and
13+
// We check the length should be 22 in the ID.generate() function and
1414
// re-run encodeBase58 if not.
1515
expect(encoded.length === 22 || encoded.length === 21).toBe(true);
1616

src/core/blocks/data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @since 0.0.6
66
*/
77

8-
import { make as makeId } from '../../id.js';
8+
import { generate } from '../../id.js';
99
import { Relation } from '../../relation.js';
1010
import { SYSTEM_IDS } from '../../system-ids.js';
1111
import type { CreateRelationOp, SetTripleOp } from '../../types.js';
@@ -43,7 +43,7 @@ type DataBlockArgs = { fromId: string; sourceType: DataBlockSourceType; position
4343
* @returns ops – The ops for the Data Block entity: {@link Op}[]
4444
*/
4545
export function make({ fromId, sourceType, position, name }: DataBlockArgs): (SetTripleOp | CreateRelationOp)[] {
46-
const newBlockId = makeId();
46+
const newBlockId = generate();
4747

4848
const dataBlockType = Relation.make({
4949
fromId: newBlockId,

src/core/blocks/text.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @since 0.0.6
66
*/
77

8-
import { make as makeId } from '../../id.js';
8+
import { generate } from '../../id.js';
99
import { Relation } from '../../relation.js';
1010
import { SYSTEM_IDS } from '../../system-ids.js';
1111
import type { Op } from '../../types.js';
@@ -29,7 +29,7 @@ type TextBlockArgs = { fromId: string; text: string; position?: string };
2929
* @returns ops – The ops for the Text Block entity: {@link Op}[]
3030
*/
3131
export function make({ fromId, text, position }: TextBlockArgs): Op[] {
32-
const newBlockId = makeId();
32+
const newBlockId = generate();
3333

3434
const textBlockType = Relation.make({
3535
fromId: newBlockId,

src/core/image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @since 0.0.6
66
*/
77

8-
import { make as makeId } from '../id.js';
8+
import { generate } from '../id.js';
99
import { Relation } from '../relation.js';
1010
import { SYSTEM_IDS } from '../system-ids.js';
1111
import type { CreateRelationOp, Op, SetTripleOp } from '../types.js';
@@ -29,7 +29,7 @@ type MakeImageReturnType = {
2929
* @returns ops – The ops for the Image entity: {@link MakeImageReturnType}
3030
*/
3131
export function make(src: string): MakeImageReturnType {
32-
const entityId = makeId();
32+
const entityId = generate();
3333

3434
return {
3535
imageId: entityId,

src/core/relation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { INITIAL_RELATION_INDEX_VALUE } from '../../constants.js';
8-
import { make as makeId } from '../id.js';
8+
import { generate } from '../id.js';
99
import { SYSTEM_IDS } from '../system-ids.js';
1010
import type { CreateRelationOp, DeleteRelationOp } from '../types.js';
1111
import { Position } from './position.js';
@@ -46,7 +46,7 @@ interface CreateRelationArgs {
4646
* @returns – {@link CreateRelationOp}
4747
*/
4848
export function make(args: CreateRelationArgs): CreateRelationOp {
49-
const newEntityId = args.relationId ?? makeId();
49+
const newEntityId = args.relationId ?? generate();
5050

5151
return {
5252
type: 'CREATE_RELATION',

0 commit comments

Comments
 (0)