\RippleRestAccount

Account helper for RippleRest

Summary

Methods
Properties
Constants
__construct()
getBalances()
getTrustlines()
addTrustline()
getSettings()
setSettings()
getNotification()
getPayment()
findPaymentPaths()
createPayment()
submitPayment()
queryPayments()
$address
$secret
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$address

$address

Account's Address (rXXXXXX.

..)

$secret

$secret

Account's secret

Methods

__construct()

__construct(string $address, string $secret) : \RippleRestAccount

Create a new instance of RippleRestAccount.

Parameters

string $address

{@see RippleRestAccount::$address}

string $secret

{@see RippleRestAccount::$secret}

Returns

\RippleRestAccount

getBalances()

getBalances() : \RippleRestBalance[]

Get an account's existing balances.

This includes XRP balance (which does not include a counterparty) and trustline balances.

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestBalance[]

getTrustlines()

getTrustlines() : \RippleRestTrustline[]

Returns Trustlines for this account.

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestTrustline[]

addTrustline()

addTrustline(mixed $obj, boolean $allowRippling) : array

Add trustline

Parameters

mixed $obj

Either a string representation of trustline limit, Hash containing value, currency, counterparty or a string form value/currency/counterparty.

boolean $allowRippling

See here for details

Throws

\Exception

if secret is missing from the Account object

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

array

getSettings()

getSettings() : \RippleRestAccountSettings

Returns a AccountSettings object for this account.

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestAccountSettings

setSettings()

setSettings(\RippleRestAccountSettings $obj) : null

Update this account's settings with a AccountSettings object.

Parameters

\RippleRestAccountSettings $obj

Throws

\Exception

if secret is missing from the Account object

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

null

getNotification()

getNotification(string $hash) : \RippleRestNotification

Get notifications.

Clients using notifications to monitor their account activity should pay particular attention to the state and result fields. The state field will either be validated or failed and represents the finalized status of that transaction. The result field will be tesSUCCESS if the state was validated. If the transaction failed, result will contain the rippled or ripple-lib error code.

Notifications have next_notification_url and previous_notification_url's. Account notifications can be polled by continuously following the next_notification_url, and handling the resultant notifications, until the next_notification_url is an empty string. This means that there are no new notifications but, as soon as there are, querying the same URL that produced this notification in the first place will return the same notification but with the next_notification_url set.

Parameters

string $hash

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestNotification

getPayment()

getPayment(string $hash) : \RippleRestPayment

Returns an individual payment.

Parameters

string $hash

Payment hash or client resource ID

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestPayment

findPaymentPaths()

findPaymentPaths(mixed $destinationAccount, mixed $destinationAmount, string[] $sourceCurrencies) : \RippleRestPayment[]

Query `rippled` for possible payment "paths" through the Ripple Network to deliver the given amount to the specified `destination_account`. If the `destination_amount` issuer is not specified, paths will be returned for all of the issuers from whom the `destination_account` accepts the given currency.

Parameters

mixed $destinationAccount

[String, RippleRestAccount] destination account

mixed $destinationAmount

[String, RippleRestAmount] destination amount

string[] $sourceCurrencies

an array of source currencies that can be used to constrain the results returned (e.g. ["XRP", "USD+r...", "BTC+r..."]) Currencies can be denoted by their currency code (e.g. USD) or by their currency code and issuer (e.g. USD+r...). If no issuer is specified for a currency other than XRP, the results will be limited to the specified currencies but any issuer for that currency will do.

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\RippleRestPayment[]

createPayment()

createPayment(\RippleRestAccount $destinationAccount, mixed $destinationAmount) : \RippleRestPayment

Create a RippleRestPayment object with some field filled.

Parameters

\RippleRestAccount $destinationAccount

destination account

mixed $destinationAmount

[String, RippleRestAmount] destination amount

Returns

\RippleRestPayment

submitPayment()

submitPayment(\RippleRestPaymeng $payment) : string

Submits a payment

Parameters

\RippleRestPaymeng $payment

Payment object

Throws

\Exception

if secret is missing from the Account object

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

string —

Client resource ID

queryPayments()

queryPayments(array $options) : \Payment[]

Browse historical payments in bulk.

Parameters

array $options

(Defaults to null) An assoc array with the following options:

  • sourceAccount [string, RippleRestAccount] If specified, limit the results to payments initiated by a particular account
  • destinationAccount [string, RippleRestAccount] If specified, limit the results to payments made to a particular account
  • excludeFailed [boolean] if set to true, this will return only payment that were successfully validated and written into the Ripple Ledger
  • startLedger [string] If earliest_first is set to true this will be the index number of the earliest ledger queried, or the most recent one if earliest_first is set to false. Defaults to the first ledger the rippled has in its complete ledger. An error will be returned if this value is outside the rippled's complete ledger set
  • endLedger [string] If earliest_first is set to true this will be the index number of the most recent ledger queried, or the earliest one if earliest_first is set to false. Defaults to the last ledger the rippled has in its complete ledger. An error will be returned if this value is outside the rippled's complete ledger set
  • earliestFirst [boolean] Determines the order in which the results should be displayed. Defaults to true
  • resultsPerPage [int] Limits the number of resources displayed per page. Defaults to 20
  • page [int] : The page to be displayed. If there are fewer than the results_per_page number displayed, this indicates that this is the last page

Throws

\RippleRestError

if RippleRest server returns an error

\RippleRestProtocolError

if protocol is wrong or network is down

Returns

\Payment[]