6

Good day, I would love to know how to make Sudo calls through subxt library , I can't seem to find a meaningful solution. substrate-api-client has an example on how to make on, but going through the documentation of subxt library, it doesn't show how to do it.

1 Answer 1

6

There is a nice test that could be helpful for you to discover how to use sudo:

let call = Call::Balances(BalancesCall::transfer {
    dest: bob,
    value: 10_000,
});

let found_event = cxt
    .api
    .tx()
    .sudo()
    .sudo(call)
    .sign_and_submit_then_watch(&alice)
    .await?
    .wait_for_finalized_success()
    .await?
    .has::<sudo::events::Sudid>()?;

Reference: https://github.com/paritytech/subxt/blob/b1b717332eb44af3f992ad4486b0d43a8d1f6d79/subxt/tests/integration/frame/sudo.rs#L42

Update May 2023:

Original reference is outdated, new reference here: https://github.com/paritytech/subxt/blob/81494027c8f5ae62d44883167585d5e557f0fcba/testing/integration-tests/src/frame/sudo.rs#L26

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.