@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.
- package/dist/cjs/utils/eth.js +18 -1
- package/dist/cjs/utils/expose.js +2 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/utils/eth.js +15 -0
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/types/types/debug.d.ts +1 -0
- package/dist/types/utils/eth.d.ts +1 -0
- package/dist/types/utils/expose.d.ts +1 -1
- package/package.json +1 -1
package/dist/mjs/utils/eth.js
CHANGED
|
@@ -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);
|
package/dist/mjs/utils/expose.js
CHANGED
|
@@ -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";
|
|
@@ -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';
|