Skip to content

feat/use json compatible schemas#61

Merged
solidsnakedev merged 6 commits into
mainfrom
feat/use-json-compatible-schemas
Nov 18, 2025
Merged

feat/use json compatible schemas#61
solidsnakedev merged 6 commits into
mainfrom
feat/use-json-compatible-schemas

Conversation

@solidsnakedev
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings November 18, 2025 13:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the codebase to use JSON-compatible schemas by replacing Schema.BigIntFromSelf with Schema.BigInt and updating data type representations from string-based to typed primitives (e.g., hex strings to Uint8Array for byte arrays).

  • Changed ByteArray schema from string-based to Uint8Array runtime type with hex string encoding
  • Replaced Schema.BigIntFromSelf with Schema.BigInt throughout for JSON serialization compatibility
  • Updated Map schemas from ReadonlyMapFromSelf to Schema.Map for proper JSON encoding

Reviewed Changes

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/evolution/src/core/TSchema.ts Updated ByteArray schema to use Uint8Array runtime type; added equivalence function export
packages/evolution/src/core/Data.ts Changed Data type to use Uint8Array for bytes and Map for maps; added encoded type definitions
packages/evolution/src/core/TransactionMetadatum.ts Updated metadata schemas to use Schema.Map and Schema.BigInt for JSON compatibility
packages/evolution/src/core/NativeScripts.ts Refactored equality/hash implementations; changed slot/required fields to use Schema.BigInt
packages/evolution/test/*.test.ts Updated tests to use fromHex() and TSchema.equivalence() for comparisons
packages/evolution/src/core/*.ts Replaced BigIntFromSelf with BigInt across Coin, Numeric, PositiveCoin, and other modules
packages/evolution/src/sdk/*.ts Updated SDK schemas to use Schema.BigInt for JSON-compatible serialization
docs/* Regenerated documentation reflecting schema type changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
return h
}
return Hash.hash(JSON.stringify(toJSON(this.script)))
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imported function toJSON is used on line 167 but it's not imported or defined in this file. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
export type TransactionMetadatumVariantsEncoded =
| { readonly _tag: "TextMetadatum"; readonly value: string }
| { readonly _tag: "IntMetadatum"; readonly value: string }
| { readonly _tag: "BytesMetadatum"; readonly value: Uint8Array }
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation comment in line 204 incorrectly states "BytesMetadatum" has value type Uint8Array, but according to line 69, it's actually Uint8ArrayFromHex which means the encoded format is a hex string, not Uint8Array.

Copilot uses AI. Check for mistakes.
@solidsnakedev solidsnakedev merged commit dfa140c into main Nov 18, 2025
5 checks passed
@solidsnakedev solidsnakedev deleted the feat/use-json-compatible-schemas branch November 18, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants