Socket
Socket
Sign inDemoInstall

@vechain/sdk-network

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vechain/sdk-network - npm Package Compare versions

Comparing version 1.0.0-beta.0 to 1.0.0-beta.1

6

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc