Skip to content

feat: simplified useWriteContracts#1088

Merged
Zizzamia merged 6 commits intomainfrom
zizzamia/coverage-8-16
Aug 17, 2024
Merged

feat: simplified useWriteContracts#1088
Zizzamia merged 6 commits intomainfrom
zizzamia/coverage-8-16

Conversation

@Zizzamia
Copy link
Contributor

What changed? Why?

Notes to reviewers

How has it been tested?

@vercel
Copy link

vercel bot commented Aug 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ❌ Failed (Inspect) Aug 17, 2024 6:45am
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 17, 2024 6:45am
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 17, 2024 6:45am

onSubmit,
receipt,
statusWriteContract,
statusWriteContracts,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing data back and forth from random components, we align the way data is stream by having:

  • from the parent pushing down status update
  • from the child to the parent set the status

So ideally lifeCycleStatus directs the experience of all components under the same provider.

This creates a drum bit, that help set the tone across all components.

cc @abcrane123 @0xAlec @cpcramer

statusWriteContract === 'pending' ||
statusWriteContracts === 'pending' ||
isLoading;
lifeCycleStatus.statusName === 'transactionPending' || isLoading;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the name transactionPending, something to reflect more in the next few weeks.

});
(useCallsStatus as ReturnType<typeof vi.fn>).mockReturnValue({
transactionHash: null,
status: 'IDLE',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apperently we were writing this wrong in a bunch of tests.

contracts,
capabilities,
});
}, [writeContractsAsync, contracts, capabilities]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less is more in this case!

},
});
return { status, writeContractAsync, data };
} catch (err) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I was reflecting on when this try/catch will fire off, and I couldn't figure out a real case this can go off.

So I removed it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant