MCPcopy Create free account
hub / github.com/api3dao/airnode / buildSchemaHeader

Function buildSchemaHeader

packages/airnode-abi/src/encoding.ts:13–25  ·  view source on GitHub ↗
(types: ParameterType[])

Source from the content-addressed store, hash-verified

11};
12
13function buildSchemaHeader(types: ParameterType[]): string {
14 const allShortTypes = Object.keys(PARAMETER_SHORT_TYPES);
15
16 // Shorten all selected types with the corresponding "short" type
17 // i.e. 'address' types get set as simply 'a' and 'bytes32' becomes
18 // simply 'b' etc
19 const selectedShortTypes = types.reduce((acc: string[], type) => {
20 const shortType = allShortTypes.find((st) => PARAMETER_SHORT_TYPES[st as ParameterTypeShort] === type);
21 return [...acc, shortType!];
22 }, []);
23
24 return `${VERSION}${selectedShortTypes.join('')}`;
25}
26
27function buildNameValuePairs(parameters: InputParameter[]): unknown[] {
28 return flatMap(parameters, (parameter) => {

Callers 1

encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected