Skip to content

Commit

Permalink
format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
wizicer committed Feb 19, 2024
1 parent eafda13 commit 776623f
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions src/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Resolve

**NOTE:**
**NOTE:**

1. You can access the hosting service of CNS, or resolve it by yourself with or without this [reference code](https://github.com/SutuLabs/pawket-api)
2. We are still working towards a more decentralized solution like the mechanism in the inscription chain.

Expand All @@ -13,31 +14,33 @@ Here you can resolve the address through our API for demonstration purpose.
**POST** https://walletapi.chiabee.net/Name/resolve

**Request:**

```json
{
"queries": [
{
"name": "chianameservice.xch",
"type": "address"
}
]
"queries": [
{
"name": "chianameservice.xch",
"type": "address"
}
]
}
```

**Response:**

```json
{
"answers": [
{
"name": "chianameservice.xch",
"type": "address",
"time_to_live": 600,
"data": "2fa8cc93dec82f50a7781ced27b6c2ee5a8e5efd1d70606b877c58bb8545e906",
"proof_coin_name": "0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d",
"proof_coin_spent_index": 4952003,
"nft_coin_name": "0x56506bca506dc262a27355a08f77d45c02bc7b48de09d1b1ab4d84864bd370df"
}
]
"answers": [
{
"name": "chianameservice.xch",
"type": "address",
"time_to_live": 600,
"data": "2fa8cc93dec82f50a7781ced27b6c2ee5a8e5efd1d70606b877c58bb8545e906",
"proof_coin_name": "0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d",
"proof_coin_spent_index": 4952003,
"nft_coin_name": "0x56506bca506dc262a27355a08f77d45c02bc7b48de09d1b1ab4d84864bd370df"
}
]
}
```

Expand All @@ -63,6 +66,7 @@ Sometime, we need to reverse resolving, from address to name, here is the exampl
**POST** https://walletapi.chiabee.net/Name/resolve

**Request:**

```json
{
"queries": [
Expand All @@ -75,6 +79,7 @@ Sometime, we need to reverse resolving, from address to name, here is the exampl
```

**Response:**

```json
{
"answers": [
Expand Down Expand Up @@ -110,45 +115,44 @@ Different client may have different way to get the coin details, here is one way
**POST** https://walletapi.chiabee.net/Wallet/get-coin-solution

**Request:**

```json
{
"coinIds": [
"0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d"
]
"coinIds": ["0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d"]
}
```

**Response:**

```json
[
{
"coin": {
"amount": 1,
"parent_coin_info": "0x804037b1362351a6e9b29f0dc3a821a81143dc499fd953a1b9573ed95fc4836e",
"puzzle_hash": "0x10d14864451e4c2e6e94d58512b29f7de603e77713ed62e4b23f1b8af44f3b0d"
},
"puzzle_reveal": "0xff02ffff01ff02ffff0...",
"solution": "0xffffa0793d3984ad2321...",
"confirmed_index": 4946819,
"spent_index": 4952003,
"timestamp": 1707986063
}
{
"coin": {
"amount": 1,
"parent_coin_info": "0x804037b1362351a6e9b29f0dc3a821a81143dc499fd953a1b9573ed95fc4836e",
"puzzle_hash": "0x10d14864451e4c2e6e94d58512b29f7de603e77713ed62e4b23f1b8af44f3b0d"
},
"puzzle_reveal": "0xff02ffff01ff02ffff0...",
"solution": "0xffffa0793d3984ad2321...",
"confirmed_index": 4946819,
"spent_index": 4952003,
"timestamp": 1707986063
}
]
```

## Retrieve All

For some application, it's better to get all domain names at once, and resolve them locally with periodical update.


### API to resolve all

Here you can resolve the address through our API for demonstration purpose. (this API is not opened yet, but will be in next update)

**GET** https://walletapi.chiabee.net/Name/all


**Response:**

```json
[
{
Expand All @@ -174,7 +178,6 @@ Here you can resolve the address through our API for demonstration purpose. (thi

the `address` is the Hex format of address, convert to xch address [by bech32m tool](https://mixch.dev/#/tools/address).


## UI

**Loading**
Expand All @@ -193,4 +196,4 @@ After verifying, it could tell user it's verified.

If the address is not found in the resolver, then the error may tell user.

![](cns-not-found.png)
![](cns-not-found.png)

0 comments on commit 776623f

Please sign in to comment.