Expand description
MetadataApi facade and IPFS fetch/upload helpers for CoW Protocol
app-data.
This module provides two layers of API:
-
Free functions — stateless helpers like
get_app_data_info,validate_app_data_doc,fetch_doc_from_cid, andupload_app_data_to_pinatathat operate on explicit parameters. -
MetadataApi— an ergonomic facade that bundles anIpfsconfiguration and delegates to the free functions, mirroring theMetadataApiclass from theTypeScriptSDK.
Most users will interact through MetadataApi:
use cow_app_data::{AppDataDoc, MetadataApi};
let api = MetadataApi::new();
let doc = api.generate_app_data_doc("MyApp");
let info = api.get_app_data_info(&doc).unwrap();
println!("appData hex : {}", info.app_data_hex);
println!("CID : {}", info.cid);Structs§
- AppData
Info - Full app-data information derived from an
AppDataDoc. - Ipfs
- IPFS connection parameters for upload/fetch operations.
- Ipfs
Upload Result - Result of uploading metadata to IPFS (legacy).
- Metadata
Api - High-level facade mirroring
MetadataApifrom theTypeScriptSDK. - Validation
Result - Result of validating an
AppDataDocagainst its schema.
Constants§
- DEFAULT_
IPFS_ READ_ URI - Default IPFS gateway used when none is provided.
- DEFAULT_
IPFS_ WRITE_ URI - Default IPFS write URI (Pinata).
Functions§
- fetch_
doc_ from_ app_ data_ hex - Fetch an
AppDataDocfrom IPFS using a hexappDatavalue. - fetch_
doc_ from_ app_ data_ hex_ legacy Deprecated - Fetch an
AppDataDocfrom IPFS using the legacy CID derivation method. - fetch_
doc_ from_ cid - Fetch an
AppDataDocfrom IPFS by itsCIDv1. - get_
app_ data_ info - Derive the full
AppDataInfofrom a document. - get_
app_ data_ info_ from_ str - Derive
AppDataInfofrom a pre-serialised app-data JSON string. - get_
app_ data_ info_ legacy Deprecated - Derive
AppDataInfousing the legacy method. - get_
app_ data_ schema - Get the app-data schema for a given version.
- import_
schema - Import (look up) an app-data schema by version string.
- upload_
app_ data_ to_ pinata - Upload an
AppDataDocto IPFS via the Pinata pinning service. - upload_
metadata_ doc_ to_ ipfs_ legacy Deprecated - Upload an
AppDataDocto IPFS via Pinata using the legacy method. - validate_
app_ data_ doc - Validate an
AppDataDocagainst allCoWProtocol app-data rules.