XcmTools
Scripts related to XCM for Moonbeam/Moonriver
Install / Use
/learn @albertov19/XcmToolsREADME
xcmTools
Different set of tools with the Polkadot API.
Use at your own risk!
Getting Started
Install packages:
yarn
Then, run script with ts-node depending on the file
Scripts
calculateLocalAssetInfo --w <"ws_endpoint"> --a <"asset"> calculates the storage key element, XC-20 address and Asset ID of a given asset. Need to provide the ws provider (--w) and the local asset counter (--a)
calculateMultilocationDerivative --w <"ws_endpoint"> --a <"address"> --p <"para-id"> calculates the multilocaiton-derived address for remote calls through XCM. Need to provide the ws provider (--w) of the target parachain, the address (--a) of the origin account, and the parachain id (--p) of the origin parachain
calculateMultilocationInfo --n <"network"> --a <"asset"> calculates the storage key element, XC-20 address and Asset ID of a given asset. Need to provide the network (Moonbeam, Moonriver, Moonbase) (--n) and the asset multilocation (--a)
calculateSovereignAddress --r <"polkadot/kusama/moonbase"> --paraid <"para-id"> prints the sovereign account of a given parachain Id for the relay chain, and for other parachains. Need to provide the relay to use (--r either polkadot, kusama or moonbase) and the parachain id
calculateUnitsPerSeconds --a <"asset name kusama/karura/kintsugi"> --d <"decimals"> --xwc <"TotalXCMWeightCost"> --price <"asset-price"> --t <"TargetPrioce"> simple tool to calculate the units per second to be charged for a given target price (0.02$ per XCM transfer). Target price can also be configured with --t. It uses the CoinGecko API to fetch the token price, although it can be overwritten with --price flag. You need to provide the asset name as supported by CoinGecko (flag --aset or --a), the decimals (flag --decimals or -d), there are other inputs that are optional like the cost of each XCM instruction (--xcm-op-cost or --xoc), by default set to 200M weight units per instruction (Moonbeam & Moonriver)
calculateBatchUnitsPerSeconds --n <"network moonbeam/moonriver"> script to calculate the batched encoded call data to set the units per second for XCM msgs for all supported types. It wil read the asset information from the assets.json file that needs to be manually updated. It uses the CoinGecko API to fetch the token price, although it can be overwritten with a price key and value in the .json file. Check calculateUnitsPerSeconds for more help.
fetchAssets --w <"ws_endpoint"> gets a list of XC-20 assets in the given network. Returns the name, symbol, decimals and token's precompile address. Need to provide the ws provider (--w)
Related Skills
node-connect
349.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.7kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
