Add NFT record field to asset tree and comprehensive tests#3
Merged
Conversation
- Add nftRecord field to AssetTree type in both TypeScript and Python SDKs - TypeScript: Added nftRecord?: string to AssetTree interface - Python: Added nft_record field to AssetTree dataclass and updated get_asset_tree() to properly map the field from API response Integration tests: - Add integration test files for both SDKs to verify: - Asset tree returns creatorWallet and nftRecord fields correctly - Asset search (Verify Engine) returns precise matches and similar assets Unit tests: - test_asset_tree.py: Mock tests for asset tree parsing including nftRecord - test_asset_search.py: Mock tests for asset search functionality - test_integration.py: Live API tests (requires CAPTURE_TOKEN env var) Tests verify asset NID bafybeif3mhxhkhfwuszl2lybtai3hz3q6naqpfisd4q55mcc7opkmiv5ei: - creatorWallet: 0x019F590C900c78060da8597186d065ee514931BB - nftRecord: bafkreibjj4sgpeirznei5or3lncndzije6nw4qsksoomsbu23ivp7bdwei https://claude.ai/code/session_01S2rjj4C9JGAHGh5JU2Fofe
BREAKING CHANGE: license field type changed from string to License object Changes: - Add License type with name and document fields (both SDKs) - Update AssetTree to use License object instead of string - Add new fields from AssetTree spec: - usedBy: URL of website using the asset - integrityCid: IPFS CID of integrity proof - digitalSourceType: Source type (digitalCapture, trainedAlgorithmicMedia, etc.) - miningPreference: Mining/indexing preference - generatedBy: AI/algorithm info for generated content Python client handles both license object and string for backwards compatibility: - If API returns object: creates License(name=..., document=...) - If API returns string: creates License(name=string_value) Updated tests to cover: - License object parsing - License string backwards compatibility - All new AssetTree spec fields Bump version: 0.1.0 -> 0.2.0 (breaking change) Spec: https://docs.numbersprotocol.io/introduction/numbers-protocol/defining-web3-assets/assettree https://claude.ai/code/session_01S2rjj4C9JGAHGh5JU2Fofe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for the
nftRecordfield in asset tree responses and includes comprehensive unit and integration tests for both Python and TypeScript SDKs.Key Changes
Core Changes
Added
nftRecordfield toAssetTreetype in both Python and TypeScriptnft_record: str | Nonefield toAssetTreedataclass with documentationnftRecord?: stringfield toAssetTreeinterfaceUpdated asset tree parsing logic in Python SDK
get_asset_tree()methodnft_recordparameter inAssetTreeconstructorextradictTest Coverage
Python unit tests (
test_asset_tree.py):nft_recordfieldnftRecordin responsesextradictPython unit tests (
test_asset_search.py):Python integration tests (
test_integration.py):creatorWalletandnftRecordCAPTURE_TOKENenvironment variableTypeScript integration tests (
ts/src/integration.test.ts):CAPTURE_TOKENenvironment variableImplementation Details
nftRecordfield is optional (defaults toNone/undefined) to maintain backward compatibilityextradict to avoid duplicationhttps://claude.ai/code/session_01S2rjj4C9JGAHGh5JU2Fofe