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

Runtime API for LocationToAccountId Conversion #4298

Closed
joepetrowski opened this issue Apr 25, 2024 · 1 comment · Fixed by #4857
Closed

Runtime API for LocationToAccountId Conversion #4298

joepetrowski opened this issue Apr 25, 2024 · 1 comment · Fixed by #4857
Assignees
Labels
T4-runtime_API This PR/Issue is related to runtime APIs. T6-XCM This PR/Issue is related to XCM.

Comments

@joepetrowski
Copy link
Contributor

We use this type to convert locations in the system to local AccountIds on a chain. Quite often we want to do this conversion in applications or just for debugging, so it would be nice to expose an API to query how a chain will convert a location. Examples:

  • Recent case with Phala and sibling vs. Relay sovereign account
  • In this referendum, the beneficiary was specified as (1, PalletInstance(18)) as it is more expressive to show that you are transferring the funds to the control of a pallet in the system and not some random account. But it's difficult to actually find this account now.
@joepetrowski joepetrowski added T6-XCM This PR/Issue is related to XCM. T4-runtime_API This PR/Issue is related to runtime APIs. labels Apr 25, 2024
@bkontur bkontur self-assigned this May 2, 2024
@bkontur
Copy link
Contributor

bkontur commented Jun 25, 2024

@joepetrowski implemented here: #4857, please take a look:
Input:

  • location: VersionedLocation
  • ss58_prefix - optional, if none the runtime's SS58Prefix is used or you can specify what ever output you need

Output:

  • account_id bytes
  • ss58_address + ss58_version

Example bellow is for:

Location::parent()

account_id:  0x506172656e740000000000000000000000000000000000000000000000000000

image

github-merge-queue bot pushed a commit that referenced this issue Jun 26, 2024
Closes: #4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.


## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`
 
Output:
 - account_id bytes


![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
fgamundi pushed a commit to moondance-labs/polkadot-sdk that referenced this issue Jul 17, 2024
Closes: paritytech#4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.

## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`

Output:
 - account_id bytes

![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	cumulus/parachains/integration-tests/emulated/chains/relays/westend/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml
#	cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs
#	cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml
#	cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
#	cumulus/parachains/runtimes/people/people-rococo/Cargo.toml
#	cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
#	cumulus/parachains/runtimes/people/people-westend/Cargo.toml
#	cumulus/parachains/runtimes/people/people-westend/src/lib.rs
#	cumulus/parachains/runtimes/testing/penpal/Cargo.toml
#	cumulus/parachains/runtimes/testing/penpal/src/lib.rs
#	cumulus/polkadot-parachain/Cargo.toml
#	polkadot/node/service/Cargo.toml
#	polkadot/runtime/rococo/Cargo.toml
#	polkadot/runtime/westend/Cargo.toml
#	polkadot/xcm/pallet-xcm/Cargo.toml
#	polkadot/xcm/xcm-runtime-apis/Cargo.toml
#	umbrella/Cargo.toml
#	umbrella/src/lib.rs
fgamundi pushed a commit to moondance-labs/polkadot-sdk that referenced this issue Jul 17, 2024
Closes: paritytech#4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.

## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`

Output:
 - account_id bytes

![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	cumulus/parachains/integration-tests/emulated/chains/relays/westend/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml
#	cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs
#	cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml
#	cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
#	cumulus/parachains/runtimes/people/people-rococo/Cargo.toml
#	cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
#	cumulus/parachains/runtimes/people/people-westend/Cargo.toml
#	cumulus/parachains/runtimes/people/people-westend/src/lib.rs
#	cumulus/parachains/runtimes/testing/penpal/Cargo.toml
#	cumulus/parachains/runtimes/testing/penpal/src/lib.rs
#	cumulus/polkadot-parachain/Cargo.toml
#	polkadot/node/service/Cargo.toml
#	polkadot/runtime/rococo/Cargo.toml
#	polkadot/runtime/westend/Cargo.toml
#	polkadot/xcm/pallet-xcm/Cargo.toml
#	polkadot/xcm/xcm-runtime-apis/Cargo.toml
#	umbrella/Cargo.toml
#	umbrella/src/lib.rs
fgamundi pushed a commit to moondance-labs/polkadot-sdk that referenced this issue Jul 17, 2024
Closes: paritytech#4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.

## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`

Output:
 - account_id bytes

![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	cumulus/parachains/integration-tests/emulated/chains/relays/westend/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml
#	cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs
#	cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml
#	cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
#	cumulus/parachains/runtimes/people/people-rococo/Cargo.toml
#	cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
#	cumulus/parachains/runtimes/people/people-westend/Cargo.toml
#	cumulus/parachains/runtimes/people/people-westend/src/lib.rs
#	cumulus/parachains/runtimes/testing/penpal/Cargo.toml
#	cumulus/parachains/runtimes/testing/penpal/src/lib.rs
#	cumulus/polkadot-parachain/Cargo.toml
#	polkadot/node/service/Cargo.toml
#	polkadot/runtime/rococo/Cargo.toml
#	polkadot/runtime/westend/Cargo.toml
#	polkadot/xcm/pallet-xcm/Cargo.toml
#	polkadot/xcm/xcm-runtime-apis/Cargo.toml
#	umbrella/Cargo.toml
#	umbrella/src/lib.rs
girazoki pushed a commit to moondance-labs/polkadot-sdk that referenced this issue Aug 1, 2024
Closes: paritytech#4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.

## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`

Output:
 - account_id bytes

![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	cumulus/parachains/integration-tests/emulated/chains/relays/westend/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml
#	cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs
#	cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml
#	cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
#	cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
#	cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
#	cumulus/parachains/runtimes/people/people-rococo/Cargo.toml
#	cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
#	cumulus/parachains/runtimes/people/people-westend/Cargo.toml
#	cumulus/parachains/runtimes/people/people-westend/src/lib.rs
#	cumulus/parachains/runtimes/testing/penpal/Cargo.toml
#	cumulus/parachains/runtimes/testing/penpal/src/lib.rs
#	cumulus/polkadot-parachain/Cargo.toml
#	polkadot/node/service/Cargo.toml
#	polkadot/runtime/rococo/Cargo.toml
#	polkadot/runtime/westend/Cargo.toml
#	polkadot/xcm/pallet-xcm/Cargo.toml
#	polkadot/xcm/xcm-runtime-apis/Cargo.toml
#	umbrella/Cargo.toml
#	umbrella/src/lib.rs
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this issue Aug 2, 2024
Closes: paritytech#4298

This PR also merges `xcm-fee-payment-runtime-api` module to the
`xcm-runtime-api`.


## TODO

- [x] rename `convert` to `convert_location` and add new one
`convert_account` (opposite direction)
- [x] add to the all testnet runtimes
- [x] check polkadot-js if supports that automatically or if needs to be
added manually polkadot-js/api#5917
- [ ] backport/patch for fellows and release (asap)

## Open questions
- [x] should we merge `xcm-runtime-api` and
`xcm-fee-payment-runtime-api` to the one module `xcm-runtime-api` ?

## Usage
Input:
 - `location:  VersionedLocation`
 
Output:
 - account_id bytes


![image](https://github.com/paritytech/polkadot-sdk/assets/8159517/4607b15a-77d2-462b-806c-606107776c0d)

---------

Co-authored-by: Bastian Köcher <[email protected]>
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this issue Aug 7, 2024
…imes (#413)

Relates to: paritytech/polkadot-sdk#4298
Relates to: paritytech/polkadot-sdk#4857


<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [ ] Does not require a CHANGELOG entry

---------

Co-authored-by: Adrian Catangiu <[email protected]>
Co-authored-by: Dónal Murray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T4-runtime_API This PR/Issue is related to runtime APIs. T6-XCM This PR/Issue is related to XCM.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants