Operation

Operation

Methods

(static) accountMerge(opts) → {xdr.AccountMergeOp}

Transfers native balance to destination account.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
destination string

Destination to merge the source account into.

source string <optional>

The source account (defaults to transaction source).

Returns:
Type:
xdr.AccountMergeOp

(static) allowTrust(opts) → {xdr.AllowTrustOp}

Returns an XDR AllowTrustOp. An "allow trust" operation authorizes another account to hold your account's credit for a given asset.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
trustor string

The trusting account (the one being authorized)

assetCode string

The asset code being authorized.

authorize boolean

True to authorize the line, false to deauthorize.

source string <optional>

The source account (defaults to transaction source).

Returns:
Type:
xdr.AllowTrustOp

(static) changeTrust(opts) → {xdr.ChangeTrustOp}

Returns an XDR ChangeTrustOp. A "change trust" operation adds, removes, or updates a trust line for a given asset from the source account to another. The issuer being trusted and the asset code are in the given Asset object.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
asset Asset

The asset for the trust line.

limit string <optional>

The limit for the asset, defaults to max int64. If the limit is set to "0" it deletes the trustline.

source string <optional>

The source account (defaults to transaction source).

Returns:
Type:
xdr.ChangeTrustOp

(static) createAccount(opts) → {xdr.CreateAccountOp}

Create and fund a non existent account.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
destination string

Destination account ID to create an account for.

startingBalance string

Amount in XLM the account should be funded for. Must be greater than the reserve balance amount.

source string <optional>

The source account for the payment. Defaults to the transaction's source account.

Returns:
Type:
xdr.CreateAccountOp

(static) createPassiveOffer(opts) → {xdr.CreatePassiveOfferOp}

Returns a XDR CreatePasiveOfferOp. A "create passive offer" operation creates an offer that won't consume a counter offer that exactly matches this offer. This is useful for offers just used as 1:1 exchanges for path payments. Use manage offer to manage this offer after using this operation to create it.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
selling Asset

What you're selling.

buying Asset

What you're buying.

amount string

The total amount you're selling. If 0, deletes the offer.

price number | string | BigNumber | Object

Price of 1 unit of selling in terms of buying.

Name Type Description
n number

If opts.price is an object: the price numerator

d number

If opts.price is an object: the price denominator

source string <optional>

The source account (defaults to transaction source).

Throws:

Throws Error when the best rational approximation of price cannot be found.

Type
Error
Returns:
Type:
xdr.CreatePassiveOfferOp

(static) fromXDRObject(operation) → {Operation}

Converts the XDR Operation object to the opts object used to create the XDR operation.

Source:
Parameters:
Name Type Description
operation xdr.Operation

An XDR Operation.

Returns:
Type:
Operation

(static) inflation(optsopt) → {xdr.InflationOp}

This operation generates the inflation.

Source:
Parameters:
Name Type Attributes Description
opts object <optional>
Name Type Attributes Description
source string <optional>

The optional source account.

Returns:
Type:
xdr.InflationOp

(static) manageData(opts) → {xdr.ManageDataOp}

This operation adds data entry to the ledger.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
name string

The name of the data entry.

value string | Buffer

The value of the data entry.

source string <optional>

The optional source account.

Returns:
Type:
xdr.ManageDataOp

(static) manageOffer(opts) → {xdr.ManageOfferOp}

Returns a XDR ManageOfferOp. A "manage offer" operation creates, updates, or deletes an offer.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
selling Asset

What you're selling.

buying Asset

What you're buying.

amount string

The total amount you're selling. If 0, deletes the offer.

price number | string | BigNumber | Object

Price of 1 unit of selling in terms of buying.

Name Type Description
n number

If opts.price is an object: the price numerator

d number

If opts.price is an object: the price denominator

offerId number | string <optional>

If 0, will create a new offer (default). Otherwise, edits an exisiting offer.

source string <optional>

The source account (defaults to transaction source).

Throws:

Throws Error when the best rational approximation of price cannot be found.

Type
Error
Returns:
Type:
xdr.ManageOfferOp

(static) pathPayment(opts) → {xdr.PathPaymentOp}

Returns a XDR PaymentOp. A "payment" operation send the specified amount to the destination account, optionally through a path. XLM payments create the destination account if it does not exist.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
sendAsset Asset

The asset to pay with.

sendMax string

The maximum amount of sendAsset to send.

destination string

The destination account to send to.

destAsset Asset

The asset the destination will receive.

destAmount string

The amount the destination receives.

path Array.<Asset>

An array of Asset objects to use as the path.

source string <optional>

The source account for the payment. Defaults to the transaction's source account.

Returns:
Type:
xdr.PathPaymentOp

(static) payment(opts) → {xdr.PaymentOp}

Create a payment operation.

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
destination string

The destination account ID.

asset Asset

The asset to send.

amount string

The amount to send.

source string <optional>

The source account for the payment. Defaults to the transaction's source account.

Returns:
Type:
xdr.PaymentOp

(static) setOptions(opts) → {xdr.SetOptionsOp}

Returns an XDR SetOptionsOp. A "set options" operations set or clear account flags, set the account's inflation destination, and/or add new signers to the account. The flags used in opts.clearFlags and opts.setFlags can be the following:

It's possible to set/clear multiple flags at once using logical or.

Source:
See:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
inflationDest string <optional>

Set this account ID as the account's inflation destination.

clearFlags number | string <optional>

Bitmap integer for which account flags to clear.

setFlags number | string <optional>

Bitmap integer for which account flags to set.

masterWeight number | string <optional>

The master key weight.

lowThreshold number | string <optional>

The sum weight for the low threshold.

medThreshold number | string <optional>

The sum weight for the medium threshold.

highThreshold number | string <optional>

The sum weight for the high threshold.

signer object <optional>

Add or remove a signer from the account. The signer is deleted if the weight is 0. Only one of ed25519PublicKey, sha256Hash, preAuthTx should be defined.

Name Type Attributes Description
ed25519PublicKey string <optional>

The ed25519 public key of the signer.

sha256Hash Buffer | string <optional>

sha256 hash (Buffer or hex string) of preimage that will unlock funds. Preimage should be used as signature of future transaction.

preAuthTx Buffer | string <optional>

Hash (Buffer or hex string) of transaction that will unlock funds.

weight number | string <optional>

The weight of the new signer (0 to delete or 1-255)

homeDomain string <optional>

sets the home domain used for reverse federation lookup.

source string <optional>

The source account (defaults to transaction source).

Returns:
Type:
xdr.SetOptionsOp