// import { Field, PublicKey } from 'o1js';
// import { BuyTicketEvent, PLottery } from '../src/PLottery.js';
// import { configDefaultInstance } from './utils.js';
// import { LotteryAction } from '../src/Proofs/TicketReduceProof.js';

import { Field } from 'o1js';
import { LotteryAction } from '../src/Proofs/TicketReduceProof.js';
import { MerkleMap20 } from '../src/Structs/CustomMerkleMap.js';

// const response = {
//   data: {
//     actions: [
//       {
//         actionState: {
//           actionStateOne:
//             '25313349900211893975382608876719408889698704200031209664249044279080109975560',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '21763299541040298587753333338371893846810690469232963591372060459026381039252',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '8628496078274769461115542000844796878294462781470938159543797714990992667559',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '5514469181095466736859934799926525380889572026984429413409318992237299997028',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '25885889073951718527354395363806199815487911681101764913596881578771086370107',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '3084111396668553871010196373800365499745037262843862158729989883860675348483',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '13532287841471317150184319478504392572847735859185693513218934441300016387637',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '12636308717155378495657553296284990333618148856424346334743675423201692801125',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '13552033292375176242184292341671233419412691991179711376625259275814019808194',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '22428816182994066811035979110138663502097287483003215755615557883450156059598',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '2657110063538905863496230550574434206907731812034404344231638673775478011856',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '11553781833537412187998791170094246504179739906426596650283148421062134031747',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '5036646800226972634599960587058868707090262022460888863204286405189747942769',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '22676822127286113867589765068900374089270892723224396474888670556596794299564',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '14450089155455621218882496336231751337940932425300837691009523581147767161552',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '17343217782575155169164602200877752769390651578694569216079202747806169189400',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '4721274078801522986713969462049522847078998862315482276343640953261102256362',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '24590522690942364367249289292250875547314635228745100120965991135101856466170',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '12019972858140051491726046897631768713365384917855031502876641235872835491337',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '26933479101281889273961421117413591687444559825118348139804588313346830288078',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '23201954681884767758512172994752868073493999252959563785369154647654943505003',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '21085262550220603617926377152517886464296676073611212137713290514256181853522',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '4146388601077199122206031386411652580617016997869931303420910616895941221197',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '14718563754416384998379734580498763754546083084109085189673860430296171756381',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '22436535202149639941751810143299386980419124467745452646260136710636706430818',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '18015734753837148792640655842002233652997206386955938713795916347682406080658',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '5989718682878427339698011237393630391441699611966040976806294178468546132857',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '11039574756583041422705581318606421503121373204996207587125251343333662996114',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '7379144528024958936343424260830686924904206550439278105352113113000234052189',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '24283805577955881676900472334374429071021848694541967135292970635633855656883',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '27917968951373205519442101593104886425493701279695265372489725966028374733614',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '11937452033494931410595153767448335237459927133492086587705984949580439129039',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '306448953181338948703362175977727545535067969675851726758279105861051213348',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '19991151149040056775582798588186971099809360863980267824215220093022078601248',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '18999781809875195137409610136070952042171951557435220711669467625163107442257',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '22259450645853554803948670420677142306910404755410865258251921895815255415293',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '673392883539533741083833323613664749289537716367396287193620007403227590463',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '180909818899335552282960593032326010452353832984413053838586392982800816361',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '538225759583776828838980185916932993423635294076028661477767307668950083971',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '4210843157566732374188279776068401510341581683721677983374406432934351405013',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '2375606751531955225584659908431366439429720821737589519328970676862230219271',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '28572180278243802365130664312029280013478342104105268309616763080120835719175',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '12899116552879177714657258721657037908668833441168563615599253271792804930852',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '10375799052052966330950685338047579489788902317193326634260491570085922237258',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '28196269303668651416346699879165004850139154523393478734820585068142981031732',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '6729748500965556777838399631123462458572881535784863605229371522514436976852',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '14719305835147967404874431642690015496919031381380405675285238602024771385112',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '23502921406421697988804387941348397070115790652527000864921063117727632274725',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '14235722333149067143537863043740008100246151900030018710036040299525674834117',
//         },
//       },
//       {
//         actionState: {
//           actionStateOne:
//             '3432500319723012006583645985859849032413742507994268064744704124629760504866',
//         },
//       },
//     ],
//   },
// };

// const actionStates = response.data.actions.map(
//   (action) => action.actionState.actionStateOne
// );

// const { transactionFee } = configDefaultInstance();

// const plotteryAddress = PublicKey.fromBase58(
//   'B62qrHzs8Sn6rJW3Jkd8xvUkPKb4RBC4xsTgKnBd7KvVWnjhkXV7YKJ'
// );
// let plottery = new PLottery(plotteryAddress);

// // let actions = [];

// // for (let i = 0; i < actionStates.length - 1; i++) {
// //   const fromActionState = Field.from(actionStates[i]);
// //   const endActionState = Field.from(actionStates[i + 1]);

// //   actions.push(
// //     await plottery.reducer.fetchActions({
// //       fromActionState,
// //       endActionState,
// //     })
// //   );

// //   console.log(actions[i]);

// //   console.log(actions.flat(1));
// // }

// // let actions = await plottery.reducer.fetchActions({
// //   endActionState: Field.from(
// //     '2274732647015854546500491500649598388489089745635220719829682203109227374236'
// //   ),
// // });

// let actionsFucked = await plottery.reducer.fetchActions({
//   fromActionState: Field.from(
//     '2657110063538905863496230550574434206907731812034404344231638673775478011856'
//   ),
//   endActionState: Field.from(
//     '11553781833537412187998791170094246504179739906426596650283148421062134031747'
//   ),
// });

// let actions1 = await plottery.reducer.fetchActions({
//   endActionState: Field.from(
//     '2657110063538905863496230550574434206907731812034404344231638673775478011856'
//   ),
// });

// console.log(actions1);

// let actions2 = await plottery.reducer.fetchActions({
//   fromActionState: Field.from(
//     '11553781833537412187998791170094246504179739906426596650283148421062134031747'
//   ),
// });

// const actions = [...actions1, ...actions2];

// console.log(actions);
// console.log(actions.length);
// console.log(actionStates.length);

// const allEvents = await plottery.fetchEvents();

// console.log(allEvents.filter((event) => event.type === 'buy-ticket'));

// const actionLists = allEvents
//   .filter((event) => event.type === 'buy-ticket')
//   // @ts-ignore
//   .map((event) => event.event.data as BuyTicketEvent)
//   .map((ticketEvent) => [
//     new LotteryAction({
//       ticket: ticketEvent.ticket,
//     }),
//   ]);

// console.log(actionLists.length);

// console.log(actionLists.map((elem) => elem[0].ticket.numbers.map((v) => +v)));

const actionData = [
  {
    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',
  },
];
let ac = actionData
  .map((elem) =>
    elem.actions.map((actions) =>
      LotteryAction.fromFields(actions.map((v) => Field(v)))
    )
  )
  .flat(1);

console.log(ac);

console.log(ac.map((elem) => elem.ticket.numbers.map((v) => +v).join(',')));

let curMap = new MerkleMap20();

for (let i = 0; i < ac.length; i++) {
  console.log(`Root before: ${curMap.getRoot().toString()}`);
  curMap.set(Field(i), ac[i].ticket.hash());
}

console.log(`Final root: ${curMap.getRoot().toString()}`);
