-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5be4393
commit 21643f2
Showing
40 changed files
with
5,945 additions
and
8,864 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ tests | |
benchmark/*.js | ||
*/resolvers-types.ts | ||
codegen.ts | ||
/zkapp | ||
/benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ coverage/**/* | |
|
||
# Ignore benchmark results | ||
benchmark/*.json | ||
benchmark/*.csv |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Lightnet, PrivateKey } from 'o1js'; | ||
import { dirname, join } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { writeFileSync } from 'node:fs'; | ||
import { | ||
setNetworkConfig, | ||
fetchAccountInfo, | ||
deployContract, | ||
updateContractState, | ||
emitSingleEvent, | ||
emitMultipleFieldsEvent, | ||
emitAction, | ||
reduceAction, | ||
} from '../zkapp/utils.js'; | ||
|
||
(async () => { | ||
setNetworkConfig(); | ||
|
||
const zkAppKey = PrivateKey.random(); | ||
const zkAppKeypair = { | ||
privateKey: zkAppKey, | ||
publicKey: zkAppKey.toPublicKey(), | ||
}; | ||
|
||
const senderKeypair = await Lightnet.acquireKeyPair(); | ||
|
||
await fetchAccountInfo(senderKeypair.publicKey); | ||
|
||
const zkApp = await deployContract(zkAppKeypair, senderKeypair); | ||
|
||
await updateContractState(zkApp, senderKeypair); | ||
|
||
await emitSingleEvent(zkApp, senderKeypair); | ||
|
||
await emitMultipleFieldsEvent(zkApp, senderKeypair); | ||
|
||
await emitAction(zkApp, senderKeypair); | ||
|
||
await reduceAction(zkApp, senderKeypair); | ||
|
||
await emitAction(zkApp, senderKeypair, { numberOfEmits: 3 }); | ||
|
||
await reduceAction(zkApp, senderKeypair); | ||
|
||
const keyPairReleaseMessage = await Lightnet.releaseKeyPair({ | ||
publicKey: senderKeypair.publicKey.toBase58(), | ||
}); | ||
|
||
if (keyPairReleaseMessage) console.info(keyPairReleaseMessage); | ||
|
||
const filePath = join(dirname(fileURLToPath(import.meta.url)), 'zkapp.csv'); | ||
writeFileSync(filePath, `address\n${zkAppKeypair.publicKey.toBase58()}\n`); | ||
console.log(`Public key of zkApp keypair written into ${filePath}`); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"watch": ["src"], | ||
"ext": "ts", | ||
"execMap": { | ||
"ts": "node --loader ts-node/esm" | ||
} | ||
} |
Oops, something went wrong.