Skip to content

docs: polish address section#55

Merged
solidsnakedev merged 1 commit into
mainfrom
docs/update-address-2
Nov 11, 2025
Merged

docs: polish address section#55
solidsnakedev merged 1 commit into
mainfrom
docs/update-address-2

Conversation

@solidsnakedev
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings November 11, 2025 17:42
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 polishes the address documentation section and refactors the address-related code. The main changes include:

  • Core module reorganization: Renamed AddressStructure to Address and restructured address-related exports
  • Assets API enhancement: Made lovelace field optional and added helper functions (getLovelace, setLovelace, etc.)
  • Documentation restructure: Reorganized address documentation with clearer separation between SDK and Core layers
  • Dependency updates: Updated Effect and platform dependencies to newer versions

Reviewed Changes

Copilot reviewed 52 out of 53 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/evolution/src/core/Address.ts Renamed AddressStructure class to Address and updated error class names
packages/evolution/src/sdk/Assets.ts Made lovelace optional, added helper functions, and new schema transformations
packages/evolution/src/sdk/Address.ts Simplified to provide SDK-level string-based address API
packages/evolution/src/sdk/AddressDetails.ts New file providing rich address details with network/type information
packages/evolution/src/index.ts Reorganized exports with Core namespace and SDK modules
docs/content/docs/addresses/* Complete documentation restructure with new organization
Test files Updated to use Assets.getLovelace() instead of direct property access
Package dependencies Updated Effect platform packages
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

expect(result.selectedUtxos).toHaveLength(2)

const totalLovelace = result.selectedUtxos.reduce((sum, u) => sum + u.assets.lovelace, 0n)
const totalLovelace = UTxO.getTotalLovelace([...result.selectedUtxos])
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The function UTxO.getTotalLovelace is being called but there's no evidence this function exists in the codebase. The import shows import * as UTxO from \"../src/sdk/UTxO.js\" but this function hasn't been added to the UTxO module. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
expect(result.selectedUtxos).toHaveLength(3)

const total = result.selectedUtxos.reduce((sum, u) => sum + u.assets.lovelace, 0n)
const total = UTxO.getTotalLovelace([...result.selectedUtxos])
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Same issue as above - UTxO.getTotalLovelace function doesn't exist. This should either use the reduce pattern with Assets.getLovelace or the function needs to be implemented in the UTxO module.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +15
export const AssetsSchema = Schema.Struct({
lovelace: Schema.optional(Schema.BigIntFromSelf)
}).pipe(Schema.extend(Schema.Record({ key: Schema.String, value: Schema.BigIntFromSelf })))
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Making lovelace optional in the schema creates inconsistency. The AssetsSchema now allows lovelace to be undefined, but many existing functions like empty() explicitly set it to 0n. This could lead to confusion about whether assets without lovelace should have lovelace: undefined or lovelace: 0n. Consider either making it always required with a default of 0n, or ensure all constructor functions consistently use undefined when there's no lovelace.

Copilot uses AI. Check for mistakes.
Comment on lines +56 to 60
}).annotations({
identifier: "Mint",
title: "Token Mint Operations",
description: "A collection of token minting/burning operations grouped by policy ID"
})
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The .pipe(Schema.brand(\"Mint\")) call was removed but the type Mint is still exported as typeof Mint.Type which would have relied on the brand. This breaks the type definition. The brand should be restored or the type export needs to be updated to match the new schema definition.

Copilot uses AI. Check for mistakes.
Comment on lines 76 to 78

/**
* Check if a value is a valid NonZeroInt64.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The make constructor function was removed without explanation. If this was intentional to encourage using Schema.decodeSync(NonZeroInt64) directly, this breaking change should be documented. Otherwise, the helper function should be restored for developer convenience.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +39
return {
_tag: "KeyHash" as const,
hash: Bytes.toHex(this.hash)
}
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Changing the toJSON() return type from a string to an object is a breaking change in the serialization format. Code that previously expected toJSON() to return a hex string will break. This should either be reverted or clearly documented as a breaking change with migration instructions.

Suggested change
return {
_tag: "KeyHash" as const,
hash: Bytes.toHex(this.hash)
}
return Bytes.toHex(this.hash)

Copilot uses AI. Check for mistakes.
Comment on lines +112 to +117
const map = new Map(entries.map(([policyId, assetEntries]) => [policyId, new Map(assetEntries)])) as Mint
// Validate the constructed Mint
if (!is(map)) {
throw new MintError({ message: "Invalid Mint structure" })
}
return map
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

is function is called but not defined or imported in this file. This will cause a runtime error. Should be Mint.is(map) or the is predicate needs to be imported from the Mint schema.

Copilot uses AI. Check for mistakes.
@solidsnakedev solidsnakedev merged commit d206aef into main Nov 11, 2025
11 checks passed
@solidsnakedev solidsnakedev deleted the docs/update-address-2 branch November 11, 2025 17:47
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