TransactionBuilder
open class TransactionBuilder : Disposable, AutoCloseable, TransactionBuilderInterface
A builder for creating transactions. Use finish to finalize the transaction data.
Constructors
| TransactionBuilder | constructor(sender: Address) Create a new transaction builder and initialize its elements to default. |
Functions
| Name | Summary |
|---|---|
| authorizeUpgrade | open override fun authorizeUpgrade(upgradeCapability: PtbArgument, upgradePolicy: UpgradePolicy, digest: Digest, upgradeTicketName: String): TransactionBuilder Authorize a package upgrade by calling 0x2::package::authorize_upgrade. |
| close | @Synchronized open override fun close() |
| commitUpgrade | open override fun commitUpgrade(upgradeCapability: PtbArgument, upgradeReceipt: PtbArgument): TransactionBuilder Commit a package upgrade by calling 0x2::package::commit_upgrade, consuming the UpgradeReceipt returned by TransactionBuilder::upgrade(). |
| destroy | open override fun destroy() |
| divideCoin | open override fun divideCoin(coin: PtbArgument, count: ULong, coinType: TypeTag?): TransactionBuilder Divide a coin into count coins of equal value, all kept by the sender. |
| executeWithGasStation | open suspend override fun executeWithGasStation(gasStation: GasStation, signer: TransactionSigner): TransactionDigest Execute the transaction with its gas paid by gas_station, returning the transaction digest. |
| expiration | open override fun expiration(epoch: ULong): TransactionBuilder Set the expiration of the transaction to be a specific epoch. |
| finish | open override fun finish(): Transaction Convert this builder into a transaction. |
| gas | open override fun gas(objectRefs: List<ObjectReference>): TransactionBuilder Add gas coins that will be consumed. Optional. |
| gasBudget | open override fun gasBudget(budget: ULong): TransactionBuilder Set the gas budget for the transaction. |
| gasPrice | open override fun gasPrice(price: ULong): TransactionBuilder Set the gas price for the transaction. |
| makeMoveVec | open override fun makeMoveVec(elements: List<MoveArg>, typeTag: TypeTag, name: String): TransactionBuilder Make a move vector from a list of elements. The elements must all be of the type indicated by type_tag. |
| mergeCoins | open override fun mergeCoins(primaryCoin: PtbArgument, consumedCoins: List<PtbArgument>): TransactionBuilder Merge multiple coins into one. |
| moveCall | open override fun moveCall(package: Address, module: Identifier, function: Identifier, arguments: List<PtbArgument>, typeArgs: List<TypeTag>, names: List<String>): TransactionBuilder Call a Move function with the given arguments. |
| pay | open override fun pay(coins: List<PtbArgument>, payments: List<Payment>): TransactionBuilder Send coins to multiple recipients, each paired with the amount to send. |
| payIota | open override fun payIota(payments: List<Payment>): TransactionBuilder Send IOTA to multiple recipients, each paired with the amount to send. |
| publishPackage | open override fun publishPackage(packageData: MovePackageData, upgradeCapName: String): TransactionBuilder 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: |
| sendCoins | open override fun sendCoins(coins: List<PtbArgument>, recipient: Address, amount: PtbArgument?): TransactionBuilder Transfer some coins to a recipient address. If multiple coins are provided then they will be merged. |
| sender | open override fun sender(sender: Address): TransactionBuilder Set the sender address. |
| sendIota | open override fun sendIota(recipient: Address, amount: PtbArgument): TransactionBuilder Send IOTA to a recipient address. |
| splitCoins | open override fun splitCoins(coin: PtbArgument, amounts: List<PtbArgument>, names: List<String>): TransactionBuilder Split a coin by the provided amounts. |
| sponsor | open override fun sponsor(sponsor: Address): TransactionBuilder Set the sponsor of the transaction. |
| stake | open override fun stake(stake: PtbArgument, validatorAddress: Address): TransactionBuilder Add stake to a validator's staking pool. |
| toString | open override fun toString(): String |
| transferObjects | open override fun transferObjects(recipient: Address, objects: List<PtbArgument>): TransactionBuilder Transfer a list of objects to the given address, without producing any result. |
| unstake | open override fun unstake(stakedIota: PtbArgument): TransactionBuilder Withdraw stake from a validator's staking pool. |
| upgrade | open override fun upgrade(packageId: ObjectId, packageData: MovePackageData, upgradeTicket: PtbArgument, name: String?): TransactionBuilder Upgrade a Move package. |
| upgradePackage | open override fun upgradePackage(packageId: ObjectId, packageData: MovePackageData, upgradeCapability: PtbArgument, upgradePolicy: UpgradePolicy): TransactionBuilder Upgrade a Move package. |
| withGraphqlClient | open override fun withGraphqlClient(client: GraphQlClient): GraphQlTransactionBuilder Use a GraphQL client to automatically resolve the transaction inputs. |
| withGrpcClient | open override fun withGrpcClient(client: GrpcClient): GrpcTransactionBuilder Use a gRPC client to automatically resolve the transaction inputs. |
Companion object functions
| Name | Summary |
|---|---|
| fromProgrammableTransaction | fun fromProgrammableTransaction(ptb: ProgrammableTransaction): TransactionBuilder Create a transaction builder from a programmable transaction. |
| fromTransaction | fun fromTransaction(transaction: Transaction): TransactionBuilder Reconstruct a transaction builder from a finalized transaction. Calling finish on the returned builder produces a transaction equal to the input. |