@ethersphere/bee-js 9.8.0 → 10.0.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.
@@ -79,9 +79,12 @@ export class Fork {
79
79
  const type = Binary.uint8ToNumber(reader.read(1));
80
80
  const prefixLength = Binary.uint8ToNumber(reader.read(1));
81
81
  const prefix = reader.read(prefixLength);
82
- reader.read(30 - prefixLength);
82
+ if (prefixLength < 30) {
83
+ reader.read(30 - prefixLength);
84
+ }
83
85
  const selfAddress = reader.read(addressLength);
84
86
  debug('unmarshalling fork', {
87
+ type,
85
88
  prefixLength,
86
89
  prefix: DECODER.decode(prefix),
87
90
  addressLength,
@@ -223,7 +226,7 @@ export class MantarayNode {
223
226
  throw new Error('MantarayNode#unmarshal invalid version hash');
224
227
  }
225
228
  const targetAddressLength = Binary.uint8ToNumber(reader.read(1));
226
- const targetAddress = targetAddressLength === 0 ? NULL_ADDRESS : reader.read(targetAddressLength);
229
+ const targetAddress = targetAddressLength ? reader.read(targetAddressLength) : NULL_ADDRESS;
227
230
  const node = new MantarayNode({
228
231
  selfAddress,
229
232
  targetAddress,
@@ -232,7 +235,7 @@ export class MantarayNode {
232
235
  const forkBitmap = reader.read(32);
233
236
  for (let i = 0; i < 256; i++) {
234
237
  if (Binary.getBit(forkBitmap, i, 'LE')) {
235
- const newFork = Fork.unmarshal(reader, targetAddressLength);
238
+ const newFork = Fork.unmarshal(reader, selfAddress.length);
236
239
  node.forks.set(i, newFork);
237
240
  newFork.node.parent = node;
238
241
  }
@@ -19,9 +19,9 @@ export async function getChequebookAddress(requestOptions) {
19
19
  name: 'response.data'
20
20
  });
21
21
  return {
22
- chequebookAddress: Types.asString(body.chequebookAddress, {
22
+ chequebookAddress: new EthAddress(Types.asString(body.chequebookAddress, {
23
23
  name: 'chequebookAddress'
24
- })
24
+ }))
25
25
  };
26
26
  }
27
27
  /**