Class: GraphQlTransactionBuilder
A builder for creating transactions which uses a GraphQL client to automatically resolve
inputs. Use finish to finalize the transaction data.
Extends
UniffiAbstractObject
Implements
Properties
[destructorGuardSymbol]
readonly [destructorGuardSymbol]: UniffiGcObject;
[pointerLiteralSymbol]
readonly [pointerLiteralSymbol]: bigint;
[uniffiTypeNameSymbol]
readonly [uniffiTypeNameSymbol]: "GraphQlTransactionBuilder" = "GraphQlTransactionBuilder";
Methods
authorizeUpgrade()
authorizeUpgrade(
upgradeCapability,
upgradePolicy,
digest,
upgradeTicketName
): GraphQlTransactionBuilderLike;
Authorize a package upgrade by calling 0x2::package::authorize_upgrade.
The result assigned to upgrade_ticket_name is the UpgradeTicket expected by
upgrade(). The digest is the digest of the package being upgraded to
(MovePackageData::digest()).
For the standard upgrade flow, use upgrade_package() instead.
Parameters
upgradeCapability
upgradePolicy
digest
upgradeTicketName
string
Returns
Implementation of
GraphQlTransactionBuilderLike.authorizeUpgrade
commitUpgrade()
commitUpgrade(upgradeCapability, upgradeReceipt): GraphQlTransactionBuilderLike;
Commit a package upgrade by calling 0x2::package::commit_upgrade, consuming the
UpgradeReceipt returned by upgrade().
Parameters
upgradeCapability
upgradeReceipt
Returns
Implementation of
GraphQlTransactionBuilderLike.commitUpgrade
divideCoin()
divideCoin(
coin,
count,
coinType?
): GraphQlTransactionBuilderLike;
Divide a coin into count coins of equal value, all kept by the sender.
Unlike split_coins, the new coins are transferred to the sender by
0x2::pay::divide_and_keep itself, so no transfer command is needed for them. In
exchange they are not available as command results and cannot be used by later
commands in the same transaction.
The coin defaults an IOTA coin. For any other coin type, set it with coin_type,
which is the T of 0x2::coin::Coin<T>.
count - 1 new coins are created, each holding value / count, and the divided
coin keeps its own share plus the remainder of the division. The transaction aborts
if count is zero or larger than the coin's value.
The coin is passed by reference, so the gas coin (PTBArgument::Gas) can be divided
as well, as long as it retains enough balance to pay for the transaction.
Parameters
coin
count
bigint
coinType?
TypeTagLike | undefined = undefined
Returns
Implementation of
GraphQlTransactionBuilderLike.divideCoin
dryRun()
dryRun(skipChecks?, asyncOpts_?): Promise<GraphQlDryRunResult>;
Dry run the transaction.
Parameters
skipChecks?
boolean = false
asyncOpts_?
signal
AbortSignal
Returns
Promise<GraphQlDryRunResult>
Implementation of
GraphQlTransactionBuilderLike.dryRun
execute()
execute(
signer,
waitFor?,
asyncOpts_?
): Promise<TransactionEffectsLike>;
Execute the transaction and optionally wait for finalization.
If the wait fails, the error is returned although the transaction was executed, and
its effects are lost. To keep them, pass no wait_for and call
wait_for_transaction on the client afterwards.
Parameters
signer
waitFor?
WaitForTransaction | undefined = undefined
asyncOpts_?
signal
AbortSignal
Returns
Promise<TransactionEffectsLike>
Implementation of
GraphQlTransactionBuilderLike.execute
executeWithGasStation()
executeWithGasStation(
gasStation,
signer,
asyncOpts_?
): Promise<TransactionEffectsLike>;
Execute the transaction with its gas paid by gas_station, and wait for
finalization.
Parameters
gasStation
signer
asyncOpts_?
signal
AbortSignal
Returns
Promise<TransactionEffectsLike>
Implementation of
GraphQlTransactionBuilderLike.executeWithGasStation
executeWithSponsorSigner()
executeWithSponsorSigner(
signer,
sponsorSigner,
waitFor?,
asyncOpts_?
): Promise<TransactionEffectsLike>;
Execute the transaction with both the sender's and the sponsor's signature, and optionally wait for finalization.
If the wait fails, the error is returned although the transaction was executed, and
its effects are lost. To keep them, pass no wait_for and call
wait_for_transaction on the client afterwards.
Use this when you hold the sponsor's key. The sponsor's address must be set with
sponsor, which is also where the gas coins are drawn from. When the sponsor is a
service that keeps its own key and submits for you, use execute_with_gas_station
instead.
Parameters
signer
sponsorSigner
waitFor?
WaitForTransaction | undefined = undefined
asyncOpts_?
signal
AbortSignal
Returns
Promise<TransactionEffectsLike>
Implementation of
GraphQlTransactionBuilderLike.executeWithSponsorSigner
expiration()
expiration(epoch): GraphQlTransactionBuilderLike;
Set the expiration of the transaction to be a specific epoch.
Parameters
epoch
bigint
Returns
Implementation of
GraphQlTransactionBuilderLike.expiration
finish()
finish(asyncOpts_?): Promise<TransactionLike>;
Convert this builder into a transaction.
Parameters
asyncOpts_?
signal
AbortSignal
Returns
Promise<TransactionLike>
Implementation of
GraphQlTransactionBuilderLike.finish
finishWithBudget()
finishWithBudget(gasBudget, asyncOpts_?): Promise<TransactionLike>;
Convert this builder into a transaction with the given gas budget, used as-is (no
estimation or minimum clamp) and overriding any budget set via gas_budget.
Parameters
gasBudget
bigint
asyncOpts_?
signal
AbortSignal
Returns
Promise<TransactionLike>
Implementation of
GraphQlTransactionBuilderLike.finishWithBudget
gas()
gas(objectIds): GraphQlTransactionBuilderLike;
Add gas coins that will be consumed. Optional.
Parameters
objectIds
Returns
Implementation of
GraphQlTransactionBuilderLike.gas
gasBudget()
gasBudget(budget): GraphQlTransactionBuilderLike;
Set the gas budget for the transaction.
Parameters
budget
bigint
Returns
Implementation of
GraphQlTransactionBuilderLike.gasBudget
gasPrice()
gasPrice(price): GraphQlTransactionBuilderLike;
Set the gas price for the transaction.
Parameters
price
bigint
Returns
Implementation of
GraphQlTransactionBuilderLike.gasPrice
makeMoveVec()
makeMoveVec(
elements,
typeTag,
name
): GraphQlTransactionBuilderLike;
Make a move vector from a list of elements. The elements must all be of the type
indicated by type_tag.
Parameters
elements
typeTag
name
string
Returns
Implementation of
GraphQlTransactionBuilderLike.makeMoveVec
mergeCoins()
mergeCoins(primaryCoin, consumedCoins): GraphQlTransactionBuilderLike;
Merge multiple coins into one.
This method combines the balances of multiple coins of the same coin type into a
single coin. The primary_coin will receive the balances from all consumed_coins.
After merging, the consumed_coins will be consumed and no longer exist.
Parameters
primaryCoin
consumedCoins
Returns
Implementation of
GraphQlTransactionBuilderLike.mergeCoins
moveCall()
moveCall(
package_,
module,
function_,
moveArguments?,
typeArgs?,
names?
): GraphQlTransactionBuilderLike;
Call a Move function with the given arguments.
Parameters
package_
module
function_
moveArguments?
PtbArgumentLike[] = []
typeArgs?
TypeTagLike[] = []
names?
string[] = []
Returns
Implementation of
GraphQlTransactionBuilderLike.moveCall
pay()
pay(coins, payments): GraphQlTransactionBuilderLike;
Send coins to multiple recipients, each paired with the amount to send.
The amounts specify quantities in the coins' smallest unit (NANOS for IOTA coins, where 1 IOTA equals 1_000_000_000 NANOS).
The coins are merged into the first one, the amounts are split off it in a single command, and each split coin is transferred to its corresponding recipient, with one transfer command per unique recipient. The remainder stays in the first coin.
All provided coins must have the same coin type. Mixing coins of different types will result in an error.
To pay IOTA directly from the gas coin, use pay_iota() instead.
For a single recipient, consider using send_coins() or send_iota() instead.
Parameters
coins
payments
Payment[]
Returns
Implementation of
GraphQlTransactionBuilderLike.pay
payIota()
payIota(payments): GraphQlTransactionBuilderLike;
Send IOTA to multiple recipients, each paired with the amount to send.
The amounts specify quantities in NANOS, where 1 IOTA equals 1_000_000_000 NANOS. They are split off the gas coin in a single command, and each split coin is transferred to its corresponding recipient, with one transfer command per unique recipient.
To pay with specific coins, or with a coin type other than IOTA, use pay(). For a
single recipient, consider using send_iota() instead.
Parameters
payments
Payment[]
Returns
Implementation of
GraphQlTransactionBuilderLike.payIota
publishPackage()
publishPackage(packageData, upgradeCapName): GraphQlTransactionBuilderLike;
Publish a list of modules with the given dependencies. The result assigned to
upgrade_cap_name is the 0x2::package::UpgradeCap Move type. Note that the
upgrade capability needs to be handled after this call:
- transfer it to the transaction sender or another address
- burn it
- wrap it for access control
- discard the it to make a package immutable
The arguments required for this command are:
modules: is the modules' bytecode to be publisheddependencies: is the list of IDs of the transitive dependencies of the package
Parameters
packageData
upgradeCapName
string
Returns
Implementation of
GraphQlTransactionBuilderLike.publishPackage
sendCoins()
sendCoins(
coins,
recipient,
amount?
): GraphQlTransactionBuilderLike;
Transfer some coins to a recipient address. If multiple coins are provided then they will be merged.
The amount parameter specifies the quantity in NANOS, where 1 IOTA equals
1_000_000_000 NANOS.
If amount is provided, that amount is split from the provided coins and sent.
If amount is None, the entire coins are transferred.
All provided coins must have the same coin type. Mixing coins of different types will result in an error.
If you intend to transfer all provided coins to another address in a single
transaction, consider using TransactionBuilder::transfer_objects() instead.
Parameters
coins
recipient
amount?
PtbArgumentLike | undefined = undefined
Returns
Implementation of
GraphQlTransactionBuilderLike.sendCoins
sender()
sender(sender): GraphQlTransactionBuilderLike;
Set the sender address.
Parameters
sender
Returns
Implementation of
GraphQlTransactionBuilderLike.sender
sendIota()
sendIota(recipient, amount): GraphQlTransactionBuilderLike;
Send IOTA to a recipient address.
The amount parameter specifies the quantity in NANOS, where 1 IOTA equals
1_000_000_000 NANOS. That amount is split from the gas coin and sent.
Parameters
recipient
amount
Returns
Implementation of
GraphQlTransactionBuilderLike.sendIota
splitCoins()
splitCoins(
coin,
amounts,
names?
): GraphQlTransactionBuilderLike;
Split a coin into many.
Parameters
coin
amounts
names?
string[] = []
Returns
Implementation of
GraphQlTransactionBuilderLike.splitCoins
sponsor()
sponsor(sponsor): GraphQlTransactionBuilderLike;
Set the sponsor of the transaction.
Parameters
sponsor
Returns
Implementation of
GraphQlTransactionBuilderLike.sponsor
stake()
stake(stake, validatorAddress): GraphQlTransactionBuilderLike;
Add stake to a validator's staking pool.
This is a high-level function which will split the provided stake amount from the gas coin and then stake using the resulting coin.
Parameters
stake
validatorAddress
Returns
Implementation of
GraphQlTransactionBuilderLike.stake
transferObjects()
transferObjects(recipient, objects): GraphQlTransactionBuilderLike;
Transfer a list of objects to the given address, without producing any result.
Parameters
recipient
objects
Returns
Implementation of
GraphQlTransactionBuilderLike.transferObjects
uniffiDestroy()
uniffiDestroy(): void;
Explicitly tell Rust to destroy the native peer that backs this object.
Once this method has been called, any following method calls will throw an error.
Can be called more than once.
Returns
void
Overrides
UniffiAbstractObject.uniffiDestroy
uniffiUse()
uniffiUse<T>(block): T;
A convenience method to use this object, then destroy it after its use.
Type Parameters
T
T
Parameters
block
(obj) => T
Returns
T
Inherited from
UniffiAbstractObject.uniffiUse
unstake()
unstake(stakedIota): GraphQlTransactionBuilderLike;
Withdraw stake from a validator's staking pool.
Parameters
stakedIota
Returns
Implementation of
GraphQlTransactionBuilderLike.unstake
upgrade()
upgrade(
packageId,
packageData,
upgradeTicket,
name?
): GraphQlTransactionBuilderLike;
Upgrade a Move package.
modules: is the modules' bytecode for the modules to be publisheddependencies: is the list of IDs of the transitive dependencies of the package to be upgradedpackage: is the ID of the current package being upgradedticket: is the upgrade ticket
To get the ticket, use authorize_upgrade(). The result assigned to name is the
UpgradeReceipt expected by commit_upgrade().
Parameters
packageId
packageData
upgradeTicket
name?
string | undefined = undefined
Returns
Implementation of
GraphQlTransactionBuilderLike.upgrade
upgradePackage()
upgradePackage(
packageId,
packageData,
upgradeCapability,
upgradePolicy
): GraphQlTransactionBuilderLike;
Upgrade a Move package.
This is a high-level function which chains authorize_upgrade(), upgrade() and
commit_upgrade() using the digest from the provided MovePackageData. Use the
individual functions for custom upgrade flows.
Parameters
packageId
packageData
upgradeCapability
upgradePolicy
Returns
Implementation of
GraphQlTransactionBuilderLike.upgradePackage
instanceOf()
static instanceOf(obj_): obj_ is GraphQlTransactionBuilder;
Parameters
obj_
any
Returns
obj_ is GraphQlTransactionBuilder