Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: version packages v0.30.0 🌊 #1141

Merged
merged 1 commit into from
Aug 22, 2024
Merged

chore: version packages v0.30.0 🌊 #1141

merged 1 commit into from
Aug 22, 2024

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@coinbase/onchainkit@0.30.0

Minor Changes

  • ed2379e: - feat: Moved the onError and onSuccess lifecycle listeners from the <SwapButton> component to the <Swap> component. By @Zizzamia chore: release #1139

    Breaking Changes
    OnchainKit standardizes lifecycle listeners with three callbacks: onError, onSuccess, and onStatus. The onError and onSuccess callbacks handle only the error and success states, respectively. In contrast, the onStatus callback provides more granular phases of each component's experience.

    Before, we used onError and onSuccess in the <SwapButton /> component.

    const handleOnError = useCallback((error) => {
      console.log(error);
    }, []);
    
    const handleOnSuccess = useCallback((response) => {
      console.log(response);
    }, []);
    
    ...
    
    <Swap address={address}>
      <SwapAmountInput
        label="Sell"
        swappableTokens={swappableTokens}
        token={ETHToken}
        type="from"
      />
      <SwapToggleButton />
      <SwapAmountInput
        label="Buy"
        swappableTokens={swappableTokens}
        token={USDCToken}
        type="to"
      />
      <SwapButton
        onError={handleOnError}
        onSuccess={handleOnSuccess}
      />
      <SwapMessage />
    </Swap>

    After, we use onStatus in the <Swap /> component.

    const handleOnStatus = useCallback((lifeCycleStatus: LifeCycleStatus) => {
      console.log('Status:', lifeCycleStatus);
    }, []);
    
    ...
    
    <Swap
      address={address}
      onStatus={handleOnStatus}
    >
      <SwapAmountInput
        label="Sell"
        swappableTokens={swappableTokens}
        token={ETHToken}
        type="from"
      />
      <SwapToggleButton />
      <SwapAmountInput
        label="Buy"
        swappableTokens={swappableTokens}
        token={USDCToken}
        type="to"
      />
      <SwapButton />
      <SwapMessage />
    </Swap>

    The onStatus callback will expose

    export type LifeCycleStatus =
      | {
          statusName: "init";
          statusData: null;
        }
      | {
          statusName: "error";
          statusData: SwapError;
        }
      | {
          statusName: "amountChange";
          statusData: null;
        }
      | {
          statusName: "transactionPending";
          statusData: null;
        }
      | {
          statusName: "transactionApproved";
          statusData: {
            transactionHash: Hex;
            transactionType: "ERC20" | "Permit2";
          };
        }
      | {
          statusName: "success";
          statusData: {
            transactionReceipt: TransactionReceipt;
          };
        };

Copy link

vercel bot commented Aug 22, 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 22, 2024 11:50pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 11:50pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 11:50pm

@github-actions github-actions bot changed the title chore: version packages v0.30.0 🌊 chore: version packages 🔖 Aug 22, 2024
@Zizzamia Zizzamia changed the title chore: version packages 🔖 chore: version packages v0.30.0 🌊 Aug 22, 2024
@Zizzamia Zizzamia merged commit 5a856fc into main Aug 22, 2024
7 checks passed
@Zizzamia Zizzamia deleted the changeset-release/main branch August 22, 2024 23:51
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