@concordium/node-sdk
Advanced tools
Comparing version
# Changelog | ||
## 0.8.0 2022-05-?? | ||
## 1.0.0 2022-05-11 | ||
@@ -6,0 +6,0 @@ ### Added |
@@ -640,4 +640,2 @@ # concordium-node-sdk-js | ||
Retrieves the current amount of funds in the system at a specific block, and the state of the special accounts. | ||
Protocol version 4 expanded the amount of information in the response, so one should check the type to access that. | ||
This information includes information about the payday and total amount of funds staked. | ||
```js | ||
@@ -647,11 +645,11 @@ const blockHash = "7f7409679e53875567e2ae812c9fcefe90ced8961d08554756f42bf268a42749"; | ||
const rewardStatus = await client.getRewardStatus(blockHash); | ||
``` | ||
Protocol version 4 expanded the amount of information in the response, so one should check the type to access that. | ||
This information includes information about the payday and total amount of funds staked. | ||
```js | ||
if (isRewardStatusV1(rewardStatus)) { | ||
const nextPaydayTime = rewardStatus.nextPaydayTime; | ||
... | ||
} else if (isRewardStatusV0(rewardStatus)) { | ||
// This status is for a block from protocol version <= 3, so it will only have limited information | ||
... | ||
} | ||
... | ||
``` | ||
@@ -658,0 +656,0 @@ |
@@ -1,4 +0,3 @@ | ||
import { Authorizations, AuthorizationsV0, AuthorizationsV1, BlockSummary, BlockSummaryV0, BlockSummaryV1, ChainParameters, ChainParametersV0, ChainParametersV1, Keys, KeysV0, KeysV1, UpdateQueues, UpdateQueuesV0, UpdateQueuesV1, Updates, UpdatesV0, UpdatesV1 } from './types'; | ||
import { Authorizations, AuthorizationsV1, BlockSummary, BlockSummaryV0, BlockSummaryV1, ChainParameters, ChainParametersV0, ChainParametersV1, Keys, KeysV0, KeysV1, UpdateQueues, UpdateQueuesV0, UpdateQueuesV1, Updates, UpdatesV0, UpdatesV1 } from './types'; | ||
export declare const isAuthorizationsV1: (a: Authorizations) => a is AuthorizationsV1; | ||
export declare function isAuthorizationsV0(a: Authorizations): a is AuthorizationsV0; | ||
export declare const isChainParametersV1: (cp: ChainParameters) => cp is ChainParametersV1; | ||
@@ -5,0 +4,0 @@ export declare const isChainParametersV0: (cp: ChainParameters) => cp is ChainParametersV0; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isBlockSummaryV0 = exports.isBlockSummaryV1 = exports.isUpdatesV0 = exports.isUpdatesV1 = exports.isUpdateQueuesV0 = exports.isUpdateQueuesV1 = exports.isKeysV0 = exports.isKeysV1 = exports.isChainParametersV0 = exports.isChainParametersV1 = exports.isAuthorizationsV0 = exports.isAuthorizationsV1 = void 0; | ||
exports.isBlockSummaryV0 = exports.isBlockSummaryV1 = exports.isUpdatesV0 = exports.isUpdatesV1 = exports.isUpdateQueuesV0 = exports.isUpdateQueuesV1 = exports.isKeysV0 = exports.isKeysV1 = exports.isChainParametersV0 = exports.isChainParametersV1 = exports.isAuthorizationsV1 = void 0; | ||
const isAuthorizationsV1 = (a) => a.timeParameters !== undefined; | ||
exports.isAuthorizationsV1 = isAuthorizationsV1; | ||
function isAuthorizationsV0(a) { | ||
return a.timeParameters === undefined; | ||
} | ||
exports.isAuthorizationsV0 = isAuthorizationsV0; | ||
const isChainParametersV1 = (cp) => cp.mintPerPayday !== undefined; | ||
@@ -16,3 +12,3 @@ exports.isChainParametersV1 = isChainParametersV1; | ||
exports.isKeysV1 = isKeysV1; | ||
const isKeysV0 = (k) => isAuthorizationsV0(k.level2Keys); | ||
const isKeysV0 = (k) => !(0, exports.isAuthorizationsV1)(k.level2Keys); | ||
exports.isKeysV0 = isKeysV0; | ||
@@ -19,0 +15,0 @@ const isUpdateQueuesV1 = (uq) => uq.timeParameters !== undefined; |
@@ -1,3 +0,2 @@ | ||
import { RewardStatus, RewardStatusV0, RewardStatusV1 } from './types'; | ||
import { RewardStatus, RewardStatusV1 } from './types'; | ||
export declare function isRewardStatusV1(rs: RewardStatus): rs is RewardStatusV1; | ||
export declare function isRewardStatusV0(rs: RewardStatus): rs is RewardStatusV0; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isRewardStatusV0 = exports.isRewardStatusV1 = void 0; | ||
exports.isRewardStatusV1 = void 0; | ||
function isRewardStatusV1(rs) { | ||
@@ -8,5 +8,1 @@ return rs.protocolVersion !== undefined && rs.protocolVersion > 3n; | ||
exports.isRewardStatusV1 = isRewardStatusV1; | ||
function isRewardStatusV0(rs) { | ||
return rs.protocolVersion === undefined || rs.protocolVersion <= 3n; | ||
} | ||
exports.isRewardStatusV0 = isRewardStatusV0; |
{ | ||
"name": "@concordium/node-sdk", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0", | ||
"description": "Helpers for interacting with the Concordium node", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -640,4 +640,2 @@ # concordium-node-sdk-js | ||
Retrieves the current amount of funds in the system at a specific block, and the state of the special accounts. | ||
Protocol version 4 expanded the amount of information in the response, so one should check the type to access that. | ||
This information includes information about the payday and total amount of funds staked. | ||
```js | ||
@@ -647,11 +645,11 @@ const blockHash = "7f7409679e53875567e2ae812c9fcefe90ced8961d08554756f42bf268a42749"; | ||
const rewardStatus = await client.getRewardStatus(blockHash); | ||
``` | ||
Protocol version 4 expanded the amount of information in the response, so one should check the type to access that. | ||
This information includes information about the payday and total amount of funds staked. | ||
```js | ||
if (isRewardStatusV1(rewardStatus)) { | ||
const nextPaydayTime = rewardStatus.nextPaydayTime; | ||
... | ||
} else if (isRewardStatusV0(rewardStatus)) { | ||
// This status is for a block from protocol version <= 3, so it will only have limited information | ||
... | ||
} | ||
... | ||
``` | ||
@@ -658,0 +656,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
-50%2047883
-0.04%12116
-0.08%958
-0.21%