TransactionBuilder
Defined in: ootle/src/builder.ts:234
Fluent builder for constructing UnsignedTransactionV1 objects.
Only buildUnsignedTransaction() is exposed — signing is handled separately
via the Signer interface and signTransaction flow function.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TransactionBuilder(
network,maxEpoch):TransactionBuilder
Defined in: ootle/src/builder.ts:253
maxEpoch is required: every transaction now carries a bounded validity window
(UnsignedTransactionV1.max_epoch), so the last epoch in which it may be sequenced
is decided up front rather than left open. The network rejects a window longer than
MAX_TRANSACTION_VALIDITY_EPOCHS epochs past the current one with
AbortReason::ValidityWindowTooLong, so derive it from the chain tip — e.g.
(await provider.getCurrentEpoch()) + 10.
Parameters
Section titled “Parameters”network
Section titled “network”number
maxEpoch
Section titled “maxEpoch”number
Returns
Section titled “Returns”TransactionBuilder
Throws
Section titled “Throws”if maxEpoch is not a non-negative integer.
Accessors
Section titled “Accessors”maxEpoch
Section titled “maxEpoch”Get Signature
Section titled “Get Signature”get maxEpoch():
number
Defined in: ootle/src/builder.ts:622
The max_epoch set so far, read without the window check buildUnsignedTransaction applies.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”addFeeInstruction()
Section titled “addFeeInstruction()”addFeeInstruction(
instruction):this
Defined in: ootle/src/builder.ts:484
Parameters
Section titled “Parameters”instruction
Section titled “instruction”Instruction
Returns
Section titled “Returns”this
addInput()
Section titled “addInput()”addInput(
input):this
Defined in: ootle/src/builder.ts:572
Declare a transaction input. A SubstateRequirement (no is_write) is declared as a
write — the conservative default: over-declaring locks more than needed, whereas writing to
an input declared read aborts the transaction. Pass is_write: false for inputs the
transaction only reads, so they take a read lock that admits concurrent readers.
Parameters
Section titled “Parameters”InputDeclaration | SubstateRequirement
Returns
Section titled “Returns”this
addInstruction()
Section titled “addInstruction()”addInstruction(
instruction):this
Defined in: ootle/src/builder.ts:478
Parameters
Section titled “Parameters”instruction
Section titled “instruction”Instruction
Returns
Section titled “Returns”this
allocateAddress()
Section titled “allocateAddress()”allocateAddress(
allocatableType,workspaceIdName):this
Defined in: ootle/src/builder.ts:361
Parameters
Section titled “Parameters”allocatableType
Section titled “allocatableType”AllocatableAddressType
workspaceIdName
Section titled “workspaceIdName”string
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if workspaceIdName is empty.
authorizeProof()
Section titled “authorizeProof()”authorizeProof(
proofName):this
Defined in: ootle/src/builder.ts:427
Opens an authorization window over the workspace proof proofName for the instructions
that follow, until dropProofAuthorization closes it.
A proof authorizes only inside a window its holder opens, and a window lends one hop: the proof authorizes the calls made by the next instructions, not calls those make in turn. Prefer withAuthorizedProof, which closes the window for you.
Parameters
Section titled “Parameters”proofName
Section titled “proofName”string
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if no workspace variable named proofName is defined.
buildUnsignedTransaction()
Section titled “buildUnsignedTransaction()”buildUnsignedTransaction():
UnsignedTransactionV1
Defined in: ootle/src/builder.ts:715
Returns a copy of the transaction built so far.
Returns
Section titled “Returns”UnsignedTransactionV1
Throws
Section titled “Throws”if min_epoch is set and exceeds max_epoch.
callFunction()
Section titled “callFunction()”callFunction<
T>(func,args):this
Defined in: ootle/src/builder.ts:274
Type Parameters
Section titled “Type Parameters”T extends TariFunctionDefinition
Parameters
Section titled “Parameters”T
Exclude<T["args"], undefined>
Returns
Section titled “Returns”this
callMethod()
Section titled “callMethod()”callMethod<
T>(method,args):this
Defined in: ootle/src/builder.ts:289
Type Parameters
Section titled “Type Parameters”T extends TariMethodDefinition
Parameters
Section titled “Parameters”method
Section titled “method”T
Exclude<T["args"], undefined>
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if method provides neither componentAddress
nor fromWorkspace, or if fromWorkspace references an undefined variable.
claimBurn()
Section titled “claimBurn()”claimBurn(
claim):this
Defined in: ootle/src/builder.ts:334
Parameters
Section titled “Parameters”MinotariBurnClaimProof
Returns
Section titled “Returns”this
createAccount()
Section titled “createAccount()”createAccount(
ownerPublicKey,workspaceBucket?):this
Defined in: ootle/src/builder.ts:312
Parameters
Section titled “Parameters”ownerPublicKey
Section titled “ownerPublicKey”string
workspaceBucket?
Section titled “workspaceBucket?”string
Returns
Section titled “Returns”this
createProof()
Section titled “createProof()”createProof(
account,resourceAddress):this
Defined in: ootle/src/builder.ts:324
Parameters
Section titled “Parameters”account
Section titled “account”string
resourceAddress
Section titled “resourceAddress”string
Returns
Section titled “Returns”this
dropAllProofsInWorkspace()
Section titled “dropAllProofsInWorkspace()”dropAllProofsInWorkspace():
this
Defined in: ootle/src/builder.ts:413
Returns
Section titled “Returns”this
dropProofAuthorization()
Section titled “dropProofAuthorization()”dropProofAuthorization(
proofName):this
Defined in: ootle/src/builder.ts:436
Closes the authorization window authorizeProof opened over proofName.
Parameters
Section titled “Parameters”proofName
Section titled “proofName”string
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if no workspace variable named proofName is defined.
feeTransactionPayFromComponent()
Section titled “feeTransactionPayFromComponent()”feeTransactionPayFromComponent(
componentAddress,maxFee):this
Defined in: ootle/src/builder.ts:385
Adds a fee instruction that calls pay_fee on the given component.
The component must call vault.pay_fee and reveal enough confidential XTR.
Parameters
Section titled “Parameters”componentAddress
Section titled “componentAddress”string
maxFee
Section titled “maxFee”bigint
Returns
Section titled “Returns”this
feeTransactionPayFromComponentConfidential()
Section titled “feeTransactionPayFromComponentConfidential()”feeTransactionPayFromComponentConfidential(
_componentAddress,_proof):this
Defined in: ootle/src/builder.ts:403
NOT IMPLEMENTED — always throws. A confidential pay_fee needs a
ConfidentialWithdrawProof Literal that requires tari_bor struct encoding
the TS SDK does not yet provide. Use feeTransactionPayFromComponent for
revealed-fee payment.
Parameters
Section titled “Parameters”_componentAddress
Section titled “_componentAddress”string
_proof
Section titled “_proof”ConfidentialWithdrawProof
Returns
Section titled “Returns”this
Throws
Section titled “Throws”always.
publishTemplate()
Section titled “publishTemplate()”publishTemplate(
binaryBase64,metadataHash?):this
Defined in: ootle/src/builder.ts:470
Publishes a compiled WASM template. The binary is stored as a transaction
blob and referenced by index from the PublishTemplate instruction.
Parameters
Section titled “Parameters”binaryBase64
Section titled “binaryBase64”string
the template WASM, standard-base64 encoded
metadataHash?
Section titled “metadataHash?”string | null
optional multihash of off-chain CBOR metadata
Returns
Section titled “Returns”this
resolveWorkspaceOffsetId()
Section titled “resolveWorkspaceOffsetId()”resolveWorkspaceOffsetId(
name):WorkspaceOffsetId
Defined in: ootle/src/builder.ts:706
Resolves a workspace variable name (supporting dot-notation offsets, e.g. "bucket.0")
to its WorkspaceOffsetId. The variable must have been declared by a prior saveVar
(or other allocating call). Use this when constructing an Instruction that takes a
WorkspaceOffsetId directly (e.g. the native StealthTransfer variant’s
revealed_input_bucket), where the builder’s automatic { Workspace: "name" } arg
resolution does not apply.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”WorkspaceOffsetId
Throws
Section titled “Throws”if no workspace variable with that name has been defined.
saveVar()
Section titled “saveVar()”saveVar(
name):this
Defined in: ootle/src/builder.ts:374
Saves the last instruction output to a named workspace variable.
The variable can be referenced by subsequent instructions using { Workspace: "name" }.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if name is empty.
setComponentAccessRules()
Section titled “setComponentAccessRules()”setComponentAccessRules(
componentAddress,accessRules):this
Defined in: ootle/src/builder.ts:344
Replace a component’s method access rules (SetComponentAccessRules). The component’s
rules_updater, fixed when it was created, decides who may: Locked components refuse it.
Parameters
Section titled “Parameters”componentAddress
Section titled “componentAddress”string
accessRules
Section titled “accessRules”ComponentAccessRules
Returns
Section titled “Returns”this
setComponentOwnerRule()
Section titled “setComponentOwnerRule()”setComponentOwnerRule(
componentAddress,ownerRule):this
Defined in: ootle/src/builder.ts:354
Replace a component’s owner rule (SetComponentOwnerRule), as permitted by its
rules_updater.
Parameters
Section titled “Parameters”componentAddress
Section titled “componentAddress”string
ownerRule
Section titled “ownerRule”OwnerRule
Returns
Section titled “Returns”this
withAuthorizedProof()
Section titled “withAuthorizedProof()”withAuthorizedProof(
proofName,build):this
Defined in: ootle/src/builder.ts:455
Adds the instructions build adds inside an authorization window over the workspace
proof proofName, so the window covers exactly those instructions.
Parameters
Section titled “Parameters”proofName
Section titled “proofName”string
(builder) => unknown
Returns
Section titled “Returns”this
Example
Section titled “Example”builder .createProof(account, badgeResource) .saveVar("badge") .withAuthorizedProof("badge", (b) => b.callMethod({ componentAddress, methodName: "admin_only" }, [])) .dropAllProofsInWorkspace();Throws
Section titled “Throws”if no workspace variable named proofName is defined.
withFeeInstructions()
Section titled “withFeeInstructions()”withFeeInstructions(
instructions):this
Defined in: ootle/src/builder.ts:496
Parameters
Section titled “Parameters”instructions
Section titled “instructions”Instruction[]
Returns
Section titled “Returns”this
withFeeInstructionsBuilder()
Section titled “withFeeInstructionsBuilder()”withFeeInstructionsBuilder(
builder):this
Defined in: ootle/src/builder.ts:533
Build the fee instructions with a nested builder, mirroring the Rust builder’s separate fee-instruction builder. The nested builder gets its own workspace scope — correct, because the engine clears the workspace between the fee and main instruction runs.
The nested builder’s inputs and blobs are merged into the outer transaction:
- Duplicate inputs (by
substate_id) fill in a missingversionand upgrade read locks to write locks without mutating existing input objects. - Nested
blobsare appended toblobs, and anyPublishTemplateinstructions in the fee instructions have their blob index shifted by the prior outerblobs.length.
Note this REPLACES any fee_instructions already set, as it always has, while inputs
and blobs are additive only — nothing added by an earlier call is removed when fee
instructions are replaced.
Parameters
Section titled “Parameters”builder
Section titled “builder”(b) => TransactionBuilder
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if the outer and nested builders declare different explicit
(non-null) versions for the same substate_id.
withInputs()
Section titled “withInputs()”withInputs(
inputs):this
Defined in: ootle/src/builder.ts:578
Declare several transaction inputs; see addInput for the is_write default.
Parameters
Section titled “Parameters”inputs
Section titled “inputs”(InputDeclaration | SubstateRequirement)[]
Returns
Section titled “Returns”this
withInstructions()
Section titled “withInstructions()”withInstructions(
instructions):this
Defined in: ootle/src/builder.ts:490
Parameters
Section titled “Parameters”instructions
Section titled “instructions”Instruction[]
Returns
Section titled “Returns”this
withMainSigner()
Section titled “withMainSigner()”withMainSigner(
mainSigner):this
Defined in: ootle/src/builder.ts:592
Sets the transaction’s main signer: the key it acts as wherever the engine needs a single
signer (OwnerRule::OwnedBySigner, the caller’s transaction_signer_public_key, a
published template’s author). Every signature covers it, so it is fixed before signing.
Defaults to "None", which signTransaction replaces with the first signer’s key
({ Authorizer: <public key hex> }). Set it to name another authorizer, or to
"SealSigner" when the seal key itself should carry authority.
Parameters
Section titled “Parameters”mainSigner
Section titled “mainSigner”MainSigner
Returns
Section titled “Returns”this
withMaxEpoch()
Section titled “withMaxEpoch()”withMaxEpoch(
maxEpoch):this
Defined in: ootle/src/builder.ts:616
Overrides the validity window set at construction. See the constructor for the network’s cap on how far ahead of the current epoch this may sit. As with withMinEpoch, the window is checked by buildUnsignedTransaction.
Parameters
Section titled “Parameters”maxEpoch
Section titled “maxEpoch”number
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if maxEpoch is not a non-negative integer.
withMinEpoch()
Section titled “withMinEpoch()”withMinEpoch(
minEpoch):this
Defined in: ootle/src/builder.ts:604
Sets the first epoch in which the transaction may be sequenced. The window is checked
against max_epoch by buildUnsignedTransaction, not here, so the two bounds
may be set in either order.
Parameters
Section titled “Parameters”minEpoch
Section titled “minEpoch”number
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if minEpoch is not a non-negative integer.
withNonce()
Section titled “withNonce()”withNonce(
nonce):this
Defined in: ootle/src/builder.ts:636
Stamps the transaction nonce, which distinguishes otherwise-identical transactions.
The transaction id excludes the seal signature’s witness data, so two identical
bodies sealed by the same key are the same transaction — submitting both executes
once. Give each intent a distinct nonce when repeated submissions must each execute.
Defaults to 0.
Parameters
Section titled “Parameters”number | bigint
Returns
Section titled “Returns”this
Throws
Section titled “Throws”if nonce is negative or overflows u64.
withUnsignedTransaction()
Section titled “withUnsignedTransaction()”withUnsignedTransaction(
unsignedTransaction):this
Defined in: ootle/src/builder.ts:660
Adopt an existing transaction and keep building on it.
The adopted transaction is copied, not aliased: subsequent builder calls must not
reach back into the caller’s object. The manual co-signing flow ships
JSON.stringify(unsigned) across a boundary, so mutating a transaction the caller has
already serialized or signed makes the two sides disagree — surfacing only at submit
time as the opaque engine error "Transaction has one or more invalid signature(s)".
This mirrors the copy buildUnsignedTransaction makes on the way out.
Parameters
Section titled “Parameters”unsignedTransaction
Section titled “unsignedTransaction”UnsignedTransactionV1
Returns
Section titled “Returns”this
staticnew(network,maxEpoch):TransactionBuilder
Defined in: ootle/src/builder.ts:270
Parameters
Section titled “Parameters”network
Section titled “network”number
maxEpoch
Section titled “maxEpoch”number
Returns
Section titled “Returns”TransactionBuilder