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 Cargo.lock

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

2 changes: 1 addition & 1 deletion beam-apps/apps/uniswap/Cargo.lock

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

2 changes: 1 addition & 1 deletion beam-apps/apps/uniswap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "beam-app-uniswap"
version = "1.0.0"
version = "1.0.2"
edition = "2024"
publish = false

Expand Down
4 changes: 2 additions & 2 deletions beam-apps/apps/uniswap/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"format_version": 1,
"id": "uniswap",
"display_name": "Uniswap",
"version": "1.0.0",
"version": "1.0.2",
"publisher": "Payy",
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"min_beam_version": "0.1.2",
"min_beam_version": "0.2.1",
"wasm": {
"sha256": "",
"entrypoint": "beam_app_main"
Expand Down
19 changes: 10 additions & 9 deletions beam-apps/apps/uniswap/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@ pub fn token_metadata(chain: &str, token: &str) -> Result<SwapToken> {
value: None,
})?;
let response = parse_host_value::<TokenMetadataResponse>(response)?;
let decimals = response.decimals.ok_or_else(|| Error::InvalidHostResponse {
reason: format!("token {token} missing decimals"),
})?;
let decimals = response
.decimals
.ok_or_else(|| Error::InvalidHostResponse {
reason: format!("token {token} missing decimals"),
})?;
Ok(SwapToken {
is_native: is_native_token(&response.address, &response.label),
address: response.address,
Expand Down Expand Up @@ -408,12 +410,11 @@ fn host_call(request: HostRequest) -> Result<Value> {
})?;
let mut response = vec![0_u8; HOST_RESPONSE_CAPACITY];
let len = beam_host_call_wrapper(&request, &mut response)?;
let response =
serde_json::from_slice::<HostCallResponse>(&response[..len]).map_err(|err| {
Error::InvalidHostResponse {
reason: err.to_string(),
}
})?;
let response = serde_json::from_slice::<HostCallResponse>(&response[..len]).map_err(|err| {
Error::InvalidHostResponse {
reason: err.to_string(),
}
})?;
if !response.ok {
return Err(Error::HostCallFailed {
message: response
Expand Down
21 changes: 12 additions & 9 deletions beam-apps/apps/uniswap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ fn run_guest(input_ptr: *const u8, input_len: usize) -> Result<Value> {
reason: err.to_string(),
})?;
host::ensure_host_abi(&invocation)?;
let command = invocation
.args
.first()
.map(String::as_str)
.ok_or_else(|| Error::UnsupportedCommand {
command: "<missing>".to_string(),
})?;
let command =
invocation
.args
.first()
.map(String::as_str)
.ok_or_else(|| Error::UnsupportedCommand {
command: "<missing>".to_string(),
})?;
match command {
"swap" => {
let plan = run_swap(invocation)?;
Expand Down Expand Up @@ -146,8 +147,10 @@ fn run_swap(invocation: GuestInvocation) -> Result<ActionPlan> {
&swap_payload(&quote, &wallet),
)?;
let mut swap = SwapResponse {
transaction: find_transaction(&swap_value).ok_or_else(|| Error::InvalidUniswapResponse {
reason: "swap response missing transaction".to_string(),
transaction: find_transaction(&swap_value).ok_or_else(|| {
Error::InvalidUniswapResponse {
reason: "swap response missing transaction".to_string(),
}
})?,
raw: swap_value,
};
Expand Down
2 changes: 1 addition & 1 deletion beam-apps/apps/uniswap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn builds_approval_and_swap_action_plan() {
buy: token("ETH", "0x0000000000000000000000000000000000000000", true),
context: PlanContext {
app_id: "uniswap".to_string(),
app_version: "1.0.0".to_string(),
app_version: "1.0.2".to_string(),
chain: "base".to_string(),
manifest_sha256: "sha256:manifest".to_string(),
wallet: "0x3333333333333333333333333333333333333333".to_string(),
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"format_version": 1,
"id": "uniswap",
"display_name": "Uniswap",
"version": "1.0.0",
"version": "1.0.2",
"publisher": "Payy",
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"min_beam_version": "0.1.2",
"min_beam_version": "0.2.1",
"wasm": {
"sha256": "sha256:15dadd2f783c783594c5c586f494f7b31be6dc89e5efbab1c479cf317b15ad0f",
"sha256": "sha256:18aa6e8845772beccef895e83bbf2d1f3783d24fbf0fb8feee75d1eacfa1a7f9",
"entrypoint": "beam_app_main"
},
"catalog": {
Expand Down Expand Up @@ -211,14 +211,14 @@
"privacy_reserved": true
},
"icon": {
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/icon.svg",
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/icon.svg",
"sha256": "sha256:a7588127f926d7f5aa352cdeca3ab596c4ed673df98fc964af3e9c9f27e65b0d",
"media_type": "image/svg+xml",
"alt": "Uniswap logo"
},
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:7606f4bb87567420778c2688804cb3cbfdc7d8dd49d712f10bb71177fabd4a0f"
"value": "sha256:847162262ed6ee2a090a77fdc0b7caa2bf90cbfc385fb4f18b271c00a9558f36"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:a7bac552c206a4a3a86a0261d6e8efe4e374b62780e692669d4055c7f2933178"
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:c066a56b6703a1d421195be37474192a11a960ce259991ff3cb91fd2f062c8de"
}
14 changes: 7 additions & 7 deletions beam-apps/fixtures/broad-wildcard/catalog/apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"display_name": "Uniswap",
"publisher": "Payy",
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"latest_version": "1.0.0",
"min_beam_version": "0.1.2",
"latest_version": "1.0.2",
"min_beam_version": "0.2.1",
"detail_url": "https://registry.beam.payy.network/catalog/apps/uniswap.json",
"install_command": "beam apps install uniswap",
"pinned_install_command": "beam apps install uniswap --version 1.0.0",
"pinned_install_command": "beam apps install uniswap --version 1.0.2",
"supported_chains": [
{
"id": "ethereum",
Expand Down Expand Up @@ -90,11 +90,11 @@
"App storage"
],
"version": {
"version": "1.0.0",
"min_beam_version": "0.1.2"
"version": "1.0.2",
"min_beam_version": "0.2.1"
},
"icon": {
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/icon.svg",
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/icon.svg",
"sha256": "sha256:a7588127f926d7f5aa352cdeca3ab596c4ed673df98fc964af3e9c9f27e65b0d",
"media_type": "image/svg+xml",
"alt": "Uniswap logo"
Expand All @@ -104,6 +104,6 @@
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:83a8fa8333089b3481f93f9caacd25bae6dab5bdd4d39cdfafaec2ccbc87efab"
"value": "sha256:066b1321d86de07e799ba77ac8a531d7a14c258b5ff79cb6e7f352a6cf8ab5d7"
}
}
2 changes: 1 addition & 1 deletion beam-apps/fixtures/broad-wildcard/catalog/apps.json.sig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:83a8fa8333089b3481f93f9caacd25bae6dab5bdd4d39cdfafaec2ccbc87efab"
"value": "sha256:066b1321d86de07e799ba77ac8a531d7a14c258b5ff79cb6e7f352a6cf8ab5d7"
}
16 changes: 8 additions & 8 deletions beam-apps/fixtures/broad-wildcard/catalog/apps/uniswap.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"display_name": "Uniswap",
"publisher": "Payy",
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"latest_version": "1.0.0",
"min_beam_version": "0.1.2",
"latest_version": "1.0.2",
"min_beam_version": "0.2.1",
"install_commands": {
"latest": "beam apps install uniswap",
"pinned": "beam apps install uniswap --version 1.0.0",
"pinned": "beam apps install uniswap --version 1.0.2",
"dry_run": "beam apps install uniswap --dry-run"
},
"supported_chains": [
Expand Down Expand Up @@ -274,17 +274,17 @@
"readme_markdown": "# Uniswap App\n\nThe Uniswap app turns a swap request into a Beam-approved action plan. It asks\nthe Uniswap Trading API for a quote, checks your current ERC-20 allowance,\nprepares an exact approval only when one is needed, builds the swap transaction,\nand hands the whole plan to Beam for approval and execution.\n\nBeam owns your wallet boundary. The app never receives private keys, cannot sign\ntransactions, and cannot send a transaction on its own.\n\n## Install\n\n```bash\nbeam apps install uniswap\n```\n\nBeam shows the publisher, version, supported chains, network access, wallet\ncapabilities, and storage permissions before activating the app. To inspect the\nsame permission summary without installing:\n\n```bash\nbeam apps install uniswap --dry-run\n```\n\n## Swap\n\n```bash\nbeam x uniswap swap <sell-token> <buy-token> <amount> [options]\n```\n\nCommand help is exported through the app manifest and rendered by Beam without\nfetching a quote or invoking guest WASM:\n\n```bash\nbeam x uniswap swap --help\n```\n\nExample:\n\n```bash\nbeam x uniswap swap USDC ETH 100 --chain base --from alice\n```\n\nBeam shows the quote, any required approval, and the swap as a single plan. You\napprove the final plan before Beam signs or submits anything.\n\n## Options\n\n- `--min-receive <amount>` sets the minimum acceptable output amount.\n- `--max-gas <wei>` rejects the plan if estimated gas exceeds the limit.\n- `--slippage-bps <bps>` sets max slippage in basis points.\n- `--recipient <wallet-or-address>` sends output to another wallet, ENS name, or\n EVM address.\n- `--deadline-seconds <seconds>` sets the quote and transaction deadline window.\n- `--unlimited-approval` asks Beam to request an unlimited ERC-20 approval\n instead of the default exact approval.\n\nToken inputs can be Beam token labels, `native`, the active chain's native\nsymbol, or EVM token addresses.\n\n## How a Swap Works\n\n1. The app fetches a quote through Beam-mediated HTTPS access.\n2. Beam reads your token balance and allowance through its chain APIs.\n3. If allowance is short, Beam adds an exact ERC-20 approval step.\n4. The app prepares the swap transaction.\n5. Beam renders the typed plan, asks for approval, signs, submits, and tracks the\n receipt.\n\nIf an approval is required, Beam submits it first and submits the swap only after\nthe approval is confirmed. If fresh allowance already satisfies the exact plan,\nBeam skips the approval step. Execution output reports confirmed, pending,\ndropped, or skipped transaction state; confirmed receipts include the RPC status\nvalue.\n\n## Agents\n\nAgents and other non-interactive callers should prepare a continuation, inspect\nit, then explicitly approve and execute it:\n\n```bash\nbeam x uniswap swap USDC ETH 100 --chain base --from alice --prepare --format json\nbeam apps approvals show <approval-id>\nbeam apps approvals approve <approval-id> --execute\n```\n\n`--no-prompt` fails closed for wallet-affecting swaps unless the command is\npreparing a continuation or executing an already-approved continuation.\n\n## Permissions\n\nThe app requests HTTPS access to the Uniswap Trading API, read/simulate/send\naccess on supported public EVM chains, ERC-20 approval planning, wallet balance\nreads, transaction proposals, and app-local storage. It does not request Beam\nprivacy capabilities in v1.\n\nSupported chains are Ethereum, Base, Arbitrum, Polygon, BNB, and Sepolia.\n\nApprovals default to the exact amount required. Unlimited approvals require the\nexplicit `--unlimited-approval` flag and are shown in the Beam approval prompt.\n",
"manifest_summary": {
"format_version": 1,
"min_beam_version": "0.1.2",
"min_beam_version": "0.2.1",
"wasm_entrypoint": "beam_app_main"
},
"versions": [
{
"version": "1.0.0",
"min_beam_version": "0.1.2"
"version": "1.0.2",
"min_beam_version": "0.2.1"
}
],
"icon": {
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/icon.svg",
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/icon.svg",
"sha256": "sha256:a7588127f926d7f5aa352cdeca3ab596c4ed673df98fc964af3e9c9f27e65b0d",
"media_type": "image/svg+xml",
"alt": "Uniswap logo"
Expand All @@ -293,6 +293,6 @@
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:cf1ff80f294be2c782b248b643bf45ad2aa8d1c45d4fd48ef3e160e601037b42"
"value": "sha256:54e79a5357fd6defd210f7f6ec88d70a6b0212cd805b273fcc6731ae81d59279"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:cf1ff80f294be2c782b248b643bf45ad2aa8d1c45d4fd48ef3e160e601037b42"
"value": "sha256:54e79a5357fd6defd210f7f6ec88d70a6b0212cd805b273fcc6731ae81d59279"
}
16 changes: 8 additions & 8 deletions beam-apps/fixtures/broad-wildcard/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"versions": [
{
"version": "1.0.0",
"min_beam_version": "0.1.2",
"manifest_url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/manifest.json",
"manifest_sha256": "sha256:679a551bf48519a586975b25385e310519b077853383a4b3f7c2ff7b66ca3470",
"module_url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/module.wasm",
"module_sha256": "sha256:15dadd2f783c783594c5c586f494f7b31be6dc89e5efbab1c479cf317b15ad0f",
"version": "1.0.2",
"min_beam_version": "0.2.1",
"manifest_url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/manifest.json",
"manifest_sha256": "sha256:07b1223ee0855508eb0c46743a3345e96422f97a7cf12175c504bfee8850341b",
"module_url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/module.wasm",
"module_sha256": "sha256:18aa6e8845772beccef895e83bbf2d1f3783d24fbf0fb8feee75d1eacfa1a7f9",
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:d66c14c15fb72b7d083a8a61984e2356a130b521fb70e664edefcfabd08ed8dd"
"value": "sha256:c066a56b6703a1d421195be37474192a11a960ce259991ff3cb91fd2f062c8de"
}
}
]
Expand All @@ -27,6 +27,6 @@
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:40a78ac42754c32d9e50aab13e98882852a73f14155a648919d1fdae928e78a8"
"value": "sha256:02b57fe91af9b8247f4b71214bbe382ea4b09a63461bd05c5e59e61987a5c98d"
}
}
2 changes: 1 addition & 1 deletion beam-apps/fixtures/broad-wildcard/index.json.sig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:40a78ac42754c32d9e50aab13e98882852a73f14155a648919d1fdae928e78a8"
"value": "sha256:02b57fe91af9b8247f4b71214bbe382ea4b09a63461bd05c5e59e61987a5c98d"
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"format_version": 1,
"id": "uniswap",
"display_name": "Uniswap",
"version": "1.0.0",
"version": "1.0.2",
"publisher": "Payy",
"description": "Prepare public Uniswap swaps through Beam-mediated HTTP, chain, approval, and transaction planning.",
"min_beam_version": "0.1.2",
"min_beam_version": "0.2.1",
"wasm": {
"sha256": "sha256:15dadd2f783c783594c5c586f494f7b31be6dc89e5efbab1c479cf317b15ad0f",
"sha256": "sha256:18aa6e8845772beccef895e83bbf2d1f3783d24fbf0fb8feee75d1eacfa1a7f9",
"entrypoint": "beam_app_main"
},
"catalog": {
Expand Down Expand Up @@ -282,14 +282,14 @@
"privacy_reserved": true
},
"icon": {
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.0/icon.svg",
"url": "https://registry.beam.payy.network/apps/uniswap/1.0.2/icon.svg",
"sha256": "sha256:a7588127f926d7f5aa352cdeca3ab596c4ed673df98fc964af3e9c9f27e65b0d",
"media_type": "image/svg+xml",
"alt": "Uniswap logo"
},
"signature": {
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:2f47a3e064fdc3572cc68eb52929147275f5e57fc958e82e59e8c2a5f21ab57e"
"value": "sha256:a7bac552c206a4a3a86a0261d6e8efe4e374b62780e692669d4055c7f2933178"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:a7bac552c206a4a3a86a0261d6e8efe4e374b62780e692669d4055c7f2933178"
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"algorithm": "sha256-dev",
"key_id": "payy-dev-2026-05",
"value": "sha256:c066a56b6703a1d421195be37474192a11a960ce259991ff3cb91fd2f062c8de"
}
Loading
Loading