0.11.2 • Published 4 years ago

trtl-apps v0.11.2

Weekly downloads
3
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

trtl-apps

a node-js package for interacting with turtle apps.

Full API Documentation can be found here

Quickstart

Create an app using the TRTL apps console

Install the package

npm install trtl-apps --save

Initialize your app

import { TrtlApp } from 'trtl-apps';

TrtlApp.initialize('YOUR_APP_ID', 'YOUR_APP_SECRET');

Create accounts

const [alice, error]  = await TrtlApp.createAccount();
const [bob, error]    = await TrtlApp.createAccount();

console.log(`alice deposit address: ${alice.depositAddress}`);

Transfer from one account to another

const [transfer, error] = await TrtlApp.transfer(alice.id, bob.id, 120);

if (transfer) {
    console.log(`transfer succeeded, transfer id: ${transfer.id}`);
}

Account preview withdrawal

const accountId = '8RgwiWmgiYKQlUHWGaTW';
const amount = 2100;
const address = 'TRTLv2fdtVVDjWKueQ1aAETchiGVWkDvi1ATNgqZ3nKc7biCLm7KzLYeCzfS46mWYNRe8JaMPcTGWAR874kkN2zQ7Mt16J1vzcA';

const [preview, error] = await TrtlApp.withdrawalPreview(accountId, amount, address);

if (preview) {
 console.log(`Withdrawal preview created successfully, id: ${preview.id}, fee: ${preview.fee}`);
}

Account withdraw

const [withdrawal, error] = await TrtlApp.withdraw(preview.id);

if (withdrawal) {
 console.log(`Withdrawal request created successfully and is beeing processed, paymentId: ${withdrawal.paymentId}`);
}

CI/CD

This project uses Github actions to automatically build and publish the node package to NPM when a new release tag is created. For this to work correctly the following secret must be added to Github at settings -> secrets:

secret name: NPM_TOKEN secret value: YOUR NPM TOKEN

Contributing

Documentation

Compile the javascript

tsc

Generate documentation website. The copyfiles package must be installed globally

npm i copyfiles -g

Use the following command to generate the static documentation site.

npm run docs

Documentation is automatically hosted using github pages with each commit to the master branch

0.11.1

4 years ago

0.11.2

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.1

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.8

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago