mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add asset-bridging support to it (#1215)
This commit adds Rococo Asset Hub dedicated runtime so we can test new features here, before merging them in Kusama Asset Hub. Also adds one such feature: asset transfer over bridge (Rococo AssetHub <> Wococo AssetHub) - clone `asset-hub-kusama-runtime` -> `asset-hub-rococo-runtime` - make it use Rococo primitives, names, assets, constants, etc - add asset-transfer-over-bridge support to Rococo AssetHub <> Wococo AssetHub Fixes #1128 --------- Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
@@ -1,44 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
||||
# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]
|
||||
ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL="//Alice"
|
||||
# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
||||
# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]
|
||||
ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
|
||||
|
||||
# SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }` => 5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ
|
||||
# Expected sovereign accounts.
|
||||
#
|
||||
# use sp_core::crypto::Ss58Codec;
|
||||
# println!("{}",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# GlobalConsensusParachainConvertsFor::<UniversalLocation, [u8; 32]>::convert_ref(
|
||||
# MultiLocation { parents: 2, interior: X2(GlobalConsensus(Kusama), Parachain(1000)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ"
|
||||
# Generated by:
|
||||
#
|
||||
# #[test]
|
||||
# fn generate_sovereign_accounts() {
|
||||
# use sp_core::crypto::Ss58Codec;
|
||||
# use polkadot_parachain_primitives::primitives::Sibling;
|
||||
#
|
||||
# parameter_types! {
|
||||
# pub UniversalLocationAHR: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(1000));
|
||||
# pub UniversalLocationAHW: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(1000));
|
||||
# }
|
||||
#
|
||||
# // SS58=42
|
||||
# println!("GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# GlobalConsensusConvertsFor::<UniversalLocationAHW, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Rococo)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# println!("GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# GlobalConsensusParachainConvertsFor::<UniversalLocationAHW, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# println!("ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# SiblingParachainConvertsVia::<Sibling, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 1, interior: X1(Parachain(1000)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#
|
||||
# // SS58=42
|
||||
# println!("GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# GlobalConsensusConvertsFor::<UniversalLocationAHR, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Wococo)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# println!("GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# GlobalConsensusParachainConvertsFor::<UniversalLocationAHR, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Wococo), Parachain(1000)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# println!("ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# SiblingParachainConvertsVia::<Sibling, [u8; 32]>::convert_location(
|
||||
# &MultiLocation { parents: 1, interior: X1(Parachain(1000)) }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# }
|
||||
GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT="5GxRGwT8bU1JeBPTUXc7LEjZMxNrK8MyL2NJnkWFQJTQ4sii"
|
||||
GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ"
|
||||
ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
|
||||
GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT="5EWw2NzfPr2DCahourp33cya6bGWEJViTnJN6Z2ruFevpJML"
|
||||
GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT="5EJX8L4dwGyYnCsjZ91LfWAsm3rCN8vY2AYvT4mauMEjsrQz"
|
||||
ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
|
||||
|
||||
# Address: GegTpZJMyzkntLN7NJhRfHDk4GWukLbGSsag6PHrLSrCK4h
|
||||
ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT="scatter feed race company oxygen trip extra elbow slot bundle auto canoe"
|
||||
# Expected sovereign accounts for rewards on BridgeHubs.
|
||||
#
|
||||
# Generated by:
|
||||
#[test]
|
||||
#fn generate_sovereign_accounts_for_rewards() {
|
||||
# use sp_core::crypto::Ss58Codec;
|
||||
#
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
|
||||
# LaneId([0, 0, 0, 1]),
|
||||
# *b"bhwo",
|
||||
# RewardsAccountOwner::ThisChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
|
||||
# LaneId([0, 0, 0, 1]),
|
||||
# *b"bhwo",
|
||||
# RewardsAccountOwner::BridgedChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
|
||||
# LaneId([0, 0, 0, 1]),
|
||||
# *b"bhro",
|
||||
# RewardsAccountOwner::ThisChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
|
||||
# LaneId([0, 0, 0, 1]),
|
||||
# *b"bhro",
|
||||
# RewardsAccountOwner::BridgedChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#}
|
||||
ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain="5EHnXaT5BhiS8YRPMeHi97YHofTtNx4pLNb8wR8TwjVq1gzU"
|
||||
ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain="5EHnXaT5BhiS8YRPMeHyt95svA95qWAh53XeVMpJQZNZHAzj"
|
||||
ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain="5EHnXaT5BhiS8YRNuCukWXTQdAqARjjXmpjehjx1YZNE5keZ"
|
||||
ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain="5EHnXaT5BhiS8YRNuCv2FYzzjfWMtHqQWVgAFgdr1PExMN94"
|
||||
|
||||
# Adress: 5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y / H9jCvwVWsDJkrS4gPp1QB99qr4hmbGsVyAqn3F2PPaoWyU3
|
||||
# AccountId: [202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20]
|
||||
ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO="5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y"
|
||||
ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_WOCOCO="tone spirit magnet sunset cannon poverty forget lock river east blouse random"
|
||||
|
||||
function address_to_account_id_bytes() {
|
||||
local address=$1
|
||||
local output=$2
|
||||
echo "address_to_account_id_bytes - address: $address, output: $output"
|
||||
if [ $address == "$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" ]; then
|
||||
jq --null-input '[212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]' > $output
|
||||
elif [ $address == "$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" ]; then
|
||||
jq --null-input '[202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20]' > $output
|
||||
else
|
||||
echo -n "Sorry, unknown address: $address - please, add bytes here or function for that!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
LANE_ID="00000001"
|
||||
|
||||
function ensure_binaries() {
|
||||
if [[ ! -f ~/local_bridge_testing/bin/polkadot ]]; then
|
||||
@@ -87,8 +172,8 @@ function ensure_polkadot_js_api() {
|
||||
echo ""
|
||||
echo ""
|
||||
echo "-------------------"
|
||||
echo "Installing (nodejs) sub module: ./scripts/generate_hex_encoded_call"
|
||||
pushd ./scripts/generate_hex_encoded_call
|
||||
echo "Installing (nodejs) sub module: $(dirname "$0")/generate_hex_encoded_call"
|
||||
pushd $(dirname "$0")/generate_hex_encoded_call
|
||||
npm install
|
||||
popd
|
||||
fi
|
||||
@@ -103,7 +188,7 @@ function generate_hex_encoded_call_data() {
|
||||
shift
|
||||
echo "Input params: $@"
|
||||
|
||||
node ./scripts/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@"
|
||||
node $(dirname "$0")/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@"
|
||||
local retVal=$?
|
||||
|
||||
if [ $type != "check" ]; then
|
||||
@@ -129,7 +214,7 @@ function transfer_balance() {
|
||||
polkadot-js-api \
|
||||
--ws "${runtime_para_endpoint}" \
|
||||
--seed "${seed?}" \
|
||||
tx.balances.transfer \
|
||||
tx.balances.transferAllowDeath \
|
||||
"${target_account}" \
|
||||
"${amount}"
|
||||
}
|
||||
@@ -200,68 +285,53 @@ function send_governance_transact() {
|
||||
"${message}"
|
||||
}
|
||||
|
||||
function allow_assets_transfer_send() {
|
||||
function open_hrmp_channels() {
|
||||
local relay_url=$1
|
||||
local relay_chain_seed=$2
|
||||
local sender_para_id=$3
|
||||
local recipient_para_id=$4
|
||||
local max_capacity=$5
|
||||
local max_message_size=$6
|
||||
echo " calling open_hrmp_channels:"
|
||||
echo " relay_url: ${relay_url}"
|
||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||
echo " sender_para_id: ${sender_para_id}"
|
||||
echo " recipient_para_id: ${recipient_para_id}"
|
||||
echo " max_capacity: ${max_capacity}"
|
||||
echo " max_message_size: ${max_message_size}"
|
||||
echo " params:"
|
||||
echo "--------------------------------------------------"
|
||||
polkadot-js-api \
|
||||
--ws "${relay_url?}" \
|
||||
--seed "${relay_chain_seed?}" \
|
||||
--sudo \
|
||||
tx.hrmp.forceOpenHrmpChannel \
|
||||
${sender_para_id} \
|
||||
${recipient_para_id} \
|
||||
${max_capacity} \
|
||||
${max_message_size}
|
||||
}
|
||||
|
||||
function set_storage() {
|
||||
local relay_url=$1
|
||||
local relay_chain_seed=$2
|
||||
local runtime_para_id=$3
|
||||
local runtime_para_endpoint=$4
|
||||
local bridge_hub_para_id=$5
|
||||
local bridged_para_network=$6
|
||||
local bridged_para_para_id=$7
|
||||
echo " calling allow_assets_transfer_send:"
|
||||
local items=$5
|
||||
echo " calling set_storage:"
|
||||
echo " relay_url: ${relay_url}"
|
||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||
echo " runtime_para_id: ${runtime_para_id}"
|
||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||
echo " bridge_hub_para_id: ${bridge_hub_para_id}"
|
||||
echo " bridged_para_network: ${bridged_para_network}"
|
||||
echo " bridged_para_para_id: ${bridged_para_para_id}"
|
||||
echo " items: ${items}"
|
||||
echo " params:"
|
||||
|
||||
# 1. generate data for Transact (add_exporter_config)
|
||||
local bridge_config=$(jq --null-input \
|
||||
--arg bridge_hub_para_id "$bridge_hub_para_id" \
|
||||
--arg bridged_para_network "$bridged_para_network" \
|
||||
--arg bridged_para_para_id "$bridged_para_para_id" \
|
||||
'
|
||||
{
|
||||
"bridgeLocation": {
|
||||
"parents": 1,
|
||||
"interior": {
|
||||
"X1": { "Parachain": $bridge_hub_para_id }
|
||||
}
|
||||
},
|
||||
"allowedTargetLocation": {
|
||||
"parents": 2,
|
||||
"interior": {
|
||||
"X2": [
|
||||
{
|
||||
"GlobalConsensus": $bridged_para_network,
|
||||
},
|
||||
{
|
||||
"Parachain": $bridged_para_para_id
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"maxTargetLocationFee": {
|
||||
"id": {
|
||||
"Concrete": {
|
||||
"parents": 1,
|
||||
"interior": "Here"
|
||||
}
|
||||
},
|
||||
"fun": {
|
||||
"Fungible": 50000000000
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
)
|
||||
# 1. generate data for Transact (System::set_storage)
|
||||
local tmp_output_file=$(mktemp)
|
||||
generate_hex_encoded_call_data "add-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_para_network "$bridge_config"
|
||||
generate_hex_encoded_call_data "set-storage" "${runtime_para_endpoint}" "${tmp_output_file}" "$items"
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
# 2. trigger governance call
|
||||
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
|
||||
}
|
||||
|
||||
@@ -270,254 +340,93 @@ function force_create_foreign_asset() {
|
||||
local relay_chain_seed=$2
|
||||
local runtime_para_id=$3
|
||||
local runtime_para_endpoint=$4
|
||||
local global_consensus=$5
|
||||
local asset_multilocation=$5
|
||||
local asset_owner_account_id=$6
|
||||
local min_balance=$7
|
||||
local is_sufficient=$8
|
||||
echo " calling force_create_foreign_asset:"
|
||||
echo " relay_url: ${relay_url}"
|
||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||
echo " runtime_para_id: ${runtime_para_id}"
|
||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||
echo " global_consensus: ${global_consensus}"
|
||||
echo " asset_multilocation: ${asset_multilocation}"
|
||||
echo " asset_owner_account_id: ${asset_owner_account_id}"
|
||||
echo " min_balance: ${min_balance}"
|
||||
echo " is_sufficient: ${is_sufficient}"
|
||||
echo " params:"
|
||||
|
||||
# 1. generate data for Transact (ForeignAssets::force_create)
|
||||
local asset_id=$(jq --null-input \
|
||||
--arg global_consensus "$global_consensus" \
|
||||
'
|
||||
{
|
||||
"parents": 2,
|
||||
"interior": {
|
||||
"X1": {
|
||||
"GlobalConsensus": $global_consensus,
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
)
|
||||
local tmp_output_file=$(mktemp)
|
||||
generate_hex_encoded_call_data "force-create-asset" "${runtime_para_endpoint}" "${tmp_output_file}" "$asset_id" "$asset_owner_account_id" false "1000"
|
||||
generate_hex_encoded_call_data "force-create-asset" "${runtime_para_endpoint}" "${tmp_output_file}" "$asset_multilocation" "$asset_owner_account_id" $is_sufficient $min_balance
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
# 2. trigger governance call
|
||||
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
|
||||
}
|
||||
|
||||
function allow_assets_transfer_receive() {
|
||||
local relay_url=$1
|
||||
local relay_chain_seed=$2
|
||||
local runtime_para_id=$3
|
||||
local runtime_para_endpoint=$4
|
||||
local bridge_hub_para_id=$5
|
||||
local bridged_network=$6
|
||||
local bridged_para_id=$7
|
||||
echo " calling allow_assets_transfer_receive:"
|
||||
echo " relay_url: ${relay_url}"
|
||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||
echo " runtime_para_id: ${runtime_para_id}"
|
||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||
echo " bridge_hub_para_id: ${bridge_hub_para_id}"
|
||||
echo " bridged_network: ${bridged_network}"
|
||||
echo " bridged_para_id: ${bridged_para_id}"
|
||||
echo " params:"
|
||||
|
||||
# 1. generate data for Transact (add_universal_alias)
|
||||
local location=$(jq --null-input \
|
||||
--arg bridge_hub_para_id "$bridge_hub_para_id" \
|
||||
'{ "V3": { "parents": 1, "interior": { "X1": { "Parachain": $bridge_hub_para_id } } } }')
|
||||
|
||||
local junction=$(jq --null-input \
|
||||
--arg bridged_network "$bridged_network" \
|
||||
'{ "GlobalConsensus": $bridged_network } ')
|
||||
|
||||
local tmp_output_file=$(mktemp)
|
||||
generate_hex_encoded_call_data "add-universal-alias" "${runtime_para_endpoint}" "${tmp_output_file}" "$location" "$junction"
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
|
||||
|
||||
# 2. generate data for Transact (add_reserve_location)
|
||||
local reserve_location=$(jq --null-input \
|
||||
--arg bridged_network "$bridged_network" \
|
||||
--arg bridged_para_id "$bridged_para_id" \
|
||||
'{ "V3": {
|
||||
"parents": 2,
|
||||
"interior": {
|
||||
"X2": [
|
||||
{
|
||||
"GlobalConsensus": $bridged_network,
|
||||
},
|
||||
{
|
||||
"Parachain": $bridged_para_id
|
||||
}
|
||||
]
|
||||
}
|
||||
} }')
|
||||
|
||||
local tmp_output_file=$(mktemp)
|
||||
generate_hex_encoded_call_data "add-reserve-location" "${runtime_para_endpoint}" "${tmp_output_file}" "$reserve_location"
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
|
||||
}
|
||||
|
||||
function remove_assets_transfer_send() {
|
||||
local relay_url=$1
|
||||
local relay_chain_seed=$2
|
||||
local runtime_para_id=$3
|
||||
local runtime_para_endpoint=$4
|
||||
local bridged_network=$5
|
||||
echo " calling remove_assets_transfer_send:"
|
||||
echo " relay_url: ${relay_url}"
|
||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||
echo " runtime_para_id: ${runtime_para_id}"
|
||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||
echo " bridged_network: ${bridged_network}"
|
||||
echo " params:"
|
||||
|
||||
local tmp_output_file=$(mktemp)
|
||||
generate_hex_encoded_call_data "remove-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_network
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
|
||||
}
|
||||
|
||||
# TODO: we need to fill sovereign account for bridge-hub, because, small ammouts does not match ExistentialDeposit, so no reserve pass
|
||||
# SA for BH: MultiLocation { parents: 1, interior: X1(Parachain(1013)) } - 5Eg2fntRRwLinojmk3sh5xscp7F3S6Zzm5oDVtoLTALKiypR on Kusama Asset Hub
|
||||
|
||||
function transfer_asset_via_bridge() {
|
||||
function limited_reserve_transfer_assets() {
|
||||
local url=$1
|
||||
local seed=$2
|
||||
local target_account=$3
|
||||
local target_global_consensus=$4
|
||||
echo " calling transfer_asset_via_bridge:"
|
||||
local destination=$3
|
||||
local beneficiary=$4
|
||||
local assets=$5
|
||||
local fee_asset_item=$6
|
||||
local weight_limit=$7
|
||||
echo " calling limited_reserve_transfer_assets:"
|
||||
echo " url: ${url}"
|
||||
echo " seed: ${seed}"
|
||||
echo " target_account: ${target_account}"
|
||||
echo " target_global_consensus: ${target_global_consensus}"
|
||||
echo " params:"
|
||||
|
||||
local assets=$(jq --null-input \
|
||||
'
|
||||
{
|
||||
"V3": [
|
||||
{
|
||||
"id": {
|
||||
"Concrete": {
|
||||
"parents": 1,
|
||||
"interior": "Here"
|
||||
}
|
||||
},
|
||||
"fun": {
|
||||
"Fungible": 100000000
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
'
|
||||
)
|
||||
|
||||
local tmp_output_file=$(mktemp)
|
||||
address_to_account_id_bytes "$target_account" "${tmp_output_file}"
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
local destination=$(jq --null-input \
|
||||
--arg target_global_consensus "$target_global_consensus" \
|
||||
--argjson hex_encoded_data "$hex_encoded_data" \
|
||||
'
|
||||
{
|
||||
"V3": {
|
||||
"parents": 2,
|
||||
"interior": {
|
||||
"X3": [
|
||||
{
|
||||
"GlobalConsensus": $target_global_consensus
|
||||
},
|
||||
{
|
||||
"Parachain": 1000
|
||||
},
|
||||
{
|
||||
"AccountId32": {
|
||||
"id": $hex_encoded_data
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
)
|
||||
|
||||
echo ""
|
||||
echo " assets:"
|
||||
echo "${assets}"
|
||||
echo ""
|
||||
echo " destination:"
|
||||
echo "${destination}"
|
||||
echo " destination: ${destination}"
|
||||
echo " beneficiary: ${beneficiary}"
|
||||
echo " assets: ${assets}"
|
||||
echo " fee_asset_item: ${fee_asset_item}"
|
||||
echo " weight_limit: ${weight_limit}"
|
||||
echo ""
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
polkadot-js-api \
|
||||
--ws "${url?}" \
|
||||
--seed "${seed?}" \
|
||||
tx.bridgeTransfer.transferAssetViaBridge \
|
||||
tx.polkadotXcm.limitedReserveTransferAssets \
|
||||
"${destination}" \
|
||||
"${beneficiary}" \
|
||||
"${assets}" \
|
||||
"${destination}"
|
||||
"${fee_asset_item}" \
|
||||
"${weight_limit}"
|
||||
}
|
||||
|
||||
function ping_via_bridge() {
|
||||
local url=$1
|
||||
function claim_rewards() {
|
||||
local runtime_para_endpoint=$1
|
||||
local seed=$2
|
||||
local target_account=$3
|
||||
local target_global_consensus=$4
|
||||
echo " calling ping_via_bridge:"
|
||||
echo " url: ${url}"
|
||||
local lane_id=$3
|
||||
local bridged_chain_id=$4
|
||||
local owner=$5
|
||||
echo " calling claim_rewards:"
|
||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||
echo " seed: ${seed}"
|
||||
echo " target_account: ${target_account}"
|
||||
echo " target_global_consensus: ${target_global_consensus}"
|
||||
echo " params:"
|
||||
|
||||
local tmp_output_file=$(mktemp)
|
||||
address_to_account_id_bytes "$target_account" "${tmp_output_file}"
|
||||
local hex_encoded_data=$(cat $tmp_output_file)
|
||||
|
||||
local destination=$(jq --null-input \
|
||||
--arg target_global_consensus "$target_global_consensus" \
|
||||
--argjson hex_encoded_data "$hex_encoded_data" \
|
||||
'
|
||||
{
|
||||
"V3": {
|
||||
"parents": 2,
|
||||
"interior": {
|
||||
"X3": [
|
||||
{
|
||||
"GlobalConsensus": $target_global_consensus
|
||||
},
|
||||
{
|
||||
"Parachain": 1000
|
||||
},
|
||||
{
|
||||
"AccountId32": {
|
||||
"id": $hex_encoded_data
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
)
|
||||
|
||||
echo ""
|
||||
echo " destination:"
|
||||
echo "${destination}"
|
||||
echo " lane_id: ${lane_id}"
|
||||
echo " bridged_chain_id: ${bridged_chain_id}"
|
||||
echo " owner: ${owner}"
|
||||
echo ""
|
||||
|
||||
local rewards_account_params=$(jq --null-input \
|
||||
--arg lane_id "$lane_id" \
|
||||
--arg bridged_chain_id "$bridged_chain_id" \
|
||||
--arg owner "$owner" \
|
||||
'{
|
||||
"laneId": $lane_id,
|
||||
"bridgedChainId": $bridged_chain_id,
|
||||
"owner": $owner
|
||||
}')
|
||||
|
||||
echo " rewards_account_params:"
|
||||
echo "${rewards_account_params}"
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
polkadot-js-api \
|
||||
--ws "${url?}" \
|
||||
--ws "${runtime_para_endpoint}" \
|
||||
--seed "${seed?}" \
|
||||
tx.bridgeTransfer.pingViaBridge \
|
||||
"${destination}"
|
||||
tx.bridgeRelayers.claimRewards \
|
||||
"${rewards_account_params}"
|
||||
}
|
||||
|
||||
function init_ro_wo() {
|
||||
@@ -573,7 +482,7 @@ function run_relay() {
|
||||
--rococo-headers-to-bridge-hub-wococo-signer //Bob \
|
||||
--rococo-parachains-to-bridge-hub-wococo-signer //Bob \
|
||||
--bridge-hub-wococo-transactions-mortality 4 \
|
||||
--lane 00000001
|
||||
--lane "${LANE_ID}"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -582,93 +491,175 @@ case "$1" in
|
||||
init_wo_ro
|
||||
run_relay
|
||||
;;
|
||||
allow-transfers-local)
|
||||
# this allows send transfers on asset hub kusama local (by governance-like)
|
||||
./$0 "allow-transfer-on-asset-hub-kusama-local"
|
||||
# this allows receive transfers on asset hub westend local (by governance-like)
|
||||
./$0 "allow-transfer-on-asset-hub-westend-local"
|
||||
;;
|
||||
allow-transfer-on-asset-hub-kusama-local)
|
||||
init-asset-hub-rococo-local)
|
||||
ensure_polkadot_js_api
|
||||
allow_assets_transfer_send \
|
||||
# create foreign assets for native Wococo token (governance call on Rococo)
|
||||
force_create_foreign_asset \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9910" \
|
||||
1013 \
|
||||
"Wococo" 1000
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Wococo" } } }')" \
|
||||
"$GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT" \
|
||||
10000000000 \
|
||||
true
|
||||
# drip SA which holds reserves
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Alice" \
|
||||
"$GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT" \
|
||||
$((1000000000 + 50000000000 * 20))
|
||||
# HRMP
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1000 1013 4 524288
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1013 1000 4 524288
|
||||
;;
|
||||
allow-transfer-on-asset-hub-westend-local)
|
||||
init-bridge-hub-rococo-local)
|
||||
ensure_polkadot_js_api
|
||||
allow_assets_transfer_receive \
|
||||
# SA of sibling asset hub pays for the execution
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO" \
|
||||
$((1000000000 + 50000000000 * 20))
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain" \
|
||||
$((1000000000 + 2000000000000))
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain" \
|
||||
$((1000000000 + 2000000000000))
|
||||
;;
|
||||
init-asset-hub-wococo-local)
|
||||
ensure_polkadot_js_api
|
||||
# set Wococo flavor - set_storage with:
|
||||
# - `key` is `HexDisplay::from(&asset_hub_rococo_runtime::xcm_config::Flavor::key())`
|
||||
# - `value` is `HexDisplay::from(&asset_hub_rococo_runtime::RuntimeFlavor::Wococo.encode())`
|
||||
set_storage \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9010" \
|
||||
1014 \
|
||||
"Rococo" \
|
||||
1000
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
|
||||
$((1000000000 + 50000000000 * 20)) # ExistentialDeposit + maxTargetLocationFee * 20
|
||||
# create foreign assets for native Kusama token (yes, Kusama, because we are using Kusama Asset Hub runtime on rococo)
|
||||
"$(jq --null-input '[["0x48297505634037ef48c848c99c0b1f1b", "0x01"]]')"
|
||||
# create foreign assets for native Rococo token (governance call on Wococo)
|
||||
force_create_foreign_asset \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"Kusama" \
|
||||
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT"
|
||||
;;
|
||||
remove-assets-transfer-from-asset-hub-kusama-local)
|
||||
ensure_polkadot_js_api
|
||||
remove_assets_transfer_send \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"Wococo"
|
||||
;;
|
||||
transfer-asset-from-asset-hub-kusama-local)
|
||||
ensure_polkadot_js_api
|
||||
transfer_asset_via_bridge \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"$ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL" \
|
||||
"$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" \
|
||||
"Wococo"
|
||||
;;
|
||||
ping-via-bridge-from-asset-hub-kusama-local)
|
||||
ensure_polkadot_js_api
|
||||
ping_via_bridge \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"$ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL" \
|
||||
"$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" \
|
||||
"Wococo"
|
||||
;;
|
||||
transfer-asset-from-asset-hub-rococo)
|
||||
ensure_polkadot_js_api
|
||||
transfer_asset_via_bridge \
|
||||
"wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \
|
||||
"$ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
|
||||
"$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" \
|
||||
"Wococo"
|
||||
;;
|
||||
ping-via-bridge-from-asset-hub-rococo)
|
||||
ensure_polkadot_js_api
|
||||
ping_via_bridge \
|
||||
"wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \
|
||||
"${ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT}" \
|
||||
"$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" \
|
||||
"Wococo"
|
||||
;;
|
||||
drip)
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Rococo" } } }')" \
|
||||
"$GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT" \
|
||||
10000000000 \
|
||||
true
|
||||
# drip SA which holds reserves
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
|
||||
"$GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
|
||||
$((1000000000 + 50000000000 * 20))
|
||||
# HRMP
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1000 1014 4 524288
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1014 1000 4 524288
|
||||
;;
|
||||
init-bridge-hub-wococo-local)
|
||||
# set Wococo flavor - set_storage with:
|
||||
# - `key` is `HexDisplay::from(&bridge_hub_rococo_runtime::xcm_config::Flavor::key())`
|
||||
# - `value` is `HexDisplay::from(&bridge_hub_rococo_runtime::RuntimeFlavor::Wococo.encode())`
|
||||
set_storage \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1014 \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"$(jq --null-input '[["0x48297505634037ef48c848c99c0b1f1b", "0x01"]]')"
|
||||
# SA of sibling asset hub pays for the execution
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO" \
|
||||
$((1000000000 + 50000000000 * 20))
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain" \
|
||||
$((1000000000 + 2000000000000))
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain" \
|
||||
$((1000000000 + 2000000000000))
|
||||
;;
|
||||
reserve-transfer-assets-from-asset-hub-rococo-local)
|
||||
ensure_polkadot_js_api
|
||||
# send ROCs to Alice account on AHW
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Wococo" }, { "Parachain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } } } } }')" \
|
||||
"$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": 200000000000 } } ] }')" \
|
||||
0 \
|
||||
"Unlimited"
|
||||
;;
|
||||
reserve-transfer-assets-from-asset-hub-wococo-local)
|
||||
ensure_polkadot_js_api
|
||||
# send WOCs to Alice account on AHR
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Rococo" }, { "Parachain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } } } } }')" \
|
||||
"$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": 150000000000 } } ] }')" \
|
||||
0 \
|
||||
"Unlimited"
|
||||
;;
|
||||
claim-rewards-bridge-hub-rococo-local)
|
||||
ensure_polkadot_js_api
|
||||
# bhwo -> [62, 68, 77, 6f] -> 0x6268776f
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268776f" \
|
||||
"ThisChain"
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268776f" \
|
||||
"BridgedChain"
|
||||
;;
|
||||
claim-rewards-bridge-hub-wococo-local)
|
||||
# bhro -> [62, 68, 72, 6f] -> 0x6268726f
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268726f" \
|
||||
"ThisChain"
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268726f" \
|
||||
"BridgedChain"
|
||||
;;
|
||||
stop)
|
||||
pkill -f polkadot
|
||||
@@ -681,15 +672,14 @@ case "$1" in
|
||||
echo "A command is require. Supported commands for:
|
||||
Local (zombienet) run:
|
||||
- run-relay
|
||||
- allow-transfers-local
|
||||
- allow-transfer-on-asset-hub-kusama-local
|
||||
- allow-transfer-on-asset-hub-westend-local
|
||||
- remove-assets-transfer-from-asset-hub-kusama-local
|
||||
- transfer-asset-from-asset-hub-kusama-local
|
||||
- ping-via-bridge-from-asset-hub-kusama-local
|
||||
Live Rococo/Wococo run:
|
||||
- transfer-asset-from-asset-hub-rococo
|
||||
- ping-via-bridge-from-asset-hub-rococo";
|
||||
- init-asset-hub-rococo-local
|
||||
- init-bridge-hub-rococo-local
|
||||
- init-asset-hub-wococo-local
|
||||
- init-bridge-hub-wococo-local
|
||||
- reserve-transfer-assets-from-asset-hub-rococo-local
|
||||
- reserve-transfer-assets-from-asset-hub-wococo-local
|
||||
- claim-rewards-bridge-hub-rococo-local
|
||||
- claim-rewards-bridge-hub-wococo-local";
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -106,6 +106,20 @@ function forceCreateAsset(endpoint, outputFile, assetId, assetOwnerAccountId, is
|
||||
});
|
||||
}
|
||||
|
||||
function setStorage(endpoint, outputFile, items) {
|
||||
console.log(`Generating setStorage from RPC endpoint: ${endpoint} to outputFile: ${outputFile}, items: ${items}`);
|
||||
connect(endpoint)
|
||||
.then((api) => {
|
||||
const call = api.tx.system.setStorage(JSON.parse(items));
|
||||
writeHexEncodedBytesToOutput(call.method, outputFile);
|
||||
exit(0);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
if (!process.argv[2] || !process.argv[3]) {
|
||||
console.log("usage: node ./script/generate_hex_encoded_call <type> <endpoint> <output hex-encoded data file> <input message>");
|
||||
exit(1);
|
||||
@@ -140,6 +154,9 @@ switch (type) {
|
||||
case 'force-create-asset':
|
||||
forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
|
||||
break;
|
||||
case 'set-storage':
|
||||
setStorage(rpcEnpoint, output, inputArgs[0]);
|
||||
break;
|
||||
case 'check':
|
||||
console.log(`Checking nodejs installation, if you see this everything is ready!`);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user