Newer
Older
let instruction = QueryResponse { query_id, response, max_weight, querier };
let message = Xcm(vec![instruction]);
self.send(destination, message, fee_reason)
}
fn try_reanchor(
asset: MultiAsset,
destination: &MultiLocation,
) -> Result<(MultiAsset, InteriorMultiLocation), XcmError> {
let reanchor_context = Config::UniversalLocation::get();
let asset = asset
.reanchored(&destination, reanchor_context)
.map_err(|()| XcmError::ReanchorFailed)?;
Ok((asset, reanchor_context))
}
fn try_reanchor_multilocation(
location: MultiLocation,
destination: &MultiLocation,
) -> Result<(MultiLocation, InteriorMultiLocation), XcmError> {
let reanchor_context = Config::UniversalLocation::get();
let location = location
.reanchored(&destination, reanchor_context)
.map_err(|_| XcmError::ReanchorFailed)?;
Ok((location, reanchor_context))
}
/// NOTE: Any assets which were unable to be reanchored are introduced into `failed_bin`.
fn reanchored(
mut assets: Assets,
dest: &MultiLocation,
maybe_failed_bin: Option<&mut Assets>,
) -> MultiAssets {
let reanchor_context = Config::UniversalLocation::get();
assets.reanchor(dest, reanchor_context, maybe_failed_bin);
assets.into_assets_iter().collect::<Vec<_>>().into()