Skip to content

Commit fa6779c

Browse files
committed
try graphQL query both ways
1 parent bccfd1c commit fa6779c

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/lib/mina/fetch.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,15 @@ async function fetchActions(
710710
graphqlEndpoint,
711711
networkConfig.archiveFallbackEndpoints
712712
);
713-
if (error) throw Error(error.statusText);
713+
if (error) {
714+
// retry once without querying transaction info
715+
[response, error] = await makeGraphqlRequest<ActionQueryResponse>(
716+
getActionsQuery(publicKey, actionStates, tokenId, undefined, true),
717+
graphqlEndpoint,
718+
networkConfig.archiveFallbackEndpoints
719+
);
720+
if (error) throw Error(error.statusText);
721+
}
714722
let fetchedActions = response?.data.actions;
715723
if (fetchedActions === undefined) {
716724
return {

src/lib/mina/graphql.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ const getActionsQuery = (
321321
publicKey: string,
322322
actionStates: ActionStatesStringified,
323323
tokenId: string,
324-
_filterOptions?: EventActionFilterOptions
324+
_filterOptions?: EventActionFilterOptions,
325+
retryWithoutTxInfo: boolean = false
325326
) => {
326327
const { fromActionState, endActionState } = actionStates ?? {};
327328
let input = `address: "${publicKey}", tokenId: "${tokenId}"`;
@@ -343,9 +344,10 @@ const getActionsQuery = (
343344
actionData {
344345
accountUpdateId
345346
data
346-
transactionInfo {
347-
sequenceNumber
348-
zkappAccountUpdateIds
347+
${
348+
retryWithoutTxInfo
349+
? ''
350+
: 'transactionInfo { sequenceNumber zkappAccountUpdateIds }'
349351
}
350352
}
351353
}

0 commit comments

Comments
 (0)