MCPcopy Index your code
hub / github.com/api3dao/airnode / encodeValue

Function encodeValue

packages/airnode-adapter/src/response-processing/encoding.ts:23–30  ·  view source on GitHub ↗
(value: ValueType, type: ResponseType)

Source from the content-addressed store, hash-verified

21}
22
23export function encodeValue(value: ValueType, type: ResponseType): string {
24 const solidityType = getSolidityType(type);
25
26 const goEncode = goSync(() => ethers.utils.defaultAbiCoder.encode([solidityType], [value]));
27 if (!goEncode.success) throw new Error(goEncode.error.message);
28
29 return goEncode.data;
30}
31
32export function encodeMultipleValues(values: ValueType[], types: ResponseType[]): string {
33 const solidityTypes = types.map(getSolidityType);

Callers 2

extractAndEncodeResponseFunction · 0.90
encoding.test.tsFile · 0.90

Calls 1

getSolidityTypeFunction · 0.85

Tested by

no test coverage detected