Skip to content

Releases: thirdweb-dev/js

@thirdweb-dev/chains@0.1.93

11 Apr 20:59
5781dac
Compare
Choose a tag to compare

Patch Changes

@thirdweb-dev/auth@4.1.60

11 Apr 20:59
5781dac
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [cb2a7e9]:
    • @thirdweb-dev/wallets@2.5.2

thirdweb@5.4.2

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Patch Changes

@thirdweb-dev/wallets@2.5.1

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [d836889, d65713a]:
    • @thirdweb-dev/sdk@4.0.61
    • @thirdweb-dev/chains@0.1.92

@thirdweb-dev/unity-js-bridge@0.6.10

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [d836889, d65713a]:
    • @thirdweb-dev/sdk@4.0.61
    • @thirdweb-dev/chains@0.1.92
    • @thirdweb-dev/wallets@2.5.1
    • @thirdweb-dev/auth@4.1.59

@thirdweb-dev/sdk@4.0.61

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Patch Changes

  • #2579 d836889 Thanks @ElasticBottle! - Adds "buy with crypto" APIs, Here's an example of how you can use it for swapping tokens

    // 1. get a quote for swapping tokens
    const quote = await getBuyWithCryptoQuote(quoteParams);
    
    // 2. if approval is required, send the approval transaction
    if (quote.approval) {
      const approvalTx = await signer.sendTransaction(quote.approval);
      await approvalTx.wait();
    }
    
    // 3. send the quoted transaction
    const buyTx = await signer.sendTransaction(quote.transactionRequest);
    await buyTx.wait();
    
    // 4. keep polling the status of the quoted transaction until it * returns a success or failure status
    const status = await getBuyWithCryptoStatus({
      clientId: "YOUR_CLIENT_ID",
      transactionHash: transactionResult.hash,
    });

    For more information, check out the pay documentation for purchases with crypto

  • Updated dependencies [d836889, d65713a]:

    • thirdweb@5.4.2
    • @thirdweb-dev/chains@0.1.92

@thirdweb-dev/react@4.6.0

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Minor Changes

  • #2579 d836889 Thanks @ElasticBottle! - Adds Buy button in ConnectWallet component's details Modal to allow users to Swap tokens. Setting clientId on ThirdWebProvider is required to enable this feature.

    A new prop hideBuyButton is added to ConnectWallet component to hide the Buy button in the details Modal. By default, the Buy button is visible.

Patch Changes

  • Updated dependencies [d836889, d836889, d65713a]:
    • @thirdweb-dev/react-core@4.6.0
    • @thirdweb-dev/sdk@4.0.61
    • @thirdweb-dev/chains@0.1.92
    • @thirdweb-dev/wallets@2.5.1

@thirdweb-dev/react-native@0.7.32

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [d836889, d836889, d65713a]:
    • @thirdweb-dev/react-core@4.6.0
    • @thirdweb-dev/sdk@4.0.61
    • @thirdweb-dev/chains@0.1.92
    • @thirdweb-dev/wallets@2.5.1

@thirdweb-dev/react-native-compat@0.7.32

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare
@thirdweb-dev/react-native-compat@0.7.32

@thirdweb-dev/react-core@4.6.0

10 Apr 15:51
758cbdd
Compare
Choose a tag to compare

Minor Changes

  • #2579 d836889 Thanks @ElasticBottle! - Adds "buy with crypto" Hooks, Here's an example of how you can use it to build a UI for Swapping tokens

    function Component() {
      const signer = useSigner();
      // 1. get a quote for swapping tokens
      const quoteQuery = useBuyWithCryptoQuote(swapParams);
    
      const [buyTxHash, setBuyTxHash] = useState<string | undefined>();
      const statusQuery = useBuyWithCryptoStatus(
        buyTxHash
          ? {
              clientId: "YOUR_CLIENT_ID",
              transactionHash: buyTxHash,
            }
          : undefined,
      );
    
      async function handleBuyWithCrypto() {
        if (!quoteQuery.data || !signer) {
          return;
        }
    
        // 2. if approval is required
        if (quoteQuery.data.approval) {
          const approveTx = await signer.sendTransaction(
            quoteQuery.data.approval,
          );
          await approveTx.wait();
        }
    
        // 3. send the transaction to buy crypto
        const buyTx = await signer.sendTransaction(
          quoteQuery.data.transactionRequest,
        );
        await buyTx.wait();
    
        // set buyTx.transactionHash to poll the status of the swap transaction
        setBuyTxHash(buyTx.hash);
      }
    
      // 4. wait for the status of the transaction
      if (statusQuery.data) {
        console.log("swap status:", statusQuery.data);
      }
    
      return <button onClick={handleBuyWithCrypto}>Swap</button>;
    }

    For more information, check out the pay documentation for purchases with crypto

Patch Changes

  • Updated dependencies [d836889, d65713a]:
    • @thirdweb-dev/sdk@4.0.61
    • @thirdweb-dev/chains@0.1.92
    • @thirdweb-dev/wallets@2.5.1
    • @thirdweb-dev/auth@4.1.59