{
"name": "7461796C6F7273776966742E636F6D" (1)
}
HTTP API
DeNS Query provides an HTTP interface for accessing the UTxOs stored in the database.
Authentication
Some endpoints provided by DeNS Query are exposed internal functionalities to and are made available to facilitate testing and development.
|
Important
|
To prevent malicious interactions/modifications of DeNS Query’s database, it is therefore expected that these endpoints must NOT be exposed publicly (i.e., not accessible to end-users). For this to be effective, a HTTPS reverse proxy may be used to:
|
Below is a list of these internal endpoints that should not be exposed in the public API:
HTTP Endpoints
POST Query Set Insertion UTxO
- Method
-
POST
- URL
-
/api/query-set-insertion-utxo
Returns the UTxO to spend in order to purchase the given domain from the smart contracts.
-
Hex encoded domain name one wishes to purchase
{
"name": "Ok",
"fields":
[
{
"name": "676F6F676C652E636F6D", (1)
"pointer": (2)
{
"currency_symbol":
"0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F",
"token_name": ""
},
"txOutRef": (3)
{
"txOutRef": (4)
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"txOutRefIx": 69 (5)
}
}
]
}
-
Hex encoded largest purchased domain name which is lexicograpically strictly less than the provided domain name.
-
Asset class which identifies the UTxOs of RRs
-
Transaction output that this information resides at
-
Hex encoded transaction hash
-
Integer index
Errors
Code |
Message |
Description |
400 |
Thrown if the domain name to purchase has already been purchased |
|
500 |
Thrown if there are no UTxOs to spend in the set (most likely a misconfigured protocol) |
POST Protocol UTxO
- Method
-
POST
- URL
-
/api/query-protocol-utxo
Returns the UTxO which holds the Protocol type i.e., trusted information of the DeNS protocol.
{ }
{
"name": "Ok",
"fields":
[
{
"txOutRef": (1)
{
"txOutRef": (2)
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"txOutRefIx": 69 (3)
},
"protocol": (4)
{
"elementIdMintingPolicy":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"setElemMintingPolicy" :
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"setValidator":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"recordsValidator":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
]
}
-
Transaction output that this information resides at
-
Hex encoded transaction hash
-
Integer index
-
JSON object of hex encoded script hashes (28 bytes)
Errors
Code |
Message |
Description |
500 |
Thrown if there is no UTxO for the protocol |
POST Set Protocol NFT
- Method
-
POST
- URL
-
/api/set-protocol-nft
Sets the protocol NFT to the provided protocol NFT returning the new protocol NFT that DeNS Query now follows. In other words, recalling that all instances of the DeNS protocol are uniquely identified by a protocol NFT, setting the protocol NFT to a new protocol NFT therefore changes the instance of the DeNS protocol that this DeNS Query server follows.
{
"protocolNft":
{
"currency_symbol":
"0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F",
"token_name":
""
}
}
{
"name": "Ok",
"fields":
[
{
"protocolNft":
{
"currency_symbol":
"0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F",
"token_name":
""
}
}
]
}
LambdaBuffers
All datum described in the requests and responses in HTTP Endpoints have an associated LambdaBuffers type with generated JSON parsers. Details can be found in the LambdaBuffers schema file given below
module Dens.Server
import Prelude (Eq, Json, Text)
import Plutus.V1 (TxOutRef, AssetClass, Bytes)
import Dens.Db (DensProtocolUtxo, DensSetUtxo)
---------------------------------------------------
-- Response type
---------------------------------------------------
sum Response a
= Ok a
| Failed ResponseFailed
record ResponseFailed = { error: Text }
derive Eq (Response a)
derive Json (Response a)
derive Eq ResponseFailed
derive Json ResponseFailed
---------------------------------------------------
-- Set insertion request / response
---------------------------------------------------
record QueryDensSetInsertionUtxoRequest = { name : Bytes }
prod QueryDensSetInsertionUtxoResponse = (Response DensSetUtxo)
derive Eq QueryDensSetInsertionUtxoRequest
derive Json QueryDensSetInsertionUtxoRequest
derive Eq QueryDensSetInsertionUtxoResponse
derive Json QueryDensSetInsertionUtxoResponse
---------------------------------------------------
-- Set query request / response
---------------------------------------------------
-- TODO(jaredponn): implementing this would be useful for updates, but we don't
-- support this now.
-- record QueryDensSettxoRequest = { name : Bytes }
-- prod QueryDensSetUtxoResponse = (Response DensSetUtxo)
--
-- derive Eq QueryDensSetUtxoRequest
-- derive Json QueryDensSetUtxoRequest
--
-- derive Eq QueryDensSetUtxoResponse
-- derive Json QueryDensSetUtxoResponse
---------------------------------------------------
-- Protocol info query / response
---------------------------------------------------
-- TODO(jaredponn): LB doesn't like JSON objects for empty records. I'll PR
-- this in LB.
-- record QueryDensProtocolUtxoRequest = { }
prod QueryDensProtocolUtxoResponse = (Response DensProtocolUtxo)
-- derive Eq QueryDensProtocolUtxoRequest
-- derive Json QueryDensProtocolUtxoRequest
derive Eq QueryDensProtocolUtxoResponse
derive Json QueryDensProtocolUtxoResponse
---------------------------------------------------
-- Set protocol NFT query /response
---------------------------------------------------
record SetProtocolNftRequest = { protocolNft: AssetClass }
prod SetProtocolNftResponse = (Response SetProtocolNftRequest)
derive Eq SetProtocolNftRequest
derive Json SetProtocolNftRequest
derive Eq SetProtocolNftResponse
derive Json SetProtocolNftResponse