(_value: BigNumberish)
| 209 | * Converts %%value%% to a Big Endian Uint8Array. |
| 210 | */ |
| 211 | export function toBeArray(_value: BigNumberish): Uint8Array { |
| 212 | const value = getUint(_value, "value"); |
| 213 | |
| 214 | if (value === BN_0) { return new Uint8Array([ ]); } |
| 215 | |
| 216 | let hex = value.toString(16); |
| 217 | if (hex.length % 2) { hex = "0" + hex; } |
| 218 | |
| 219 | const result = new Uint8Array(hex.length / 2); |
| 220 | for (let i = 0; i < result.length; i++) { |
| 221 | const offset = i * 2; |
| 222 | result[i] = parseInt(hex.substring(offset, offset + 2), 16); |
| 223 | } |
| 224 | |
| 225 | return result; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. |
no test coverage detected