Skip to main content
POST
/
transactions
/
contract_call
import cobo_waas2
from cobo_waas2.models.contract_call_params import ContractCallParams
from cobo_waas2.models.create_transfer_transaction201_response import (
    CreateTransferTransaction201Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.TransactionsApi(api_client)
    contract_call_params = cobo_waas2.ContractCallParams(
        request_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
        chain_id="ETH",
        source=cobo_waas2.ContractCallSource(
            cobo_waas2.MpcContractCallSource(
                source_type="Org-Controlled",
                wallet_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
                address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
            )
        ),
        destination=cobo_waas2.ContractCallDestination(
            cobo_waas2.EvmContractCallDestination(
                destination_type="EVM_Contract",
                address="0x0406db8351aa6839169bb363f63c2c808fee8f99",
                calldata="0xa22cb4650000000000000000000000001e0049783f008a0085193e00003d00cd54003c71000000000000000000000000000000000000000000000000000000000000DEMO",
            )
        ),
    )

    try:
        # Call smart contract
        api_response = api_instance.create_contract_call_transaction(
            contract_call_params=contract_call_params
        )
        print("The response of TransactionsApi->create_contract_call_transaction:\n")
        pprint(api_response)
    except Exception as e:
        print(
            "Exception when calling TransactionsApi->create_contract_call_transaction: %s\n"
            % e
        )

{
  "request_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "transaction_id": "c986cb3b-1301-412f-9450-13a52c43a95f",
  "status": "Submitted"
}
import cobo_waas2
from cobo_waas2.models.contract_call_params import ContractCallParams
from cobo_waas2.models.create_transfer_transaction201_response import (
    CreateTransferTransaction201Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.TransactionsApi(api_client)
    contract_call_params = cobo_waas2.ContractCallParams(
        request_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
        chain_id="ETH",
        source=cobo_waas2.ContractCallSource(
            cobo_waas2.MpcContractCallSource(
                source_type="Org-Controlled",
                wallet_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
                address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
            )
        ),
        destination=cobo_waas2.ContractCallDestination(
            cobo_waas2.EvmContractCallDestination(
                destination_type="EVM_Contract",
                address="0x0406db8351aa6839169bb363f63c2c808fee8f99",
                calldata="0xa22cb4650000000000000000000000001e0049783f008a0085193e00003d00cd54003c71000000000000000000000000000000000000000000000000000000000000DEMO",
            )
        ),
    )

    try:
        # Call smart contract
        api_response = api_instance.create_contract_call_transaction(
            contract_call_params=contract_call_params
        )
        print("The response of TransactionsApi->create_contract_call_transaction:\n")
        pprint(api_response)
    except Exception as e:
        print(
            "Exception when calling TransactionsApi->create_contract_call_transaction: %s\n"
            % e
        )

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Body

application/json

The request body for making a contract call.

The information about a transaction that interacts with a smart contract

request_id
string
required

The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization.

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

chain_id
string
required

The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains.

Example:

"ETH"

source
object
required

The information about the transaction source type. Refer to Transaction sources and destinations for a detailed introduction about the supported sources and destinations for each transaction type.

Switch between the tabs to display the properties for different transaction sources.

  • Org-Controlled/User-Controlled
  • Safe{Wallet}
  • Web3
destination
object
required

The information about the transaction destination. Refer to Transaction sources and destinations for a detailed introduction about the supported sources and destinations for each transaction type.

  • EVM_Contract
  • SOL_Contract
  • STELLAR_Contract
description
string

The description of the contract call transaction.

Example:

"Transaction to call a smart contract initiated from a wallet"

category_names
string[]

The custom category for you to identify your transactions.

fee
object

The preset properties to limit transaction fee.

In the fixed fee model, the transaction fee is a fixed amount within a certain amount of period regardless of the transaction size or network congestion, which can vary between different chains. For more information about the fixed fee model, refer to Fee models.

You can specify the maximum fee amount to limit the transaction fee. The transaction will fail if the transaction fee exceeds the specified maximum fee amount.

Switch between the tabs to display the properties for different transaction fee models.

  • Fixed
  • EVM_EIP_1559
  • EVM_Legacy
  • UTXO
  • SOL
  • FIL
transaction_process_type
enum<string>

Transaction processing type. Possible values are:

  • AutoProcess (default): After the transaction is constructed, it will be automatically signed and broadcast.
  • BuildOnly: Set to this value if you want to build the transaction first without automatically signing and broadcasting it. You can manually call the Sign and broadcast transaction operation to complete the signing and broadcasting process.
Available options:
AutoProcess,
BuildOnly
Example:

"AutoProcess"

auto_fuel
enum<string>

The mode of transaction fee payment using Fee Station. Currently, Fee Station supports EVM-compatible and TRON transactions initiated from MPC Wallets (Organization-Controlled) and Custodial Wallets (Web3 Wallets). For more details, refer to Fee Station.

  • ProActiveAutoFuel: Always use Fee Station to pay transaction fees.
  • PassiveAutoFuel: Use Fee Station only when the source address balance is insufficient to cover the transaction fees.
  • UsePortalPreference: Use payment preferences set on Cobo Portal.

Please note that the TRON chain does not support PassiveAutoFuel due to its fee delegation mechanism.

Available options:
PassiveAutoFuel,
ProActiveAutoFuel,
UsePortalPreference
Example:

"PassiveAutoFuel"

Response

The request was successful.

request_id
string
required

The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization.

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

transaction_id
string
required

The transaction ID.

Example:

"c986cb3b-1301-412f-9450-13a52c43a95f"

status
enum<string>
required

The transaction status. For more details including sub-statuses, please refer to Transaction statuses and sub-statuses.

Available options:
Submitted,
PendingScreening,
PendingAuthorization,
PendingSignature,
Broadcasting,
Confirming,
Completed,
Failed,
Rejected,
Pending
Example:

"Submitted"