bity 0.3.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

Bity library #

pub package

A library for communicating with the Bity API. Some calls are missing.

Examples #

Get an estimate #

  var client = Client('https://exchange.api.bity.com/');
  print(await client.estimate(inputCurrency: "BTC", inputAmount: 1, outputCurrency: "CHF"));
  client.close();

Create a crypto to fiat order #

In this example you want to buy 1000 CHF for Ether. How much Ether that is going to cost can be found by looking at the generated order.

  var client = Client('https://exchange.api.bity.com/');
  var uuid = await client.createCryptoToFiatOrder(inputCurrency: "ETH", outputCurrency: "CHF", outputAmount: 1000, outputIban: "some iban", "owner": {"name": "some name", "address": "some street", "zip": "some zip", "city": "some city", "country": "some country CODE!"}, "reference": "a reference"));
  print(uuid);
  client.close();

View order #

  var client = Client('https://exchange.api.bity.com/');
  print(await client.getOrder("some uuid"));
  client.close();

Installing #

Add it to your pubspec.yaml:

dependencies:
  bity: any

Licence overview #

All files in this repository fall under the license specified in COPYING. The project is licensed as AGPL with a lesser clause. It may be used within a proprietary project, but the core library and any changes to it must be published online. Source code for this library must always remain free for everybody to access.

Thanks #

v0.3.5

  • Add priceGuaranteed to Order

v0.3.4

  • Add a list of countries that support receiving fiat

v0.3.3

  • Add optional reference field to createCryptoToFiatOrder call

v0.3.2

  • Add OrderAmountTooLow exception

v0.3.1

  • Handle 'exceeds_quota' error

v0.3.0

  • Order placement needs an Owner
  • Order queries need a session identifier

v0.2.6

  • Updated API endpoints
  • Fix bug in which amount was not submitted as a String

v0.2.5

  • Workaround Bity's inability to handle URL encoding

v0.2.4

  • Fix createCryptoToFiatOrder call

v0.2.3

  • Add getOrders call

v0.2.2

  • Add IBAN validation

v0.2.1

  • Add Output class

v0.2.0

  • Add Order class

v0.1.1

  • Tidy up code base

v0.1.0

  • Initial release

example/main.dart

import 'package:bity/bity.dart';

void main() async {
  var client = Client('https://exchange.api.bity.com/');
  var estimate = await client
      .getEstimate(inputCurrency: "BTC", inputAmount: 1, outputCurrency: "EUR")
      .timeout(const Duration(seconds: 2));
  print('1 BTC costs $estimate EUR');

  var owner = Owner(
    "Some street",
    "Some city",
    "Some zip",
    "AT",
    "Some name",
  );
  await client.createCryptoToFiatOrder(
    inputCurrency: "BTC",
    outputAmount: 10.0,
    outputCurrency: "EUR",
    outputIban: "AT611904300234573201",
    owner: owner,
    reference: "inapay",
  );
  var orders = await client.getOrders();
  print('Orders: $orders');
  client.close();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  bity: ^0.3.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:bity/bity.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4

Health suggestions

Format lib/src/client.dart.

Run dartfmt to format lib/src/client.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0+1 0.12.0+2
iban ^0.1.0 0.1.1
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
mod97 0.1.0
path 1.6.4
pedantic 1.9.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
mock_web_server ^4.0.0
test ^1.3.4