-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,982 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,5 @@ types | |
|
||
# Development File | ||
dev.js | ||
dev.ts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.