thirdweb@5.11.0
Minor Changes
-
#2679
560d8adThanks @ElasticBottle! - Add support for connecting in-app wallet using phone numberUsage in TypeScript
import { createThirdwebClient, createWallet } from "thirdweb"; import { preAuthenticate } from "thirdweb/wallets/in-app"; const client = createThirdwebClient({ clientId: "..." }); const phoneNumber = '+123456789'; // Send OTP to given phone number async function sendOTP() { await preAuthenticate({ strategy: "phone", phoneNumber, client, }); } async function connect() { // create a in-app wallet instance const wallet = createWallet('inApp'); // if the OTP is correct, the wallet will be connected else an error will be thrown const account = await wallet.connect({ client, strategy: "phone"; phoneNumber, verificationCode: '...' // Pass the OTP entered by the user }); console.log('connected to', account); }
Usage in React
import { createThirdwebClient } from "thirdweb"; import { preAuthenticate } from "thirdweb/wallets/in-app"; import { useConnect } from "thirdweb/react"; const client = createThirdwebClient({ clientId: "..." }); function Component() { const { connect } = useConnect(); const [phoneNumber, setPhoneNumber] = useState(''); // get phone number from user const [otp, setOtp] = useState(''); // get OTP from user // Send OTP to given phone number async function sendOTP() { await preAuthenticate({ strategy: "phone", phoneNumber, client, }); } async function connect() { // create a in-app wallet instance const wallet = createWallet('inApp'); // if the OTP is correct, the wallet will be connected else an error will be thrown await wallet.connect({ client, strategy: "phone"; phoneNumber, verificationCode: otp }); // set the wallet as active connect(wallet) } // render UI to get OTP and phone number from user return <div> ... </div> }
-
#2818
948f155Thanks @jnsdls! - Gasless transactions in Typescriptimport { sendTransaction } from "thirdweb"; const result = sendTransaction({ transaction, account, gasless: { provider: "engine", relayerUrl: "https://...", relayerForwarderAddress: "0x...", }, });
Gasless transactions in React
import { useSendTransaction } from "thirdweb/react"; const { mutate } = useSendTransaction({ gasless: { provider: "engine", relayerUrl: "https://...", relayerForwarderAddress: "0x...", }, }); // Call mutate with the transaction object mutate(transaction);
Patch Changes
-
#2842
d7e6671Thanks @joaquim-verges! - fix: handle signature minting with price and currency -
#2839
3be61ddThanks @MananTank! - Enable Buy Modal by default with useSendTransaction hook -
#2768
cfff7e8Thanks @MananTank! - Fix custom chain not being used