Skip to content

Commit

Permalink
Merge pull request #359 from Anastasia-Labs/feat/return-lucid-config
Browse files Browse the repository at this point in the history
feat: add return .lucidConfig()
  • Loading branch information
solidsnakedev authored Oct 9, 2024
2 parents 695b402 + cb6476b commit a4ec78c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curvy-seas-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lucid-evolution/lucid": patch
---

add return .lucidConfig()
14 changes: 13 additions & 1 deletion packages/lucid/src/tx-builder/TxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,18 @@ export type TxBuilder = {
chainSafe: () => Promise<
Either<[UTxO[], UTxO[], TxSignBuilder.TxSignBuilder], TransactionError>
>;
/**
* **Warning:** This method executes all programs and mutates the TxBuilder state.
*
* Calling `.complete()` after executing this function will lead to unexpected behavior.
*
* It is recommended to call `.config()` only for debugging purposes
*/
config: () => Promise<TxBuilderConfig>;
/**
* Returns the current lucid instance configuration
*/
lucidConfig: () => LucidConfig;
};

export function makeTxBuilder(lucidConfig: LucidConfig): TxBuilder {
Expand Down Expand Up @@ -591,9 +602,10 @@ export function makeTxBuilder(lucidConfig: LucidConfig): TxBuilder {
makeReturn(CompleteTxBuilder.complete(config, options)).safeRun(),
config: () =>
Effect.gen(function* () {
yield* Effect.all(config.programs, { concurrency: "unbounded" });
yield* Effect.all(config.programs);
return config;
}).pipe(Effect.runPromise),
lucidConfig: () => config.lucidConfig,
};
return txBuilder;
}

0 comments on commit a4ec78c

Please sign in to comment.