Skip to content

Commit 41eced8

Browse files
committed
feat: update docs
1 parent e20c160 commit 41eced8

File tree

8 files changed

+108
-33
lines changed

8 files changed

+108
-33
lines changed

docs/content/docs/modules/sdk/builders/SignBuilder.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ SignBuilder extends TransactionResultBase with signing capabilities.
2525
Only available when the client has a signing wallet (seed, private key, or API wallet).
2626
Provides access to unsigned transaction (via base interface) and signing operations.
2727

28+
Includes `chainResult` for transaction chaining - use `chainResult.available` as
29+
`availableUtxos` for the next transaction in a chain.
30+
2831
**Signature**
2932

3033
```ts
3134
export interface SignBuilder extends TransactionResultBase, EffectToPromiseAPI<SignBuilderEffect> {
3235
readonly Effect: SignBuilderEffect
36+
/**
37+
* Compute chain result for building dependent transactions.
38+
* Contains consumed UTxOs, available UTxOs (remaining + created), and txHash.
39+
*
40+
* Result is memoized - computed once on first call, cached for subsequent calls.
41+
*/
42+
readonly chainResult: () => ChainResult
3343
}
3444
```
3545

@@ -52,6 +62,7 @@ export interface SignBuilderEffect {
5262

5363
// Signing methods
5464
readonly sign: () => Effect.Effect<SubmitBuilder, TransactionBuilderError>
65+
readonly signAndSubmit: () => Effect.Effect<string, TransactionBuilderError>
5566
readonly signWithWitness: (
5667
witnessSet: TransactionWitnessSet.TransactionWitnessSet
5768
) => Effect.Effect<SubmitBuilder, TransactionBuilderError>

docs/content/docs/modules/sdk/builders/SignBuilderImpl.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export declare const makeSignBuilder: (params: {
4646
referenceUtxos: ReadonlyArray<CoreUTxO.UTxO>
4747
provider: Provider.Provider
4848
wallet: Wallet
49+
outputs: ReadonlyArray<TxOut.TransactionOutput>
50+
availableUtxos: ReadonlyArray<CoreUTxO.UTxO>
4951
}) => SignBuilder
5052
```
5153

docs/content/docs/modules/sdk/builders/TransactionBuilder.mdx

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,36 @@ export interface TransactionBuilderBase {
629629
* @category builder-methods
630630
*/
631631
readonly addSigner: (params: AddSignerParams) => this
632+
633+
// ============================================================================
634+
// Transaction Chaining Methods
635+
// ============================================================================
636+
637+
/**
638+
* Execute transaction build and return consumed/available UTxOs for chaining.
639+
*
640+
* Runs the full build pipeline (coin selection, fee calculation, evaluation) and returns
641+
* which UTxOs were consumed and which remain available for subsequent transactions.
642+
* Use this when building multiple dependent transactions in sequence.
643+
*
644+
* @returns Promise<ChainResult> with consumed and available UTxOs
645+
*
646+
* @example
647+
* ```typescript
648+
* // Build first transaction, get remaining UTxOs
649+
* const tx1 = await builder
650+
* .payTo({ address, value: { lovelace: 5_000_000n } })
651+
* .build({ availableUtxos: walletUtxos })
652+
*
653+
* // Build second transaction using remaining UTxOs from chainResult
654+
* const tx2 = await builder
655+
* .payTo({ address, value: { lovelace: 3_000_000n } })
656+
* .build({ availableUtxos: tx1.chainResult().available })
657+
* ```
658+
*
659+
* @since 2.0.0
660+
* @category chaining-methods
661+
*/
632662
}
633663
````
634664
@@ -1021,17 +1051,22 @@ Added in v2.0.0
10211051

10221052
Result type for transaction chaining operations.
10231053

1024-
**NOTE: NOT YET IMPLEMENTED** - This interface is reserved for future implementation
1025-
of multi-transaction workflows. Current chain methods return stub implementations.
1054+
Provides consumed and available UTxOs for building chained transactions.
1055+
The available UTxOs include both remaining unspent inputs AND newly created outputs
1056+
with pre-computed txHash, ready to be spent in subsequent transactions.
1057+
1058+
Accessed via `SignBuilder.chainResult()` after calling `build()`.
10261059

10271060
**Signature**
10281061

10291062
```ts
10301063
export interface ChainResult {
1031-
readonly transaction: Transaction.Transaction
1032-
readonly newOutputs: ReadonlyArray<CoreUTxO.UTxO> // UTxOs created by this transaction
1033-
readonly updatedUtxos: ReadonlyArray<CoreUTxO.UTxO> // Available UTxOs for next transaction (original - spent + new)
1034-
readonly spentUtxos: ReadonlyArray<CoreUTxO.UTxO> // UTxOs consumed by this transaction
1064+
/** UTxOs consumed from availableUtxos by coin selection */
1065+
readonly consumed: ReadonlyArray<CoreUTxO.UTxO>
1066+
/** Available UTxOs: remaining unspent + newly created (with computed txHash) */
1067+
readonly available: ReadonlyArray<CoreUTxO.UTxO>
1068+
/** Pre-computed transaction hash (blake2b-256 of transaction body) */
1069+
readonly txHash: string
10351070
}
10361071
```
10371072

packages/evolution/docs/modules/sdk/builders/SignBuilder.ts.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ SignBuilder extends TransactionResultBase with signing capabilities.
2525
Only available when the client has a signing wallet (seed, private key, or API wallet).
2626
Provides access to unsigned transaction (via base interface) and signing operations.
2727

28+
Includes `chainResult` for transaction chaining - use `chainResult.available` as
29+
`availableUtxos` for the next transaction in a chain.
30+
2831
**Signature**
2932

3033
```ts
3134
export interface SignBuilder extends TransactionResultBase, EffectToPromiseAPI<SignBuilderEffect> {
3235
readonly Effect: SignBuilderEffect
36+
/**
37+
* Compute chain result for building dependent transactions.
38+
* Contains consumed UTxOs, available UTxOs (remaining + created), and txHash.
39+
*
40+
* Result is memoized - computed once on first call, cached for subsequent calls.
41+
*/
42+
readonly chainResult: () => ChainResult
3343
}
3444
```
3545

@@ -52,6 +62,7 @@ export interface SignBuilderEffect {
5262

5363
// Signing methods
5464
readonly sign: () => Effect.Effect<SubmitBuilder, TransactionBuilderError>
65+
readonly signAndSubmit: () => Effect.Effect<string, TransactionBuilderError>
5566
readonly signWithWitness: (
5667
witnessSet: TransactionWitnessSet.TransactionWitnessSet
5768
) => Effect.Effect<SubmitBuilder, TransactionBuilderError>

packages/evolution/docs/modules/sdk/builders/SignBuilderImpl.ts.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export declare const makeSignBuilder: (params: {
4646
referenceUtxos: ReadonlyArray<CoreUTxO.UTxO>
4747
provider: Provider.Provider
4848
wallet: Wallet
49+
outputs: ReadonlyArray<TxOut.TransactionOutput>
50+
availableUtxos: ReadonlyArray<CoreUTxO.UTxO>
4951
}) => SignBuilder
5052
```
5153

packages/evolution/docs/modules/sdk/builders/TransactionBuilder.ts.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,36 @@ export interface TransactionBuilderBase {
629629
* @category builder-methods
630630
*/
631631
readonly addSigner: (params: AddSignerParams) => this
632+
633+
// ============================================================================
634+
// Transaction Chaining Methods
635+
// ============================================================================
636+
637+
/**
638+
* Execute transaction build and return consumed/available UTxOs for chaining.
639+
*
640+
* Runs the full build pipeline (coin selection, fee calculation, evaluation) and returns
641+
* which UTxOs were consumed and which remain available for subsequent transactions.
642+
* Use this when building multiple dependent transactions in sequence.
643+
*
644+
* @returns Promise<ChainResult> with consumed and available UTxOs
645+
*
646+
* @example
647+
* ```typescript
648+
* // Build first transaction, get remaining UTxOs
649+
* const tx1 = await builder
650+
* .payTo({ address, value: { lovelace: 5_000_000n } })
651+
* .build({ availableUtxos: walletUtxos })
652+
*
653+
* // Build second transaction using remaining UTxOs from chainResult
654+
* const tx2 = await builder
655+
* .payTo({ address, value: { lovelace: 3_000_000n } })
656+
* .build({ availableUtxos: tx1.chainResult().available })
657+
* ```
658+
*
659+
* @since 2.0.0
660+
* @category chaining-methods
661+
*/
632662
}
633663
````
634664
@@ -1021,17 +1051,22 @@ Added in v2.0.0
10211051

10221052
Result type for transaction chaining operations.
10231053

1024-
**NOTE: NOT YET IMPLEMENTED** - This interface is reserved for future implementation
1025-
of multi-transaction workflows. Current chain methods return stub implementations.
1054+
Provides consumed and available UTxOs for building chained transactions.
1055+
The available UTxOs include both remaining unspent inputs AND newly created outputs
1056+
with pre-computed txHash, ready to be spent in subsequent transactions.
1057+
1058+
Accessed via `SignBuilder.chainResult()` after calling `build()`.
10261059

10271060
**Signature**
10281061

10291062
```ts
10301063
export interface ChainResult {
1031-
readonly transaction: Transaction.Transaction
1032-
readonly newOutputs: ReadonlyArray<CoreUTxO.UTxO> // UTxOs created by this transaction
1033-
readonly updatedUtxos: ReadonlyArray<CoreUTxO.UTxO> // Available UTxOs for next transaction (original - spent + new)
1034-
readonly spentUtxos: ReadonlyArray<CoreUTxO.UTxO> // UTxOs consumed by this transaction
1064+
/** UTxOs consumed from availableUtxos by coin selection */
1065+
readonly consumed: ReadonlyArray<CoreUTxO.UTxO>
1066+
/** Available UTxOs: remaining unspent + newly created (with computed txHash) */
1067+
readonly available: ReadonlyArray<CoreUTxO.UTxO>
1068+
/** Pre-computed transaction hash (blake2b-256 of transaction body) */
1069+
readonly txHash: string
10351070
}
10361071
```
10371072

packages/evolution/src/sdk/builders/SignBuilder.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ export interface SignBuilder extends TransactionResultBase, EffectToPromiseAPI<S
5757
* Contains consumed UTxOs, available UTxOs (remaining + created), and txHash.
5858
*
5959
* Result is memoized - computed once on first call, cached for subsequent calls.
60-
*
61-
* @example
62-
* ```typescript
63-
* const tx1 = await client.newTx().payToAddress(...).build({ availableUtxos: walletUtxos })
64-
* const tx2 = await client.newTx().payToAddress(...).build({ availableUtxos: tx1.chainResult().available })
65-
* await tx1.sign().submit()
66-
* await tx2.sign().submit()
67-
* ```
6860
*/
6961
readonly chainResult: () => ChainResult
7062
}

packages/evolution/src/sdk/builders/TransactionBuilder.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -519,19 +519,6 @@ const buildPartialEffectCore = (
519519
*
520520
* Accessed via `SignBuilder.chainResult()` after calling `build()`.
521521
*
522-
* @example
523-
* ```ts
524-
* const tx1 = await TxBuilder.create(sdk)
525-
* .payTo({ address, value: { lovelace: 5_000_000n } })
526-
* .build({ availableUtxos: walletUtxos })
527-
*
528-
* // tx1.chainResult().available contains remaining unspent + new UTxOs with computed txHash
529-
*
530-
* const tx2 = await TxBuilder.create(sdk)
531-
* .payTo({ address, value: { lovelace: 3_000_000n } })
532-
* .build({ availableUtxos: tx1.chainResult().available })
533-
* ```
534-
*
535522
* @since 2.0.0
536523
* @category model
537524
*/

0 commit comments

Comments
 (0)