MayaChain client

MayaChain client

Constants

xchainpy2_mayachain.const.AssetMAYA = ('MAYA', 'MAYA', '', AssetKind.NATIVE)

Asset object for the Maya token. Maya token collects fees in Cacao for its holders.

xchainpy2_mayachain.const.CACAO_DISPLAY_SYMBOL = 'C'

Display symbol for the Cacao token.

xchainpy2_mayachain.const.CACAO_DUST = 0.0001

Minimum non-zero Cacao amount to be sent in MRC20 and M-NFT transactions.

xchainpy2_mayachain.const.CACAO_TICKER = 'CACAO'

Ticker symbol for the Cacao token.

xchainpy2_mayachain.const.DEFAULT_CACAO_NETWORK_FEE = ((5000000000, 10), ('MAYA', 'CACAO', '', AssetKind.NATIVE))

Default Cacao fee for transactions. Subject to change.

xchainpy2_mayachain.const.DEFAULT_CHAIN_IDS = {NetworkType.MAINNET: 'mayachain-mainnet-v1', NetworkType.STAGENET: 'mayachain-stagenet-v1', NetworkType.TESTNET: 'deprecated'}

Default chain IDs for the Maya network. Subject to change.

xchainpy2_mayachain.const.DEFAULT_CLIENT_URLS = {NetworkType.MAINNET: ('https://mayanode.mayachain.info', 'https://tendermint.mayachain.info/'), NetworkType.STAGENET: ('https://stagenet.mayanode.mayachain.info', 'https://stagenet.mayachain.info/'), NetworkType.TESTNET: ('deprecated', 'deprecated')}

Default client URLs for the Maya network.

xchainpy2_mayachain.const.DEFAULT_EXPLORER_URL = 'https://explorer.mayachain.info{path}{network_tag}'

Default explorer URL for the Maya network.

xchainpy2_mayachain.const.DEFAULT_GAS_LIMIT_VALUE = 4000000

Default gas limit for transactions. Related to Cosmos SDK

xchainpy2_mayachain.const.DEFAULT_MAYA_EXPLORERS = {NetworkType.MAINNET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}'), NetworkType.STAGENET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}'), NetworkType.TESTNET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}')}

Explorer URLs for the Maya network.

xchainpy2_mayachain.const.DENOM_CACAO_NATIVE = 'cacao'

Cosmos denomination for the Cacao token.

xchainpy2_mayachain.const.DENOM_MAYA = 'maya'

Cosmos denomination for the Maya token.

xchainpy2_mayachain.const.DEPOSIT_GAS_LIMIT_VALUE = 600000000

Default gas limit for deposit transactions. Related to Cosmos SDK

xchainpy2_mayachain.const.FALLBACK_CLIENT_URLS = {NetworkType.MAINNET: [], NetworkType.STAGENET: [], NetworkType.TESTNET: []}

Fallback client URLs for the Maya network.

xchainpy2_mayachain.const.MAX_PAGES_PER_FUNCTION_CALL = 15

Maximum number of pages per function call.

xchainpy2_mayachain.const.MAX_TX_COUNT_PER_FUNCTION_CALL = 500

Maximum number of transactions per function call.

xchainpy2_mayachain.const.MAX_TX_COUNT_PER_PAGE = 100

Maximum number of transactions per page.

xchainpy2_mayachain.const.MAYANODE_PORT = 1317

API port for the Maya network.

xchainpy2_mayachain.const.MAYASCAN_EXPLORERS = {NetworkType.MAINNET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}'), NetworkType.STAGENET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}'), NetworkType.TESTNET: ('https://mayascan.org', 'https://mayascan.org/address/{address}', 'https://mayascan.org/tx/{tx_id}')}

Explorer URLs for the Maya network by MayaScan.

xchainpy2_mayachain.const.MAYASCAN_EXPLORER_URL = 'https://mayascan.org{path}'

Explorer URL for the Maya network by MayaScan.

xchainpy2_mayachain.const.MAYA_BLOCK_TIME_SEC = 6.0

The block time in seconds for the Maya network.

xchainpy2_mayachain.const.MAYA_DECIMAL = 4

Decimal places for the Maya token.

xchainpy2_mayachain.const.MAYA_LIQUIFY_MIDGARD_URL = 'https://midgard-maya.liquify.com'

Midgard URL for the Maya network by Liquify.

xchainpy2_mayachain.const.MAYA_LIQUIFY_NODE_URL = ('https://api-maya.liquify.com/', 'https://rpc-maya.liquify.com/')

MayaNode URL for the Maya network by Liquify.

xchainpy2_mayachain.const.ROOT_DERIVATION_PATH = "44'/931'/0'/0/"

Root derivation path of crypto-keys for the Maya network.

xchainpy2_mayachain.const.ROOT_DERIVATION_PATHS = {NetworkType.MAINNET: "44'/931'/0'/0/", NetworkType.STAGENET: "44'/931'/0'/0/", NetworkType.TESTNET: "44'/931'/0'/0/"}

Root derivation paths of crypto-keys for the Maya network.

xchainpy2_mayachain.const.RPC_PORTS = {NetworkType.MAINNET: 27147, NetworkType.STAGENET: 26657, NetworkType.TESTNET: 26657}

RPC ports for the Maya network.

xchainpy2_mayachain.const.make_client_urls_from_ip_address(ip_address: str, network=NetworkType.MAINNET, protocol='http')

Make client URLs from an IP address.

Parameters:
  • ip_address – IP address of MayaNode

  • network – Network type

  • protocol – Protocol to use HTTP or HTTPS

Returns:

dict of MayaNode URLs to pass to the client constructor

xchainpy2_mayachain.const.make_explorer_object(network_tag: str, base_url='https://mayascan.org{path}')

Make an explorer object.

Parameters:
  • network_tag – Query string to append to the base URL

  • base_url – Base URL of the explorer

Returns:

Explorer object

Models

class xchainpy2_mayachain.models.NodeURL(node, rpc)

Bases: NamedTuple

classmethod from_ip_address(ip_address: str, thornode_port: int, rpc_port: int, protocol='http')
node: str

Alias for field number 0

rpc: str

Alias for field number 1

Utils

MRC20 and M-NFT Memo

class xchainpy2_mayachain.mrc20.memo.MNFTMemo

Bases: object

MNFTMemo is a class that provides methods to generate memos for M-NFT transactions.

classmethod buy(symbol, token_id) str

Generate a memo for fulfilling an order to buy M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • token_id – Token identifier to buy

Returns:

Memo string

classmethod cancel(symbol, token_id) str

Generate a memo for cancelling a sell order for a M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • token_id – Token identifier to cancel

Returns:

Memo string

classmethod deploy_token(name, symbol, supply, base_url, pre_minted, minted_by_owner_only=None, mint_price=None) str

Generate a memo for deploying a new M-NFT token. https://docs.mayaprotocol.com/blockchain-explorer/mayascan/m-nfts

Parameters:
  • name – Name of the token 1-20 characters long

  • symbol – Symbol of the token

  • supply – Supply of the token 1-100000

  • base_url – Base URL for the token metadata

  • pre_minted – Whether the token is pre-minted

  • minted_by_owner_only – Whether the token can only be minted by the owner

  • mint_price – Price of minting a token in Cacao

Returns:

Memo string

classmethod mint(symbol, token_id=None) str

Generate a memo for minting a M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • token_id – Token identifier to mint

Returns:

Memo string

classmethod sell(symbol, token_id, price) str

Generate a memo for placing a sell order for a M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • token_id – Token identifier to sell

  • price – Sale price in Cacao

Returns:

Memo string

classmethod set_base_url(symbol, base_url) str

Generate a memo for setting the base URL of a M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • base_url – Base URL for the token metadata

Returns:

Memo string

classmethod transfer(symbol, token_id) str

Generate a memo for transferring M-NFT token. The token is transferred to the recipient address of the transaction.

Parameters:
  • symbol – M-NFT token symbol

  • token_id – Token identifier to transfer

Returns:

Memo string

classmethod update_mint_price(symbol, mint_price) str

Generate a memo for updating the mint price of a M-NFT token.

Parameters:
  • symbol – M-NFT token symbol

  • mint_price – Mint price in Cacao

Returns:

Memo string

static yes_no(value) str

Convert a boolean value to YES or NO string

Parameters:

value – any boolean-like value

Returns:

str

class xchainpy2_mayachain.mrc20.memo.MRC20Memo

Bases: object

MRC20Memo is a class that provides methods to generate memos for MRC20 transactions.

classmethod burn(ticker, amount) str

Generate a memo for burning a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to burn

Returns:

Memo string

classmethod buy(ticker, amount, tx_hash) str

Generate a memo for fulfilling a buy order for a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to buy

  • tx_hash – Transaction hash of the order to fulfill

Returns:

Memo string

classmethod cancel(ticker, tx_hash) str

Generate a memo for cancelling a MRC20 token sell order.

Parameters:
  • ticker – MRC20 token ticker

  • tx_hash – Transaction hash of the order to cancel

Returns:

Memo string

classmethod claim(ticker) str

Generate a memo for claiming staking rewards.

Parameters:

ticker – MRC20 token ticker

Returns:

Memo string

classmethod deploy_token(ticker, supply, mint_limit=None, mint_price=None) str

Generate a memo for deploying a MRC20 token.

Parameters:
  • ticker – The ticker of a new token

  • supply – Total supply of the token. See: Amount.auto

  • mint_limit – The maximum amount of tokens that can be minted. See: Amount.auto

  • mint_price – The price of minting a token in Cacao. See: Amount.auto

Returns:

Memo string

classmethod mint(ticker, amount, recipient=None) str

Generate a memo for minting a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to mint

  • recipient – Recipient of the minted tokens

Returns:

Memo string

classmethod sell(ticker, amount, price) str

Generate a memo for placing a sell order for a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to sell

  • price – Price per token in Cacao. See: AmountInitTypes

Returns:

Memo string

classmethod set_mint_price(ticker, mint_price) str

Generate a memo for setting the mint price of a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • mint_price – The price of minting a token in Cacao. See: AmountInitTypes

Returns:

Memo string

classmethod stake(ticker, amount) str

Generate a memo for staking a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to stake

Returns:

Memo string

classmethod transfer(ticker, amount) str

Generate a memo for transferring a MRC20 token.

Parameters:
  • ticker – MRC20 token ticker

  • amount – Amount to transfer

Returns:

Memo string

classmethod withdraw_stake(ticker) str

Generate a memo for withdrawing a staked MRC20 token.

Parameters:

ticker – MRC20 token ticker

Returns:

Memo string

xchainpy2_mayachain.mrc20.memo.check_ticker(ticker: Asset | str)

Check if the MRC20 ticker is valid.

Parameters:

ticker – Asset or str

Returns:

bool

xchainpy2_mayachain.mrc20.memo.get_amount(amount, zero_allowed=False)

Helper function to convert an amount to a string suitable for a memo.

Parameters:
  • amount – Amount or str

  • zero_allowed – if zero amounts are allowed

MRC20 and M-NFT API

xchainpy2_mayachain.mrc20.api.MAYANS_BASE_API = 'https://www.mayans.app/api/'

Base URL for the Mayans API

xchainpy2_mayachain.mrc20.api.MAYA_SCAN_BASE_API = 'https://www.MayaScan.org/api/'

Base URL for the MayaScan API

class xchainpy2_mayachain.mrc20.api.MayaScanClient(network: NetworkType = NetworkType.MAINNET, session=None)

Bases: object

Client for interacting with the MayaScan API See: https://www.mayascan.org/standards/api/docs

async close()

Close the aiohttp session if any

async get_all_nft_tokens() List[MNFTToken]

Get all M-NFT token collections information

Returns:

List[MNFTToken]

async get_all_tokens() List[MRC20Token]

Get all MRC20 token information

Returns:

List[MRC20Token]

async get_balance(address: str) List[MRC20Balance]

Get the MRC20 token balances of a specific address

Parameters:

address – MayaChain address

Returns:

async get_nft_balance(address: str, page=0) List[MNFTBalance]

Get the M-NFT balance of a specific address

Parameters:
  • address – MayaChain address

  • page – Page number to get, default is 0

Returns:

List[MNFTBalance]

async get_nft_collection(symbol: str) MNFTToken | None

Get a specific M-NFT token collection information

Parameters:

symbol – M-NFT collection symbol

Returns:

Optional[MNFTToken]

async get_nft_orderbook(symbol=None, page=0) List[MNFTOrder]

Get the M-NFT orderbook for a specific collection

Parameters:
  • symbol – M-NFT collection symbol

  • page – Page number to get, default is 0

Returns:

List[MNFTOrder]

async get_orderbook(ticker: Asset | str) List[MRC20Order]

Get the MRC20 token orderbook

Parameters:

ticker – MRC20 token ticker

Returns:

List[MRC20Order]

Return type:

List[MRC20Order]

async get_price(ticker: Asset | str) MRC20Price | None

Get the MRC20 token price (last trade price probably)

Parameters:

ticker – MRC20 token ticker

Returns:

Optional[MRC20Price]

async get_staking_balance(address: str, ticker: Asset | str) MRC20StakingBalance | None

Get the MRC20 token staking balance of a specific MayaChain address. None is returned if the address has no staking balance.

Parameters:
  • address – MayaChain address

  • ticker – MRC20 token ticker

Returns:

Optional[MRC20StakingBalance]

async get_staking_summary() List[MRC20StakingInfo]

Get the staking summary of MRC20 tokens

Returns:

List[MRC20StakingInfo]

async get_token(ticker: Asset | str) MRC20Token | None

Get a specific MRC20 token information

Parameters:

ticker – MRC20 token ticker

Returns:

Optional[MRC20Token]

url_all_tokens()

Get the URL to the whole MRC20 tokens list

Returns:

str

url_balance(address: str)

Get the URL for the MRC20 balance of a specific address

Parameters:

address – MayaChain address

Returns:

str

url_nft_all_tokens()

Get the URL for all NFT token collection

Returns:

str

url_nft_balance(address: str, page=0)

Get the URL for the NFT balance of a specific address

Parameters:
  • address – MayaChain address

  • page – Page number to get, default is 0

Returns:

str

url_nft_collection(symbol)

Get the URL for a specific NFT token collection

Parameters:

symbol – M-NFT symbol

Returns:

str

url_nft_orderbook(symbol=None, page=0)

Get the URL for the M-NFT orderbook for a specific collection

Parameters:
  • symbol – M-NFT collection symbol

  • page – Page number to get, default is 0

Returns:

str

url_orderbook(ticker: str)

Get the URL for the MRC20 orderbook of a specific token

Parameters:

ticker – Ticker of the token

Returns:

str

url_price(ticker: str)

Get the URL for the MRC20 price of a specific token

Parameters:

ticker – Ticker of the token

Returns:

str

url_staking()

Get the URL for the staking summary

Returns:

str

url_staking_balance(ticker: str, address: str)

Get the URL for the MRC20 token staking balance of a specific address

Parameters:
  • ticker – Ticker of the token

  • address – MayaChain address

Returns:

str

url_ticker(ticker: str)

Get the URL for a specific MRC20 token

Parameters:

ticker – Ticker of the token

Returns:

str

url_transactions(mtype: str | None = None, page=None)

Get the URL for the transactions endpoint

Parameters:
  • mtype – Type of transaction to filter by

  • page – Page number to get

Returns:

str

exception xchainpy2_mayachain.mrc20.api.MayaScanException(*args, code=200)

Bases: Exception

Exception raised when an error occurs in the MayaScanClient

property is_not_found

Check if the error is a 404 error

xchainpy2_mayachain.mrc20.api.logger = <Logger MayaScanClient (WARNING)>

Logger for the MayaScanClient

MRC20 and M-NFT Constants

xchainpy2_mayachain.mrc20.const.AssetGLD = ('MRC20', 'GLD', '', AssetKind.NATIVE)

Asset object for GLD

xchainpy2_mayachain.mrc20.const.MNFT_CHAIN = 'MNFT'

Special Chain identifier for MNFT assets on chain

xchainpy2_mayachain.mrc20.const.MRC20_CHAIN = 'MRC20'

Special Chain identifier for MRC20 assets on chain

xchainpy2_mayachain.mrc20.const.MRC20_DECIMALS = 10

The number of decimals for MRC20 tokens

class xchainpy2_mayachain.mrc20.const.SendsType

Bases: object

Enum for the type of MRC20 transactions

ALL = None
MNFT = 'M-NFT'
MRC20 = 'MRC-20'
MSG = 'MSG'
ORDERBOOK = 'ORDERBOOK'
PERPS = 'PERPS'
SEND = 'SEND'
STAKING = 'STAKING'
TALK = 'TALK'
xchainpy2_mayachain.mrc20.const.is_mnft(asset: Asset)

Check if the asset is a MNFT asset

Parameters:

asset – Asset

Returns:

bool

xchainpy2_mayachain.mrc20.const.is_mrc20(asset: Asset)

Check if the asset is a MRC20 asset

Parameters:

asset – Asset

Returns:

bool

xchainpy2_mayachain.mrc20.const.make_mnft_asset(symbol)

Create an Asset object from a MNFT symbol

Parameters:

symbol – Symbol of the asset

Returns:

Asset

xchainpy2_mayachain.mrc20.const.make_mrc20_asset(symbol)

Create an Asset object from a MRC20 symbol

Parameters:

symbol – Symbol of the asset

Returns:

Asset

MRC20 and M-NFT Models

class xchainpy2_mayachain.mrc20.model.MNFTBalance(symbol: str, ids: List[int], name: str, base_url: str)

Bases: NamedTuple

This class represents the balance of M-NFT tokens of an address.

base_url: str

Base URL of the token metadata

classmethod from_dict(d) MNFTBalance

Create a MNFTBalance object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MNFTBalance object

ids: List[int]

List of token IDs

name: str

Name of the token

symbol: str

Symbol of the token

class xchainpy2_mayachain.mrc20.model.MNFTOrder(hash: str, symbol: str, address: str, id: int, price: int, height: int, date: str)

Bases: NamedTuple

This class represents a sell order of a M-NFT token.

address: str

Seller address

date: str

Date string of the sell order transaction

classmethod from_api(resp)
classmethod from_dict(d)
hash: str

Hash of the sell order transaction

height: int

Block height of the sell order transaction

id: int

Token ID

price: int

Price of the token in Cacao

symbol: str

Symbol of the token

class xchainpy2_mayachain.mrc20.model.MNFTToken(symbol: str, hash: str, height: int, name: str, supply: int, base_url: str, pre_minted: bool, minted_by_owner_only: bool, mint_price: int, owner: str, date: str, listed: bool, minted: int, listed_for_sale: int, floor_price: int, volume_transfer: int, volume_mint: int, volume_buy: int, volume_sell: int, volume_transfer_cacao: int, volume_mint_cacao: int, volume_buy_cacao: int, volume_sell_cacao: int, holders: int, holders_balance: int)

Bases: NamedTuple

M-NFT token description

base_url: str

Base URL of the token metadata

date: str

Date when the token was created

floor_price: int

Floor price of the token

classmethod from_api(resp) List[MNFTToken]

Create a list of MNFTToken objects from an API response.

Parameters:

resp – Response from the Maya API

Returns:

List of MNFTToken objects

Return type:

List[MNFTToken]

classmethod from_dict(d) MNFTToken

Create a MNFTToken object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MNFTToken object

hash: str

Hash of the token

height: int

Block height where the token was created

holders: int

Number of token holders

holders_balance: int

Total balance of the token holders

listed: bool

Whether the token is listed or not

listed_for_sale: int

Total amount of the token that has been listed for sale

mint_price: int

Price of minting the token

minted: int

Total amount of the token that has been minted so far

minted_by_owner_only: bool

Whether the token can be minted by the owner only

name: str

Name of the token

owner: str

Address of the token owner

pre_minted: bool

Whether the token is pre-minted or not

supply: int

Total supply of the token

symbol: str

Symbol of the token

volume_buy: int

Volume of the token bought

volume_buy_cacao: int

Volume of the token bought in Cacao

volume_mint: int

Volume of the token minted

volume_mint_cacao: int

Volume of the token minted in Cacao

volume_sell: int

Volume of the token sold

volume_sell_cacao: int

Volume of the token sold in Cacao

volume_transfer: int

Volume of the token transferred

volume_transfer_cacao: int

Volume of the token transferred in Cacao

class xchainpy2_mayachain.mrc20.model.MRC20Balance(ticker: str, balance: int, balance_for_sale: int, balance_staked: int, name: str, logo: str, logo_full_path: str, price_in_cacao: float, price_in_usd: float, decimals: int)

Bases: NamedTuple

This class represents the balance of a MRC20 token

balance: int

Balance of the token

balance_for_sale: int

Balance of the token that is available for sale

balance_staked: int

Balance of the token that is staked

decimals: int

Number of decimals places for the token

classmethod from_dict(d) MRC20Balance

Create a MRC20Balance object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MRC20Balance object

URL of the token logo

logo_full_path: str

Full path of the token logo

name: str

Name of the token

price_in_cacao: float

Price of the token in Cacao

price_in_usd: float

Price of the token in USD

ticker: str

MRC20 token ticker

class xchainpy2_mayachain.mrc20.model.MRC20Order(hash: str, ticker: str, address: str, balance: int, price: int, height: int, date: str, sellers_balance_remaining: int)

Bases: NamedTuple

This class represents a sell order of a MRC20 token.

address: str

Seller address

balance: int

Balance of the token

date: str

Date string of the sell order transaction

classmethod from_api(resp) List[MRC20Order]

Create a list of MRC20Order objects from an API response.

Parameters:

resp – Maya API response

Returns:

List of MRC20Order objects

Return type:

List[MRC20Order]

classmethod from_dict(d) MRC20Order

Create a MRC20Order object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MRC20Order object

hash: str

Hash of the sell order transaction

height: int

Block height of the sell order transaction

price: int

Price of the token in Cacao

sellers_balance_remaining: int

Remaining balance of the order

ticker: str

Symbol of the MRC20 token

class xchainpy2_mayachain.mrc20.model.MRC20Price(ticker: str, price_in_cacao: float, price_in_usd: float, decimals: int)

Bases: NamedTuple

This class represents the price of a MRC20 token.

decimals: int

Number of decimals places for the token

classmethod from_dict(d) MRC20Price

Create a MRC20Price object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MRC20Price object

price_in_cacao: float

Price of the token in Cacao

price_in_usd: float

Price of the token in USD

ticker: str

MRC20 token ticker

class xchainpy2_mayachain.mrc20.model.MRC20StakingBalance(added: int, claimed: int, claimable: float)

Bases: NamedTuple

This class represents the staking balance of a MRC20 token.

added: int

Amount of the token that was added to the staking pool

claimable: float

Amount of the token that can be claimed

claimed: int

Amount of the token that has been claimed so far

classmethod from_dict(d) MRC20StakingBalance

Create a MRC20StakingBalance object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MRC20StakingBalance object

class xchainpy2_mayachain.mrc20.model.MRC20StakingInfo(ticker: str, pool: int, apr: float, stakers: int, staked: int, claimed: int)

Bases: NamedTuple

This class represents the staking information of a MRC20 token.

apr: float

Annual Percentage Rate of the token staking pool

claimed: int

Amount of the staking rewards that has been claimed from the staking pool

classmethod from_dict(d) MRC20StakingInfo

Create a MRC20StakingInfo object from a dictionary.

Parameters:

d – Input dictionary

Returns:

MRC20StakingInfo object

pool: int

Amount of the token in the staking pool

staked: int

Amount of the token staked in the staking pool

stakers: int

Number of stakers in the staking pool

ticker: str

MRC20 token ticker

class xchainpy2_mayachain.mrc20.model.MRC20Token(ticker: str, hash: str, height: int, supply: int, minted: int, burnt: int, owner: str, memo: str, date: str, listed: bool, max_mint_per_address: int, mint_price_per_token: int, name: str, description: str, logo: str, volume_transfer: int, volume_mint: int, volume_buy: int, volume_sell: int, volume_transfer_cacao: int, volume_mint_cacao: int, volume_buy_cacao: int, volume_sell_cacao: int, holders: int, holders_balance: int)

Bases: NamedTuple

This class represents a MRC20 token description.

burnt: int

Total amount of the token that has been burnt so far

date: str

Date when the token was created

description: str

Description of the token

classmethod from_api(resp) List[MRC20Token]

Create a list of MRC20Token objects from an API response.

Parameters:

resp – Response from the Maya API

Returns:

List of MRC20Token objects

classmethod from_dict(d)
hash: str

Token hash. Not sure what this is for

height: int

Block height, where the token was created

holders: int

Number of token holders

holders_balance: int

Total balance of the token holders

listed: bool

Whether the token is listed or not

URL of the token logo

max_mint_per_address: int

Maximum amount of the token that can be minted per address

memo: str

Memo of the token. Not sure what this is for

mint_price_per_token: int

Price of minting the token per token

minted: int

Total amount of the token that has been minted so far

name: str

Name of the token

owner: str

Maya address of the token owner

supply: int

Total supply of the token

ticker: str

Token ticker

volume_buy: int

Volume of the token bought

volume_buy_cacao: int

Volume of the token bought in Cacao

volume_mint: int

Volume of the token minted

volume_mint_cacao: int

Volume of the token minted in Cacao

volume_sell: int

Volume of the token sold

volume_sell_cacao: int

Volume of the token sold in Cacao

volume_transfer: int

Volume of the token transferred

volume_transfer_cacao: int

Volume of the token transferred in Cacao

class xchainpy2_mayachain.mrc20.model.SendAction(hash: str, height: int, from_: str, to: str, asset: str, amount: str, memo: str, date: str)

Bases: NamedTuple

This class represents a send action of MRC20 tokens.

amount: str

Amount of the asset that was sent

asset: str

Asset ticker

date: str

Date string of the send action transaction

from_: str

Sender address

classmethod from_dict(d) SendAction

Create a SendAction object from a dictionary.

Parameters:

d – Input dictionary

Returns:

SendAction object

hash: str

Hash of the send action transaction

height: int

Block height of the send action transaction

memo: str

Memo of the send action transaction

to: str

Receiver address

class xchainpy2_mayachain.mrc20.model.SendActionResponse(total: int, actions: List[SendAction])

Bases: NamedTuple

This class represents the response of a send action of MRC20 tokens.

actions: List[SendAction]

List of send actions in the response

classmethod from_response(d) SendActionResponse

Create a SendActionResponse object from a response dictionary.

Parameters:

d – Input dictionary

Returns:

SendActionResponse object

total: int

Total number of send actions in the response

MRC20 and M-NFT Utils

xchainpy2_mayachain.mrc20.utils.build_url(base_url, params: dict) str

Build a URL from a base URL and a dictionary of parameters.

Parameters:
  • base_url – Base URL

  • params – A dictionary of parameters

Returns:

full URL