files
Ocean does not handle the actual storage of files directly. The files are stored via other services which are then specified within the DDO.
During the publish process, file URLs must be encrypted with a respective Provider API call before storing the DDO on-chain. For this, you need to send the following object to Provider (where "files" contains one or more storage objects):
The files object is stored in the format of an encrypted string.
Example:{
"files": "0x044736da6dae39889ff570c34540f24e5e084f4e5bd81eff3691b729c2dd1465ae8292fc721e9d4b1f10f56ce12036c9d149a4dab454b0795bd3ef8b7722c6001e0becdad5caeb2005859642284ef6a546c7ed76f8b350480691f0f6c6dfdda6c1e4d50ee90e83ce3cb3ca0a1a5a2544e10daa6637893f4276bb8d7301eb35306ece50f61ca34dcab550b48181ec81673953d4eaa4b5f19a45c0e9db4cd9729696f16dd05e0edb460623c843a263291ebe757c1eb3435bb529cc19023e0f49db66ef781ca692655992ea2ca7351ac2882bf340c9d9cb523b0cbcd483731dc03f6251597856afa9a68a1e0da698cfc8e81824a69d92b108023666ee35de4a229ad7e1cfa9be9946db2d909735"
}
Static URLs
Parameters:
url
- File URL, requiredmethod
- The HTTP method, requiredheaders
- Additional HTTP headers, optional
{
"type": "url",
"url": "https://url.com/file1.csv",
"method": "GET",
"headers": {
"Authorization": "Bearer 123",
"APIKEY": "124"
}
}
Interplanetary File System
Parameters:
hash
- The file hash, required
{
"type": "ipfs",
"hash": "XXX"
}
GraphQL
Parameters:
url
- Server endpoint URL, requiredquery
- The query to be executed, requiredheaders
- Additional HTTP headers, optional
{
"type": "graphql",
"url": "http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph",
"headers":{
"Authorization": "Bearer 123",
"APIKEY": "124",
},
"query": """query{
nfts(orderBy: createdTimestamp,orderDirection:desc){
id
symbol
createdTimestamp
}
}"""
}
Smart Contract Data
Parameters:
chainId
- The chainId used to query the contract, requiredaddress
- The smartcontract address, requiredabi
- The function abi (NOT the entire contract abi), required
{
"type": "smartcontract",
"chainId": 1,
"address": "0x8149276f275EEFAc110D74AFE8AFECEaeC7d1593",
"abi": {
"inputs": [],
"name": "swapOceanFee",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
}
Arweave
Parameters:
transactionId
- The transaction identifier, required
{
"type": "arweave",
"transactionId": "a4qJoQZa1poIv5guEzkfgZYSAD0uYm7Vw4zm_tCswVQ"
}