(_value)
| 180 | * Converts %%value%% to a Big Endian Uint8Array. |
| 181 | */ |
| 182 | export function toBeArray(_value) { |
| 183 | const value = getUint(_value, "value"); |
| 184 | if (value === BN_0) { |
| 185 | return new Uint8Array([]); |
| 186 | } |
| 187 | let hex = value.toString(16); |
| 188 | if (hex.length % 2) { |
| 189 | hex = "0" + hex; |
| 190 | } |
| 191 | const result = new Uint8Array(hex.length / 2); |
| 192 | for (let i = 0; i < result.length; i++) { |
| 193 | const offset = i * 2; |
| 194 | result[i] = parseInt(hex.substring(offset, offset + 2), 16); |
| 195 | } |
| 196 | return result; |
| 197 | } |
| 198 | /** |
| 199 | * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. |
| 200 | * |
no test coverage detected
searching dependent graphs…