haveno_dart 0.1.0
haveno_dart: ^0.1.0 copied to clipboard
Dart client library for the Haveno daemon gRPC API, ported from haveno-ts.
haveno_dart #
Dart client library for the Haveno daemon, ported from the TypeScript library haveno-ts.
import 'package:haveno_dart/haveno.dart';
final alice = HavenoClient('http://localhost:8080', 'apitest');
final balances = await alice.getBalances();
final paymentAccounts = await alice.getPaymentAccounts();
final myOffers = await alice.getMyOffers('ETH');
final offers = await alice.getOffers('ETH', OfferDirection.BUY);
final trade = await alice.takeOffer(offers[0].id, paymentAccounts[0].id);
await alice.disconnect();
Transport #
The client speaks gRPC to the daemon's API port. On the Dart VM / Flutter mobile and
desktop it uses native gRPC over HTTP/2; on Flutter web it automatically uses gRPC-web
(point it at an Envoy / gRPC-web proxy, as haveno-ts does). A custom ClientChannel can
be injected via HavenoClient(url, password, channel: ...).
Development #
dart pub get
dart analyze
dart test # unit tests + client tests against an in-process fake daemon
tool/generate_protos.sh ../haveno # regenerate lib/src/protobuf from haveno's .proto files
Regenerating requires protoc and dart pub global activate protoc_plugin (>= 22 for protobuf 6).