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: 2.5.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 2.7 and 3.4+
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
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
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)
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 |
MineApi | mine | POST /mine | Mine regtest coins to a specified 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 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 |
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. |
- 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
- GetXpubKeyInfoRequest
- GetXpubKeyInfoResponse
- HistoryRequest
- InOutput
- InlineObject
- InlineObject1
- InlineObject2
- InlineObject3
- InlineObject4
- MaxAmountToSendRequest
- MineRequest
- NetworkEnum
- OpReturnData
- ScalableVectorGraphic
- SendMaxRequest
- SendMaxResponse
- SendRequest
- SendRequestItem
- SendRequestItemAnyOf
- SendRequestOptions
- SendResponse
- SerializedWallet
- SignedMessageResponse
- SignedMessageResponseDetails
- SignedMessageResponseRaw
- SubmitTransactionRequest
- SubmitTransactionResponse
- Token
- TokenAmountChange
- TokenBurnRequest
- TokenGenesisRequest
- TokenMintRequest
- TokenMintRequestRequests
- TokenSendRequest
- TransactionHistoryItem
- UnitType
- UtilDecodeTransactionRequest
- Utxo
- VerifySignedMessageRequest
- VerifySignedMessageResponse
- VerifySignedMessageResponseDetails
- WalletInfo
- WalletMnemonic
- WalletNamedExistsRequest
- WalletReplaceNamedRequest
- WalletRequest
- WalletResponse
- WalletType
- WatchAddressRequest
- WatchAddressResponse
- Wif
- XPubKey
- XPubKeyRequest
- XPubKeyResponse
- ZeroBalanceResponse
- Type: Bearer authentication