Skip to content

Commit

Permalink
Merge pull request #894 from o1-labs/feature/remove-depricated-apis
Browse files Browse the repository at this point in the history
Remove deprecated APIs from all code, tutorials, and code snippets
  • Loading branch information
ymekuria authored Apr 11, 2024
2 parents 05ee54b + ee34718 commit b5f6de6
Show file tree
Hide file tree
Showing 47 changed files with 248 additions and 16,340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ export class OffChainStorageTestContract extends SmartContract {
storedNewRootSignature: Signature
) {
let root = this.root.get();
this.root.assertEquals(root);
this.root.requireEquals(root);

let rootNumber = this.rootNumber.get();
this.rootNumber.assertEquals(rootNumber);
this.rootNumber.requireEquals(rootNumber);

let serverPublicKey = this.serverPublicKey.get();
this.serverPublicKey.assertEquals(serverPublicKey);
this.serverPublicKey.requireEquals(serverPublicKey);

let leaf = [oldNum];
let newLeaf = [num];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const SERVER_ADDRESS = 'http://localhost:3001';
{ sender: deployerAccount.publicKey, fee: TRANSACTION_FEE },
async () => {
AccountUpdate.fundNewAccount(deployerAccount.publicKey);
await zkAppInstance.deploy({ zkappKey: zkAppAccount.privateKey });
await zkAppInstance.deploy();
}
);
deploy_txn.sign([deployerAccount.privateKey, zkAppAccount.privateKey]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ export class NumberTreeContract extends SmartContract {
@state(Field) storageNumber = State<Field>();
@state(Field) storageTreeRoot = State<Field>();

deploy(args: DeployArgs) {
super.deploy(args);
this.account.permissions.set({
...Permissions.default(),
editState: Permissions.proofOrSignature(),
});
}

@method async initState(storageServerPublicKey: PublicKey) {
this.storageServerPublicKey.set(storageServerPublicKey);
this.storageNumber.set(Field(0));
Expand All @@ -46,14 +38,10 @@ export class NumberTreeContract extends SmartContract {
storedNewRootNumber: Field,
storedNewRootSignature: Signature
) {
const storedRoot = this.storageTreeRoot.get();
this.storageTreeRoot.assertEquals(storedRoot);

let storedNumber = this.storageNumber.get();
this.storageNumber.assertEquals(storedNumber);

let storageServerPublicKey = this.storageServerPublicKey.get();
this.storageServerPublicKey.assertEquals(storageServerPublicKey);
const storedRoot = this.storageTreeRoot.getAndRequireEquals();
let storedNumber = this.storageNumber.getAndRequireEquals();
let storageServerPublicKey =
this.storageServerPublicKey.getAndRequireEquals();

let leaf = [oldNum];
let newLeaf = [num];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ export class SignedMessageBoard extends SmartContract {
@state(Field) storageNumber = State<Field>();
@state(Field) storageTreeRoot = State<Field>();

deploy(args: DeployArgs) {
super.deploy(args);
this.account.permissions.set({
...Permissions.default(),
editState: Permissions.proofOrSignature(),
});
}

@method async initState(storageServerPublicKey: PublicKey) {
this.storageServerPublicKey.set(storageServerPublicKey);
this.storageNumber.set(Field(0));
Expand All @@ -51,14 +43,12 @@ export class SignedMessageBoard extends SmartContract {
storedNewStorageNumber: Field,
storedNewStorageSignature: Signature
) {
const storedRoot = this.storageTreeRoot.get();
this.storageTreeRoot.assertEquals(storedRoot);
const storedRoot = this.storageTreeRoot.getAndRequireEquals();

let storedNumber = this.storageNumber.get();
this.storageNumber.assertEquals(storedNumber);
let storedNumber = this.storageNumber.getAndRequireEquals();

let storageServerPublicKey = this.storageServerPublicKey.get();
this.storageServerPublicKey.assertEquals(storageServerPublicKey);
let storageServerPublicKey =
this.storageServerPublicKey.getAndRequireEquals();

const leaf = priorLeafSigner
.toGroup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if (useLocal) {
feePayerKey.toPublicKey(),
async () => {
AccountUpdate.fundNewAccount(feePayerKey.toPublicKey());
await zkapp.deploy({ zkappKey: zkappPrivateKey });
await zkapp.deploy();
await zkapp.initState(serverPublicKey);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function main() {

const transaction = await Mina.transaction(feePayerPublicKey, async () => {
AccountUpdate.fundNewAccount(feePayerPublicKey);
await zkapp.deploy({ zkappKey: zkappPrivateKey });
await zkapp.deploy();
await zkapp.initState(serverPublicKey);
});
transaction.sign([feePayerKey, zkappPrivateKey]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const makeAndSendTransaction = async <State extends ToString>({
await fetchAccount({ publicKey: feePayerPrivateKey.toPublicKey() });

let transaction = await Mina.transaction(
{ feePayerKey: feePayerPrivateKey, fee: transactionFee },
{ sender: feePayerPrivateKey.toPublicKey(), fee: transactionFee },
async () => {
await mutateZkApp();
}
Expand Down
1 change: 0 additions & 1 deletion examples/zkapps/07-oracles/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@typescript-eslint/parser": "^5.5.0",
"eslint": "^8.7.0",
"eslint-plugin-o1js": "^0.4.0",
"husky": "^7.0.1",
"jest": "^27.3.1",
"lint-staged": "^11.0.1",
"prettier": "^2.3.2",
Expand Down
15 changes: 0 additions & 15 deletions examples/zkapps/08-custom-tokens/.eslintrc.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions examples/zkapps/08-custom-tokens/.gitattributes

This file was deleted.

26 changes: 0 additions & 26 deletions examples/zkapps/08-custom-tokens/.github/workflows/ci.yml

This file was deleted.

13 changes: 0 additions & 13 deletions examples/zkapps/08-custom-tokens/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions examples/zkapps/08-custom-tokens/.husky/pre-commit

This file was deleted.

8 changes: 0 additions & 8 deletions examples/zkapps/08-custom-tokens/.npmignore

This file was deleted.

14 changes: 0 additions & 14 deletions examples/zkapps/08-custom-tokens/.prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions examples/zkapps/08-custom-tokens/.prettierrc

This file was deleted.

Binary file removed examples/zkapps/08-custom-tokens/081output.png
Binary file not shown.
Binary file removed examples/zkapps/08-custom-tokens/082output.png
Binary file not shown.
Loading

0 comments on commit b5f6de6

Please sign in to comment.