Skip to content

metasv/metasv-mvc-sdk-python

Repository files navigation

mvcapi-sdk

API definition for MicrovisionChain provided apis

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 3.0.8
  • Package version: 3.0.8
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import mvcapi-sdk

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import mvcapi-sdk

Getting Started

Please follow the installation procedure and then run the following:

import time
import mvcapi-sdk
from pprint import pprint
from mvcapi-sdk.api import address_api
from mvcapi-sdk.model.address_balance import AddressBalance
from mvcapi-sdk.model.address_tx import AddressTx
from mvcapi-sdk.model.address_utxo import AddressUtxo
# Defining the host is optional and defaults to https://testnet.mvcapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = mvcapi-sdk.Configuration(
    host = "https://testnet.mvcapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (JWT): bearerAuth
configuration = mvcapi-sdk.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with mvcapi-sdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = address_api.AddressApi(api_client)
    address = "address_example" # str | the requested address

    try:
        # Get address balance by specific address.
        api_response = api_instance.address_address_balance_get(address)
        pprint(api_response)
    except mvcapi-sdk.ApiException as e:
        print("Exception when calling AddressApi->address_address_balance_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://testnet.mvcapi.com

Class Method HTTP request Description
AddressApi address_address_balance_get GET /address/{address}/balance Get address balance by specific address.
AddressApi address_address_tx_get GET /address/{address}/tx Get address history by specific address(recent 10 days available).
AddressApi address_address_utxo_get GET /address/{address}/utxo Get address utxos by specific address(100 per page).
BlockApi block_block_id_get GET /block/{blockId} Get block request by height or hash
BlockApi block_get GET /block Get recent block list by paging. 30 items per page.
BlockApi block_info_get GET /block/info Get current blockchain info from full node.
ContractApi contract_ft_address_address_balance_confirmed_get GET /contract/ft/address/{address}/balance/confirmed Get all contract token balances for specific address ignoring all unconfirmed txs.
ContractApi contract_ft_address_address_balance_get GET /contract/ft/address/{address}/balance Get all contract token balances for specific address.
ContractApi contract_ft_address_address_code_hash_genesis_tx_get GET /contract/ft/address/{address}/{codeHash}/{genesis}/tx Get all contract token balances for specific address.
ContractApi contract_ft_address_address_utxo_get GET /contract/ft/address/{address}/utxo Get all contract token utxos for specific address.
ContractApi contract_nft_address_address_count_confirmed_get GET /contract/nft/address/{address}/count/confirmed Get confirmed utxo count for specific nft(ignore all unconfirmed txs).
ContractApi contract_nft_address_address_summary_get GET /contract/nft/address/{address}/summary Get nft summary(NFT count group by genesis) for address.
ContractApi contract_nft_address_address_utxo_get GET /contract/nft/address/{address}/utxo Get all contract nft token utxos for specific address.
ContractApi contract_nft_genesis_code_hash_genesis_summary_get GET /contract/nft/genesis/{codeHash}/{genesis}/summary Get nft summary(count group by address) for specific codeHash and genesisId(result cached for 60s).
ContractApi contract_nft_genesis_code_hash_genesis_utxo_get GET /contract/nft/genesis/{codeHash}/{genesis}/utxo Get all contract nft token utxos by codeHash and genesisId.
ContractApi contract_nft_sell_address_address_utxo_get GET /contract/nft/sell/address/{address}/utxo Get all contract sell sell utxos for specific address.
ContractApi contract_nft_sell_genesis_code_hash_genesis_utxo_get GET /contract/nft/sell/genesis/{codeHash}/{genesis}/utxo Get all contract nft token utxos by codeHash and genesisId.
ContractApi contract_unique_genesis_code_hash_genesis_utxo_get GET /contract/unique/genesis/{codeHash}/{genesis}/utxo Get contract unique utxos by codeHash and genesisId.
MerchantApi merchant_utxo_post POST /merchant/utxo Pick utxos by addresses and amount.
OutpointApi outpoint_txid_index_get GET /outpoint/{txid}/{index} Get tx output(outpoint for vin) spent status.
TreasuryApi treasury_get GET /treasury Get current treasury info.
TreasuryApi treasury_history_get GET /treasury/history Get all treasury history.
TxApi tx_broadcast_batch_post POST /tx/broadcast/batch Broadcast a batch of tx to MvcApi fullnode. This endpoint use rpc sendrawtransactions.
TxApi tx_broadcast_post POST /tx/broadcast Broadcast tx to MvcApi fullnode.
TxApi tx_txid_get GET /tx/{txid} Get transaction detail by specific txid.
TxApi tx_txid_raw_get GET /tx/{txid}/raw Get transaction raw hex by specific txid.
TxApi tx_txid_seen_get GET /tx/{txid}/seen Whether MvcApi have seen this tx before. This is a fast approach to know if the tx exist or not.
TxApi vin_txid_detail_get GET /vin/{txid}/detail Get all output point of vins in the tx with detailed output script.
XpubApi xpub_lite_xpub_address_address_get GET /xpubLite/{xpub}/address/{address} Get xpub address type and index. Only index under /0/70 /1/30 is valid. Otherwise not found.
XpubApi xpub_lite_xpub_balance_get GET /xpubLite/{xpub}/balance Get xpub balances including confirmed and unconfirmed.
XpubApi xpub_lite_xpub_utxo_get GET /xpubLite/{xpub}/utxo Get xpub utxos by specific xpub(300 per page).

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: Bearer authentication (JWT)

Author

[email protected]

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in mvcapi-sdk.apis and mvcapi-sdk.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from mvcapi-sdk.api.default_api import DefaultApi
  • from mvcapi-sdk.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import mvcapi-sdk
from mvcapi-sdk.apis import *
from mvcapi-sdk.models import *

About

Python client to access metasv mvc apis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published