Skip to content

Commit

Permalink
v1.1.0-alpha.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zinoadidi authored Apr 1, 2021
2 parents 6de52e8 + edb88d2 commit f1d03ad
Show file tree
Hide file tree
Showing 47 changed files with 1,982 additions and 268 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

** Pull Requests **
All Pull Request should be made against development branch read contributors guide for more information about contributing
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ A description of how the contributor's work should behave.
<!-- Do not remove these notices! -->
#### Please ask for this task to be assigned to you and earn and its sweet reward 😉
#### Remember to include your account number in your PR description for us to pay you 💰

** Pull Requests **
All Pull Request should be made to development branch, read contributors guild for more information about contributing
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ types

# Development File
dev.js
dev.ts

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.1.0-alpha.0](https://github.com/thenewboston-developers/thenewboston-js/compare/v1.0.3...v1.1.0-alpha.0) (2021-04-01)


### Features

* added getCrawlStatus ([#91](https://github.com/thenewboston-developers/thenewboston-js/issues/91)) ([409d559](https://github.com/thenewboston-developers/thenewboston-js/commit/409d559513579d00a66a6b62fe73645f97d449c7))
* Bulk payments ([#82](https://github.com/thenewboston-developers/thenewboston-js/issues/82)) ([28b3ca9](https://github.com/thenewboston-developers/thenewboston-js/commit/28b3ca9f0633a185cb2be2e919637423615ece3d))
* Get bank pv ([#89](https://github.com/thenewboston-developers/thenewboston-js/issues/89)) ([99b0d17](https://github.com/thenewboston-developers/thenewboston-js/commit/99b0d17b34d9ed3fd85f3c88c00323fc58a1ea49))
* getCleanStatus(), startClean() and stopClean() ([#97](https://github.com/thenewboston-developers/thenewboston-js/issues/97)) ([3037330](https://github.com/thenewboston-developers/thenewboston-js/commit/303733002c478e3e09b38f531a4c5791b632b446))
* Tx fees ([#92](https://github.com/thenewboston-developers/thenewboston-js/issues/92)) ([8650634](https://github.com/thenewboston-developers/thenewboston-js/commit/8650634454a78fbe2b53cdb55b3d118938cc8cf5))

# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
180 changes: 0 additions & 180 deletions changelog.html

This file was deleted.

79 changes: 79 additions & 0 deletions docs/account-payment-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Account Payment Handler

In this section, we will look at the methods of the `AccountPaymentHandler` class, which allows a client to make transactions using a specific bank.

## Sending Coins

Any application or user send coins by using a bank to process an account's transactions.

> **Note**: Before you can send coins you need to call the `init()` method in order to update to retrieve the details and transactions fees for the **Bank** and **Primary Validator**
Coins can be sent by using the `sendCoins()` method.

```ts
const sendersAccount = new Account("fakeSigningKey");
const bankUrl = "http://18.218.193.164";

const paymentHandlerOptions = {
account: sendersAccount,
bankUrl: bankUrl,
};

const paymentHandler = new tnb.AccountPaymentHandler(paymentHandlerOptions);

// This is very important.
// Method for getting the Bank and Primary validator Transactions fees
await paymentHandler.init();

//This can be a new Account object or just the recipients account number
const recipientAccount = new Account("fakeSigningKey");
const amount = 1000;

await sendCoins(recipientAccount, 1000);
```

## Send Bulk Payments

Any application or user can send multiple coins to multiple recipients from a single account.

> **Note**: Before you can send coins you need to call the `init()` method in order to update to retrieve the details and transactions fees for the **Bank** and **Primary Validator**
Bulk payments can be sent by using the `sendBulkPayments()` method.

```ts
const sendersAccount = new Account("fakeSigningKey");
const bankUrl = "http://18.218.193.164";

const paymentHandlerOptions = {
account: sendersAccount,
bankUrl: bankUrl,
};

const paymentHandler = new tnb.AccountPaymentHandler(paymentHandlerOptions);

// This is very important.
// Method for getting the Bank and Primary validator Transactions fees
await paymentHandler.init();

/* Note
The sender cannot be listed as a recipient
A recipient cannot be listed more than once
*/

const txs = [
{
amount: 10,
recipient: "fakeAccountNumber1",
},
{
amount: 100,
recipient: "fakeAccountNumber2",
},
{
amount: 1000,
recipient: "fakeAccountNumber3",
},
];

await sendBulkPayments(txs);
```
9 changes: 1 addition & 8 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,13 @@ Account.isValidPair("SIGNING_KEY", "ACCOUNT_NUMBER"); // returns true only if th

## Using Signed Data and Signed Messages

We have already talked about creating signatures, so let's learn how we can apply them to creating signed data and signed messages. Signed data and signed messages are very similar, with the only difference being that signed messages have an extra `node_identifier` property. Here is an example of us creating signed data and a signed message:
We have already talked about creating signatures, so let's learn how we can apply them to creating signed messages. Here is an example of us creating a signed message:

> Note that all of the `signature` and `node_identifier` properties that we are generating are _almost_ random as we are not passing any arguments into the `Account` class.
```ts
const account = new Account();

account.createSignedData({ name: "Bacon" });

// {
// data: { name: 'Bacon' },
// signature: '68202fd5336c57dd42ba116fbf4154b7ef797473c7bc04949fef943c37b7b448ababf22c94711cd5f0fc603f5bd7d10d4e96dff9c876599de9fe887dfffe6d01'
// }

account.createSignedMessage({ name: "Tuna" });

// {
Expand Down
Loading

0 comments on commit f1d03ad

Please sign in to comment.