ClientTransactionBuilder
type ClientTransactionBuilder
A builder for creating transactions which uses a GraphQL client to automatically resolve inputs. Use `finish` to finalize the transaction data.
type ClientTransactionBuilder struct {
// contains filtered or unexported fields
}
func LiftFromExternalClientTransactionBuilder
func LiftFromExternalClientTransactionBuilder(handle uint64) *ClientTransactionBuilder
func (*ClientTransactionBuilder) Destroy
func (object *ClientTransactionBuilder) Destroy()
func (*ClientTransactionBuilder) DryRun
func (_self *ClientTransactionBuilder) DryRun(skipChecks bool) (DryRunResult, error)
Dry run the transaction.
func (*ClientTransactionBuilder) Execute
func (_self *ClientTransactionBuilder) Execute(signer *TransactionSigner, waitFor *WaitForTx) (*TransactionEffects, error)
Execute the transaction and optionally wait for finalization.
func (*ClientTransactionBuilder) ExecuteWithSponsor
func (_self *ClientTransactionBuilder) ExecuteWithSponsor(signer *TransactionSigner, sponsorSigner *TransactionSigner, waitFor *WaitForTx) (*TransactionEffects, error)
Execute the transaction and optionally wait for finalization.
func (*ClientTransactionBuilder) Expiration
func (_self *ClientTransactionBuilder) Expiration(epoch uint64) *ClientTransactionBuilder
Set the expiration of the transaction to be a specific epoch.
func (*ClientTransactionBuilder) Finish
func (_self *ClientTransactionBuilder) Finish() (*Transaction, error)
Convert this builder into a transaction.
func (*ClientTransactionBuilder) Gas
func (_self *ClientTransactionBuilder) Gas(objectIds []*ObjectId) *ClientTransactionBuilder
Add gas coins that will be consumed. Optional.
func (*ClientTransactionBuilder) GasBudget
func (_self *ClientTransactionBuilder) GasBudget(budget uint64) *ClientTransactionBuilder
Set the gas budget for the transaction.
func (*ClientTransactionBuilder) GasPrice
func (_self *ClientTransactionBuilder) GasPrice(price uint64) *ClientTransactionBuilder
Set the gas price for the transaction.
func (*ClientTransactionBuilder) GasStationSponsor
func (_self *ClientTransactionBuilder) GasStationSponsor(url string, duration *time.Duration, headers *map[string][]string) *ClientTransactionBuilder
Set the gas station sponsor.
func (*ClientTransactionBuilder) MakeMoveVec
func (_self *ClientTransactionBuilder) MakeMoveVec(elements []*MoveArg, typeTag *TypeTag, name string) *ClientTransactionBuilder
Make a move vector from a list of elements. The elements must all be of the type indicated by `type_tag`.
func (*ClientTransactionBuilder) MergeCoins
func (_self *ClientTransactionBuilder) MergeCoins(primaryCoin *PtbArgument, consumedCoins []*PtbArgument) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) MoveCall
func (_self *ClientTransactionBuilder) MoveCall(varPackage *Address, module *Identifier, function *Identifier, arguments []*PtbArgument, typeArgs []*TypeTag, names []string) *ClientTransactionBuilder
Call a Move function with the given arguments.
func (*ClientTransactionBuilder) Pay
func (_self *ClientTransactionBuilder) Pay(coins []*PtbArgument, payments []Payment) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) PayIota
func (_self *ClientTransactionBuilder) PayIota(payments []Payment) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) PublishPackage
func (_self *ClientTransactionBuilder) PublishPackage(packageData *MovePackageData, upgradeCapName string) *ClientTransactionBuilder
Publish a list of modules with the given dependencies. The result assigned to `upgrade_cap_name` is the `0x2:📦: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
func (*ClientTransactionBuilder) SendCoins
func (_self *ClientTransactionBuilder) SendCoins(coins []*PtbArgument, recipient *Address, amount **PtbArgument) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) SendIota
func (_self *ClientTransactionBuilder) SendIota(recipient *Address, amount *PtbArgument) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) SetSender
func (_self *ClientTransactionBuilder) SetSender(sender *Address)
Set the sender address.
func (*ClientTransactionBuilder) SplitCoins
func (_self *ClientTransactionBuilder) SplitCoins(coin *PtbArgument, amounts []*PtbArgument, names []string) *ClientTransactionBuilder
Split a coin into many.
func (*ClientTransactionBuilder) Sponsor
func (_self *ClientTransactionBuilder) Sponsor(sponsor *Address) *ClientTransactionBuilder
Set the sponsor of the transaction.
func (*ClientTransactionBuilder) Stake
func (_self *ClientTransactionBuilder) Stake(stake *PtbArgument, validatorAddress *Address) *ClientTransactionBuilder
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.
func (*ClientTransactionBuilder) TransferObjects
func (_self *ClientTransactionBuilder) TransferObjects(recipient *Address, objects []*PtbArgument) *ClientTransactionBuilder
Transfer a list of objects to the given address, without producing any result.
func (*ClientTransactionBuilder) Unstake
func (_self *ClientTransactionBuilder) Unstake(stakedIota *PtbArgument) *ClientTransactionBuilder
Withdraw stake from a validator's staking pool.
func (*ClientTransactionBuilder) Upgrade
func (_self *ClientTransactionBuilder) Upgrade(packageId *ObjectId, packageData *MovePackageData, upgradeTicket *PtbArgument, name *string) *ClientTransactionBuilder
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:📦:authorize_upgrade` function, and pass the package ID, the upgrade policy, and package digest.