Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartialEq is not implemented in Payload #1422

Closed
amiyatulu opened this issue Feb 9, 2024 · 1 comment · Fixed by #1429
Closed

PartialEq is not implemented in Payload #1422

amiyatulu opened this issue Feb 9, 2024 · 1 comment · Fixed by #1429

Comments

@amiyatulu
Copy link

It gives following error in leptos:

can't compare subxt::tx::Payload<AddCitizen> with subxt::tx::Payload<AddCitizen>
the trait PartialEq is not implemented for subxt::tx::Payload<AddCitizen>

Leptos code:

pub fn sign_in_with_extension<T>(
    tx: T,
    account_address: String,
    account_source: String,
    set_error: WriteSignal<String>,
    set_extrinsic_success: WriteSignal<String>,
) where
    T: subxt::tx::TxPayload + 'static + std::clone::Clone + std::cmp::PartialEq,
{
    let async_transaction = create_resource(
        move || {
            (
                account_address.clone(),
                tx.clone(),
                account_source.clone(),
                set_error,
                set_extrinsic_success,
            )
        },
        |(account_address, tx, account_source, set_error, set_extrinsic_success)| async move {
            let account_id: AccountId32 = account_address.parse().unwrap();

            let api = OnlineClient::<PolkadotConfig>::from_url(NODE_URL)
                .await
                .unwrap();
    let tx = polkadot::tx().profile_validation().add_citizen(content);
    sign_in_with_extension(tx, account_address, account_source, set_error, set_extrinsic_success);
@lexnv
Copy link
Collaborator

lexnv commented Feb 12, 2024

This sounds like a good use case to cover with our Payloads.

I'll look at implementing this for types that implement PartialEq (or Eq). This may lead to changes being made to our codegen, since we'll have to double-check that the types we expose can implement partialEq.

In the meanwhile, we do expose a few methods on the concrete Payload type which may help you work around this: call_data, pallet_name, call_name. However, I would suggest waiting for a PR and subxt release; since the workaround implies removing the generic T over TxPayload.

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 a pull request may close this issue.

2 participants