diff --git a/CHANGELOG.md b/CHANGELOG.md index 4affae49..3c57d37a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package-lock.json b/package-lock.json index 729f746c..9ee6a7b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "thenewboston", - "version": "1.1.0-alpha.1", + "version": "1.1.0-alpha.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ceb86ad5..4bd773c2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/bank.ts b/src/bank.ts index 9d432a01..b4e50a1c 100644 --- a/src/bank.ts +++ b/src/bank.ts @@ -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 { @@ -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( + return await super.postData( "/crawl", account.createSignedMessage({ crawl: "start" }) ); @@ -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( + return await super.postData( "/crawl", account.createSignedMessage({ crawl: "stop" }) ); diff --git a/src/confirmation-validator.ts b/src/confirmation-validator.ts index dc61e18b..de321784 100644 --- a/src/confirmation-validator.ts +++ b/src/confirmation-validator.ts @@ -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 { @@ -11,7 +11,7 @@ export class ConfirmationValidator extends Validator { /** Gets the current crawl status */ async getCrawlStatus() { - return await super.getData("/crawl"); + return await super.getData("/crawl"); } /** @@ -19,9 +19,9 @@ export class ConfirmationValidator extends Validator { * @param account An Account created with the Network Id Signing key of the current Confirmation Validator */ async startCrawl(account: Account) { - return await super.postData( + return await super.postData( "/crawl", - account.createSignedMessage({ clean: "start" }) + account.createSignedMessage({ crawl: "start" }) ); } @@ -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( + return await super.postData( "/crawl", - account.createSignedMessage({ clean: "stop" }) + account.createSignedMessage({ crawl: "stop" }) ); } @@ -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 }) diff --git a/src/models/responses/generic/index.ts b/src/models/responses/generic/index.ts index ffa89892..7ba1ad71 100644 --- a/src/models/responses/generic/index.ts +++ b/src/models/responses/generic/index.ts @@ -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"; diff --git a/src/models/responses/pagination/entries/bank.ts b/src/models/responses/pagination/entries/bank.ts index 550c5a5f..aa4edb6e 100644 --- a/src/models/responses/pagination/entries/bank.ts +++ b/src/models/responses/pagination/entries/bank.ts @@ -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; diff --git a/src/models/responses/pagination/entries/validator.ts b/src/models/responses/pagination/entries/validator.ts index f098593f..51f6f93b 100644 --- a/src/models/responses/pagination/entries/validator.ts +++ b/src/models/responses/pagination/entries/validator.ts @@ -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; } diff --git a/src/server-node.ts b/src/server-node.ts index 7b001b87..3798390f 100644 --- a/src/server-node.ts +++ b/src/server-node.ts @@ -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. @@ -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({