Script using POKTscan GraphQL API to retrieve transactions and export them in the Koinly CSV format for tax purpose.
Write down your POKTSCAN_API_KEY
and NODE_ADDRESS
in your .envrc
.
Once written down, load your env with:
direnv allow
The getRewards.ts script, retrieves rewards for relays and blocks produces by your node.
You can adjust the date range by modifying startDate
and endDate
.
You can also modify the CSV filename and export path on line 45.
Once your setup is done, generate your CSV export with the following command:
yarn getRewards
The getTransfers.ts script, retrieves transfers from your node to another address.
You need to add the TO_ADDRESS
to your .envrc
and load it with:
direnv allow
You can adjust the date range by modifying startDate
and endDate
.
You can also modify the CSV filename and export path on line 39.
Once your setup is done, generate your CSV export with the following command:
yarn getTransfers
This project uses graphql-request to query GraphQL endpoints and json2csv to export results in a CSV file.
direnv is used to manage environment variables. You'll likely need to install it.
Copy .envrc.example
and write down the env variables needed to run this project:
cp .envrc.example .envrc
Once your env variables are setup, load them with:
direnv allow
Prettier is used to format TypeScript code. Use it by running:
yarn format
Or per file:
yarn format:file ./scripts/getRewards.ts