Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update snarkyjs & deploy #207

Merged
merged 5 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zkapp-cli",
"version": "0.3.6",
"version": "0.3.7",
"description": "CLI to create a zkApp (\"zero-knowledge app\") for Mina Protocol.",
"keywords": [
"cli",
Expand Down Expand Up @@ -45,7 +45,7 @@
"mina-signer": "^1.1.0",
"ora": "^5.4.1",
"shelljs": "^0.8.5",
"snarkyjs": "^0.3.3",
"snarkyjs": "^0.4.1",
"table": "^6.8.0",
"yargs": "^17.5.1"
},
Expand Down
12 changes: 6 additions & 6 deletions src/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ async function deploy({ network, yes }) {
}

// import snarkyjs from the user directory
let { isReady, shutdown, PrivateKey, addCachedAccount, Mina } = await import(
`${DIR}/node_modules/snarkyjs/dist/server/index.mjs`
);
let { isReady, shutdown, PrivateKey, addCachedAccount, Mina, Party } =
await import(`${DIR}/node_modules/snarkyjs/dist/server/index.mjs`);

const graphQLEndpoint = config?.networks[network]?.url ?? DEFAULT_GRAPHQL;
const { data: nodeStatus } = await sendGraphQL(
Expand Down Expand Up @@ -288,8 +287,8 @@ async function deploy({ network, yes }) {
let zkapp = new zkApp(zkAppAddress);
zkapp.deploy({ verificationKey, zkappKey: zkAppPrivateKey });
// hack: manually increment nonce
let nonce = zkapp.self.body.accountPrecondition.nonce.lower.add(1);
zkapp.self.body.accountPrecondition.nonce.assertBetween(nonce, nonce);
let nonce = zkapp.self.body.preconditions.account.nonce.lower.add(1);
Party.assertEquals(zkapp.self.body.preconditions.account.nonce, nonce);
}
);
return tx.sign().toJSON();
Expand Down Expand Up @@ -506,7 +505,8 @@ function getAccountQuery(publicKey) {

function getErrorMessage(errors) {
let errorMessage =
' Failed to send transaction to relayer. Please try again.';
' Failed to send transaction to relayer. Errors: ' +
errors.map((e) => e.message);
for (const error of errors) {
if (error.message.includes('Invalid_nonce')) {
errorMessage = ` Failed to send transaction to the relayer. An invalid account nonce was specified. Please try again.`;
Expand Down
28 changes: 14 additions & 14 deletions templates/project-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions templates/project-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
"dependencies": {
"snarkyjs": "^0.3.3"
"snarkyjs": "^0.4.1"
},
"devDependencies": {
"@babel/preset-env": "^7.16.4",
Expand All @@ -44,6 +44,6 @@
"lint-staged": "^11.0.1",
"prettier": "^2.3.2",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
"typescript": "^4.7.2"
}
}