From bccfd1c7112fff8ad679b180c7c1d9259156b442 Mon Sep 17 00:00:00 2001 From: Coby Date: Fri, 22 Nov 2024 09:48:29 -0500 Subject: [PATCH 1/9] Sort actions by tx sequence when available --- src/lib/mina/fetch.ts | 28 +- src/lib/mina/fetch.unit-test.ts | 1272 ++++++++++- ...-actions-response-with-transaction-info.ts | 1864 +++++++++++++++++ ...tions-response-without-transaction-info.ts | 123 ++ .../mina/fixtures/fetch-actions-response.ts | 118 -- src/lib/mina/graphql.ts | 8 + 6 files changed, 3199 insertions(+), 214 deletions(-) create mode 100644 src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts create mode 100644 src/lib/mina/fixtures/fetch-actions-response-without-transaction-info.ts delete mode 100644 src/lib/mina/fixtures/fetch-actions-response.ts diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index 8165bad6f7..c9b86817ed 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -757,9 +757,31 @@ export function createActionsList( `No action data was found for the account ${publicKey} with the latest action state ${actionState}` ); - actionData = actionData.sort((a1, a2) => { - return Number(a1.accountUpdateId) < Number(a2.accountUpdateId) ? -1 : 1; - }); + // DEPRECATED: In case the archive node is running an out-of-date version, best guess is to sort by the account update id + if (!actionData[0].transactionInfo) { + actionData = actionData.sort((a1, a2) => { + return Number(a1.accountUpdateId) - Number(a2.accountUpdateId); + }); + } else { + // sort actions within one block by transaction sequence number and account update sequence + actionData = actionData.sort((a1, a2) => { + const a1TxSequence = a1.transactionInfo!.sequenceNumber; + const a2TxSequence = a2.transactionInfo!.sequenceNumber; + if (a1TxSequence === a2TxSequence) { + const a1AuSequence = + a1.transactionInfo!.zkappAccountUpdateIds.indexOf( + Number(a1.accountUpdateId) + ); + const a2AuSequence = + a2.transactionInfo!.zkappAccountUpdateIds.indexOf( + Number(a2.accountUpdateId) + ); + return a1AuSequence - a2AuSequence; + } else { + return a1TxSequence - a2TxSequence; + } + }); + } // split actions by account update let actionsByAccountUpdate: string[][][] = []; diff --git a/src/lib/mina/fetch.unit-test.ts b/src/lib/mina/fetch.unit-test.ts index 3f0d662cec..ddff0457fb 100644 --- a/src/lib/mina/fetch.unit-test.ts +++ b/src/lib/mina/fetch.unit-test.ts @@ -1,6 +1,7 @@ import { PrivateKey, TokenId } from 'o1js'; import { createActionsList } from './fetch.js'; -import { mockFetchActionsResponse } from './fixtures/fetch-actions-response.js'; +import { mockFetchActionsResponse as fetchResponseWithTxInfo } from './fixtures/fetch-actions-response-with-transaction-info.js'; +import { mockFetchActionsResponse as fetchResponseNoTxInfo } from './fixtures/fetch-actions-response-without-transaction-info.js'; import { test, describe } from 'node:test'; import { removeJsonQuotes } from './graphql.js'; import { expect } from 'expect'; @@ -123,8 +124,8 @@ expect(actual).toEqual(expected); console.log('regex tests complete 🎉'); -describe('Fetch', async (t) => { - describe('#createActionsList with default params', async (t) => { +describe('Fetch', () => { + describe('#createActionsList with default params', () => { const defaultPublicKey = PrivateKey.random().toPublicKey().toBase58(); const defaultActionStates = { fromActionState: undefined, @@ -136,96 +137,1181 @@ describe('Fetch', async (t) => { tokenId: TokenId.default.toString(), }; - const actionsList = createActionsList( - defaultAccountInfo, - mockFetchActionsResponse.data.actions - ); - - await test('orders the actions correctly', async () => { - expect(actionsList).toEqual([ - { - actions: [ - [ - '20374659537065244088703638031937922870146667362923279084491778322749365537089', - '1', - ], - ], - hash: '10619825168606131449407092474314250900469658818945385329390497057469974757422', - }, - { - actions: [ - [ - '20503089751358270987184701275168489753952341816059774976784079526478451099801', - '1', - ], - ], - hash: '25525130517416993227046681664758665799110129890808721833148757111140891481208', - }, - { - actions: [ - [ - '3374074164183544078218789545772953663729921088152354292852793744356608231707', - '0', - ], - ], - hash: '290963518424616502946790040851348455652296009700336010663574777600482385855', - }, - { - actions: [ - [ - '12630758077588166643924428865613845067150916064939816120404808842510620524633', - '1', - ], - ], - hash: '20673199655841577810393943638910551364027795297920791498278816237738641857371', - }, - { - actions: [ - [ - '5643224648393140391519847064914429159616501351124129591669928700148350171602', - '0', - ], - ], - hash: '5284016523143033193387918577616839424871122381326995145988133445906503263869', - }, - { - actions: [ - [ - '15789351988619560045401465240113496854401074115453702466673859303925517061263', - '0', - ], - ], - hash: '16944163018367910067334012882171366051616125936127175065464614786387687317044', - }, - { - actions: [ - [ - '27263309408256888453299195755797013857604561285332380691270111409680109142128', - '1', - ], - ], - hash: '23662159967366296714544063539035629952291787828104373633198732070740691309118', - }, - { - actions: [ - [ - '3378367318331499715304980508337843233019278703665446829424824679144818589558', - '1', - ], - ], - hash: '1589729766029695153975344283092689798747741638003354620355672853210932754595', - }, - { - actions: [ - [ - '17137397755795687855356639427474789131368991089558570411893673365904353943290', - '1', - ], - ], - hash: '10964420428484427410756859799314206378989718180435238943573393516522086219419', - }, - ]); + describe('with a payload that is missing transaction info', () => { + const actionsList = createActionsList( + defaultAccountInfo, + fetchResponseNoTxInfo.data.actions + ); + + test('orders the actions correctly', () => { + expect(actionsList).toEqual([ + { + actions: [ + [ + '20374659537065244088703638031937922870146667362923279084491778322749365537089', + '1', + ], + ], + hash: '10619825168606131449407092474314250900469658818945385329390497057469974757422', + }, + { + actions: [ + [ + '20503089751358270987184701275168489753952341816059774976784079526478451099801', + '1', + ], + ], + hash: '25525130517416993227046681664758665799110129890808721833148757111140891481208', + }, + { + actions: [ + [ + '3374074164183544078218789545772953663729921088152354292852793744356608231707', + '0', + ], + ], + hash: '290963518424616502946790040851348455652296009700336010663574777600482385855', + }, + { + actions: [ + [ + '12630758077588166643924428865613845067150916064939816120404808842510620524633', + '1', + ], + ], + hash: '20673199655841577810393943638910551364027795297920791498278816237738641857371', + }, + { + actions: [ + [ + '5643224648393140391519847064914429159616501351124129591669928700148350171602', + '0', + ], + ], + hash: '5284016523143033193387918577616839424871122381326995145988133445906503263869', + }, + { + actions: [ + [ + '15789351988619560045401465240113496854401074115453702466673859303925517061263', + '0', + ], + ], + hash: '16944163018367910067334012882171366051616125936127175065464614786387687317044', + }, + { + actions: [ + [ + '27263309408256888453299195755797013857604561285332380691270111409680109142128', + '1', + ], + ], + hash: '23662159967366296714544063539035629952291787828104373633198732070740691309118', + }, + { + actions: [ + [ + '3378367318331499715304980508337843233019278703665446829424824679144818589558', + '1', + ], + ], + hash: '1589729766029695153975344283092689798747741638003354620355672853210932754595', + }, + { + actions: [ + [ + '17137397755795687855356639427474789131368991089558570411893673365904353943290', + '1', + ], + ], + hash: '10964420428484427410756859799314206378989718180435238943573393516522086219419', + }, + ]); + }); + }); + + describe('with a payload that includes transaction info', () => { + const actionsList = createActionsList( + defaultAccountInfo, + fetchResponseWithTxInfo.data.actions + ); + + test('orders the actions correctly', () => { + expect(actionsList).toEqual([ + { + actions: [ + [ + '6', + '5', + '7', + '6', + '7', + '8', + '12956991225953906921841684099823101706501308776705520473434038962466907995970', + '0', + '1', + ], + ], + hash: '25313349900211893975382608876719408889698704200031209664249044279080109975560', + }, + { + actions: [ + [ + '4', + '6', + '2', + '2', + '8', + '3', + '26088020189287768782099688020326138224459601487567694418767232338236813240193', + '0', + '2', + ], + ], + hash: '21763299541040298587753333338371893846810690469232963591372060459026381039252', + }, + { + actions: [ + [ + '2', + '6', + '9', + '7', + '5', + '6', + '25255790042732573450954003712317736246768978834829349553370983848692302775344', + '0', + '1', + ], + ], + hash: '8628496078274769461115542000844796878294462781470938159543797714990992667559', + }, + { + actions: [ + [ + '6', + '5', + '3', + '9', + '9', + '1', + '19964205550324939630550545763048675864161800749940585779962982033858494022559', + '1', + '1', + ], + ], + hash: '5514469181095466736859934799926525380889572026984429413409318992237299997028', + }, + { + actions: [ + [ + '9', + '9', + '6', + '6', + '4', + '6', + '12346427434327004348125362664915565629710192257864556013521112054257232754796', + '1', + '1', + ], + ], + hash: '27436192387992217139011123768031802510733783343834317381772204899483202267193', + }, + { + actions: [ + [ + '9', + '7', + '1', + '9', + '8', + '8', + '12346427434327004348125362664915565629710192257864556013521112054257232754796', + '1', + '1', + ], + ], + hash: '25885889073951718527354395363806199815487911681101764913596881578771086370107', + }, + { + actions: [ + [ + '2', + '4', + '4', + '7', + '4', + '3', + '19964205550324939630550545763048675864161800749940585779962982033858494022559', + '1', + '1', + ], + ], + hash: '3084111396668553871010196373800365499745037262843862158729989883860675348483', + }, + { + actions: [ + [ + '9', + '2', + '9', + '2', + '7', + '6', + '21377591073895713510341309420398793185576884815818377506681280615802759881106', + '0', + '1', + ], + ], + hash: '13532287841471317150184319478504392572847735859185693513218934441300016387637', + }, + { + actions: [ + [ + '7', + '5', + '9', + '4', + '7', + '6', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '23562173419146814432140831830018386191372262558717813981702672868292521523493', + }, + { + actions: [ + [ + '2', + '7', + '4', + '3', + '1', + '3', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '17091049856171838105194364005412166905307014398334933913160405653259432088216', + }, + { + actions: [ + [ + '1', + '6', + '3', + '5', + '2', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '17232885850087529233459756382038742870248640044940153006158312935267918515979', + }, + { + actions: [ + [ + '4', + '7', + '5', + '1', + '2', + '2', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '12636308717155378495657553296284990333618148856424346334743675423201692801125', + }, + { + actions: [ + [ + '3', + '1', + '3', + '1', + '5', + '6', + '12165186923319687572900094011821565862668411524381584956461194876028064035764', + '0', + '1', + ], + ], + hash: '17082487567758469425757467457967473265642001333824907522427890208991758759731', + }, + { + actions: [ + [ + '1', + '1', + '3', + '4', + '9', + '4', + '12956991225953906921841684099823101706501308776705520473434038962466907995970', + '0', + '1', + ], + ], + hash: '14226491442770650712364681911870921131508915865197379983185088742764625929348', + }, + { + actions: [ + [ + '9', + '7', + '1', + '1', + '8', + '6', + '12444248802460880132081449291546340439683979052479458915102943284375240795308', + '1', + '1', + ], + ], + hash: '13552033292375176242184292341671233419412691991179711376625259275814019808194', + }, + { + actions: [ + [ + '9', + '2', + '1', + '1', + '2', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '22428816182994066811035979110138663502097287483003215755615557883450156059598', + }, + { + actions: [ + [ + '6', + '5', + '7', + '6', + '7', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '22526342661206194008430176692375034342082965513600234855498984822568539554270', + }, + { + actions: [ + [ + '4', + '6', + '2', + '2', + '8', + '3', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '2657110063538905863496230550574434206907731812034404344231638673775478011856', + }, + { + actions: [ + [ + '7', + '7', + '7', + '7', + '7', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '22538126940372893133565877949395572498140210910784052520799713638161217553842', + }, + { + actions: [ + [ + '3', + '4', + '5', + '7', + '6', + '2', + '6453147199940115032546911372596674482366995380739961315278593325733504245402', + '0', + '1', + ], + ], + hash: '13346898880455647067452267285098444549289840161340616136535351191377323737874', + }, + { + actions: [ + [ + '3', + '4', + '5', + '7', + '6', + '3', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + ], + hash: '8960443634734051886489484343002863270419199667986186484392955287225122849837', + }, + { + actions: [ + [ + '3', + '4', + '5', + '7', + '6', + '3', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + ], + hash: '11553781833537412187998791170094246504179739906426596650283148421062134031747', + }, + { + actions: [ + [ + '2', + '3', + '4', + '5', + '6', + '7', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + ], + hash: '5036646800226972634599960587058868707090262022460888863204286405189747942769', + }, + { + actions: [ + [ + '2', + '3', + '1', + '4', + '8', + '6', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '22676822127286113867589765068900374089270892723224396474888670556596794299564', + }, + { + actions: [ + [ + '7', + '1', + '6', + '9', + '2', + '2', + '12444248802460880132081449291546340439683979052479458915102943284375240795308', + '1', + '1', + ], + ], + hash: '14450089155455621218882496336231751337940932425300837691009523581147767161552', + }, + { + actions: [ + [ + '1', + '2', + '3', + '4', + '5', + '6', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + ], + hash: '17343217782575155169164602200877752769390651578694569216079202747806169189400', + }, + { + actions: [ + [ + '6', + '4', + '3', + '4', + '5', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '4721274078801522986713969462049522847078998862315482276343640953261102256362', + }, + { + actions: [ + [ + '2', + '4', + '2', + '9', + '3', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + ], + hash: '24590522690942364367249289292250875547314635228745100120965991135101856466170', + }, + { + actions: [ + [ + '1', + '3', + '8', + '1', + '1', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '3', + ], + ], + hash: '12019972858140051491726046897631768713365384917855031502876641235872835491337', + }, + { + actions: [ + [ + '4', + '7', + '4', + '2', + '7', + '3', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '26933479101281889273961421117413591687444559825118348139804588313346830288078', + }, + { + actions: [ + [ + '8', + '7', + '6', + '8', + '7', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '23201954681884767758512172994752868073493999252959563785369154647654943505003', + }, + { + actions: [ + [ + '3', + '7', + '4', + '1', + '3', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + ], + hash: '1000179065401720127557736288040692604435268683625844611181682352431913959786', + }, + { + actions: [ + [ + '2', + '8', + '2', + '4', + '6', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + ], + hash: '25629104547868447471450619254775537300502100982314563069790647977264591517687', + }, + { + actions: [ + [ + '5', + '7', + '1', + '8', + '7', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + ], + hash: '21085262550220603617926377152517886464296676073611212137713290514256181853522', + }, + { + actions: [ + [ + '9', + '4', + '3', + '7', + '4', + '5', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '15', + ], + ], + hash: '4146388601077199122206031386411652580617016997869931303420910616895941221197', + }, + { + actions: [ + [ + '9', + '9', + '8', + '1', + '5', + '7', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '11', + ], + ], + hash: '14718563754416384998379734580498763754546083084109085189673860430296171756381', + }, + { + actions: [ + [ + '8', + '3', + '2', + '6', + '3', + '2', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + ], + hash: '22436535202149639941751810143299386980419124467745452646260136710636706430818', + }, + { + actions: [ + [ + '4', + '2', + '3', + '1', + '6', + '1', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + ], + hash: '18015734753837148792640655842002233652997206386955938713795916347682406080658', + }, + { + actions: [ + [ + '7', + '5', + '2', + '2', + '5', + '9', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '1', + ], + ], + hash: '5989718682878427339698011237393630391441699611966040976806294178468546132857', + }, + { + actions: [ + [ + '8', + '7', + '9', + '3', + '3', + '7', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + ], + hash: '11039574756583041422705581318606421503121373204996207587125251343333662996114', + }, + { + actions: [ + [ + '8', + '2', + '6', + '5', + '7', + '4', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '2', + ], + ], + hash: '7379144528024958936343424260830686924904206550439278105352113113000234052189', + }, + { + actions: [ + [ + '4', + '1', + '6', + '1', + '1', + '6', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '2', + ], + ], + hash: '24283805577955881676900472334374429071021848694541967135292970635633855656883', + }, + { + actions: [ + [ + '6', + '4', + '6', + '1', + '2', + '9', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '1', + ], + ], + hash: '19405796317933396070039636056934415509446558084901550036222940955133827617765', + }, + { + actions: [ + [ + '1', + '2', + '8', + '9', + '4', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '13425676685081274200150148900107466661840453492794459505977670505230504369974', + }, + { + actions: [ + [ + '7', + '1', + '4', + '7', + '1', + '8', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '27917968951373205519442101593104886425493701279695265372489725966028374733614', + }, + { + actions: [ + [ + '8', + '6', + '8', + '2', + '2', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '11937452033494931410595153767448335237459927133492086587705984949580439129039', + }, + { + actions: [ + [ + '2', + '5', + '4', + '8', + '7', + '5', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '306448953181338948703362175977727545535067969675851726758279105861051213348', + }, + { + actions: [ + [ + '5', + '2', + '8', + '7', + '7', + '5', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '13037290554120599887681883061039081896239901874775234148973110430688400555848', + }, + { + actions: [ + [ + '2', + '7', + '4', + '2', + '1', + '7', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '2', + ], + ], + hash: '19991151149040056775582798588186971099809360863980267824215220093022078601248', + }, + { + actions: [ + [ + '9', + '5', + '2', + '5', + '3', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '18999781809875195137409610136070952042171951557435220711669467625163107442257', + }, + { + actions: [ + [ + '6', + '6', + '9', + '6', + '6', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '22259450645853554803948670420677142306910404755410865258251921895815255415293', + }, + { + actions: [ + [ + '1', + '2', + '3', + '4', + '5', + '6', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + ], + hash: '673392883539533741083833323613664749289537716367396287193620007403227590463', + }, + { + actions: [ + [ + '7', + '9', + '4', + '9', + '1', + '5', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + ], + hash: '180909818899335552282960593032326010452353832984413053838586392982800816361', + }, + { + actions: [ + [ + '7', + '9', + '4', + '9', + '1', + '5', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + ], + hash: '538225759583776828838980185916932993423635294076028661477767307668950083971', + }, + { + actions: [ + [ + '2', + '2', + '2', + '8', + '8', + '9', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + ], + hash: '4210843157566732374188279776068401510341581683721677983374406432934351405013', + }, + { + actions: [ + [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '2375606751531955225584659908431366439429720821737589519328970676862230219271', + }, + { + actions: [ + [ + '3', + '8', + '3', + '4', + '6', + '3', + '5184473896111145264519431161346885015530479516304070497804290646708961158413', + '0', + '1', + ], + ], + hash: '28572180278243802365130664312029280013478342104105268309616763080120835719175', + }, + { + actions: [ + [ + '3', + '8', + '3', + '4', + '6', + '3', + '5184473896111145264519431161346885015530479516304070497804290646708961158413', + '0', + '1', + ], + ], + hash: '12899116552879177714657258721657037908668833441168563615599253271792804930852', + }, + { + actions: [ + [ + '1', + '2', + '1', + '5', + '9', + '1', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '2555885378598582391522968633614983571379707146909737091855320170891477716903', + }, + { + actions: [ + [ + '5', + '3', + '5', + '6', + '4', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '28693111339694534490617800963939986871474892326167009476909279946629415762752', + }, + { + actions: [ + [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '10375799052052966330950685338047579489788902317193326634260491570085922237258', + }, + { + actions: [ + [ + '6', + '6', + '6', + '6', + '6', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '2', + ], + ], + hash: '28196269303668651416346699879165004850139154523393478734820585068142981031732', + }, + { + actions: [ + [ + '2', + '8', + '2', + '8', + '2', + '8', + '13935000824120239057894068646248236946420165139009401302919178322058796491040', + '1', + '1', + ], + ], + hash: '6729748500965556777838399631123462458572881535784863605229371522514436976852', + }, + { + actions: [ + [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '14719305835147967404874431642690015496919031381380405675285238602024771385112', + }, + { + actions: [ + [ + '5', + '7', + '9', + '4', + '1', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + ], + hash: '23502921406421697988804387941348397070115790652527000864921063117727632274725', + }, + { + actions: [ + [ + '3', + '1', + '3', + '1', + '3', + '1', + '3358872557945087289287973916777076282977688673157429840747067769412340487925', + '1', + '1', + ], + ], + hash: '14235722333149067143537863043740008100246151900030018710036040299525674834117', + }, + { + actions: [ + [ + '9', + '8', + '5', + '3', + '2', + '7', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + ], + hash: '3432500319723012006583645985859849032413742507994268064744704124629760504866', + }, + ]); + }); }); }); }); -``; diff --git a/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts b/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts new file mode 100644 index 0000000000..1a0f0b836a --- /dev/null +++ b/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts @@ -0,0 +1,1864 @@ +export { mockFetchActionsResponse }; + +const mockFetchActionsResponse = { + data: { + actions: [ + { + blockInfo: { + distanceFromMaxBlockHeight: 10067, + }, + actionState: { + actionStateOne: + '25313349900211893975382608876719408889698704200031209664249044279080109975560', + actionStateTwo: + '25079927036070901246064867767436987657692091363973573142121686150614948079097', + }, + actionData: [ + { + accountUpdateId: '40468', + data: [ + '6', + '5', + '7', + '6', + '7', + '8', + '12956991225953906921841684099823101706501308776705520473434038962466907995970', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40468, 8848, 8849], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10061, + }, + actionState: { + actionStateOne: + '21763299541040298587753333338371893846810690469232963591372060459026381039252', + actionStateTwo: + '25313349900211893975382608876719408889698704200031209664249044279080109975560', + }, + actionData: [ + { + accountUpdateId: '40492', + data: [ + '4', + '6', + '2', + '2', + '8', + '3', + '26088020189287768782099688020326138224459601487567694418767232338236813240193', + '0', + '2', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40492, 40493, 40494], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10060, + }, + actionState: { + actionStateOne: + '8628496078274769461115542000844796878294462781470938159543797714990992667559', + actionStateTwo: + '21763299541040298587753333338371893846810690469232963591372060459026381039252', + }, + actionData: [ + { + accountUpdateId: '40496', + data: [ + '2', + '6', + '9', + '7', + '5', + '6', + '25255790042732573450954003712317736246768978834829349553370983848692302775344', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40496, 40497, 40498], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10059, + }, + actionState: { + actionStateOne: + '5514469181095466736859934799926525380889572026984429413409318992237299997028', + actionStateTwo: + '8628496078274769461115542000844796878294462781470938159543797714990992667559', + }, + actionData: [ + { + accountUpdateId: '40500', + data: [ + '6', + '5', + '3', + '9', + '9', + '1', + '19964205550324939630550545763048675864161800749940585779962982033858494022559', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 10, + zkappAccountUpdateIds: [40500, 40501, 40502], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10057, + }, + actionState: { + actionStateOne: + '25885889073951718527354395363806199815487911681101764913596881578771086370107', + actionStateTwo: + '5514469181095466736859934799926525380889572026984429413409318992237299997028', + }, + actionData: [ + { + accountUpdateId: '40517', + data: [ + '9', + '9', + '6', + '6', + '4', + '6', + '12346427434327004348125362664915565629710192257864556013521112054257232754796', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40517, 40518, 40519], + }, + }, + { + accountUpdateId: '40520', + data: [ + '9', + '7', + '1', + '9', + '8', + '8', + '12346427434327004348125362664915565629710192257864556013521112054257232754796', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40520, 40518, 40519], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10049, + }, + actionState: { + actionStateOne: + '3084111396668553871010196373800365499745037262843862158729989883860675348483', + actionStateTwo: + '25885889073951718527354395363806199815487911681101764913596881578771086370107', + }, + actionData: [ + { + accountUpdateId: '40561', + data: [ + '2', + '4', + '4', + '7', + '4', + '3', + '19964205550324939630550545763048675864161800749940585779962982033858494022559', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40561, 40372, 40373], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10047, + }, + actionState: { + actionStateOne: + '13532287841471317150184319478504392572847735859185693513218934441300016387637', + actionStateTwo: + '3084111396668553871010196373800365499745037262843862158729989883860675348483', + }, + actionData: [ + { + accountUpdateId: '40565', + data: [ + '9', + '2', + '9', + '2', + '7', + '6', + '21377591073895713510341309420398793185576884815818377506681280615802759881106', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40565, 40566, 40567], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10044, + }, + actionState: { + actionStateOne: + '12636308717155378495657553296284990333618148856424346334743675423201692801125', + actionStateTwo: + '13532287841471317150184319478504392572847735859185693513218934441300016387637', + }, + actionData: [ + { + accountUpdateId: '40576', + data: [ + '7', + '5', + '9', + '4', + '7', + '6', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40576, 6396, 33066], + }, + }, + { + accountUpdateId: '40577', + data: [ + '2', + '7', + '4', + '3', + '1', + '3', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 8, + zkappAccountUpdateIds: [40577, 6396, 33066], + }, + }, + { + accountUpdateId: '40586', + data: [ + '1', + '6', + '3', + '5', + '2', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 12, + zkappAccountUpdateIds: [40586, 6396, 33066], + }, + }, + { + accountUpdateId: '40587', + data: [ + '4', + '7', + '5', + '1', + '2', + '2', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 13, + zkappAccountUpdateIds: [40587, 6396, 33066], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10043, + }, + actionState: { + actionStateOne: + '13552033292375176242184292341671233419412691991179711376625259275814019808194', + actionStateTwo: + '12636308717155378495657553296284990333618148856424346334743675423201692801125', + }, + actionData: [ + { + accountUpdateId: '40589', + data: [ + '3', + '1', + '3', + '1', + '5', + '6', + '12165186923319687572900094011821565862668411524381584956461194876028064035764', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40589, 40590, 40591], + }, + }, + { + accountUpdateId: '40592', + data: [ + '1', + '1', + '3', + '4', + '9', + '4', + '12956991225953906921841684099823101706501308776705520473434038962466907995970', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40592, 8848, 8849], + }, + }, + { + accountUpdateId: '40593', + data: [ + '9', + '7', + '1', + '1', + '8', + '6', + '12444248802460880132081449291546340439683979052479458915102943284375240795308', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40593, 40594, 40595], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10040, + }, + actionState: { + actionStateOne: + '22428816182994066811035979110138663502097287483003215755615557883450156059598', + actionStateTwo: + '13552033292375176242184292341671233419412691991179711376625259275814019808194', + }, + actionData: [ + { + accountUpdateId: '40599', + data: [ + '9', + '2', + '1', + '1', + '2', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40599, 6396, 33066], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10039, + }, + actionState: { + actionStateOne: + '2657110063538905863496230550574434206907731812034404344231638673775478011856', + actionStateTwo: + '22428816182994066811035979110138663502097287483003215755615557883450156059598', + }, + actionData: [ + { + accountUpdateId: '40601', + data: [ + '6', + '5', + '7', + '6', + '7', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40601, 6396, 33066], + }, + }, + { + accountUpdateId: '40602', + data: [ + '4', + '6', + '2', + '2', + '8', + '3', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40602, 6396, 33066], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10037, + }, + actionState: { + actionStateOne: + '11553781833537412187998791170094246504179739906426596650283148421062134031747', + actionStateTwo: + '2657110063538905863496230550574434206907731812034404344231638673775478011856', + }, + actionData: [ + { + accountUpdateId: '40618', + data: [ + '7', + '7', + '7', + '7', + '7', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40618, 6396, 33066], + }, + }, + { + accountUpdateId: '40617', + data: [ + '3', + '4', + '5', + '7', + '6', + '2', + '6453147199940115032546911372596674482366995380739961315278593325733504245402', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40617, 40372, 40373], + }, + }, + { + accountUpdateId: '40619', + data: [ + '3', + '4', + '5', + '7', + '6', + '3', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40619, 33539, 33540], + }, + }, + { + accountUpdateId: '40620', + data: [ + '3', + '4', + '5', + '7', + '6', + '3', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40620, 33539, 33540], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10036, + }, + actionState: { + actionStateOne: + '5036646800226972634599960587058868707090262022460888863204286405189747942769', + actionStateTwo: + '11553781833537412187998791170094246504179739906426596650283148421062134031747', + }, + actionData: [ + { + accountUpdateId: '40622', + data: [ + '2', + '3', + '4', + '5', + '6', + '7', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40622, 33539, 33540], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10034, + }, + actionState: { + actionStateOne: + '22676822127286113867589765068900374089270892723224396474888670556596794299564', + actionStateTwo: + '5036646800226972634599960587058868707090262022460888863204286405189747942769', + }, + actionData: [ + { + accountUpdateId: '40624', + data: [ + '2', + '3', + '1', + '4', + '8', + '6', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 3, + zkappAccountUpdateIds: [40624, 40372, 40373], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10033, + }, + actionState: { + actionStateOne: + '14450089155455621218882496336231751337940932425300837691009523581147767161552', + actionStateTwo: + '22676822127286113867589765068900374089270892723224396474888670556596794299564', + }, + actionData: [ + { + accountUpdateId: '40626', + data: [ + '7', + '1', + '6', + '9', + '2', + '2', + '12444248802460880132081449291546340439683979052479458915102943284375240795308', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 9, + zkappAccountUpdateIds: [40626, 40372, 40373], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10031, + }, + actionState: { + actionStateOne: + '17343217782575155169164602200877752769390651578694569216079202747806169189400', + actionStateTwo: + '14450089155455621218882496336231751337940932425300837691009523581147767161552', + }, + actionData: [ + { + accountUpdateId: '40629', + data: [ + '1', + '2', + '3', + '4', + '5', + '6', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40629, 33539, 33540], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10014, + }, + actionState: { + actionStateOne: + '4721274078801522986713969462049522847078998862315482276343640953261102256362', + actionStateTwo: + '17343217782575155169164602200877752769390651578694569216079202747806169189400', + }, + actionData: [ + { + accountUpdateId: '40651', + data: [ + '6', + '4', + '3', + '4', + '5', + '8', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 8, + zkappAccountUpdateIds: [40651, 6396, 33066], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 10010, + }, + actionState: { + actionStateOne: + '24590522690942364367249289292250875547314635228745100120965991135101856466170', + actionStateTwo: + '4721274078801522986713969462049522847078998862315482276343640953261102256362', + }, + actionData: [ + { + accountUpdateId: '40657', + data: [ + '2', + '4', + '2', + '9', + '3', + '7', + '15661593045172372274349484602975176160403678593916071611247487060653084577990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 1, + zkappAccountUpdateIds: [40657, 6396, 33066], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9997, + }, + actionState: { + actionStateOne: + '12019972858140051491726046897631768713365384917855031502876641235872835491337', + actionStateTwo: + '24590522690942364367249289292250875547314635228745100120965991135101856466170', + }, + actionData: [ + { + accountUpdateId: '40663', + data: [ + '1', + '3', + '8', + '1', + '1', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '3', + ], + transactionInfo: { + sequenceNumber: 0, + zkappAccountUpdateIds: [40663, 40664, 40665], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9995, + }, + actionState: { + actionStateOne: + '26933479101281889273961421117413591687444559825118348139804588313346830288078', + actionStateTwo: + '12019972858140051491726046897631768713365384917855031502876641235872835491337', + }, + actionData: [ + { + accountUpdateId: '40666', + data: [ + '4', + '7', + '4', + '2', + '7', + '3', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40666, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9993, + }, + actionState: { + actionStateOne: + '23201954681884767758512172994752868073493999252959563785369154647654943505003', + actionStateTwo: + '26933479101281889273961421117413591687444559825118348139804588313346830288078', + }, + actionData: [ + { + accountUpdateId: '40669', + data: [ + '8', + '7', + '6', + '8', + '7', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 0, + zkappAccountUpdateIds: [40669, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9982, + }, + actionState: { + actionStateOne: + '21085262550220603617926377152517886464296676073611212137713290514256181853522', + actionStateTwo: + '23201954681884767758512172994752868073493999252959563785369154647654943505003', + }, + actionData: [ + { + accountUpdateId: '40670', + data: [ + '3', + '7', + '4', + '1', + '3', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 0, + zkappAccountUpdateIds: [40670, 40671, 40672], + }, + }, + { + accountUpdateId: '40673', + data: [ + '2', + '8', + '2', + '4', + '6', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40673, 40671, 40672], + }, + }, + { + accountUpdateId: '40674', + data: [ + '5', + '7', + '1', + '8', + '7', + '4', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40674, 40671, 40672], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9981, + }, + actionState: { + actionStateOne: + '4146388601077199122206031386411652580617016997869931303420910616895941221197', + actionStateTwo: + '21085262550220603617926377152517886464296676073611212137713290514256181853522', + }, + actionData: [ + { + accountUpdateId: '40675', + data: [ + '9', + '4', + '3', + '7', + '4', + '5', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '15', + ], + transactionInfo: { + sequenceNumber: 3, + zkappAccountUpdateIds: [40675, 40671, 40676], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9980, + }, + actionState: { + actionStateOne: + '14718563754416384998379734580498763754546083084109085189673860430296171756381', + actionStateTwo: + '4146388601077199122206031386411652580617016997869931303420910616895941221197', + }, + actionData: [ + { + accountUpdateId: '40677', + data: [ + '9', + '9', + '8', + '1', + '5', + '7', + '16117436006122484987940201799625330705159920592877857277902587370363771532990', + '0', + '11', + ], + transactionInfo: { + sequenceNumber: 2, + zkappAccountUpdateIds: [40677, 40671, 40678], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9854, + }, + actionState: { + actionStateOne: + '22436535202149639941751810143299386980419124467745452646260136710636706430818', + actionStateTwo: + '14718563754416384998379734580498763754546083084109085189673860430296171756381', + }, + actionData: [ + { + accountUpdateId: '40711', + data: [ + '8', + '3', + '2', + '6', + '3', + '2', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 3, + zkappAccountUpdateIds: [40711, 9874, 9875], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9850, + }, + actionState: { + actionStateOne: + '18015734753837148792640655842002233652997206386955938713795916347682406080658', + actionStateTwo: + '22436535202149639941751810143299386980419124467745452646260136710636706430818', + }, + actionData: [ + { + accountUpdateId: '40712', + data: [ + '4', + '2', + '3', + '1', + '6', + '1', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 3, + zkappAccountUpdateIds: [40712, 9874, 9875], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9848, + }, + actionState: { + actionStateOne: + '5989718682878427339698011237393630391441699611966040976806294178468546132857', + actionStateTwo: + '18015734753837148792640655842002233652997206386955938713795916347682406080658', + }, + actionData: [ + { + accountUpdateId: '40715', + data: [ + '7', + '5', + '2', + '2', + '5', + '9', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40715, 37315, 39397], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9847, + }, + actionState: { + actionStateOne: + '11039574756583041422705581318606421503121373204996207587125251343333662996114', + actionStateTwo: + '5989718682878427339698011237393630391441699611966040976806294178468546132857', + }, + actionData: [ + { + accountUpdateId: '40717', + data: [ + '8', + '7', + '9', + '3', + '3', + '7', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40717, 9874, 9875], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9844, + }, + actionState: { + actionStateOne: + '7379144528024958936343424260830686924904206550439278105352113113000234052189', + actionStateTwo: + '11039574756583041422705581318606421503121373204996207587125251343333662996114', + }, + actionData: [ + { + accountUpdateId: '40721', + data: [ + '8', + '2', + '6', + '5', + '7', + '4', + '24840112588285523788042659808059218180295445131298006396932946669691657371564', + '0', + '2', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40721, 9874, 30008], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9843, + }, + actionState: { + actionStateOne: + '24283805577955881676900472334374429071021848694541967135292970635633855656883', + actionStateTwo: + '7379144528024958936343424260830686924904206550439278105352113113000234052189', + }, + actionData: [ + { + accountUpdateId: '40723', + data: [ + '4', + '1', + '6', + '1', + '1', + '6', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '2', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40723, 37315, 40724], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9837, + }, + actionState: { + actionStateOne: + '27917968951373205519442101593104886425493701279695265372489725966028374733614', + actionStateTwo: + '24283805577955881676900472334374429071021848694541967135292970635633855656883', + }, + actionData: [ + { + accountUpdateId: '40733', + data: [ + '6', + '4', + '6', + '1', + '2', + '9', + '26471495794066032558155485203329454126509007011869868179564287910271919232646', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40733, 40372, 40373], + }, + }, + { + accountUpdateId: '40734', + data: [ + '1', + '2', + '8', + '9', + '4', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40734, 40664, 40667], + }, + }, + { + accountUpdateId: '40735', + data: [ + '7', + '1', + '4', + '7', + '1', + '8', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40735, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9836, + }, + actionState: { + actionStateOne: + '11937452033494931410595153767448335237459927133492086587705984949580439129039', + actionStateTwo: + '27917968951373205519442101593104886425493701279695265372489725966028374733614', + }, + actionData: [ + { + accountUpdateId: '40737', + data: [ + '8', + '6', + '8', + '2', + '2', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40737, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9835, + }, + actionState: { + actionStateOne: + '306448953181338948703362175977727545535067969675851726758279105861051213348', + actionStateTwo: + '11937452033494931410595153767448335237459927133492086587705984949580439129039', + }, + actionData: [ + { + accountUpdateId: '40743', + data: [ + '2', + '5', + '4', + '8', + '7', + '5', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40743, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9834, + }, + actionState: { + actionStateOne: + '19991151149040056775582798588186971099809360863980267824215220093022078601248', + actionStateTwo: + '306448953181338948703362175977727545535067969675851726758279105861051213348', + }, + actionData: [ + { + accountUpdateId: '40744', + data: [ + '5', + '2', + '8', + '7', + '7', + '5', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40744, 40664, 40667], + }, + }, + { + accountUpdateId: '40745', + data: [ + '2', + '7', + '4', + '2', + '1', + '7', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '2', + ], + transactionInfo: { + sequenceNumber: 5, + zkappAccountUpdateIds: [40745, 40664, 40746], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9833, + }, + actionState: { + actionStateOne: + '18999781809875195137409610136070952042171951557435220711669467625163107442257', + actionStateTwo: + '19991151149040056775582798588186971099809360863980267824215220093022078601248', + }, + actionData: [ + { + accountUpdateId: '40749', + data: [ + '9', + '5', + '2', + '5', + '3', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40749, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9828, + }, + actionState: { + actionStateOne: + '22259450645853554803948670420677142306910404755410865258251921895815255415293', + actionStateTwo: + '18999781809875195137409610136070952042171951557435220711669467625163107442257', + }, + actionData: [ + { + accountUpdateId: '40755', + data: [ + '6', + '6', + '9', + '6', + '6', + '9', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40755, 40664, 40667], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9813, + }, + actionState: { + actionStateOne: + '673392883539533741083833323613664749289537716367396287193620007403227590463', + actionStateTwo: + '22259450645853554803948670420677142306910404755410865258251921895815255415293', + }, + actionData: [ + { + accountUpdateId: '40773', + data: [ + '1', + '2', + '3', + '4', + '5', + '6', + '21594276700301685638451290563121567472719745179788000956082286147863718718533', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40773, 33539, 33540], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9812, + }, + actionState: { + actionStateOne: + '180909818899335552282960593032326010452353832984413053838586392982800816361', + actionStateTwo: + '673392883539533741083833323613664749289537716367396287193620007403227590463', + }, + actionData: [ + { + accountUpdateId: '40775', + data: [ + '7', + '9', + '4', + '9', + '1', + '5', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40775, 40776, 40777], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9811, + }, + actionState: { + actionStateOne: + '538225759583776828838980185916932993423635294076028661477767307668950083971', + actionStateTwo: + '180909818899335552282960593032326010452353832984413053838586392982800816361', + }, + actionData: [ + { + accountUpdateId: '40779', + data: [ + '7', + '9', + '4', + '9', + '1', + '5', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40779, 40776, 40777], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9810, + }, + actionState: { + actionStateOne: + '4210843157566732374188279776068401510341581683721677983374406432934351405013', + actionStateTwo: + '538225759583776828838980185916932993423635294076028661477767307668950083971', + }, + actionData: [ + { + accountUpdateId: '40781', + data: [ + '2', + '2', + '2', + '8', + '8', + '9', + '8131464104783289520687471370575272049926091999122737565948566444191693236634', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 10, + zkappAccountUpdateIds: [40781, 40776, 40777], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9807, + }, + actionState: { + actionStateOne: + '2375606751531955225584659908431366439429720821737589519328970676862230219271', + actionStateTwo: + '4210843157566732374188279776068401510341581683721677983374406432934351405013', + }, + actionData: [ + { + accountUpdateId: '40785', + data: [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40785, 40786, 40787], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9806, + }, + actionState: { + actionStateOne: + '28572180278243802365130664312029280013478342104105268309616763080120835719175', + actionStateTwo: + '2375606751531955225584659908431366439429720821737589519328970676862230219271', + }, + actionData: [ + { + accountUpdateId: '40789', + data: [ + '3', + '8', + '3', + '4', + '6', + '3', + '5184473896111145264519431161346885015530479516304070497804290646708961158413', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40789, 40790, 40791], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9805, + }, + actionState: { + actionStateOne: + '12899116552879177714657258721657037908668833441168563615599253271792804930852', + actionStateTwo: + '28572180278243802365130664312029280013478342104105268309616763080120835719175', + }, + actionData: [ + { + accountUpdateId: '40793', + data: [ + '3', + '8', + '3', + '4', + '6', + '3', + '5184473896111145264519431161346885015530479516304070497804290646708961158413', + '0', + '1', + ], + transactionInfo: { + sequenceNumber: 7, + zkappAccountUpdateIds: [40793, 40790, 40791], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9802, + }, + actionState: { + actionStateOne: + '10375799052052966330950685338047579489788902317193326634260491570085922237258', + actionStateTwo: + '12899116552879177714657258721657037908668833441168563615599253271792804930852', + }, + actionData: [ + { + accountUpdateId: '40797', + data: [ + '1', + '2', + '1', + '5', + '9', + '1', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 12, + zkappAccountUpdateIds: [40797, 40786, 40787], + }, + }, + { + accountUpdateId: '40798', + data: [ + '5', + '3', + '5', + '6', + '4', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 13, + zkappAccountUpdateIds: [40798, 40786, 40787], + }, + }, + { + accountUpdateId: '40799', + data: [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 15, + zkappAccountUpdateIds: [40799, 40786, 40787], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9801, + }, + actionState: { + actionStateOne: + '28196269303668651416346699879165004850139154523393478734820585068142981031732', + actionStateTwo: + '10375799052052966330950685338047579489788902317193326634260491570085922237258', + }, + actionData: [ + { + accountUpdateId: '40801', + data: [ + '6', + '6', + '6', + '6', + '6', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '2', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40801, 40786, 40802], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9794, + }, + actionState: { + actionStateOne: + '6729748500965556777838399631123462458572881535784863605229371522514436976852', + actionStateTwo: + '28196269303668651416346699879165004850139154523393478734820585068142981031732', + }, + actionData: [ + { + accountUpdateId: '40810', + data: [ + '2', + '8', + '2', + '8', + '2', + '8', + '13935000824120239057894068646248236946420165139009401302919178322058796491040', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40810, 40811, 40812], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9793, + }, + actionState: { + actionStateOne: + '14719305835147967404874431642690015496919031381380405675285238602024771385112', + actionStateTwo: + '6729748500965556777838399631123462458572881535784863605229371522514436976852', + }, + actionData: [ + { + accountUpdateId: '40815', + data: [ + '1', + '2', + '5', + '2', + '2', + '5', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 8, + zkappAccountUpdateIds: [40815, 40372, 40373], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9792, + }, + actionState: { + actionStateOne: + '23502921406421697988804387941348397070115790652527000864921063117727632274725', + actionStateTwo: + '14719305835147967404874431642690015496919031381380405675285238602024771385112', + }, + actionData: [ + { + accountUpdateId: '40817', + data: [ + '5', + '7', + '9', + '4', + '1', + '7', + '10329935204614394060743187454419407441282038590465076620570686354885776266705', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 10, + zkappAccountUpdateIds: [40817, 40372, 40373], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9787, + }, + actionState: { + actionStateOne: + '14235722333149067143537863043740008100246151900030018710036040299525674834117', + actionStateTwo: + '23502921406421697988804387941348397070115790652527000864921063117727632274725', + }, + actionData: [ + { + accountUpdateId: '40824', + data: [ + '3', + '1', + '3', + '1', + '3', + '1', + '3358872557945087289287973916777076282977688673157429840747067769412340487925', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 6, + zkappAccountUpdateIds: [40824, 40825, 40826], + }, + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 9775, + }, + actionState: { + actionStateOne: + '3432500319723012006583645985859849032413742507994268064744704124629760504866', + actionStateTwo: + '14235722333149067143537863043740008100246151900030018710036040299525674834117', + }, + actionData: [ + { + accountUpdateId: '40850', + data: [ + '9', + '8', + '5', + '3', + '2', + '7', + '5706376253943510402705579272467768662733130021399469094173930489992680696927', + '1', + '1', + ], + transactionInfo: { + sequenceNumber: 4, + zkappAccountUpdateIds: [40850, 40664, 40667], + }, + }, + ], + }, + ], + }, +}; diff --git a/src/lib/mina/fixtures/fetch-actions-response-without-transaction-info.ts b/src/lib/mina/fixtures/fetch-actions-response-without-transaction-info.ts new file mode 100644 index 0000000000..f098fddc39 --- /dev/null +++ b/src/lib/mina/fixtures/fetch-actions-response-without-transaction-info.ts @@ -0,0 +1,123 @@ +export { mockFetchActionsResponse }; + +const mockFetchActionsResponse = { + data: { + actions: [ + { + blockInfo: { + distanceFromMaxBlockHeight: 11, + }, + actionState: { + actionStateOne: + '25525130517416993227046681664758665799110129890808721833148757111140891481208', + actionStateTwo: + '25079927036070901246064867767436987657692091363973573142121686150614948079097', + }, + actionData: [ + { + accountUpdateId: '5', + data: [ + '20503089751358270987184701275168489753952341816059774976784079526478451099801', + '1', + ], + }, + { + accountUpdateId: '3', + data: [ + '20374659537065244088703638031937922870146667362923279084491778322749365537089', + '1', + ], + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 5, + }, + actionState: { + actionStateOne: + '290963518424616502946790040851348455652296009700336010663574777600482385855', + actionStateTwo: + '25525130517416993227046681664758665799110129890808721833148757111140891481208', + }, + actionData: [ + { + accountUpdateId: '7', + data: [ + '3374074164183544078218789545772953663729921088152354292852793744356608231707', + '0', + ], + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 3, + }, + actionState: { + actionStateOne: + '20673199655841577810393943638910551364027795297920791498278816237738641857371', + actionStateTwo: + '290963518424616502946790040851348455652296009700336010663574777600482385855', + }, + actionData: [ + { + accountUpdateId: '9', + data: [ + '12630758077588166643924428865613845067150916064939816120404808842510620524633', + '1', + ], + }, + ], + }, + { + blockInfo: { + distanceFromMaxBlockHeight: 2, + }, + actionState: { + actionStateOne: + '10964420428484427410756859799314206378989718180435238943573393516522086219419', + actionStateTwo: + '20673199655841577810393943638910551364027795297920791498278816237738641857371', + }, + actionData: [ + { + accountUpdateId: '19', + data: [ + '17137397755795687855356639427474789131368991089558570411893673365904353943290', + '1', + ], + }, + { + accountUpdateId: '17', + data: [ + '3378367318331499715304980508337843233019278703665446829424824679144818589558', + '1', + ], + }, + { + accountUpdateId: '15', + data: [ + '27263309408256888453299195755797013857604561285332380691270111409680109142128', + '1', + ], + }, + { + accountUpdateId: '13', + data: [ + '15789351988619560045401465240113496854401074115453702466673859303925517061263', + '0', + ], + }, + { + accountUpdateId: '11', + data: [ + '5643224648393140391519847064914429159616501351124129591669928700148350171602', + '0', + ], + }, + ], + }, + ], + }, +}; diff --git a/src/lib/mina/fixtures/fetch-actions-response.ts b/src/lib/mina/fixtures/fetch-actions-response.ts deleted file mode 100644 index 3e280bbff2..0000000000 --- a/src/lib/mina/fixtures/fetch-actions-response.ts +++ /dev/null @@ -1,118 +0,0 @@ -export { - mockFetchActionsResponse -} - -const mockFetchActionsResponse = -{ - "data": { - "actions": [ - { - "blockInfo": { - "distanceFromMaxBlockHeight": 11 - }, - "actionState": { - "actionStateOne": "25525130517416993227046681664758665799110129890808721833148757111140891481208", - "actionStateTwo": "25079927036070901246064867767436987657692091363973573142121686150614948079097" - }, - "actionData": [ - { - "accountUpdateId": "5", - "data": [ - "20503089751358270987184701275168489753952341816059774976784079526478451099801", - "1" - ] - }, - { - "accountUpdateId": "3", - "data": [ - "20374659537065244088703638031937922870146667362923279084491778322749365537089", - "1" - ] - } - ] - }, - { - "blockInfo": { - "distanceFromMaxBlockHeight": 5 - }, - "actionState": { - "actionStateOne": "290963518424616502946790040851348455652296009700336010663574777600482385855", - "actionStateTwo": "25525130517416993227046681664758665799110129890808721833148757111140891481208" - }, - "actionData": [ - { - "accountUpdateId": "7", - "data": [ - "3374074164183544078218789545772953663729921088152354292852793744356608231707", - "0" - ] - } - ] - }, - { - "blockInfo": { - "distanceFromMaxBlockHeight": 3 - }, - "actionState": { - "actionStateOne": "20673199655841577810393943638910551364027795297920791498278816237738641857371", - "actionStateTwo": "290963518424616502946790040851348455652296009700336010663574777600482385855" - }, - "actionData": [ - { - "accountUpdateId": "9", - "data": [ - "12630758077588166643924428865613845067150916064939816120404808842510620524633", - "1" - ] - } - ] - }, - { - "blockInfo": { - "distanceFromMaxBlockHeight": 2 - }, - "actionState": { - "actionStateOne": "10964420428484427410756859799314206378989718180435238943573393516522086219419", - "actionStateTwo": "20673199655841577810393943638910551364027795297920791498278816237738641857371" - }, - "actionData": [ - { - "accountUpdateId": "19", - "data": [ - "17137397755795687855356639427474789131368991089558570411893673365904353943290", - "1" - ] - }, - { - "accountUpdateId": "17", - "data": [ - "3378367318331499715304980508337843233019278703665446829424824679144818589558", - "1" - ] - }, - { - "accountUpdateId": "15", - "data": [ - "27263309408256888453299195755797013857604561285332380691270111409680109142128", - "1" - ] - }, - { - "accountUpdateId": "13", - "data": [ - "15789351988619560045401465240113496854401074115453702466673859303925517061263", - "0" - ] - }, - { - "accountUpdateId": "11", - "data": [ - "5643224648393140391519847064914429159616501351124129591669928700148350171602", - "0" - ] - } - ] - } - ] - } -} \ No newline at end of file diff --git a/src/lib/mina/graphql.ts b/src/lib/mina/graphql.ts index 04e0340a61..0c126bff14 100644 --- a/src/lib/mina/graphql.ts +++ b/src/lib/mina/graphql.ts @@ -262,6 +262,10 @@ type FetchedAction = { actionData: { accountUpdateId: string; data: string[]; + transactionInfo?: { + sequenceNumber: number; + zkappAccountUpdateIds: number[]; + }; }[]; }; @@ -339,6 +343,10 @@ const getActionsQuery = ( actionData { accountUpdateId data + transactionInfo { + sequenceNumber + zkappAccountUpdateIds + } } } }`; From fa6779cfa2b8c8f76cb887da7d549cd6421be75b Mon Sep 17 00:00:00 2001 From: Coby Date: Fri, 22 Nov 2024 09:55:16 -0500 Subject: [PATCH 2/9] try graphQL query both ways --- src/lib/mina/fetch.ts | 10 +++++++++- src/lib/mina/graphql.ts | 10 ++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index c9b86817ed..cf6e48daa6 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -710,7 +710,15 @@ async function fetchActions( graphqlEndpoint, networkConfig.archiveFallbackEndpoints ); - if (error) throw Error(error.statusText); + if (error) { + // retry once without querying transaction info + [response, error] = await makeGraphqlRequest( + getActionsQuery(publicKey, actionStates, tokenId, undefined, true), + graphqlEndpoint, + networkConfig.archiveFallbackEndpoints + ); + if (error) throw Error(error.statusText); + } let fetchedActions = response?.data.actions; if (fetchedActions === undefined) { return { diff --git a/src/lib/mina/graphql.ts b/src/lib/mina/graphql.ts index 0c126bff14..df574d7420 100644 --- a/src/lib/mina/graphql.ts +++ b/src/lib/mina/graphql.ts @@ -321,7 +321,8 @@ const getActionsQuery = ( publicKey: string, actionStates: ActionStatesStringified, tokenId: string, - _filterOptions?: EventActionFilterOptions + _filterOptions?: EventActionFilterOptions, + retryWithoutTxInfo: boolean = false ) => { const { fromActionState, endActionState } = actionStates ?? {}; let input = `address: "${publicKey}", tokenId: "${tokenId}"`; @@ -343,9 +344,10 @@ const getActionsQuery = ( actionData { accountUpdateId data - transactionInfo { - sequenceNumber - zkappAccountUpdateIds + ${ + retryWithoutTxInfo + ? '' + : 'transactionInfo { sequenceNumber zkappAccountUpdateIds }' } } } From 3b599764016867b62314604c226ea9f9e00486cb Mon Sep 17 00:00:00 2001 From: Coby Date: Fri, 22 Nov 2024 10:03:03 -0500 Subject: [PATCH 3/9] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da97589a32..171006af3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Compiling stuck in the browser for recursive zkprograms https://github.com/o1-labs/o1js/pull/1906 +- Sort order for actions now includes the transaction sequence number and the exact account id sequence ## [2.1.0](https://github.com/o1-labs/o1js/compare/b04520d...e1bac02) - 2024-11-13 From 65c315948f4717805cbe1a866305bf7263a605e5 Mon Sep 17 00:00:00 2001 From: Coby Date: Wed, 8 Jan 2025 10:58:27 -0500 Subject: [PATCH 4/9] updating comments and function documentation --- src/lib/mina/fetch.ts | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index cf6e48daa6..f9e5613b1f 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -691,10 +691,30 @@ async function fetchEvents( }); } +/** + * Fetches account actions for a specified public key and token ID by performing a GraphQL query. + * + * @param accountInfo - An {@link ActionsQueryInputs} containing the public key, and optional query parameters for the actions query + * @param graphqlEndpoint - The GraphQL endpoint to fetch from. Defaults to the configured Mina endpoint. + * + * @returns A promise that resolves to an object containing the final actions hash for the account, and a list of actions + * @throws Will throw an error if the GraphQL endpoint is invalid or if the fetch request fails. + * + * @example + * const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' }; + * const acitonsList = await fetchAccount(accountInfo); + * console.log(acitonsList); + */ async function fetchActions( accountInfo: ActionsQueryInputs, graphqlEndpoint = networkConfig.archiveEndpoint -) { +): Promise< + | { + actions: string[][]; + hash: string; + }[] + | { error: FetchError } +> { if (!graphqlEndpoint) throw Error( 'fetchActions: Specified GraphQL endpoint is undefined. When using actions, you must set the archive node endpoint in Mina.Network(). Please ensure your Mina.Network() configuration includes an archive node endpoint.' @@ -710,14 +730,25 @@ async function fetchActions( graphqlEndpoint, networkConfig.archiveFallbackEndpoints ); + // As of 2025-01-07, minascan is running a version of the node which supports `sequenceNumber` and `zkappAccountUpdateIds` fields + // We could consider removing this fallback since no other nodes are widely used if (error) { - // retry once without querying transaction info + const originalError = error; [response, error] = await makeGraphqlRequest( - getActionsQuery(publicKey, actionStates, tokenId, undefined, true), + getActionsQuery( + publicKey, + actionStates, + tokenId, + /* _filterOptions= */ undefined, + /* retryWithoutTxInfo= */ true + ), graphqlEndpoint, networkConfig.archiveFallbackEndpoints ); - if (error) throw Error(error.statusText); + if (error) + throw Error( + `ORIGINAL ERROR: ${originalError.statusText} \n\nRETRY ERROR: ${error.statusText}` + ); } let fetchedActions = response?.data.actions; if (fetchedActions === undefined) { @@ -766,6 +797,8 @@ export function createActionsList( ); // DEPRECATED: In case the archive node is running an out-of-date version, best guess is to sort by the account update id + // As of 2025-01-07, minascan is running a version of the node which supports `sequenceNumber` and `zkappAccountUpdateIds` fields + // We could consider removing this fallback since no other nodes are widely used if (!actionData[0].transactionInfo) { actionData = actionData.sort((a1, a2) => { return Number(a1.accountUpdateId) - Number(a2.accountUpdateId); From 9c40282890e5a6e6bb876285d8845d447defc26e Mon Sep 17 00:00:00 2001 From: Coby Date: Wed, 8 Jan 2025 16:43:21 -0500 Subject: [PATCH 5/9] simplify unit test --- src/lib/mina/fetch.unit-test.ts | 1183 +----------- ...-actions-response-with-transaction-info.ts | 1704 ----------------- 2 files changed, 26 insertions(+), 2861 deletions(-) diff --git a/src/lib/mina/fetch.unit-test.ts b/src/lib/mina/fetch.unit-test.ts index ddff0457fb..d3273e9b5e 100644 --- a/src/lib/mina/fetch.unit-test.ts +++ b/src/lib/mina/fetch.unit-test.ts @@ -144,89 +144,20 @@ describe('Fetch', () => { ); test('orders the actions correctly', () => { - expect(actionsList).toEqual([ - { - actions: [ - [ - '20374659537065244088703638031937922870146667362923279084491778322749365537089', - '1', - ], - ], - hash: '10619825168606131449407092474314250900469658818945385329390497057469974757422', - }, - { - actions: [ - [ - '20503089751358270987184701275168489753952341816059774976784079526478451099801', - '1', - ], - ], - hash: '25525130517416993227046681664758665799110129890808721833148757111140891481208', - }, - { - actions: [ - [ - '3374074164183544078218789545772953663729921088152354292852793744356608231707', - '0', - ], - ], - hash: '290963518424616502946790040851348455652296009700336010663574777600482385855', - }, - { - actions: [ - [ - '12630758077588166643924428865613845067150916064939816120404808842510620524633', - '1', - ], - ], - hash: '20673199655841577810393943638910551364027795297920791498278816237738641857371', - }, - { - actions: [ - [ - '5643224648393140391519847064914429159616501351124129591669928700148350171602', - '0', - ], - ], - hash: '5284016523143033193387918577616839424871122381326995145988133445906503263869', - }, - { - actions: [ - [ - '15789351988619560045401465240113496854401074115453702466673859303925517061263', - '0', - ], - ], - hash: '16944163018367910067334012882171366051616125936127175065464614786387687317044', - }, - { - actions: [ - [ - '27263309408256888453299195755797013857604561285332380691270111409680109142128', - '1', - ], - ], - hash: '23662159967366296714544063539035629952291787828104373633198732070740691309118', - }, - { - actions: [ - [ - '3378367318331499715304980508337843233019278703665446829424824679144818589558', - '1', - ], - ], - hash: '1589729766029695153975344283092689798747741638003354620355672853210932754595', - }, - { - actions: [ - [ - '17137397755795687855356639427474789131368991089558570411893673365904353943290', - '1', - ], - ], - hash: '10964420428484427410756859799314206378989718180435238943573393516522086219419', - }, - ]); + const correctActionsHashes = [ + '10619825168606131449407092474314250900469658818945385329390497057469974757422', + '25525130517416993227046681664758665799110129890808721833148757111140891481208', + '290963518424616502946790040851348455652296009700336010663574777600482385855', + '20673199655841577810393943638910551364027795297920791498278816237738641857371', + '5284016523143033193387918577616839424871122381326995145988133445906503263869', + '16944163018367910067334012882171366051616125936127175065464614786387687317044', + '23662159967366296714544063539035629952291787828104373633198732070740691309118', + '1589729766029695153975344283092689798747741638003354620355672853210932754595', + '10964420428484427410756859799314206378989718180435238943573393516522086219419', + ]; + expect(actionsList.map(({ hash }) => hash)).toEqual( + correctActionsHashes + ); }); }); @@ -237,1080 +168,18 @@ describe('Fetch', () => { ); test('orders the actions correctly', () => { - expect(actionsList).toEqual([ - { - actions: [ - [ - '6', - '5', - '7', - '6', - '7', - '8', - '12956991225953906921841684099823101706501308776705520473434038962466907995970', - '0', - '1', - ], - ], - hash: '25313349900211893975382608876719408889698704200031209664249044279080109975560', - }, - { - actions: [ - [ - '4', - '6', - '2', - '2', - '8', - '3', - '26088020189287768782099688020326138224459601487567694418767232338236813240193', - '0', - '2', - ], - ], - hash: '21763299541040298587753333338371893846810690469232963591372060459026381039252', - }, - { - actions: [ - [ - '2', - '6', - '9', - '7', - '5', - '6', - '25255790042732573450954003712317736246768978834829349553370983848692302775344', - '0', - '1', - ], - ], - hash: '8628496078274769461115542000844796878294462781470938159543797714990992667559', - }, - { - actions: [ - [ - '6', - '5', - '3', - '9', - '9', - '1', - '19964205550324939630550545763048675864161800749940585779962982033858494022559', - '1', - '1', - ], - ], - hash: '5514469181095466736859934799926525380889572026984429413409318992237299997028', - }, - { - actions: [ - [ - '9', - '9', - '6', - '6', - '4', - '6', - '12346427434327004348125362664915565629710192257864556013521112054257232754796', - '1', - '1', - ], - ], - hash: '27436192387992217139011123768031802510733783343834317381772204899483202267193', - }, - { - actions: [ - [ - '9', - '7', - '1', - '9', - '8', - '8', - '12346427434327004348125362664915565629710192257864556013521112054257232754796', - '1', - '1', - ], - ], - hash: '25885889073951718527354395363806199815487911681101764913596881578771086370107', - }, - { - actions: [ - [ - '2', - '4', - '4', - '7', - '4', - '3', - '19964205550324939630550545763048675864161800749940585779962982033858494022559', - '1', - '1', - ], - ], - hash: '3084111396668553871010196373800365499745037262843862158729989883860675348483', - }, - { - actions: [ - [ - '9', - '2', - '9', - '2', - '7', - '6', - '21377591073895713510341309420398793185576884815818377506681280615802759881106', - '0', - '1', - ], - ], - hash: '13532287841471317150184319478504392572847735859185693513218934441300016387637', - }, - { - actions: [ - [ - '7', - '5', - '9', - '4', - '7', - '6', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '23562173419146814432140831830018386191372262558717813981702672868292521523493', - }, - { - actions: [ - [ - '2', - '7', - '4', - '3', - '1', - '3', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '17091049856171838105194364005412166905307014398334933913160405653259432088216', - }, - { - actions: [ - [ - '1', - '6', - '3', - '5', - '2', - '7', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '17232885850087529233459756382038742870248640044940153006158312935267918515979', - }, - { - actions: [ - [ - '4', - '7', - '5', - '1', - '2', - '2', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '12636308717155378495657553296284990333618148856424346334743675423201692801125', - }, - { - actions: [ - [ - '3', - '1', - '3', - '1', - '5', - '6', - '12165186923319687572900094011821565862668411524381584956461194876028064035764', - '0', - '1', - ], - ], - hash: '17082487567758469425757467457967473265642001333824907522427890208991758759731', - }, - { - actions: [ - [ - '1', - '1', - '3', - '4', - '9', - '4', - '12956991225953906921841684099823101706501308776705520473434038962466907995970', - '0', - '1', - ], - ], - hash: '14226491442770650712364681911870921131508915865197379983185088742764625929348', - }, - { - actions: [ - [ - '9', - '7', - '1', - '1', - '8', - '6', - '12444248802460880132081449291546340439683979052479458915102943284375240795308', - '1', - '1', - ], - ], - hash: '13552033292375176242184292341671233419412691991179711376625259275814019808194', - }, - { - actions: [ - [ - '9', - '2', - '1', - '1', - '2', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '22428816182994066811035979110138663502097287483003215755615557883450156059598', - }, - { - actions: [ - [ - '6', - '5', - '7', - '6', - '7', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '22526342661206194008430176692375034342082965513600234855498984822568539554270', - }, - { - actions: [ - [ - '4', - '6', - '2', - '2', - '8', - '3', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '2657110063538905863496230550574434206907731812034404344231638673775478011856', - }, - { - actions: [ - [ - '7', - '7', - '7', - '7', - '7', - '7', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '22538126940372893133565877949395572498140210910784052520799713638161217553842', - }, - { - actions: [ - [ - '3', - '4', - '5', - '7', - '6', - '2', - '6453147199940115032546911372596674482366995380739961315278593325733504245402', - '0', - '1', - ], - ], - hash: '13346898880455647067452267285098444549289840161340616136535351191377323737874', - }, - { - actions: [ - [ - '3', - '4', - '5', - '7', - '6', - '3', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - ], - hash: '8960443634734051886489484343002863270419199667986186484392955287225122849837', - }, - { - actions: [ - [ - '3', - '4', - '5', - '7', - '6', - '3', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - ], - hash: '11553781833537412187998791170094246504179739906426596650283148421062134031747', - }, - { - actions: [ - [ - '2', - '3', - '4', - '5', - '6', - '7', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - ], - hash: '5036646800226972634599960587058868707090262022460888863204286405189747942769', - }, - { - actions: [ - [ - '2', - '3', - '1', - '4', - '8', - '6', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '22676822127286113867589765068900374089270892723224396474888670556596794299564', - }, - { - actions: [ - [ - '7', - '1', - '6', - '9', - '2', - '2', - '12444248802460880132081449291546340439683979052479458915102943284375240795308', - '1', - '1', - ], - ], - hash: '14450089155455621218882496336231751337940932425300837691009523581147767161552', - }, - { - actions: [ - [ - '1', - '2', - '3', - '4', - '5', - '6', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - ], - hash: '17343217782575155169164602200877752769390651578694569216079202747806169189400', - }, - { - actions: [ - [ - '6', - '4', - '3', - '4', - '5', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '4721274078801522986713969462049522847078998862315482276343640953261102256362', - }, - { - actions: [ - [ - '2', - '4', - '2', - '9', - '3', - '7', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - ], - hash: '24590522690942364367249289292250875547314635228745100120965991135101856466170', - }, - { - actions: [ - [ - '1', - '3', - '8', - '1', - '1', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '3', - ], - ], - hash: '12019972858140051491726046897631768713365384917855031502876641235872835491337', - }, - { - actions: [ - [ - '4', - '7', - '4', - '2', - '7', - '3', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '26933479101281889273961421117413591687444559825118348139804588313346830288078', - }, - { - actions: [ - [ - '8', - '7', - '6', - '8', - '7', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '23201954681884767758512172994752868073493999252959563785369154647654943505003', - }, - { - actions: [ - [ - '3', - '7', - '4', - '1', - '3', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - ], - hash: '1000179065401720127557736288040692604435268683625844611181682352431913959786', - }, - { - actions: [ - [ - '2', - '8', - '2', - '4', - '6', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - ], - hash: '25629104547868447471450619254775537300502100982314563069790647977264591517687', - }, - { - actions: [ - [ - '5', - '7', - '1', - '8', - '7', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - ], - hash: '21085262550220603617926377152517886464296676073611212137713290514256181853522', - }, - { - actions: [ - [ - '9', - '4', - '3', - '7', - '4', - '5', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '15', - ], - ], - hash: '4146388601077199122206031386411652580617016997869931303420910616895941221197', - }, - { - actions: [ - [ - '9', - '9', - '8', - '1', - '5', - '7', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '11', - ], - ], - hash: '14718563754416384998379734580498763754546083084109085189673860430296171756381', - }, - { - actions: [ - [ - '8', - '3', - '2', - '6', - '3', - '2', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - ], - hash: '22436535202149639941751810143299386980419124467745452646260136710636706430818', - }, - { - actions: [ - [ - '4', - '2', - '3', - '1', - '6', - '1', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - ], - hash: '18015734753837148792640655842002233652997206386955938713795916347682406080658', - }, - { - actions: [ - [ - '7', - '5', - '2', - '2', - '5', - '9', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '1', - ], - ], - hash: '5989718682878427339698011237393630391441699611966040976806294178468546132857', - }, - { - actions: [ - [ - '8', - '7', - '9', - '3', - '3', - '7', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - ], - hash: '11039574756583041422705581318606421503121373204996207587125251343333662996114', - }, - { - actions: [ - [ - '8', - '2', - '6', - '5', - '7', - '4', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '2', - ], - ], - hash: '7379144528024958936343424260830686924904206550439278105352113113000234052189', - }, - { - actions: [ - [ - '4', - '1', - '6', - '1', - '1', - '6', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '2', - ], - ], - hash: '24283805577955881676900472334374429071021848694541967135292970635633855656883', - }, - { - actions: [ - [ - '6', - '4', - '6', - '1', - '2', - '9', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '1', - ], - ], - hash: '19405796317933396070039636056934415509446558084901550036222940955133827617765', - }, - { - actions: [ - [ - '1', - '2', - '8', - '9', - '4', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '13425676685081274200150148900107466661840453492794459505977670505230504369974', - }, - { - actions: [ - [ - '7', - '1', - '4', - '7', - '1', - '8', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '27917968951373205519442101593104886425493701279695265372489725966028374733614', - }, - { - actions: [ - [ - '8', - '6', - '8', - '2', - '2', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '11937452033494931410595153767448335237459927133492086587705984949580439129039', - }, - { - actions: [ - [ - '2', - '5', - '4', - '8', - '7', - '5', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '306448953181338948703362175977727545535067969675851726758279105861051213348', - }, - { - actions: [ - [ - '5', - '2', - '8', - '7', - '7', - '5', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '13037290554120599887681883061039081896239901874775234148973110430688400555848', - }, - { - actions: [ - [ - '2', - '7', - '4', - '2', - '1', - '7', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '2', - ], - ], - hash: '19991151149040056775582798588186971099809360863980267824215220093022078601248', - }, - { - actions: [ - [ - '9', - '5', - '2', - '5', - '3', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '18999781809875195137409610136070952042171951557435220711669467625163107442257', - }, - { - actions: [ - [ - '6', - '6', - '9', - '6', - '6', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '22259450645853554803948670420677142306910404755410865258251921895815255415293', - }, - { - actions: [ - [ - '1', - '2', - '3', - '4', - '5', - '6', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - ], - hash: '673392883539533741083833323613664749289537716367396287193620007403227590463', - }, - { - actions: [ - [ - '7', - '9', - '4', - '9', - '1', - '5', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - ], - hash: '180909818899335552282960593032326010452353832984413053838586392982800816361', - }, - { - actions: [ - [ - '7', - '9', - '4', - '9', - '1', - '5', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - ], - hash: '538225759583776828838980185916932993423635294076028661477767307668950083971', - }, - { - actions: [ - [ - '2', - '2', - '2', - '8', - '8', - '9', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - ], - hash: '4210843157566732374188279776068401510341581683721677983374406432934351405013', - }, - { - actions: [ - [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '2375606751531955225584659908431366439429720821737589519328970676862230219271', - }, - { - actions: [ - [ - '3', - '8', - '3', - '4', - '6', - '3', - '5184473896111145264519431161346885015530479516304070497804290646708961158413', - '0', - '1', - ], - ], - hash: '28572180278243802365130664312029280013478342104105268309616763080120835719175', - }, - { - actions: [ - [ - '3', - '8', - '3', - '4', - '6', - '3', - '5184473896111145264519431161346885015530479516304070497804290646708961158413', - '0', - '1', - ], - ], - hash: '12899116552879177714657258721657037908668833441168563615599253271792804930852', - }, - { - actions: [ - [ - '1', - '2', - '1', - '5', - '9', - '1', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '2555885378598582391522968633614983571379707146909737091855320170891477716903', - }, - { - actions: [ - [ - '5', - '3', - '5', - '6', - '4', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '28693111339694534490617800963939986871474892326167009476909279946629415762752', - }, - { - actions: [ - [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '10375799052052966330950685338047579489788902317193326634260491570085922237258', - }, - { - actions: [ - [ - '6', - '6', - '6', - '6', - '6', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '2', - ], - ], - hash: '28196269303668651416346699879165004850139154523393478734820585068142981031732', - }, - { - actions: [ - [ - '2', - '8', - '2', - '8', - '2', - '8', - '13935000824120239057894068646248236946420165139009401302919178322058796491040', - '1', - '1', - ], - ], - hash: '6729748500965556777838399631123462458572881535784863605229371522514436976852', - }, - { - actions: [ - [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '14719305835147967404874431642690015496919031381380405675285238602024771385112', - }, - { - actions: [ - [ - '5', - '7', - '9', - '4', - '1', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - ], - hash: '23502921406421697988804387941348397070115790652527000864921063117727632274725', - }, - { - actions: [ - [ - '3', - '1', - '3', - '1', - '3', - '1', - '3358872557945087289287973916777076282977688673157429840747067769412340487925', - '1', - '1', - ], - ], - hash: '14235722333149067143537863043740008100246151900030018710036040299525674834117', - }, - { - actions: [ - [ - '9', - '8', - '5', - '3', - '2', - '7', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - ], - hash: '3432500319723012006583645985859849032413742507994268064744704124629760504866', - }, - ]); + const correctActionsHashes = [ + '23562173419146814432140831830018386191372262558717813981702672868292521523493', + '17091049856171838105194364005412166905307014398334933913160405653259432088216', + '17232885850087529233459756382038742870248640044940153006158312935267918515979', + '12636308717155378495657553296284990333618148856424346334743675423201692801125', + '17082487567758469425757467457967473265642001333824907522427890208991758759731', + '14226491442770650712364681911870921131508915865197379983185088742764625929348', + '13552033292375176242184292341671233419412691991179711376625259275814019808194', + ]; + expect(actionsList.map(({ hash }) => hash)).toEqual( + correctActionsHashes + ); }); }); }); diff --git a/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts b/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts index 1a0f0b836a..de1df5d8c9 100644 --- a/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts +++ b/src/lib/mina/fixtures/fetch-actions-response-with-transaction-info.ts @@ -3,241 +3,6 @@ export { mockFetchActionsResponse }; const mockFetchActionsResponse = { data: { actions: [ - { - blockInfo: { - distanceFromMaxBlockHeight: 10067, - }, - actionState: { - actionStateOne: - '25313349900211893975382608876719408889698704200031209664249044279080109975560', - actionStateTwo: - '25079927036070901246064867767436987657692091363973573142121686150614948079097', - }, - actionData: [ - { - accountUpdateId: '40468', - data: [ - '6', - '5', - '7', - '6', - '7', - '8', - '12956991225953906921841684099823101706501308776705520473434038962466907995970', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40468, 8848, 8849], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10061, - }, - actionState: { - actionStateOne: - '21763299541040298587753333338371893846810690469232963591372060459026381039252', - actionStateTwo: - '25313349900211893975382608876719408889698704200031209664249044279080109975560', - }, - actionData: [ - { - accountUpdateId: '40492', - data: [ - '4', - '6', - '2', - '2', - '8', - '3', - '26088020189287768782099688020326138224459601487567694418767232338236813240193', - '0', - '2', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40492, 40493, 40494], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10060, - }, - actionState: { - actionStateOne: - '8628496078274769461115542000844796878294462781470938159543797714990992667559', - actionStateTwo: - '21763299541040298587753333338371893846810690469232963591372060459026381039252', - }, - actionData: [ - { - accountUpdateId: '40496', - data: [ - '2', - '6', - '9', - '7', - '5', - '6', - '25255790042732573450954003712317736246768978834829349553370983848692302775344', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40496, 40497, 40498], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10059, - }, - actionState: { - actionStateOne: - '5514469181095466736859934799926525380889572026984429413409318992237299997028', - actionStateTwo: - '8628496078274769461115542000844796878294462781470938159543797714990992667559', - }, - actionData: [ - { - accountUpdateId: '40500', - data: [ - '6', - '5', - '3', - '9', - '9', - '1', - '19964205550324939630550545763048675864161800749940585779962982033858494022559', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 10, - zkappAccountUpdateIds: [40500, 40501, 40502], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10057, - }, - actionState: { - actionStateOne: - '25885889073951718527354395363806199815487911681101764913596881578771086370107', - actionStateTwo: - '5514469181095466736859934799926525380889572026984429413409318992237299997028', - }, - actionData: [ - { - accountUpdateId: '40517', - data: [ - '9', - '9', - '6', - '6', - '4', - '6', - '12346427434327004348125362664915565629710192257864556013521112054257232754796', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40517, 40518, 40519], - }, - }, - { - accountUpdateId: '40520', - data: [ - '9', - '7', - '1', - '9', - '8', - '8', - '12346427434327004348125362664915565629710192257864556013521112054257232754796', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 7, - zkappAccountUpdateIds: [40520, 40518, 40519], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10049, - }, - actionState: { - actionStateOne: - '3084111396668553871010196373800365499745037262843862158729989883860675348483', - actionStateTwo: - '25885889073951718527354395363806199815487911681101764913596881578771086370107', - }, - actionData: [ - { - accountUpdateId: '40561', - data: [ - '2', - '4', - '4', - '7', - '4', - '3', - '19964205550324939630550545763048675864161800749940585779962982033858494022559', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 7, - zkappAccountUpdateIds: [40561, 40372, 40373], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10047, - }, - actionState: { - actionStateOne: - '13532287841471317150184319478504392572847735859185693513218934441300016387637', - actionStateTwo: - '3084111396668553871010196373800365499745037262843862158729989883860675348483', - }, - actionData: [ - { - accountUpdateId: '40565', - data: [ - '9', - '2', - '9', - '2', - '7', - '6', - '21377591073895713510341309420398793185576884815818377506681280615802759881106', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40565, 40566, 40567], - }, - }, - ], - }, { blockInfo: { distanceFromMaxBlockHeight: 10044, @@ -390,1475 +155,6 @@ const mockFetchActionsResponse = { }, ], }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10040, - }, - actionState: { - actionStateOne: - '22428816182994066811035979110138663502097287483003215755615557883450156059598', - actionStateTwo: - '13552033292375176242184292341671233419412691991179711376625259275814019808194', - }, - actionData: [ - { - accountUpdateId: '40599', - data: [ - '9', - '2', - '1', - '1', - '2', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40599, 6396, 33066], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10039, - }, - actionState: { - actionStateOne: - '2657110063538905863496230550574434206907731812034404344231638673775478011856', - actionStateTwo: - '22428816182994066811035979110138663502097287483003215755615557883450156059598', - }, - actionData: [ - { - accountUpdateId: '40601', - data: [ - '6', - '5', - '7', - '6', - '7', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40601, 6396, 33066], - }, - }, - { - accountUpdateId: '40602', - data: [ - '4', - '6', - '2', - '2', - '8', - '3', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40602, 6396, 33066], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10037, - }, - actionState: { - actionStateOne: - '11553781833537412187998791170094246504179739906426596650283148421062134031747', - actionStateTwo: - '2657110063538905863496230550574434206907731812034404344231638673775478011856', - }, - actionData: [ - { - accountUpdateId: '40618', - data: [ - '7', - '7', - '7', - '7', - '7', - '7', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40618, 6396, 33066], - }, - }, - { - accountUpdateId: '40617', - data: [ - '3', - '4', - '5', - '7', - '6', - '2', - '6453147199940115032546911372596674482366995380739961315278593325733504245402', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40617, 40372, 40373], - }, - }, - { - accountUpdateId: '40619', - data: [ - '3', - '4', - '5', - '7', - '6', - '3', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40619, 33539, 33540], - }, - }, - { - accountUpdateId: '40620', - data: [ - '3', - '4', - '5', - '7', - '6', - '3', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 7, - zkappAccountUpdateIds: [40620, 33539, 33540], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10036, - }, - actionState: { - actionStateOne: - '5036646800226972634599960587058868707090262022460888863204286405189747942769', - actionStateTwo: - '11553781833537412187998791170094246504179739906426596650283148421062134031747', - }, - actionData: [ - { - accountUpdateId: '40622', - data: [ - '2', - '3', - '4', - '5', - '6', - '7', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40622, 33539, 33540], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10034, - }, - actionState: { - actionStateOne: - '22676822127286113867589765068900374089270892723224396474888670556596794299564', - actionStateTwo: - '5036646800226972634599960587058868707090262022460888863204286405189747942769', - }, - actionData: [ - { - accountUpdateId: '40624', - data: [ - '2', - '3', - '1', - '4', - '8', - '6', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 3, - zkappAccountUpdateIds: [40624, 40372, 40373], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10033, - }, - actionState: { - actionStateOne: - '14450089155455621218882496336231751337940932425300837691009523581147767161552', - actionStateTwo: - '22676822127286113867589765068900374089270892723224396474888670556596794299564', - }, - actionData: [ - { - accountUpdateId: '40626', - data: [ - '7', - '1', - '6', - '9', - '2', - '2', - '12444248802460880132081449291546340439683979052479458915102943284375240795308', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 9, - zkappAccountUpdateIds: [40626, 40372, 40373], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10031, - }, - actionState: { - actionStateOne: - '17343217782575155169164602200877752769390651578694569216079202747806169189400', - actionStateTwo: - '14450089155455621218882496336231751337940932425300837691009523581147767161552', - }, - actionData: [ - { - accountUpdateId: '40629', - data: [ - '1', - '2', - '3', - '4', - '5', - '6', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40629, 33539, 33540], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10014, - }, - actionState: { - actionStateOne: - '4721274078801522986713969462049522847078998862315482276343640953261102256362', - actionStateTwo: - '17343217782575155169164602200877752769390651578694569216079202747806169189400', - }, - actionData: [ - { - accountUpdateId: '40651', - data: [ - '6', - '4', - '3', - '4', - '5', - '8', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 8, - zkappAccountUpdateIds: [40651, 6396, 33066], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 10010, - }, - actionState: { - actionStateOne: - '24590522690942364367249289292250875547314635228745100120965991135101856466170', - actionStateTwo: - '4721274078801522986713969462049522847078998862315482276343640953261102256362', - }, - actionData: [ - { - accountUpdateId: '40657', - data: [ - '2', - '4', - '2', - '9', - '3', - '7', - '15661593045172372274349484602975176160403678593916071611247487060653084577990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 1, - zkappAccountUpdateIds: [40657, 6396, 33066], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9997, - }, - actionState: { - actionStateOne: - '12019972858140051491726046897631768713365384917855031502876641235872835491337', - actionStateTwo: - '24590522690942364367249289292250875547314635228745100120965991135101856466170', - }, - actionData: [ - { - accountUpdateId: '40663', - data: [ - '1', - '3', - '8', - '1', - '1', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '3', - ], - transactionInfo: { - sequenceNumber: 0, - zkappAccountUpdateIds: [40663, 40664, 40665], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9995, - }, - actionState: { - actionStateOne: - '26933479101281889273961421117413591687444559825118348139804588313346830288078', - actionStateTwo: - '12019972858140051491726046897631768713365384917855031502876641235872835491337', - }, - actionData: [ - { - accountUpdateId: '40666', - data: [ - '4', - '7', - '4', - '2', - '7', - '3', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40666, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9993, - }, - actionState: { - actionStateOne: - '23201954681884767758512172994752868073493999252959563785369154647654943505003', - actionStateTwo: - '26933479101281889273961421117413591687444559825118348139804588313346830288078', - }, - actionData: [ - { - accountUpdateId: '40669', - data: [ - '8', - '7', - '6', - '8', - '7', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 0, - zkappAccountUpdateIds: [40669, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9982, - }, - actionState: { - actionStateOne: - '21085262550220603617926377152517886464296676073611212137713290514256181853522', - actionStateTwo: - '23201954681884767758512172994752868073493999252959563785369154647654943505003', - }, - actionData: [ - { - accountUpdateId: '40670', - data: [ - '3', - '7', - '4', - '1', - '3', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 0, - zkappAccountUpdateIds: [40670, 40671, 40672], - }, - }, - { - accountUpdateId: '40673', - data: [ - '2', - '8', - '2', - '4', - '6', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40673, 40671, 40672], - }, - }, - { - accountUpdateId: '40674', - data: [ - '5', - '7', - '1', - '8', - '7', - '4', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40674, 40671, 40672], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9981, - }, - actionState: { - actionStateOne: - '4146388601077199122206031386411652580617016997869931303420910616895941221197', - actionStateTwo: - '21085262550220603617926377152517886464296676073611212137713290514256181853522', - }, - actionData: [ - { - accountUpdateId: '40675', - data: [ - '9', - '4', - '3', - '7', - '4', - '5', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '15', - ], - transactionInfo: { - sequenceNumber: 3, - zkappAccountUpdateIds: [40675, 40671, 40676], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9980, - }, - actionState: { - actionStateOne: - '14718563754416384998379734580498763754546083084109085189673860430296171756381', - actionStateTwo: - '4146388601077199122206031386411652580617016997869931303420910616895941221197', - }, - actionData: [ - { - accountUpdateId: '40677', - data: [ - '9', - '9', - '8', - '1', - '5', - '7', - '16117436006122484987940201799625330705159920592877857277902587370363771532990', - '0', - '11', - ], - transactionInfo: { - sequenceNumber: 2, - zkappAccountUpdateIds: [40677, 40671, 40678], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9854, - }, - actionState: { - actionStateOne: - '22436535202149639941751810143299386980419124467745452646260136710636706430818', - actionStateTwo: - '14718563754416384998379734580498763754546083084109085189673860430296171756381', - }, - actionData: [ - { - accountUpdateId: '40711', - data: [ - '8', - '3', - '2', - '6', - '3', - '2', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 3, - zkappAccountUpdateIds: [40711, 9874, 9875], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9850, - }, - actionState: { - actionStateOne: - '18015734753837148792640655842002233652997206386955938713795916347682406080658', - actionStateTwo: - '22436535202149639941751810143299386980419124467745452646260136710636706430818', - }, - actionData: [ - { - accountUpdateId: '40712', - data: [ - '4', - '2', - '3', - '1', - '6', - '1', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 3, - zkappAccountUpdateIds: [40712, 9874, 9875], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9848, - }, - actionState: { - actionStateOne: - '5989718682878427339698011237393630391441699611966040976806294178468546132857', - actionStateTwo: - '18015734753837148792640655842002233652997206386955938713795916347682406080658', - }, - actionData: [ - { - accountUpdateId: '40715', - data: [ - '7', - '5', - '2', - '2', - '5', - '9', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40715, 37315, 39397], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9847, - }, - actionState: { - actionStateOne: - '11039574756583041422705581318606421503121373204996207587125251343333662996114', - actionStateTwo: - '5989718682878427339698011237393630391441699611966040976806294178468546132857', - }, - actionData: [ - { - accountUpdateId: '40717', - data: [ - '8', - '7', - '9', - '3', - '3', - '7', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40717, 9874, 9875], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9844, - }, - actionState: { - actionStateOne: - '7379144528024958936343424260830686924904206550439278105352113113000234052189', - actionStateTwo: - '11039574756583041422705581318606421503121373204996207587125251343333662996114', - }, - actionData: [ - { - accountUpdateId: '40721', - data: [ - '8', - '2', - '6', - '5', - '7', - '4', - '24840112588285523788042659808059218180295445131298006396932946669691657371564', - '0', - '2', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40721, 9874, 30008], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9843, - }, - actionState: { - actionStateOne: - '24283805577955881676900472334374429071021848694541967135292970635633855656883', - actionStateTwo: - '7379144528024958936343424260830686924904206550439278105352113113000234052189', - }, - actionData: [ - { - accountUpdateId: '40723', - data: [ - '4', - '1', - '6', - '1', - '1', - '6', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '2', - ], - transactionInfo: { - sequenceNumber: 7, - zkappAccountUpdateIds: [40723, 37315, 40724], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9837, - }, - actionState: { - actionStateOne: - '27917968951373205519442101593104886425493701279695265372489725966028374733614', - actionStateTwo: - '24283805577955881676900472334374429071021848694541967135292970635633855656883', - }, - actionData: [ - { - accountUpdateId: '40733', - data: [ - '6', - '4', - '6', - '1', - '2', - '9', - '26471495794066032558155485203329454126509007011869868179564287910271919232646', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40733, 40372, 40373], - }, - }, - { - accountUpdateId: '40734', - data: [ - '1', - '2', - '8', - '9', - '4', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40734, 40664, 40667], - }, - }, - { - accountUpdateId: '40735', - data: [ - '7', - '1', - '4', - '7', - '1', - '8', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40735, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9836, - }, - actionState: { - actionStateOne: - '11937452033494931410595153767448335237459927133492086587705984949580439129039', - actionStateTwo: - '27917968951373205519442101593104886425493701279695265372489725966028374733614', - }, - actionData: [ - { - accountUpdateId: '40737', - data: [ - '8', - '6', - '8', - '2', - '2', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40737, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9835, - }, - actionState: { - actionStateOne: - '306448953181338948703362175977727545535067969675851726758279105861051213348', - actionStateTwo: - '11937452033494931410595153767448335237459927133492086587705984949580439129039', - }, - actionData: [ - { - accountUpdateId: '40743', - data: [ - '2', - '5', - '4', - '8', - '7', - '5', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40743, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9834, - }, - actionState: { - actionStateOne: - '19991151149040056775582798588186971099809360863980267824215220093022078601248', - actionStateTwo: - '306448953181338948703362175977727545535067969675851726758279105861051213348', - }, - actionData: [ - { - accountUpdateId: '40744', - data: [ - '5', - '2', - '8', - '7', - '7', - '5', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40744, 40664, 40667], - }, - }, - { - accountUpdateId: '40745', - data: [ - '2', - '7', - '4', - '2', - '1', - '7', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '2', - ], - transactionInfo: { - sequenceNumber: 5, - zkappAccountUpdateIds: [40745, 40664, 40746], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9833, - }, - actionState: { - actionStateOne: - '18999781809875195137409610136070952042171951557435220711669467625163107442257', - actionStateTwo: - '19991151149040056775582798588186971099809360863980267824215220093022078601248', - }, - actionData: [ - { - accountUpdateId: '40749', - data: [ - '9', - '5', - '2', - '5', - '3', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40749, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9828, - }, - actionState: { - actionStateOne: - '22259450645853554803948670420677142306910404755410865258251921895815255415293', - actionStateTwo: - '18999781809875195137409610136070952042171951557435220711669467625163107442257', - }, - actionData: [ - { - accountUpdateId: '40755', - data: [ - '6', - '6', - '9', - '6', - '6', - '9', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40755, 40664, 40667], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9813, - }, - actionState: { - actionStateOne: - '673392883539533741083833323613664749289537716367396287193620007403227590463', - actionStateTwo: - '22259450645853554803948670420677142306910404755410865258251921895815255415293', - }, - actionData: [ - { - accountUpdateId: '40773', - data: [ - '1', - '2', - '3', - '4', - '5', - '6', - '21594276700301685638451290563121567472719745179788000956082286147863718718533', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40773, 33539, 33540], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9812, - }, - actionState: { - actionStateOne: - '180909818899335552282960593032326010452353832984413053838586392982800816361', - actionStateTwo: - '673392883539533741083833323613664749289537716367396287193620007403227590463', - }, - actionData: [ - { - accountUpdateId: '40775', - data: [ - '7', - '9', - '4', - '9', - '1', - '5', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40775, 40776, 40777], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9811, - }, - actionState: { - actionStateOne: - '538225759583776828838980185916932993423635294076028661477767307668950083971', - actionStateTwo: - '180909818899335552282960593032326010452353832984413053838586392982800816361', - }, - actionData: [ - { - accountUpdateId: '40779', - data: [ - '7', - '9', - '4', - '9', - '1', - '5', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40779, 40776, 40777], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9810, - }, - actionState: { - actionStateOne: - '4210843157566732374188279776068401510341581683721677983374406432934351405013', - actionStateTwo: - '538225759583776828838980185916932993423635294076028661477767307668950083971', - }, - actionData: [ - { - accountUpdateId: '40781', - data: [ - '2', - '2', - '2', - '8', - '8', - '9', - '8131464104783289520687471370575272049926091999122737565948566444191693236634', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 10, - zkappAccountUpdateIds: [40781, 40776, 40777], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9807, - }, - actionState: { - actionStateOne: - '2375606751531955225584659908431366439429720821737589519328970676862230219271', - actionStateTwo: - '4210843157566732374188279776068401510341581683721677983374406432934351405013', - }, - actionData: [ - { - accountUpdateId: '40785', - data: [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40785, 40786, 40787], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9806, - }, - actionState: { - actionStateOne: - '28572180278243802365130664312029280013478342104105268309616763080120835719175', - actionStateTwo: - '2375606751531955225584659908431366439429720821737589519328970676862230219271', - }, - actionData: [ - { - accountUpdateId: '40789', - data: [ - '3', - '8', - '3', - '4', - '6', - '3', - '5184473896111145264519431161346885015530479516304070497804290646708961158413', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40789, 40790, 40791], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9805, - }, - actionState: { - actionStateOne: - '12899116552879177714657258721657037908668833441168563615599253271792804930852', - actionStateTwo: - '28572180278243802365130664312029280013478342104105268309616763080120835719175', - }, - actionData: [ - { - accountUpdateId: '40793', - data: [ - '3', - '8', - '3', - '4', - '6', - '3', - '5184473896111145264519431161346885015530479516304070497804290646708961158413', - '0', - '1', - ], - transactionInfo: { - sequenceNumber: 7, - zkappAccountUpdateIds: [40793, 40790, 40791], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9802, - }, - actionState: { - actionStateOne: - '10375799052052966330950685338047579489788902317193326634260491570085922237258', - actionStateTwo: - '12899116552879177714657258721657037908668833441168563615599253271792804930852', - }, - actionData: [ - { - accountUpdateId: '40797', - data: [ - '1', - '2', - '1', - '5', - '9', - '1', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 12, - zkappAccountUpdateIds: [40797, 40786, 40787], - }, - }, - { - accountUpdateId: '40798', - data: [ - '5', - '3', - '5', - '6', - '4', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 13, - zkappAccountUpdateIds: [40798, 40786, 40787], - }, - }, - { - accountUpdateId: '40799', - data: [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 15, - zkappAccountUpdateIds: [40799, 40786, 40787], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9801, - }, - actionState: { - actionStateOne: - '28196269303668651416346699879165004850139154523393478734820585068142981031732', - actionStateTwo: - '10375799052052966330950685338047579489788902317193326634260491570085922237258', - }, - actionData: [ - { - accountUpdateId: '40801', - data: [ - '6', - '6', - '6', - '6', - '6', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '2', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40801, 40786, 40802], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9794, - }, - actionState: { - actionStateOne: - '6729748500965556777838399631123462458572881535784863605229371522514436976852', - actionStateTwo: - '28196269303668651416346699879165004850139154523393478734820585068142981031732', - }, - actionData: [ - { - accountUpdateId: '40810', - data: [ - '2', - '8', - '2', - '8', - '2', - '8', - '13935000824120239057894068646248236946420165139009401302919178322058796491040', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40810, 40811, 40812], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9793, - }, - actionState: { - actionStateOne: - '14719305835147967404874431642690015496919031381380405675285238602024771385112', - actionStateTwo: - '6729748500965556777838399631123462458572881535784863605229371522514436976852', - }, - actionData: [ - { - accountUpdateId: '40815', - data: [ - '1', - '2', - '5', - '2', - '2', - '5', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 8, - zkappAccountUpdateIds: [40815, 40372, 40373], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9792, - }, - actionState: { - actionStateOne: - '23502921406421697988804387941348397070115790652527000864921063117727632274725', - actionStateTwo: - '14719305835147967404874431642690015496919031381380405675285238602024771385112', - }, - actionData: [ - { - accountUpdateId: '40817', - data: [ - '5', - '7', - '9', - '4', - '1', - '7', - '10329935204614394060743187454419407441282038590465076620570686354885776266705', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 10, - zkappAccountUpdateIds: [40817, 40372, 40373], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9787, - }, - actionState: { - actionStateOne: - '14235722333149067143537863043740008100246151900030018710036040299525674834117', - actionStateTwo: - '23502921406421697988804387941348397070115790652527000864921063117727632274725', - }, - actionData: [ - { - accountUpdateId: '40824', - data: [ - '3', - '1', - '3', - '1', - '3', - '1', - '3358872557945087289287973916777076282977688673157429840747067769412340487925', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 6, - zkappAccountUpdateIds: [40824, 40825, 40826], - }, - }, - ], - }, - { - blockInfo: { - distanceFromMaxBlockHeight: 9775, - }, - actionState: { - actionStateOne: - '3432500319723012006583645985859849032413742507994268064744704124629760504866', - actionStateTwo: - '14235722333149067143537863043740008100246151900030018710036040299525674834117', - }, - actionData: [ - { - accountUpdateId: '40850', - data: [ - '9', - '8', - '5', - '3', - '2', - '7', - '5706376253943510402705579272467768662733130021399469094173930489992680696927', - '1', - '1', - ], - transactionInfo: { - sequenceNumber: 4, - zkappAccountUpdateIds: [40850, 40664, 40667], - }, - }, - ], - }, ], }, }; From b2fc1113d6c48d0a192af210d1783d595864a932 Mon Sep 17 00:00:00 2001 From: Coby Date: Wed, 8 Jan 2025 16:51:31 -0500 Subject: [PATCH 6/9] add PR to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fef29ec4d..b38c7c96a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased](https://github.com/o1-labs/o1js/compare/b857516...HEAD) ### Changed -- Sort order for actions now includes the transaction sequence number and the exact account id sequence +- Sort order for actions now includes the transaction sequence number and the exact account id sequence https://github.com/o1-labs/o1js/pull/1917 ## [2.2.0](https://github.com/o1-labs/o1js/compare/e1bac02...b857516) - 2024-12-10 From 05af3614312e65af112a45ab21222db21e4d3d60 Mon Sep 17 00:00:00 2001 From: Coby Date: Thu, 9 Jan 2025 15:05:02 -0500 Subject: [PATCH 7/9] update param name --- src/lib/mina/fetch.ts | 2 +- src/lib/mina/graphql.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index f9e5613b1f..cd12f64edf 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -740,7 +740,7 @@ async function fetchActions( actionStates, tokenId, /* _filterOptions= */ undefined, - /* retryWithoutTxInfo= */ true + /* _excludeTransactionInfo= */ true ), graphqlEndpoint, networkConfig.archiveFallbackEndpoints diff --git a/src/lib/mina/graphql.ts b/src/lib/mina/graphql.ts index df574d7420..0dfb34e637 100644 --- a/src/lib/mina/graphql.ts +++ b/src/lib/mina/graphql.ts @@ -322,7 +322,10 @@ const getActionsQuery = ( actionStates: ActionStatesStringified, tokenId: string, _filterOptions?: EventActionFilterOptions, - retryWithoutTxInfo: boolean = false + // As of 2025-01-07 minascan is running a version of the node API which supports `sequenceNumber` and `zkappAccountUpdateIds` fields + // In case a user tries to access an older API version, we support making the query without these fields, but can't guarantee action ordering + // Transaction sequence info is required to be 100% certain of action order + _excludeTransactionInfo: boolean = false ) => { const { fromActionState, endActionState } = actionStates ?? {}; let input = `address: "${publicKey}", tokenId: "${tokenId}"`; @@ -345,7 +348,7 @@ const getActionsQuery = ( accountUpdateId data ${ - retryWithoutTxInfo + _excludeTransactionInfo ? '' : 'transactionInfo { sequenceNumber zkappAccountUpdateIds }' } From 67d9570047ca5f25adc193e46c4378ab4c082ba2 Mon Sep 17 00:00:00 2001 From: Coby Date: Thu, 9 Jan 2025 15:11:16 -0500 Subject: [PATCH 8/9] Update src/lib/mina/fetch.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Boray Saygılıer --- src/lib/mina/fetch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index cd12f64edf..c78a99b7b4 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -702,8 +702,8 @@ async function fetchEvents( * * @example * const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' }; - * const acitonsList = await fetchAccount(accountInfo); - * console.log(acitonsList); + * const actionsList = await fetchAccount(accountInfo); + * console.log(actionsList); */ async function fetchActions( accountInfo: ActionsQueryInputs, From 5ef0bdc01f3d2701ee56040e89f0a111f971da4d Mon Sep 17 00:00:00 2001 From: Coby Date: Thu, 9 Jan 2025 15:12:51 -0500 Subject: [PATCH 9/9] update doc comments --- src/lib/mina/fetch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/mina/fetch.ts b/src/lib/mina/fetch.ts index c78a99b7b4..f2269001f8 100644 --- a/src/lib/mina/fetch.ts +++ b/src/lib/mina/fetch.ts @@ -641,9 +641,11 @@ function sendZkapp( * @returns A promise that resolves to an array of objects containing event data, block information and transaction information for the account. * @throws If the GraphQL request fails or the response is invalid. * @example + * ```ts * const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' }; * const events = await fetchEvents(accountInfo); * console.log(events); + * ``` */ async function fetchEvents( accountInfo: { publicKey: string; tokenId?: string }, @@ -701,9 +703,11 @@ async function fetchEvents( * @throws Will throw an error if the GraphQL endpoint is invalid or if the fetch request fails. * * @example + * ```ts * const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' }; * const actionsList = await fetchAccount(accountInfo); * console.log(actionsList); + * ``` */ async function fetchActions( accountInfo: ActionsQueryInputs,