Skip to content

Commit 3bd1c15

Browse files
authored
Defined deploy script for contract, updated o1js (#45)
1 parent b1c91e3 commit 3bd1c15

File tree

8 files changed

+33
-48
lines changed

8 files changed

+33
-48
lines changed

.github/workflows/deploy-npm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ jobs:
2323
env:
2424
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2525
- run: mv ./README.md ./zk-states/
26+
- run: cd zk-states-contracts && yarn npm publish --access public --tolerate-republish
2627
- run: cd zk-states && yarn npm publish --access public --tolerate-republish

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7427,9 +7427,9 @@ __metadata:
74277427
languageName: node
74287428
linkType: hard
74297429

7430-
"o1js@npm:^0.12.1":
7431-
version: 0.12.1
7432-
resolution: "o1js@npm:0.12.1"
7430+
"o1js@npm:^0.13.0":
7431+
version: 0.13.0
7432+
resolution: "o1js@npm:0.13.0"
74337433
dependencies:
74347434
blakejs: 1.2.1
74357435
detect-gpu: ^5.0.5
@@ -7439,7 +7439,7 @@ __metadata:
74397439
tslib: ^2.3.0
74407440
bin:
74417441
snarky-run: src/build/run.js
7442-
checksum: 50b21fa4a69490ca2018f850a17336a71cf4c6e2bd1607acf3f24394ca86e22065c68c6bf323ecd3fb7adabcc8c258b7be78db5b6ccf1ba60ea7b104a3a90098
7442+
checksum: d5b0f81702fa32d986c77aa3e4d2ed1146d1e32dd9f274d85a921a3401aae497a6d315e9b685e790fa2dc98fb7519f37d1ef3d1269ac76c217e65e54a75d8f2d
74437443
languageName: node
74447444
linkType: hard
74457445

@@ -9856,13 +9856,13 @@ __metadata:
98569856
husky: ^7.0.1
98579857
jest: ^27.3.1
98589858
lint-staged: ^11.0.1
9859-
o1js: ^0.12.1
9859+
o1js: ^0.13.0
98609860
prettier: ^2.3.2
98619861
ts-jest: ^27.0.7
98629862
typescript: ^4.7.2
98639863
zod: ^3.22.2
98649864
peerDependencies:
9865-
o1js: 0.12.*
9865+
o1js: 0.13.*
98669866
languageName: unknown
98679867
linkType: soft
98689868

@@ -9913,7 +9913,7 @@ __metadata:
99139913
eslint-plugin-react-hooks: ^4.6.0
99149914
eslint-plugin-vitest: ^0.2.8
99159915
jsdom: ^22.1.0
9916-
o1js: ^0.12.1
9916+
o1js: ^0.13.0
99179917
prettier: ^3.0.0
99189918
react: ^18.2.0
99199919
react-dom: ^18.2.0
@@ -9931,7 +9931,7 @@ __metadata:
99319931
zod: ^3.21.4
99329932
zustand: ^4.3.9
99339933
peerDependencies:
9934-
o1js: ">=0.12.1"
9934+
o1js: ">=0.13.0"
99359935
react: ">=18.0.0"
99369936
react-dom: ">=18.0.0"
99379937
zustand: ">=4.3.9"

zk-states-contracts/README.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
11
# Mina zkApp: Zk States Contract
22

3-
This template uses TypeScript.
4-
5-
## How to build
6-
7-
```sh
8-
npm run build
9-
```
10-
11-
## How to run tests
12-
13-
```sh
14-
npm run test
15-
npm run testw # watch mode
16-
```
17-
18-
## How to run coverage
19-
20-
```sh
21-
npm run coverage
22-
```
23-
24-
## License
25-
26-
[Apache-2.0](LICENSE)
3+
Mina contract and program for [zk-states](https://www.npmjs.com/package/zk-states) library.

zk-states-contracts/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "zk-states-contracts",
3-
"version": "0.0.0",
3+
"version": "0.0.2",
44
"author": "Marius Sili (https://github.com/silimarius)",
5-
"private": true,
5+
"description": "Mina program and contract for zk-states library",
66
"keywords": [
77
"mina-zkapp",
88
"mina-zk-app",
@@ -12,6 +12,10 @@
1212
"type": "module",
1313
"main": "build/src/index.js",
1414
"types": "build/src/index.d.ts",
15+
"files": [
16+
"build/**/*"
17+
],
18+
"license": "MIT",
1519
"scripts": {
1620
"clean": "rm -rf build/",
1721
"build": "tsc",
@@ -42,13 +46,13 @@
4246
"husky": "^7.0.1",
4347
"jest": "^27.3.1",
4448
"lint-staged": "^11.0.1",
45-
"o1js": "^0.12.1",
49+
"o1js": "^0.13.0",
4650
"prettier": "^2.3.2",
4751
"ts-jest": "^27.0.7",
4852
"typescript": "^4.7.2",
4953
"zod": "^3.22.2"
5054
},
5155
"peerDependencies": {
52-
"o1js": "0.12.*"
56+
"o1js": "0.13.*"
5357
}
5458
}

zk-states/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zk-states",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"license": "MIT",
55
"description": "Verifiable state manager for React based on o1js & Mina protocol",
66
"typesVersions": {
@@ -75,7 +75,7 @@
7575
"eslint-plugin-react-hooks": "^4.6.0",
7676
"eslint-plugin-vitest": "^0.2.8",
7777
"jsdom": "^22.1.0",
78-
"o1js": "^0.12.1",
78+
"o1js": "^0.13.0",
7979
"prettier": "^3.0.0",
8080
"react": "^18.2.0",
8181
"react-dom": "^18.2.0",
@@ -91,7 +91,7 @@
9191
"zustand": "^4.3.9"
9292
},
9393
"peerDependencies": {
94-
"o1js": ">=0.12.1",
94+
"o1js": ">=0.13.0",
9595
"react": ">=18.0.0",
9696
"react-dom": ">=18.0.0",
9797
"zustand": ">=4.3.9"

zk-states/src/hooks.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const createZKState = <T extends object>(
3434
workerClient: ZkAppWorkerClient,
3535
createState: StateCreator<T, [], []>,
3636
networkName: MinaNetwork = "berkeley",
37-
appPublicKeyBase58 = "B62qrquKapqyBXxtEBGQTUKLzHeD7xJnxG1qro83HjXhFj7rBiLTuXD",
37+
appPublicKeyBase58 = "B62qnQqrPW5Cx71WavaPjUfUzdx1eEgfnFXEqeQV9m8DKJn3bUW4BF8",
3838
) => {
3939
const useZKStore = create<T & { rollback: (oldState: T) => void }>(
4040
zkImpl(
@@ -93,7 +93,14 @@ export const createZKState = <T extends object>(
9393

9494
const proof = await workerClient.init(
9595
{ appPublicKey58: appPublicKeyBase58 },
96-
() => {},
96+
(event) => {
97+
switch (event.updateType) {
98+
case "initializationProgress": {
99+
setInitializationProgress(event.status);
100+
break;
101+
}
102+
}
103+
},
97104
(payload) => {
98105
switch (payload.updateType) {
99106
case "latestProof": {
@@ -121,10 +128,6 @@ export const createZKState = <T extends object>(
121128
setProofFailed(false);
122129
break;
123130
}
124-
case "initializationProgress": {
125-
setInitializationProgress(workerRes.status);
126-
break;
127-
}
128131
}
129132
},
130133
);

zk-states/src/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ interface InititializationProgressUpdate {
129129
}
130130

131131
export type UIUpdate =
132-
| InititializationProgressUpdate
133132
| LatestProofUpdate
134133
| UpdateQueueUpdate
135134
| IsProvingUpdate
@@ -140,7 +139,9 @@ interface WorkerErrorUpdate {
140139
updateType: "workerError";
141140
}
142141

143-
export type WorkerStateUpdate = WorkerErrorUpdate;
142+
export type WorkerStateUpdate =
143+
| WorkerErrorUpdate
144+
| InititializationProgressUpdate;
144145

145146
export interface TxRes {
146147
transaction: string;

zk-states/src/zkAppWorker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
fetchAccountArgsSchema,
1111
initArgsSchema,
1212
setMinaNetworkArgsSchema,
13-
InitializationProgress,
1413
} from "./types";
1514
import { logger } from "./utils";
1615

0 commit comments

Comments
 (0)