Skip to content

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.

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.

number

number

TransactionBuilder

if maxEpoch is not a non-negative integer.

addFeeInstruction(instruction): this

Defined in: ootle/src/builder.ts:400

Instruction

this


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.

InputDeclaration | SubstateRequirement

this


addInstruction(instruction): this

Defined in: ootle/src/builder.ts:394

Instruction

this


allocateAddress(allocatableType, workspaceIdName): this

Defined in: ootle/src/builder.ts:325

AllocatableAddressType

string

this


buildUnsignedTransaction(): UnsignedTransactionV1

Defined in: ootle/src/builder.ts:554

UnsignedTransactionV1


callFunction<T>(func, args): this

Defined in: ootle/src/builder.ts:259

T extends TariFunctionDefinition

T

Exclude<T["args"], undefined>

this


callMethod<T>(method, args): this

Defined in: ootle/src/builder.ts:274

T extends TariMethodDefinition

T

Exclude<T["args"], undefined>

this

if method provides neither componentAddress nor fromWorkspace, or if fromWorkspace references an undefined variable.


claimBurn(claim, output_data): this

Defined in: ootle/src/builder.ts:319

MinotariBurnClaimProof

ClaimBurnOutputData

this


createAccount(ownerPublicKey, workspaceBucket?): this

Defined in: ootle/src/builder.ts:297

string

string

this


createProof(account, resourceAddress): this

Defined in: ootle/src/builder.ts:309

string

string

this


dropAllProofsInWorkspace(): this

Defined in: ootle/src/builder.ts:375

this


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.

string

bigint

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.

string

ConfidentialWithdrawProof

this

always.


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.

string

the template WASM, standard-base64 encoded

string | null

optional multihash of off-chain CBOR metadata

this


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.

string

WorkspaceOffsetId

if no workspace variable with that name has been defined.


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" }.

string

this


withFeeInstructions(instructions): this

Defined in: ootle/src/builder.ts:412

Instruction[]

this


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.

(b) => TransactionBuilder

this


withInputs(inputs): this

Defined in: ootle/src/builder.ts:459

Declare several transaction inputs; see addInput for the is_write default.

(InputDeclaration | SubstateRequirement)[]

this


withInstructions(instructions): this

Defined in: ootle/src/builder.ts:406

Instruction[]

this


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.

number

this

if maxEpoch is not a non-negative integer.


withMinEpoch(minEpoch): this

Defined in: ootle/src/builder.ts:465

number

this

if minEpoch is not a non-negative integer.


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.

number | bigint

this

if nonce is negative or overflows u64.


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.

UnsignedTransactionV1

this


static new(network, maxEpoch): TransactionBuilder

Defined in: ootle/src/builder.ts:255

number

number

TransactionBuilder