Docs

ensureBytecodePrefix

Ensures that the given bytecode has the correct prefix. If the bytecode already starts with "0x", it is returned as is. Otherwise, the prefix "0x" is added to the bytecode.

Example

import { ensureBytecodePrefix } from "thirdweb/utils/bytecode/prefix";
const bytecode =
"363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3";
const prefixedBytecode = ensureBytecodePrefix(bytecode);
console.log(prefixedBytecode);

Parameters

Returns

The bytecode with the correct prefix.