MCPcopy Create free account
hub / github.com/wevm/viem / getArrayComponents

Function getArrayComponents

src/utils/abi/encodeAbiParameters.ts:426–434  ·  view source on GitHub ↗
(
  type: string,
)

Source from the content-addressed store, hash-verified

424type GetArrayComponentsErrorType = ErrorType
425
426export function getArrayComponents(
427 type: string,
428): [length: number | null, innerType: string] | undefined {
429 const matches = type.match(/^(.*)\[(\d+)?\]$/)
430 return matches
431 ? // Return `null` if the array is dynamic.
432 [matches[2] ? Number(matches[2]) : null, matches[1]]
433 : undefined
434}
435
436function isDynamicType(param: AbiParameter): boolean {
437 const { type } = param

Callers 5

decodeParameterFunction · 0.85
hasDynamicChildFunction · 0.85
prepareParamFunction · 0.85
isDynamicTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected