MCPcopy Create free account
hub / github.com/subquery/subql / processBigIntFields

Function processBigIntFields

packages/node-core/src/utils/graphql.ts:157–167  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

155 const bigIntFields = field.jsonInterface?.fields.filter((f) => f.type === 'BigInt');
156 const nestJsonFields = field.jsonInterface?.fields.filter((f) => f.jsonInterface);
157 const processBigIntFields = (value: any) => {
158 if (bigIntFields) {
159 for (const bigIntField of bigIntFields) {
160 // If null is passed, we should not convert it to BigInt
161 if (value[bigIntField.name] !== undefined && value[bigIntField.name] !== null) {
162 value[bigIntField.name] = BigInt(value[bigIntField.name].slice(0, -1));
163 }
164 }
165 }
166 return value;
167 };
168 if (nestJsonFields) {
169 for (const nestJsonField of nestJsonFields) {
170 // have a nest field, and nest field is json type, also value is defined

Callers 1

processGetJsonFunction · 0.85

Calls 1

BigIntInterface · 0.85

Tested by

no test coverage detected