@ethersphere/bee-js 5.1.2 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- import * as connectivity from "./modules/debug/connectivity.js";
2
1
  import * as balance from "./modules/debug/balance.js";
3
2
  import * as chequebook from "./modules/debug/chequebook.js";
3
+ import * as connectivity from "./modules/debug/connectivity.js";
4
4
  import * as settlements from "./modules/debug/settlements.js";
5
+ import * as stake from "./modules/debug/stake.js";
6
+ import * as states from "./modules/debug/states.js";
5
7
  import * as status from "./modules/debug/status.js";
6
8
  import * as transactions from "./modules/debug/transactions.js";
7
- import * as states from "./modules/debug/states.js";
8
- import * as stake from "./modules/debug/stake.js";
9
+ import * as stamps from "./modules/debug/stamps.js";
10
+ import * as tag from "./modules/debug/tag.js";
11
+ import { STAMPS_DEPTH_MAX, STAMPS_DEPTH_MIN } from "./types/index.js";
9
12
  import { BeeArgumentError, BeeError } from "./utils/error.js";
10
- import { assertBeeUrl, stripLastSlash } from "./utils/url.js";
11
13
  import { assertAddress, assertBatchId, assertCashoutOptions, assertNonNegativeInteger, assertPositiveInteger, assertPostageBatchOptions, assertRequestOptions, assertTransactionHash, assertTransactionOptions, isTag } from "./utils/type.js";
12
- import { STAMPS_DEPTH_MAX, STAMPS_DEPTH_MIN } from "./types/index.js";
13
- import * as tag from "./modules/debug/tag.js";
14
- import * as stamps from "./modules/debug/stamps.js";
14
+ import { assertBeeUrl, stripLastSlash } from "./utils/url.js";
15
15
  import { DEFAULT_KY_CONFIG, wrapRequestClosure, wrapResponseClosure } from "./utils/http.js";
16
- import { sleep } from "./utils/sleep.js";
17
16
  import { deepMerge } from "./utils/merge.js";
17
+ import { sleep } from "./utils/sleep.js";
18
18
  export class BeeDebug {
19
19
  constructor(url, options) {
20
20
  assertBeeUrl(url);
@@ -528,6 +528,15 @@ export class BeeDebug {
528
528
  assertTransactionOptions(options);
529
529
  await stake.stake(this.getKyOptionsForCall(options), amount, options);
530
530
  }
531
+ /**
532
+ * Get current status of node in redistribution game
533
+ *
534
+ * @param options
535
+ */
536
+ async getRedistributionState(options) {
537
+ assertRequestOptions(options);
538
+ return stake.getRedistributionState(this.getKyOptionsForCall(options));
539
+ }
531
540
  async waitForUsablePostageStamp(id, timeout = 120000) {
532
541
  const TIME_STEP = 1500;
533
542
  for (let time = 0; time < timeout; time += TIME_STEP) {
@@ -1,5 +1,6 @@
1
1
  import { http } from "../../utils/http.js";
2
2
  const STAKE_ENDPOINT = 'stake';
3
+ const REDISTRIBUTION_ENDPOINT = 'redistributionstate';
3
4
  /**
4
5
  * Gets the staked amount
5
6
  *
@@ -34,4 +35,17 @@ export async function stake(kyOptions, amount, options) {
34
35
  path: `${STAKE_ENDPOINT}/${amount}`,
35
36
  headers
36
37
  });
38
+ }
39
+ /**
40
+ * Get current status of node in redistribution game
41
+ *
42
+ * @param kyOptions Ky Options for making requests
43
+ */
44
+ export async function getRedistributionState(kyOptions) {
45
+ const response = await http(kyOptions, {
46
+ method: 'get',
47
+ responseType: 'json',
48
+ path: REDISTRIBUTION_ENDPOINT
49
+ });
50
+ return response.parsedData;
37
51
  }
@@ -2,7 +2,7 @@ import { http } from "../../utils/http.js";
2
2
  import getMajorSemver from 'semver/functions/major.js';
3
3
  // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
4
4
  // so if you are changing anything about them change the `update_bee` action accordingly!
5
- export const SUPPORTED_BEE_VERSION_EXACT = '1.11.1-1992b846';
5
+ export const SUPPORTED_BEE_VERSION_EXACT = '1.12.0-88c1d236';
6
6
  export const SUPPORTED_API_VERSION = '4.0.0';
7
7
  export const SUPPORTED_DEBUG_API_VERSION = '4.0.0';
8
8
  export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.substring(0, SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
@@ -1,4 +1,4 @@
1
- import type { Address, Peer, BalanceResponse, PeerBalance, ChequebookAddressResponse, ChequebookBalanceResponse, LastChequesResponse, LastChequesForPeerResponse, LastCashoutActionResponse, Settlements, AllSettlements, RemovePeerResponse, Topology, PingResponse, Health, NodeAddresses, ReserveState, ChainState, NumberString, ExtendedTag, PostageBatchBuckets, PostageBatch, TransactionInfo, TransactionHash, NodeInfo, BeeVersions, WalletBalance } from './types';
1
+ import type { Address, AllSettlements, BalanceResponse, BeeVersions, ChainState, ChequebookAddressResponse, ChequebookBalanceResponse, ExtendedTag, Health, LastCashoutActionResponse, LastChequesForPeerResponse, LastChequesResponse, NodeAddresses, NodeInfo, NumberString, Peer, PeerBalance, PingResponse, PostageBatch, PostageBatchBuckets, RedistributionState, RemovePeerResponse, ReserveState, Settlements, Topology, TransactionHash, TransactionInfo, WalletBalance } from './types';
2
2
  import { BatchId, BeeOptions, CashoutOptions, PostageBatchOptions, RequestOptions, Tag, TransactionOptions } from './types';
3
3
  export declare class BeeDebug {
4
4
  /**
@@ -304,6 +304,12 @@ export declare class BeeDebug {
304
304
  * @param options
305
305
  */
306
306
  depositStake(amount: NumberString, options?: RequestOptions & TransactionOptions): Promise<void>;
307
+ /**
308
+ * Get current status of node in redistribution game
309
+ *
310
+ * @param options
311
+ */
312
+ getRedistributionState(options?: RequestOptions): Promise<RedistributionState>;
307
313
  private waitForUsablePostageStamp;
308
314
  private getKyOptionsForCall;
309
315
  }
@@ -1,4 +1,4 @@
1
- import { NumberString, TransactionOptions } from '../../types';
1
+ import { NumberString, RedistributionState, TransactionOptions } from '../../types';
2
2
  import type { Options as KyOptions } from 'ky';
3
3
  /**
4
4
  * Gets the staked amount
@@ -14,3 +14,9 @@ export declare function getStake(kyOptions: KyOptions): Promise<NumberString>;
14
14
  * @param options
15
15
  */
16
16
  export declare function stake(kyOptions: KyOptions, amount: NumberString, options?: TransactionOptions): Promise<void>;
17
+ /**
18
+ * Get current status of node in redistribution game
19
+ *
20
+ * @param kyOptions Ky Options for making requests
21
+ */
22
+ export declare function getRedistributionState(kyOptions: KyOptions): Promise<RedistributionState>;
@@ -1,7 +1,7 @@
1
1
  import type { Health, NodeInfo } from '../../types/debug';
2
2
  import { BeeVersions } from '../../types/debug';
3
3
  import type { Options as KyOptions } from 'ky';
4
- export declare const SUPPORTED_BEE_VERSION_EXACT = "1.11.1-1992b846";
4
+ export declare const SUPPORTED_BEE_VERSION_EXACT = "1.12.0-88c1d236";
5
5
  export declare const SUPPORTED_API_VERSION = "4.0.0";
6
6
  export declare const SUPPORTED_DEBUG_API_VERSION = "4.0.0";
7
7
  export declare const SUPPORTED_BEE_VERSION: string;
@@ -1,5 +1,5 @@
1
- import { PublicKey, NumberString, Reference, TransactionHash, RequestOptions } from './index';
2
1
  import { HexEthAddress } from '../utils/eth';
2
+ import { NumberString, PublicKey, Reference, RequestOptions, TransactionHash } from './index';
3
3
  /**
4
4
  * Object that contains information about progress of upload of data to network.
5
5
  *
@@ -136,6 +136,16 @@ export declare enum BeeModes {
136
136
  ULTRA_LIGHT = "ultra-light",
137
137
  DEV = "dev"
138
138
  }
139
+ export interface RedistributionState {
140
+ isFrozen: boolean;
141
+ round: number;
142
+ lastWonRound: number;
143
+ lastPlayedRound: number;
144
+ lastFrozenRound: number;
145
+ block: number;
146
+ reward: NumberString;
147
+ fees: NumberString;
148
+ }
139
149
  /**
140
150
  * Information about Bee node and its configuration
141
151
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "5.1.2",
3
+ "version": "5.2.0",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",
@@ -132,6 +132,6 @@
132
132
  "npm": ">=6.0.0",
133
133
  "beeApiVersion": "4.0.0",
134
134
  "beeDebugApiVersion": "4.0.0",
135
- "bee": "1.11.1-1992b846"
135
+ "bee": "1.12.0-88c1d236"
136
136
  }
137
137
  }