Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 0e59f28

Browse files
authored
[docs] add stripHexPrefix method to migration guide (#6843)
* add stripHexPrefix method to accounts migration guide * add stripHexPrefix method to web3-utils migration guide
1 parent ab1b250 commit 0e59f28

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/docs/guides/web3_upgrade_guide/1.x/accounts_migration_guide.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@ const wallet = web3.eth.accounts.wallet.create(1, 'optionalEntropy'); // entropy
3434
const account = web3.eth.accounts.wallet.create(1, 'optionalEntropy'); // will result in an error
3535
const account = web3.eth.accounts.wallet.create(); // correct way
3636
```
37+
38+
## stripHexPrefix method
39+
40+
In 1.x `stripHexPrefix` method is located in the `web3-utils` package, in 4.x this has been moved to `web3-eth-accounts`
41+
42+
```typescript
43+
import { stripHexPrefix } from 'web3-eth-accounts';
44+
45+
console.log(stripHexPrefix('0x123')); // "123"
46+
47+
```

docs/docs/guides/web3_upgrade_guide/1.x/web3_utils_migration_guide.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ isHex('-0x'); // in 1.x used to return `true`. But changed in 4.x to return `fal
7979

8080
isHexStrict('-0x'); // in 1.x used to return `true`. But changed in 4.x to return `false`
8181
// `false`
82+
```
83+
## stripHexPrefix method
84+
85+
In 1.x `stripHexPrefix` method is located in the `web3-utils` package, in 4.x this has been moved to `web3-eth-accounts`
86+
87+
```typescript
88+
import { stripHexPrefix } from 'web3-eth-accounts';
89+
90+
console.log(stripHexPrefix('0x123')); // "123"
91+
8292
```
8393

8494
## Other functions

0 commit comments

Comments
 (0)