web3go-xyz / web3go.xyz

Discovery data value of Web3
Apache License 2.0
10 stars 4 forks source link

sublink service development #14

Closed happyJ2024 closed 2 years ago

happyJ2024 commented 2 years ago
happyJ2024 commented 2 years ago
  1. sublink的swagger 文档 https://web3go.xyz/sublink/ => http://18.163.114.136:30001/api/

  2. get Price:

var fetch = require('node-fetch');

fetch('https://web3go.xyz/oracle/getPrice', {
    method: 'POST',
    headers: {
        'User-Agent': 'Apipost client Runtime/+https://www.apipost.cn/',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ "symbol": "DOT" })
});
  1. get polkadot balance detail
    
    var fetch = require('node-fetch');

fetch('https://web3go.xyz/polkadot-balance/polkadot-balance-analysis/getAccountDetail', { method: 'POST', headers: { 'User-Agent': 'Apipost client Runtime/+https://www.apipost.cn/', 'Content-Type': 'application/json' }, body: JSON.stringify({ "account_id": "1kroLNzcZDxc9p3KdRdwbAxTSR4Tmxzzfgc2CH9peL5Mnaw", "time_start": "2022-01-04T13:16:37.324Z", "time_end": "2022-01-04T13:16:37.324Z", "include_transactions_detail": true }) });

happyJ2024 commented 2 years ago
  1. get chains
    
    var fetch = require('node-fetch');

fetch('https://web3go.xyz/sublink/parachain/getAllSupportedChains', { method: 'POST', headers: { 'User-Agent': 'Apipost client Runtime/+https://www.apipost.cn/', 'Content-Type': 'application/json' } });

happyJ2024 commented 2 years ago
  1. ss58transform
    
    var fetch = require('node-fetch');

fetch('https://web3go.xyz/sublink/parachain/ss58transform', { method: 'POST', headers: { 'User-Agent': 'Apipost client Runtime/+https://www.apipost.cn/', 'Content-Type': 'application/json' }, body: JSON.stringify({ "account": "15MtNMKZUFjHoWzqQzQ8ntuXaAB8KHb3QSf5SeXfkqpBh45i", "networks": [ "polkadot" ], "filter_no_symbol": true }) });

happyJ2024 commented 2 years ago

Balance 显示流程: 1, 进入Profile 页面时 , 调用 接口https://web3go.xyz/sublink/parachain/getAllSupportedChains

  1. 输入地址, 回车=》 调用接口https://web3go.xyz/sublink/parachain/ss58transform 得到了AddressList

  2. 默认选择的是 Balance Tab

  3. 根据Address List 循环, 一次性发送所有的请求到接口: https://web3go.xyz/sublink/parachain/getBalance , 得到 每一个token的 balance。

  4. 根据Address List 循环, 一次性发送所有的请求到接口: https://web3go.xyz/oracle/getPrice { "symbol": "DOT" }

  5. Price * Balance = Value

  6. 最上面的total amount= Sum(Value).

  7. 点击token表格中的某个token,显示明细, 调用接口:https://web3go.xyz/polkadot-balance/polkadot-balance-analysis/getAccountDetail

happyJ2024 commented 2 years ago

Defi cdp api:

curl --location --request POST 'https://web3go.xyz/sublink/defi/karura/getLoanPositionList' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'Content-Type: application/json' \
--data '{
    "pageSize": 10,
    "pageIndex": 1,
    "orderBys": [],
    "chain": "Karura",
    "symbol": "KSM",
    "accountId": "rLLs6M3ss96nMPjmV5c5gByx4qhur2zAKRE8mzm2YZi7EGd",
    "filterStatus": [],
    "hideLoanCompleted": false
}'

note: account_id 是karura链的账户地址

页面链接地址: Karura CDP: https://web3go.xyz/#/CDPDetail?loanPositionId=693&accountId=rLLs6M3ss96nMPjmV5c5gByx4qhur2zAKRE8mzm2YZi7EGd

happyJ2024 commented 2 years ago

nft api

curl --location --request POST 'https://web3go.xyz/sublink/nft/rmrk/getAccountOwnedNFT' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'origin: http://localhost:10005' \
--header 'Content-Type: application/json' \
--data '{
  "account_id": "8949162-e0b9bdcc456a36497a-KANBIRD-KANL-00001695"
}'

note: account_id 是kusama链的账户地址

页面链接地址: Collection: https://web3go.xyz/#/NftDetail?back=NFTProfiler&id=e0b9bdcc456a36497a-KANBIRD&symbol=KANBIRD

NFT: https://web3go.xyz/#/NftItemDetail?id=8949162-e0b9bdcc456a36497a-KANBIRD-KANR-00000842

happyJ2024 commented 2 years ago

polkadot crowdloan

note: account是polkadot 链的账户地址

get contribution detail of account:

curl --location --request POST 'https://web3go.xyz/polkadot/parachain-analysis/getCrowdloanContributions' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'Content-Type: application/json' \
--data '{

    "account": "JGmrBLZEqaaqLrfRmXkZhsD4JhoPkjRkfXJjj9smCk2UoYA",

}'

get parachain info

curl --location --request POST 'https://web3go.xyz/polkadot/parachain-analysis/getPolkParaChainList' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'Content-Type: application/json' \
--data ''
happyJ2024 commented 2 years ago

kusama crowdloan

note: account是kusama 链的账户地址

get contribution detail of account:

curl --location --request POST 'https://web3go.xyz/kusama /parachain-analysis/getCrowdloanContributions' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'Content-Type: application/json' \
--data '{

    "account": "FcPK96da7tjqzxxLHoTpGbS59ywakFs2g6SSg8xFQznRWKW",

}'

get parachain info

curl --location --request POST 'https://web3go.xyz/kusama /parachain-analysis/getPolkParaChainList' \
--header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \
--header 'Content-Type: application/json' \
--data ''