Skip to content

Commit e4bc20e

Browse files
committed
feat: update modules
1 parent 6a4a24a commit e4bc20e

23 files changed

+1749
-1785
lines changed

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

Lines changed: 0 additions & 75 deletions
This file was deleted.

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
17621762
// Get actual CBOR size with fake witnesses
17631763
const txSizeWithWitnesses = yield* calculateTransactionSize(txWithWitnesses)
17641764

1765-
yield* Effect.logInfo(
1765+
yield* Effect.logDebug(
17661766
`Transaction size check: ${txSizeWithWitnesses} bytes ` +
17671767
`(with ${fakeWitnessSet.vkeyWitnesses?.length ?? 0} fake witnesses), max=${ctx.config.protocolParameters.maxTxSize} bytes`
17681768
)
@@ -2130,7 +2130,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
21302130
// Get actual CBOR size with fake witnesses
21312131
const txSizeWithWitnesses = yield* calculateTransactionSize(txWithFakeWitnesses)
21322132

2133-
yield* Effect.logInfo(
2133+
yield* Effect.logDebug(
21342134
`[StateMachineV2] Transaction size: ${txSizeWithWitnesses} bytes ` +
21352135
`(with ${fakeWitnessSet.vkeyWitnesses?.length ?? 0} fake witnesses), ` +
21362136
`max=${ctx.config.protocolParameters.maxTxSize} bytes`
@@ -2155,7 +2155,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
21552155
}
21562156

21572157
// Log final build summary
2158-
yield* Effect.logInfo(
2158+
yield* Effect.logDebug(
21592159
`[StateMachineV2] Build complete: ${inputs.length} input(s), ${allOutputs.length} output(s) ` +
21602160
`(${baseOutputs.length} base + ${finalBuildCtx.changeOutputs.length} change), ` +
21612161
`Fee: ${finalBuildCtx.calculatedFee} lovelace, Size: ${txSizeWithWitnesses} bytes, Attempts: ${finalBuildCtx.attempt}`
@@ -2561,7 +2561,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
25612561

25622562
// Balanced!
25632563
if (difference === 0n) {
2564-
yield* Effect.logInfo("[BalanceVerificationV2] Transaction balanced!")
2564+
yield* Effect.logDebug("[BalanceVerificationV2] Transaction balanced!")
25652565
return { next: "complete" as const }
25662566
}
25672567

@@ -2645,13 +2645,13 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
26452645
})
26462646
)
26472647
}
2648-
yield* Effect.logInfo("[BalanceVerificationV2] Attempts exhausted, trying drainTo")
2648+
yield* Effect.logDebug("[BalanceVerificationV2] Attempts exhausted, trying drainTo")
26492649
return { next: "drainTo" as const }
26502650
}
26512651

26522652
// Strategy 3: Burn as fee (TODO: add allowBurnAsFee to BuildOptions)
26532653
// if (ctx.options?.allowBurnAsFee && difference < 10_000n) {
2654-
// yield* Effect.logInfo("[BalanceVerificationV2] Attempts exhausted, burning as fee")
2654+
// yield* Effect.logDebug("[BalanceVerificationV2] Attempts exhausted, burning as fee")
26552655
// return { next: "burnAsFee" as const }
26562656
// }
26572657

@@ -2754,7 +2754,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
27542754
// Clear change outputs
27552755
yield* Ref.update(buildCtxRef, (ctx) => ({ ...ctx, changeOutputs: [] }))
27562756

2757-
yield* Effect.logInfo(`[DrainToV2] Successfully merged leftover (validated: ${mergedLovelace} >= ${mergedMinUtxo})`)
2757+
yield* Effect.logDebug(`[DrainToV2] Successfully merged leftover (validated: ${mergedLovelace} >= ${mergedMinUtxo})`)
27582758
return { next: "complete" as const }
27592759
})
27602760

@@ -2784,7 +2784,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
27842784
)
27852785
}
27862786

2787-
yield* Effect.logInfo(
2787+
yield* Effect.logDebug(
27882788
`[BurnAsFeeV2] Burning ${leftoverAfterFee.lovelace} lovelace as extra fee ` + `(below minUTxO, no native assets)`
27892789
)
27902790

@@ -3121,7 +3121,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
31213121

31223122
// Try reselection up to MAX_ATTEMPTS (if UTxOs available)
31233123
if (hasMoreUtxos && buildCtx.attempt < MAX_ATTEMPTS) {
3124-
yield* Effect.logInfo(
3124+
yield* Effect.logDebug(
31253125
`[ChangeCreationV3] Leftover ${tentativeLeftover.lovelace} < ${minLovelaceForSingle} minUTxO ` +
31263126
`(shortfall: ${shortfall}${isAdaOnlyLeftover ? ", ADA-only" : ", with native assets"}). ` +
31273127
`Attempting reselection (${buildCtx.attempt + 1}/${MAX_ATTEMPTS})`
@@ -3309,7 +3309,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
33093309

33103310
// Step 3: Check if balanced (delta is empty) → complete
33113311
if (isBalanced) {
3312-
yield* Effect.logInfo("[BalanceV3] Transaction balanced!")
3312+
yield* Effect.logDebug("[BalanceV3] Transaction balanced!")
33133313
return { next: "complete" as V3Phase }
33143314
}
33153315

@@ -3374,14 +3374,14 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
33743374
)
33753375
yield* Ref.set(ctx.state.totalOutputAssets, newTotalOutputAssets)
33763376

3377-
yield* Effect.logInfo(
3377+
yield* Effect.logDebug(
33783378
`[BalanceV3] DrainTo mode: Merged ${deltaLovelace} lovelace into output[${drainToIndex}]. ` +
33793379
`New output value: ${newLovelace}. Transaction balanced.`
33803380
)
33813381
return { next: "complete" as V3Phase }
33823382
} else if (isBurnMode) {
33833383
// Burn mode: Positive delta is the burned leftover (becomes implicit fee)
3384-
yield* Effect.logInfo(
3384+
yield* Effect.logDebug(
33853385
`[BalanceV3] Burn mode: ${deltaLovelace} lovelace burned as implicit fee. ` +
33863386
`Transaction balanced.`
33873387
)
@@ -3429,7 +3429,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
34293429
// Note: ChangeCreation ensures only ADA-only cases reach this phase.
34303430

34313431
const phaseFallbackV3 = Effect.gen(function* () {
3432-
yield* Effect.logInfo("[V3] Phase: Fallback")
3432+
yield* Effect.logDebug("[V3] Phase: Fallback")
34333433

34343434
const ctx = yield* TxContext
34353435
const buildCtxRef = yield* V3BuildContextTag
@@ -3466,7 +3466,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
34663466
changeOutputs: []
34673467
}))
34683468

3469-
yield* Effect.logInfo(
3469+
yield* Effect.logDebug(
34703470
`[Fallback] DrainTo strategy: Change outputs cleared. ` +
34713471
`Leftover will be merged into output[${drainToIndex}] after fee calculation.`
34723472
)
@@ -3486,7 +3486,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
34863486
changeOutputs: []
34873487
}))
34883488

3489-
yield* Effect.logInfo(
3489+
yield* Effect.logDebug(
34903490
`[Fallback] Burn strategy: Leftover will be burned as implicit fee ` +
34913491
`(recalculating fee without change outputs).`
34923492
)
@@ -3591,7 +3591,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
35913591
const buildCtx = yield* Ref.get(ctxRef)
35923592
const ctx = yield* TxContext
35933593

3594-
yield* Effect.logInfo(`[V3] Build complete - fee: ${buildCtx.calculatedFee}`)
3594+
yield* Effect.logDebug(`[V3] Build complete - fee: ${buildCtx.calculatedFee}`)
35953595

35963596
// Add change outputs to the transaction outputs
35973597
if (buildCtx.changeOutputs.length > 0) {
@@ -3625,7 +3625,7 @@ export const makeTxBuilder = (config: TxBuilderConfig): TransactionBuilder => {
36253625

36263626
const txSizeWithWitnesses = yield* calculateTransactionSize(txWithFakeWitnesses)
36273627

3628-
yield* Effect.logInfo(
3628+
yield* Effect.logDebug(
36293629
`[V3] Transaction size: ${txSizeWithWitnesses} bytes ` +
36303630
`(with ${fakeWitnessSet.vkeyWitnesses?.length ?? 0} fake witnesses), ` +
36313631
`max=${ctx.config.protocolParameters.maxTxSize} bytes`

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,16 +1073,11 @@ export const createChangeOutput = (params: {
10731073

10741074
// If unfracking is enabled, use Unfrack module
10751075
if (unfrackOptions) {
1076-
const config = {
1077-
subdivideThreshold: unfrackOptions.ada?.subdivideThreshold ?? 100_000000n,
1078-
bundleSize: unfrackOptions.tokens?.bundleSize ?? 10
1079-
}
1080-
10811076
const unfrackedOutputs = yield* Unfrack.createUnfrackedChangeOutputs(
1082-
leftoverAssets,
10831077
changeAddress,
1078+
leftoverAssets,
1079+
unfrackOptions,
10841080
coinsPerUtxoByte,
1085-
config
10861081
).pipe(
10871082
Effect.mapError((error) =>
10881083
new TransactionBuilderError({

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* - Token bundling: Group tokens into optimally-sized UTxOs
66
* - Fungible isolation: Place each fungible token on its own UTxO
77
* - NFT grouping: Group NFTs by policy ID
8-
* - ADA optimization: Roll up or subdivide ADA-only UTxOs
8+
* - ADA optimization: Roll up or subdivide ADA-only
99
*
10-
* Named in respect to the Unfrack.It open source community
11-
* @see https://unfrack.it
10+
* Named in respect to the Unfrack.It website
1211
*/
1312

1413
import * as Effect from "effect/Effect"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from "./CoinSelection.js"
22
export * from "./operations/index.js"
3-
export * from "./ReadOnlyTransactionBuilder.js"
43
export * from "./SignBuilder.js"
54
export * from "./TransactionBuilder.js"

0 commit comments

Comments
 (0)