Skip to content

Commit 84ec669

Browse files
Deploy unfinished version of Dandelion pages via Markdown
1 parent 43ee76f commit 84ec669

18 files changed

+891
-47
lines changed

components/Layouts/DandelionLayout.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function CskCard({ children }) {
2+
return (
3+
<div className='box-border shadow-xl h-auto w-1/2 mx-auto my-4 p-4 border-4 bg-purple-200 bg-opacity-50'>
4+
{children}
5+
</div>
6+
)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: 'cardano-node-socket'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# cardano-node-socket
8+
## [coming-soon] cardano-node-socket-over-https
9+
10+
You can use this REST API to setup a local socket file and use cardano-cli against it
11+
12+
cardano-cli is the first class citizen supporting every new blockchain feature, and this endpoint helps to transport a cardano-node's socket to you using a secure HTTPS tunnel.\n Currently access to this API is enabled on demand. Authorization and secure channel is setup with https://github.com/jpillora/chisel and TCP-to-socket termination can be done by using `socat`
13+
14+
![](/showcase-comingsoon.jpg)
15+
16+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-node#cardano-cli)
17+
- [Official Documentation](https://github.com/input-output-hk/cardano-node/blob/master/cardano-cli/README.md)
18+
19+
20+
- "mainnet": { "version": "1.25.1" }
21+
- "testnet": { "version": "1.25.1" }
22+
23+
- [testnet](https://cardano-node-socket.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
24+
- [mainnet](https://cardano-node-socket.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
25+
26+
27+
```
28+
~~~bash
29+
# TODO
30+
~~~
31+
```

data/dandelion-pages/explorer-api.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: 'explorer-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# cardano-rest/explorer-api
8+
## You can use this REST API to gather basic info from the blockchain
9+
10+
This is the currently officially supported API to explore Cardano transactions. In future it may be augmented or replaced by cardano-graphql, but cardano-explorer-api will be supported for some time, even once alternatives become available.
11+
12+
![](/showcase-explorer-api.png)
13+
14+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-rest#overview)
15+
- [Official Documentation](https://input-output-hk.github.io/cardano-rest/explorer-api)
16+
- mainnet: `"version": "3.1.1"`
17+
- testnet: `"version": "3.1.1"`
18+
- [testnet](https://explorer-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
19+
- [mainnet](https://explorer-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
20+
21+
```
22+
- [graphql](https://github.com/input-output-hk/cardano-graphql/tree/master/packages/api-cardano-db-hasura/src/example_queries)
23+
- bash:
24+
~~~bash
25+
curl -s \\
26+
https://explorer-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`/api/txs/last
27+
~~~
28+
```

data/dandelion-pages/graphql-api.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: 'graphql-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# graphql-api
8+
## hasura/graphql-api
9+
10+
You can use this GraphQL API to gather composed info from the blockchain
11+
12+
GraphQL is a query language and execution environment with server and client implementations across many programming languages. The language can be serialized for network transmission, schema implementations hashed for assurance, and is suited for describing most domains.\nCardano project is implementing a GraphQL API, to make exploring blockchain data a breeze.
13+
14+
![](showcase-graphql-api.png)
15+
16+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-graphql#overview)
17+
- [Official Documentation](https://input-output-hk.github.io/cardano-graphql/)
18+
19+
- "mainnet": { "version": "3.2.0" }
20+
- "testnet": { "version": "3.2.0" }
21+
22+
- [testnet](https://graphql-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
23+
- [mainnet](https://graphql-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
24+
25+
26+
```
27+
- bash:
28+
~~~bash
29+
# query db sync status
30+
curl -H 'Content-Type: application/json' \\
31+
-H 'Accept: application/json' \\
32+
--data-binary \\
33+
'{"query": \
34+
"query cardanoDbSyncProgress {\\n\
35+
cardanoDbMeta {\\n\
36+
initialized\\n\
37+
syncPercentage\\n\
38+
}\\n\
39+
}\\n\
40+
"}' \\
41+
https://graphql-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`
42+
~~~
43+
```

data/dandelion-pages/ogmios-api.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: 'ogmios-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# ogmios-api
8+
## headerTitle: "KtorZ's cardano-node ogmios-api
9+
10+
You can use this JSON-WSP (websocket) API to gather live blockchain info directly from a cardano-node instance
11+
12+
Ogmios is a translation service written in Haskell running on top of cardano-node. It offers a JSON-WSP interface through WebSockets and enables clients to speak Ouroboros' mini-protocols via remote procedure calls over JSON.
13+
14+
![](/showcase-ogmios-api.png)
15+
- [View on IOHK GitHub](https://github.com/KtorZ/cardano-ogmios)
16+
- [Official Documentation](https://ktorz.github.io/cardano-ogmios/)
17+
18+
19+
- "mainnet": { "version": "2.0.0-beta" },
20+
- "testnet": { "version": "2.0.0-beta" },
21+
22+
- [testnet (wss)](https://ogmios-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
23+
- [mainnet (wss)](https://ogmios-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
24+
25+
```
26+
- bash (using [websocat](https://github.com/vi/websocat)):
27+
~~~bash
28+
echo '{ "type": "jsonwsp/request", "version": "1.0", "servicename": "ogmios", "methodname": "RequestNext", "args": {} }' \\
29+
| websocat --text -1 - wss://ogmios-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`
30+
31+
echo '{ "type": "jsonwsp/request", "version": "1.0", "servicename": "ogmios", "methodname": "FindIntersect", "args": { "points": [ "origin" ] } }' \\
32+
| websocat --text -1 - wss://ogmios-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`
33+
~~~
34+
```

data/dandelion-pages/postgrest-api.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: 'postgrest-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# postgrest-api
8+
## cardano-db-sync/postgrest-api
9+
10+
You can use this REST API to perform SQL queries to gather info from the blockchain.
11+
12+
Cardano DB Sync is to follow the Cardano chain and take information from the chain and an internally maintained copy of ledger state. Data is then extracted from the chain and inserted into a PostgreSQL database that can be accessed through a read-only REST API exposed by an instance of the postgREST project.
13+
14+
![](/showcase-postgrest-api.png)
15+
16+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-db-sync)
17+
- [Official Documentation](https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md)
18+
19+
20+
- "mainnet": { "version": "cardano-db-sync-8.0.0" }
21+
- "testnet": { "version": "cardano-db-sync-8.0.0" }
22+
23+
24+
- [testnet](https://postgrest-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
25+
- [mainnet](https://postgrest-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
26+
27+
```
28+
- bash:
29+
~~~bash
30+
# query available metadatums
31+
curl -s "https://postgrest-api.mainnet.dandelion.link/rpc/get_metadatum"
32+
# query metadatum 20201210
33+
curl -d metadatum=20201210 -s "https://postgrest-api.mainnet.dandelion.link/rpc/get_metadata" | jq .
34+
# query metadatum 42 for epoch 234-235 and limit results to 1
35+
curl -s -d metadatum=42 -d epochs={234,235} "https://postgrest-api.mainnet.dandelion.link/rpc/get_metadata?limit=1"
36+
# query metadata entry number 15
37+
curl -s "https://postgrest-api.mainnet.dandelion.link/tx_metadata?id=eq.15"
38+
# query pool metadata whose URL contains "repsistance"
39+
curl -s "https://postgrest-api.mainnet.dandelion.link/pool_meta_data?url=like.*repsistance*"
40+
# query metadata entries for SPOCRA proposalId "80064c28-1b03-4f1c-abf0-ca8c5a98d5b9"
41+
curl -s "https://postgrest-api.mainnet.dandelion.link/tx_metadata?json->>ProposalId=eq.80064c28-1b03-4f1c-abf0-ca8c5a98d5b9"
42+
# query metadata entries for the whole SPOCRA network
43+
curl -s "https://postgrest-api.mainnet.dandelion.link/tx_metadata?json->>NetworkId=eq.SPOCRA"
44+
# query transactions history for addresses array
45+
curl -X POST -H "Content-Type: application/json" -d '{ "data": { "addresses" : ["addr_test1vzep2se0nr849acwfnlpm2sa3sz726g6v78ej4sy9ewjprqmcl720","addr_test1qptw3z77j2vjhd45vdqhct46uvwucese43twz9afv0lt9h83lgv8qkdvg9akyn2yyrtp75sd6ejwl3m0f4qtve43ydnsckuvc4"] } }' -s "https://postgrest-api.testnet.dandelion.link/rpc/get_tx_history_for_addresses" | jq .
46+
# query delegation history for stake addresses array
47+
curl -X POST -H "Content-Type: application/json" -d '{ "data": { "addresses" : ["stake_test1uz605p766mvsyrufagjw5fepqfp8x9ff2ty2hzdrjuvuj8g5efx4w","stake_test1uq3zf47elmdxp92wgmcx4lrkjrlts5fffs36c7dz02d7faqye6l9j"] } }' -s "https://postgrest-api.testnet.dandelion.link/rpc/get_delegation_history_for_stake_address" | jq .
48+
# query addresses balance at the end of a given epoch
49+
curl -X POST -H "Content-Type: application/json" -d '{ "data": { "epoch": "105", "addresses" : ["addr_test1vzep2se0nr849acwfnlpm2sa3sz726g6v78ej4sy9ewjprqmcl720","addr_test1qptw3z77j2vjhd45vdqhct46uvwucese43twz9afv0lt9h83lgv8qkdvg9akyn2yyrtp75sd6ejwl3m0f4qtve43ydnsckuvc4"] } }' -s "https://postgrest-api.testnet.dandelion.link/rpc/get_eoe_balance_for_addresses" | jq .
50+
~~~
51+
52+
[Postgrest documentation](http://postgrest.org/en/latest/api.html) will be handy to explore the whole Cardano network throuh this API.
53+
54+
```

data/dandelion-pages/rosetta-api.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: 'rosetta-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
8+
# rosetta-api
9+
## rosetta-api
10+
11+
Rosetta is an open-source specification and set of tools that makes integrating with blockchains simpler, faster, and more reliable.
12+
13+
![](/showcase-rosetta-api.png)
14+
15+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-rosetta)
16+
- [Official Documentation](https://github.com/input-output-hk/cardano-rosetta#documentation)
17+
18+
19+
- "mainnet": { "version": "1.1.0" },
20+
- "testnet": { "version": "1.1.0-testnet" },
21+
22+
23+
- [testnet](https://rosetta-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
24+
- [mainnet](https://rosetta-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
25+
26+
```
27+
- bash:
28+
~~~bash
29+
curl -X POST -H 'Content-Type: application/json' --data '{"network_identifier":{"blockchain":"cardano","network":"testnet"},"block_identifier":{"index":100}}' https://rosetta-api.testnet.dandelion.link/block
30+
~~~
31+
```

data/dandelion-pages/submit-api.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: 'submit-api'
3+
date: '05-02-2021'
4+
version: 1
5+
---
6+
7+
# submit-api
8+
## cardano-rest/submit-api
9+
10+
You can use this REST API to send signed-transactions to the blockchain
11+
12+
This is the currently officially supported API to submit signed Cardano transactions to the blockchain.
13+
14+
![](showcase-submit-api.png)
15+
- [View on IOHK GitHub](https://github.com/input-output-hk/cardano-rest#overview)
16+
- [Official Documentation](https://input-output-hk.github.io/cardano-rest/submit-api/)
17+
18+
- "mainnet": { "version": "3.1.1" },
19+
- "testnet": { "version": "3.1.1" },
20+
21+
- [testnet](https://submit-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`)
22+
- [mainnet](https://submit-api.mainnet.`+process.env.REACT_APP_API_DOMAIN+`)
23+
24+
```
25+
- bash:
26+
~~~bash
27+
# '/tmp/cbor-tx' should be a file containing
28+
# a valid 'application/cbor' signed transaction (in e.g., from cardano-cli)
29+
curl -X POST \\
30+
--header "Content-Type: application/cbor" \\
31+
--data-binary @/tmp/cbor-tx \\
32+
https://submit-api.testnet.`+process.env.REACT_APP_API_DOMAIN+`/api/submit/tx
33+
~~~
34+
```

lib/dandelions.js

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
import matter from 'gray-matter'
4+
import remark from 'remark'
5+
import html from 'remark-html'
6+
7+
const dapisDirectory = path.join(process.cwd(), 'data/dandelion-pages')
8+
9+
export function getSortedDapisData() {
10+
// Get file names under /posts
11+
const fileNames = fs.readdirSync(dapisDirectory)
12+
const dapisData = fileNames.map(fileName => {
13+
// Remove ".md" from file name to get id
14+
const id = fileName.replace(/\.md$/, '')
15+
16+
// Read markdown file as string
17+
const fullPath = path.join(dapisDirectory, fileName)
18+
const fileContents = fs.readFileSync(fullPath, 'utf8')
19+
20+
// Use gray-matter to parse the post metadata section
21+
const matterResult = matter(fileContents)
22+
23+
// Combine the data with the id
24+
return {
25+
id,
26+
...matterResult.data
27+
}
28+
})
29+
// Sort posts by date
30+
return dapisData.sort((a, b) => {
31+
if (a.date < b.date) {
32+
return 1
33+
} else {
34+
return -1
35+
}
36+
})
37+
}
38+
39+
export async function getAllDapiData(id) {
40+
const fullPath = path.join(dapisDirectory, `${id}.md`)
41+
const fileContents = fs.readFileSync(fullPath, 'utf8')
42+
43+
// Use gray-matter to parse the post metadata section
44+
const matterResult = matter(fileContents)
45+
46+
// Use remark to convert markdown into HTML string
47+
const processedContent = await remark()
48+
.use(html)
49+
.process(matterResult.content)
50+
const contentHtml = processedContent.toString()
51+
52+
// Combine the data with the id and contentHtml
53+
return {
54+
id,
55+
contentHtml,
56+
...matterResult.data
57+
}
58+
}
59+
60+
export function getAllDapiIds() {
61+
const fileNames = fs.readdirSync(dapisDirectory)
62+
63+
return fileNames.map(fileName => {
64+
return {
65+
params: {
66+
id: fileName.replace(/\.md$/, '')
67+
}
68+
}
69+
})
70+
}
71+
72+
export async function getDapiData(id) {
73+
const fullPath = path.join(dapisDirectory, `${id}.md`)
74+
const fileContents = fs.readFileSync(fullPath, 'utf8')
75+
76+
// Use gray-matter to parse the dapi metadata section
77+
const matterResult = matter(fileContents)
78+
79+
// Use remark to convert markdown into HTML string
80+
const processedContent = await remark()
81+
.use(html)
82+
.process(matterResult.content)
83+
const contentHtml = processedContent.toString()
84+
85+
// Combine the data with the id
86+
return {
87+
id,
88+
contentHtml,
89+
...matterResult.data
90+
}
91+
}

next.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
webpack: (config, { isServer }) => {
3+
// Fixes npm packages that depend on `fs` module
4+
if (!isServer) {
5+
config.node = {
6+
fs: 'empty'
7+
}
8+
}
9+
10+
return config
11+
}
12+
}

0 commit comments

Comments
 (0)