@@ -87,7 +87,7 @@ toBytes(
87
87
Encodes a hex value to a byte array.
88
88
89
89
``` ts
90
- import { numberToHex } from ' viem'
90
+ import { hexToBytes } from ' viem'
91
91
92
92
hexToBytes (' 0x48656c6c6f20576f726c6421' ) // [!code focus:2]
93
93
// Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
@@ -103,7 +103,7 @@ hexToBytes('0x48656c6c6f20576f726c6421', { size: 32 }) // [!code focus:2]
103
103
Encodes a string to a byte array.
104
104
105
105
``` ts
106
- import { numberToHex } from ' viem'
106
+ import { stringToBytes } from ' viem'
107
107
108
108
stringToBytes (' Hello world' ) // [!code focus:2]
109
109
// Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
@@ -119,7 +119,7 @@ stringToBytes('Hello world', { size: 32 }) // [!code focus:2]
119
119
Encodes a number to a byte array.
120
120
121
121
``` ts
122
- import { numberToHex } from ' viem'
122
+ import { numberToBytes } from ' viem'
123
123
124
124
numberToBytes (420 ) // [!code focus:2]
125
125
// Uint8Array([1, 164])
@@ -135,7 +135,7 @@ numberToBytes(420, { size: 32 }) // [!code focus:2]
135
135
Encodes a boolean to a byte array.
136
136
137
137
``` ts
138
- import { boolToHex } from ' viem'
138
+ import { boolToBytes } from ' viem'
139
139
140
140
boolToBytes (true ) // [!code focus:2]
141
141
// Uint8Array([1])
0 commit comments