mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 03:05:44 +00:00
ffa0e30e58
Closes: - #1383 - Declared chains can be now be imported and reused in a different crate. - Chain declaration are now generic over a generic type `N` (the Network) - #1389 - Solved #1383, chains and networks declarations can be restructure to avoid having to compile all chains when running integrations tests where are not needed. - Chains are now declared on its own crate (removed from `integration-tests-common`) - Networks are now declared on its own crate (removed from `integration-tests-common`) - Integration tests will import only the relevant Network crate - `integration-tests-common` is renamed to `emulated-integration-tests-common` All this is necessary to be able to implement what is described here: https://github.com/paritytech/roadmap/issues/56#issuecomment-1777010553 --------- Co-authored-by: command-bot <>
62 lines
2.0 KiB
Rust
62 lines
2.0 KiB
Rust
// Copyright (C) Parity Technologies (UK) Ltd.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// Cumulus
|
|
use parachains_common::AccountId;
|
|
|
|
// Polkadot
|
|
use xcm::{prelude::*, DoubleEncoded};
|
|
|
|
/// Helper method to build a XCM with a `Transact` instruction and paying for its execution
|
|
pub fn xcm_transact_paid_execution(
|
|
call: DoubleEncoded<()>,
|
|
origin_kind: OriginKind,
|
|
native_asset: MultiAsset,
|
|
beneficiary: AccountId,
|
|
) -> VersionedXcm<()> {
|
|
let weight_limit = WeightLimit::Unlimited;
|
|
let require_weight_at_most = Weight::from_parts(1000000000, 200000);
|
|
let native_assets: MultiAssets = native_asset.clone().into();
|
|
|
|
VersionedXcm::from(Xcm(vec![
|
|
WithdrawAsset(native_assets),
|
|
BuyExecution { fees: native_asset, weight_limit },
|
|
Transact { require_weight_at_most, origin_kind, call },
|
|
RefundSurplus,
|
|
DepositAsset {
|
|
assets: All.into(),
|
|
beneficiary: MultiLocation {
|
|
parents: 0,
|
|
interior: X1(AccountId32 { network: None, id: beneficiary.into() }),
|
|
},
|
|
},
|
|
]))
|
|
}
|
|
|
|
/// Helper method to build a XCM with a `Transact` instruction without paying for its execution
|
|
pub fn xcm_transact_unpaid_execution(
|
|
call: DoubleEncoded<()>,
|
|
origin_kind: OriginKind,
|
|
) -> VersionedXcm<()> {
|
|
let weight_limit = WeightLimit::Unlimited;
|
|
let require_weight_at_most = Weight::from_parts(1000000000, 200000);
|
|
let check_origin = None;
|
|
|
|
VersionedXcm::from(Xcm(vec![
|
|
UnpaidExecution { weight_limit, check_origin },
|
|
Transact { require_weight_at_most, origin_kind, call },
|
|
]))
|
|
}
|