@ethersphere/bee-js 7.0.3 → 7.1.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.
@@ -8,6 +8,21 @@ import { assertBytes } from "./bytes.js";
8
8
  import { assertHexString, hexToBytes, intToHex, makeHexString } from "./hex.js";
9
9
  const ETH_ADDR_BYTES_LENGTH = 20;
10
10
  const ETH_ADDR_HEX_LENGTH = 40;
11
+ export function capitalizeAddressERC55(address) {
12
+ if (address.startsWith('0x')) {
13
+ address = address.slice(2);
14
+ }
15
+ const addressHash = keccak256(address.toLowerCase());
16
+ let result = '0x';
17
+ for (let i = 0; i < address.length; i++) {
18
+ if (parseInt(addressHash[i], 16) > 7) {
19
+ result += address[i].toUpperCase();
20
+ } else {
21
+ result += address[i].toLowerCase();
22
+ }
23
+ }
24
+ return result;
25
+ }
11
26
  export function makeEthAddress(address) {
12
27
  if (typeof address === 'string') {
13
28
  const hexAddr = makeHexString(address, ETH_ADDR_HEX_LENGTH);
@@ -2,7 +2,7 @@ export { getCollectionSize } from "./collection.js";
2
2
  export { getFolderSize } from "./collection.node.js";
3
3
  export { assertBytes, assertFlexBytes, bytesAtOffset, bytesEqual, flexBytesAtOffset, isBytes, isFlexBytes } from "./bytes.js";
4
4
  export { assertHexString, assertPrefixedHexString, bytesToHex, hexToBytes, intToHex, isHexString, makeHexString } from "./hex.js";
5
- export { ethToSwarmAddress, fromLittleEndian, isHexEthAddress, makeEthAddress, makeEthereumWalletSigner, makeHexEthAddress, toLittleEndian } from "./eth.js";
5
+ export { capitalizeAddressERC55, ethToSwarmAddress, fromLittleEndian, isHexEthAddress, makeEthAddress, makeEthereumWalletSigner, makeHexEthAddress, toLittleEndian } from "./eth.js";
6
6
  export { keccak256Hash } from "./hash.js";
7
7
  export { makeMaxTarget } from "./pss.js";
8
8
  export { getAmountForTtl, getDepthForCapacity, getStampCostInBzz, getStampCostInPlur, getStampEffectiveBytes, getStampMaximumCapacityBytes, getStampTtlSeconds, getStampUsage } from "./stamps.js";
@@ -233,6 +233,7 @@ export interface ReserveState {
233
233
  }
234
234
  export interface ChainState {
235
235
  block: number;
236
+ chainTip: number;
236
237
  totalAmount: NumberString;
237
238
  currentPrice: NumberString;
238
239
  }
@@ -4,6 +4,7 @@ import { HexString } from './hex';
4
4
  export type OverlayAddress = BrandedString<'OverlayAddress'>;
5
5
  export type EthAddress = Bytes<20>;
6
6
  export type HexEthAddress = HexString<40>;
7
+ export declare function capitalizeAddressERC55(address: string): string;
7
8
  export declare function makeEthAddress(address: EthAddress | Uint8Array | string | unknown): EthAddress;
8
9
  export declare function makeHexEthAddress(address: EthAddress | Uint8Array | string | unknown): HexEthAddress;
9
10
  /**
@@ -2,7 +2,7 @@ export { getCollectionSize } from './collection';
2
2
  export { getFolderSize } from './collection.node';
3
3
  export { Bytes, FlexBytes, assertBytes, assertFlexBytes, bytesAtOffset, bytesEqual, flexBytesAtOffset, isBytes, isFlexBytes, } from './bytes';
4
4
  export { HexString, PrefixedHexString, assertHexString, assertPrefixedHexString, bytesToHex, hexToBytes, intToHex, isHexString, makeHexString, } from './hex';
5
- export { EthAddress, ethToSwarmAddress, fromLittleEndian, isHexEthAddress, makeEthAddress, makeEthereumWalletSigner, makeHexEthAddress, toLittleEndian, } from './eth';
5
+ export { EthAddress, capitalizeAddressERC55, ethToSwarmAddress, fromLittleEndian, isHexEthAddress, makeEthAddress, makeEthereumWalletSigner, makeHexEthAddress, toLittleEndian, } from './eth';
6
6
  export { keccak256Hash } from './hash';
7
7
  export { makeMaxTarget } from './pss';
8
8
  export { getAmountForTtl, getDepthForCapacity, getStampCostInBzz, getStampCostInPlur, getStampEffectiveBytes, getStampMaximumCapacityBytes, getStampTtlSeconds, getStampUsage, } from './stamps';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "7.0.3",
3
+ "version": "7.1.0",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",