Files
explore/lib/hexToBytes.ts
T
tom goriunovandGitHub 8933d05185 Add Blobs support (EIP-4884) (#1672)
* blob page placeholder

* txs with blobs list view

* tx additional info popup

* blob gas info for tx and block

* update hints

* tx blobs tab

* blob details page

* add ENV to hide blob txs tab

* tx blob fees and adj for tx burnt fees

* preliminary tests

* blob data convertion

* display blob data type in lists

* download asset

* blob txs in block

* tests for blob data preview

* fixes

* fix tests

* support blobs in search

* update blob icon

* more fixes
2024-03-07 18:36:55 +04:00

10 lines
322 B
TypeScript

// hex can be with prefix - `0x{string}` - or without it - `{string}`
export default function hexToBytes(hex: string) {
const bytes = [];
const startIndex = hex.startsWith('0x') ? 2 : 0;
for (let c = startIndex; c < hex.length; c += 2) {
bytes.push(parseInt(hex.substring(c, c + 2), 16));
}
return bytes;
}