-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split API to resolve and verify, and init register page
- Loading branch information
Showing
8 changed files
with
166 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Register | ||
|
||
## Price | ||
|
||
Get the price for domain registering. | ||
|
||
**GET** https://cns.api.pawket.app/api/price | ||
|
||
**Request:** | ||
|
||
``` | ||
?name=123458.xch&year=1&renew=false | ||
``` | ||
|
||
| Key | Required? | Description | | ||
| ----- | --------- | -------------------------------------------------- | | ||
| name | Yes | the name to register, typically suffix with `.xch` | | ||
| year | Yes | how many year to register or renew, max 99 | | ||
| renew | No | whether to get price for register or renew | | ||
|
||
**Response:** | ||
|
||
```json | ||
{ | ||
"name": "123458.xch", | ||
"price": 400000000000, | ||
"annualFee": 250000000000, | ||
"registrationFee": 150000000000, | ||
"royaltyPercentage": 500, | ||
"success": true | ||
} | ||
``` | ||
|
||
| Key | Type | Description | | ||
| ----------------- | -------- | ---------------------------------------------- | | ||
| name | String | the name to register or renew | | ||
| price | Number | the total price for register or renew, in mojo | | ||
| annualFee | Number | the annual fee for this name, in mojo | | ||
| registrationFee | Number | the registration fee for this name, in mojo | | ||
| royaltyPercentage | Number | the royalty percentage in 1/10000, e.g. 500=5% | | ||
| success | Boolean | whether success to get price information | | ||
| code | String | if failed, this is the error code | | ||
| reason | String | if failed, this is the reason | | ||
| arguments | String[] | if failed, this is the arguments for reason | | ||
|
||
## Register | ||
|
||
Get the offer for registering or renewing. | ||
|
||
**POST** https://cns.api.pawket.app/api/register | ||
|
||
**Request:** | ||
|
||
```json | ||
{ | ||
"name": "123458.xch", | ||
"royaltyAddress": "", | ||
"address": "", | ||
"publicKey": "", | ||
"did": "", | ||
"text": "", | ||
"renew": false, | ||
"year": 1 | ||
} | ||
``` | ||
|
||
| Key | Required? | Description | | ||
| -------------- | --------- | -------------------------------------------------------------------- | | ||
| name | Yes | the name to register, typically suffix with `.xch` | | ||
| year | Yes | how many year to register or renew, max 99 | | ||
| royaltyAddress | No | the default royalty address of this CNS NFT, format like xch1... | | ||
| address | No | the default binding address, format like xch1 | | ||
| publicKey | No | the default binding publick key, format usually like 0x... | | ||
| did | No | the default binding DID, format like did:chia:... | | ||
| text | No | the default binding text, can be arbitrary text except double quotes | | ||
| renew | No | whether to get price for register or renew | | ||
|
||
**Response:** | ||
|
||
```json | ||
{ | ||
"name": "123458.xch", | ||
"offer": "offer1qqr83....", | ||
"image": "/9j/4AAQSkZJRg....", | ||
"success": true | ||
} | ||
``` | ||
|
||
| Key | Type | Description | | ||
| --------- | -------- | ------------------------------------------- | | ||
| name | String | the name to register or renew | | ||
| image | String | the NFT image in base64 | | ||
| offer | String | the offer string | | ||
| success | Boolean | whether success to get register offer | | ||
| code | String | if failed, this is the error code | | ||
| reason | String | if failed, this is the reason | | ||
| arguments | String[] | if failed, this is the arguments for reason | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Verify | ||
|
||
The security of CNS resolving can be greatly upgraded by doing verification, which require access to synchronized full node. | ||
|
||
The quick and dirty way is just resolve without verify, but to resist the malicious resolver, the client are persuade to verify the proof in the client side. | ||
|
||
Here is the steps: | ||
|
||
1. download coin data from blockchain for the proof coin | ||
2. parse(uncurry) the coin and check the correctness of name and binding address | ||
3. check the next coin of this proof coin is not spent (that the proof coin is the latest changes) | ||
|
||
## API to check coin | ||
|
||
Different client may have different way to get the coin details, here is one way to demonstrate this function. | ||
|
||
**POST** https://walletapi.chiabee.net/Wallet/get-coin-solution | ||
|
||
**Request:** | ||
|
||
```json | ||
{ | ||
"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 | ||
} | ||
] | ||
``` |
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# API | ||
|
||
| API | Path | Type | Summary | | ||
| ---------- | ------------------------------------------------------ | ---- | ------------------------------------------ | | ||
| [Resolve] | https://walletapi.chiabee.net/Name/resolve | POST | resolve address or name | | ||
| [Resolve] | https://walletapi.chiabee.net/Name/all | GET | get all names and corresponding address | | ||
| [Verify] | https://walletapi.chiabee.net/Wallet/get-coin-solution | POST | get the information for verification | | ||
| [Register] | https://cns.api.pawket.app/api/price | GET | get price for the CNS to register or renew | | ||
| [Register] | https://cns.api.pawket.app/api/register | POST | request to register or renew certain CNS | | ||
|
||
- for testnet, prefix `testnet.` | ||
- Resolving/Verify: https://testnet.walletapi.chiabee.net/ | ||
- Register: https://testnet.cns.api.pawket.app/ | ||
|
||
[resolve]: Resolve.md | ||
[verify]: Verify.md | ||
[register]: Register.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters