IntersectMBO / IntersectMBO/evolution-sdk
feat(builder): lazy UTxO resolvers for retry-safe buildEffect
- Lingua principale
- TypeScript
- Stelle
- 22
- Fork
- 30
- Merge medio
- 5h 29m
- PR unite (30g)
- 12
Descrizione
## Problem
`BuildOptions.availableUtxos` and `collectFrom` inputs are static arrays resolved before `buildEffect()` runs. When an action is retried via `Effect.retry`, the same stale UTxO arrays are reused — the provider is never queried again.
## Proposed Solution
Allow `availableUtxos` and `collectFrom.inputs` to also accept a lazy resolver `() => Effect>` evaluated at build time:
```ts
client.newTx()
.collectFrom({ inputs: () => client.Effect.getUtxos(scriptAddress), redeemer })
.buildEffect({ availableUtxos: () => client.Effect.getWalletUtxos() })
.pipe(Effect.flatMap(s => s.Effect.signAndSubmit()))
.pipe(Effect.retry(Schedule.recurs(3)))
```
Each retry calls the resolver fresh, so UTxOs are always up to date with no extra boilerplate required from the user.
## Affected Areas
- `BuildOptions.availableUtxos` — extend type to accept `() => Effect>`
- `resolveAvailableUtxos` in `TransactionBuilder.ts` — yield the Effect at build time when lazy
- `CollectFromParams.inputs` — same lazy extension
- `createCollectFromProgram` in `Collect.ts` — evaluate resolver at program execution time
Non-breaking — static arrays continue to work as-is.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.