@tari-project/ootle 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +34 -10
  2. package/dist/index.js +418 -378
  3. package/package.json +11 -3
package/dist/index.d.ts CHANGED
@@ -80,7 +80,7 @@ export declare class AccountInvokeBuilder {
80
80
  * for a follow-up instruction.
81
81
  */
82
82
  publishTemplate(_sourceAccount: ComponentAddress, templateBinaryBase64: string, workspaceBucket?: string): this;
83
- build(): UnsignedTransactionWithBlobs;
83
+ build(): UnsignedTransactionV1;
84
84
  }
85
85
 
86
86
  export { Amount }
@@ -351,7 +351,7 @@ export { Decision }
351
351
  * The result of decrypting an owned output via the AEAD path (`unblindOutput`).
352
352
  *
353
353
  * Maps from the WASM `DecryptedOutputResult { mask: Uint8Array, value: bigint,
354
- * memo_json: string | undefined }`. Per the verified 0.32 ABI, `memo` is the
354
+ * memo_json: string | undefined }`. Per the verified 0.38 ABI, `memo` is the
355
355
  * **JSON-encoded `Memo` string** (`U256` / `Message` / `Bytes` / `PayRefAndBytes`),
356
356
  * not raw bytes — callers parse it if needed.
357
357
  */
@@ -468,7 +468,7 @@ export declare class FaucetInvokeBuilder {
468
468
  * Mirrors `FaucetInvokeBuilder::publish_template` from ootle-rs.
469
469
  */
470
470
  publishTemplate(templateAddress: PublishedTemplateAddress, workspaceBucket?: string): this;
471
- build(): UnsignedTransactionWithBlobs;
471
+ build(): UnsignedTransactionV1;
472
472
  }
473
473
 
474
474
  export { FinalizeOutcome }
@@ -1676,8 +1676,8 @@ export declare interface TransactionAuthorization {
1676
1676
  */
1677
1677
  export declare class TransactionBuilder {
1678
1678
  private unsignedTransaction;
1679
- private allocatedIds;
1680
- private currentId;
1679
+ private workspaceIds;
1680
+ private feeWorkspaceIds;
1681
1681
  constructor(network: Network | number);
1682
1682
  static new(network: Network | number): TransactionBuilder;
1683
1683
  callFunction<T extends TariFunctionDefinition>(func: T, args: Exclude<T["args"], undefined>): this;
@@ -1722,11 +1722,33 @@ export declare class TransactionBuilder {
1722
1722
  addFeeInstruction(instruction: Instruction): this;
1723
1723
  withInstructions(instructions: Instruction[]): this;
1724
1724
  withFeeInstructions(instructions: Instruction[]): this;
1725
+ /**
1726
+ * Account for slots claimed by instructions the builder did not allocate itself, so a
1727
+ * later `saveVar` cannot re-issue one. Rust does this inline in `add_instruction`.
1728
+ */
1729
+ private observeAllocations;
1730
+ /**
1731
+ * Build the fee instructions with a nested builder, mirroring the Rust builder's separate
1732
+ * fee-instruction builder. The nested builder gets its own workspace scope — correct,
1733
+ * because the engine clears the workspace between the fee and main instruction runs.
1734
+ *
1735
+ * Note this REPLACES any fee instructions already set, as it always has.
1736
+ */
1725
1737
  withFeeInstructionsBuilder(builder: (b: TransactionBuilder) => TransactionBuilder): this;
1726
1738
  addInput(input: SubstateRequirement): this;
1727
1739
  withInputs(inputs: SubstateRequirement[]): this;
1728
1740
  withMinEpoch(minEpoch: number): this;
1729
1741
  withMaxEpoch(maxEpoch: number): this;
1742
+ /**
1743
+ * Adopt an existing transaction and keep building on it.
1744
+ *
1745
+ * The adopted transaction is **copied**, not aliased: subsequent builder calls must not
1746
+ * reach back into the caller's object. The manual co-signing flow ships
1747
+ * `JSON.stringify(unsigned)` across a boundary, so mutating a transaction the caller has
1748
+ * already serialized or signed makes the two sides disagree — surfacing only at submit
1749
+ * time as the opaque engine error `"Transaction has one or more invalid signature(s)"`.
1750
+ * This mirrors the copy {@link buildUnsignedTransaction} makes on the way out.
1751
+ */
1730
1752
  withUnsignedTransaction(unsignedTransaction: UnsignedTransactionV1): this;
1731
1753
  /**
1732
1754
  * Resolves a workspace variable name (supporting dot-notation offsets, e.g. `"bucket.0"`)
@@ -1739,7 +1761,7 @@ export declare class TransactionBuilder {
1739
1761
  * @throws {InvalidArgumentError} if no workspace variable with that name has been defined.
1740
1762
  */
1741
1763
  resolveWorkspaceOffsetId(name: string): WorkspaceOffsetId;
1742
- buildUnsignedTransaction(): UnsignedTransactionWithBlobs;
1764
+ buildUnsignedTransaction(): UnsignedTransactionV1;
1743
1765
  private addNamedId;
1744
1766
  private requireNamedId;
1745
1767
  private getOffsetIdFromWorkspaceName;
@@ -1801,10 +1823,12 @@ export { UnsignedTransactionV1 }
1801
1823
  /**
1802
1824
  * `UnsignedTransactionV1` with the `blobs` list: standard-base64 payloads
1803
1825
  * referenced from instructions by index (see {@link TransactionBuilder.publishTemplate}).
1826
+ *
1827
+ * @deprecated `blobs` is now a field of `UnsignedTransactionV1` itself (ootle-ts-bindings
1828
+ * ≥ 1.47), so this intersection adds nothing. Kept as an alias for one release; use
1829
+ * `UnsignedTransactionV1` directly.
1804
1830
  */
1805
- export declare type UnsignedTransactionWithBlobs = UnsignedTransactionV1 & {
1806
- blobs: string[];
1807
- };
1831
+ export declare type UnsignedTransactionWithBlobs = UnsignedTransactionV1;
1808
1832
 
1809
1833
  /**
1810
1834
  * CBOR-encode a `UtxoAddress` as `Tag(141, [ResourceAddress, UtxoId])`, where the
@@ -1916,7 +1940,7 @@ export declare interface WalletStealthAuthorizerOptions {
1916
1940
  }
1917
1941
 
1918
1942
  /**
1919
- * The real `StealthCryptoProvider`, backed by `@tari-project/ootle-wasm@0.32.0`.
1943
+ * The real `StealthCryptoProvider`, backed by `@tari-project/ootle-wasm@0.38.0`.
1920
1944
  *
1921
1945
  * Marshals between the step-02 domain types (`Mask`, `Output`, statements) and the raw
1922
1946
  * WASM ABI (snake_case result fields, positional args, raw `Uint8Array`s/`bigint`s).