Skip to content

Latest commit

 

History

History
298 lines (221 loc) · 12.1 KB

ContractEscrowApi.md

File metadata and controls

298 lines (221 loc) · 12.1 KB

mainnet.ContractEscrowApi

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

Method HTTP request Description
create_escrow POST /contract/escrow/create Create an escrow contract
escrow_fn POST /contract/escrow/call Finalize an escrow contract
escrow_info POST /contract/escrow/info Get information about an escrow contract from the escrowContractId
escrow_utxos POST /contract/escrow/utxos List specific utxos on any escrow contract

create_escrow

EscrowResponse create_escrow(escrow_request)

Create an escrow contract

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.ContractEscrowApi(api_client)
    escrow_request = mainnet.EscrowRequest() # EscrowRequest | Request a new escrow contract from a template

    try:
        # Create an escrow contract
        api_response = api_instance.create_escrow(escrow_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ContractEscrowApi->create_escrow: %s\n" % e)

Parameters

Name Type Description Notes
escrow_request EscrowRequest Request a new escrow contract from a template

Return type

EscrowResponse

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 successful operation -
500 Error -

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

escrow_fn

ContractFnResponse escrow_fn(escrow_fn_request)

Finalize an escrow contract

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.ContractEscrowApi(api_client)
    escrow_fn_request = mainnet.EscrowFnRequest() # EscrowFnRequest | 

    try:
        # Finalize an escrow contract
        api_response = api_instance.escrow_fn(escrow_fn_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ContractEscrowApi->escrow_fn: %s\n" % e)

Parameters

Name Type Description Notes
escrow_fn_request EscrowFnRequest

Return type

ContractFnResponse

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 successful operation -
500 Error -

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

escrow_info

EscrowInfoResponse escrow_info(escrow_info_request)

Get information about an escrow contract from the escrowContractId

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.ContractEscrowApi(api_client)
    escrow_info_request = {"escrowContractId":"escrowContract:testnet:WW1Ob2RHV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toIHx8IGhhc2gxNjAoc2lnbmluZ1BrKSA9PSBidXllclBraCk7CiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShjaGVja1NpZyhzLCBzaWduaW5nUGspKTsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGFtb3VudCA+PSBjb250cmFjdEFtb3VudCk7CiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShub25jZSA9PSBjb250cmFjdE5vbmNlKTsKICAgICAgICAgICAgICAgICAgICBieXRlczM0IG91dHB1dCA9IG5ldyBPdXRwdXRQMlBLSChieXRlczgoYW1vdW50KSwgc2VsbGVyUGtoKTsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGhhc2gyNTYob3V0cHV0KSA9PSB0eC5oYXNoT3V0cHV0cyk7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVmdW5kKHB1YmtleSBzaWduaW5nUGssIHNpZyBzLCBpbnQgYW1vdW50LCBpbnQgbm9uY2UpIHsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGhhc2gxNjAoc2lnbmluZ1BrKSA9PSBhcmJpdGVyUGtofHxoYXNoMTYwKHNpZ25pbmdQaykgPT0gc2VsbGVyUGtoKTsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGNoZWNrU2lnKHMsIHNpZ25pbmdQaykpOwogICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoYW1vdW50ID49IGNvbnRyYWN0QW1vdW50KTsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKG5vbmNlID09IGNvbnRyYWN0Tm9uY2UpOwogICAgICAgICAgICAgICAgICAgIGJ5dGVzMzQgb3V0cHV0ID0gbmV3IE91dHB1dFAyUEtIKGJ5dGVzOChhbW91bnQpLCBidXllclBraCk7CiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShoYXNoMjU2KG91dHB1dCkgPT0gdHguaGFzaE91dHB1dHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAg:1075184727"} # EscrowInfoRequest | Request parsed information regarding a contract from the escrowContractId

    try:
        # Get information about an escrow contract from the escrowContractId
        api_response = api_instance.escrow_info(escrow_info_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ContractEscrowApi->escrow_info: %s\n" % e)

Parameters

Name Type Description Notes
escrow_info_request EscrowInfoRequest Request parsed information regarding a contract from the escrowContractId

Return type

EscrowInfoResponse

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 successful operation -
500 Error -

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

escrow_utxos

list[Utxo] escrow_utxos(escrow_contract)

List specific utxos on any escrow contract

Returns all UTXOs that can be spent by the contract. Both confirmed and unconfirmed UTXOs are included. The endpoint works with contracts generated from templates (i.e. escrow).

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.ContractEscrowApi(api_client)
    escrow_contract = mainnet.EscrowContract() # EscrowContract | 

    try:
        # List specific utxos on any escrow contract
        api_response = api_instance.escrow_utxos(escrow_contract)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ContractEscrowApi->escrow_utxos: %s\n" % e)

Parameters

Name Type Description Notes
escrow_contract EscrowContract

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 -
405 Invalid input -

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