Skip to content

chore: remove address prop and update sponsor txn check#1114

Merged
Zizzamia merged 10 commits intomainfrom
alissa.crane/address-fix
Aug 20, 2024
Merged

chore: remove address prop and update sponsor txn check#1114
Zizzamia merged 10 commits intomainfrom
alissa.crane/address-fix

Conversation

@abcrane123
Copy link
Contributor

@abcrane123 abcrane123 commented Aug 20, 2024

What changed? Why?

  • remove address prop and use wagmi useAccount instead
  • update life cycle status check for transaction sponsor

Notes to reviewers

How has it been tested?

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 20, 2024
@vercel
Copy link

vercel bot commented Aug 20, 2024

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

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 9:04pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 9:04pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 9:04pm

```ts
type TransactionReact = {
address: Address; // The wallet address involved in the transaction.
address?: Address; // The wallet address involved in the transaction (defaults to connected account if not provided).
Copy link
Contributor

Choose a reason for hiding this comment

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

And in the end, we decided to remove this completelly, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep just updated

@abcrane123 abcrane123 marked this pull request as draft August 20, 2024 19:51
@abcrane123 abcrane123 changed the title chore: default to connect wallet and update sponsor txn check chore: remove address prop and update sponsor txn check Aug 20, 2024
"@coinbase/onchainkit": patch
---

- **patch**: Remove address prop and fix sponsor component. By @abcrane123 #1114
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. try to be more verbose and explain this as someone with no context is reading this.

transactionId,
} = useTransactionContext();

const { address } = useAccount();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should useAccount be added even in small components. Or should be synced at Provider level?

Open question

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am leaning towards leaving this at component level because the TransactionButton component is the only component that requires address (to disable the button if address isn't defined) but let me know if you disagree

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good

writeContractsAsync: writeContractsAsyncMock,
});
(useWriteContract as ReturnType<typeof vi.fn>).mockReturnValue({
status: 'IDLE',
Copy link
Contributor

Choose a reason for hiding this comment

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

idle or IDLE?

I have a feeling it's always lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah you're right it is idle


expect(screen.queryByText('Zero transaction fee')).not.toBeInTheDocument();
});
it('does not render if statusName is not init', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

My take on spaces with test is:

  • no space within an it
  • one space between it

By doing that it's much easiser reading large file full of tests.


expect(screen.queryByText('Zero transaction fee')).not.toBeInTheDocument();
});
it('does render if statusName is init', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually the good practice of test, it's to start with the wording should ...

@Zizzamia Zizzamia merged commit 886d974 into main Aug 20, 2024
@Zizzamia Zizzamia deleted the alissa.crane/address-fix branch August 20, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

3 participants