Closed Maddiaa0 closed 1 year ago
Hey @cheethas this is great, thanks for putting this together and including the tests and everything.
I would like to get a gas estimate option working for all of the methods, and I think I'll try to generalize it a bit for that (trying to decide between something like await splitsClient.createSplit({ ..., shouldEstimateGas: true})
, or await splitsClient.gasEstimator.createSplit({ ... })
, or maybe something else.
Anyway, this is a great start for that and will be easy to work off of, so thank you. I'm pretty sure I won't be able to get that wrapped up and published this week. Will be a couple weeks at best.
Do you need this functionality for create split pretty soon? Maybe could get that other pattern figured out and wired up just for createSplit to start.
Hey @mihoward21 thanks for reviewing. I like the latter pattern as it matches what people are already familiar with with libraries like ethers
. I'll wire up createSplit
with the pattern and aim to help contribute the remaining functions over the week!
Hey @cheethas , sorry this took so long. Not sure if it helps at this point but I finally got around to the gas estimate feature. It basically works the same as ethersjs contracts with the estimateGas
property. So for example:
const splitsClient = new SplitsClient({ chainId, provider })
const createSplitGas = splitsClient.estimateGas.createSplit({ ...inputs })
Still playing around with it so you'll need to download the latest beta version of the sdk if you want to use it. Hopefully can get it published to prod and on our docs next week.
That's awesome work I'll absolutely play around with it!
Apologies I never finished it up. The api you've ended up with looks awesome
Rational When building a user interface leveraging the splits sdk, we would like to be able to prompt the user with the estimated gas cost in usd dollar terms before they view it within their signer. This pr adds gas estimation functionality for the create split method.
Usage
This returns the number of wei a user can expect to spend for a deploy.
Notes I've attempted to keep the coding style of this pr in line with what currently exists in the sdk. Please let me know if you would like me to make any changes / enhancements.