NonceGeek / Tai-Shang-Soul-Card

A web3 Namecard project using TaiShang Micro FaaS!
MIT License
11 stars 6 forks source link

Snippet: SpeedRunFetcher.ex #6

Open leeduckgo opened 2 years ago

leeduckgo commented 2 years ago

requirment:

fetch data from api of speedrun, and parser it for our need.

API Example:

get https://bewater.leeduckgo.com/builders

Response:

[
   ...
      {
  "id": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
  "creationTimestamp": 1633088553224,
  "role": "builder",
  "challenges": {
    "simple-nft-example": {
      "status": "ACCEPTED",
      "contractUrl": "https://etherscan.io/address/0xde30da39c46104798bb5aa3fe8b9e0e1f348163f",
      "deployedUrl": "https://github.com/austintgriffith/scaffold-eth/tree/simple-nft-example_v1",
      "reviewComment": "Nice work!"
    },
    "decentralized-staking": {
      "status": "REJECTED",
      "contractUrl": "https://etherscan.io/address/0xde30da39c46104798bb5aa3fe8b9e0e1f348163f",
      "deployedUrl": "https://github.com/austintgriffith/scaffold-eth/tree/challenge-1-decentralized-staking_v1",
      "reviewComment": "It throws an error when opening the app."
    }
  }
},
   ...
]

Input:

ethereum_addr, speedrun_api_endpoint, speedrun_url

Output:

%{chanllege_passed_num: num,  link: link_to_speedrun_profile, level: caculated_level_by_chanllege_passed_num}
kenspirit commented 2 years ago

@leeduckgo speedrun_api_endpoint, speedrun_url 分别是啥? https://bewater.leeduckgo.com/buildersspeedrun_api_endpoint? link_to_speedrun_profile 是什么?level 怎么计算?返回最后一个 ACCEPTED 的 challenge 名字?

leeduckgo commented 2 years ago

https://bewater.leeduckgo.com/builders = speedrun_api_endpoint

speedrun_url = https://speedrun-noncegeek.surge.sh/

link_to_speedrun_profile = https://speedrun-noncegeek.surge.sh/builders/0x73c7448760517E3E6e416b2c130E3c6dB2026A1d

level 的计算,现在先随便编一个?根据 accepted 的 challenge 的数量得出一个 level