Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storages list endpoint #8

Closed
balessan opened this issue Nov 20, 2022 · 2 comments · Fixed by #5
Closed

Storages list endpoint #8

balessan opened this issue Nov 20, 2022 · 2 comments · Fixed by #5

Comments

@balessan
Copy link
Collaborator

Description: Information about supported storage types & payments

Path: /storages/

Arguments: None

Returns:

[
    {
        "type": "filecoin",
        "description":  "File storage on FileCoin",
        "payment":
            [ 
                {
                    "chainId": 1,
                    "acceptedTokens": 
                        [ 
                            "OCEAN": "0xOCEAN_on_MAINNET",
                            "DAI": "0xDAI_ON_MAINNET"
                        ]
                },
                {
                    "chainId": "polygon_chain_id",
                    "acceptedTokens": 
                        [ 
                            "OCEAN": "0xOCEAN_on_POLYGON",
                            "DAI": "0xDAI_ON_POLYGON"
                        ]
                }
            ]
    },
    {
        "type": "arweave",
        "description":  "File storage on Arweave",
        "payment":
            [ 
                {
                    "chainId": 1,
                    "acceptedTokens": 
                        [ 
                            "OCEAN": "0xOCEAN_on_MAINNET",
                            "DAI": "0xDAI_ON_MAINNET"
                        ]
                },
                {
                    "chainId": "arweave_chain_id",
                    "acceptedTokens": 
                        [ 
                            "ARWEAVE": "0xARWEAVEtoken_on_arweaveChain"
                        ]
                }
            ]
    }
]    
@balessan
Copy link
Collaborator Author

@alexcos20 @happy-dev : Three things for which I need your inputs here.

First, the result given as example is not a valid JSON as is, as JSON/JS do not support associative arrays (checked with JSON). As specified in the current PR, the format I propose is the following:

[
  {
    "type": "filecoin",
    "description": "The file coin storage description.",
    "payment_methods": [
      {
        "chain_id": "1",
        "accepted_tokens": [
          {
            "OCEAN": "0xOCEAN_on_MAINNET"
          },
          {
            "DAI": "0xDAI_ON_MAINNET"
          }
        ]
      },
      {
        "chain_id": "polygon_chain_id",
        "accepted_tokens": [
          {
            "OCEAN": "0xOCEAN_on_POLYGON"
          },
          {
            "DAI": "0xDAI_ON_POLYGON"
          }
        ]
      }
    ]
  }
]

Only change being the accepted tokens array format from

"acceptedTokens": 
[ 
    "OCEAN": "0xOCEAN_on_MAINNET",
    "DAI": "0xDAI_ON_MAINNET"
]

To

"accepted_tokens": [
  {
    "OCEAN": "0xOCEAN_on_MAINNET"
  },
  {
    "DAI": "0xDAI_ON_MAINNET"
  }
]

Is that ok ?

Second question, I see there is now a URL field on the storage objects which makes sense, but what are examples valid values for this field ?

Third question, the initial specification issue suggests to use a /info/ path. To be more REST compliant I suggest to use a GET on /storages/ for that. Is that ok ?

@happy-dev I'd like to discuss the chains vs accepted_tokens usage here.

@happy-dev
Copy link
Collaborator

happy-dev commented Nov 21, 2022

@balessan For questions n°1 and 3, they sound like valid points to me. I let @alexcos20 express his opinion since he has the final say on this.

Regarding question n°2, is this what you are looking for?

{
    "type": "filecoin",
    "description":  "File storage on FileCoin",
    "url": "http://microservice.url",
    "payment":
            [ 
                {
                    "chainId": 1,
                    "acceptedTokens": 
                        [ 
                            "OCEAN": "0xOCEAN_on_MAINNET",
                            "DAI": "0xDAI_ON_MAINNET"
                        ]
                },
                {
                    "chainId": "polygon_chain_id",
                    "acceptedTokens": 
                        [ 
                            "OCEAN": "0xOCEAN_on_POLYGON",
                            "DAI": "0xDAI_ON_POLYGON"
                        ]
                }
            ]
}  

I assume it is not but... I'm trying to help 😌

Call back whenever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants