Skip to content
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
2 changes: 1 addition & 1 deletion apps/interface/src/lib/components/SendForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { lib } from "$lib";
import { requestRollup } from "$lib/utils";
import { sdk } from "@repo/contracts/sdk";
import { TokenAmount } from "@repo/contracts/sdk/RollupService";
import { TokenAmount } from "@repo/contracts/sdk/PoolErc20Service";
import { Ui } from "@repo/ui";
import { utils } from "@repo/utils";
import { assert } from "ts-essentials";
Expand Down
7 changes: 1 addition & 6 deletions packages/contracts/noir/common/src/owned_note.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use protocol_types::{
abis::nullifier_leaf_preimage::NullifierLeafPreimage, hash::poseidon2_hash_with_separator,
merkle_tree,
};
use protocol_types::{hash::poseidon2_hash_with_separator, merkle_tree};

pub trait OwnedNote: crate::Note {
fn owner(self) -> crate::WaAddress;
Expand All @@ -23,8 +20,6 @@ pub struct NoteConsumptionInputs<T> {
pub note: T,
pub note_index: Field,
pub note_sibling_path: [Field; crate::NOTE_HASH_TREE_HEIGHT],
pub nullifier_low_leaf_preimage: NullifierLeafPreimage,
pub nullifier_low_leaf_membership_witness: merkle_tree::MembershipWitness<crate::NOTE_HASH_TREE_HEIGHT>,
}

impl<T> NoteConsumptionInputs<T>
Expand Down
5 changes: 4 additions & 1 deletion packages/contracts/sdk/NonMembershipTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import type { Fr } from "@aztec/aztec.js";
import type { StandardIndexedTree } from "@aztec/merkle-tree";
import { ethers } from "ethers";
import { assert } from "ts-essentials";
import { INCLUDE_UNCOMMITTED, NULLIFIER_SUBTREE_HEIGHT } from "./RollupService";
import {
INCLUDE_UNCOMMITTED,
NULLIFIER_SUBTREE_HEIGHT,
} from "./PoolErc20Service";

export class NonMembershipTree {
private constructor(readonly _tree: StandardIndexedTree) {}
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/sdk/RollupOnlyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
MAX_NULLIFIERS_PER_ROLLUP,
NOTE_HASH_SUBTREE_HEIGHT,
type NoirAndBackend,
} from "./RollupService";
} from "./PoolErc20Service";
import type { TreesService } from "./TreesService";
import { prove } from "./utils.js";

Expand Down
11 changes: 2 additions & 9 deletions packages/contracts/sdk/TreesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
MAX_NULLIFIERS_PER_ROLLUP,
NOTE_HASH_TREE_HEIGHT,
NULLIFIER_TREE_HEIGHT,
} from "./RollupService";
} from "./PoolErc20Service";

export class TreesService {
constructor(private contract: PoolERC20) {}
Expand All @@ -36,11 +36,7 @@ export class TreesService {
.implement(async (params) => {
const { Fr } = await import("@aztec/aztec.js");

const { noteHashTree, nullifierTree } = await this.getTrees();

const nullifierNmWitness = await nullifierTree.getNonMembershipWitness(
new Fr(BigInt(params.nullifier)),
);
const { noteHashTree } = await this.getTrees();

const noteIndex = noteHashTree.findLeafIndex(
new Fr(BigInt(params.noteHash)),
Expand All @@ -54,9 +50,6 @@ export class TreesService {
.toTuple()
.map((x: Fr) => x.toString()),
note_index: ethers.toQuantity(noteIndex),
nullifier_low_leaf_preimage: nullifierNmWitness.low_leaf_preimage,
nullifier_low_leaf_membership_witness:
nullifierNmWitness.low_leaf_membership_witness,
};
});

Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { mapValues } from "lodash-es";
import type { AsyncOrSync } from "ts-essentials";
import type { PoolERC20 } from "../typechain-types/index.js";
import { EncryptionService } from "./EncryptionService.js";
import { PoolErc20Service } from "./PoolErc20Service.js";
import { type ITreesService } from "./RemoteTreesService.js";
import { PoolErc20Service } from "./RollupService.js";

export * from "./EncryptionService.js";
export * from "./NonMembershipTree.js";
export * from "./PoolErc20Service.js";
export * from "./RemoteTreesService.js";
export * from "./RollupService.js";
export * from "./TreesService.js";

export function createCoreSdk(contract: PoolERC20) {
Expand Down
Loading