mainnet
A developer friendly bitcoin cash wallet api
This API is currently in active development, breaking changes may be made prior to official release of version 1.0.0.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.10
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements.
Python 2.7 and 3.4+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/mainnet-cash/mainnet-python-generated.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/mainnet-cash/mainnet-python-generated.git
)
Then import the package:
import mainnet
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 mainnet
Getting Started
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import mainnet
from mainnet.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://rest-unstable.mainnet.cash
# See configuration.py for a list of all supported configuration parameters.
configuration = mainnet.Configuration(
host = "https://rest-unstable.mainnet.cash"
)
# 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: bearerAuth
configuration = mainnet.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with mainnet.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = mainnet.ContractApi(api_client)
contract_fn_request = {"contractId":"testnet:TURNME1UQmxaakEwT0dJelpHRXpOVEUzT1RObU5tVmtNVFJqWXpKbVpHVTBOakJpWldOak5XSTJOVGhrT1RFek9EUTBNMkk1WVRNd01EQTNNRGRoTm1FMzpNRE0wT1RjNFlXTTBOalJtTXpVNFlqSXpOV1l4TVRJeE1tVmlObVV3TVRkaFpqa3dNakUxWWprd1lqRm1aamMwTnpGa09XRmxNbUZpWWpWbE1Ea3lOak5pOk1qRTE=:Y29udHJhY3QgVHJhbnNmZXJXaXRoVGltZW91dChwdWJrZXkgc2VuZGVyLCBwdWJrZXkgcmVjaXBpZW50LCBpbnQgdGltZW91dCkgewogICAgZnVuY3Rpb24gdHJhbnNmZXIoc2lnIHJlY2lwaWVudFNpZykgewogICAgICAgIHJlcXVpcmUoY2hlY2tTaWcocmVjaXBpZW50U2lnLCByZWNpcGllbnQpKTsKICAgIH0KCiAgICBmdW5jdGlvbiB0aW1lb3V0KHNpZyBzZW5kZXJTaWcpIHsKICAgICAgICByZXF1aXJlKGNoZWNrU2lnKHNlbmRlclNpZywgc2VuZGVyKSk7CiAgICAgICAgcmVxdWlyZSh0eC50aW1lID49IHRpbWVvdXQpOwogICAgfQp9Cg==:1996128042","action":"send","function":"timeout","to":{"unit":"sat","cashaddr":"bchtest:qpalhxhl05mlhms3ys43u76rn0ttdv3qg2usm4nm7t","value":2000},"feePerByte":1} # ContractFnRequest | Request a new cashscript contract
try:
# Call a method on a contract
api_response = api_instance.contract_fn(contract_fn_request)
pprint(api_response)
except ApiException as e:
print("Exception when calling ContractApi->contract_fn: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://rest-unstable.mainnet.cash
Class | Method | HTTP request | Description |
---|---|---|---|
ContractApi | contract_fn | POST /contract/call | Call a method on a contract |
ContractApi | contract_info | POST /contract/info | Get information about a contract from the contractId |
ContractApi | contract_utxos | POST /contract/utxos | List specific utxos on any contract |
ContractApi | create_contract | POST /contract/create | Create a cashscript contract |
ContractEscrowApi | create_escrow | POST /contract/escrow/create | Create an escrow contract |
ContractEscrowApi | escrow_fn | POST /contract/escrow/call | Finalize an escrow contract |
ContractEscrowApi | escrow_info | POST /contract/escrow/info | Get information about an escrow contract from the escrowContractId |
ContractEscrowApi | escrow_utxos | POST /contract/escrow/utxos | List specific utxos on any escrow contract |
FaucetApi | get_addresses | POST /faucet/get_addresses | Get addresses to return back or donate the testnet bch and tokens |
FaucetApi | get_testnet_bch | POST /faucet/get_testnet_bch | Get testnet bch |
FaucetApi | get_testnet_sbch | POST /faucet/get_testnet_sbch | Request testnet SmartBCH funds. The request is enqueued and served within 1-3 block confirmations. If the target address holds more that 0.1 BCH, the request will fail. Otherwise the address will be topped up to 0.1 BCH. |
FaucetApi | get_testnet_sep20 | POST /faucet/get_testnet_sep20 | Request testnet SmartBch SEP20 tokens. The request is enqueued and served within 1-3 block confirmations. If the target address holds more that 10 tokens of requested kind, the request will fail. Otherwise the address will be topped up to 10 tokens. |
FaucetApi | get_testnet_slp | POST /faucet/get_testnet_slp | Get testnet slp tokens |
MineApi | mine | POST /mine | Mine regtest coins to a specified address |
SmartbchContractApi | smart_bch_contract_call | POST /smartbch/contract/call | Call a SmartBch contract function |
SmartbchContractApi | smart_bch_contract_create | POST /smartbch/contract/create | Create a SmartBch contractId |
SmartbchContractApi | smart_bch_contract_deploy | POST /smartbch/contract/deploy | Request to deploy a SmartBch contract |
SmartbchContractApi | smart_bch_contract_estimate_gas | POST /smartbch/contract/estimate_gas | Estimate the gas for a contract interaction function given the arguments |
SmartbchContractApi | smart_bch_contract_info | POST /smartbch/contract/info | Get information about a SmartBch contract from the contractId |
SmartbchSep20Api | smart_bch_sep20_all_balances | POST /smartbch/sep20/all_balances | Get all SmartBch SEP20 balances of the wallet |
SmartbchSep20Api | smart_bch_sep20_balance | POST /smartbch/sep20/balance | Get total SmartBch SEP20 token balance of the wallet |
SmartbchSep20Api | smart_bch_sep20_deposit_address | POST /smartbch/sep20/deposit_address | Get an SmartBch SEP20 deposit address |
SmartbchSep20Api | smart_bch_sep20_deposit_qr | POST /smartbch/sep20/deposit_qr | Get an SmartBch SEP20 receiving address as a qrcode |
SmartbchSep20Api | smart_bch_sep20_genesis | POST /smartbch/sep20/genesis | Get created tokenId back and new SmartBch SEP20 token balance of the wallet |
SmartbchSep20Api | smart_bch_sep20_mint | POST /smartbch/sep20/mint | Get created tokenId back and new SmartBch SEP20 token balance of the wallet |
SmartbchSep20Api | smart_bch_sep20_send | POST /smartbch/sep20/send | Send some SmartBch SEP20 token amount to a given address |
SmartbchSep20Api | smart_bch_sep20_send_max | POST /smartbch/sep20/send_max | Send all available SmartBch SEP20 token funds to a given address |
SmartbchSep20Api | smart_bch_sep20_token_info | POST /smartbch/sep20/token_info | Get information about the SmartBch SEP20 token |
SmartbchWalletApi | smartbch_balance | POST /smartbch/wallet/balance | Get total balance for wallet |
SmartbchWalletApi | smartbch_create_wallet | POST /smartbch/wallet/create | create a new wallet |
SmartbchWalletApi | smartbch_deposit_address | POST /smartbch/wallet/deposit_address | Get a deposit address |
SmartbchWalletApi | smartbch_deposit_qr | POST /smartbch/wallet/deposit_qr | Get receiving cash address as a qrcode |
SmartbchWalletApi | smartbch_max_amount_to_send | POST /smartbch/wallet/max_amount_to_send | Get maximum spendable amount |
SmartbchWalletApi | smartbch_send | POST /smartbch/wallet/send | Send some amount to a given address |
SmartbchWalletApi | smartbch_send_max | POST /smartbch/wallet/send_max | Send all available funds to a given address |
SmartbchWalletApi | smartbch_signed_message_sign | POST /smartbch/wallet/signed/sign | Returns the message signature |
SmartbchWalletApi | smartbch_signed_message_verify | POST /smartbch/wallet/signed/verify | Returns a boolean indicating whether message was valid for a given address |
UtilApi | convert | POST /util/convert | convert between units |
UtilApi | get_addrs_by_xpub_key | POST /util/get_addrs_by_xpubkey | Derive heristic determined addresses from an extended public key, per BIP32 |
UtilApi | get_xpub_key_info | POST /util/get_xpubkey_info | Decode information about an extended public key, per BIP32 |
WalletApi | balance | POST /wallet/balance | Get total balance for wallet |
WalletApi | create_wallet | POST /wallet/create | create a new wallet |
WalletApi | deposit_address | POST /wallet/deposit_address | Get a deposit address in cash address format |
WalletApi | deposit_qr | POST /wallet/deposit_qr | Get receiving cash address as a qrcode |
WalletApi | encode_transaction | POST /wallet/encode_transaction | Encode and sign a transaction given a list of sendRequests, options and estimate fees |
WalletApi | get_all_nft_token_balances | POST /wallet/get_all_nft_token_balances | Get non-fungible token balance |
WalletApi | get_all_token_balances | POST /wallet/get_all_token_balances | Get non-fungible token balance |
WalletApi | get_history | POST /wallet/get_history | Get a simplified list of transactions related to a wallet |
WalletApi | get_nft_token_balance | POST /wallet/get_nft_token_balance | Get non-fungible token balance |
WalletApi | get_token_balance | POST /wallet/get_token_balance | Get fungible token balance |
WalletApi | get_token_utxos | POST /wallet/get_token_utxos | Get token utxos |
WalletApi | info | POST /wallet/info | Get information about a wallet |
WalletApi | max_amount_to_send | POST /wallet/max_amount_to_send | Get maximum spendable amount |
WalletApi | named_exists | POST /wallet/named_exists | Check if a named wallet already exists |
WalletApi | replace_named | POST /wallet/replace_named | Replace (recover) named wallet with a new walletId. If wallet with a provided name does not exist yet, it will be creted with a `walletId` supplied If wallet exists it will be overwritten without exception |
WalletApi | send | POST /wallet/send | Send some amount to a given address |
WalletApi | send_max | POST /wallet/send_max | Send all available funds to a given address |
WalletApi | submit_transaction | POST /wallet/submit_transaction | submit an encoded and signed transaction to the network |
WalletApi | token_burn | POST /wallet/token_burn | Perform an explicit token burn |
WalletApi | token_deposit_address | POST /wallet/token_deposit_address | Get a token aware deposit address in cash address format |
WalletApi | token_deposit_qr | POST /wallet/token_deposit_qr | Get receiving token aware cash address as a qrcode |
WalletApi | token_genesis | POST /wallet/token_genesis | Create new token category |
WalletApi | token_mint | POST /wallet/token_mint | Mint new non-fungible tokens |
WalletApi | utxos | POST /wallet/utxo | Get detailed information about unspent outputs (utxos) |
WalletApi | xpubkeys | POST /wallet/xpubkeys | A set of xpubkeys and paths for the wallet. |
WalletBcmrApi | bcmr_add_metadata_registry_auth_chain | POST /wallet/bcmr/add_registry_authchain | Add BCMR metadata registry from autchain, returning the built chain |
WalletBcmrApi | bcmr_add_registry | POST /wallet/bcmr/add_registry | Add BCMR registry from parameter |
WalletBcmrApi | bcmr_add_registry_from_uri | POST /wallet/bcmr/add_registry_from_uri | Reset tracked BCMR registries |
WalletBcmrApi | bcmr_build_auth_chain | POST /wallet/bcmr/build_authchain | Build a BCMR authchain |
WalletBcmrApi | bcmr_get_registries | POST /wallet/bcmr/get_registries | Get tracked BCMR registries |
WalletBcmrApi | bcmr_get_token_info | POST /wallet/bcmr/get_token_info | Get token info |
WalletBcmrApi | bcmr_reset_registries | POST /wallet/bcmr/reset_registries | Reset tracked BCMR registries |
WalletSignedApi | signed_message_sign | POST /wallet/signed/sign | Returns the message signature |
WalletSignedApi | signed_message_verify | POST /wallet/signed/verify | Returns a boolean indicating whether message was valid for a given address |
WalletSlpApi | nft_child_genesis | POST /wallet/slp/nft_child_genesis | Get created tokenId back and new NFT child token balance of the wallet |
WalletSlpApi | nft_parent_genesis | POST /wallet/slp/nft_parent_genesis | Get created tokenId back and new NFT token balance of the wallet |
WalletSlpApi | slp_all_balances | POST /wallet/slp/all_balances | Get all slp balances of the wallet |
WalletSlpApi | slp_balance | POST /wallet/slp/balance | Get total slp token balance of the wallet |
WalletSlpApi | slp_create_wallet | POST /wallet/slp/create | create a new SLP wallet |
WalletSlpApi | slp_deposit_address | POST /wallet/slp/deposit_address | Get an SLP deposit address in cash address format |
WalletSlpApi | slp_deposit_qr | POST /wallet/slp/deposit_qr | Get an SLP receiving cash address as a qrcode |
WalletSlpApi | slp_genesis | POST /wallet/slp/genesis | Get created tokenId back and new slp token balance of the wallet |
WalletSlpApi | slp_mint | POST /wallet/slp/mint | Get created tokenId back and new slp token balance of the wallet |
WalletSlpApi | slp_outpoints | POST /wallet/slp/outpoints | Get list of unspent SLP outpoints. |
WalletSlpApi | slp_send | POST /wallet/slp/send | Send some SLP token amount to a given cash address |
WalletSlpApi | slp_send_max | POST /wallet/slp/send_max | Send all available SLP funds to a given address |
WalletSlpApi | slp_token_info | POST /wallet/slp/token_info | Get information about the token |
WalletSlpApi | slp_utxos | POST /wallet/slp/utxo | Get detailed information about unspent SLP outputs (utxos) |
WalletUtilApi | util_decode_transaction | POST /wallet/util/decode_transaction | Decode a bitcoin transaction. Accepts both transaction hash or raw transaction in hex format. |
WalletUtilApi | util_get_raw_transaction | POST /wallet/util/get_raw_transaction | Get bitcoin raw transaction |
WebhookApi | watch_address | POST /webhook/watch_address | Create a webhook to watch cashaddress balance and transactions. |
Documentation For Models
- AuthChainElement
- BalanceRequest
- BalanceResponse
- CashscriptReceipt
- Contract
- ContractFnRequest
- ContractFnResponse
- ContractInfoRequest
- ContractInfoResponse
- ContractRequest
- ContractResponse
- ConvertRequest
- CreateSignedMessageRequest
- DepositAddressResponse
- ElectrumRawTransaction
- ElectrumRawTransactionScriptPubKey
- ElectrumRawTransactionScriptSig
- ElectrumRawTransactionVin
- ElectrumRawTransactionVout
- EncodeTransactionRequest
- EncodeTransactionResponse
- Error
- EscrowContract
- EscrowFnRequest
- EscrowInfoRequest
- EscrowInfoResponse
- EscrowRequest
- EscrowResponse
- GetAddressesResponse
- GetAddrsByXpubKeyRequest
- GetTestnetBchRequest
- GetTestnetBchResponse
- GetTestnetSbchRequest
- GetTestnetSbchResponse
- GetTestnetSep20Request
- GetTestnetSep20Response
- GetTestnetSlpRequest
- GetTestnetSlpResponse
- GetXpubKeyInfoRequest
- GetXpubKeyInfoResponse
- HistoryRequest
- HistoryResponse
- InlineObject
- InlineObject1
- InlineObject2
- InlineObject3
- InlineObject4
- MaxAmountToSendRequest
- MineRequest
- NetworkEnum
- OpReturnData
- ScalableVectorGraphic
- SendMaxRequest
- SendMaxResponse
- SendRequest
- SendRequestItem
- SendRequestItemAnyOf
- SendRequestOptions
- SendResponse
- SerializedWallet
- SignedMessageResponse
- SignedMessageResponseDetails
- SignedMessageResponseRaw
- SlpBalanceRequest
- SlpBalanceResponse
- SlpDepositAddressResponse
- SlpGenesisRequest
- SlpGenesisResponse
- SlpMintRequest
- SlpMintResponse
- SlpOutpointsResponse
- SlpSendMaxRequest
- SlpSendRequest
- SlpSendRequestItem
- SlpSendRequestOptions
- SlpSendResponse
- SlpTokenInfoRequest
- SlpTokenInfoResponse
- SlpUtxo
- SlpUtxoResponse
- SmartBchContractDeployRequest
- SmartBchContractDeployResponse
- SmartBchContractEstimateGasRequest
- SmartBchContractEstimateGasResponse
- SmartBchContractFnCallRequest
- SmartBchContractFnCallResponse
- SmartBchContractInfoRequest
- SmartBchContractInfoResponse
- SmartBchContractRequest
- SmartBchContractResponse
- SmartBchDepositAddressResponse
- SmartBchMaxAmountToSendRequest
- SmartBchOverrides
- SmartBchSendMaxRequest
- SmartBchSendRequest
- SmartBchSendRequestItem
- SmartBchSendRequestItemAnyOf
- SmartBchSendRequestOptions
- SmartBchSendResponseItem
- SmartBchSep20AllBalancesRequest
- SmartBchSep20BalanceRequest
- SmartBchSep20BalanceResponse
- SmartBchSep20GenesisRequest
- SmartBchSep20GenesisResponse
- SmartBchSep20MintRequest
- SmartBchSep20MintResponse
- SmartBchSep20SendMaxRequest
- SmartBchSep20SendRequest
- SmartBchSep20SendRequestItem
- SmartBchSep20TokenInfoRequest
- SmartBchSep20TokenInfoResponse
- SmartBchTransactionReceipt
- SubmitTransactionRequest
- SubmitTransactionResponse
- TokenBurnRequest
- TokenGenesisRequest
- TokenMintRequest
- TokenMintRequestRequests
- TokenSendRequest
- TransactionHistoryItem
- UnitType
- UtilDecodeTransactionRequest
- Utxo
- UtxoResponse
- VerifySignedMessageRequest
- VerifySignedMessageResponse
- VerifySignedMessageResponseDetails
- WalletInfo
- WalletMnemonic
- WalletNamedExistsRequest
- WalletReplaceNamedRequest
- WalletRequest
- WalletResponse
- WalletType
- WatchAddressRequest
- WatchAddressResponse
- Wif
- XPubKey
- XPubKeyRequest
- XPubKeyResponse
- ZeroBalanceResponse
Documentation For Authorization
bearerAuth
- Type: Bearer authentication