Skip to content

Commit

Permalink
deprecate CustomScalar and small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phn210 committed Sep 30, 2024
1 parent 7475c87 commit 58684c3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 19 deletions.
48 changes: 34 additions & 14 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
Expand Up @@ -57,9 +57,9 @@
"lint-staged": "^11.0.1",
"prettier": "^2.3.2",
"ts-jest": "^28.0.8",
"typescript": "^5.1"
"typescript": "^5.4"
},
"dependencies": {
"o1js": "1.3.1"
"o1js": "1.8.0"
}
}
3 changes: 3 additions & 0 deletions src/CustomScalar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Bool, Field, Poseidon, Scalar, Struct, UInt64 } from 'o1js';
import { fromUInt64ToScalar } from './utils/math.js';

/**
* @deprecated This class is deprecated. Use Scalar instead.
*/
export class CustomScalar extends Struct({
scalar: Scalar,
}) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Network', () => {

@method
async testWithSender(value1: Field, value2: Field) {
this.sender.getAndRequireSignature();
this.sender.getAndRequireSignatureV2();
value1.assertEquals(value2);
this.num.set(value1);
this.reducer.dispatch(value1);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/zkApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ function requireCaller(address: PublicKey, contract: SmartContract) {
return update;
}

function checkCondition(condition: Bool, message: string) {
function checkCondition(condition: Bool, message?: string) {
Provable.witness(Void, () => {
if (!condition.toBoolean()) {
console.error(message);
console.error(message || 'Unknown error!');
}
});
return condition;
Expand Down

0 comments on commit 58684c3

Please sign in to comment.