Skip to content

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.

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.

number

number

TransactionBuilder

if maxEpoch is not a non-negative integer.

get maxEpoch(): number

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

The max_epoch set so far, read without the window check buildUnsignedTransaction applies.

number

addFeeInstruction(instruction): this

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

Instruction

this


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.

InputDeclaration | SubstateRequirement

this


addInstruction(instruction): this

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

Instruction

this


allocateAddress(allocatableType, workspaceIdName): this

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

AllocatableAddressType

string

this

if workspaceIdName is empty.


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.

string

this

if no workspace variable named proofName is defined.


buildUnsignedTransaction(): UnsignedTransactionV1

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

Returns a copy of the transaction built so far.

UnsignedTransactionV1

if min_epoch is set and exceeds max_epoch.


callFunction<T>(func, args): this

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

T extends TariFunctionDefinition

T

Exclude<T["args"], undefined>

this


callMethod<T>(method, args): this

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

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): this

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

MinotariBurnClaimProof

this


createAccount(ownerPublicKey, workspaceBucket?): this

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

string

string

this


createProof(account, resourceAddress): this

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

string

string

this


dropAllProofsInWorkspace(): this

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

this


dropProofAuthorization(proofName): this

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

Closes the authorization window authorizeProof opened over proofName.

string

this

if no workspace variable named proofName is defined.


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.

string

bigint

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.

string

ConfidentialWithdrawProof

this

always.


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.

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: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.

string

WorkspaceOffsetId

if no workspace variable with that name has been defined.


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

string

this

if name is empty.


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.

string

ComponentAccessRules

this


setComponentOwnerRule(componentAddress, ownerRule): this

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

Replace a component’s owner rule (SetComponentOwnerRule), as permitted by its rules_updater.

string

OwnerRule

this


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.

string

(builder) => unknown

this

builder
.createProof(account, badgeResource)
.saveVar("badge")
.withAuthorizedProof("badge", (b) => b.callMethod({ componentAddress, methodName: "admin_only" }, []))
.dropAllProofsInWorkspace();

if no workspace variable named proofName is defined.


withFeeInstructions(instructions): this

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

Instruction[]

this


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 missing version and upgrade read locks to write locks without mutating existing input objects.
  • Nested blobs are appended to blobs, and any PublishTemplate instructions in the fee instructions have their blob index shifted by the prior outer blobs.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.

(b) => TransactionBuilder

this

if the outer and nested builders declare different explicit (non-null) versions for the same substate_id.


withInputs(inputs): this

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

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

(InputDeclaration | SubstateRequirement)[]

this


withInstructions(instructions): this

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

Instruction[]

this


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.

MainSigner

this


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.

number

this

if maxEpoch is not a non-negative integer.


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.

number

this

if minEpoch is not a non-negative integer.


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.

number | bigint

this

if nonce is negative or overflows u64.


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.

UnsignedTransactionV1

this


static new(network, maxEpoch): TransactionBuilder

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

number

number

TransactionBuilder