Operation class abstract
Base class for all operations in a Stellar transaction.
Operations are the commands that mutate the ledger state. A transaction contains one or more operations that are executed atomically. Each operation can optionally specify a source account that differs from the transaction's source account.
Available operation types:
- CreateAccountOperation - Create and fund a new account
- PaymentOperation - Send assets to an account
- PathPaymentStrictReceiveOperation - Send through a payment path with exact receive amount
- PathPaymentStrictSendOperation - Send through a payment path with exact send amount
- ManageSellOfferOperation - Create, update, or delete a sell offer
- ManageBuyOfferOperation - Create, update, or delete a buy offer
- CreatePassiveSellOfferOperation - Create a passive sell offer
- SetOptionsOperation - Set account options (inflation, thresholds, signers, etc.)
- ChangeTrustOperation - Create, update, or delete a trustline
- AllowTrustOperation - Authorize or deauthorize an account to hold an asset
- AccountMergeOperation - Merge one account into another
- ManageDataOperation - Set, modify, or delete a data entry
- BumpSequenceOperation - Bump account sequence number
- CreateClaimableBalanceOperation - Create a claimable balance entry
- ClaimClaimableBalanceOperation - Claim a claimable balance
- BeginSponsoringFutureReservesOperation - Begin sponsoring reserves for another account
- EndSponsoringFutureReservesOperation - End sponsoring reserves
- RevokeSponsorshipOperation - Revoke sponsorship of a ledger entry or signer
- ClawbackOperation - Clawback an asset from an account
- ClawbackClaimableBalanceOperation - Clawback a claimable balance
- SetTrustLineFlagsOperation - Set flags on a trustline
- LiquidityPoolDepositOperation - Deposit assets into a liquidity pool
- LiquidityPoolWithdrawOperation - Withdraw assets from a liquidity pool
- InvokeHostFunctionOperation - Invoke a Soroban smart contract function
- ExtendFootprintTTLOperation - Extend the TTL of Soroban contract storage entries
- RestoreFootprintOperation - Restore archived Soroban contract storage entries
Example:
// Create a payment operation
var payment = PaymentOperationBuilder(
destinationAccountId,
Asset.native(),
"100.50"
).build();
// Create a payment with custom source account
var paymentWithSource = PaymentOperationBuilder(
destinationAccountId,
Asset.native(),
"100.50"
).setSourceAccount(customSourceAccount).build();
// Add operation to a transaction
var transaction = TransactionBuilder(sourceAccount)
.addOperation(payment)
.build();
See also:
- Transaction for building and submitting transactions
- TransactionBuilder for constructing transactions with operations
- Stellar developer docs
- Implementers
- AccountMergeOperation
- AllowTrustOperation
- BeginSponsoringFutureReservesOperation
- BumpSequenceOperation
- ChangeTrustOperation
- ClaimClaimableBalanceOperation
- ClawbackClaimableBalanceOperation
- ClawbackOperation
- CreateAccountOperation
- CreateClaimableBalanceOperation
- CreatePassiveSellOfferOperation
- EndSponsoringFutureReservesOperation
- ExtendFootprintTTLOperation
- InvokeHostFunctionOperation
- LiquidityPoolDepositOperation
- LiquidityPoolWithdrawOperation
- ManageBuyOfferOperation
- ManageDataOperation
- ManageSellOfferOperation
- PathPaymentStrictReceiveOperation
- PathPaymentStrictSendOperation
- PaymentOperation
- RestoreFootprintOperation
- RevokeSponsorshipOperation
- SetOptionsOperation
- SetTrustLineFlagsOperation
Constructors
- Operation()
- Creates a base Operation instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sourceAccount ↔ MuxedAccount?
-
Optional source account for this operation.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toOperationBody(
) → XdrOperationBody - Converts this operation to its XDR operation body representation.
-
toString(
) → String -
A string representation of this object.
inherited
-
toXdr(
) → XdrOperation - Converts this operation to its XDR representation.
-
toXdrBase64(
) → String - Returns base64-encoded Operation XDR object from this operation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromXdr(
XdrOperation xdrOp) → Operation -
Returns Operation object from an Operation XDR object
xdrOp.