coinbase / coinbase/onchainkit
Feature Request: <Transaction /> should accept an async function in calls prop
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 520
- Avg merge
- 32m
- Merged PRs (30d)
- 2
Description
### Describe the solution you'd like
I would like the component to accept an async function in the calls prop that resolves to calls.
I would much rather have a component that looks like this:
```typescript
await fetchCalls() as Call[]}
chainId={{base.id}}
>
Buy
```
Rather than setup a component such that I need to find a creative way for my calls to be constantly updating in a useMemo or something like that.
### Describe alternatives you've considered.
Instead of having my calls prop behave like a promise where I can fetch calls and then return the calls to the transaction button, I need to do extra work to ensure that my calls are memoized and stay updated based on user behavior.
Example: consider the situation where a user controls an input field and based on the amount that they enter, I need to fetch a quote and create calls based on the quote. In the current setup, I need to watch the input field and fire off a query to fetch a quote when the input changes.
If instead I could pass an async function to the transaction component, I could execute the fetch for the quote only once and then return the calls to the transaction component at the time of execution.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.