trtlservices 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

TRTL Service Dart API Interface #

This wrapper allows you to easily interact with the TRTL Services v1 API to quickly develop applications that interact with the TurtleCoin Network.

Table of Contents #

  1. Installation
  2. Intialization
  3. Documentation
  4. Methods

Installation #

trtlservice: 0.1.1

Intialization #

import 'package:trtlservice/trtlservices.dart';

TRTLServices trtlServices = TRTLServices('eyJhbGciOiJIUzUxMiIsInR5fCI6IkpXVCJ9.eyJuYW1lIjoidGVzdCIsImFwcElkIjo0LCJ1c2VySWQiOjYsInBlcm1pc3Npb25zIjpbIwFkZHJlc3M6bmV3Il0sImlhdCI6MTUzMjU4NTM2NywiZXhwIjoxNT25MTc3MzY3LCJhdWQiOiJ0dXJ0bGV3YWxsZXQuaW8iLCJpc3MiOiJUUlRMIFNlcnZpY2VzIiwianRpIjoiMzMioQ.AEHXmvTo8RfNuZ15Y3IGPRhZPaJxFSmOZvVv2YGN9L4We7bXslIPxhMv_n_5cNW8sIgE2Fr-46OTb5H5AFgpjA', Duration(milliseconds: 20));
You can leave the last field (timeout) blank to default to 2000 milliseconds. #

Documentation #

API documentation is available at https://trtl.services/docs

Methods #

Note: All functions return a Future and need to be awaited #

createAddress() #

Create a new TRTL address

trtlServices.createAddress()

getAddress(address) #

Get address details by address

trtlServices.getAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

deleteAddress(address) #

Delete a selected TRTL address

trtlServices.deleteAdddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

getAddresses() #

View all addresses belonging to the specified token.

trtlServices.getAddresses()

scanAddress(address, blockIndex) #

Scan an address for transactions between a 100 block range starting from the specified blockIndex.

trtlServices.scanAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A", 899093)

getAddressKeys(address) #

Get the public and secret spend key of an address.

trtlServices.getAddressKeys("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

integrateAddress(address, paymentId) #

Create an integrated address with an address and payment ID.

trtlServices.integrateAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A", "7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804")

getIntegratedAddresses(address) #

Get all integrated addresses that belong to the specified address.

trtlServices.getIntegratedAddresses("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

getFee(amount) #

Calculate the TRTL Services fee for an amount specified in TRTL with two decimal points.

trtlServices.getFee(1092.19)

createTransfer(sender, receiver, amount, fee, paymentId, extra) #

Send a TRTL transaction with an address with the amount specified two decimal points.

trtlServices.createTransfer(
  "TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A",
  "TRTLuzAzNs1E1RBFhteX56A5353vyHuSJ5AYYQfoN97PNbcMDvwQo4pUWHs7SYpuD9ThvA7AD3r742kwTmWh5o9WFaB9JXH8evP",
  1000.01,
  1.2,
  "7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804",
  "3938f915a11582f62d93f82f710df9203a029f929fd2f915f2701d947f920f99"
)

You can leave the last two fields (paymentId and extra) blank. #

getTransfer(hash) #

Get a transaction created with TRTL Services by hash.

trtlServices.getTransfer("EohMUzR1DELyeQM9RVVwpmn5Y1DP0lh1b1ZpLQrfXQsgtvGHnDdJSG31nX2yESYZ")

getWallet() #

Get wallet container info and health check.

trtlServices.getWallet()

getStatus() #

Get the current status of the TRTL Services infrastructure.

trtlServices.getStatus()

License #

Copyright (C) 2018 Fexra, The TurtleCoin Developers
Copyright (C) 2019 TheDOme6

Please see the included LICENSE file for more information.

0.1.1 #

  • Format code

0.1.0 #

  • Initial version

example/trtlservices_example.dart

// Copyright (c) 2019, TheDOme6
//
// Please see the included LICENSE file for more information.
import 'package:trtlservices/trtlservices.dart';

main() async {
  TRTLServices trtlServices = TRTLServices(
      'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoidGVzdCIsImFwcElkIjozNywidXNlcklkIjo0MSwicGVybWlzc2lvbnMiOlsiYWRkcmVzczpuZXciLCJhZGRyZXNzOnZpZXciLCJhZGRyZXNzOnNjYW4iLCJhZGRyZXNzOmV4cG9ydCIsImFkZHJlc3M6ZGVsZXRlIiwidHJhbnNmZXI6bmV3IiwidHJhbnNmZXI6dmlldyJdLCJpYXQiOjE1NTIxMzQ0MjUsImV4cCI6MTU4MzY5MjAyNSwiYXVkIjoid3d3Lm5vdHJhaXQuY29tIiwiaXNzIjoiVFJUTCBTZXJ2aWNlcyIsImp0aSI6IjUwIn0.bnLXr9YQlmrYKkVob0e0dkgjBUt8nhSfB-Hn4N-6FX_ZKADkJVnCNWBSSQW4GnIAotEQXSheoWI4t1iEuZ-wYQ',
      Duration(seconds: 10));

  // Create a new TRTL address.
  await trtlServices.createAddress();

  // Get address details by address.
  await trtlServices.getAddress(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A');

  // Delete a selected TRTL address.
  await trtlServices.deleteAddress(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A');

  // View all addresses belonging to the specified token.
  await trtlServices.getAddresses();

  // Scan an address for transactions between a 100 block range starting from the specified blockIndex.
  await trtlServices.scanAddress(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A',
      899093);

  // Get the public and secret spend key of an address.
  await trtlServices.getAddressKeys(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A');

  // Create an integrated address with an address and payment ID.
  await trtlServices.integrateAddress(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A',
      '7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804');

  // Get all integrated addresses that belong to the specified address.
  await trtlServices.getIntegratedAddresses(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A');

  // Calculate the TRTL Services fee for an amount specified in TRTL with two decimal points.
  await trtlServices.getFee(1092.19);

  // Send a TRTL transaction with an address with the amount specified two decimal points.
  await trtlServices.createTransfer(
      'TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A',
      'TRTLuzAzNs1E1RBFhteX56A5353vyHuSJ5AYYQfoN97PNbcMDvwQo4pUWHs7SYpuD9ThvA7AD3r742kwTmWh5o9WFaB9JXH8evP',
      1000.01,
      1.2,
      '7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804',
      '3938f915a11582f62d93f82f710df9203a029f929fd2f915f2701d947f920f99');

  // Get a transaction details specified by transaction hash.
  await trtlServices.getTransfer(
      '381ad3d32f12e9e2cfb17ea1b32e8d9d781d2b44c6db63371ac61796dd2e75e8');

  // Get wallet container info and health check.
  await trtlServices.getWallet();

  // Get the current status of the TRTL Services infrastructure.
  await trtlServices.getStatus();

  // Generate a random Payment Id.
  TRTLServices.generatePaymentId();
}

Use this package as a library

1. Depend on it

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


dependencies:
  trtlservices: ^0.1.1

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:trtlservices/trtlservices.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:trtlservices/trtlservices.dart with components: io.

Health suggestions

Fix lib/src/trtlservices_base.dart. (-1 points)

Analysis of lib/src/trtlservices_base.dart reported 2 hints:

line 115 col 20: Avoid using null in if null operators.

line 116 col 16: Avoid using null in if null operators.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
http ^0.12.0+1 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.7
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.0.0