Skip to main content

Class: ClientTransactionBuilder

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]: "ClientTransactionBuilder" = "ClientTransactionBuilder";

Methods

dryRun()

dryRun(skipChecks?, asyncOpts_?): Promise<DryRunResult>;

Dry run the transaction.

Parameters

skipChecks?

boolean = false

asyncOpts_?
signal

AbortSignal

Returns

Promise<DryRunResult>

Implementation of

ClientTransactionBuilderLike.dryRun


execute()

execute(
signer,
waitFor?,
asyncOpts_?
): Promise<TransactionEffectsLike>;

Execute the transaction and optionally wait for finalization.

Parameters

signer

TransactionSignerLike

waitFor?

WaitForTx | undefined

asyncOpts_?
signal

AbortSignal

Returns

Promise<TransactionEffectsLike>

Implementation of

ClientTransactionBuilderLike.execute


executeWithSponsor()

executeWithSponsor(
signer,
sponsorSigner,
waitFor?,
asyncOpts_?
): Promise<TransactionEffectsLike>;

Execute the transaction and optionally wait for finalization.

Parameters

signer

TransactionSignerLike

sponsorSigner

TransactionSignerLike

waitFor?

WaitForTx | undefined

asyncOpts_?
signal

AbortSignal

Returns

Promise<TransactionEffectsLike>

Implementation of

ClientTransactionBuilderLike.executeWithSponsor


expiration()

expiration(epoch): ClientTransactionBuilderLike;

Set the expiration of the transaction to be a specific epoch.

Parameters

epoch

bigint

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.expiration


finish()

finish(asyncOpts_?): Promise<TransactionLike>;

Convert this builder into a transaction.

Parameters

asyncOpts_?
signal

AbortSignal

Returns

Promise<TransactionLike>

Implementation of

ClientTransactionBuilderLike.finish


gas()

gas(objectIds): ClientTransactionBuilderLike;

Add gas coins that will be consumed. Optional.

Parameters

objectIds

ObjectIdLike[]

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.gas


gasBudget()

gasBudget(budget): ClientTransactionBuilderLike;

Set the gas budget for the transaction.

Parameters

budget

bigint

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.gasBudget


gasPrice()

gasPrice(price): ClientTransactionBuilderLike;

Set the gas price for the transaction.

Parameters

price

bigint

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.gasPrice


gasStationSponsor()

gasStationSponsor(
url,
duration?,
headers?
): ClientTransactionBuilderLike;

Set the gas station sponsor.

Parameters

url

string

duration?

number | undefined

headers?

Map<string, string[]> | undefined

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.gasStationSponsor


makeMoveVec()

makeMoveVec(
elements,
typeTag,
name
): ClientTransactionBuilderLike;

Make a move vector from a list of elements. The elements must all be of the type indicated by type_tag.

Parameters

elements

MoveArgLike[]

typeTag

TypeTagLike

name

string

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.makeMoveVec


mergeCoins()

mergeCoins(primaryCoin, consumedCoins): ClientTransactionBuilderLike;

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

PtbArgumentLike

consumedCoins

PtbArgumentLike[]

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.mergeCoins


moveCall()

moveCall(
package_,
module,
function_,
moveArguments?,
typeArgs?,
names?
): ClientTransactionBuilderLike;

Call a Move function with the given arguments.

Parameters

package_

AddressLike

module

IdentifierLike

function_

IdentifierLike

moveArguments?

PtbArgumentLike[] = []

typeArgs?

TypeTagLike[] = []

names?

string[] = []

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.moveCall


pay()

pay(coins, payments): ClientTransactionBuilderLike;

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 ClientTransactionBuilder::pay_iota() instead.

For a single recipient, consider using ClientTransactionBuilder::send_coins() or ClientTransactionBuilder::send_iota() instead.

Parameters

coins

PtbArgumentLike[]

payments

Payment[]

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.pay


payIota()

payIota(payments): ClientTransactionBuilderLike;

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 ClientTransactionBuilder::pay(). For a single recipient, consider using ClientTransactionBuilder::send_iota() instead.

Parameters

payments

Payment[]

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.payIota


publishPackage()

publishPackage(packageData, upgradeCapName): ClientTransactionBuilderLike;

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 published
  • dependencies: is the list of IDs of the transitive dependencies of the package

Parameters

packageData

MovePackageDataLike

upgradeCapName

string

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.publishPackage


sendCoins()

sendCoins(
coins,
recipient,
amount?
): ClientTransactionBuilderLike;

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

PtbArgumentLike[]

recipient

AddressLike

amount?

PtbArgumentLike | undefined

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.sendCoins


sendIota()

sendIota(recipient, amount): ClientTransactionBuilderLike;

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

AddressLike

amount

PtbArgumentLike

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.sendIota


setSender()

setSender(sender): void;

Set the sender address.

Parameters

sender

AddressLike

Returns

void

Implementation of

ClientTransactionBuilderLike.setSender


splitCoins()

splitCoins(
coin,
amounts,
names?
): ClientTransactionBuilderLike;

Split a coin into many.

Parameters

coin

PtbArgumentLike

amounts

PtbArgumentLike[]

names?

string[] = []

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.splitCoins


sponsor(sponsor): ClientTransactionBuilderLike;

Set the sponsor of the transaction.

Parameters

AddressLike

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.sponsor


stake()

stake(stake, validatorAddress): ClientTransactionBuilderLike;

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

PtbArgumentLike

validatorAddress

AddressLike

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.stake


transferObjects()

transferObjects(recipient, objects): ClientTransactionBuilderLike;

Transfer a list of objects to the given address, without producing any result.

Parameters

recipient

AddressLike

objects

PtbArgumentLike[]

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.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): ClientTransactionBuilderLike;

Withdraw stake from a validator's staking pool.

Parameters

stakedIota

PtbArgumentLike

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.unstake


upgrade()

upgrade(
packageId,
packageData,
upgradeTicket,
name?
): ClientTransactionBuilderLike;

Upgrade a Move package.

  • modules: is the modules' bytecode for the modules to be published
  • dependencies: is the list of IDs of the transitive dependencies of the package to be upgraded
  • package: is the ID of the current package being upgraded
  • ticket: is the upgrade ticket

To get the ticket, you have to call the 0x2::package::authorize_upgrade function, and pass the package ID, the upgrade policy, and package digest.

Parameters

packageId

ObjectIdLike

packageData

MovePackageDataLike

upgradeTicket

PtbArgumentLike

name?

string | undefined

Returns

ClientTransactionBuilderLike

Implementation of

ClientTransactionBuilderLike.upgrade


instanceOf()

static instanceOf(obj_): obj_ is ClientTransactionBuilder;

Parameters

obj_

any

Returns

obj_ is ClientTransactionBuilder