Skip to content

Commit 0f563c8

Browse files
committed
Add xrpl mapping info
1 parent 5becb54 commit 0f563c8

File tree

4 files changed

+2686
-2
lines changed

4 files changed

+2686
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
import requests
3+
import tokenomics_decentralization.helper as hlp
4+
import logging
5+
6+
logging.basicConfig(format='[%(asctime)s] %(message)s', datefmt='%Y/%m/%d %I:%M:%S %p', level=logging.INFO)
7+
8+
api_url = 'https://api.xrpscan.com/api/v1/names/well-known'
9+
response = requests.get(api_url)
10+
data = response.json()
11+
12+
data_dir = hlp.MAPPING_INFO_DIR / "addresses"
13+
logging.info(f'Saving XRPL address info to {data_dir / "xrpl.jsonl"}')
14+
15+
with open(data_dir / 'xrpl.jsonl', 'w') as outfile:
16+
for entry in data:
17+
# rename account to address for consistency
18+
if 'account' in entry:
19+
entry['address'] = entry.pop('account')
20+
# add source field
21+
entry['source'] = 'https://api.xrpscan.com'
22+
json_line = json.dumps(entry)
23+
outfile.write(json_line + '\n')

0 commit comments

Comments
 (0)