Skip to content

Commit

Permalink
v1.1.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zinoadidi authored Apr 10, 2021
2 parents 5a282f2 + ec91924 commit 9c69b7c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.2](https://github.com/thenewboston-developers/thenewboston-js/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2021-04-10)


### Bug Fixes

* Replaced startCrawl and stopCrawl return types ([#136](https://github.com/thenewboston-developers/thenewboston-js/issues/136)) ([9f05092](https://github.com/thenewboston-developers/thenewboston-js/commit/9f05092d97e172eef5e1736a266795cfdc721632))

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

### Features
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thenewboston",
"version": "1.1.0-alpha.1",
"version": "1.1.0-alpha.2",
"description": "JavaScript library for thenewboston.",
"author": {
"name": "thenewboston-developers",
Expand Down
6 changes: 3 additions & 3 deletions src/bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import type {
PaginatedBlockEntry,
PaginatedValidatorEntry,
CleanResponse,
CrawlResponse,
CleanData,
CrawlData,
} from "./models";
import type { Account } from "./account";
import { CrawlResponse } from "./models/responses/generic/crawl";

/** Used for creating banks and sending requests easily to that specific bank server node. */
export class Bank extends ServerNode {
Expand Down Expand Up @@ -119,7 +119,7 @@ export class Bank extends ServerNode {
* @param account An Account created with the Network Id Signing key of the current Bank
*/
async startCrawl(account: Account) {
return await super.postData<CleanResponse>(
return await super.postData<CrawlResponse>(
"/crawl",
account.createSignedMessage<CrawlData>({ crawl: "start" })
);
Expand All @@ -130,7 +130,7 @@ export class Bank extends ServerNode {
* @param account An Account created with the Network Id Signing key of the current Bank
*/
async stopCrawl(account: Account) {
return await super.postData<CleanResponse>(
return await super.postData<CrawlResponse>(
"/crawl",
account.createSignedMessage<CrawlData>({ crawl: "stop" })
);
Expand Down
14 changes: 7 additions & 7 deletions src/confirmation-validator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Validator } from "./validator";
import type { Account } from "./account";
import type { ConfirmationValidatorConfigResponse, CrawlData, CrawlCommand, CleanResponse, CleanData } from "./models";
import type { ConfirmationValidatorConfigResponse, CleanResponse, CrawlResponse, CleanData, CrawlData } from "./models";

/** Used for connecting with and using confirmation validator server nodes. */
export class ConfirmationValidator extends Validator {
Expand All @@ -11,17 +11,17 @@ export class ConfirmationValidator extends Validator {

/** Gets the current crawl status */
async getCrawlStatus() {
return await super.getData("/crawl");
return await super.getData<CrawlResponse>("/crawl");
}

/**
* Sends a Post Request to the confirmation validator to start crawl process
* @param account An Account created with the Network Id Signing key of the current Confirmation Validator
*/
async startCrawl(account: Account) {
return await super.postData<CleanResponse>(
return await super.postData<CrawlResponse>(
"/crawl",
account.createSignedMessage<CleanData>({ clean: "start" })
account.createSignedMessage<CrawlData>({ crawl: "start" })
);
}

Expand All @@ -30,9 +30,9 @@ export class ConfirmationValidator extends Validator {
* @param account An Account created with the Network Id Signing key of the current Confirmation Validator
*/
async stopCrawl(account: Account) {
return await super.postData<CleanResponse>(
return await super.postData<CrawlResponse>(
"/crawl",
account.createSignedMessage<CleanData>({ clean: "stop" })
account.createSignedMessage<CrawlData>({ crawl: "stop" })
);
}

Expand Down Expand Up @@ -72,7 +72,7 @@ export class ConfirmationValidator extends Validator {
* @param protocol the protocol of the primary validator
* @param account the account that the current `ConfirmationValidator` is connected to
*/
async sendPrimaryValidatorUpdatedPing(ipAddress: string, port: string, protocol: string, account: Account) {
async sendPrimaryValidatorUpdatedPing(ipAddress: string, port: number, protocol: string, account: Account) {
return await super.postData(
"/primary_validator_updated",
account.createSignedMessage({ ip_address: ipAddress, port, protocol })
Expand Down
1 change: 1 addition & 0 deletions src/models/responses/generic/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type { AccountBalanceLockResponse } from "./account-balance-lock";
export type { AccountBalanceResponse } from "./account-balance";
export type { CleanResponse } from "./clean";
export type { CrawlResponse } from "./crawl";
4 changes: 2 additions & 2 deletions src/models/responses/pagination/entries/bank.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Protocol, Version } from "../../constants";
import type { Port, Protocol, Version } from "../../constants";

export interface PaginatedBankEntry {
account_number: string;
ip_address: string;
node_identifier: string;
port: number | null;
port: Port | null;
protocol: Protocol;
version: Version;
default_transaction_fee: number;
Expand Down
6 changes: 3 additions & 3 deletions src/models/responses/pagination/entries/validator.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Protocol, Version } from "../../constants";
import type { Port, Protocol, Version } from "../../constants";

export interface PaginatedValidatorEntry {
account_number: string;
ip_address: string;
node_identifier: string;
port: string | null;
port: Port | null;
protocol: Protocol;
version: Version;
default_transaction_fee: number;
root_account_file: string;
root_account_file_hash: string;
seed_block_identifier: string;
daily_confirmation_rate: number | null;
daily_confirmation_rate: Port | null;
trust: string;
}
3 changes: 1 addition & 2 deletions src/server-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
import type { Account } from "./account";
import type { Protocol } from "./models/responses/constants";
import { throwError } from "./utils";
import { CrawlResponse } from "./models/responses/generic/crawl";

/**
* Used internally for all server nodes.
Expand Down Expand Up @@ -95,7 +94,7 @@ export abstract class ServerNode {
* @param protocol the new node's protocol
* @param account the server account to validate the request
*/
async sendConnectionRequest(ipAddress: string, port: string, protocol: Protocol, account: Account) {
async sendConnectionRequest(ipAddress: string, port: number, protocol: Protocol, account: Account) {
return await this.postData(
"/connection_requests",
account.createSignedMessage({
Expand Down

0 comments on commit 9c69b7c

Please sign in to comment.