@@ -8,6 +8,24 @@ import { AppSelectors } from '@app/app.state';
88import  {  AppActions  }  from  '@app/app.actions' ; 
99import  {  Observable ,  timer  }  from  'rxjs' ; 
1010import  {  CONFIG  }  from  '@shared/constants/config' ; 
11+ // import { AccountUpdate, declareMethods, Field, method, Mina, PrivateKey, SmartContract, State, state } from 'o1js'; 
12+ 
13+ // export class Square extends SmartContract { 
14+ //   @state (Field) num = State<Field>(); 
15+ // 
16+ //   override init() { 
17+ //     super.init(); 
18+ //     this.num.set(Field(3)); 
19+ //   } 
20+ // 
21+ //   // @method  
22+ //   async update(square: Field) { 
23+ //     const currentState = this.num.get(); 
24+ //     this.num.requireEquals(currentState); 
25+ //     square.assertEquals(currentState.mul(currentState)); 
26+ //     this.num.set(square); 
27+ //   } 
28+ // } 
1129
1230@Component ( { 
1331  selector : 'app-root' , 
@@ -36,8 +54,80 @@ export class AppComponent extends ManualDetection implements OnInit {
3654      this . scheduleNodeUpdates ( ) ; 
3755    } 
3856    this . listenToWindowResizing ( ) ; 
57+     // console.log('Start'); 
58+     // this.startZK(); 
59+     // console.log('Finish!'); 
3960  } 
4061
62+ 
63+ //   async startZK() { 
64+ //     //@ts -ignore 
65+ //     declareMethods(Square, { update: [Field] }); 
66+ // 
67+ //     const useProof = false; 
68+ // 
69+ //     const Local = await Mina.LocalBlockchain({ proofsEnabled: useProof }); 
70+ //     Mina.setActiveInstance(Local); 
71+ // 
72+ //     const deployerAccount = Local.testAccounts[0]; 
73+ //     const deployerKey = deployerAccount.key; 
74+ //     const senderAccount = Local.testAccounts[1]; 
75+ //     const senderKey = senderAccount.key; 
76+ // // ---------------------------------------------------- 
77+ // 
78+ // // Create a public/private key pair. The public key is your address and where you deploy the zkApp to 
79+ //     const zkAppPrivateKey = PrivateKey.random(); 
80+ //     const zkAppAddress = zkAppPrivateKey.toPublicKey(); 
81+ // 
82+ // // create an instance of Square - and deploy it to zkAppAddress 
83+ //     const zkAppInstance = new Square(zkAppAddress); 
84+ //     const deployTxn = await Mina.transaction(deployerAccount, async () => { 
85+ //       AccountUpdate.fundNewAccount(deployerAccount); 
86+ //       await zkAppInstance.deploy(); 
87+ //     }); 
88+ //     await deployTxn.sign([deployerKey, zkAppPrivateKey]).send(); 
89+ // 
90+ // // get the initial state of Square after deployment 
91+ //     const num0 = zkAppInstance.num.get(); 
92+ //     console.log('state after init:', num0.toString()); 
93+ // 
94+ // // ---------------------------------------------------- 
95+ // 
96+ //     const txn1 = await Mina.transaction(senderAccount, async () => { 
97+ //       await zkAppInstance.update(Field(9)); 
98+ //     }); 
99+ //     await txn1.prove(); 
100+ //     await txn1.sign([senderKey]).send(); 
101+ // 
102+ //     const num1 = zkAppInstance.num.get(); 
103+ //     console.log('state after txn1:', num1.toString()); 
104+ // 
105+ // // ---------------------------------------------------- 
106+ // 
107+ //     try { 
108+ //       const txn2 = await Mina.transaction(senderAccount, async () => { 
109+ //         await zkAppInstance.update(Field(75)); 
110+ //       }); 
111+ //       await txn2.prove(); 
112+ //       await txn2.sign([senderKey]).send(); 
113+ //     } catch (error: any) { 
114+ //       console.log(error.message); 
115+ //     } 
116+ //     const num2 = zkAppInstance.num.get(); 
117+ //     console.log('state after txn2:', num2.toString()); 
118+ // 
119+ // // ---------------------------------------------------- 
120+ // 
121+ //     const txn3 = await Mina.transaction(senderAccount, async () => { 
122+ //       await zkAppInstance.update(Field(81)); 
123+ //     }); 
124+ //     await txn3.prove(); 
125+ //     await txn3.sign([senderKey]).send(); 
126+ // 
127+ //     const num3 = zkAppInstance.num.get(); 
128+ //     console.log('state after txn3:', num3.toString()); 
129+ //   } 
130+ 
41131  private  scheduleNodeUpdates ( ) : void   { 
42132    timer ( 1000 ,  5000 ) . subscribe ( ( )  =>  this . store . dispatch ( AppActions . getNodeDetails ( ) ) ) ; 
43133  } 
0 commit comments