Skip to content

Releases: coinbase/onchainkit

v0.32.0

17 Sep 15:07
adf2a7c
Compare
Choose a tag to compare

Minor Changes

  • feat: re-typed walletCapabilities object in OnchainKitConfig. By @0xAlec #1238
  • fix: removed mt-4 from <TransactionButton>, ensuring the primary component maintains a clean and consistent design without outer margin. By @Zizzamia #1258
  • fix: renamed LifeCycle to Lifecycle. By @Zizzamia #1257
  • fix: SwapSlippageInput was visually resetting to default value on error. By @cpcramer #1250
  • fix: removed context states and use lifecyclestatus as the source of truth, also persisted all lifecycle status data (except errors). By @alessey #1249
  • fix: extracting SwapMessage to constants to avoid circular dependency. By @alessey #1255
  • feat: enhanced Framegear Home component with layout, loading state, and placeholder improvements. By @adarshswaminath #1241

Breaking Changes

Removed walletCapabilities from the OnchainKitConfig and improved the internal types by using the native Viem wallet capabilities type. This update ensures that wallet capabilities are now used solely as read info, avoiding accidental changes to wallet capabilities.

The <TransactionButton> will no longer have a preset margin, allowing you to customize your app's spacing. Please check your app to see if you need to add a 4px margin. We aim to provide more neutral spacing, giving you the flexibility to add margin as needed.

The LifeCycleStatus type is now renamed LifecycleStatus. This update aligns with React's lifecycle naming best practices, ensuring a smoother experience with your app. Please take note of this improvement.

v0.31.6

12 Sep 21:37
5d9d1fb
Compare
Choose a tag to compare

Patch Changes

  • 6147155: - feat: added custom max slippage support in the Swap component along with a new settings dropdown UI. By @cpcramer #1176 #1248
    • feat: added type LifecycleStatusDataShared to the LifeCycleStatus to hold shared lifeCycle state. By @Zizzamia #1234 #1240
    • feat: introduced config for the Swap component, with the first option for maxSlippage. By @Zizzamia & @cpcramer #1242
    • fix: added spacing between swap input and token select. By @alessey #1229

v0.31.5

10 Sep 20:37
379cd72
Compare
Choose a tag to compare

Patch Changes

v0.31.4

05 Sep 22:13
582cd72
Compare
Choose a tag to compare

Patch Changes

v0.31.3

03 Sep 20:22
e1ebadb
Compare
Choose a tag to compare

Patch Changes

  • a417d30: - feat: added buildPayTransaction utilities for making RPC calls to hydrate a charge and build a pay transaction in preparation for Pay button. By @avidreder #1177

v0.31.2

29 Aug 21:11
22f7b2d
Compare
Choose a tag to compare

Patch Changes

  • ef6e936: - feat: added connect wallet functionality to Swap component for disconnected users. By @abcrane123 #1173
    • fix: added logic to refetch balances and clear inputs after Swap succeeds. By @0xAlec #1089
    • fix: adjusted Swap component style to prevent UI shifting. By @abcrane123 #1184

v0.31.1

27 Aug 17:09
356cab8
Compare
Choose a tag to compare

Patch Changes

  • 003c9b6: - fix: improved hover state for WalletDropdown component. By @cpcramer #1156
    • feat: added onchainkit-version header to API requests. By @0xAlec #1169
    • feat: introduced getAddress and useAddress utilities to easily retrieve an address from ENS name or basename. By @Zizzamia #1170

v0.31.0

23 Aug 23:14
aae1726
Compare
Choose a tag to compare

Minor Changes

  • 4382d93: - fix: error message in Swap experience. By @Zizzamia & @0xAlec #1154 #1153 #1155

    Breaking Changes
    We streamlined the Swap experience to match the Transaction experience by eliminating the need for an address prop, making it work automatically.

    All APIs within OnchainKit are now consolidated under the @coinbase/onchainkit/api module. There's no change in functionality; simply import them from the api module.

v0.30.0

22 Aug 23:52
5a856fc
Compare
Choose a tag to compare

Minor Changes

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

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;
          };
        };

v0.29.5

21 Aug 23:41
ded8cf9
Compare
Choose a tag to compare

Patch Changes

  • feat: exported buildSwapTransaction, getSwapQuote and getTokens from API module. By @Zizzamia #1133 07c5af6
  • feat: added useSendCall and useSendCalls hooks to support call-type transactions in Transaction component. By @0xAlec #1130