Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

TelePay-cash/telepay-dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dart SDK for the TelePay API

TelePay Dart

TelePay client library for the Dart language, so you can easely process cryptocurrency payments using the REST API.

License: MIT Last commit GitHub commit activity Github Stars Github Forks Github Watchers GitHub contributors Telegram Blog

Package Pub
telepay pub package
telepay_dio pub package
telepay_http pub package
telepay_hooks (Coming soon)

Index

Installation

Add to dependencies on pubspec.yaml:

dependencies:
    telepay_dio: <version>

Using the library

The first thing is to create an instance of TelePayDio for later use, which receives two parameters, your secret API key and an instance of Dio.

  final telepay = TelePayDio(secretApiKey: 'your_secret_api_key', dio: Dio());

🚨 WARNING 🚨 Your secretApiKey is confidential and meant to be used by you. Anyone who has your project key can access your merchant. Please, do not share it or commit it in your code.

Methods

getMe

Get the current merchant info.

final me = await telepay.getMe();
getAssets

Get all the assets suported by TelePay.

final assets = await telepay.getAssets();
getBalance

Get the balance of the all your wallets.

final balance = await telepay.getBalance();
getInvoices

Get all the invoices the your merchant.

final invoices = await telepay.getInvoices();
createInvoice

Creates an invoice, associated to your merchant.

final invoiceCreate = await telepay.createInvoice(
    const CreateInvoice(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 3.5,
    ),
);
getInvoice

Get a specific invoice etails, by invoice number.

final invoice = await telepay.getInvoice('YYXZT1U7Q2P8');
cancelInvoice

Cancel invoice, by its number.

final invoiceCancel = await telepay.cancelInvoice('FNGUA7LR6B');
deleteInvoice

Delete invoice, by its number.

final isDelete = await telepay.deleteInvoice('FNGUA7LR6BYYY');
transfer

Create a tranferent between internal wallets, thsi is a off-chain operation

final transfer = await telepay.transfer(
    const CreateTransfer(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 3.5,
        username: 'yeikel16',
    ),
);
getWithdrawMinimum

Get minimum fee for a specific asset for withdraw.

final withdrawMin =
    await telepay.getWithdrawMinimum('TON', 'TON', 'testnet');
getWithdrawFee

Get estimated withdraw fee, composed of blockchain fee and processing fee.

final withdrawFee = await telepay.getWithdrawFee(
    const CreateWithdraw(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 5.2,
        toAddress: 'EQAwEl_ExMqFJIjfitPRPTdV_B9KTgHG-YognX6iKRWHdpX1',
    ),
);
withdraw

Withdraw funds to a specific address

    final withdraw = await telepay.withdraw(
      const CreateWithdraw(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 5.2,
        toAddress: 'EQAwEl_ExMqFJIjfitPRPTdV_B9KTgHG-YognX6iKRWHdpX1',
      ),
    );

Tests

To run all unit tests use the following command:

dart test --coverage="/coveraga" --test-randomize-ordering-seed random

To view the generated coverage report you can use coverde.

# Filter the tested files.
coverde filter -f \.g\.dart

# Generate Coverage Report and open in browser.
coverde report -l

Bugs or Requests

If you want to report a problem or would like to add a new feature, feel free to open an issue on GitHub. Pull requests are also welcome.

Contributors ✨

The library is made by (emoji key):


Yeikel Uriarte Arteaga

πŸ’»

Luis Antonio Correa Leyva

πŸ’»

Carlos Lugones

πŸ§‘β€πŸ«

This project follows the all-contributors specification. Contributions of any kind welcome!