MCS API

This is a Postman Collection for the Multi-Chain Storage API v1 endpoints. The page below describes different components of our API offering.

Common

Get system config

GET https://mcs-api.filswan.com/api/v1/common/system/params

This endpoint allows you to get system config

Path Parameters

NameTypeDescription

limit

String

When not provided, use default: 100

{
    "status": "success",
    "code": "200",
    "data": {
        "LOCK_TIME": "6",
        "MINT_CONTRACT": "0x1A1e5AC88C493e0608C84c60b7bb5f04D9cF50B3",
        "PAY_GAS_LIMIT": "9999999",
        "PAY_WITH_MULTIPLY_FACTOR": "1.5",
        "RECIPIENT": "0xABeAAb124e6b52afFF504DB71bbF08D0A768D053",
        "SWAN_PAYMENT_CONTRACT_ADDRESS": "0x7ab09f9Ab4D39cfBE0551dfb6AdAc63C89bB955b",
        "USDC_ADDRESS": "0xe11A86849d99F524cAC3E7A0Ec1241828e332C62"
    }
}

Get host info

GET https://mcs-api.filswan.com/api/v1/common/host/info

{{
    "status": "success",
    "code": "200",
    "data": {
        "swan_miner_version": "swan-miner-v2.5.0",
        "operating_system": "linux",
        "architecture": "amd64",
        "cpu_number": 8
    }
}

Upload file

Get USDC/Filecoin exchange rate

GET https://mcs-api.filswan.com/api/v1/billing/price/filecoin

This endpoint allows you to get the current exchange rate of USDC against Filecoin.

{
    "status":"success",
    "code":"200",
    "data":173
}

Get average Filecoin statistics.

GET https://api.filswan.com/stats/storage

This endpoint allows you to get average Filecoin storage price.

{
    "data":
    {
        "average_cost_push_message":" FIL",
        "average_data_cost_sealing_1TB":" FIL/TiB",
        "average_gas_cost_sealing_1TB":" FIL/TiB",
        "average_min_piece_size":" Byte",
        "average_price_per_GB_per_year":" FIL/GiB/year",
        "average_verified_price_per_GB_per_year":" FIL/GiB/year"},
        "status":"success"
}

Upload to IPFS

POST https://mcs-api.filswan.com/api/v1/storage/ipfs/upload

This endpoint allows you to upload your file to IPFS server.

Request Body

NameTypeDescription

file*

Binary

file to be uploaded

duration*

String

days for the uploaded file to be kept on miner

file_type*

String

0:uploaded by user, 1:uploaded by nft

wallet_address*

String

wallet address used to pay

{
    "status": "success",
    "code": "200",
    "data": {
        "source_file_id": 593,
        "payload_cid": "bafykbzacecjq3txd5liqtv52cmguj6mmx7uwhdhb6cfxlgv53ytk4xk5osyvg",
        "ipfs_url": "https://calibration-ipfs.filswan.com/ipfs/QmdJGnSpXCX9zGEh1G9RwBRUH1KYhtNqsZH1ZdXRQidXWR",
        "need_pay": 0,
        "file_size": 2504638
    }
}

Batch Upload to IPFS

POST https://mcs-api.filswan.com/api/v1/storage/ipfs/batchupload

This endpoint allows you to batch upload your file to IPFS server.

Request Body

NameTypeDescription

wallet_address*

String

wallet address used to pay

files*

Binary

file to be uploaded

duration*

String

days for the uploaded file to be kept on miner

file_type*

String

0:uploaded by user, 1:uploaded by nft

My files

Get uploaded file list

GET https://mcs-api.filswan.com/api/v1/storage/tasks/deals

This endpoint allows you to get a list of your uploaded files.

Path Parameters

NameTypeDescription

file_name

String

file name of the uploaded file

page_size

Number

upper limit or records to return this time

page_number

Number

if not a valid number, or <=0, then 1, else use provided value

wallet_address*

String

uploaded under this wallet

payload_cid

String

payload cid of the car file for uploaded file

{
    code: "200"
    data: 
    [
        {
            id: 0, 
            user_id:, 
            file_name: "", 
            file_size: "",
        },
    ]
    page_info: 
    {
        page_number: "1", 
        page_size: "10", 
        total_record_count: ""
    }
    status: "success"
}

Get deal details

GET https://mcs-api.filswan.com/api/v1/storage/deal/detail/<deal_id>

This endpoint allows you to get deal details and DAO details.

Path Parameters

NameTypeDescription

payload_cid*

String

payload cid of the car file for uploaded file

{
    "status": "success",
    "code": "200",
    "data": {
        "dao": [
            {
                "dao_name": "Dao2",
                "dao_address": "0x6f2B76024196e82D81c8bC5eDe7cff0B0276c9C1",
                "order_index": "2",
                "deal_id": 4813917,
                "dao_pass_time": "1648074606",
                "payload_cid": "bafykbzacedp5sm4hgjc5l5d3hadkjw7t6dz6qtkyug4kdb7vyojlgwojuhr32",
                "dao_address_event": "0x6f2B76024196e82D81c8bC5eDe7cff0B0276c9C1",
                "tx_hash": "0x38d63b594193ecc568219f73ed138f152ebcb76e1b3e821acb20eb4cc18702d8",
                "status": "1"
            },
            {
                "dao_name": "Dao3",
                "dao_address": "0x800210CfB747992790245eA878D32F188d01a03A",
                "order_index": "3",
                "deal_id": 4813917,
                "dao_pass_time": "1648074636",
                "payload_cid": "bafykbzacedp5sm4hgjc5l5d3hadkjw7t6dz6qtkyug4kdb7vyojlgwojuhr32",
                "dao_address_event": "0x800210CfB747992790245eA878D32F188d01a03A",
                "tx_hash": "0x4db5ffcac1231a4a10b8cfb926e2273f47ac0f6998db8f419d40da56ee249b2d",
                "status": "1"
            },
            {
                "dao_name": "Dao1",
                "dao_address": "0x05856015d07F3E24936B7D20cB3CcfCa3D34B41d",
                "order_index": "1",
                "deal_id": 0,
                "dao_pass_time": "",
                "payload_cid": "",
                "dao_address_event": "",
                "tx_hash": "",
                "status": ""
            }
        ],
        "dao_thresh_hold": 2,
        "dao_total_count": 3,
        "deal": {
            "deal_id": 4813917,
            "deal_cid": "bafyreiha2opmhanchdezyynfwbnbgvfhsd7l6al6r32tjgzovwews75fba",
            "message_cid": "bafy2bzacedwh5otlxmyyruk3k6hue4dm6qhegvuisv7tjib37wnlgllqf26ec",
            "height": 1658913,
            "piece_cid": "baga6ea4seaqeqjfpuk76spigclf5hti2v3tia2mz4pyomxxnkegcdzhlcge4agi",
            "verified_deal": true,
            "storage_price_per_epoch": 0,
            "signature": "",
            "signature_type": "",
            "created_at": 1648073790,
            "piece_size_format": "",
            "start_height": 1669905,
            "end_height": 3184293,
            "client": "f14r2jybmccwiu6hze4fu55jyhclktvwacec56hea",
            "client_collateral_format": "000000000000000000",
            "provider": "f019104",
            "provider_tag": "",
            "verified_provider": 0,
            "provider_collateral_format": "000000000000000000",
            "status": 0,
            "network_name": "filecoin_mainnet",
            "storage_price": 0,
            "ipfs_url": "https://calibration-ipfs.filswan.com/ipfs/QmP6TY2Nm1BJmQsypnUYbfSe1sQ8KpEU2DpSVP8T9siTFC",
            "file_name": "instruction148.docx"
        },
        "found": {
            "payload_cid": "bafykbzacedp5sm4hgjc5l5d3hadkjw7t6dz6qtkyug4kdb7vyojlgwojuhr32",
            "client_wallet_address": "",
            "create_at": "1648054345164",
            "locked_fee": "263721000000000"
        },
        "signed_dao_count": 2,
        "unlock_status": true
    }
}

get deal logs

GET https://mcs-api.filswan.com/api/v1/storage/deal/log/<deal_cid>

This endpoint allows you to get offline deal logs

{
    "status": "success",
    "code": "200",
    "data": {
        "offline_deal_logs": [
            {
                "id": 57,
                "deal_cid": "bafyreic7izff2iezvpgepliv2mfrzhdcmxixx2w637kprg6p3f7uvoaefe",
                "status": "StorageDealActive",
                "message": "",
                "create_at": "1646998800016"
            },
            {
                "id": 49,
                "deal_cid": "bafyreic7izff2iezvpgepliv2mfrzhdcmxixx2w637kprg6p3f7uvoaefe",
                "status": "StorageDealAwaitingPreCommit",
                "message": "",
                "create_at": "1646968320019"
            },
            {
                "id": 48,
                "deal_cid": "bafyreic7izff2iezvpgepliv2mfrzhdcmxixx2w637kprg6p3f7uvoaefe",
                "status": "StorageDealCheckForAcceptance",
                "message": "Provider state: StorageDealPublishing",
                "create_at": "1646968080008"
            },
            {
                "id": 47,
                "deal_cid": "bafyreic7izff2iezvpgepliv2mfrzhdcmxixx2w637kprg6p3f7uvoaefe",
                "status": "StorageDealCheckForAcceptance",
                "message": "Provider state: StorageDealPublish",
                "create_at": "1646967360012"
            },
            {
                "id": 46,
                "deal_cid": "bafyreic7izff2iezvpgepliv2mfrzhdcmxixx2w637kprg6p3f7uvoaefe",
                "status": "StorageDealCheckForAcceptance",
                "message": "Provider state: StorageDealWaitingForData",
                "create_at": "1646966400009"
            }
        ]
    }
}

Get payment information

GET https://mcs-api.filswan.com/api/v1/billing/deal/lockpayment/info

This endpoint allows you to get the specific payment information by payload CID.

Path Parameters

NameTypeDescription

payload_cid*

String

payload cid of the car file for the source file

{
    "status": "success",
    "code": "200",
    "data": {
        "locked_fee": "7283883000000000",
        "payload_cid": "bafykbzacebk3f4v4cqdfch35h3arwelg4hodutkahwa45nrnpbadui7uzaky6",
        "tx_hash": "0xe53608744eac42fcc784d4ba8cef151583c33ff3b8f42424166867be25305f7f"
    }
}

Record mint info

POST https://mcs-api.filswan.com/api/v1/storage/mint/info

This endpoint allows to record mint info to mcs database.

Request Body

NameTypeDescription

payload_cid*

String

tx_hash*

String

token_id*

String

mint_address*

String

Billing history

Get billing history

GET https://mcs-api.filswan.com/api/v1/billing

This endpoint allows you to get the billing history related to current wallet account.

Path Parameters

NameTypeDescription

wallet_address*

String

wallet who pay the file

tx_hash

String

transaction hash of payment

page_size

Number

when empty, use default:10, max records returned each time

page_number

Number

when empty string, then 1

{
    code: "200"
    data: 
    [
        {
            tx_hash: "",
        }
    ]
    page_info: 
    {
        page_number: "1", 
        page_size: "10", 
        total_record_count: ""
    }
    status: "success"    
}

Last updated