mainnet-cash/mainnet-php-generated

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.

2.3.12 2024-05-05 13:39 UTC

This package is auto-updated.

Last update: 2024-05-05 16:14:18 UTC


README

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 PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2.3.12
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 7.2 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/mainnet-cash/mainnet-php-generated.git"
    }
  ],
  "require": {
    "mainnet-cash/mainnet-php-generated": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/Mainnet/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure Bearer authorization: bearerAuth
$config = Mainnet\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Mainnet\Api\ContractApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$contract_fn_request = {"contractId":"testnet:TURNME1UQmxaakEwT0dJelpHRXpOVEUzT1RObU5tVmtNVFJqWXpKbVpHVTBOakJpWldOak5XSTJOVGhrT1RFek9EUTBNMkk1WVRNd01EQTNNRGRoTm1FMzpNRE0wT1RjNFlXTTBOalJtTXpVNFlqSXpOV1l4TVRJeE1tVmlObVV3TVRkaFpqa3dNakUxWWprd1lqRm1aamMwTnpGa09XRmxNbUZpWWpWbE1Ea3lOak5pOk1qRTE=:Y29udHJhY3QgVHJhbnNmZXJXaXRoVGltZW91dChwdWJrZXkgc2VuZGVyLCBwdWJrZXkgcmVjaXBpZW50LCBpbnQgdGltZW91dCkgewogICAgZnVuY3Rpb24gdHJhbnNmZXIoc2lnIHJlY2lwaWVudFNpZykgewogICAgICAgIHJlcXVpcmUoY2hlY2tTaWcocmVjaXBpZW50U2lnLCByZWNpcGllbnQpKTsKICAgIH0KCiAgICBmdW5jdGlvbiB0aW1lb3V0KHNpZyBzZW5kZXJTaWcpIHsKICAgICAgICByZXF1aXJlKGNoZWNrU2lnKHNlbmRlclNpZywgc2VuZGVyKSk7CiAgICAgICAgcmVxdWlyZSh0eC50aW1lID49IHRpbWVvdXQpOwogICAgfQp9Cg==:1996128042","action":"send","function":"timeout","to":{"unit":"sat","cashaddr":"bchtest:qpalhxhl05mlhms3ys43u76rn0ttdv3qg2usm4nm7t","value":2000},"feePerByte":1}; // \Mainnet\Model\ContractFnRequest | Request a new cashscript contract

try {
    $result = $apiInstance->contractFn($contract_fn_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContractApi->contractFn: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

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

Class Method HTTP request Description
ContractApi contractFn POST /contract/call Call a method on a contract
ContractApi contractInfo POST /contract/info Get information about a contract from the contractId
ContractApi contractUtxos POST /contract/utxos List specific utxos on any contract
ContractApi createContract POST /contract/create Create a cashscript contract
ContractEscrowApi createEscrow POST /contract/escrow/create Create an escrow contract
ContractEscrowApi escrowFn POST /contract/escrow/call Finalize an escrow contract
ContractEscrowApi escrowInfo POST /contract/escrow/info Get information about an escrow contract from the escrowContractId
ContractEscrowApi escrowUtxos POST /contract/escrow/utxos List specific utxos on any escrow contract
FaucetApi getAddresses POST /faucet/get_addresses Get addresses to return back or donate the testnet bch and tokens
FaucetApi getTestnetBch 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 getAddrsByXpubKey POST /util/get_addrs_by_xpubkey Derive heristic determined addresses from an extended public key, per BIP32
UtilApi getXpubKeyInfo 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 createWallet POST /wallet/create create a new wallet
WalletApi depositAddress POST /wallet/deposit_address Get a deposit address in cash address format
WalletApi depositQr POST /wallet/deposit_qr Get receiving cash address as a qrcode
WalletApi encodeTransaction POST /wallet/encode_transaction Encode and sign a transaction given a list of sendRequests, options and estimate fees
WalletApi getAllNftTokenBalances POST /wallet/get_all_nft_token_balances Get non-fungible token balance
WalletApi getAllTokenBalances POST /wallet/get_all_token_balances Get non-fungible token balance
WalletApi getHistory POST /wallet/get_history Get a simplified list of transactions related to a wallet
WalletApi getNftTokenBalance POST /wallet/get_nft_token_balance Get non-fungible token balance
WalletApi getTokenBalance POST /wallet/get_token_balance Get fungible token balance
WalletApi getTokenUtxos POST /wallet/get_token_utxos Get token utxos
WalletApi info POST /wallet/info Get information about a wallet
WalletApi maxAmountToSend POST /wallet/max_amount_to_send Get maximum spendable amount
WalletApi namedExists POST /wallet/named_exists Check if a named wallet already exists
WalletApi replaceNamed 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 sendMax POST /wallet/send_max Send all available funds to a given address
WalletApi submitTransaction POST /wallet/submit_transaction submit an encoded and signed transaction to the network
WalletApi tokenBurn POST /wallet/token_burn Perform an explicit token burn
WalletApi tokenDepositAddress POST /wallet/token_deposit_address Get a token aware deposit address in cash address format
WalletApi tokenDepositQr POST /wallet/token_deposit_qr Get receiving token aware cash address as a qrcode
WalletApi tokenGenesis POST /wallet/token_genesis Create new token category
WalletApi tokenMint 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 bcmrAddMetadataRegistryAuthChain POST /wallet/bcmr/add_registry_authchain Add BCMR metadata registry from autchain, returning the built chain
WalletBcmrApi bcmrAddRegistry POST /wallet/bcmr/add_registry Add BCMR registry from parameter
WalletBcmrApi bcmrAddRegistryFromUri POST /wallet/bcmr/add_registry_from_uri Reset tracked BCMR registries
WalletBcmrApi bcmrBuildAuthChain POST /wallet/bcmr/build_authchain Build a BCMR authchain
WalletBcmrApi bcmrGetRegistries POST /wallet/bcmr/get_registries Get tracked BCMR registries
WalletBcmrApi bcmrGetTokenInfo POST /wallet/bcmr/get_token_info Get token info
WalletBcmrApi bcmrResetRegistries POST /wallet/bcmr/reset_registries Reset tracked BCMR registries
WalletSignedApi signedMessageSign POST /wallet/signed/sign Returns the message signature
WalletSignedApi signedMessageVerify POST /wallet/signed/verify Returns a boolean indicating whether message was valid for a given address
WalletUtilApi utilDecodeTransaction POST /wallet/util/decode_transaction Decode a bitcoin transaction. Accepts both transaction hash or raw transaction in hex format.
WalletUtilApi utilGetRawTransaction POST /wallet/util/get_raw_transaction Get bitcoin raw transaction
WebhookApi watchAddress POST /webhook/watch_address Create a webhook to watch cashaddress balance and transactions.

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: Bearer authentication

Author

hello@mainnet.cash