Maya Protocol One-Stop-Shop
  • Introduction
    • 🍫What is Maya Protocol?
      • Getting Started
      • Roles
        • Liquidity Providers
        • Swappers
        • Arbitrageurs
        • Node Operators
      • Maya Protocol Native Assets
    • 🌐Maya Ecosystem
      • User interfaces & Wallets
      • Tools
    • 🍫How to buy CACAO?
    • πŸ›£οΈRoadmap 2025
  • Deep Dive
    • πŸšΆβ€β™‚οΈStep-by-Step Guides
      • Set up a MAYAChain wallet
        • Using El Dorito Club
        • Using THORWallet web APP
        • Using THORWallet Mobile APP
        • Through MAYANode cli
        • By importing Ledger hard wallet into Ctrl Wallet
      • Custom Memos
        • Swap
        • Add Liquidity
        • Withdraw Liquidity
    • πŸ› οΈHow It Works
      • Technology
      • Incentive Curve
      • Fees
      • Governance
      • Constants and Mimir
      • Security
      • Dynamic Inflation
      • Liquidity Nodes
      • Impermanent Loss Protection (ILP)
      • ELI5
        • What is Threshold Signature Scheme (TSS)?
    • πŸ’΅DeFi Products
      • Synthetics
      • Liquidity
    • πŸ”Audits
    • 🎭Maya Masks
    • ❓FAQs
  • Blockchain Explorer
    • πŸ”ŽMayaScan
      • πŸͺ™MRC-20 Tokens
      • πŸ–ΌοΈM-NFTS
  • Airdrop
    • πŸͺ‚$MAYA Airdrops Guide
  • Media
    • πŸ“½οΈAaluxx Interviews
    • 🐦Twitter Spaces
    • πŸ”—Links
  • Contribute
    • 😎Ambassador Program
    • 🎨Content Creators Guide
  • Node Docs
    • πŸ–₯️MAYANodes
      • MAYANode Overview
      • Cluster Launcher
        • Setup - Linode
        • Setup - Azure
        • Setup - Hetzner Bare Metal
        • Setup - Google Cloud
        • Setup - HCloud
        • Setup - Digital Ocean
        • Setup - AWS
      • Deploying
      • Joining
      • Managing
      • Pooled MAYANodes
      • Alerting
      • Leaving
      • πŸ›‘Emergency Procedures
      • βœ”οΈ CHECKLIST
      • Multi-node Deployment
      • Fullnode Installation Guide
    • Bonding & Unbonding Guide
    • Bare Metal Node Guides
  • MAYACHAIN DEV DOCS
    • Introduction
      • MAYAName Guide
      • Swapping Guide
        • Quickstart Guide
        • Fees and Wait Times
        • Streaming Swaps
      • Add MAYAChain to your Wallet
    • Examples
      • Tutorials
      • Typescript (XChainJS) WIP
        • Query Package
        • AMM Package
        • Client Packages
        • Packages Breakdown
        • Coding Guide
      • SwapKit SDK
    • Concepts
      • Connecting to MAYAChain
      • Querying MAYAChain
      • Transaction Memos
      • Asset Notation
      • Memo Length Reduction
      • Network Halts
      • Fees
      • Delays
      • Sending Transactions
      • Math
    • Aggregators
      • Memos
      • EVM Implementation
    • CLI
      • Multisig
      • Offline Ledger Support
    • Protocol Development
      • Adding New Chains
      • Chain Clients
        • UTXO
        • EVM Chains
        • Cosmos Chains
      • ERC-20 Tokens
      • THORChain Version Updates I
      • THORChain Version Updates II
  • White Paper
    • πŸ“–Maya Whitepaper 2.0
      • Introduction
      • 🍫Fair Launch
        • Philosophical perspective FL
        • Economic overview FL
        • Technical overview FL
      • πŸͺ™$MAYA token
        • Philosophical perspective MT
        • Economic overview MT
        • Technical overview MT
      • 🌊Liquidity Nodes
        • Philosophical perspective LN
        • Economic overview LN
        • Technical overview LN
      • πŸ”’Security Nodes
        • Philosophical perspective SN
        • Economic overview SN
        • Technical overview SN
      • πŸ”΄Aztec Chain & $AZTEC token
        • Philosophical perspective AC
        • Economic overview AC
        • Technical overview AC
      • βš–οΈStable Pools & Route Optimization
        • Philosophical perspective RO
        • Economic overview RO
        • Technical overview RO
      • πŸ‘£Roadmap. Maya 3.0
        • Philosophical perspective 3.0
        • Economic overview 3.0
        • Technical overview 3.0
  • Website
  • GitLab
  • Archive
    • Liquidity Auction
    • THORChads Airdrop
    • Add ETH, USDC, or USDT through THORWallet using Metamask + Ledger
    • $MAYA Airdrop for Maya Mask Holders
    • Maya Integration Guide
    • Roadmap 2023
Powered by GitBook

Social Media

  • Twitter
  • Telegram
  • Discord
On this page
  • Getting the Asgard Vault
  • Displaying available pairs
  • Decimals and Base Units
  • Finding Chain Status

Was this helpful?

Export as PDF
  1. MAYACHAIN DEV DOCS
  2. Concepts

Querying MAYAChain

How to Query MAYAChain

PreviousConnecting to MAYAChainNextTransaction Memos

Last updated 3 months ago

Was this helpful?

Getting the Asgard Vault

Vaults are fetched from the /inbound_addresses :

You need to select the address of the Chain the inbound transaction will go to.

The address will be the current active Asgard Address that accepts inbounds. Do not cache these address as they change regularly. Do not delay inbound transactions (e.g. do not use future timeLocks).

Example Output, each connected chain will be displayed.

[
  {
		"address": "bc1qqtemwlu9ju3ts3da5l82qejnzdl3xfs3lcl4wg",
		"chain": "BTC",
		"chain_lp_actions_paused": false,
		"chain_trading_paused": false,
		"gas_rate": "390",
		"gas_rate_units": "satsperbyte",
		"global_trading_paused": false,
		"halted": false,
		"outbound_fee": "390000",
		"outbound_tx_size": "1000",
		"pub_key": "mayapub1addwnpepqvz6vkw4nzcp5sl9ktx63kz7v0n754r99uehfnzv42eauc644yzgvmuun3k"
	},
      ...

Never cache vault addresses, they churn regularly.

Inbound transactions should not be delayed for any reason else there is risk funds will be sent to an unreachable address. Use standard transactions, check the inbound address before sending and use the recommended gas rate to ensure transactions are confirmed in the next block to the latest Inbound_Address.

Check for the halted parameter and never send funds if it is set to true

If a chain has a router on the inbound address endpoint, then everything must be deposited via the router. The router is a contract that the user first approves, and the deposit call transfers the asset into the network and emits an event to THORChain.

This is done because "tokens" on protocols don't support memos on-chain, thus need to be wrapped by a router which can force a memo.

Note: you can transfer the base asset, eg ETH, directly to the address and skip the router, but it is recommended to deposit everything via the router.

{
		"address": "0x87a8d8abd8086173e2f15a90a1938d8077e02ecb",
		"chain": "ETH",
		"chain_lp_actions_paused": false,
		"chain_trading_paused": false,
		"gas_rate": "100",
		"gas_rate_units": "gwei",
		"global_trading_paused": false,
		"halted": false,
		"outbound_fee": "840000",
		"outbound_tx_size": "80000",
		"pub_key": "mayapub1addwnpepqvz6vkw4nzcp5sl9ktx63kz7v0n754r99uehfnzv42eauc644yzgvmuun3k",
		"router": "0xe3985E6b61b814F7Cdb188766562ba71b446B46d"
	},
  • Chain: Chain Name

  • Address: Asgard Vault inbound address for that chain.,

  • Halted: Boolean, if the chain is halted. This should be monitored.

  • gas_rate: rate to be used, e.g. in Stats or GWei. See Fees.

Displaying available pairs

{
		"annualPercentageRate": "0.1653348126078579",
		"asset": "KUJI.KUJI",
		"assetDepth": "22781179322318",
		"assetPrice": "3.621027920713548",
		"assetPriceUSD": "3.498740619649093",
		"liquidityUnits": "5385277119677037",
		"poolAPY": "0.1653348126078579",
		"runeDepth": "8249128639289561",
		"status": "available",
		"synthSupply": "31040367",
		"synthUnits": "3668841935",
		"units": "5385280788518972",
		"volume24h": "561310885869971"
	}

Only pools with "status": "available" are available to trade

Make sure to manually add Native $CACAO as a swappable asset.

"assetPrice" tells you the asset's price in CACAO (RUNE Depth/AssetDepth ). In the above example

1 KUJI.KUJI = 3.62 RUNE

Decimals and Base Units

All values on MAYAChain (MAYANode and Midgard) are given in 1e8 eg, 100000000 base units (like Bitcoin), and unless postpended by "USD", they are in units of RUNE. Even 1e18 assets, such as ETH.ETH, are shortened to 1e8. 1e6 Assets like ETH.USDC, are padded to 1e8. MAYANode will tell you the decimals for each asset, giving you the opportunity to convert back to native units in your interface.

Finding Chain Status

There are two ways to see if a Chain is halted.

If you connect to a public Midgard, you must be conscious of the fact that you can be phished and could send money to the WRONG vault. You should do safety checks, i.e. comparing with other nodes, or even inspecting the vault itself for the presence of funds. You should also consider running your own '' instance to query for trusted data.

Use the /pools of Midgard to retrieve all swappable assets on MAYAChain. The response will be an array of objects like this:

See code examples using the MAYAChain xchain package here

Looking at the /inbound_addresses and inspecting the halted flag.

Looking at Mimir and inspecting the HALT[Chain]TRADING setting. See for more details.

https://mayanode.mayachain.info/mayachain/inbound_addresses
fullnode
endpoint
https://github.com/xchainjs/xchainjs-lib/tree/master/packages/xchain-mayachain
endpoint
Network Halts