Skip to content

@thirdweb-dev/sdk@4.0.61

Compare
Choose a tag to compare
@jnsdls jnsdls released this 10 Apr 15:51
· 6318 commits to main since this release
758cbdd

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