A class for making calls to uplexa-wallet-rpc using PHP
Parameters:
$host <String>uplexa-wallet-rpc hostname (optional)$port <int>uplexa-wallet-rpc port (optional)$protocol <String>uplexa-wallet-rpc protocol (eg. 'http') (optional)$user <String>uplexa-wallet-rpc RPC username (optional)$password <String>uplexa-wallet-rpc RPC passphrase (optional)
Parameters can also be passed in as an associative array (object/dictionary,) as in:
$walletRPC = new walletRPC(['host' => '127.0.0.1', 'port' => 28083])If an object is used to provide parameters (as above,) parameters can be declared in any order.
_transformget_balance(alias:getbalance)get_address(alias:getaddress)create_addresslabel_addressget_accountscreate_accountlabel_accountget_account_tagstag_accountsuntag_accountsset_account_tag_descriptionget_height(alias:getheight)transfertransfer_splitsweep_dustsweep_unmixablesweep_allsweep_singlerelay_txstoreget_paymentsget_bulk_paymentsincoming_transfersquery_keyview_keyspend_keymnemonicmake_integrated_addresssplit_integrated_addressstop_walletrescan_blockchainset_tx_notesget_tx_notesset_attributeget_attributeget_tx_keycheck_tx_keyget_tx_proofcheck_tx_proofget_spend_proofcheck_spend_proofget_reserve_proofcheck_reserve_proofget_transfersget_transfer_by_txidsignverifyexport_key_imagesimport_key_imagesmake_uriparse_uriget_address_bookadd_address_bookdelete_address_bookrescan_spentstart_miningstop_miningget_languagescreate_walletopen_walletis_multisigprepare_multisigmake_multisigexport_multisig_infoimport_multisig_infofinalize_multisigsign_multisigsubmit_multisigget_client(alias:getClient)
Look up an account's balance
Parameters:
$account_index <number>Index of account to look up ( optional)
Return: <Object>
{
"balance": 140000000000,
"unlocked_balance": 50000000000
}Alias: getbalance
Look up wallet address(es)
Parameters:
$account_index <number>Index of account to look up (optional)$address_index <number>Index of subaddress to look up (optional)
Return: <Object>
{
"address": "A2XE6ArhRkVZqepY2DQ5QpW8p8P2dhDQLhPJ9scSkW6q9aYUHhrhXVvE8sjg7vHRx2HnRv53zLQH4ATS",
"addresses": [
{
"address": "A2XE6ArhRkVZqepY2DQ5QpW8p8P2dhDQLhPJ9scSkW6q9aYUHhrhXVvE8sjg7vHRx2HnRv53zLQH",
"address_index": 0,
"label": "Primary account",
"used": true
}, {
"address": "Bh3ttLbjGFnVGCeGJF1HgVh4DfCaBNpDt7PQAgsC2GFug7WKskgfbTmB6e7UupyiijiHDQPmDC7w",
"address_index": 1,
"label": "",
"used": true
}
]
}Alias: getaddress
Create a new subaddress
Parameters:
$account_index <number>The subaddress account index$label <String>A label to the new subaddress
Return: <Object>
{
"address": "Bh3ttLbjGFnVGCeGJF1HgVh4DfCaBNpDt7PQAgsC2GFug7WKskgfbTmB6e7UupyiijiHDQPmDC7wSC",
"address_index": 1
}Label a subaddress
Parameters:
$index <number>The index of the subaddress to label$label <String>The label to apply
Look up wallet accounts
Return: <Object>
{
"subaddress_accounts": {
"0": {
"account_index": 0,
"balance": 2808597352948771,
"base_address": "A2XE6ArhRkVZqepY2DQ5QpW8p8P2dhDQLhPJ9scSkW6q9aYUHhrhXVvE8sjg7vHRx2HnR",
"label": "Primary account",
"tag": "",
"unlocked_balance": 2717153096298162
},
"1": {
"account_index": 1,
"balance": 0,
"base_address": "BcXKsfrvffKYVoNGN4HUFfaruAMRdk5DrLZDmJBnYgXrTFrXyudn81xMj7rsmU5P9dX56",
"label": "Secondary account",
"tag": "",
"unlocked_balance": 0
},
"total_balance": 2808597352948771,
"total_unlocked_balance": 2717153096298162
}Create a new account
Parameters:
$label <String>Label to apply to new account
Label an account
Parameters:
$account_index <number>Index of account to label$label <String>Label to apply
Look up account tags
Return: <Object>
{
"account_tags": {
"0": {
"accounts": {
"0": 0,
"1": 1
},
"label": "",
"tag": "Example tag"
}
}
}Tag accounts
Parameters:
$accounts <Array>The indices of the accounts to tag$tag <String>Tag to apply
Untag accounts
Parameters:
$accounts <Array>The indices of the accounts to untag
Describe a tag
Parameters:
$tag <String>Tag to describe$description <String>Description to apply to tag
Return: <Object>
Look up how many blocks are in the longest chain known to the wallet
Return: <Object>
{
"height": 994310
}Alias: getheight
Send uplexa
Parameters can be passed in individually (as listed below) or as an object/dictionary (as listed below) or as an object/dictionary (as listed at bottom)
To send to multiple recipients, use the object/dictionary (bottom) format and pass an array of recipient addresses and amount arrays in the destinations field (as in "destinations = [['amount' => 1, 'address' => ...], ['amount' => 2, 'address' => ...]]")
Parameters:
-
$amount <String>Amount of uplexa to send -
$address <String>Address to receive funds -
$payment_id <String>Payment -
$mixin <number>Mixin number (ringsize - 1) -
$account_index <number>Account to send -
$subaddr_indices <String>Comma-separated list of subaddress indices to spend -
$priority <number>Transaction -
$unlock_time <number>UNIX time or block height to unlock -
$do_not_relay <boolean>Do not relayor
-
$params <Object>Array containing any of the options listed above, where only amount and address or a destionation's array are required
Return: <Object>
{
"amount": "1000000000000",
"fee": "1000020000",
"tx_hash": "c60a64ddae46154a75af65544f73a7064911289a7760be8fb5390cb57c06f2db",
"tx_key": "805abdb3882d9440b6c80490c2d6b95a79dbc6d1b05e514131a91768e8040b04"
}Same as transfer, but splits transfer into more than one transaction if necessary
Return: <Object>
Send all dust outputs back to the wallet
Return: <Object>
Send all unmixable outputs back to the wallet
Return: <Object>
Send all unlocked outputs from an account to an address
Parameters:
-
$address <String>Address to receive funds -
$subaddr_indices <String>Comma-separated list of subaddress indices to sweep (optional) -
$account_index <number>Index of the account to sweep (optional) -
$payment_id <String>Payment ID (optional) -
$mixin <number>Mixin number (ringsize - 1) (optional) -
$priority <number>Payment ID (optional) -
$below_amount <number>Only send outputs below this amount (optional) -
$unlock_time <number>UNIX time or block height to unlock output (optional) -
$do_not_relay <boolean>Do not relay transaction (optional)or
-
$params <Object>Array containing any of the options listed above, where only address is required
Return: <Object>
{
"amount": "1000000000000",
"fee": "1000020000",
"tx_hash": "c60a64ddae46154a75af65544f73a7064911289a7760be8fb5390cb57c06f2db",
"tx_key": "805abdb3882d9440b6c80490c2d6b95a79dbc6d1b05e514131a91768e8040b04"
}Sweep a single key image to an address
Parameters:
-
$key_image <String>Key image to sweep -
$address <String>Address to receive funds -
$payment_id <String>Payment ID (optional) -
$below_amount <number>Only send outputs below this amount (optional) -
$mixin <number>Mixin number (ringsize - 1) (optional) -
$priority <number>Payment ID (optional) -
$unlock_time <number>UNIX time or block height to unlock output (optional) -
$do_not_relay <boolean>Do not relay transaction (optional)or
-
$params <Object>Array containing any of the options listed above, where Return:<Object>
{
"amount": "1000000000000",
"fee": "1000020000",
"tx_hash": "c60a64ddae46154a75af65544f73a7064911289a7760be8fb5390cb57c06f2db",
"tx_key": "805abdb3882d9440b6c80490c2d6b95a79dbc6d1b05e514131a91768e8040b04"
}Relay a transaction
Parameters:
$hex <String>Blob of transaction to relay
Return: <Object>
Save wallet
Look up incoming payments by payment ID
Parameters:
$payment_id <String>Payment ID to look up
Return: <Object>
{
"payments": [{
"amount": 10350000000000,
"block_height": 994327,
"payment_id": "4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
"tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"unlock_time": 0
}]
}Look up incoming payments by payment ID (or a list of payments IDs) from a given height
Parameters:
$payment_ids <Array>Array of payment IDs to look up$min_block_height <String>Height to begin search
Return: <Object>
{
"payments": [{
"amount": 10350000000000,
"block_height": 994327,
"payment_id": "4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
"tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"unlock_time": 0
}]
}Look up incoming transfers
Parameters:
$type <String>Type of transfer to look up; must be 'all', 'available', or 'unavailable' (incoming transfers which have already been spent)$account_index <number>Index of account to look up (optional)$subaddr_indices <String>Comma-separated list of subaddress indices to look up (optional)
Return: <Object>
{
"transfers": [{
"amount": 10000000000000,
"global_index": 711506,
"spent": false,
"tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"tx_size": 5870
},{
"amount": 300000000000,
"global_index": 794232,
"spent": false,
"tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"tx_size": 5870
},{
"amount": 50000000000,
"global_index": 213659,
"spent": false,
"tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"tx_size": 5870
}]
}Look up a wallet key
Parameters:
$key_type <String>Type of key to look up; must be 'view_key', 'spend_key', or 'mnemonic'
Return: <Object>
{
"key": "7e341d..."
}Look up wallet view key
Return: <Object>
{
"key": "7e341d..."
}Look up wallet spend key
Return: <Object>
{
"key": "2ab810..."
}Look up wallet mnemonic seed
Return: <Object>
{
"key": "2ab810..."
}Create an integrated address from a given payment ID
Parameters:
$payment_id <String>Payment ID (optional)
Return: <Object>
{
"integrated_address": "4BpEv3WrufwXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CG
}Look up the wallet address and payment ID corresponding to an integrated address
Parameters:
$integrated_address <String>Integrated address to split
Return: <Object>
{
"payment_id": "420fa29b2d9a49f5",
"standard_address": "427ZuEhNJQRXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJ
}Stop the wallet, saving the state
Rescan the blockchain from scratch
Add notes to transactions
$txids <Array>Array of transaction IDs to note
Parameters:
$notes <Array>Array of notes (strings) to add
Look up transaction note
Parameters:
$txids <Array>Array of transaction IDs (strings) to look up
Return: <Object>
Set a wallet option
Parameters:
$key <String>Option to set$value <String>Value to set
Look up a wallet option
Parameters:
$key <String>Wallet option to query Return:<Object>
Look up a transaction key
Parameters:
$txid <String>Transaction ID to look up
Return:
Example: {
"tx_key": "e8e97866b1606bd87178eada8f995bf96d2af3fec5db0bc570a451ab1d589b0f"
}Check a transaction key
Parameters:
$address <String>Address that sent transaction$txid <String>Transaction ID$tx_key <String>Transaction key
Return:
Example: {
"confirmations": 1,
"in_pool": ,
"received": 0
}Create proof (signature) of transaction
Parameters:
$address <String>Address that spent funds$txid <String>Transaction ID Return:<Object>
{
"signature": "InProofV1Lq4nejMXxMnAdnLeZhHe3FGCmFdnSvzVM1AiGcXjngTRi4hfHPcDL9D4th7KUuvF9ZH
}Verify transaction proof
Parameters:
$address <String>Address that spent funds$txid <String>Transaction ID$signature <String>Signature (tx_proof)
Return:
{
"confirmations": 2,
"good": 1,
"in_pool": ,
"received": 15752471409492,
}Create proof of a spend
Parameters:
$txid <String>Transaction ID
Return: <Object>
{
"signature": "SpendProofV1RnP6ywcDQHuQTBzXEMiHKbe5ErzRAjpUB1h4RUMfGPNv4bbR6V7EFyiYkCrURwbb
}Verify spend proof
Parameters:
$txid <String>Transaction ID$signature <String>Spend proof to verify
Return: <Object>
{
"good": 1
}Create proof of reserves
Parameters:
$account_index <String>Comma-separated list of account indices of which to prove
Return:
{
"signature": "ReserveProofV11BZ23sBt9sZJeGccf84mzyAmNCP3KzYbE111111111111AjsVgKzau88VxXVGA
}Verify a reserve proof
Parameters:
$address <String>Wallet address$signature <String>Reserve proof
Return: <Object>
{
"good": 1,
"spent": 0,
"total": 0
}Look up transfers
Parameters:
-
$input_types <Array>Array of transfer type strings; possible values include 'all', 'in', 'out', 'pending', 'failed', and 'pool' (optional) -
$account_index <number>Index of account to look (optional) -
$subaddr_indices <String>Comma-separated list of subaddress indices to look up (optional) -
$min_height <number>Minimum block height to use when looking up (optional) -
$max_height <number>Maximum block height to use when looking up (optional)or
-
$inputs_types <Object>Array containing any of the options listed above, where only an input types array is required
Return: <Object>
{
"pool": [{
"amount": 500000000000,
"fee": 0,
"height": 0,
"note": "",
"payment_id": "758d9b225fda7b7f",
"timestamp": 1488312467,
"txid": "da7301d5423efa09fabacb720002e978d114ff2db6a1546f8b820644a1b96208",
"type": "pool"
}]
}Look up transaction by transaction ID
Parameters:
$txid <String>Transaction ID to look up$account_index <String>Index of account to query (optional)
Return: <Object>
{
"transfer": {
"amount": 10000000000000,
"fee": 0,
"height": 1316388,
"note": "",
"payment_id": "0000000000000000",
"timestamp": 1495539310,
"txid": "f2d33ba969a09941c6671e6dfe7e9456e5f686eca72c1a94a3e63ac6d7f27baf",
"type": "in"
}
}Sign a string
Parameters:
$data <String>Data to sign
Return: <Object>
{
"signature": "SigV1Xp61ZkGguxSCHpkYEVw9eaWfRfSoAf36PCsSCApx4DUrKWHEqM9CdNwjeuhJii6LHDVDFxv
}Verify a signature
Parameters:
$data <String>Signed data$address <String>Address that signed data$signature <String>Signature to verify
Return:
{
"good": true
}Export an array of signed key images
Return: <Object>
Import a signed set of key images
Parameters:
$signed_key_images <Array>Array of signed key images
Return:
{
// TODO example
height: ,
spent: ,
unspent:
}Create a payment URI using the official URI specification
Parameters:
$address <String>Address to receive funds$amount <String>Amount of uplexa to request$payment_id <String>Payment ID (optional)$recipient_name <String>Name of recipient (optional)$tx_description <String>Payment description (optional)
Return: <Object>
Parse a payment URI
Parameters:
$uri <String>Payment URI
Return: <Object>
{
"uri": {
"address": "UPX1YbdjaqFL1hNbARqKy2gDDmZcWAHR2JnWDiuYwzMnDFMSRPrVAah2oJfj5g1zRWULxuszr2G9ZPNkgcTDga5c6JVCq9Jp3a
"amount": 10,
"payment_id": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"recipient_name": "uPlexa Project donation address",
"tx_description": "Testing out the make_uri function"
}
}Look up address book entries
Parameters:
$entries <Array>Array of address book entry indices to look up
Return: <Object>
Add entry to the address book
Parameters:
$address <String>Address to add to address book$payment_id <String>Payment ID to use with address in address book (optional)$description <String>Description of address (optional)
Return: <Object>
Delete an entry from the address book
Parameters:
$index <Array>Index of the address book entry to remove
Rescan the blockchain for spent outputs
Start mining
$threads_count <number>Number of threads with which to mine$do_background_mining <boolean>Mine in background?$ignore_battery <boolean>Ignore battery?
Stop mining
Look up a list of available languages for your wallet's seed
Return: <Object>
Create a new wallet
$filename <String>Filename of new wallet to create$password <String>Password of new wallet to create$language <String>Language of new wallet to create
Open a wallet
Parameters:
$filename <String>Filename of wallet to open$password <String>Password of wallet to open
Check if wallet is multisig
Return: <Object>
Non-multisignature wallet return:
{
"multisig": ,
"ready": ,
"threshold": 0,
"total": 0
}Create information needed to create a multisignature wallet
Return: <Object>
{
"multisig_info": "MultisigV1WBnkPKszceUBriuPZ6zoDsU6RYJuzQTiwUqE5gYSAD1yGTz85vqZGetawVvioa
}Create a multisignature wallet
Parameters:
$multisig_info <String>Multisignature information (from eg. prepare_multisig)$threshold <String>Threshold required to spend from multisignature wallet$password <String>Passphrase to apply to multisignature wallet
Return: <Object>
Export multisignature information
Return: <Object>
Import multisignature information
Parameters:
$info <String>Multisignature info (from eg. prepare_multisig)
Return: <Object>
Finalize a multisignature wallet
Parameters:
$multisig_info <String>Multisignature info (from eg. prepare_multisig)$password <String>Multisignature info (from eg. prepare_multisig)
Return: <Object>
Sign a multisignature transaction
Parameters:
$tx_data_hex <String>Blob of transaction to sign
Return: <Object>
Submit (relay) a multisignature transaction
Parameters:
$tx_data_hex <String>Blob of transaction to submit
Return: <Object>
Return the jsonRPCClient used by the class
Return: jsonRPCClient
Alias: getClient
Using work from:
- CryptoChangements [uPlexa_RPC] (bW9uZXJv@gmail.com) (https://github.com/cryptochangements34)
- Serhack [uPlexa Integrations] (nico@serhack.me) (https://serhack.me)
- TheKoziTwo [xmr-integration] (thekozitwo@gmail.com)
- Kacper Rowinski [jsonRPCClient] (krowinski@implix.com)