Skip to content

andro-devs/blockfrost-dart

 
 

Repository files navigation

Build status

blockfrost-dart


Dart SDK for Blockfrost.io API.

Getting startedUsage


Getting started

To use this SDK, you first need login into to blockfrost.io create your project to retrieve your API token.


Usage

Using the SDK is pretty straight-forward as you can see from the following example.

Cardano

import 'package:blockfrost_api/blockfrost_api.dart';

void main() async {
  String projectId = "<insert project id>";

  String out;

  try {
    BlockService service = BlockService(Service.networkCardanoMainnet, projectId);

    BlockContent block = await service.getLatestBlock();

    out = block.hash;
  }

  catch (e) {
    out = e.toString();
  }

  print(out);
}

How to run the unit tests?

Note: Replace the placeholders by values from https://blockfrost.io/dashboard

PROJECT_ID_MAINNET="[YOUR_PROJECT_ID_MAINNET_HERE]" PROJECT_ID_IPFS="YOUR_PROJECT_IPFS_ID" dart run test test/

About

Dart SDK for the Blockfrost.io API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 100.0%