TransactionBuilder
Defined in: ootle/src/builder.ts:219
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:238
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.
Methods
Section titled “Methods”addFeeInstruction()
Section titled “addFeeInstruction()”addFeeInstruction(
instruction):this
Defined in: ootle/src/builder.ts:400
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:453
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:394
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:325
Parameters
Section titled “Parameters”allocatableType
Section titled “allocatableType”AllocatableAddressType
workspaceIdName
Section titled “workspaceIdName”string
Returns
Section titled “Returns”this
buildUnsignedTransaction()
Section titled “buildUnsignedTransaction()”buildUnsignedTransaction():
UnsignedTransactionV1
Defined in: ootle/src/builder.ts:554
Returns
Section titled “Returns”UnsignedTransactionV1
callFunction()
Section titled “callFunction()”callFunction<
T>(func,args):this
Defined in: ootle/src/builder.ts:259
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:274
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,output_data):this
Defined in: ootle/src/builder.ts:319
Parameters
Section titled “Parameters”MinotariBurnClaimProof
output_data
Section titled “output_data”ClaimBurnOutputData
Returns
Section titled “Returns”this
createAccount()
Section titled “createAccount()”createAccount(
ownerPublicKey,workspaceBucket?):this
Defined in: ootle/src/builder.ts:297
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:309
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:375
Returns
Section titled “Returns”this
feeTransactionPayFromComponent()
Section titled “feeTransactionPayFromComponent()”feeTransactionPayFromComponent(
componentAddress,maxFee):this
Defined in: ootle/src/builder.ts:347
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:365
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:386
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:550
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:336
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
withFeeInstructions()
Section titled “withFeeInstructions()”withFeeInstructions(
instructions):this
Defined in: ootle/src/builder.ts:412
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:438
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.
Note this REPLACES any fee instructions already set, as it always has.
Parameters
Section titled “Parameters”builder
Section titled “builder”(b) => TransactionBuilder
Returns
Section titled “Returns”this
withInputs()
Section titled “withInputs()”withInputs(
inputs):this
Defined in: ootle/src/builder.ts:459
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:406
Parameters
Section titled “Parameters”instructions
Section titled “instructions”Instruction[]
Returns
Section titled “Returns”this
withMaxEpoch()
Section titled “withMaxEpoch()”withMaxEpoch(
maxEpoch):this
Defined in: ootle/src/builder.ts:476
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.
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:465
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:491
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:515
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:255
Parameters
Section titled “Parameters”network
Section titled “network”number
maxEpoch
Section titled “maxEpoch”number
Returns
Section titled “Returns”TransactionBuilder