Giter Site home page Giter Site logo

xcmtools's Introduction

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)

xcmtools's People

Contributors

albertov19 avatar wuzhong-papermoon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.