trtlservices 0.1.1 copy "trtlservices: ^0.1.1" to clipboard
trtlservices: ^0.1.1 copied to clipboard

discontinued

Dart wrapper for TRTL Services API.

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();
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Dart wrapper for TRTL Services API.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on trtlservices