- Consider to learn self tests: selftest.php
- Self tests contain tests of all transactions which can easily be used as examples
Name | Description |
---|---|
__construct | Creates WavesKit instance |
balance | Gets an address full balance |
base58Decode | Decodes data from base58 string |
base58Encode | Encodes data to base58 string |
base64ToBase64Tx | Converts string from base64 to base64 in transaction notation |
base64TxToBase64 | Converts string from base64 in transaction notation to base64 |
base64TxToBin | Converts base64 string in transaction notation to binary data |
binToBase64Tx | Converts binary data to base64 string in transaction notation |
blake2b256 | Hashes data with blake2b256 |
calculateFee | Calculates fee of a transaction on a node |
compile | Compiles a script |
decryptash | Decrypts data with cryptash parameters |
encryptash | Encrypts data with cryptash parameters |
ensure | Ensures a transaction confirmed and reached required confirmations |
fetch | Fetches GET or POST response |
fetchMulti | Fetches GET or POST responses from all nodes |
getAddress | Gets address |
getAddressByAlias | Gets an address by an alias |
getAddressScript | Gets a script associated with an address |
getBlockAt | Gets a block at a certain height |
getChainId | Gets blockchain identifier value |
getData | Gets data value by an address key from the blockchain |
getLastBitFlip | Get last bit flip option status |
getNodeAddress | Gets main node address |
getOrderById | Gets an order with status by its id for your account |
getOrders | Gets order history for your account |
getPrivateKey | Gets private key |
getPublicKey | Gets public Key |
getSodium | Gets sodium option status |
getStateChanges | Gets state changes of an invoke transaction by its id |
getTransactionById | Gets a transaction by its id |
getTransactions | Gets transactions for an address |
height | Gets current blockchain height |
isAddressValid | Validates an address by a current blockchain identifier |
json_decode | json_decode wrapper for WavesKit |
keccak256 | Hashes data with keccak256 |
log | Logs a message with a level |
nfts | Gets an address NFTs balance |
randomSeed | Generates random seed string |
secureHash | Hashes data with blake2b256 and keccak256 |
setAddress | Sets address |
setBestNode | Internally sets nodes in order of priority by the current height and response time |
setCryptash | Sets cryptash parameters |
setLastBitFlip | Sets last bit flip option |
setLogFilter | Set filter specific messages |
setMatcherFee | Sets an order fee based on matcher settings |
setMatcherSettings | Sets matcher settings |
setNodeAddress | Sets node address with cache lifetime and backup node addresses |
setPairsDatabase | Sets database pairs path |
setPrivateKey | Sets private key |
setPublicKey | Sets public key |
setRSEED | Sets RSEED value (DANGEROUS) |
setSeed | Sets user seed string |
setSodium | Sets sodium option |
sha256 | Hashes data with sha256 |
sha512 | Hashes data with sha512 |
sign | Signs a message with a private key |
timestamp | Gets current timestamp |
txAddressScript | Makes address script transaction as an array |
txAlias | Makes alias transaction as an array |
txAssetScript | Makes asset script transaction as an array |
txBody | Gets transaction body |
txBroadcast | Broadcasts a transaction |
txBurn | Makes burn transaction as an array |
txData | Makes data transaction as an array |
txEvaluate | Evaluates a transaction |
txInvokeScript | Makes invoke script transaction as an array |
txIssue | Makes issue transaction as an array |
txLease | Makes lease transaction as an array |
txLeaseCancel | Makes lease cancel transaction as an array |
txMass | Makes mass transfer transaction as an array |
txMonitor | Monitors for new transaction in realtime |
txOrder | Makes order as an array |
txOrderBroadcast | Broadcasts an order to a matcher |
txOrderCancel | Cancels an order on a matcher |
txReissue | Makes reissue transaction as an array |
txSign | Signs a transaction |
txSponsorship | Makes sponsorship transaction as an array |
txTransfer | Makes transfer transaction as an array |
txUpdateAssetInfo | Makes update asset information transaction as an array |
txValidate | Validates a transaction |
verify | Verifies a signature of a message by a public key |
Description
public __construct (string $chainId, mixed|null $logFunction, bool $keyCaching)
Creates WavesKit instance
Parameters
(string) $chainId
: Blockchain identifier (default: 'W')(mixed|null) $logFunction
: Log functionality (default: null)(bool) $keyCaching
: Cache key flag (default: false)
Return Values
void
Description
public balance (string|null $address, string|null $asset)
Gets an address full balance
Parameters
(string|null) $address
: Address to get balance (default: null)(string|null) $asset
: Asset to get balance (default: null)
Return Values
array|int|false
Balance of all assets as an array or balance of specific asset or FALSE on failure
Description
public base58Decode (string $data, bool $useCache)
Decodes data from base58 string
Parameters
(string) $data
: Base58 string(bool) $useCache
: Use cache or not (default: true)
Return Values
string|false
Decoded data or FALSE on failure
Description
public base58Encode (string $data)
Encodes data to base58 string
Parameters
(string) $data
: Data to encode
Return Values
string
Encoded data
Description
public base64ToBase64Tx (string $base64)
Converts string from base64 to base64 in transaction notation
Parameters
(string) $base64
: Base64 string
Return Values
string
Base64 string in transaction notation
Description
public base64TxToBase64 (string $base64)
Converts string from base64 in transaction notation to base64
Parameters
(string) $base64
: Base64 string in transaction notation
Return Values
string
Base64 string
Description
public base64TxToBin (string $base64)
Converts base64 string in transaction notation to binary data
Parameters
(string) $base64
: Base64 string in transaction notation
Return Values
string
Binary data
Description
public binToBase64Tx (string $bin)
Converts binary data to base64 string in transaction notation
Parameters
(string) $bin
: Binary data
Return Values
string
Base64 string in transaction notation
Description
public blake2b256 (string $data)
Hashes data with blake2b256
Parameters
(string) $data
: Data to hash
Return Values
string
Hash result
Description
public calculateFee (array $tx)
Calculates fee of a transaction on a node
Parameters
(array) $tx
: Transaction as an array
Return Values
int|false
Minimal fee for transaction or FALSE on failure
Description
public compile (string $script)
Compiles a script
Parameters
(string) $script
: Text of the script
Return Values
array|false
Compiled script information or FALSE on failure
Description
public decryptash (string $data)
Decrypts data with cryptash parameters
Parameters
(string) $data
: Data to decrypt
Return Values
string|false
Decrypted data or FALSE on failure
Description
public encryptash (string $data)
Encrypts data with cryptash parameters
Parameters
(string) $data
: Data to encrypt
Return Values
string|false
Encrypted data or FALSE on failure
Description
public ensure (array $tx, int $confirmations, int|float $sleep, int $timeout, bool $hard)
Ensures a transaction confirmed and reached required confirmations
Parameters
(array) $tx
: Transaction as an array(int) $confirmations
: Number of confirmations to reach (default: 0)(int|float) $sleep
: Seconds to sleep between requests (default: 0.5)(int) $timeout
: Timeout to reach lost status (default: 30)(bool) $hard
: Use hard timeout (default: false)
Return Values
array|false
Ensured transaction as an array or FALSE on failure
Description
public fetch (string $url, bool $post, string|null $data, array|null $ignoreCodes, array|null $headers)
Fetches GET or POST response
Parameters
(string) $url
: URL of request(bool) $post
: POST or GET (default: GET)(string|null) $data
: Data for POST (default: null)(array|null) $ignoreCodes
: Array of ignored HTTP codes (default: null)(array|null) $headers
: Optional HTTP headers (default: null)
Return Values
string|false
Returns response data or FALSE on failure
Description
public fetchMulti (string $url, bool $post, string|null $data, array|null $ignoreCodes, array|null $headers)
Fetches GET or POST responses from all nodes
Parameters
(string) $url
: URL of request(bool) $post
: POST or GET (default: GET)(string|null) $data
: Data for POST (default: null)(array|null) $ignoreCodes
: Array of ignored HTTP codes (default: null)(array|null) $headers
: Optional HTTP headers (default: null)
Return Values
array|false
Returns data responses from all nodes or FALSE on failure
Description
public getAddress (bool $raw)
Gets address
Parameters
(bool) $raw
: String format is binary or base58 (default: base58)
Return Values
string|false
Address or FALSE on failure
Description
public getAddressByAlias (string $alias)
Gets an address by an alias
Parameters
(string) $alias
: Alias
Return Values
string|false
Address or FALSE on failure
Description
public getAddressScript (string|null $address)
Gets a script associated with an address
Parameters
(string|null) $address
: Address to get the script for (default: null)
Return Values
string|false
Address script information or FALSE on failure
Description
public getBlockAt (int $height, bool $headers)
Gets a block at a certain height
Parameters
(int) $height
: Height of the block(bool) $headers
: Just headers or the full block information (default: full block)
Return Values
array|false
Block information or FALSE on failure
Description
public getChainId (void)
Gets blockchain identifier value
Parameters
This function has no parameters.
Return Values
string
Blockchain identifier value
Description
public getData (string $key, string $address, bool $justValue)
Gets data value by an address key from the blockchain
Parameters
(string) $key
: Key to get value(string) $address
: Address of the key value pair (default: null)(bool) $justValue
: Get just value or full information (default: just value)
Return Values
mixed|false
Value from blockchain by the key
Description
public getLastBitFlip (void)
Get last bit flip option status
Parameters
This function has no parameters.
Return Values
bool
Enabled or disabled
Description
public getNodeAddress (void)
Gets main node address
Parameters
This function has no parameters.
Return Values
string|false
Main node address or FALSE on failure
Description
public getOrderById (string $orderId)
Gets an order with status by its id for your account
Parameters
(string) $orderId
: Id of the order
Return Values
array|false
Your order as an array or FALSE on failure
Description
public getOrders (bool $activeOnly, bool|null $closedOnly)
Gets order history for your account
Parameters
(bool) $activeOnly
: Active only orders (default: true)(bool|null) $closedOnly
: Closed only orders (default: null)
Return Values
array|false
Your orders as an array or FALSE on failure
Description
public getPrivateKey (bool $raw, string|null $seed, string|null $prefix, bool|false $noret)
Gets private key
Parameters
(bool) $raw
: String format is binary or base58 (default: binary)(string|null) $seed
: Seed string in binary format (default: null)(string|null) $prefix
: Prefix string in binary format (default: "\0\0\0\0")(bool|false) $noret
: Do not return the key (default: false)
Return Values
string|bool
Private key or FALSE on failure or TRUE on noret
Description
public getPublicKey (bool $raw)
Gets public Key
Parameters
(bool) $raw
: String format is binary or base58 (default: base58)
Return Values
string|false
Public key or FALSE on failure
Description
public getSodium (void)
Gets sodium option status
Parameters
This function has no parameters.
Return Values
bool
Enabled or disabled
Description
public getStateChanges (string $id)
Gets state changes of an invoke transaction by its id
Parameters
(string) $id
: Id of the invoke transaction
Return Values
array|false
Invoke transaction with state changes as an array or FALSE on failure
Description
public getTransactionById (string $id, bool $unconfirmed)
Gets a transaction by its id
Parameters
(string) $id
: Id of the transaction(bool) $unconfirmed
: Search in unconfirmed or confirmed transactions (default: confirmed)
Return Values
array|false
Found transaction as an array or FALSE on failure
Description
public getTransactions (string|null $address, int $limit, string|null $after)
Gets transactions for an address
Parameters
(string|null) $address
: Address to get transactions (default: null)(int) $limit
: Limit of transactions count (default: 100)(string|null) $after
: Id of a transaction to paginate from (default: null)
Return Values
array|false
Transactions as an arrays or FALSE on failure
Description
public height (void)
Gets current blockchain height
Parameters
This function has no parameters.
Return Values
int|false
Current blockchain height or FALSE on failure
Description
public isAddressValid (mixed $address, mixed $raw)
Validates an address by a current blockchain identifier
Parameters
(mixed) $address
(mixed) $raw
Return Values
bool
Returns TRUE if the address is valid or FALSE on failure
Description
public json_decode (string $json)
json_decode wrapper for WavesKit
Parameters
(string) $json
Return Values
array|false
Description
public keccak256 (string $data)
Hashes data with keccak256
Parameters
(string) $data
: Data to hash
Return Values
string
Hash result
Description
public log (string $level, string $message)
Logs a message with a level
Parameters
(string) $level
: Message level(string) $message
: Message
Return Values
void
Description
public nfts (string|null $address)
Gets an address NFTs balance
Parameters
(string|null) $address
: Address to get NFTs (default: null)
Return Values
array|int|false
Balance of all NFTs as an array or FALSE on failure
Description
public randomSeed (int $words)
Generates random seed string
Parameters
(int) $words
: Words in seed string (default: 15)
Return Values
string|false
Returns random seed or FALSE on failure
Description
public secureHash (string $data)
Hashes data with blake2b256 and keccak256
Parameters
(string) $data
: Data to hash
Return Values
string
Hash result
Description
public setAddress (string $address, bool $raw)
Sets address
Parameters
(string) $address
: Address(bool) $raw
: String format is binary or base58 (default: base58)
Return Values
void
Description
public setBestNode (void)
Internally sets nodes in order of priority by the current height and response time
Parameters
This function has no parameters.
Return Values
void
Description
public setCryptash (string $secret, int $iv, int $mac, string $hash)
Sets cryptash parameters
Parameters
(string) $secret
: Secret string(int) $iv
: IV size(int) $mac
: MAC size(string) $hash
: Hash algorithm (default: sha256)
Return Values
void
Description
public setLastBitFlip (bool $enabled)
Sets last bit flip option
Parameters
(bool) $enabled
: Enable or disable (default: enable)
Return Values
void
Description
public setLogFilter (array $filter)
Set filter specific messages
Parameters
(array) $filter
: Array of sub-strings to filter
Return Values
void
Description
public setMatcherFee (array $order, bool $discount)
Sets an order fee based on matcher settings
Parameters
(array) $order
: Order as an array(bool) $discount
: Use dicount asset (default: true)
Return Values
array|false
Order as an array or FALSE on failure
Description
public setMatcherSettings (array|null $settings)
Sets matcher settings
Parameters
(array|null) $settings
: Matcher settings or NULL to get them on-the-fly (default: null)
Return Values
bool
TRUE on success or FALSE on failure
Description
public setNodeAddress (string|array $nodeAddress, int|float $cacheLifetime, array|null $backupNodes)
Sets node address with cache lifetime and backup node addresses
Parameters
(string|array) $nodeAddress
: Main node address to work with(int|float) $cacheLifetime
: Cache lifetime in seconds (default: 0.5)(array|null) $backupNodes
: Backup node addresses to fallback
Return Values
void
Description
public setPairsDatabase (mixed $path)
Sets database pairs path
Parameters
(mixed) $path
: Path or an existing PDO for the database
Return Values
void
Description
public setPrivateKey (string $privateKey, bool $raw)
Sets private key
Parameters
(string) $privateKey
: Private key(bool) $raw
: String format is binary or base58 (default: base58)
Return Values
void
Description
public setPublicKey (string $publicKey, bool $raw)
Sets public key
Parameters
(string) $publicKey
: Public key(bool) $raw
: String format is binary or base58 (default: base58)
Return Values
void
Description
public setRSEED (string $rseed)
Sets RSEED value (DANGEROUS)
Parameters
(string) $rseed
: RSEED value
Return Values
void
Description
public setSeed (string $seed, bool $raw, string|null $prefix)
Sets user seed string
Parameters
(string) $seed
: Seed string(bool) $raw
: String format is binary or base58 (default: binary)(string|null) $prefix
: Prefix string in binary format (default: "\0\0\0\0")
Return Values
void
Description
public setSodium (bool $enabled)
Sets sodium option
Parameters
(bool) $enabled
: Enable or disable (default: enable)
Return Values
void
Description
public sha256 (string $data)
Hashes data with sha256
Parameters
(string) $data
: Data to hash
Return Values
string
Hash result
Description
public sha512 (string $data)
Hashes data with sha512
Parameters
(string) $data
: Data to hash
Return Values
string
Hash result
Description
public sign (string $data, string|null $key)
Signs a message with a private key
Parameters
(string) $data
: Data to sign(string|null) $key
: Private key (default: null)
Return Values
string|false
Signature of data or FALSE on failure
Description
public timestamp (bool $fromNode)
Gets current timestamp
Parameters
(bool) $fromNode
: Timstamp from node or local (default: local)
Return Values
int|false
Timestamp or FALSE on failure
Description
public txAddressScript (string $script, array|null $options)
Makes address script transaction as an array
Parameters
(string) $script
: Script to set(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Address script transaction as an array or FALSE on failure
Description
public txAlias (string $alias, array|null $options)
Makes alias transaction as an array
Parameters
(string) $alias
: Alias(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Alias transaction as an array or FALSE on failure
Description
public txAssetScript (string $asset, string $script, array|null $options)
Makes asset script transaction as an array
Parameters
(string) $asset
: Asset id to script change(string) $script
: Asset script(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Asset script transaction as an array or FALSE on failure
Description
public txBody (string $tx)
Gets transaction body
Parameters
(string) $tx
: Transaction as an array
Return Values
string|false
Body of the transaction or FALSE on failure
Description
public txBroadcast (array $tx)
Broadcasts a transaction
Parameters
(array) $tx
: Transaction as an array
Return Values
array|false
Broadcasted transaction as an array or FALSE on failure
Description
public txBurn (string $asset, int $quantity, array|null $options)
Makes burn transaction as an array
Parameters
(string) $asset
: Asset id(int) $quantity
: Asset quantity to burn(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Burn transaction as an array or FALSE on failure
Description
public txData (array $userData, array|null $options)
Makes data transaction as an array
Parameters
(array) $userData
: Array of key value pairs(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Data transaction as an array or FALSE on failure
Description
public txEvaluate (array $tx)
Evaluates a transaction
Parameters
(array) $tx
: Transaction as an array
Return Values
array|false
Evaluated transaction as an array or FALSE on failure
Description
public txInvokeScript (string $dappAddress, string $function, array|null $args, array|null $payments, array|null $options)
Makes invoke script transaction as an array
Parameters
(string) $dappAddress
: Address of dApp script(string) $function
: Function to call(array|null) $args
: Arguments as an array (default: null)(array|null) $payments
: Payments as an array (default: null)(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Invoke script transaction as an array or FALSE on failure
Description
public txIssue (string $name, string $description, int $quantity, int $decimals, bool $reissuable, string $script, array|null $options)
Makes issue transaction as an array
Parameters
(string) $name
: Asset name(string) $description
: Asset description(int) $quantity
: Asset quantity to issue(int) $decimals
: Asset decimals (0 .. 8)(bool) $reissuable
: Asset is reissuable or not(string) $script
: Asset script (default: null)(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Issue transaction as an array or FALSE on failure
Description
public txLease (string $recipient, int $amount, array|null $options)
Makes lease transaction as an array
Parameters
(string) $recipient
: Recipient address or alias(int) $amount
: Amount to lease(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Lease transaction as an array or FALSE on failure
Description
public txLeaseCancel (string $leaseId, array|null $options)
Makes lease cancel transaction as an array
Parameters
(string) $leaseId
: Lease transaction id to cancel(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Lease cancel transaction as an array or FALSE on failure
Description
public txMass (array $recipients, array $amounts, string $asset, array|null $options)
Makes mass transfer transaction as an array
Parameters
(array) $recipients
: Array of recipient addresses or aliases(array) $amounts
: Array of amounts to send(string) $asset
: Asset id to send(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Mass transfer transaction as an array or FALSE on failure
Description
public txMonitor (callable $callback, int $confirmations, int $depth, int $sleep)
Monitors for new transaction in realtime
Parameters
(callable) $callback
: Function to call when new transactions apear(int) $confirmations
: Number of confirmations to reach stability(int) $depth
: Minimal height to scan back(int) $sleep
: Seconds to sleep between requests
Return Values
bool
TRUE if monitoring was successful or FALSE on failure
Description
public txOrder (string $amountAsset, string $priceAsset, bool $isSell, int $amount, int $price, int $expiration, array|null $options)
Makes order as an array
Parameters
(string) $amountAsset
: Amount asset id(string) $priceAsset
: Price asset id(bool) $isSell
: Sell or buy(int) $amount
: Order amount(int) $price
: Order price(int) $expiration
: Order expiration(array|null) $options
: Order options as an array (default: null)
Return Values
array
Order as an array
Description
public txOrderBroadcast (array $tx)
Broadcasts an order to a matcher
Parameters
(array) $tx
: Order as an array
Return Values
array|false
Broadcasted order as an array or FALSE on failure
Description
public txOrderCancel (array|string $tx)
Cancels an order on a matcher
Parameters
(array|string) $tx
: Order as an array or word "ALL" to cancel all orders
Return Values
bool
TRUE on cancel or FALSE on failure
Description
public txReissue (string $asset, int $quantity, bool $reissuable, array|null $options)
Makes reissue transaction as an array
Parameters
(string) $asset
: Asset id(int) $quantity
: Asset quantity to reissue(bool) $reissuable
: Asset is reissuable or not(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Reissue transaction as an array or FALSE on failure
Description
public txSign (array $tx, int|null $proofIndex)
Signs a transaction
Parameters
(array) $tx
: Transaction as an array(int|null) $proofIndex
: Index of a proof in proofs (default: null)
Return Values
array|false
Signed transaction as an array or FALSE on failure
Description
public txSponsorship (string $asset, int , array|null $options)
Makes sponsorship transaction as an array
Parameters
(string) $asset
: Asset id of the sponsorship(int)
: minSponsoredAssetFee Minimal sponsored asset fee(array|null) $options
: Transaction options as an array (default: null)
Return Values
array|false
Sponsorship transaction as an array or FALSE on failure
Description
public txTransfer (string $recipient, int $amount, string|null $asset, array|null $options)
Makes transfer transaction as an array
Parameters
(string) $recipient
: Recipient address or alias(int) $amount
: Amount to send(string|null) $asset
: Asset id (default: null)(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Transfer transaction as an array or FALSE on failure
Description
public txUpdateAssetInfo (string $assetId, string $name, string $description, array|null $options)
Makes update asset information transaction as an array
Parameters
(string) $assetId
: Asset ID(string) $name
: Updated asset name(string) $description
: Updated asset description(array|null) $options
: Transaction options as an array (default: null)
Return Values
array
Update asset information transaction as an array or FALSE on failure
Description
public txValidate (array $tx)
Validates a transaction
Parameters
(array) $tx
: Transaction as an array
Return Values
array|false
Validated transaction as an array or FALSE on failure
Description
public verify (string $sig, string $data, string|null $key)
Verifies a signature of a message by a public key
Parameters
(string) $sig
: Signature to verify(string) $data
: Signed data(string|null) $key
: Public key (default: null)
Return Values
bool
Returns TRUE if the signature is valid or FALSE on failure