Skip to content

Commit 882d3d7

Browse files
authored
feat: add doc sample for A8 (#129)
1 parent a75dc3e commit 882d3d7

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
sidebar_position: 5
3+
sidebar_label: Sample with Ancient8
4+
---
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
8+
# Sample with Ancient8
9+
Ancient8 Chain is a gaming-focused community-driven Ethereum layer 2, currently supported on Horoscope (dev and staging environments with [link](/product/horoscope/#horoscope))
10+
11+
## 1. Querying ERC20
12+
13+
#### List all ERC20 asset of one address
14+
It can be retrieved from the Horoscope like shown below:
15+
16+
<Tabs groupId="example">
17+
<TabItem value="ancient8" label="ancient8">
18+
19+
```bash
20+
curl 'https://indexer-v2.dev.aurascan.io/api/v2/graphql' \
21+
-H 'content-type: application/json' \
22+
--data-raw '{"operationName":"MyQuery","variables":{},"query":"query MyQuery {\n ancient8 {\n account(where: {address: {_eq: \"0x69e1a5a8ea4f587bc0ea3748409ee9c57dcc0ce7\"}}) {\n id\n account_balances {\n amount\n denom\n }\n }\n }\n}\n"}'
23+
```
24+
</TabItem>
25+
</Tabs>
26+
27+
#### Parse output
28+
This is an output of get detail ERC20:
29+
```json
30+
{
31+
"code": 200,
32+
"message": "Successful",
33+
"data": {
34+
"ancient8": {
35+
"account": [
36+
{
37+
"id": 5998,
38+
"account_balances": [
39+
{
40+
"amount": "88888000000000000000000",
41+
"denom": "0x38bb7b9b87bdfbed883aaf50a2f411d330fe32d6"
42+
},
43+
{
44+
"amount": "953333333000000000000000",
45+
"denom": "0xd47d6CEe7c7ABF10D23E514321d1095b4F5A5557"
46+
},
47+
{
48+
"amount": "4875723974012606",
49+
"denom": "wei"
50+
}
51+
]
52+
}
53+
]
54+
}
55+
}
56+
}
57+
```
58+
## 2. Querying ERC721
59+
60+
#### List all ERC721 asset of one address
61+
It can be retrieved from the Horoscope like shown below:
62+
63+
<Tabs groupId="example">
64+
<TabItem value="ancient8" label="ancient8">
65+
66+
```bash
67+
curl 'https://indexer-v2.dev.aurascan.io/api/v2/graphql' \
68+
-H 'content-type: application/json' \
69+
--data-raw '{"operationName":"MyQuery","variables":{},"query":"query MyQuery {\n ancient8 {\n erc721_token(\n where: {owner: {_eq: \"0xbc1fee05c54962c0371b681fdc23f956f9999999\"}}\n limit: 1\n ) {\n token_id\n media_info\n }\n }\n}"}'
70+
```
71+
</TabItem>
72+
</Tabs>
73+
74+
#### Parse output
75+
This is an output of get detail ERC20:
76+
```json
77+
{
78+
"code": 200,
79+
"message": "Successful",
80+
"data": {
81+
"ancient8": {
82+
"erc721_token": [
83+
{
84+
"token_id": "0",
85+
"media_info": {
86+
"onchain": {
87+
"metadata": {
88+
"name": "Cool Cat #10",
89+
"image": "https://ipfs.io/ipfs/QmdwsEVLVGcJZYd8tWcHShXkGkVG9pRQ7dLMWLFk223rfS",
90+
"points": {
91+
"Body": 0,
92+
"Face": 2,
93+
"Hats": 2,
94+
"Shirt": 2
95+
},
96+
"attributes": [
97+
{
98+
"value": "blue cat skin",
99+
"trait_type": "body"
100+
},
101+
{
102+
"value": "beret pink",
103+
"trait_type": "hats"
104+
},
105+
{
106+
"value": "overalls flannel",
107+
"trait_type": "shirt"
108+
},
109+
{
110+
"value": "three eyes",
111+
"trait_type": "face"
112+
},
113+
{
114+
"value": "wild_2",
115+
"trait_type": "tier"
116+
}
117+
],
118+
"ipfs_image": "https://ipfs.io/ipfs/QmdwsEVLVGcJZYd8tWcHShXkGkVG9pRQ7dLMWLFk223rfS",
119+
"description": "Cool Cats is a collection of 9,999 randomly generated and stylistically curated NFTs that exist on the Ethereum Blockchain. Cool Cat holders can participate in exclusive events such as NFT claims, raffles, community giveaways, and more. Remember, all cats are cool, but some are cooler than others. Visit [www.coolcatsnft.com](https://www.coolcatsnft.com/) to learn more.",
120+
"google_image": "https://drive.google.com/uc?id=1eMipW7qMtP8WImpJCGR1mkva52_ntY5w"
121+
},
122+
"token_uri": "https://api.coolcatsnft.com/cat/10"
123+
},
124+
"offchain": {
125+
"image": {
126+
"url": "https://nft.aurascan.io/ipfs/QmdwsEVLVGcJZYd8tWcHShXkGkVG9pRQ7dLMWLFk223rfS",
127+
"file_path": "ipfs/QmdwsEVLVGcJZYd8tWcHShXkGkVG9pRQ7dLMWLFk223rfS",
128+
"content_type": "image/png"
129+
},
130+
"animation": {}
131+
}
132+
}
133+
}
134+
]
135+
}
136+
}
137+
}
138+
```
139+
## 3. Querying transaction history
140+
141+
#### List all transaction history which from address
142+
It can be retrieved from the Horoscope like shown below:
143+
144+
<Tabs groupId="example">
145+
<TabItem value="ancient8" label="ancient8">
146+
147+
```bash
148+
curl 'https://indexer-v2.dev.aurascan.io/api/v2/graphql' \
149+
-H 'content-type: application/json' \
150+
--data-raw '{"operationName":"MyQuery","variables":{},"query":"query MyQuery {\n ancient8 {\n evm_transaction(\n where: {from: {_eq: \"0xbc1fee05c54962c0371b681fdc23f956f9999999\"}}\n limit: 2\n ) {\n to\n value\n data\n contract_address\n }\n }\n}"}'
151+
```
152+
</TabItem>
153+
</Tabs>
154+
155+
#### Parse output
156+
This is an output of get detail ERC20:
157+
```json
158+
{
159+
"code": 200,
160+
"message": "Successful",
161+
"data": {
162+
"ancient8": {
163+
"evm_transaction": [
164+
{
165+
"to": "0x521c3b3c412f81cf710b46537c55333922e14a43",
166+
"value": null,
167+
"data": "731133e9000000000000000000000000bc1fee05c54962c0371b681fdc23f956f99999990000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000014bc1fee05c54962c0371b681fdc23f956f9999999000000000000000000000000",
168+
"contract_address": null
169+
},
170+
{
171+
"to": "0x4200000000000000000000000000000000000006",
172+
"value": "0",
173+
"data": "095ea7b300000000000000000000000067807b9f5b9757c0c79347f0b3f360c15c5e6affffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
174+
"contract_address": null
175+
}
176+
]
177+
}
178+
}
179+
}
180+
```

0 commit comments

Comments
 (0)