FuelLabs / fuels-ts

Fuel Network Typescript SDK
https://docs.fuel.network/docs/fuels-ts/
Apache License 2.0
44.25k stars 1.34k forks source link

Combine similar methods in `BaseInvocationScope` #1865

Open Torres-ssf opened 6 months ago

Torres-ssf commented 6 months ago

We currently have multiple dry-run methods within BaseInvocationScope: simulate, dryRun, and get.

We need to validate which methods we are maintaining and which ones we are going to remove.

This is some brainstorm originally posted here:

/*
  Call - accepts optional flags
*/
call({ ..., dryRun: boolean, skipUtxoValidation: boolean })
// - Requires Wallet
// - Never use fake UTXOs

// valid calls
call({ ... }) // = default
call({ ..., dryRun: true }) // current simulate
call({ ..., dryRun: true, skipUtxoValidation: true }) // current dryRun

// invalid calls
call({ ..., skipUtxoValidation: true }) // throws error (requires dryRun=true)
call({ ..., dryRun: false, skipUtxoValidation: true }) // throws error (requires dryRun=true)

/*
  Get - requires no special flags
*/
get({ ... })
// - Do not require but can receive a Wallet
// - Always use fake UTXOs (accounts for lack of balance)
arboleya commented 6 months ago

This could potentially be done together with: