Skip to content
Open
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
239 changes: 120 additions & 119 deletions sdk/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ serde = "1"
serde_json = "1"
sha2 = "0.10"

snarkvm = { git = "https://github.com/ProvableHQ/snarkVM.git", tag = "v4.8.1", default-features = false, features = [
snarkvm = { git = "https://github.com/ProvableHQ/snarkVM.git", tag = "v4.9.0", default-features = false, features = [
"console", "circuit", "synthesizer", "ledger", "utilities", "algorithms", "parameters",
] }

Expand Down
1 change: 1 addition & 0 deletions sdk/python/aleo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
pass

from .encryptor import *
from .merkle import MerkleExclusionProof as MerkleExclusionProof
from .network_client import AleoNetworkClient as AleoNetworkClient
from .async_network_client import AsyncAleoNetworkClient as AsyncAleoNetworkClient
from ._client_common import AleoNetworkError as AleoNetworkError
Expand Down
39 changes: 39 additions & 0 deletions sdk/python/aleo/async_network_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,45 @@ async def get_program_mapping_value(
"getProgramMappingValue",
)

async def get_freeze_list(self, program_id: str) -> list[int]:
"""Read a compliance program's freeze-list Merkle tree.

Programs following the Sealance architecture publish their freeze list
as a sorted Merkle tree and require callers to prove non-inclusion in
it. Pair this with :class:`~aleo.MerkleExclusionProof` to turn the tree
into the proof a transition expects.

Args:
program_id: The freeze-list program, e.g.
``"shield_swap_freezelist.aleo"``. Each compliance program
keeps its own list, so this is a parameter rather than a
constant.

Returns:
Every node of the tree in tree order — leaves first, then each layer
above, with the Merkle root last. An empty list reads back as the
two-leaf zero tree.

Raises:
AleoNetworkError: If the program does not exist or serves no list.
ValueError: If the response is not an array of field values.
"""
payload = await self._get(
f"/programs/{program_id}/compliance/freeze-list",
"getFreezeList",
)
if not isinstance(payload, list):
raise ValueError(
f"{program_id} returned a {type(payload).__name__} rather than "
f"a freeze list array"
)
try:
return [int(str(node).strip().removesuffix("field")) for node in payload]
except ValueError:
raise ValueError(
f"{program_id} freeze list holds a non-numeric node"
) from None

async def get_public_balance(self, address: str) -> int:
"""Read an address's public ``credits.aleo`` balance.

Expand Down
Loading
Loading