Skip to content

Script using POKTscan GraphQL API to retrieve transactions and export them in the Koinly CSV format for tax purpose

Notifications You must be signed in to change notification settings

PierrickGT/pokt-koinly-accounting

Repository files navigation

pokt-koinly-accounting

Script using POKTscan GraphQL API to retrieve transactions and export them in the Koinly CSV format for tax purpose.

Usage

Write down your POKTSCAN_API_KEY and NODE_ADDRESS in your .envrc.

Once written down, load your env with:

direnv allow

getRewards

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

getTransfers

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

Development

This project uses graphql-request to query GraphQL endpoints and json2csv to export results in a CSV file.

Env

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

Code quality

Prettier is used to format TypeScript code. Use it by running:

yarn format

Or per file:

yarn format:file ./scripts/getRewards.ts

About

Script using POKTscan GraphQL API to retrieve transactions and export them in the Koinly CSV format for tax purpose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published