Skip to content

Latest commit

 

History

History
1653 lines (1235 loc) · 57 KB

File metadata and controls

1653 lines (1235 loc) · 57 KB

mainnet.WalletApi

All URIs are relative to https://rest-unstable.mainnet.cash

Method HTTP request Description
balance POST /wallet/balance Get total balance for wallet
create_wallet POST /wallet/create create a new wallet
deposit_address POST /wallet/deposit_address Get a deposit address in cash address format
encode_transaction POST /wallet/encode_transaction Encode and sign a transaction given a list of sendRequests, options and estimate fees
get_all_nft_token_balances POST /wallet/get_all_nft_token_balances Get non-fungible token balance
get_all_token_balances POST /wallet/get_all_token_balances Get non-fungible token balance
get_history POST /wallet/get_history Get a list of transactions related to a wallet
get_nft_token_balance POST /wallet/get_nft_token_balance Get non-fungible token balance
get_token_balance POST /wallet/get_token_balance Get fungible token balance
get_token_utxos POST /wallet/get_token_utxos Get token utxos
info POST /wallet/info Get information about a wallet
max_amount_to_send POST /wallet/max_amount_to_send Get maximum spendable amount
named_exists POST /wallet/named_exists Check if a named wallet already exists
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
send POST /wallet/send Send some amount to a given address
send_max POST /wallet/send_max Send all available funds to a given address
submit_transaction POST /wallet/submit_transaction submit an encoded and signed transaction to the network
token_burn POST /wallet/token_burn Perform an explicit token burn
token_deposit_address POST /wallet/token_deposit_address Get a token aware deposit address in cash address format
token_genesis POST /wallet/token_genesis Create new token category
token_mint POST /wallet/token_mint Mint new non-fungible tokens
utxos POST /wallet/utxo Get detailed information about unspent outputs (utxos)
xpubkeys POST /wallet/xpubkeys A set of xpubkeys and paths for the wallet.

balance

BalanceResponse balance(balance_request)

Get total balance for wallet

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    balance_request = mainnet.BalanceRequest() # BalanceRequest | Request for a wallet balance 

    try:
        # Get total balance for wallet
        api_response = api_instance.balance(balance_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->balance: %s\n" % e)

Parameters

Name Type Description Notes
balance_request BalanceRequest Request for a wallet balance

Return type

BalanceResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_wallet

WalletResponse create_wallet(wallet_request)

create a new wallet

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    wallet_request = mainnet.WalletRequest() # WalletRequest | Request a new random wallet

    try:
        # create a new wallet
        api_response = api_instance.create_wallet(wallet_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->create_wallet: %s\n" % e)

Parameters

Name Type Description Notes
wallet_request WalletRequest Request a new random wallet

Return type

WalletResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -
405 Invalid input -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deposit_address

DepositAddressResponse deposit_address(serialized_wallet)

Get a deposit address in cash address format

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    serialized_wallet = mainnet.SerializedWallet() # SerializedWallet | Request for a deposit address given a wallet 

    try:
        # Get a deposit address in cash address format
        api_response = api_instance.deposit_address(serialized_wallet)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->deposit_address: %s\n" % e)

Parameters

Name Type Description Notes
serialized_wallet SerializedWallet Request for a deposit address given a wallet

Return type

DepositAddressResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

encode_transaction

EncodeTransactionResponse encode_transaction(encode_transaction_request)

Encode and sign a transaction given a list of sendRequests, options and estimate fees

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    encode_transaction_request = mainnet.EncodeTransactionRequest() # EncodeTransactionRequest | encode a transaction

    try:
        # Encode and sign a transaction given a list of sendRequests, options and estimate fees
        api_response = api_instance.encode_transaction(encode_transaction_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->encode_transaction: %s\n" % e)

Parameters

Name Type Description Notes
encode_transaction_request EncodeTransactionRequest encode a transaction

Return type

EncodeTransactionResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 transaction accepted -
400 Invalid Request -
418 Invalid network for given address -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_all_nft_token_balances

dict(str, float) get_all_nft_token_balances(inline_object5)

Get non-fungible token balance

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    inline_object5 = mainnet.InlineObject5() # InlineObject5 | 

    try:
        # Get non-fungible token balance
        api_response = api_instance.get_all_nft_token_balances(inline_object5)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_all_nft_token_balances: %s\n" % e)

Parameters

Name Type Description Notes
inline_object5 InlineObject5

Return type

dict(str, float)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_all_token_balances

dict(str, float) get_all_token_balances(inline_object4)

Get non-fungible token balance

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    inline_object4 = mainnet.InlineObject4() # InlineObject4 | 

    try:
        # Get non-fungible token balance
        api_response = api_instance.get_all_token_balances(inline_object4)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_all_token_balances: %s\n" % e)

Parameters

Name Type Description Notes
inline_object4 InlineObject4

Return type

dict(str, float)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_history

list[TransactionHistoryItem] get_history(history_request)

Get a list of transactions related to a wallet

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    history_request = mainnet.HistoryRequest() # HistoryRequest | Gets transaction history of this wallet with most data decoded and ready to present to user   Note: balance calculations are valid only if querying to the blockchain tip (`toHeight` === -1, `count` === -1)   Note: this method is heavy on network calls, if invoked in browser use of cache is advised, @see `Config.UseLocalStorageCache`   Note: this method tries to recreate the history tab view of Electron Cash wallet, however, it may not be 100% accurate if the tnransaction value changes are the same in the same block (ordering) 

    try:
        # Get a list of transactions related to a wallet
        api_response = api_instance.get_history(history_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_history: %s\n" % e)

Parameters

Name Type Description Notes
history_request HistoryRequest Gets transaction history of this wallet with most data decoded and ready to present to user Note: balance calculations are valid only if querying to the blockchain tip (`toHeight` === -1, `count` === -1) Note: this method is heavy on network calls, if invoked in browser use of cache is advised, @see `Config.UseLocalStorageCache` Note: this method tries to recreate the history tab view of Electron Cash wallet, however, it may not be 100% accurate if the tnransaction value changes are the same in the same block (ordering)

Return type

list[TransactionHistoryItem]

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_nft_token_balance

object get_nft_token_balance(inline_object3)

Get non-fungible token balance

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    inline_object3 = mainnet.InlineObject3() # InlineObject3 | 

    try:
        # Get non-fungible token balance
        api_response = api_instance.get_nft_token_balance(inline_object3)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_nft_token_balance: %s\n" % e)

Parameters

Name Type Description Notes
inline_object3 InlineObject3

Return type

object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_token_balance

object get_token_balance(inline_object2)

Get fungible token balance

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    inline_object2 = mainnet.InlineObject2() # InlineObject2 | 

    try:
        # Get fungible token balance
        api_response = api_instance.get_token_balance(inline_object2)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_token_balance: %s\n" % e)

Parameters

Name Type Description Notes
inline_object2 InlineObject2

Return type

object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_token_utxos

list[Utxo] get_token_utxos(inline_object1)

Get token utxos

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    inline_object1 = mainnet.InlineObject1() # InlineObject1 | 

    try:
        # Get token utxos
        api_response = api_instance.get_token_utxos(inline_object1)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->get_token_utxos: %s\n" % e)

Parameters

Name Type Description Notes
inline_object1 InlineObject1

Return type

list[Utxo]

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

info

WalletInfo info(serialized_wallet)

Get information about a wallet

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    serialized_wallet = mainnet.SerializedWallet() # SerializedWallet | The wallet to request information about, in serialized form. 

    try:
        # Get information about a wallet
        api_response = api_instance.info(serialized_wallet)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->info: %s\n" % e)

Parameters

Name Type Description Notes
serialized_wallet SerializedWallet The wallet to request information about, in serialized form.

Return type

WalletInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Information about the wallet network, type, and keys -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

max_amount_to_send

BalanceResponse max_amount_to_send(max_amount_to_send_request)

Get maximum spendable amount

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    max_amount_to_send_request = mainnet.MaxAmountToSendRequest() # MaxAmountToSendRequest | get amount that will be spend with a spend max request. If a unit type is specified, a numeric value will be returned.

    try:
        # Get maximum spendable amount
        api_response = api_instance.max_amount_to_send(max_amount_to_send_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->max_amount_to_send: %s\n" % e)

Parameters

Name Type Description Notes
max_amount_to_send_request MaxAmountToSendRequest get amount that will be spend with a spend max request. If a unit type is specified, a numeric value will be returned.

Return type

BalanceResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 transaction accepted -
400 Invalid Request -
418 Invalid network for given address -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

named_exists

WalletNamedExistsResponse named_exists(wallet_named_exists_request)

Check if a named wallet already exists

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    wallet_named_exists_request = mainnet.WalletNamedExistsRequest() # WalletNamedExistsRequest | Request parameters

    try:
        # Check if a named wallet already exists
        api_response = api_instance.named_exists(wallet_named_exists_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->named_exists: %s\n" % e)

Parameters

Name Type Description Notes
wallet_named_exists_request WalletNamedExistsRequest Request parameters

Return type

WalletNamedExistsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -
405 Invalid input -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

replace_named

WalletReplaceNamedResponse replace_named(wallet_replace_named_request)

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

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    wallet_replace_named_request = mainnet.WalletReplaceNamedRequest() # WalletReplaceNamedRequest | Request parameters

    try:
        # 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 
        api_response = api_instance.replace_named(wallet_replace_named_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->replace_named: %s\n" % e)

Parameters

Name Type Description Notes
wallet_replace_named_request WalletReplaceNamedRequest Request parameters

Return type

WalletReplaceNamedResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -
405 Invalid input -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send

SendResponse send(send_request)

Send some amount to a given address

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    send_request = mainnet.SendRequest() # SendRequest | place a send request

    try:
        # Send some amount to a given address
        api_response = api_instance.send(send_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->send: %s\n" % e)

Parameters

Name Type Description Notes
send_request SendRequest place a send request

Return type

SendResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 transaction accepted -
400 Invalid Request -
418 Invalid network for given address -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send_max

SendMaxResponse send_max(send_max_request)

Send all available funds to a given address

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    send_max_request = mainnet.SendMaxRequest() # SendMaxRequest | Request to send all available funds to a given address

    try:
        # Send all available funds to a given address
        api_response = api_instance.send_max(send_max_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->send_max: %s\n" % e)

Parameters

Name Type Description Notes
send_max_request SendMaxRequest Request to send all available funds to a given address

Return type

SendMaxResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 transaction accepted -
400 Invalid Request -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

submit_transaction

SubmitTransactionResponse submit_transaction(submit_transaction_request)

submit an encoded and signed transaction to the network

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    submit_transaction_request = mainnet.SubmitTransactionRequest() # SubmitTransactionRequest | submit an encoded and signed transaction to the network

    try:
        # submit an encoded and signed transaction to the network
        api_response = api_instance.submit_transaction(submit_transaction_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->submit_transaction: %s\n" % e)

Parameters

Name Type Description Notes
submit_transaction_request SubmitTransactionRequest submit an encoded and signed transaction to the network

Return type

SubmitTransactionResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 transaction accepted -
400 Invalid Request -
418 Invalid network for given address -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token_burn

SendResponse token_burn(token_burn_request)

Perform an explicit token burn

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    token_burn_request = mainnet.TokenBurnRequest() # TokenBurnRequest | Perform an explicit token burning by spending a token utxo to an OP_RETURN Behaves differently for fungible and non-fungible tokens:  * NFTs are always \"destroyed\"  * FTs' amount is reduced by the amount specified, if 0 FT amount is left and no NFT present, the token is \"destroyed\" Refer to spec https://github.com/bitjson/cashtokens 

    try:
        # Perform an explicit token burn
        api_response = api_instance.token_burn(token_burn_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->token_burn: %s\n" % e)

Parameters

Name Type Description Notes
token_burn_request TokenBurnRequest Perform an explicit token burning by spending a token utxo to an OP_RETURN Behaves differently for fungible and non-fungible tokens: * NFTs are always "destroyed" * FTs' amount is reduced by the amount specified, if 0 FT amount is left and no NFT present, the token is "destroyed" Refer to spec https://github.com/bitjson/cashtokens

Return type

SendResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token_deposit_address

DepositAddressResponse token_deposit_address(serialized_wallet)

Get a token aware deposit address in cash address format

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    serialized_wallet = mainnet.SerializedWallet() # SerializedWallet | Request for a token aware deposit address given a wallet 

    try:
        # Get a token aware deposit address in cash address format
        api_response = api_instance.token_deposit_address(serialized_wallet)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->token_deposit_address: %s\n" % e)

Parameters

Name Type Description Notes
serialized_wallet SerializedWallet Request for a token aware deposit address given a wallet

Return type

DepositAddressResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token_genesis

SendResponse token_genesis(token_genesis_request)

Create new token category

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    token_genesis_request = mainnet.TokenGenesisRequest() # TokenGenesisRequest | Create new cashtoken, both funglible and/or non-fungible (NFT) Refer to spec https://github.com/bitjson/cashtokens Newly created token identifier can be found in `categories` field. 

    try:
        # Create new token category
        api_response = api_instance.token_genesis(token_genesis_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->token_genesis: %s\n" % e)

Parameters

Name Type Description Notes
token_genesis_request TokenGenesisRequest Create new cashtoken, both funglible and/or non-fungible (NFT) Refer to spec https://github.com/bitjson/cashtokens Newly created token identifier can be found in `categories` field.

Return type

SendResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token_mint

SendResponse token_mint(token_mint_request)

Mint new non-fungible tokens

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    token_mint_request = mainnet.TokenMintRequest() # TokenMintRequest | Mint new NFT cashtokens using an existing minting token Refer to spec https://github.com/bitjson/cashtokens Newly minted tokens will retain the parent's category. 

    try:
        # Mint new non-fungible tokens
        api_response = api_instance.token_mint(token_mint_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->token_mint: %s\n" % e)

Parameters

Name Type Description Notes
token_mint_request TokenMintRequest Mint new NFT cashtokens using an existing minting token Refer to spec https://github.com/bitjson/cashtokens Newly minted tokens will retain the parent's category.

Return type

SendResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

utxos

list[Utxo] utxos(serialized_wallet)

Get detailed information about unspent outputs (utxos)

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    serialized_wallet = mainnet.SerializedWallet() # SerializedWallet | Request detailed list of unspent transaction outputs 

    try:
        # Get detailed information about unspent outputs (utxos)
        api_response = api_instance.utxos(serialized_wallet)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->utxos: %s\n" % e)

Parameters

Name Type Description Notes
serialized_wallet SerializedWallet Request detailed list of unspent transaction outputs

Return type

list[Utxo]

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

xpubkeys

XPubKeyResponse xpubkeys(x_pub_key_request)

A set of xpubkeys and paths for the wallet.

Example

  • Bearer Authentication (bearerAuth):
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.WalletApi(api_client)
    x_pub_key_request = mainnet.XPubKeyRequest() # XPubKeyRequest | x 

    try:
        # A set of xpubkeys and paths for the wallet.
        api_response = api_instance.xpubkeys(x_pub_key_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WalletApi->xpubkeys: %s\n" % e)

Parameters

Name Type Description Notes
x_pub_key_request XPubKeyRequest x

Return type

XPubKeyResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]