Skip to content

feat: add RequiredBadge support to PerAssetTransfers manifest builder - #452

Open
genkipool wants to merge 3 commits into
radixdlt:mainfrom
genkipool:feature/auto-attach-badges
Open

feat: add RequiredBadge support to PerAssetTransfers manifest builder#452
genkipool wants to merge 3 commits into
radixdlt:mainfrom
genkipool:feature/auto-attach-badges

Conversation

@genkipool

@genkipool genkipool commented Jul 23, 2026

Copy link
Copy Markdown

Description

This PR extends the PerAssetTransfers manifest building logic to support injecting required badges into the transaction. It is required for the upcoming feature in the Android/iOS wallets that automatically presents authorized badges when transferring restricted tokens or NFTs.

Changes

  • Addressed reviewer feedback by replacing the custom RequiredBadge type with the standard ResourceSpecifier.
  • Updated TransactionManifest.perAssetTransfers builder to accept and inject a list of ResourceSpecifier into the generated manifest instructions.
  • Implemented the correct native Radix Engine methods (create_proof_of_amount for fungibles and create_proof_of_non_fungibles for NFTs) on the Account component during manifest building.
  • Reverted unintentional formatting/serializer changes (UuidSerializer.kt, TimestampSerializer.kt) as requested.
  • Updated tests in TransactionManifestTest.kt to verify correct badge injection.

Related Issues

use crate::prelude::*;

/// A badge that is required to authorize/validate the transaction execution.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not need a new type, do use ResourceSpecifier

let resource_arg: ScryptoResourceAddress =
resource_address.into();
let amount_arg: ScryptoDecimal192 = amount.into();
builder = builder.call_method(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer create_proof_from_account_of_amount

.into_iter()
.map(ScryptoNonFungibleLocalId::from)
.collect();
builder = builder.call_method(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer using create_proof_from_account_of_non_fungibles

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for the change?

mockk = "1.13.11"
kotlin = "2.0.21"
agp = "8.9.0"
agp = "8.12.3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for this change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why this was changed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same


cargoNdk {
targets = arrayListOf("arm64", "arm")
targets = arrayListOf("arm64", "arm", "x86_64", "x86")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you need to x86_64 for building on Intel based machine for the emulator? seems that you are on Linux machine.

@genkipool

Copy link
Copy Markdown
Author

Hi @GhenadieVP,

Thank you for the detailed review! Here are my responses and the reasoning behind the changes:

1. RequiredBadge vs ResourceSpecifier & proof methods

You are absolutely right. I will refactor the code to use ResourceSpecifier instead of the custom RequiredBadge type, and I will update the manifest builder to use create_proof_from_account_of_amount and create_proof_from_account_of_non_fungibles, as suggested.

2. .kotlin/errors/...log files

My apologies! Those local compilation logs were accidentally staged and committed. I will remove them from the branch immediately.

3. Gradle and AGP versions (gradle-wrapper.properties, libs.versions.toml)

These version bumps (AGP to 8.12.3) were automatically applied by my local Android Studio environment to support the build. If you would prefer to keep the original versions to maintain CI consistency across the repository, I will revert those files.

4. TimestampSerializer.kt and UuidSerializer.kt changes

These were unintended modifications (most likely auto-formatting or import optimizations performed by Android Studio on save). I will revert both files to their original state.

5. cargoNdk targets (x86_64, x86)

Yes, exactly! I am developing on a Linux machine and needed those targets to successfully build the Rust JNI library for the local Android emulator.

Would you be okay with keeping them to support developers using Intel/Linux machines, or would you prefer that I remove them before the final merge?

I'll push a new commit shortly addressing all the code review suggestions and reverting the unintended formatting changes and log files.

Thanks again!

@GhenadieVP

Copy link
Copy Markdown
Contributor
  1. cargoNdk targets (x86_64, x86)

Yes, exactly! I am developing on a Linux machine and needed those targets to successfully build the Rust JNI library for the local Android emulator.
Would you be okay with keeping them to support developers using Intel/Linux machines, or would you prefer that I remove them before the final merge?

Yes, it is good to keep at least for local dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants