( parameters: EncodeDeployDataParameters<abi>, )
| 48 | | ErrorType |
| 49 | |
| 50 | export function encodeDeployData<const abi extends Abi | readonly unknown[]>( |
| 51 | parameters: EncodeDeployDataParameters<abi>, |
| 52 | ): EncodeDeployDataReturnType { |
| 53 | const { abi, args, bytecode } = parameters as EncodeDeployDataParameters |
| 54 | if (!args || args.length === 0) return bytecode |
| 55 | |
| 56 | const description = abi.find((x) => 'type' in x && x.type === 'constructor') |
| 57 | if (!description) throw new AbiConstructorNotFoundError({ docsPath }) |
| 58 | if (!('inputs' in description)) |
| 59 | throw new AbiConstructorParamsNotFoundError({ docsPath }) |
| 60 | if (!description.inputs || description.inputs.length === 0) |
| 61 | throw new AbiConstructorParamsNotFoundError({ docsPath }) |
| 62 | |
| 63 | const data = encodeAbiParameters(description.inputs, args) |
| 64 | return concatHex([bytecode, data!]) |
| 65 | } |
no test coverage detected