Skip to main content

Module ipfs

Module ipfs 

Source
Expand description

MetadataApi facade and IPFS fetch/upload helpers for CoW Protocol app-data.

This module provides two layers of API:

  1. Free functions — stateless helpers like get_app_data_info, validate_app_data_doc, fetch_doc_from_cid, and upload_app_data_to_pinata that operate on explicit parameters.

  2. MetadataApi — an ergonomic facade that bundles an Ipfs configuration and delegates to the free functions, mirroring the MetadataApi class from the TypeScript SDK.

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§

AppDataInfo
Full app-data information derived from an AppDataDoc.
Ipfs
IPFS connection parameters for upload/fetch operations.
IpfsUploadResult
Result of uploading metadata to IPFS (legacy).
MetadataApi
High-level facade mirroring MetadataApi from the TypeScript SDK.
ValidationResult
Result of validating an AppDataDoc against 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 AppDataDoc from IPFS using a hex appData value.
fetch_doc_from_app_data_hex_legacyDeprecated
Fetch an AppDataDoc from IPFS using the legacy CID derivation method.
fetch_doc_from_cid
Fetch an AppDataDoc from IPFS by its CIDv1.
get_app_data_info
Derive the full AppDataInfo from a document.
get_app_data_info_from_str
Derive AppDataInfo from a pre-serialised app-data JSON string.
get_app_data_info_legacyDeprecated
Derive AppDataInfo using 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 AppDataDoc to IPFS via the Pinata pinning service.
upload_metadata_doc_to_ipfs_legacyDeprecated
Upload an AppDataDoc to IPFS via Pinata using the legacy method.
validate_app_data_doc
Validate an AppDataDoc against all CoW Protocol app-data rules.