# new Operation()
Operation
class represents
operations in
Stellar network.
Use one of static methods to create operations:
Operation.createAccount
Operation.payment
Operation.pathPaymentStrictReceive
Operation.pathPaymentStrictSend
Operation.manageSellOffer
Operation.manageBuyOffer
Operation.createPassiveSellOffer
Operation.setOptions
Operation.changeTrust
Operation.allowTrust
Operation.accountMerge
Operation.inflation
Operation.manageData
Operation.bumpSequence
Operation.createClaimableBalance
Operation.claimClaimableBalance
Operation.beginSponsoringFutureReserves
Operation.endSponsoringFutureReserves
Operation.revokeAccountSponsorship
Operation.revokeTrustlineSponsorship
Operation.revokeOfferSponsorship
Operation.revokeDataSponsorship
Operation.revokeClaimableBalanceSponsorship
Operation.revokeLiquidityPoolSponsorship
Operation.revokeSignerSponsorship
Operation.clawback
Operation.clawbackClaimableBalance
Operation.setTrustLineFlags
Operation.liquidityPoolDeposit
Operation.liquidityPoolWithdraw
Operation.invokeHostFunction
, which has the following additional "pseudo-operations" that make building host functions easier:Operation.extendFootprintTtlOp
Operation.restoreFootprint
Methods
# static accountMerge(opts) → {xdr.Operation}
Transfers native balance to destination account.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
options object |
|
destination |
string
|
destination to merge the source account into |
|
source |
string
|
<optional> |
operation source account (defaults to transaction source) |
an Account Merge operation (xdr.AccountMergeOp)
xdr.Operation
# static allowTrust(opts) → {xdr.AllowTrustOp}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
trustor |
string
|
The trusting account (the one being authorized) |
|
assetCode |
string
|
The asset code being authorized. |
|
authorize |
0
|
1
|
2
|
|
|
source |
string
|
<optional> |
The source account (defaults to transaction source). |
- Deprecated:
- since v5.0 Returns an XDR AllowTrustOp. An "allow trust" operation authorizes another account to hold your account's credit for a given asset.
View Source js-stellar-base/src/operations/allow_trust.js, line 22
Allow Trust operation
xdr.AllowTrustOp
# static beginSponsoringFutureReserves(opts) → {xdr.Operation}
Create a "begin sponsoring future reserves" operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
sponsoredId |
string
|
The sponsored account id. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.beginSponsoringFutureReserves({
sponsoredId: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7'
});
# static bumpSequence(opts) → {xdr.BumpSequenceOp}
This operation bumps sequence number.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
bumpTo |
string
|
Sequence number to bump to. |
|
source |
string
|
<optional> |
The optional source account. |
Operation
xdr.BumpSequenceOp
# 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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
asset |
Asset
|
LiquidityPoolAsset
|
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). |
Change Trust operation
xdr.ChangeTrustOp
# static claimClaimableBalance(opts) → {xdr.Operation}
Create a new claim claimable balance operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
balanceId |
string
|
The claimable balance id to be claimed. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
Claim claimable balance operation
xdr.Operation
Example
const op = Operation.claimClaimableBalance({
balanceId: '00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be',
});
# static clawback(opts) → {xdr.ClawbackOp}
Creates a clawback operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
asset |
Asset
|
The asset being clawed back. |
|
amount |
string
|
The amount of the asset to claw back. |
|
from |
string
|
The public key of the (optionally-muxed) account to claw back from. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr.ClawbackOp
# static clawbackClaimableBalance(opts) → {xdr.ClawbackClaimableBalanceOp}
Creates a clawback operation for a claimable balance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
balanceId |
string
|
The claimable balance ID to be clawed back. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr.ClawbackClaimableBalanceOp
Example
const op = Operation.clawbackClaimableBalance({
balanceId: '00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be',
});
# static createAccount(opts) → {xdr.CreateAccountOp}
Create and fund a non existent account.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
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. |
Create account operation
xdr.CreateAccountOp
# static createClaimableBalance(opts) → {xdr.Operation}
Create a new claimable balance operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
asset |
Asset
|
The asset for the claimable balance. |
|
amount |
string
|
Amount. |
|
claimants |
Array.<Claimant>
|
An array of Claimants |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
Create claimable balance operation
xdr.Operation
Example
const asset = new Asset(
'USD',
'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7'
);
const amount = '100.0000000';
const claimants = [
new Claimant(
'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ',
Claimant.predicateBeforeAbsoluteTime("4102444800000")
)
];
const op = Operation.createClaimableBalance({
asset,
amount,
claimants
});
# static createCustomContract(opts) → {xdr.Operation}
Returns an operation that creates a custom WASM contract and atomically invokes its constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
any
|
the set of parameters |
|
address |
Address
|
the contract uploader address |
|
wasmHash |
Uint8Array
|
Buffer
|
the SHA-256 hash of the contract WASM you're uploading (see hash and Operation.uploadContractWasm) |
|
constructorArgs |
Array.<xdr.ScVal>
|
<optional> |
the optional parameters to pass to the constructor of this contract (see nativeToScVal for ways to easily create these parameters from native JS values) |
salt |
Uint8Array
|
Buffer
|
<optional> |
an optional, 32-byte salt to distinguish deployment instances of the same wasm from the same user (if omitted, one will be generated for you) |
auth |
Array.<xdr.SorobanAuthorizationEntry>
|
<optional> |
an optional list outlining the tree of authorizations required for the call |
source |
string
|
<optional> |
an optional source account |
an Invoke Host Function operation (xdr.InvokeHostFunctionOp)
xdr.Operation
# static createPassiveSellOffer(opts) → {xdr.CreatePassiveSellOfferOp}
Returns a XDR CreatePasiveSellOfferOp. 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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
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 |
|
price.n |
number
|
If |
|
price.d |
number
|
If |
|
source |
string
|
<optional> |
The source account (defaults to transaction source). |
Throws Error
when the best rational approximation of price
cannot be found.
Error
Create Passive Sell Offer operation
xdr.CreatePassiveSellOfferOp
# static createStellarAssetContract(opts) → {xdr.Operation}
Returns an operation that wraps a Stellar asset into a token contract.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
any
|
the set of parameters |
|
asset |
Asset
|
string
|
the Stellar asset to wrap, either as an
Asset object or in canonical form (SEP-11, |
|
auth |
Array.<xdr.SorobanAuthorizationEntry>
|
<optional> |
an optional list outlining the tree of authorizations required for the call |
source |
string
|
<optional> |
an optional source account |
an Invoke Host Function operation (xdr.InvokeHostFunctionOp)
xdr.Operation
# static endSponsoringFutureReserves(opts) → {xdr.Operation}
Create an "end sponsoring future reserves" operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.endSponsoringFutureReserves();
# static extendFootprintTtl(opts) → {xdr.Operation}
Builds an operation to bump the time-to-live (TTL) of the ledger keys. The keys for extension have to be provided in the read-only footprint of the transaction.
The only parameter of the operation itself is the new minimum TTL for all the provided entries. If an entry already has a higher TTL, then it will just be skipped.
TTL is the number of ledgers from the current ledger (exclusive) until the last ledger the entry is still considered alive (inclusive). Thus the exact ledger until the entries will live will only be determined when transaction has been applied.
The footprint has to be specified in the transaction. See
TransactionBuilder's opts.sorobanData
parameter, which is a
xdr.SorobanTransactionData instance that contains fee data & resource
usage as part of xdr.SorobanResources.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
object holding operation parameters |
|
extendTo |
number
|
the minimum TTL that all the entries in the read-only footprint will have |
|
source |
string
|
<optional> |
an optional source account |
an Extend Footprint TTL operation (xdr.ExtendFootprintTTLOp)
xdr.Operation
# static fromXDRObject(operation) → {Operation}
Deconstructs the raw XDR operation object into the structured object that
was used to create the operation (i.e. the opts
parameter to most ops).
Parameters:
Name | Type | Description |
---|---|---|
operation |
xdr.Operation
|
An XDR Operation. |
# static inflation(optsopt) → {xdr.InflationOp}
This operation generates the inflation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
<optional> |
Options object |
source |
string
|
<optional> |
The optional source account. |
Inflation operation
xdr.InflationOp
# static invokeContractFunction(opts) → {xdr.Operation}
Returns an operation that invokes a contract function.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
any
|
the set of parameters |
|
contract |
string
|
a strkey-fied contract address ( |
|
function |
string
|
the name of the contract fn to invoke |
|
args |
Array.<xdr.ScVal>
|
parameters to pass to the function invocation (try nativeToScVal or ScInt to make building these easier) |
|
auth |
Array.<xdr.SorobanAuthorizationEntry>
|
<optional> |
an optional list outlining the tree of authorizations required for the call |
source |
string
|
<optional> |
an optional source account |
- See:
-
- Operation.invokeHostFunction
- Contract.call
- Address
View Source js-stellar-base/src/operations/invoke_host_function.js, line 73
an Invoke Host Function operation (xdr.InvokeHostFunctionOp)
xdr.Operation
# static invokeHostFunction(opts) → {xdr.Operation}
Invokes a single smart contract host function.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
options object |
|
func |
xdr.HostFunction
|
host function to execute (with its wrapped parameters) |
|
auth |
Array.<xdr.SorobanAuthorizationEntry>
|
<optional> |
list outlining the tree of authorizations required for the call |
source |
string
|
<optional> |
an optional source account |
an Invoke Host Function operation (xdr.InvokeHostFunctionOp)
xdr.Operation
# static isValidAmount(value, allowZero) → {boolean}
Validates that a given amount is possible for a Stellar asset.
Specifically, this means that the amount is well, a valid number, but also that it is within the int64 range and has no more than 7 decimal levels of precision.
Note that while smart contracts allow larger amounts, this is oriented towards validating the standard Stellar operations.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
value |
string
|
the amount to validate |
|
allowZero |
boolean
|
false | optionally, whether or not zero is valid (default: no) |
boolean
# static liquidityPoolDeposit(opts) → {xdr.Operation}
Creates a liquidity pool deposit operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
liquidityPoolId |
string
|
The liquidity pool ID. |
|
maxAmountA |
string
|
Maximum amount of first asset to deposit. |
|
maxAmountB |
string
|
Maximum amount of second asset to deposit. |
|
minPrice |
number
|
string
|
BigNumber
|
Object
|
Minimum depositA/depositB price. |
|
minPrice.n |
number
|
If |
|
minPrice.d |
number
|
If |
|
maxPrice |
number
|
string
|
BigNumber
|
Object
|
Maximum depositA/depositB price. |
|
maxPrice.n |
number
|
If |
|
maxPrice.d |
number
|
If |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
The resulting operation (xdr.LiquidityPoolDepositOp).
xdr.Operation
# static liquidityPoolWithdraw(opts) → {xdr.Operation}
Creates a liquidity pool withdraw operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
liquidityPoolId |
string
|
The liquidity pool ID. |
|
amount |
string
|
Amount of pool shares to withdraw. |
|
minAmountA |
string
|
Minimum amount of first asset to withdraw. |
|
minAmountB |
string
|
Minimum amount of second asset to withdraw. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
The resulting operation (xdr.LiquidityPoolWithdrawOp).
xdr.Operation
# static manageBuyOffer(opts) → {xdr.ManageBuyOfferOp}
Returns a XDR ManageBuyOfferOp. A "manage buy offer" operation creates, updates, or deletes a buy offer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
selling |
Asset
|
What you're selling. |
|
buying |
Asset
|
What you're buying. |
|
buyAmount |
string
|
The total amount you're buying. If 0, deletes the offer. |
|
price |
number
|
string
|
BigNumber
|
Object
|
Price of 1 unit of |
|
price.n |
number
|
If |
|
price.d |
number
|
If |
|
offerId |
number
|
string
|
<optional> |
If |
source |
string
|
<optional> |
The source account (defaults to transaction source). |
Throws Error
when the best rational approximation of price
cannot be found.
Error
Manage Buy Offer operation
xdr.ManageBuyOfferOp
# static manageData(opts) → {xdr.ManageDataOp}
This operation adds data entry to the ledger.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
name |
string
|
The name of the data entry. |
|
value |
string
|
Buffer
|
The value of the data entry. |
|
source |
string
|
<optional> |
The optional source account. |
Manage Data operation
xdr.ManageDataOp
# static manageSellOffer(opts) → {xdr.ManageSellOfferOp}
Returns a XDR ManageSellOfferOp. A "manage sell offer" operation creates, updates, or deletes an offer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
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 |
|
price.n |
number
|
If |
|
price.d |
number
|
If |
|
offerId |
number
|
string
|
<optional> |
If |
source |
string
|
<optional> |
The source account (defaults to transaction source). |
Throws Error
when the best rational approximation of price
cannot be found.
Error
Manage Sell Offer operation
xdr.ManageSellOfferOp
# static pathPaymentStrictReceive(opts) → {xdr.PathPaymentStrictReceiveOp}
Creates a PathPaymentStrictReceive operation.
A PathPaymentStrictReceive
operation sends the specified amount to the
destination account. It credits the destination with destAmount
of
destAsset
, while debiting at most sendMax
of sendAsset
from the source.
The transfer optionally occurs through a path. XLM payments create the
destination account if it does not exist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
sendAsset |
Asset
|
asset to pay with |
|
sendMax |
string
|
maximum amount of sendAsset to send |
|
destination |
string
|
destination account to send to |
|
destAsset |
Asset
|
asset the destination will receive |
|
destAmount |
string
|
amount the destination receives |
|
path |
Array.<Asset>
|
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. |
the resulting path payment op
xdr.PathPaymentStrictReceiveOp
# static pathPaymentStrictSend(opts) → {xdr.Operation}
Creates a PathPaymentStrictSend operation.
A PathPaymentStrictSend
operation sends the specified amount to the
destination account crediting at least destMin
of destAsset
, optionally
through a path. XLM payments create the destination account if it does not
exist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
sendAsset |
Asset
|
asset to pay with |
|
sendAmount |
string
|
amount of sendAsset to send (excluding fees) |
|
destination |
string
|
destination account to send to |
|
destAsset |
Asset
|
asset the destination will receive |
|
destMin |
string
|
minimum amount of destAsset to be receive |
|
path |
Array.<Asset>
|
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. |
the resulting path payment operation (xdr.PathPaymentStrictSendOp)
xdr.Operation
# static payment(opts) → {xdr.Operation}
Create a payment operation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
destination |
string
|
destination account ID |
|
asset |
Asset
|
asset to send |
|
amount |
string
|
amount to send |
|
source |
string
|
<optional> |
The source account for the payment. Defaults to the transaction's source account. |
The resulting payment operation (xdr.PaymentOp)
xdr.Operation
# static restoreFootprint(optsopt) → {xdr.Operation}
Builds an operation to restore the archived ledger entries specified by the ledger keys.
The ledger keys to restore are specified separately from the operation in read-write footprint of the transaction.
It takes no parameters because the relevant footprint is derived from the
transaction itself. See TransactionBuilder's opts.sorobanData
parameter (or TransactionBuilder.setSorobanData /
TransactionBuilder.setLedgerKeys), which is a
xdr.SorobanTransactionData instance that contains fee data & resource
usage as part of xdr.SorobanTransactionData.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
<optional> |
an optional set of parameters |
source |
string
|
<optional> |
an optional source account |
a Bump Footprint Expiration operation (xdr.RestoreFootprintOp)
xdr.Operation
# static revokeAccountSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for an account.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
account |
string
|
The sponsored account ID. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeAccountSponsorship({
account: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7
});
# static revokeClaimableBalanceSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for a claimable balance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
balanceId |
string
|
The sponsored claimable balance ID. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeClaimableBalanceSponsorship({
balanceId: '00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be',
});
# static revokeDataSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for a data entry.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
account |
string
|
The account ID which owns the data entry. |
|
name |
string
|
The name of the data entry |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeDataSponsorship({
account: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7
name: 'foo'
});
# static revokeLiquidityPoolSponsorship(opts) → {xdr.Operation}
Creates a "revoke sponsorship" operation for a liquidity pool.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
– Options object. |
|
liquidityPoolId |
string
|
The sponsored liquidity pool ID in 'hex' string. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr Operation.
xdr.Operation
Example
const op = Operation.revokeLiquidityPoolSponsorship({
liquidityPoolId: 'dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7',
});
# static revokeOfferSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for an offer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
seller |
string
|
The account ID which created the offer. |
|
offerId |
string
|
The offer ID. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeOfferSponsorship({
seller: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7
offerId: '1234'
});
# static revokeSignerSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for a signer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
account |
string
|
The account ID where the signer sponsorship is being removed from. |
|
signer |
object
|
The signer whose sponsorship is being removed. |
|
signer.ed25519PublicKey |
string
|
<optional> |
The ed25519 public key of the signer. |
signer.sha256Hash |
Buffer
|
string
|
<optional> |
sha256 hash (Buffer or hex string). |
signer.preAuthTx |
Buffer
|
string
|
<optional> |
Hash (Buffer or hex string) of transaction. |
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeSignerSponsorship({
account: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7
signer: {
ed25519PublicKey: 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ'
}
})
# static revokeTrustlineSponsorship(opts) → {xdr.Operation}
Create a "revoke sponsorship" operation for a trustline.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
account |
string
|
The account ID which owns the trustline. |
|
asset |
Asset
|
LiquidityPoolId
|
The trustline asset. |
|
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr operation
xdr.Operation
Example
const op = Operation.revokeTrustlineSponsorship({
account: 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7
asset: new StellarBase.LiquidityPoolId(
'USDUSD',
'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7'
)
});
# 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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
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 |
signer.ed25519PublicKey |
string
|
<optional> |
The ed25519 public key of the signer. |
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. |
signer.preAuthTx |
Buffer
|
string
|
<optional> |
Hash (Buffer or hex string) of transaction that will unlock funds. |
signer.ed25519SignedPayload |
string
|
<optional> |
Signed payload signer (ed25519 public key + raw payload) for atomic transaction signature disclosure. |
signer.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). |
XDR operation
xdr.SetOptionsOp
# static setTrustLineFlags(opts) → {xdr.SetTrustLineFlagsOp}
Creates a trustline flag configuring operation.
For the flags, set them to true to enable them and false to disable them. Any
unmodified operations will be marked undefined
in the result.
Note that you can only clear the clawbackEnabled flag set; it must be set account-wide via operations.SetOptions (setting xdr.AccountFlags.clawbackEnabled).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object
|
Options object |
|
trustor |
string
|
the account whose trustline this is |
|
asset |
Asset
|
the asset on the trustline |
|
flags |
object
|
the set of flags to modify |
|
flags.authorized |
bool
|
<optional> |
authorize account to perform transactions with its credit |
flags.authorizedToMaintainLiabilities |
bool
|
<optional> |
authorize account to maintain and reduce liabilities for its credit |
flags.clawbackEnabled |
bool
|
<optional> |
stop claimable balances on this trustlines from having clawbacks enabled (this flag can only be set to false!) |
source |
string
|
<optional> |
The source account for the operation. Defaults to the transaction's source account. |
xdr.SetTrustLineFlagsOp
# static uploadContractWasm(opts) → {xdr.Operation}
Returns an operation that uploads WASM for a contract.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
any
|
the set of parameters |
|
wasm |
Uint8Array
|
Buffer
|
a WASM blob to upload to the ledger |
|
auth |
Array.<xdr.SorobanAuthorizationEntry>
|
<optional> |
an optional list outlining the tree of authorizations required for the call |
source |
string
|
<optional> |
an optional source account |
an Invoke Host Function operation (xdr.InvokeHostFunctionOp)
xdr.Operation