Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/update-encoding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@graphprotocol/grc-20": minor
Comment thread
nikgraf marked this conversation as resolved.
---

Update encoding to use @geoprotocol/grc-20 package

**Breaking Changes:**
- Removed `unsetEntityValues` function
- Removed `unsetRelationFields` function
- Removed `serialize` utility
- Removed `verified` field from relations (no longer supported in GRC-20 v2 format)

**New Features:**
- Added `TESTNET_V3` network support pointing to `https://testnet-api-staging.geobrowser.io`
- Added JSDoc documentation for date/time TypedValue formats

**Changes:**
- Replaced internal protobuf encoding with `@geoprotocol/grc-20` package
- Added exhaustive type checks for value types in `createEntity` and `updateEntity`
- Updated full-flow test to use SpaceRegistry contract directly
- Added comprehensive encoding/decoding tests
5 changes: 5 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"permissions": {
"allow": ["Bash(pnpm build:*)", "Bash(pnpm test:*)", "Bash(pnpm lint:*)", "Bash(pnpm lint:fix:*)"]
}
}
8 changes: 4 additions & 4 deletions examples/ranks/create-ordinal-rank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ console.log('Vote entity IDs:', ordinalRankResult.voteIds);
// The ops array contains all the operations needed to create this rank:
console.log('\nOperations breakdown:');
for (const op of ordinalRankResult.ops) {
if (op.type === 'UPDATE_ENTITY') {
console.log(` - UPDATE_ENTITY: ${op.entity.id}`);
} else if (op.type === 'CREATE_RELATION') {
console.log(` - CREATE_RELATION: ${op.relation.fromEntity} -> ${op.relation.toEntity}`);
if (op.type === 'createEntity') {
console.log(` - createEntity`);
} else if (op.type === 'createRelation') {
console.log(` - createRelation`);
}
}
8 changes: 4 additions & 4 deletions examples/ranks/create-weighted-rank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ console.log('Vote entity IDs:', weightedRankResult.voteIds);
// The ops array contains all the operations needed to create this rank:
console.log('\nOperations breakdown:');
for (const op of weightedRankResult.ops) {
if (op.type === 'UPDATE_ENTITY') {
console.log(` - UPDATE_ENTITY: ${op.entity.id}`);
} else if (op.type === 'CREATE_RELATION') {
console.log(` - CREATE_RELATION: ${op.relation.fromEntity} -> ${op.relation.toEntity}`);
if (op.type === 'createEntity') {
console.log(` - createEntity`);
} else if (op.type === 'createRelation') {
console.log(` - createRelation`);
}
}
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
"clean": "rm -rf dist",
"build": "tsc",
"test": "vitest",
"generate:protobuf": "npx buf generate",
"lint": "biome check",
"lint:fix": "biome check --write --unsafe",
"deploy": "pnpm clean && pnpm build && pnpm changeset publish",
"bump": "pnpm changeset version"
},
"dependencies": {
"@bufbuild/protobuf": "^1.9.0",
"@geoprotocol/grc-20": "^0.1.7",
"effect": "^3.17.13",
"fflate": "^0.8.2",
"fractional-indexing-jittered": "^1.0.0",
Expand All @@ -39,8 +38,6 @@
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@bufbuild/buf": "^1.31.0",
"@bufbuild/protoc-gen-es": "^1.9.0",
"@changesets/cli": "^2.29.7",
"@types/uuid": "^11.0.0",
"typescript": "^5.9.2",
Expand Down
165 changes: 14 additions & 151 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions proto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* This module provides utility functions for working with the GRC-20 Edit
* protobuf in TypeScript.
* This module provides encoding utilities for GRC-20 Edits.
*
* Note: As of this version, the encoding has migrated from protobuf to GRC-20 v2 binary format.
*/
export * as EditProposal from './src/proto/edit.js';
/**
* This module provides utility functions for working with GRC-20 protobufs
* in TypeScript.
*/
export * from './src/proto/gen/src/proto/ipfs_pb.js';
export { decodeEdit, type Edit, type EncodeOptions, encodeEdit } from '@geoprotocol/grc-20';
Comment thread
nikgraf marked this conversation as resolved.
6 changes: 3 additions & 3 deletions scripts/setup-rank-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Usage: import { ops } from './scripts/setup-rank-types.js'
*/

import type { Op as GrcOp } from '@geoprotocol/grc-20';
import {
RANK_TYPE,
RANK_TYPE_PROPERTY,
Expand All @@ -20,10 +21,9 @@ import {
} from '../src/core/ids/system.js';
import { createProperty } from '../src/graph/create-property.js';
import { createType } from '../src/graph/create-type.js';
import type { Op } from '../src/types.js';

const generateRankTypeOps = (): Op[] => {
const ops: Op[] = [];
const generateRankTypeOps = (): GrcOp[] => {
const ops: GrcOp[] = [];

// 1. Create RANK_TYPE_PROPERTY - A STRING property storing ORDINAL/WEIGHTED
const rankTypeProperty = createProperty({
Expand Down
Loading
Loading