@vechain/sdk-network
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
{ | ||
"name": "@vechain/sdk-network", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "This module allows to connect you seamlessly to the VechainThor blockchain", | ||
@@ -37,6 +37,6 @@ "author": "vechain Foundation", | ||
"@types/ws": "^8.5.10", | ||
"@vechain/sdk-core": "1.0.0-beta.0", | ||
"@vechain/sdk-errors": "1.0.0-beta.0", | ||
"@vechain/sdk-core": "1.0.0-beta.1", | ||
"@vechain/sdk-errors": "1.0.0-beta.1", | ||
"axios": "^1.6.7" | ||
} | ||
} |
@@ -153,7 +153,7 @@ import { assert, DATA } from '@vechain/sdk-errors'; | ||
/** | ||
* Retrieves details of the finalized block. | ||
* Retrieves the finalized block. | ||
* | ||
* @returns A promise that resolves to an object containing the block details. | ||
* @returns A promise that resolves to an object containing the finalized block. | ||
*/ | ||
public async getFinalBlock(): Promise<CompressedBlockDetail | null> { | ||
public async getFinalBlockCompressed(): Promise<CompressedBlockDetail | null> { | ||
return await this.getBlockCompressed('finalized'); | ||
@@ -163,2 +163,11 @@ } | ||
/** | ||
* Retrieves details of the finalized block. | ||
* | ||
* @returns A promise that resolves to an object containing the finalized block details. | ||
*/ | ||
public async getFinalBlockExpanded(): Promise<ExpandedBlockDetail | null> { | ||
return await this.getBlockExpanded('finalized'); | ||
} | ||
/** | ||
* Synchronously waits for a specific block revision using polling. | ||
@@ -168,8 +177,9 @@ * | ||
* @param options - (Optional) Allows to specify timeout and interval in milliseconds | ||
* @returns A promise that resolves to an object containing the block details. | ||
* @returns A promise that resolves to an object containing the compressed block. | ||
*/ | ||
public async waitForBlock( | ||
private async _waitForBlock( | ||
blockNumber: number, | ||
expanded: boolean, | ||
options?: WaitForBlockOptions | ||
): Promise<CompressedBlockDetail | null> { | ||
): Promise<CompressedBlockDetail | ExpandedBlockDetail | null> { | ||
assert( | ||
@@ -187,3 +197,6 @@ 'waitForBlock', | ||
return await Poll.SyncPoll( | ||
async () => await this.getBestBlockCompressed(), | ||
async () => | ||
expanded | ||
? await this.getBestBlockCompressed() | ||
: await this.getBestBlockExpanded(), | ||
{ | ||
@@ -200,2 +213,38 @@ requestIntervalInMilliseconds: options?.intervalMs, | ||
/** | ||
* Synchronously waits for a specific block revision using polling. | ||
* | ||
* @param blockNumber - The block number to wait for. | ||
* @param options - (Optional) Allows to specify timeout and interval in milliseconds | ||
* @returns A promise that resolves to an object containing the compressed block. | ||
*/ | ||
public async waitForBlockCompressed( | ||
blockNumber: number, | ||
options?: WaitForBlockOptions | ||
): Promise<CompressedBlockDetail | null> { | ||
return (await this._waitForBlock( | ||
blockNumber, | ||
false, | ||
options | ||
)) as CompressedBlockDetail | null; | ||
} | ||
/** | ||
* Synchronously waits for a specific expanded block revision using polling. | ||
* | ||
* @param blockNumber - The block number to wait for. | ||
* @param options - (Optional) Allows to specify timeout and interval in milliseconds | ||
* @returns A promise that resolves to an object containing the expanded block details. | ||
*/ | ||
public async waitForBlockExpanded( | ||
blockNumber: number, | ||
options?: WaitForBlockOptions | ||
): Promise<ExpandedBlockDetail | null> { | ||
return (await this._waitForBlock( | ||
blockNumber, | ||
false, | ||
options | ||
)) as ExpandedBlockDetail | null; | ||
} | ||
/** | ||
* Returns the head block (best block). | ||
@@ -202,0 +251,0 @@ * @returns {BlockDetail | null} The head block (best block). |
@@ -20,3 +20,3 @@ /* --- Input options start --- */ | ||
/** | ||
* Options for `waitForBlock` method. | ||
* Options for `waitForBlockCompressed` and `waitForBlockExpanded` methods. | ||
*/ | ||
@@ -23,0 +23,0 @@ interface WaitForBlockOptions { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
526955
11596
5
+ Added@vechain/sdk-core@1.0.0-beta.1(transitive)
+ Added@vechain/sdk-errors@1.0.0-beta.1(transitive)
- Removed@vechain/sdk-core@1.0.0-beta.0(transitive)
- Removed@vechain/sdk-errors@1.0.0-beta.0(transitive)