thirdweb 5.42.0 → 5.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adapters/ethers5.js +36 -27
- package/dist/cjs/adapters/ethers5.js.map +1 -1
- package/dist/cjs/cli/bin.js +13 -0
- package/dist/cjs/cli/bin.js.map +1 -1
- package/dist/cjs/exports/react.js +3 -1
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/extensions/marketplace/direct-listings/write/createListing.js +5 -1
- package/dist/cjs/extensions/marketplace/direct-listings/write/createListing.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWallet.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWallet.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWalletChain.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWalletChain.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWalletConnectionStatus.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useActiveWalletConnectionStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +4 -2
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useConnect.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useConnect.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useConnectedWallets.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useConnectedWallets.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useDisconnect.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useDisconnect.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useIsAutoConnecting.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useIsAutoConnecting.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSetActiveWallet.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSetActiveWallet.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSwitchActiveWalletChain.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSwitchActiveWalletChain.js.map +1 -1
- package/dist/cjs/react/core/providers/connection-manager.js +14 -2
- package/dist/cjs/react/core/providers/connection-manager.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/de.js +114 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/de.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +2 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +118 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -0
- package/dist/cjs/react/web/wallets/injected/locale/de.js +27 -0
- package/dist/cjs/react/web/wallets/injected/locale/de.js.map +1 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/de.js +55 -0
- package/dist/cjs/react/web/wallets/shared/locale/de.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/smartWallet/locale/de.js +13 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/de.js.map +1 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/walletConnect/locale.js +4 -0
- package/dist/cjs/react/web/wallets/walletConnect/locale.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +11 -5
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js +2 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js +3 -1
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +2 -2
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/adapters/ethers5.js +36 -27
- package/dist/esm/adapters/ethers5.js.map +1 -1
- package/dist/esm/cli/bin.js +13 -0
- package/dist/esm/cli/bin.js.map +1 -1
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/extensions/marketplace/direct-listings/write/createListing.js +5 -1
- package/dist/esm/extensions/marketplace/direct-listings/write/createListing.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useActiveAccount.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useActiveWallet.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useActiveWallet.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useActiveWalletChain.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useActiveWalletChain.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useActiveWalletConnectionStatus.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useActiveWalletConnectionStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +5 -3
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useConnect.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useConnect.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useConnectedWallets.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useConnectedWallets.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useDisconnect.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useDisconnect.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useIsAutoConnecting.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useIsAutoConnecting.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useSetActiveWallet.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useSetActiveWallet.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useSwitchActiveWalletChain.js +2 -2
- package/dist/esm/react/core/hooks/wallets/useSwitchActiveWalletChain.js.map +1 -1
- package/dist/esm/react/core/providers/connection-manager.js +13 -2
- package/dist/esm/react/core/providers/connection-manager.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/de.js +112 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/de.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +2 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +115 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -0
- package/dist/esm/react/web/wallets/injected/locale/de.js +25 -0
- package/dist/esm/react/web/wallets/injected/locale/de.js.map +1 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/de.js +53 -0
- package/dist/esm/react/web/wallets/shared/locale/de.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/smartWallet/locale/de.js +11 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/de.js.map +1 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/walletConnect/locale.js +4 -0
- package/dist/esm/react/web/wallets/walletConnect/locale.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +11 -5
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js +2 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js +4 -2
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +2 -2
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/types/adapters/ethers5.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/extensions/marketplace/direct-listings/write/createListing.d.ts +5 -1
- package/dist/types/extensions/marketplace/direct-listings/write/createListing.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useAutoConnect.d.ts.map +1 -1
- package/dist/types/react/core/providers/connection-manager.d.ts +21 -0
- package/dist/types/react/core/providers/connection-manager.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/de.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/de.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +2 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts +37 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts.map +1 -0
- package/dist/types/react/web/ui/types.d.ts +1 -1
- package/dist/types/react/web/ui/types.d.ts.map +1 -1
- package/dist/types/react/web/wallets/injected/locale/de.d.ts +7 -0
- package/dist/types/react/web/wallets/injected/locale/de.d.ts.map +1 -0
- package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/de.d.ts +54 -0
- package/dist/types/react/web/wallets/shared/locale/de.d.ts.map +1 -0
- package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/smartWallet/locale/de.d.ts +4 -0
- package/dist/types/react/web/wallets/smartWallet/locale/de.d.ts.map +1 -0
- package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/walletConnect/locale.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +3 -2
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/auth/middleware.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/ethers5.ts +48 -28
- package/src/cli/bin.ts +18 -0
- package/src/exports/react.ts +4 -0
- package/src/extensions/marketplace/direct-listings/write/createListing.ts +5 -1
- package/src/pay/buyWithCrypto/getStatus.ts +2 -1
- package/src/react/core/hooks/wallets/useActiveAccount.ts +2 -2
- package/src/react/core/hooks/wallets/useActiveWallet.ts +2 -2
- package/src/react/core/hooks/wallets/useActiveWalletChain.ts +2 -2
- package/src/react/core/hooks/wallets/useActiveWalletConnectionStatus.ts +2 -2
- package/src/react/core/hooks/wallets/useAutoConnect.ts +5 -3
- package/src/react/core/hooks/wallets/useConnect.ts +2 -2
- package/src/react/core/hooks/wallets/useConnectedWallets.ts +2 -2
- package/src/react/core/hooks/wallets/useDisconnect.ts +2 -2
- package/src/react/core/hooks/wallets/useIsAutoConnecting.ts +2 -2
- package/src/react/core/hooks/wallets/useSetActiveWallet.ts +2 -2
- package/src/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.ts +2 -2
- package/src/react/core/hooks/wallets/useSwitchActiveWalletChain.ts +2 -2
- package/src/react/core/providers/connection-manager.tsx +15 -2
- package/src/react/web/ui/ConnectWallet/locale/de.ts +117 -0
- package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
- package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +2 -0
- package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/CreateDirectListingButton.test.tsx +29 -0
- package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.tsx +165 -0
- package/src/react/web/ui/types.ts +7 -1
- package/src/react/web/wallets/injected/locale/de.ts +27 -0
- package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +2 -0
- package/src/react/web/wallets/shared/locale/de.ts +58 -0
- package/src/react/web/wallets/shared/locale/getConnectLocale.ts +2 -0
- package/src/react/web/wallets/smartWallet/locale/de.ts +13 -0
- package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +2 -0
- package/src/react/web/wallets/walletConnect/locale.ts +4 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/getLoginPath.ts +14 -5
- package/src/wallets/in-app/native/auth/native-auth.ts +2 -1
- package/src/wallets/in-app/native/helpers/auth/middleware.ts +7 -2
- package/src/wallets/in-app/native/native-connector.ts +2 -2
package/src/adapters/ethers5.ts
CHANGED
@@ -7,9 +7,9 @@ import type { Chain } from "../chains/types.js";
|
|
7
7
|
import { getRpcUrlForChain } from "../chains/utils.js";
|
8
8
|
import type { ThirdwebClient } from "../client/client.js";
|
9
9
|
import { type ThirdwebContract, getContract } from "../contract/contract.js";
|
10
|
-
import {
|
10
|
+
import { toSerializableTransaction } from "../transaction/actions/to-serializable-transaction.js";
|
11
11
|
import { waitForReceipt } from "../transaction/actions/wait-for-tx-receipt.js";
|
12
|
-
import {
|
12
|
+
import type { PreparedTransaction } from "../transaction/prepare-transaction.js";
|
13
13
|
import { toHex } from "../utils/encoding/hex.js";
|
14
14
|
import type { Account } from "../wallets/interfaces/wallet.js";
|
15
15
|
|
@@ -322,9 +322,17 @@ export async function toEthersSigner(
|
|
322
322
|
throw new Error("Account does not support signTransaction");
|
323
323
|
}
|
324
324
|
const awaitedTx = await ethers.utils.resolveProperties(transaction);
|
325
|
-
|
326
|
-
|
325
|
+
const alignedTx = await alignTxFromEthers(
|
326
|
+
client,
|
327
|
+
chain,
|
328
|
+
awaitedTx,
|
329
|
+
ethers,
|
327
330
|
);
|
331
|
+
const serialized = await toSerializableTransaction({
|
332
|
+
transaction: alignedTx,
|
333
|
+
from: account.address,
|
334
|
+
});
|
335
|
+
return account.signTransaction(serialized);
|
328
336
|
}
|
329
337
|
|
330
338
|
/**
|
@@ -340,33 +348,43 @@ export async function toEthersSigner(
|
|
340
348
|
throw new Error("Account does not support sendTransaction");
|
341
349
|
}
|
342
350
|
const awaitedTx = await ethers.utils.resolveProperties(transaction);
|
343
|
-
const alignedTx = await alignTxFromEthers(
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
});
|
353
|
-
const result = await sendTransaction({
|
354
|
-
transaction: tx,
|
355
|
-
account: account,
|
351
|
+
const alignedTx = await alignTxFromEthers(
|
352
|
+
client,
|
353
|
+
chain,
|
354
|
+
awaitedTx,
|
355
|
+
ethers,
|
356
|
+
);
|
357
|
+
const serialized = await toSerializableTransaction({
|
358
|
+
transaction: alignedTx,
|
359
|
+
from: account.address,
|
356
360
|
});
|
361
|
+
const result = await account.sendTransaction(serialized);
|
357
362
|
|
358
363
|
const response: ethers5.ethers.providers.TransactionResponse = {
|
359
|
-
|
364
|
+
...serialized,
|
365
|
+
nonce: serialized.nonce ?? 0,
|
360
366
|
from: account.address,
|
361
|
-
|
362
|
-
|
367
|
+
maxFeePerGas: serialized.maxFeePerGas
|
368
|
+
? ethers.BigNumber.from(serialized.maxFeePerGas)
|
369
|
+
: undefined,
|
370
|
+
maxPriorityFeePerGas: serialized.maxPriorityFeePerGas
|
371
|
+
? ethers.BigNumber.from(serialized.maxPriorityFeePerGas)
|
372
|
+
: undefined,
|
373
|
+
gasPrice: serialized.gasPrice
|
374
|
+
? ethers.BigNumber.from(serialized.gasPrice)
|
375
|
+
: undefined,
|
376
|
+
accessList: serialized.accessList as ethers5.ethers.utils.AccessList,
|
363
377
|
value: ethers.BigNumber.from(alignedTx.value ?? 0),
|
364
378
|
gasLimit: ethers.BigNumber.from(alignedTx.gas ?? 0),
|
365
379
|
// biome-ignore lint/style/noNonNullAssertion: TODO: fix later
|
366
380
|
hash: result.transactionHash!,
|
367
381
|
confirmations: 0,
|
368
382
|
wait: async () => {
|
369
|
-
const receipt = await waitForReceipt(
|
383
|
+
const receipt = await waitForReceipt({
|
384
|
+
transactionHash: result.transactionHash,
|
385
|
+
chain,
|
386
|
+
client,
|
387
|
+
});
|
370
388
|
return {
|
371
389
|
...receipt,
|
372
390
|
type:
|
@@ -491,9 +509,11 @@ function alignTxToEthers(
|
|
491
509
|
}
|
492
510
|
|
493
511
|
async function alignTxFromEthers(
|
512
|
+
client: ThirdwebClient,
|
513
|
+
chain: Chain,
|
494
514
|
tx: ethers5.ethers.providers.TransactionRequest,
|
495
515
|
ethers: Ethers5,
|
496
|
-
): Promise<
|
516
|
+
): Promise<PreparedTransaction> {
|
497
517
|
const {
|
498
518
|
type: ethersType,
|
499
519
|
accessList,
|
@@ -514,8 +534,8 @@ async function alignTxFromEthers(
|
|
514
534
|
throw new Error("ChainId is required for EIP-2930 transactions");
|
515
535
|
}
|
516
536
|
return {
|
517
|
-
|
518
|
-
|
537
|
+
client,
|
538
|
+
chain,
|
519
539
|
to,
|
520
540
|
data: (data ?? undefined) as Hex | undefined,
|
521
541
|
nonce: nonce ? ethers.BigNumber.from(nonce).toNumber() : undefined,
|
@@ -532,8 +552,8 @@ async function alignTxFromEthers(
|
|
532
552
|
throw new Error("ChainId is required for EIP-1559 transactions");
|
533
553
|
}
|
534
554
|
return {
|
535
|
-
|
536
|
-
|
555
|
+
client,
|
556
|
+
chain,
|
537
557
|
to,
|
538
558
|
data: (data ?? undefined) as Hex | undefined,
|
539
559
|
nonce: nonce ? ethers.BigNumber.from(nonce).toNumber() : undefined,
|
@@ -549,8 +569,8 @@ async function alignTxFromEthers(
|
|
549
569
|
}
|
550
570
|
default: {
|
551
571
|
return {
|
552
|
-
|
553
|
-
|
572
|
+
client,
|
573
|
+
chain,
|
554
574
|
to,
|
555
575
|
data: (data ?? undefined) as Hex | undefined,
|
556
576
|
nonce: nonce ? ethers.BigNumber.from(nonce).toNumber() : undefined,
|
package/src/cli/bin.ts
CHANGED
@@ -19,11 +19,29 @@ async function main() {
|
|
19
19
|
} else {
|
20
20
|
await generate(chainIdPlusContract);
|
21
21
|
}
|
22
|
+
break;
|
23
|
+
}
|
22
24
|
|
25
|
+
case "login": {
|
26
|
+
// Not implemented yet
|
27
|
+
console.info(
|
28
|
+
"Please instead pass a secret key to the command directly, learn more: https://support.thirdweb.com/troubleshooting-errors/7Y1BqKNvtLdBv5fZkRZZB3/issue-linking-device-on-the-authorization-page-via-thirdweb-cli/cn9LRA3ax7XCP6uxwRYdvx",
|
29
|
+
);
|
30
|
+
process.exit(1);
|
23
31
|
break;
|
24
32
|
}
|
25
33
|
|
26
34
|
default: {
|
35
|
+
// check several commands for missing -k flag
|
36
|
+
const commands = ["create", "deploy", "publish", "generate", "upload"];
|
37
|
+
if (commands.includes(command) && !rest.includes("-k")) {
|
38
|
+
console.info(
|
39
|
+
"Please include the -k flag with your secret key, learn more: https://support.thirdweb.com/troubleshooting-errors/7Y1BqKNvtLdBv5fZkRZZB3/issue-linking-device-on-the-authorization-page-via-thirdweb-cli/cn9LRA3ax7XCP6uxwRYdvx",
|
40
|
+
);
|
41
|
+
process.exit(1);
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
|
27
45
|
const isWindows = /^win/.test(process.platform);
|
28
46
|
|
29
47
|
const isBunAvailable = (() => {
|
package/src/exports/react.ts
CHANGED
@@ -165,5 +165,9 @@ export {
|
|
165
165
|
BuyDirectListingButton,
|
166
166
|
type BuyDirectListingButtonProps,
|
167
167
|
} from "../react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js";
|
168
|
+
export {
|
169
|
+
CreateDirectListingButton,
|
170
|
+
type CreateDirectListingButtonProps,
|
171
|
+
} from "../react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js";
|
168
172
|
|
169
173
|
export { useConnectionManager } from "../react/core/providers/connection-manager.js";
|
@@ -76,7 +76,11 @@ export type CreateListingParams = {
|
|
76
76
|
* import { createListing } from "thirdweb/extensions/marketplace";
|
77
77
|
* import { sendTransaction } from "thirdweb";
|
78
78
|
*
|
79
|
-
* const transaction = createListing({
|
79
|
+
* const transaction = createListing({
|
80
|
+
* assetContractAddress: "0x...", // the NFT contract address that you want to sell
|
81
|
+
* tokenId={0n}, // the token id you want to sell
|
82
|
+
* pricePerToken="0.1" // sell for 0.1 <native token>
|
83
|
+
* });
|
80
84
|
*
|
81
85
|
* await sendTransaction({ transaction, account });
|
82
86
|
* ```
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook that returns the active account
|
@@ -13,7 +13,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
13
13
|
* @walletConnection
|
14
14
|
*/
|
15
15
|
export function useActiveAccount() {
|
16
|
-
const manager =
|
16
|
+
const manager = useConnectionManagerCtx("useActiveAccount");
|
17
17
|
const store = manager.activeAccountStore;
|
18
18
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
19
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook that returns the active wallet
|
@@ -13,7 +13,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
13
13
|
* @walletConnection
|
14
14
|
*/
|
15
15
|
export function useActiveWallet() {
|
16
|
-
const manager =
|
16
|
+
const manager = useConnectionManagerCtx("useActiveWallet");
|
17
17
|
const store = manager.activeWalletStore;
|
18
18
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
19
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook that returns the chain the active wallet is connected to
|
@@ -13,7 +13,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
13
13
|
* @walletConnection
|
14
14
|
*/
|
15
15
|
export function useActiveWalletChain() {
|
16
|
-
const manager =
|
16
|
+
const manager = useConnectionManagerCtx("useActiveWalletChain");
|
17
17
|
const store = manager.activeWalletChainStore;
|
18
18
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
19
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook that returns the active account's connection status.
|
@@ -17,7 +17,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
17
17
|
* @walletConnection
|
18
18
|
*/
|
19
19
|
export function useActiveWalletConnectionStatus() {
|
20
|
-
const manager =
|
20
|
+
const manager = useConnectionManagerCtx("useActiveWalletConnectionStatus");
|
21
21
|
const store = manager.activeWalletConnectionStatusStore;
|
22
22
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
23
23
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
2
2
|
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
3
|
+
import { createWallet } from "../../../../wallets/create-wallet.js";
|
3
4
|
import { getUrlToken } from "../../../../wallets/in-app/web/lib/get-url-token.js";
|
4
5
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
5
6
|
import {
|
@@ -7,7 +8,7 @@ import {
|
|
7
8
|
getStoredActiveWalletId,
|
8
9
|
getStoredConnectedWalletIds,
|
9
10
|
} from "../../../../wallets/manager/index.js";
|
10
|
-
import {
|
11
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
11
12
|
import { setLastAuthProvider } from "../../utils/storage.js";
|
12
13
|
import { timeoutPromise } from "../../utils/timeoutPromise.js";
|
13
14
|
import type { AutoConnectProps } from "../connection/types.js";
|
@@ -19,7 +20,7 @@ export function useAutoConnectCore(
|
|
19
20
|
props: AutoConnectProps & { wallets: Wallet[] },
|
20
21
|
getInstalledWallets?: () => Wallet[],
|
21
22
|
) {
|
22
|
-
const manager =
|
23
|
+
const manager = useConnectionManagerCtx("useAutoConnect");
|
23
24
|
const setConnectionStatus = useSetActiveWalletConnectionStatus();
|
24
25
|
const { connect } = useConnect({
|
25
26
|
client: props.client,
|
@@ -68,7 +69,8 @@ export function useAutoConnectCore(
|
|
68
69
|
const availableWallets = [...wallets, ...(getInstalledWallets?.() ?? [])];
|
69
70
|
const activeWallet =
|
70
71
|
lastActiveWalletId &&
|
71
|
-
availableWallets.find((w) => w.id === lastActiveWalletId)
|
72
|
+
(availableWallets.find((w) => w.id === lastActiveWalletId) ||
|
73
|
+
createWallet(lastActiveWalletId));
|
72
74
|
|
73
75
|
if (activeWallet) {
|
74
76
|
try {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useCallback, useState } from "react";
|
2
2
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
3
3
|
import type { ConnectManagerOptions } from "../../../../wallets/manager/index.js";
|
4
|
-
import {
|
4
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
5
5
|
|
6
6
|
/**
|
7
7
|
* A hook to set a wallet as active wallet
|
@@ -34,7 +34,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
34
34
|
* @walletConnection
|
35
35
|
*/
|
36
36
|
export function useConnect(options?: ConnectManagerOptions) {
|
37
|
-
const manager =
|
37
|
+
const manager = useConnectionManagerCtx("useConnect");
|
38
38
|
const { connect } = manager;
|
39
39
|
const [isConnecting, setIsConnecting] = useState(false);
|
40
40
|
const [error, setError] = useState<Error | null>(null);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook that returns all connected wallets
|
@@ -13,7 +13,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
13
13
|
* @walletConnection
|
14
14
|
*/
|
15
15
|
export function useConnectedWallets() {
|
16
|
-
const manager =
|
16
|
+
const manager = useConnectionManagerCtx("useConnectedWallets");
|
17
17
|
const store = manager.connectedWallets;
|
18
18
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
19
19
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Disconnect from given account
|
@@ -21,7 +21,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
21
21
|
* @returns An object with a function to disconnect an account
|
22
22
|
*/
|
23
23
|
export function useDisconnect() {
|
24
|
-
const manager =
|
24
|
+
const manager = useConnectionManagerCtx("useDisconnect");
|
25
25
|
const disconnect = manager.disconnectWallet;
|
26
26
|
return { disconnect };
|
27
27
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
2
|
-
import {
|
2
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A hook to check if the auto connect is in progress.
|
@@ -15,7 +15,7 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
15
15
|
* @walletConnection
|
16
16
|
*/
|
17
17
|
export function useIsAutoConnecting() {
|
18
|
-
const manager =
|
18
|
+
const manager = useConnectionManagerCtx("useIsAutoConnecting");
|
19
19
|
const store = manager.isAutoConnecting;
|
20
20
|
return useSyncExternalStore(store.subscribe, store.getValue, store.getValue);
|
21
21
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* A hook that lets you set the active wallet.
|
@@ -15,6 +15,6 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
15
15
|
* @walletConnection
|
16
16
|
*/
|
17
17
|
export function useSetActiveWallet() {
|
18
|
-
const manager =
|
18
|
+
const manager = useConnectionManagerCtx("useSetActiveWallet");
|
19
19
|
return manager.setActiveWallet;
|
20
20
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* A hook that returns the active wallet's connection status.
|
@@ -15,6 +15,6 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
15
15
|
* @internal
|
16
16
|
*/
|
17
17
|
export function useSetActiveWalletConnectionStatus() {
|
18
|
-
const manager =
|
18
|
+
const manager = useConnectionManagerCtx("useSetActiveWalletConnectionStatus");
|
19
19
|
return manager.activeWalletConnectionStatusStore.setValue;
|
20
20
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Switch to blockchain with given chain id in the active wallet.
|
@@ -16,6 +16,6 @@ import { useConnectionManager } from "../../providers/connection-manager.js";
|
|
16
16
|
* @walletConnection
|
17
17
|
*/
|
18
18
|
export function useSwitchActiveWalletChain() {
|
19
|
-
const manager =
|
19
|
+
const manager = useConnectionManagerCtx("useSwitchActiveWalletChain");
|
20
20
|
return manager.switchActiveWalletChain;
|
21
21
|
}
|
@@ -6,11 +6,24 @@ export const ConnectionManagerCtx = createContext<
|
|
6
6
|
>(undefined);
|
7
7
|
|
8
8
|
export function useConnectionManager() {
|
9
|
-
const connectionManager =
|
9
|
+
const connectionManager = useConnectionManagerCtx("useConnectionManager");
|
10
10
|
if (!connectionManager) {
|
11
11
|
throw new Error(
|
12
|
-
"useConnectionManager must be used within a
|
12
|
+
"useConnectionManager must be used within a <ThirdwebProvider> Provider",
|
13
13
|
);
|
14
14
|
}
|
15
15
|
return connectionManager;
|
16
16
|
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Use this instead of `useConnectionManager` to throw a more specific error message when used outside of a provider.
|
20
|
+
* @internal
|
21
|
+
*/
|
22
|
+
export function useConnectionManagerCtx(hookname: string) {
|
23
|
+
const manager = useContext(ConnectionManagerCtx);
|
24
|
+
if (!manager) {
|
25
|
+
throw new Error(`${hookname} must be used within <ThirdwebProvider>`);
|
26
|
+
}
|
27
|
+
|
28
|
+
return manager;
|
29
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import type { ConnectLocale } from "./types.js";
|
2
|
+
|
3
|
+
const connectLocaleDe: ConnectLocale = {
|
4
|
+
id: "de_DE",
|
5
|
+
signIn: "Anmelden",
|
6
|
+
defaultButtonTitle: "Wallet verbinden",
|
7
|
+
connecting: "Anmelden",
|
8
|
+
switchNetwork: "Netzwerk wechseln",
|
9
|
+
switchingNetwork: "Netzwerk wechseln",
|
10
|
+
defaultModalTitle: "Anmelden",
|
11
|
+
recommended: "Empfohlen",
|
12
|
+
installed: "Installiert",
|
13
|
+
buy: "Kaufen",
|
14
|
+
continueAsGuest: "Als Gast fortfahren",
|
15
|
+
connectAWallet: "Wallet verbinden",
|
16
|
+
newToWallets: `Was ist ein "Wallet"?`,
|
17
|
+
getStarted: "Loslegen",
|
18
|
+
guest: "Gast",
|
19
|
+
send: "Senden",
|
20
|
+
receive: "Empfangen",
|
21
|
+
currentNetwork: "Aktuelles Netzwerk",
|
22
|
+
switchAccount: "Account wechseln",
|
23
|
+
requestTestnetFunds: "Testnetz-Geld anfordern",
|
24
|
+
transactions: "Transaktionen",
|
25
|
+
payTransactions: "Fiat Transaktionen",
|
26
|
+
walletTransactions: "Wallet Transaktionen",
|
27
|
+
viewAllTransactions: "Alle Transaktionen anzeigen",
|
28
|
+
backupWallet: "Wallet sichern",
|
29
|
+
guestWalletWarning:
|
30
|
+
"Dies ist ein temporäres Gast-Wallet. Sichere das Wallet, wenn du den Zugriff darauf nicht verlieren möchtest",
|
31
|
+
switchTo: "Wechsle zu", // Used in "Switch to <Wallet-Name>"
|
32
|
+
connectedToSmartWallet: "Smart Account",
|
33
|
+
confirmInWallet: "Im Wallet bestätigen",
|
34
|
+
disconnectWallet: "Wallet trennen",
|
35
|
+
copyAddress: "Adresse kopieren",
|
36
|
+
personalWallet: "Persönliches Wallet",
|
37
|
+
smartWallet: "Smart Wallet",
|
38
|
+
or: "Oder",
|
39
|
+
goBackButton: "Zurück",
|
40
|
+
welcomeScreen: {
|
41
|
+
defaultTitle: "Dein Tor zur dezentralen Welt",
|
42
|
+
defaultSubtitle: "Verbinde ein Wallet, um loszulegen",
|
43
|
+
},
|
44
|
+
agreement: {
|
45
|
+
prefix: "Durch die Verbindung stimmst du diesen zu:",
|
46
|
+
termsOfService: "Nutzungsbedingungen",
|
47
|
+
and: "&",
|
48
|
+
privacyPolicy: "Datenschutzrichtlinien",
|
49
|
+
},
|
50
|
+
networkSelector: {
|
51
|
+
title: "Netzwerk auswählen",
|
52
|
+
mainnets: "Mainnets",
|
53
|
+
testnets: "Testnets",
|
54
|
+
allNetworks: "Alle",
|
55
|
+
addCustomNetwork: "Eigenes Netzwerk hinzufügen",
|
56
|
+
inputPlaceholder: "Netzwerk oder Chain ID suchen",
|
57
|
+
categoryLabel: {
|
58
|
+
recentlyUsed: "Zuletzt verwendet",
|
59
|
+
popular: "Beliebt",
|
60
|
+
others: "Alle Netzwerke",
|
61
|
+
},
|
62
|
+
loading: "Laden",
|
63
|
+
failedToSwitch: "Netzwerkwechsel fehlgeschlagen",
|
64
|
+
},
|
65
|
+
receiveFundsScreen: {
|
66
|
+
title: "Geld empfangen",
|
67
|
+
instruction:
|
68
|
+
"Kopiere die Wallet-Adresse, um Geld an dieses Wallet zu senden",
|
69
|
+
},
|
70
|
+
sendFundsScreen: {
|
71
|
+
title: "Geld senden",
|
72
|
+
submitButton: "Senden",
|
73
|
+
token: "Token",
|
74
|
+
sendTo: "Senden an",
|
75
|
+
amount: "Betrag",
|
76
|
+
successMessage: "Transaktion erfolgreich",
|
77
|
+
invalidAddress: "Ungültige Adresse",
|
78
|
+
noTokensFound: "Keine Token gefunden",
|
79
|
+
searchToken: "Token suchen oder einfügen",
|
80
|
+
transactionFailed: "Transaktion fehlgeschlagen",
|
81
|
+
transactionRejected: "Transaktion abgelehnt",
|
82
|
+
insufficientFunds: "Nicht genügend Guthaben",
|
83
|
+
selectTokenTitle: "Token auswählen",
|
84
|
+
sending: "Sende",
|
85
|
+
},
|
86
|
+
signatureScreen: {
|
87
|
+
instructionScreen: {
|
88
|
+
title: "Anmelden",
|
89
|
+
instruction: "Signiere die Anmeldeanfrage in deinem Wallet",
|
90
|
+
signInButton: "Anmelden",
|
91
|
+
disconnectWallet: "Wallet trennen",
|
92
|
+
},
|
93
|
+
signingScreen: {
|
94
|
+
title: "Signaturanfrage",
|
95
|
+
prompt: "Signiere die Signaturanfrage in deinem Wallet",
|
96
|
+
promptForSafe:
|
97
|
+
"Signiere die Signaturanfrage in deinem Wallet, um fortzufahren",
|
98
|
+
approveTransactionInSafe: "Transaktion im Safe bestätigen",
|
99
|
+
tryAgain: "Erneut versuchen",
|
100
|
+
failedToSignIn: "Anmeldung fehlgeschlagen",
|
101
|
+
inProgress: "Warte auf Bestätigung",
|
102
|
+
},
|
103
|
+
},
|
104
|
+
manageWallet: {
|
105
|
+
title: "Wallet verwalten",
|
106
|
+
connectAnApp: "App verbinden",
|
107
|
+
exportPrivateKey: "PrivateKey exportieren",
|
108
|
+
},
|
109
|
+
viewFunds: {
|
110
|
+
title: "Guthaben anzeigen",
|
111
|
+
viewNFTs: "NFTs anzeigen",
|
112
|
+
viewTokens: "Tokens anzeigen",
|
113
|
+
viewAssets: "Assets anzeigen",
|
114
|
+
},
|
115
|
+
};
|
116
|
+
|
117
|
+
export default connectLocaleDe;
|
@@ -15,6 +15,9 @@ export async function getConnectLocale(localeId: LocaleId) {
|
|
15
15
|
case "vi_VN": {
|
16
16
|
return (await import("./vi.js")).default;
|
17
17
|
}
|
18
|
+
case "de_DE": {
|
19
|
+
return (await import("./de.js")).default;
|
20
|
+
}
|
18
21
|
default: {
|
19
22
|
return (await import("./en.js")).default;
|
20
23
|
}
|
@@ -151,6 +151,8 @@ export function ClaimButton(props: ClaimButtonProps) {
|
|
151
151
|
}
|
152
152
|
|
153
153
|
/**
|
154
|
+
* We can only get the image and name for Edition Drop
|
155
|
+
* For NFT Drop and Token Drop we fall back to the name & image of the contract
|
154
156
|
* @internal
|
155
157
|
*/
|
156
158
|
export async function getPayMetadata(
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
2
|
+
import { render, screen } from "~test/react-render.js";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import { sepolia } from "../../../../../../chains/chain-definitions/sepolia.js";
|
5
|
+
import { CreateDirectListingButton } from "./index.js";
|
6
|
+
|
7
|
+
const client = TEST_CLIENT;
|
8
|
+
|
9
|
+
// marketplace v3 on sepolia
|
10
|
+
const marketplaceAddress = "0xe0eFD6fb388405b67b3E9FaFc02649c70E749f03";
|
11
|
+
|
12
|
+
describe.runIf(process.env.TW_SECRET_KEY)("BuyDirectListingButton", () => {
|
13
|
+
it("should render", () => {
|
14
|
+
render(
|
15
|
+
<CreateDirectListingButton
|
16
|
+
client={client}
|
17
|
+
chain={sepolia}
|
18
|
+
contractAddress={marketplaceAddress}
|
19
|
+
assetContractAddress="0x3cf279b3248E164F3e5C341826B878d350EC6AB1"
|
20
|
+
tokenId={0n}
|
21
|
+
pricePerToken="0.1"
|
22
|
+
>
|
23
|
+
Sell NFT
|
24
|
+
</CreateDirectListingButton>,
|
25
|
+
);
|
26
|
+
expect(screen.queryByText("Sell NFT")).toBeInTheDocument();
|
27
|
+
expect(screen.getByRole("button")).toBeInTheDocument();
|
28
|
+
});
|
29
|
+
});
|