Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
7d18c3edea Version Packages (#2132)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-09 20:35:38 -08:00
iketwandGitHub 7d07490ed3 [RN] Adds hideDisconnect prop to ConnectWallet comp (#2137) 2024-01-09 23:40:28 +00:00
22571ba0a9 [Wallets] Better userOp estimations (#2098)
Co-authored-by: Aleš Ferlan <[email protected]>
2024-01-09 21:48:22 +00:00
0ff90b8fba feat: add hideDisconnect prop to ConnectWallet (#2122)
Co-authored-by: Manan Tank <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2024-01-08 20:29:55 -08:00
Adam MajmudarandGitHub e66e906650 Add support for signTypedData to AwsKmsWallet (#2125) 2024-01-09 03:56:26 +00:00
Isaac DubuqueandGitHub b3cf65b9db Payments: Minor bug fix package.json import (#2133) 2024-01-09 01:02:10 +00:00
iketwandGitHub f953c72c4e [RN] Fixes custom balance token display in ConnectWallet details button (#2131) 2024-01-08 20:49:58 +00:00
github-actions[bot]andGitHub bbc2e092b8 Version Packages (#2120) 2024-01-06 07:18:21 +13:00
iketwandGitHub 4c3c840d88 [RN] Export WC modal component (#2092) 2024-01-05 16:27:27 +00:00
Manan TankandGitHub cf606665fc Update Docs links (#2119) 2024-01-05 16:07:39 +00:00
113 changed files with 1092 additions and 701 deletions
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/auth
## 4.1.22
### Patch Changes
- Updated dependencies [[`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/wallets@2.4.0
## 4.1.21
### Patch Changes
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/wallets@2.3.4
## 4.1.20
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.20",
"version": "4.1.22",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+17
View File
@@ -1,5 +1,22 @@
# thirdweb
## 0.13.30
### Patch Changes
- Updated dependencies [[`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/wallets@2.4.0
- @thirdweb-dev/auth@4.1.22
## 0.13.29
### Patch Changes
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/wallets@2.3.4
- @thirdweb-dev/sdk@4.0.25
- @thirdweb-dev/auth@4.1.21
## 0.13.28
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.13.28",
"version": "0.13.30",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+2 -2
View File
@@ -1,5 +1,5 @@
{
"extends": "@thirdweb-dev/tsconfig/sdk.json",
"include": ["src", "types"],
"exclude": ["dist", "build", "node_modules"]
"include": ["src", "types", "test"],
"exclude": ["dist", "build", "node_modules", "**/*.test.ts"]
}
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/payments
## 1.0.2
### Patch Changes
- [#2133](https://github.com/thirdweb-dev/js/pull/2133) [`b3cf65b9`](https://github.com/thirdweb-dev/js/commit/b3cf65b9dbdab22a452d2c597d21a14300b2d174) Thanks [@IDubuque](https://github.com/IDubuque)! - Minor bug fix importing package.json
## 1.0.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/payments",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/thirdweb-dev-payments.cjs.js",
"module": "dist/thirdweb-dev-payments.esm.js",
"types": "dist/thirdweb-dev-payments.cjs.d.ts",
@@ -1,6 +1,5 @@
// CHANGED: packageJson import + version string
// eslint-disable-next-line @typescript-eslint/no-var-requires, better-tree-shaking/no-top-level-side-effects
const packageJson = require("../package.json");
import packageJson from "../../package.json";
export interface PaperPaymentElementConstructorArgs {
onLoad?: (event?: Event) => void;
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/react-core
## 4.2.3
### Patch Changes
- Updated dependencies [[`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/wallets@2.4.0
- @thirdweb-dev/auth@4.1.22
## 4.2.2
### Patch Changes
- [#2119](https://github.com/thirdweb-dev/js/pull/2119) [`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc) Thanks [@MananTank](https://github.com/MananTank)! - Update Links to Docs website
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/wallets@2.3.4
- @thirdweb-dev/sdk@4.0.25
- @thirdweb-dev/auth@4.1.21
## 4.2.1
## 4.2.0
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.2.1",
"version": "4.2.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -204,7 +204,7 @@ export function useWallets() {
* #### walletConfig
* The wallet to connect. Must be of type `WalletConfig`.
*
* [Learn more about the available wallet options](https://portal.thirdweb.com/react/connecting-wallets).
* [Learn more about the available wallet options](https://portal.thirdweb.com/react/v4/connecting-wallets).
*
* #### connectOptions
* The typeof `connectOptions` object depends on the wallet you are connecting. For some wallets, it may be optional
@@ -288,7 +288,7 @@ export function useConnectionStatus() {
/**
* Hook for setting the `connectionStatus` of the wallet which is returned by the `useConnectionStatus` hook
*
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet/build-a-wallet)
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet-sdk/v2/build)
*
* @example
*
@@ -418,7 +418,7 @@ export function useSwitchChain() {
/**
* Hook for setting a wallet instance as "connected" - once done, the wallet connection hooks like `useWallet`, `useAddress`, `useSigner`, `useConnectionStatus` etc will return the data for that wallet instance
*
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet/build-a-wallet)
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet-sdk/v2/build)
*
* @example
*
@@ -13,7 +13,7 @@ export interface ISecureStorage {
}
/**
* The configuration to use by the React and React Native SDKs with an [auth](https://portal.thirdweb.com/auth) server.
* The configuration to use by the React and React Native SDKs with an [auth](https://portal.thirdweb.com/wallets/auth) server.
* @auth
*/
export interface ThirdwebAuthConfig {
@@ -172,7 +172,7 @@ export function useActiveClaimCondition(
}
/**
* Hook to get the claimer proofs for an address for [ERC20](https://portal.thirdweb.com/solidity/base-contracts/erc20drop), [ERC721](https://portal.thirdweb.com/solidity/base-contracts/erc721drop), and [ERC1155](https://portal.thirdweb.com/solidity/base-contracts/erc1155drop) drop contracts.
* Hook to get the claimer proofs for an address for [ERC20](https://portal.thirdweb.com/contracts/build/base-contracts/erc-20/drop), [ERC721](https://portal.thirdweb.com/contracts/build/base-contracts/erc-721/drop), and [ERC1155](https://portal.thirdweb.com/contracts/build/base-contracts/erc-1155/drop) drop contracts.
*
* A claimer proof is a set of data about a claimer's claim condition, including the claimer's address, the claimer's proof, and the claimer's max claimable amount, price, and currency address.
*
@@ -875,9 +875,9 @@ export function useSetClaimConditions(
* Hook for resetting the claim conditions on a drop contract.
*
* Available to use on contracts that implement
* [`ERC721ClaimableWithConditions`](https://portal.thirdweb.com/solidity/extensions/erc721claimconditions),
* [`ERC1155ClaimableWithConditions`](https://portal.thirdweb.com/solidity/extensions/erc1155claimconditions) or
* [`ERC20ClaimableWithConditions`](https://portal.thirdweb.com/solidity/extensions/erc20claimconditions).
* [`ERC721ClaimableWithConditions`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721ClaimConditions),
* [`ERC1155ClaimableWithConditions`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155ClaimConditions) or
* [`ERC20ClaimableWithConditions`](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20ClaimConditions).
*
* @example
* ```jsx
@@ -27,7 +27,7 @@ import invariant from "tiny-invariant";
/**
* Hook for getting the primary sales recipient of a smart contract.
*
* Available to use on contracts that implement the [`PrimarySale`](https://portal.thirdweb.com/solidity/extensions/primarysale) interface.
* Available to use on contracts that implement the [`PrimarySale`](https://portal.thirdweb.com/contracts/build/extensions/general/PrimarySale) interface.
*
* @example
* ```jsx
@@ -67,7 +67,7 @@ export function usePrimarySaleRecipient(
/**
* Hook for updating the primary sale recipient on a smart contract.
*
* Available to use on smart contracts that implement the [`PrimarySale`](https://portal.thirdweb.com/solidity/extensions/primarysale) interface.
* Available to use on smart contracts that implement the [`PrimarySale`](https://portal.thirdweb.com/contracts/build/extensions/general/PrimarySale) interface.
*
* The wallet that initiates this transaction must have the required permissions to change the primary sale recipient (defaults to `"admin"` level).
*
@@ -156,7 +156,7 @@ export function useUpdatePrimarySaleRecipient(
/**
* Hook for retrieving royalty settings of a smart contract.
*
* Available to use on contracts that implement the [`Royalty`](https://portal.thirdweb.com/solidity/extensions/royalty) interface.
* Available to use on contracts that implement the [`Royalty`](https://portal.thirdweb.com/contracts/build/extensions/general/Royalty) interface.
*
* @example
* ```jsx
@@ -214,7 +214,7 @@ export function useRoyaltySettings(
/**
* Hook for updating royalty settings on a smart contract.
*
* Available to use on smart contracts that implement the [`Royalty`](https://portal.thirdweb.com/solidity/extensions/royalty) interface.
* Available to use on smart contracts that implement the [`Royalty`](https://portal.thirdweb.com/contracts/build/extensions/general/Royalty) interface.
*
* @example
* ```jsx
@@ -310,7 +310,7 @@ export function useUpdateRoyaltySettings(
/**
* Hook for getting the platform fee settings of a contract.
*
* Available to use on contracts that implement the [`PlatformFee`](https://portal.thirdweb.com/solidity/extensions/platformfee) interface.
* Available to use on contracts that implement the [`PlatformFee`](https://portal.thirdweb.com/contracts/build/extensions/general/PlatformFee) interface.
*
* @example
*
@@ -370,7 +370,7 @@ export function usePlatformFees(
/**
* Hook for updating platform fees on a smart contract.
*
* Available to use on smart contracts that implement the [`PlatformFee`](https://portal.thirdweb.com/solidity/extensions/platformfee) interface.
* Available to use on smart contracts that implement the [`PlatformFee`](https://portal.thirdweb.com/contracts/build/extensions/general/PlatformFee) interface.
*
* ```jsx
* import {
@@ -466,7 +466,7 @@ export function useUpdatePlatformFees(
/**
* Hook for getting the metadata associated with a smart contract.
*
* Available to use on contracts that implement the [Contract Metadata](https://portal.thirdweb.com/solidity/extensions/contractmetadata) interface.
* Available to use on contracts that implement the [Contract Metadata](https://portal.thirdweb.com/contracts/build/extensions/general/ContractMetadata) interface.
*
* @example
* ```jsx
@@ -107,7 +107,7 @@ export function useUnclaimedNFTs(
/**
* Hook for fetching all claimed NFTs from a given NFT Drop contract.
*
* Available to use on contracts that implement [`ERC721Claimable`](https://portal.thirdweb.com/solidity/extensions/erc721claimable),
* Available to use on contracts that implement [`ERC721Claimable`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Claimable),
* such as the [NFT Drop](https://thirdweb.com/thirdweb.eth/DropERC721).
*
* @example
@@ -174,7 +174,7 @@ export function useClaimedNFTs(
*
* Unclaimed NFTs are tokens that were lazy-minted but have not yet been claimed by a user.
*
* Available to use on contracts that implement the [`LazyMint`](https://portal.thirdweb.com/solidity/extensions/lazymint) extension;
* Available to use on contracts that implement the [`LazyMint`](https://portal.thirdweb.com/contracts/build/extensions/general/LazyMint) extension;
* such as the [NFT Drop](https://thirdweb.com/thirdweb.eth/DropERC721) contract.
*
* @example
@@ -220,7 +220,7 @@ export function useUnclaimedNFTSupply(
/**
* Hook for retrieving the total supply of NFTs claimed from an NFT Drop contract.
*
* Available to use on contracts that implement [`ERC721Claimable`](https://portal.thirdweb.com/solidity/extensions/erc721claimable).
* Available to use on contracts that implement [`ERC721Claimable`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Claimable).
*
* @example
*
@@ -262,8 +262,8 @@ export function useClaimedNFTSupply(
/**
* Hook for fetching batches of lazy-minted NFTs that were set to be revealed at a later date, but have not yet been revealed.
*
* Available to use on contracts that implement the [ERC721Revealable](https://portal.thirdweb.com/solidity/extensions/erc721revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/solidity/extensions/erc1155revealable) interfaces,
* Available to use on contracts that implement the [ERC721Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155Revealable) interfaces,
* such as the [NFT Drop](https://thirdweb.com/thirdweb.eth/DropERC721)
* and [Edition Drop](https://thirdweb.com/thirdweb.eth/DropERC1155) smart contracts.
*
@@ -605,8 +605,8 @@ export function useLazyMint<TContract extends DropContract>(
* allowing the owner to set placeholder metadata and reveal the metadata of the NFTs at a later time.
*
* Available to use on contracts that implement the
* [ERC721Revealable](https://portal.thirdweb.com/solidity/extensions/erc721revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/solidity/extensions/erc1155revealable)
* [ERC721Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155Revealable)
* interfaces.
*
* @example
@@ -725,8 +725,8 @@ export function useDelayedRevealLazyMint<TContract extends RevealableContract>(
* Hook for revealing a batch of delayed reveal NFTs using [delayed reveal](https://portal.thirdweb.com/glossary/delayed-reveal).
*
* Available to use on contracts that implement the
* [ERC721Revealable](https://portal.thirdweb.com/solidity/extensions/erc721revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/solidity/extensions/erc1155revealable)
* [ERC721Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Revealable)
* or [ERC1155Revealable](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155Revealable)
* interfaces.
*
* ```jsx
+18 -18
View File
@@ -37,8 +37,8 @@ import invariant from "tiny-invariant";
/**
* Hook for fetching information about an NFT from a smart contract.
*
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* NFT metadata is automatically fetched from where the `tokenUri` is hosted (e.g. IPFS), and makes the `image`
* property available as a URL through our IPFS gateway (if the image is hosted on IPFS).
@@ -122,8 +122,8 @@ export function useNFT<TContract extends NFTContract>(
/**
* Hook to query all NFTs associated with a smart contract.
*
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* NFT metadata is automatically fetched from where the `tokenUri` is hosted (e.g. IPFS), and makes the `image`
* property available as a URL through our IPFS gateway (if the image is hosted on IPFS).
@@ -184,8 +184,8 @@ export function useNFTs<TContract extends NFTContract>(
/**
* Hook to get the total count of **unique** NFTs minted on a smart contract.
*
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* When used for ERC1155 contracts, the total count is the number of unique token IDs minted, _not_ the total supply of all tokens in circulation.
*
@@ -242,8 +242,8 @@ export function useTotalCount<TContract extends NFTContract>(
*
* This takes into account the increase in supply due to minting and the decrease in supply due to burning.
*
* Available to use on contracts that implement either the [ERC721](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [ERC1155](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on contracts that implement either the [ERC721](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [ERC1155](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* @example
*
@@ -370,9 +370,9 @@ export function useOwnedNFTs<TContract extends NFTContract>(
}
/**
* Hook to get the quantity a user owns of a specific [ERC1155](https://portal.thirdweb.com/solidity/extensions/erc1155) NFT.
* Hook to get the quantity a user owns of a specific [ERC1155](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) NFT.
*
* Available to use on smart contracts that implement the [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* @example
* ```jsx
@@ -479,8 +479,8 @@ export function useSharedMetadata(
/**
* Hook for minting a new NFT on a smart contract.
*
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* By default, the process uploads and pins the NFT metadata to IPFS before minting.
*
@@ -608,7 +608,7 @@ export function useMintNFT<TContract extends NFTContract>(
* Hook for minting additional supply to an _existing_ ERC-1155 token.
*
* Available to use on contracts that implement the
* [ERC1155Mintable](https://portal.thirdweb.com/solidity/extensions/erc1155mintable)
* [ERC1155Mintable](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155Mintable)
* interface, such as the [Edition](https://thirdweb.com/thirdweb.eth/TokenERC1155) or [Edition Drop](https://thirdweb.com/thirdweb.eth/DropERC1155).
*
* The wallet address that initiates this transaction must have minting permissions on the contract.
@@ -717,8 +717,8 @@ export function useMintNFTSupply(contract: Erc1155) {
* Hook for transferring ERC721 or ERC1155 NFTs to another wallet address.
*
* Available to use on contracts that implement either the
* [ERC721](https://portal.thirdweb.com/solidity/extensions/erc721)
* and [ERC1155](https://portal.thirdweb.com/solidity/extensions/erc1155)
* [ERC721](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* and [ERC1155](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155)
* interfaces, such as the [Edition](https://thirdweb.com/thirdweb.eth/TokenERC1155)
* or [NFT Collection](https://thirdweb.com/thirdweb.eth/TokenERC721).
*
@@ -834,7 +834,7 @@ export function useTransferNFT<TContract extends NFTContract>(
}
/**
* Hook for airdropping [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) NFT tokens to multiple wallet addresses at once.
* Hook for airdropping [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) NFT tokens to multiple wallet addresses at once.
*
* Available to use on smart contracts that implement the `ERC1155` standard.
*
@@ -915,8 +915,8 @@ export function useAirdropNFT(contract: Erc1155) {
/**
* Hook for burning a NFT on a smart contract.
*
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/solidity/extensions/erc721)
* or [`ERC1155`](https://portal.thirdweb.com/solidity/extensions/erc1155) standard.
* Available to use on smart contracts that implement the [`ERC721`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721)
* or [`ERC1155`](https://portal.thirdweb.com/contracts/build/extensions/erc-1155/ERC1155) standard.
*
* @example
*
@@ -48,7 +48,7 @@ type GetAllReturnType<TContract extends ContractWithRoles> = Promise<
/**
* Hook for getting all wallet addresses that have a role in a smart contract.
*
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/solidity/extensions/permissions).
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/contracts/build/extensions/general/Permissions).
*
* @example
*
@@ -116,7 +116,7 @@ export function useAllRoleMembers<TContract extends ContractWithRoles>(
/**
* Hook for getting all wallet addresses that have a specific role in a smart contract.
*
* Available to use on contracts that implement the [`Permissions`](https://portal.thirdweb.com/solidity/extensions/permissions) interface.
* Available to use on contracts that implement the [`Permissions`](https://portal.thirdweb.com/contracts/build/extensions/general/Permissions) interface.
*
* @example
* ```jsx
@@ -173,7 +173,7 @@ export function useRoleMembers<TContract extends ContractWithRoles>(
/**
* Hook to check if an address is a member of a role on a smart contract.
*
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/solidity/extensions/permissions) interface
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/contracts/build/extensions/general/Permissions) interface
*
* Provide the following arguments to the hook:
*
@@ -305,7 +305,7 @@ export function useSetAllRoleMembers<TContract extends ContractWithRoles>(
/**
* Hook for granting a role on a smart contract.
*
* Available to use on smart contracts that implement the [`Permissions`](https://portal.thirdweb.com/solidity/extensions/permissions) interface.
* Available to use on smart contracts that implement the [`Permissions`](https://portal.thirdweb.com/contracts/build/extensions/general/Permissions) interface.
*
* @example
* ```jsx
@@ -403,7 +403,7 @@ export function useGrantRole<TContract extends ContractWithRoles>(
/**
* Hook for revoking a wallet address from a role on a smart contract.
*
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/solidity/extensions/permissions) interface
* Available to use on contracts that implement [`Permissions`](https://portal.thirdweb.com/contracts/build/extensions/general/Permissions) interface
*
* The wallet address that initiates this transaction must have the relevant permissions on the contract to remove the role from the wallet address (typically `"admin"` level required).
*
@@ -138,7 +138,7 @@ export function useTokenBalance(
/**
* Hook for fetching the [decimals](https://docs.openzeppelin.com/contracts/3.x/erc20#a-note-on-decimals)
* of an [ERC20](https://portal.thirdweb.com/solidity/extensions/erc20) token.
* of an [ERC20](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20) token.
*
* Tokens usually opt for a value of `18`, imitating the relationship between Ether and Wei.
* Therefore, `18` is the default value returned by this function, unless your ERC20 contract explicitly overrides it.
@@ -187,7 +187,7 @@ export function useTokenDecimals(contract: RequiredParam<TokenContract>) {
/**
* Hook for minting new tokens in an ERC20 smart contract.
*
* Available to use on contracts that implement the [ERC20Mintable](https://portal.thirdweb.com/solidity/extensions/erc20mintable)
* Available to use on contracts that implement the [ERC20Mintable](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20BatchMintable)
* interface, such as the [Token](https://thirdweb.com/thirdweb.eth/TokenERC20) contract.
*
* The wallet address that initiates this transaction must have minting permissions on the contract.
@@ -286,8 +286,8 @@ export function useMintToken(
/**
* Hook for claiming a ERC20 tokens from a smart contract.
*
* Available to use on smart contracts that implement both the [ERC20](https://portal.thirdweb.com/solidity/extensions/erc20) interface
* and the [`claim`](https://portal.thirdweb.com/solidity/extensions/erc721claimable) function,
* Available to use on smart contracts that implement both the [ERC20](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20) interface
* and the [`claim`](https://portal.thirdweb.com/contracts/build/extensions/erc-721/ERC721Claimable) function,
* such as the [Token Drop](https://thirdweb.com/thirdweb.eth/DropERC20).
*
* @example
@@ -374,7 +374,7 @@ export function useClaimToken(contract: RequiredParam<TokenContract>) {
/**
* Hook for transferring tokens on an ERC20 contract.
*
* Available to use on contracts that implement the [ERC20](https://portal.thirdweb.com/solidity/extensions/erc20)
* Available to use on contracts that implement the [ERC20](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20)
* interface, such as the [Token](https://thirdweb.com/thirdweb.eth/TokenERC20) contract.
*
* The wallet address that initiates this transaction must have a balance of tokens
@@ -518,7 +518,7 @@ export function useTransferNativeToken() {
/**
* Hook for transferring ERC20 tokens to multiple recipients in a single transaction (i.e. airdrop).
*
* Available to use on contracts that implement the [ERC20](https://portal.thirdweb.com/solidity/extensions/erc20) interface.
* Available to use on contracts that implement the [ERC20](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20) interface.
*
* The wallet that initiates this transaction must have sufficient balance to cover the total amount of tokens being transferred
* and must have transfer permissions on the contract, i.e. tokens are not soulbound.
@@ -620,7 +620,7 @@ export function useTransferBatchToken(contract: RequiredParam<TokenContract>) {
/**
* Hook for burning ERC20 tokens on a smart contract.
*
* Available to use on smart contracts that implement the [ERC20](https://portal.thirdweb.com/solidity/extensions/erc20) standard.
* Available to use on smart contracts that implement the [ERC20](https://portal.thirdweb.com/contracts/build/extensions/erc-20/ERC20) standard.
*
* @example
*
@@ -7,7 +7,7 @@ import invariant from "tiny-invariant";
import { AUTH_TOKEN_STORAGE_KEY } from "../../../core/constants/auth";
/**
* Hook to prompt the user to sign in with their wallet using [auth](https://portal.thirdweb.com/auth)
* Hook to prompt the user to sign in with their wallet using [auth](https://portal.thirdweb.com/wallets/auth)
*
* Requires the `authConfig` prop to be configured on the `ThirdwebProvider`
*
@@ -16,7 +16,7 @@ export interface UserWithData<
}
/**
* Hook for retrieving information about the currently signed-in user using [auth](https://portal.thirdweb.com/auth).
* Hook for retrieving information about the currently signed-in user using [auth](https://portal.thirdweb.com/wallets/auth).
*
* Useful to get the user's address and session data, or `undefined` if no user is signed in.
*
@@ -3,7 +3,7 @@ import { useSDK } from "../useSDK";
/**
* Get the instance of the `ThirdwebStorage` class being used by the `ThirdwebProvider`
*
* Allows you to use the TypeScript SDK functionality of [Storage](https://portal.thirdweb.com/storage) in your React app.
* Allows you to use the TypeScript SDK functionality of [Storage](https://portal.thirdweb.com/infrastructure/storage/overview) in your React app.
*
* @example
*
@@ -226,7 +226,7 @@ const WrappedThirdwebSDKProvider = <TChains extends Chain[]>({
* This Overrides any of the default values for the SDK. If not provided, it uses sensible defaults.
*
* ### storageInterface (optional)
* Override the default [Storage](https://portal.thirdweb.com/storage) interface used by the SDK.
* Override the default [Storage](https://portal.thirdweb.com/infrastructure/storage/overview) interface used by the SDK.
*
* It allows you to create an instance of `ThirdwebStorage` with your own customized config, and pass it to the SDK.
*
@@ -265,7 +265,7 @@ const WrappedThirdwebSDKProvider = <TChains extends Chain[]>({
* ```
*
* ### authConfig (optional)
* The configuration object for setting up [Auth](https://portal.thirdweb.com/auth); allowing users to sign in with their wallet.
* The configuration object for setting up [Auth](https://portal.thirdweb.com/wallets/auth); allowing users to sign in with their wallet.
*
* ### secretKey (optional)
* secretKey for thirdweb services. This is only required if server side rendering is being used.
@@ -47,7 +47,7 @@ export interface ThirdwebSDKProviderProps<TChains extends Chain[]>
sdkOptions?: Omit<SDKOptions, "chains">;
/**
* Override the default [Storage](https://portal.thirdweb.com/storage) interface used by the SDK.
* Override the default [Storage](https://portal.thirdweb.com/infrastructure/storage/overview) interface used by the SDK.
*
* It allows you to create an instance of `ThirdwebStorage` with your own customized config, and pass it to the SDK.
*
@@ -89,7 +89,7 @@ export interface ThirdwebSDKProviderProps<TChains extends Chain[]>
storageInterface?: IThirdwebStorage;
/**
* The configuration object for setting up [Auth](https://portal.thirdweb.com/auth); allowing users to sign in with their wallet.
* The configuration object for setting up [Auth](https://portal.thirdweb.com/wallets/auth); allowing users to sign in with their wallet.
*/
authConfig?: ThirdwebAuthConfig;
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.5.6
## 0.5.5
## 0.5.4
## 0.5.3
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.5.4",
"version": "0.5.6",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+29
View File
@@ -1,5 +1,34 @@
# @thirdweb-dev/react-native
## 0.5.6
### Patch Changes
- [#2131](https://github.com/thirdweb-dev/js/pull/2131) [`f953c72c`](https://github.com/thirdweb-dev/js/commit/f953c72c4e273feefcbd905876b15e7346b45740) Thanks [@iketw](https://github.com/iketw)! - Fix custom balance token display in details button
- [#2137](https://github.com/thirdweb-dev/js/pull/2137) [`7d07490e`](https://github.com/thirdweb-dev/js/commit/7d07490ed3ec80aa33a991f38b3831996d49fb09) Thanks [@iketw](https://github.com/iketw)! - Adds hideDisconnect prop to hide the disconnect button
```ts
<ConnectWallet hideDisconnect={true} />
```
- Updated dependencies [[`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.5.5
### Patch Changes
- [#2119](https://github.com/thirdweb-dev/js/pull/2119) [`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc) Thanks [@MananTank](https://github.com/MananTank)! - Update Links to Docs website
- [#2092](https://github.com/thirdweb-dev/js/pull/2092) [`4c3c840d`](https://github.com/thirdweb-dev/js/commit/4c3c840d8815915840d0819932aa0a858c5d3184) Thanks [@iketw](https://github.com/iketw)! - Export WalletConnect modal component
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.5.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.5.4",
"version": "0.5.6",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -56,7 +56,7 @@ export type ConnectWalletProps = {
/**
* Whether to show "Switch Network" button if the wallet is connected,
* but it is not connected to the `activeChain` provided in `ThirdwebProvider`
* but it is not connected to the `activeChain` provided in [`ThirdwebProvider`](https://portal.thirdweb.com/react-native/v0/ThirdwebProvider)
*
* Please, note that if you support multiple networks in your app this prop should
* be set to `false` to allow users to switch between networks.
@@ -73,13 +73,17 @@ export type ConnectWalletProps = {
supportedTokens?: SupportedTokens;
/**
* Show balance of ERC20 token instead of the native token in the "Connected" button when connected to certain network
* Display the balance of a token instead of the native token in ConnectWallet details button.
*
* @example
* ```tsx
* import { Base } from "@thirdweb-dev/chains";
*
* <ConnectWallet balanceToken={{
* 1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" // show USDC balance when connected to Ethereum mainnet
* }} />
* 1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" // show USDC balance when connected to Ethereum mainnet
* [Base.chainId]: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", // show Dai stablecoin token balance when connected to Base mainnet
* }}
* />
* ```
*/
displayBalanceToken?: Record<number, string>;
@@ -90,6 +94,18 @@ export type ConnectWalletProps = {
* The default is `false`
*/
hideSwitchToPersonalWallet?: boolean;
/**
* Hide the "Disconnect Wallet" button in the ConnectWallet Dropdown.
*
* By default it is `false`
*
* @example
* ```tsx
* <ConnectWallet hideDisconnect={true} />
* ```
*/
hideDisconnect?: boolean;
} & ConnectWalletButtonProps;
export const ConnectWallet = ({
@@ -108,6 +124,7 @@ export const ConnectWallet = ({
privacyPolicyUrl,
supportedTokens,
hideSwitchToPersonalWallet,
hideDisconnect,
}: ConnectWalletProps) => {
const globalTheme = useGlobalTheme();
const l = useLocale();
@@ -187,6 +204,7 @@ export const ConnectWallet = ({
hideTestnetFaucet={hideTestnetFaucet}
hideReceiveButton={hideReceiveButton}
hideSendButton={hideSendButton}
hideDisconnect={hideDisconnect}
supportedTokens={supportedTokensMemo}
displayBalanceToken={displayBalanceToken}
hideSwitchToPersonalWallet={hideSwitchToPersonalWallet}
@@ -43,10 +43,11 @@ export const ConnectWalletDetailsModal = ({
address,
hideTestnetFaucet,
supportedTokens,
displayBalanceToken,
tokenAddress,
hideSwitchToPersonalWallet,
hideReceiveButton,
hideSendButton,
hideDisconnect,
}: {
isVisible: boolean;
onClosePress: () => void;
@@ -54,10 +55,11 @@ export const ConnectWalletDetailsModal = ({
address?: string;
hideTestnetFaucet?: boolean;
supportedTokens: SupportedTokens;
displayBalanceToken?: Record<number, string>;
tokenAddress?: string;
hideSwitchToPersonalWallet?: boolean;
hideReceiveButton?: boolean;
hideSendButton?: boolean;
hideDisconnect?: boolean;
}) => {
const l = useLocale();
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
@@ -69,11 +71,6 @@ export const ConnectWalletDetailsModal = ({
const [isImportModalVisible, setIsImportModalVisible] = useState(false);
const setConnectedWallet = useSetConnectedWallet();
const tokenAddress =
chain?.chainId && displayBalanceToken
? displayBalanceToken[chain?.chainId]
: undefined;
const [isSmartWalletDeployed, setIsSmartWalletDeployed] = useState(false);
useEffect(() => {
@@ -235,6 +232,7 @@ export const ConnectWalletDetailsModal = ({
<WalletDetailsModalHeader
tokenAddress={tokenAddress}
address={address}
hideDisconnect={hideDisconnect}
onDisconnectPress={onDisconnectPress}
onAddressCopied={onAddressCopied}
/>
@@ -1,7 +1,7 @@
import { AddressDisplay } from "../base/AddressDisplay";
import BaseButton from "../base/BaseButton";
import Text from "../base/Text";
import { useENS, useWallet } from "@thirdweb-dev/react-core";
import { useChain, useENS, useWallet } from "@thirdweb-dev/react-core";
import { StyleSheet } from "react-native";
import { LocalWallet, walletIds } from "@thirdweb-dev/wallets";
import Box from "../base/Box";
@@ -56,6 +56,8 @@ export type ConnectWalletDetailsProps = {
* The default is `false`
*/
hideReceiveButton?: boolean;
hideDisconnect?: boolean;
};
export const WalletDetailsButton = ({
@@ -68,11 +70,13 @@ export const WalletDetailsButton = ({
supportedTokens,
displayBalanceToken,
hideSwitchToPersonalWallet,
hideDisconnect,
}: ConnectWalletDetailsProps) => {
const l = useLocale();
const activeWallet = useWallet();
const [isModalVisible, setIsModalVisible] = useState(false);
const ensQuery = useENS();
const chain = useChain();
const onPress = () => {
setIsModalVisible(!isModalVisible);
@@ -89,6 +93,11 @@ export const WalletDetailsButton = ({
? SMART_WALLET_ICON
: activeWallet?.getMeta().iconURL || "";
const tokenAddress =
chain?.chainId && displayBalanceToken
? displayBalanceToken[chain?.chainId]
: undefined;
return (
<>
<ConnectWalletDetailsModal
@@ -98,7 +107,8 @@ export const WalletDetailsButton = ({
address={address}
hideTestnetFaucet={hideTestnetFaucet}
supportedTokens={supportedTokens}
displayBalanceToken={displayBalanceToken}
hideDisconnect={hideDisconnect}
tokenAddress={tokenAddress}
hideSwitchToPersonalWallet={hideSwitchToPersonalWallet}
hideReceiveButton={hideReceiveButton}
hideSendButton={hideSendButton}
@@ -133,7 +143,10 @@ export const WalletDetailsButton = ({
address={address}
/>
)}
<TextBalance textVariant="bodySmallSecondary" />
<TextBalance
textVariant="bodySmallSecondary"
tokenAddress={tokenAddress}
/>
</Box>
</Box>
</BaseButton>
@@ -20,6 +20,7 @@ interface WalletDetailsModalHeaderProps {
onAddressCopied?: () => void;
loading?: boolean;
tokenAddress?: string;
hideDisconnect?: boolean;
}
export const WalletDetailsModalHeader = ({
@@ -27,6 +28,7 @@ export const WalletDetailsModalHeader = ({
onDisconnectPress,
onAddressCopied,
tokenAddress,
hideDisconnect,
}: WalletDetailsModalHeaderProps) => {
const theme = useGlobalTheme();
const activeWallet = useWallet();
@@ -96,7 +98,7 @@ export const WalletDetailsModalHeader = ({
</BaseButton>
{showLoading ? (
<ActivityIndicator size="small" color={theme.colors.iconHighlight} />
) : (
) : hideDisconnect ? null : (
<Icon
type="disconnect"
width={18}
@@ -120,7 +120,7 @@ export const ConnectWalletFlow = () => {
connected={handleClose}
isOpen={modalVisible}
show={onOpenModal}
hide={() => {}}
hide={handleClose}
walletConfig={activeWallet}
supportedWallets={supportedWallets}
selectionData={selectionData}
@@ -25,6 +25,7 @@ export const SmartWalletFlow = ({
goBack,
walletConfig,
personalWalletConfig,
hide,
...props
}: ConnectUIProps<SmartWallet> & { personalWalletConfig: WalletConfig }) => {
const l = useLocale();
@@ -124,6 +125,7 @@ export const SmartWalletFlow = ({
<PersonalWalletConfigUI
{...props}
connected={connected}
hide={hide}
goBack={goBack}
walletConfig={personalWalletConfig}
onLocallyConnected={onPersonalWalletConnected}
@@ -43,7 +43,7 @@ export interface Web3ButtonProps<TActionFn extends ActionFn> {
/**
* A component that allows the user to call an on-chain function on a contract.
*
* The button has to be wrapped in a `ThirdwebProvider` in order to function.
* The button has to be wrapped in a [`ThirdwebProvider`](https://portal.thirdweb.com/react-native/v0/ThirdwebProvider) in order to function.
*
* @example
* ```javascript
@@ -14,6 +14,8 @@ export function TWModal(props: Partial<ModalProps>) {
useNativeDriver
hideModalContentWhileAnimating={true}
style={{ maxWidth: MAX_WIDTH }}
animationIn="slideInUp" // Slide in from bottom
animationOut="slideOutDown" // Slide out to bottom
>
{props.children}
</Modal>
+2
View File
@@ -44,6 +44,8 @@ export {
type ActionFn,
} from "./components/Web3Button";
export { WalletConnectUI } from "./wallets/wallets/wallet-connect/WalletConnectUI";
// utilities
export * from "./utils/uri";
export { createSyncStorage as createLocalStorage } from "../core/AsyncStorage";
@@ -10,9 +10,7 @@ import { MagicConnector } from "../connectors/magic/magic-connector";
* @deprecated We have deprecated magicLink in favor of our embeddedWallet which adds support for more sign in methods.
* To learn more, please see:
*
* Our release notes: https://portal.thirdweb.com/embedded-wallet
*
* Our documentation: https://portal.thirdweb.com/react-native/react-native.embeddedwallet
* Checkout the [Release Notes](https://portal.thirdweb.com/wallets/embedded-wallet/overview) and [Documentation](https://portal.thirdweb.com/react-native/v0/wallets/embedded-wallet) for more information.
*/
export class MagicLink extends AbstractClientWallet<
MagicLinkOptions,
@@ -29,9 +29,7 @@ import { useGlobalTheme, useLocale } from "../../providers/ui-context-provider";
* @deprecated We have deprecated magicLink in favor of our embeddedWallet which adds support for more sign in methods.
* To learn more, please see:
*
* Our release notes: https://portal.thirdweb.com/embedded-wallet
*
* Our documentation: https://portal.thirdweb.com/react-native/react-native.embeddedwallet
* Check out [Release Note](https://portal.thirdweb.com/wallets/embedded-wallet/overview) and [Documentation](https://portal.thirdweb.com/react-native/v0/wallets/embedded-wallet) for more details.
*/
export const magicLink = (
magicLinkOptions: MagicLinkOptions & { recommended?: boolean },
@@ -43,8 +43,21 @@ export function WalletConnectUI({
walletConfig,
projectId,
goBack,
hide,
supportedWallets,
}: ConnectUIProps<WalletConnect> & { projectId: string }) {
isVisible,
}: Omit<
ConnectUIProps<WalletConnect>,
| "isOpen"
| "show"
| "theme"
| "selectionData"
| "setSelectionData"
| "modalSize"
> & {
projectId: string;
isVisible?: boolean;
}) {
const l = useLocale();
const theme = useGlobalTheme();
const [wallets, setWallets] = useState<WCWallet[]>([]);
@@ -55,6 +68,9 @@ export function WalletConnectUI({
const createWalletInstance = useCreateWalletInstance();
const setConnectedWallet = useSetConnectedWallet();
const setConnectionStatus = useSetConnectionStatus();
const [isVisibleInternal, setIsVisibleInternal] = useState<
boolean | undefined
>(isVisible);
const onChangeText = useDebounceCallback({ callback: setSearch });
@@ -118,6 +134,10 @@ export function WalletConnectUI({
};
}, [projectId]);
useEffect(() => {
setIsVisibleInternal(isVisible);
}, [isVisible]);
useEffect(() => {
if (wallets && search) {
setSearchWallets(
@@ -145,18 +165,24 @@ export function WalletConnectUI({
console.error(`Error connecting with WalletConnect: ${e}`);
})
.finally(() => {
connected();
setIsVisibleInternal(false);
setTimeout(() => {
connected();
});
});
};
const onClosePress = () => {
setConnectionStatus("disconnected");
connected();
setIsVisibleInternal(false);
setTimeout(() => {
hide();
});
};
return (
<TWModal
isVisible={true}
isVisible={isVisibleInternal ?? true}
onBackdropPress={onClosePress}
backdropOpacity={0.7}
>
+26
View File
@@ -1,5 +1,31 @@
# @thirdweb-dev/react
## 4.2.3
### Patch Changes
- [#2122](https://github.com/thirdweb-dev/js/pull/2122) [`0ff90b8f`](https://github.com/thirdweb-dev/js/commit/0ff90b8fba1a0f657d5727fa1a7789bd933a0ad6) Thanks [@b-bot](https://github.com/b-bot)! - Add `hideDisconnect` prop on `ConnectWallet` component to hide the "Disconnect Wallet" option from the ConnectWallet dropdown
```tsx
<ConnectWallet hideDisconnect={true} />
```
- Updated dependencies [[`b3cf65b9`](https://github.com/thirdweb-dev/js/commit/b3cf65b9dbdab22a452d2c597d21a14300b2d174), [`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 4.2.2
### Patch Changes
- [#2119](https://github.com/thirdweb-dev/js/pull/2119) [`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc) Thanks [@MananTank](https://github.com/MananTank)! - Update Links to Docs website
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 4.2.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.2.1",
"version": "4.2.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -110,7 +110,7 @@ export interface Web3ButtonProps<TActionFn extends ActionFn> {
style?: React.CSSProperties;
/**
* Web3Button renders a `ConnectWallet` if no wallet is connected. You can pass props for that component by passing a `connectWallet` prop to Web3Button
* Web3Button renders a [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) if no wallet is connected. You can pass props for that component by passing a `connectWallet` prop to Web3Button
*
* @example
* ```tsx
@@ -136,7 +136,7 @@ export interface Web3ButtonProps<TActionFn extends ActionFn> {
btnTitle?: string;
/**
* title of the `ConnectWallet` Modal.
* title of the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal.
*
* The default is `"Connect"`.
*/
@@ -193,9 +193,9 @@ export interface Web3ButtonProps<TActionFn extends ActionFn> {
*
* It ensures the following criteria before attempting to call the contract function:
*
* 1. There is a connected wallet (if there is not, it renders a `ConnectWallet` component instead.
* 1. There is a connected wallet (if there is not, it renders a [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component instead.
*
* 2. The connected wallet is on the correct network as specified in the `ThirdwebProvider`'s `activeChain` prop. if it is not, it renders a "switch network" button instead.
* 2. The connected wallet is on the correct network as specified in the [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `activeChain` prop. if it is not, it renders a "switch network" button instead.
*
* If the action you are performing is async, make sure to return a `Promise` from the action function so that the SDK knows when the action is complete. This can be done by either using async/await or by returning a `Promise`.
*
@@ -220,7 +220,7 @@ export interface Web3ButtonProps<TActionFn extends ActionFn> {
* @param props -
* The props for the component.
*
* Refer to [Web3ButtonProps](https://portal.thirdweb.com/references/react/Web3ButtonProps) for more details.
* Refer to [Web3ButtonProps](https://portal.thirdweb.com/references/react/v4/Web3ButtonProps) for more details.
*
*/
export const Web3Button = <TAction extends ActionFn>(
@@ -3,7 +3,7 @@ import type { SafeConnectionArgs } from "@thirdweb-dev/wallets";
import { useCallback } from "react";
/**
* @deprecated use `ConnectWallet` or `useConnect` instead
* @deprecated use [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) instead
* @walletConnection
* @internal
*/
@@ -23,7 +23,7 @@ export function useSafe() {
// for backwards compatibility
/**
* @deprecated use `ConnectWallet` or `useConnect` instead
* @deprecated use [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) instead
* @walletConnection
* @internal
*/
@@ -4,7 +4,7 @@ import { MagicLinkAdditionalOptions } from "@thirdweb-dev/wallets/evm/wallets/ma
import { MagicLinkConnectOptions } from "@thirdweb-dev/wallets";
/**
* @deprecated use `ConnectWallet` or `useConnect` instead
* @deprecated use [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) instead
* @walletConnection
* @internal
*/
@@ -4,7 +4,7 @@ import { BloctoWalletConfigOptions } from "../../../wallet/wallets/blocto/blocto
/**
* @internal
* @deprecated use the `ConnectWallet` component or `useConnect` hook instead
* @deprecated use the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @walletConnection
*/
export function useBloctoWallet() {
@@ -3,7 +3,7 @@ import { useCallback } from "react";
/**
* @walletConnection
* @deprecated use `ConnectWallet` component or `useConnect` hook instead
* @deprecated use [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @internal
*/
export function useCoinbaseWallet() {
@@ -22,7 +22,7 @@ import {
/**
* Hook to connect `EmbeddedWallet` which allows users to login via Email or social logins
*
* The `embeddedWallet()` should be added to `ThirdwebProvider`'s `supportedWallets` prop to enable auto-connection on page load
* The `embeddedWallet()` should be added to [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `supportedWallets` prop to enable auto-connection on page load
*
* @example
*
@@ -2,7 +2,7 @@ import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
/**
* @deprecated use the `ConnectWallet` component or `useConnect` hook instead
* @deprecated use the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @internal
*/
export function useFrameWallet() {
@@ -2,7 +2,7 @@ import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
/**
* @deprecated Use `ConnectWallet` component or `useConnect` hook instead
* @deprecated Use [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @internal
*/
export function useMetamask() {
@@ -15,7 +15,7 @@ type PaperConfig = Omit<PaperWalletAdditionalOptions, "chain">;
/**
* @internal
* @deprecated We have deprecated `PaperWallet` in favor of our `EmbeddedWallet` which adds support for more sign in methods. use the `useEmbeddedWallet` hook instead
* @deprecated We have deprecated `PaperWallet` in favor of our `EmbeddedWallet` which adds support for more sign in methods. use the [`useEmbeddedWallet`](https://portal.thirdweb.com/references/react/v4/useEmbeddedWallet) hook instead
*/
export function usePaperWallet() {
const connect = useConnect();
@@ -35,7 +35,7 @@ export function usePaperWallet() {
/**
* @internal
* @deprecated We have deprecated `PaperWallet` in favor of our `EmbeddedWallet` which adds support for more sign in methods. use the `useEmbeddedWallet` hook instead
* @deprecated We have deprecated `PaperWallet` in favor of our `EmbeddedWallet` which adds support for more sign in methods. use the [`useEmbeddedWallet`](https://portal.thirdweb.com/references/react/v4/useEmbeddedWallet) hook instead
*/
export function usePaperWalletUserEmail(): UseQueryResult<
string | undefined,
@@ -2,7 +2,7 @@ import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
/**
* @deprecated use the `ConnectWallet` component or `useConnect` hook instead
* @deprecated use the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @internal
* @walletConnection
*/
@@ -16,11 +16,11 @@ import { useCallback } from "react";
import type { BytesLike } from "ethers";
/**
* Hook to connect [Smart wallet](https://portal.thirdweb.com/wallet/smart-wallet)
* Hook to connect [Smart wallet](https://portal.thirdweb.com/references/wallets/v2/SmartWallet)
*
* `useSmartWallet()` handles connecting both the personal wallet and the Smart Wallet.
*
* The `smartWallet()` also need to be added in `ThirdwebProvider`'s `supportedWallets` prop to enable auto-connection on page load
* The `smartWallet()` also need to be added in [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `supportedWallets` prop to enable auto-connection on page load
*
* ### Example
*
@@ -2,7 +2,7 @@ import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
/**
* @deprecated use the `ConnectWallet` component or `useConnect` hook instead
* @deprecated use the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
* @internal
* @walletConnection
*/
@@ -22,7 +22,7 @@ export function useWalletConnectV1() {
/**
* @internal
* @walletConnection
* @deprecated use the `ConnectWallet` component or `useConnect` hook instead
* @deprecated use the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook instead
*/
export function useWalletConnect() {
const connect = useConnect();
+2 -2
View File
@@ -320,7 +320,7 @@ export function enDefault() {
}
/**
* Calling this function will return the default English locale object to be set on `ThirdwebProvider` to localize the thirdweb components.
* Calling this function will return the default English locale object to be set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) to localize the thirdweb components.
*
* You can also overrides parts of the default locale object by passing an object with the same structure as the default locale object and only those parts will be overridden.
*
@@ -339,7 +339,7 @@ export function enDefault() {
* })
* ```
*
* Pass it to `ThirdwebProvider`'s `locale` prop to localize the thirdweb components.
* Pass it to [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `locale` prop to localize the thirdweb components.
*
* ```tsx
* function Example() {
+2 -2
View File
@@ -328,7 +328,7 @@ export function esDefault(): ThirdwebLocale {
}
/**
* Calling this function will return the default Spanish locale object to be set on `ThirdwebProvider` to localize the thirdweb components.
* Calling this function will return the default Spanish locale object to be set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) to localize the thirdweb components.
*
* You can also overrides parts of the default locale object by passing an object with the same structure as the default locale object and only those parts will be overridden.
*
@@ -347,7 +347,7 @@ export function esDefault(): ThirdwebLocale {
* })
* ```
*
* Pass it to `ThirdwebProvider`'s `locale` prop to localize the thirdweb components.
* Pass it to [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `locale` prop to localize the thirdweb components.
*
* ```tsx
* function Example() {
+2 -2
View File
@@ -322,7 +322,7 @@ export function jaDefault(): ThirdwebLocale {
}
/**
* Calling this function will return the default Japanese locale object to be set on `ThirdwebProvider` to localize the thirdweb components.
* Calling this function will return the default Japanese locale object to be set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) to localize the thirdweb components.
*
* You can also overrides parts of the default locale object by passing an object with the same structure as the default locale object and only those parts will be overridden.
*
@@ -341,7 +341,7 @@ export function jaDefault(): ThirdwebLocale {
* })
* ```
*
* Pass it to `ThirdwebProvider`'s `locale` prop to localize the thirdweb components.
* Pass it to [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s `locale` prop to localize the thirdweb components.
*
* ```tsx
* function Example() {
@@ -381,7 +381,7 @@ export type DefaultChains = typeof defaultChains;
* ```
*
* ### authConfig (optional)
* The configuration object for setting up [Auth](https://portal.thirdweb.com/auth); allowing users to sign in with their wallet.
* The configuration object for setting up [Auth](https://portal.thirdweb.com/wallets/auth); allowing users to sign in with their wallet.
* It takes an object with the following properties:
* - `authUrl` - The backend URL of the authentication endpoints. For example, if your endpoints are at `/api/auth/login`, `/api/auth/logout`, etc. then this should be set to `/api/auth`
* - `domain` - The frontend domain used to generate the login payload. This domain should match the domain used on your auth backend.
@@ -412,7 +412,7 @@ export type DefaultChains = typeof defaultChains;
*
* Allows you to create an instance of `ThirdwebStorage` with your own customized config, and pass it to the SDK. This requires the `@thirdweb-dev/storage` package to be installed.
*
* [Learn more aboout storage](https://portal.thirdweb.com/storage)
* [Learn more about storage](https://portal.thirdweb.com/infrastructure/storage/overview)
*
* ```jsx
* import { ThirdwebProvider } from "@thirdweb-dev/react";
@@ -78,14 +78,14 @@ export const WalletUIStatesProvider = (
};
/**
* Check if the `ConnectWallet` Modal is open or not
* Check if the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal is open or not
*
* @example
* ```tsx
* const isOpen = useIsWalletModalOpen();
* ```
*
* @returns `true` if the `ConnectWallet` modal is open, `false` otherwise
* @returns `true` if the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) modal is open, `false` otherwise
* @connectWallet
*/
export const useIsWalletModalOpen = () => {
@@ -93,7 +93,7 @@ export const useIsWalletModalOpen = () => {
};
/**
* Open or close the `ConnectWallet` Modal
* Open or close the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal
*
* @example
* ```tsx
@@ -52,8 +52,8 @@ export type ConnectWalletProps = {
/**
* Set the theme for the button and modal.
*
* By default it is set to "dark" if `theme` is not set on `ThirdWebProvider`
* If a `theme` is set on `ThirdWebProvider` then that theme will be used by default which can be overridden by setting `theme` prop on `ConnectWallet` component
* By default it is set to "dark" if `theme` is not set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
* If a `theme` is set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) then that theme will be used by default which can be overridden by setting `theme` prop on [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component
*
* theme can be set to either "dark" or "light" or a custom theme object. You can also import `lightTheme` or `darkTheme` functions from `@thirdweb-dev/react` to use the default themes as base and overrides parts of it.
*
@@ -131,15 +131,15 @@ export type ConnectWalletProps = {
dropdownPosition?: DropDownPosition;
/**
* Enforce that users must sign in with their wallet using [auth](https://portal.thirdweb.com/auth) after connecting their wallet.
* Enforce that users must sign in with their wallet using [auth](https://portal.thirdweb.com/wallets/auth) after connecting their wallet.
*
* This requires the `authConfig` prop to be set on the `ThirdWebProvider` component.
* This requires the `authConfig` prop to be set on the [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) component.
*/
auth?: {
/**
* specify whether signing in is optional or not.
*
* By default it is `true` if `authConfig` is set on `ThirdWebProvider`
* By default it is `true` if `authConfig` is set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
*/
loginOptional?: boolean;
/**
@@ -179,7 +179,7 @@ export type ConnectWalletProps = {
/**
* Whether to show "Switch Network" button if the wallet is connected,
* but it is not connected to the `activeChain` provided in `ThirdwebProvider`
* but it is not connected to the `activeChain` provided in [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
*
* Please, note that if you support multiple networks in your app this prop should
* be set to `false` to allow users to switch between networks.
@@ -308,6 +308,18 @@ export type ConnectWalletProps = {
* ```
*/
hideSwitchToPersonalWallet?: boolean;
/**
* Hide the "Disconnect Wallet" button in the ConnectWallet Dropdown.
*
* By default it is `false`
*
* @example
* ```tsx
* <ConnectWallet hideDisconnect={true} />
* ```
*/
hideDisconnect?: boolean;
};
const TW_CONNECT_WALLET = "tw-connect-wallet";
@@ -315,9 +327,9 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
/**
* A component that allows the user to connect their wallet.
*
* it renders a button which when clicked opens a modal to allow users to connect to wallets specified in the `ThirdwebProvider`'s supportedWallets prop.
* it renders a button which when clicked opens a modal to allow users to connect to wallets specified in the [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)'s supportedWallets prop.
*
* This component must be descendant of `ThirdwebProvider`
* This component must be descendant of [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
*
* @example
* ```tsx
@@ -355,15 +367,15 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
*
* ### auth (optional)
* The object contains the following properties to customize the authentication
* - `loginOptional` - specify whether signing in is optional or not. By default it is `true` if `authConfig` is set on `ThirdWebProvider`
* - `loginOptional` - specify whether signing in is optional or not. By default it is `true` if `authConfig` is set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
* - `onLogin` - Callback to be called after user signs in with their wallet
* - `onLogout` - Callback to be called after user signs out
*
* ### theme (optional)
* Set the theme for the button and modal.
*
* By default it is set to "dark" if `theme` is not set on `ThirdWebProvider`
* If a `theme` is set on `ThirdWebProvider` then that theme will be used by default which can be overridden by setting `theme` prop on `ConnectWallet` component
* By default it is set to "dark" if `theme` is not set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
* If a `theme` is set on [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) then that theme will be used by default which can be overridden by setting `theme` prop on [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component
*
* theme can be set to either "dark" or "light" or a custom theme object. You can also import `lightTheme` or `darkTheme` functions from `@thirdweb-dev/react` to use the default themes as base and overrides parts of it.
*
@@ -427,7 +439,7 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
*
* ### switchToActiveChain (optional)
* Whether to show "Switch Network" button if the wallet is connected,
* but it is not connected to the `activeChain` provided in `ThirdwebProvider`
* but it is not connected to the `activeChain` provided in [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider)
*
* Please, note that if you support multiple networks in your app this prop should
* be set to `false` to allow users to switch between networks.
@@ -535,6 +547,14 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
* <ConnectWallet hideSwitchToPersonalWallet={true} />
* ```
*
* ### hideDisconnect
* Hide the "Disconnect Wallet" button in the ConnectWallet dropdown
*
* By default it is `false`
*
* ```tsx
* <ConnectWallet hideDisconnect={true} />
* ```
*/
export function ConnectWallet(props: ConnectWalletProps) {
const activeWallet = useWallet();
@@ -732,6 +752,7 @@ export function ConnectWallet(props: ConnectWalletProps) {
}
}}
hideSwitchToPersonalWallet={props.hideSwitchToPersonalWallet}
hideDisconnect={props.hideDisconnect}
/>
);
})()}
@@ -97,6 +97,7 @@ export const ConnectedWalletDetails: React.FC<{
supportedTokens: SupportedTokens;
displayBalanceToken?: Record<number, string>;
hideSwitchToPersonalWallet?: boolean;
hideDisconnect?: boolean;
}> = (props) => {
const locale = useTWLocale().connectWallet;
const chain = useChain();
@@ -331,22 +332,24 @@ export const ConnectedWalletDetails: React.FC<{
</IconButton>
</div>
<ToolTip
tip={locale.disconnectWallet}
side="bottom"
align={"end"}
sideOffset={10}
>
<DisconnectIconButton
type="button"
onClick={() => {
disconnect();
props.onDisconnect();
}}
{!props.hideDisconnect && (
<ToolTip
tip={locale.disconnectWallet}
side="bottom"
align={"end"}
sideOffset={10}
>
<ExitIcon size={iconSize.md} />
</DisconnectIconButton>
</ToolTip>
<DisconnectIconButton
type="button"
onClick={() => {
disconnect();
props.onDisconnect();
}}
>
<ExitIcon size={iconSize.md} />
</DisconnectIconButton>
</ToolTip>
)}
</Container>
{/* row 2 */}
@@ -39,6 +39,7 @@ export const ConnectModalInline = (
| "switchToActiveChain"
| "supportedTokens"
| "hideSwitchToPersonalWallet"
| "hideDisconnect"
> & {
onModalHide?: () => void;
},
@@ -32,7 +32,7 @@ const fantomIcon =
export type SupportedTokens = Record<number, TokenInfo[]>;
/**
* Default tokens shown in `ConnectWallet`'s SendFunds screen for each network.
* Default tokens shown in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet)'s SendFunds screen for each network.
*
* You can use the default tokens as a starting point for your own list of tokens and override tokens for specific networks.
*
@@ -11,7 +11,7 @@ export type BloctoWalletConfigOptions = {
appId?: string;
/**
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal
*/
recommended?: boolean;
};
@@ -19,7 +19,7 @@ export type BloctoWalletConfigOptions = {
/**
* A wallet configurator for [Blocto Wallet](https://blocto.io/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -36,7 +36,7 @@ export type BloctoWalletConfigOptions = {
* To get advanced features and support from Blocto, you need to create an appId from [blocto dashboard](https://docs.blocto.app/blocto-sdk/register-app-id)
*
* #### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -23,7 +23,7 @@ export type Coin98WalletConfigOptions = {
/**
* A wallet configurator for [Coin98 Wallet](https://coin98.com/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -41,7 +41,7 @@ export type Coin98WalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -32,7 +32,7 @@ export type CoinbaseWalletConfigOptions = {
/**
* A wallet configurator for [Coinbase Wallet](https://www.coinbase.com/wallet) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -51,7 +51,7 @@ export type CoinbaseWalletConfigOptions = {
* The default is `"custom"`
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -26,7 +26,7 @@ export type CoreWalletConfigOptions = {
/**
* A wallet configurator for [Core Wallet](https://core.app/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -44,7 +44,7 @@ export type CoreWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -8,7 +8,7 @@ import { rainbowWallet } from "./rainbow/RainbowWallet";
import { phantomWallet } from "./phantom/phantomWallet";
/**
* The default wallets that are used by the `ThirdwebProvider` if no `supportedWallets` prop is provided.
* The default wallets that are used by the [`ThirdwebProvider`](https://portal.thirdweb.com/react/v4/ThirdwebProvider) if no `supportedWallets` prop is provided.
*
* The defaults wallets are:
* - Metamask
@@ -26,7 +26,7 @@ export type CryptoDefiWalletConfigOptions = {
/**
* A wallet configurator for [Crypto.com Defi Wallet](https://crypto.com/defi-wallet) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -44,7 +44,7 @@ export type CryptoDefiWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -32,9 +32,9 @@ const DEFAULT_AUTH_OPTIONS: AuthOption[] = [
/**
* A wallet configurator for [Embedded Wallet](https://portal.thirdweb.com/wallet/embedded-wallet) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* You can also connect this wallet using the `useEmbeddedWallet` hook
* You can also connect this wallet using the [`useEmbeddedWallet`](https://portal.thirdweb.com/references/react/v4/useEmbeddedWallet) hook
*
* @example
* ```ts
@@ -60,7 +60,7 @@ const DEFAULT_AUTH_OPTIONS: AuthOption[] = [
* ```
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* ### onAuthSuccess (optional)
* A callback function that will be called when the user successfully authenticates with the wallet. The callback is called with the `authResult` object
@@ -15,7 +15,7 @@ export type FrameWalletConfigOptions = {
/**
* A wallet configurator for [Frame Wallet](https://frame.sh/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -28,7 +28,7 @@ export type FrameWalletConfigOptions = {
* Optional object containing the following properties to configure the wallet
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -11,7 +11,7 @@ const phoneIcon = `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODA
/**
* A wallet configurator for Local wallet which allows integrating a "Guest Login" experience to app.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -56,7 +56,7 @@ export type MagicWalletConfigOptions = MagicLinkAdditionalOptions & {
/**
* A wallet configurator for [Magic Link](https://magic.link/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -148,7 +148,7 @@ export type MagicWalletConfigOptions = MagicLinkAdditionalOptions & {
* ```
*
* ### recommended (optional)
* Show this wallet as "recommended" in the `ConnectWallet` Modal UI
* Show this wallet as "recommended" in the [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -40,7 +40,7 @@ export type MetamaskWalletConfigOptions = {
/**
* A wallet configurator for [MetaMask Wallet](https://metamask.io/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -59,7 +59,7 @@ export type MetamaskWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* ### connectionMethod (optional)
* Specify how the connection to metamask app should be established if the user is on a mobile device.
@@ -23,7 +23,7 @@ export type OKXWalletConfigOptions = {
/**
* A wallet configurator for [OKX Wallet](https://www.okx.com/web3) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -41,7 +41,7 @@ export type OKXWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -23,7 +23,7 @@ export type OneKeyWalletConfigOptions = {
/**
* A wallet configurator for [Onekey Wallet](https://onekey.so/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -41,7 +41,7 @@ export type OneKeyWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -18,7 +18,7 @@ export type PhantomWalletConfigOptions = {
/**
* A wallet configurator for [Phantom Wallet](https://phantom.app/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -31,7 +31,7 @@ export type PhantomWalletConfigOptions = {
* Optional configuration options for the wallet
*
* ### recommended (optional)
* If `true`, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI. Default is `false`
* If `true`, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI. Default is `false`
*
* @wallet
*/
@@ -23,7 +23,7 @@ export type RabbyWalletConfigOptions = {
/**
* A wallet configurator for [Rabby Wallet](https://rabby.io/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -41,7 +41,7 @@ export type RabbyWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -28,7 +28,7 @@ export type RainbowWalletConfigOptions = {
/**
* A wallet configurator for [Rainbow Wallet](https://rainbow.me/en/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -46,7 +46,7 @@ export type RainbowWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -31,7 +31,7 @@ export type SafeWalletConfigOptions = {
/**
* A wallet configurator for [Safe](https://safe.global/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -48,10 +48,10 @@ export type SafeWalletConfigOptions = {
* Optional configuration options for the wallet
*
* ### personalWallets (optional)
* An array of personal wallets to show in `ConnectWallet` Modal for personal wallet selection
* An array of personal wallets to show in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal for personal wallet selection
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -10,9 +10,9 @@ import { SmartWalletConnecting } from "./SmartWalletConnecting";
import { HeadlessConnectUI } from "../headlessConnectUI";
/**
* A wallet configurator for [Smart Wallet](https://portal.thirdweb.com/wallet/smart-wallet) which allows integrating the wallet with React
* A wallet configurator for [Smart Wallet](https://portal.thirdweb.com/references/wallets/v2/SmartWallet) which allows integrating the wallet with React
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -26,7 +26,7 @@ import { HeadlessConnectUI } from "../headlessConnectUI";
* ```
*
* @param wallet -
* Provide a `WalletConfig` object to use as the personal wallet for the Smart Wallet.
* Provide a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object to use as the personal wallet for the Smart Wallet.
*
* You can get this object by calling a wallet configurator function such as `metamaskWallet()`
*
@@ -25,7 +25,7 @@ export type TrustWalletConfigOptions = {
/**
* A wallet configurator for [Trust Wallet](https://trustwallet.com/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -43,7 +43,7 @@ export type TrustWalletConfigOptions = {
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -44,7 +44,7 @@ export type walletConnectConfigOptions = {
/**
* A wallet configurator for [WalletConnect](https://walletconnect.com/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
@@ -76,7 +76,7 @@ export type walletConnectConfigOptions = {
* The [WalletConnect Modal options](https://docs.walletconnect.com/advanced/walletconnectmodal/options) to customize the official WalletConnect Modal.
*
* ### recommended (optional)
* If true, the wallet will be tagged as "recommended" in `ConnectWallet` Modal UI
* If true, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI
*
* @wallet
*/
@@ -25,7 +25,7 @@ export type ZerionkWalletConfigOptions = {
/**
* A wallet configurator for [Zerion Wallet](https://zerion.io/) which allows integrating the wallet with React.
*
* It returns a `WalletConfig` object which can be used to connect the wallet to via `ConnectWallet` component or `useConnect` hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/connecting-wallets) guide
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/sdk
## 4.0.25
### Patch Changes
- [#2119](https://github.com/thirdweb-dev/js/pull/2119) [`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc) Thanks [@MananTank](https://github.com/MananTank)! - Update Links to Docs website
## 4.0.24
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "4.0.24",
"version": "4.0.25",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
+1 -1
View File
@@ -252,7 +252,7 @@ export class AuctionHasNotEndedError extends Error {
export class ExtensionNotImplementedError extends Error {
constructor(feature: Feature) {
super(
`This functionality is not available because the contract does not implement the '${feature.name}' Extension. Learn how to unlock this functionality at https://portal.thirdweb.com/extensions `,
`This functionality is not available because the contract does not implement the '${feature.name}' Extension. Learn how to unlock this functionality at https://portal.thirdweb.com/contracts/build/extensions `,
);
}
}
+1 -1
View File
@@ -314,7 +314,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
get auth() {
throw new Error(
`The sdk.auth namespace has been moved to the @thirdweb-dev/auth package and is no longer available after @thirdweb-dev/sdk >= 3.7.0.
Please visit https://portal.thirdweb.com/auth for instructions on how to switch to using the new auth package (@thirdweb-dev/[email protected]).
Please visit https://portal.thirdweb.com/wallets/auth for instructions on how to switch to using the new auth package (@thirdweb-dev/[email protected]).
If you still want to use the old @thirdweb-dev/[email protected] package, you can downgrade the SDK to version 3.6.0.`,
);
+17
View File
@@ -1,5 +1,22 @@
# @thirdweb-dev/unity-js-bridge
## 0.3.5
### Patch Changes
- Updated dependencies [[`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f), [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb)]:
- @thirdweb-dev/wallets@2.4.0
- @thirdweb-dev/auth@4.1.22
## 0.3.4
### Patch Changes
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/wallets@2.3.4
- @thirdweb-dev/sdk@4.0.25
- @thirdweb-dev/auth@4.1.21
## 0.3.3
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.3.3",
"version": "0.3.5",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/wallets
## 2.4.0
### Minor Changes
- [#2098](https://github.com/thirdweb-dev/js/pull/2098) [`22571ba0`](https://github.com/thirdweb-dev/js/commit/22571ba0a9bd238f9ee16f548bc17ccad2e7ad1f) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - - Add options to override gasless per transaction
- Better userOp estimations
- Performance optimisations
### Patch Changes
- [#2125](https://github.com/thirdweb-dev/js/pull/2125) [`e66e9066`](https://github.com/thirdweb-dev/js/commit/e66e906650e04a63e084bc869a62681bd956e0bb) Thanks [@adam-maj](https://github.com/adam-maj)! - Add signTypedData to AwsKmsWallet
## 2.3.4
### Patch Changes
- [#2119](https://github.com/thirdweb-dev/js/pull/2119) [`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc) Thanks [@MananTank](https://github.com/MananTank)! - Update Links to Docs website
- Updated dependencies [[`cf606665`](https://github.com/thirdweb-dev/js/commit/cf606665fcfdad7b08259350d39b60313278a8dc)]:
- @thirdweb-dev/sdk@4.0.25
## 2.3.3
### Patch Changes
+9
View File
@@ -0,0 +1,9 @@
/* eslint-disable better-tree-shaking/no-top-level-side-effects */
require("@nomiclabs/hardhat-ethers");
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.7.3",
};
+11 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "2.3.3",
"version": "2.4.0",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"browser": {
@@ -478,8 +478,6 @@
"sideEffects": false,
"dependencies": {
"@account-abstraction/contracts": "^0.5.0",
"@account-abstraction/sdk": "^0.5.0",
"@account-abstraction/utils": "^0.5.0",
"@blocto/sdk": "^0.5.4",
"@coinbase/wallet-sdk": "^3.7.1",
"@google-cloud/kms": "3.0.1",
@@ -548,9 +546,11 @@
"@babel/plugin-transform-private-methods": "7.22.5",
"@microsoft/api-extractor": "^7.36.3",
"@noble/ed25519": "^1.7.1",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/bn.js": "^5.1.1",
"@types/jest": "^29.5.3",
"abitype": "^0.2.5",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"bs58": "^5.0.0",
@@ -561,7 +561,10 @@
"ethereum-provider": "^0.7.7",
"ethers": "^5.7.2",
"ethers-aws-kms-signer": "^1.3.2",
"hardhat": "^2.17.0",
"jest": "^29.6.2",
"rimraf": "^3.0.2",
"ts-jest": "^29.1.1",
"tweetnacl": "^1.0.3",
"typedoc-gen": "workspace:*",
"typescript": "^5.1.6"
@@ -574,9 +577,13 @@
"build": "tsc && cross-env THIRDWEB_EWS_SDK_VERSION=$npm_package_version preconstruct build",
"preconstruct:fix": "preconstruct fix",
"push": "yalc push",
"typedoc": "node scripts/typedoc.mjs"
"typedoc": "node scripts/typedoc.mjs",
"test": "jest"
},
"engines": {
"node": ">=18"
},
"jest": {
"testTimeout": 30000
}
}
@@ -9,11 +9,13 @@ import {
ProviderConfig,
SmartWalletConfig,
SmartWalletConnectionArgs,
TransactionOptions,
UserOpOptions,
} from "./types";
import { ENTRYPOINT_ADDRESS } from "./lib/constants";
import { EVMWallet } from "../../interfaces";
import { ERC4337EthersSigner } from "./lib/erc4337-signer";
import { BigNumber, ethers, providers, utils } from "ethers";
import { BigNumber, constants, ethers, providers, utils } from "ethers";
import {
getChainProvider,
getGasPrice,
@@ -25,9 +27,7 @@ import {
TransactionResult,
} from "@thirdweb-dev/sdk";
import { AccountAPI } from "./lib/account";
import { AddressZero } from "@account-abstraction/utils";
import { TransactionDetailsForUserOp } from "./lib/transaction-details";
import { BatchData } from "./lib/base-api";
export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
protected config: SmartWalletConfig;
@@ -52,7 +52,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
this.config.bundlerUrl || `https://${this.chainId}.bundler.thirdweb.com`;
const paymasterUrl =
this.config.paymasterUrl ||
`https://${this.chainId}.bundler.thirdweb.com`;
`https://${this.chainId}.bundler.thirdweb.com/v2`;
const entryPointAddress = config.entryPointAddress || ENTRYPOINT_ADDRESS;
const localSigner = await params.personalWallet.getSigner();
const providerConfig: ProviderConfig = {
@@ -60,16 +60,15 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
localSigner,
entryPointAddress,
bundlerUrl,
paymasterAPI: this.config.gasless
paymasterAPI: this.config.paymasterAPI
? this.config.paymasterAPI
? this.config.paymasterAPI
: getVerifyingPaymaster(
paymasterUrl,
entryPointAddress,
this.config.clientId,
this.config.secretKey,
)
: undefined,
: getVerifyingPaymaster(
paymasterUrl,
entryPointAddress,
this.config.clientId,
this.config.secretKey,
),
gasless: config.gasless,
factoryAddress: config.factoryAddress,
accountAddress: params.accountAddress,
factoryInfo: config.factoryInfo || this.defaultFactoryInfo(),
@@ -172,16 +171,23 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
/**
* Send a single transaction without waiting for confirmations
* @param transaction - The transaction to send
* @param transaction - the transaction to send
* @param config - optional the transaction configuration
* @returns The awaitable transaction
*/
async send(transaction: Transaction): Promise<providers.TransactionResponse> {
async send(
transaction: Transaction,
options?: TransactionOptions,
): Promise<providers.TransactionResponse> {
const signer = await this.getSigner();
return signer.sendTransaction({
to: transaction.getTarget(),
data: transaction.encode(),
value: await transaction.getValue(),
});
return signer.sendTransaction(
{
to: transaction.getTarget(),
data: transaction.encode(),
value: await transaction.getValue(),
},
options,
);
}
/**
@@ -189,8 +195,11 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
* @param transaction - The transaction to execute
* @returns The transaction receipt
*/
async execute(transaction: Transaction): Promise<TransactionResult> {
const tx = await this.send(transaction);
async execute(
transaction: Transaction,
options?: TransactionOptions,
): Promise<TransactionResult> {
const tx = await this.send(transaction, options);
const receipt = await tx.wait();
return {
receipt,
@@ -199,6 +208,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
async sendBatch(
transactions: Transaction<any>[],
options?: TransactionOptions,
): Promise<providers.TransactionResponse> {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
@@ -211,7 +221,10 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
data: tx.encode(),
value: 0,
},
batchData,
{
...options,
batchData,
},
);
}
@@ -222,8 +235,9 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
*/
async executeBatch(
transactions: Transaction<any>[],
options?: TransactionOptions,
): Promise<TransactionResult> {
const tx = await this.sendBatch(transactions);
const tx = await this.sendBatch(transactions, options);
const receipt = await tx.wait();
return {
receipt,
@@ -234,18 +248,20 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
async sendRaw(
transaction: utils.Deferrable<providers.TransactionRequest>,
options?: TransactionOptions,
): Promise<providers.TransactionResponse> {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
}
const signer = await this.getSigner();
return signer.sendTransaction(transaction);
return signer.sendTransaction(transaction, options);
}
async executeRaw(
transaction: utils.Deferrable<providers.TransactionRequest>,
options?: TransactionOptions,
) {
const tx = await this.sendRaw(transaction);
const tx = await this.sendRaw(transaction, options);
const receipt = await tx.wait();
return {
receipt,
@@ -254,6 +270,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
async sendBatchRaw(
transactions: utils.Deferrable<providers.TransactionRequest>[],
options?: TransactionOptions,
) {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
@@ -266,14 +283,18 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
data: batch.tx.encode(),
value: 0,
},
batch.batchData, // batched tx flag
{
...options,
batchData: batch.batchData, // batched tx flag
},
);
}
async executeBatchRaw(
transactions: utils.Deferrable<providers.TransactionRequest>[],
options?: TransactionOptions,
) {
const tx = await this.sendBatchRaw(transactions);
const tx = await this.sendBatchRaw(transactions, options);
const receipt = await tx.wait();
return {
receipt,
@@ -282,32 +303,51 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
/// ESTIMATION
async estimate(transaction: Transaction) {
async estimate(transaction: Transaction, options?: TransactionOptions) {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
}
return this.estimateTx({
target: transaction.getTarget(),
data: transaction.encode(),
value: await transaction.getValue(),
});
return this.estimateTx(
{
target: transaction.getTarget(),
data: transaction.encode(),
value: await transaction.getValue(),
gasLimit: await transaction.getOverrides().gasLimit,
maxFeePerGas: await transaction.getOverrides().maxFeePerGas,
maxPriorityFeePerGas: await transaction.getOverrides()
.maxPriorityFeePerGas,
nonce: await transaction.getOverrides().nonce,
},
options,
);
}
async estimateRaw(
transaction: utils.Deferrable<providers.TransactionRequest>,
options?: TransactionOptions,
) {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
}
const tx = await ethers.utils.resolveProperties(transaction);
return this.estimateTx({
target: tx.to || AddressZero,
data: tx.data?.toString() || "",
value: tx.value || BigNumber.from(0),
});
return this.estimateTx(
{
target: tx.to || constants.AddressZero,
data: tx.data?.toString() || "",
value: tx.value || BigNumber.from(0),
gasLimit: tx.gasLimit,
maxFeePerGas: tx.maxFeePerGas,
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
nonce: tx.nonce,
},
options,
);
}
async estimateBatch(transactions: Transaction<any>[]) {
async estimateBatch(
transactions: Transaction<any>[],
options?: TransactionOptions,
) {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
}
@@ -317,13 +357,21 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
target: tx.getTarget(),
data: tx.encode(),
value: await tx.getValue(),
gasLimit: await tx.getOverrides().gasLimit,
maxFeePerGas: await tx.getOverrides().maxFeePerGas,
maxPriorityFeePerGas: await tx.getOverrides().maxPriorityFeePerGas,
nonce: await tx.getOverrides().nonce,
},
{
...options,
batchData,
},
batchData,
);
}
async estimateBatchRaw(
transactions: utils.Deferrable<providers.TransactionRequest>[],
options?: TransactionOptions,
) {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
@@ -334,8 +382,15 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
target: tx.getTarget(),
data: tx.encode(),
value: await tx.getValue(),
gasLimit: await tx.getOverrides().gasLimit,
maxFeePerGas: await tx.getOverrides().maxFeePerGas,
maxPriorityFeePerGas: await tx.getOverrides().maxPriorityFeePerGas,
nonce: await tx.getOverrides().nonce,
},
{
...options,
batchData,
},
batchData,
);
}
@@ -346,7 +401,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
* Note that this is not necessary as the smart wallet will be deployed automatically on the first transaction the user makes.
* @returns The transaction receipt
*/
async deploy(): Promise<TransactionResult> {
async deploy(options?: TransactionOptions): Promise<TransactionResult> {
if (!this.accountApi) {
throw new Error("Personal wallet not connected");
}
@@ -357,10 +412,13 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
data: "0x",
},
{
targets: [],
data: [],
values: [],
}, // batched tx flag to avoid hitting the Router fallback method
...options,
batchData: {
targets: [],
data: [],
values: [],
}, // batched tx flag to avoid hitting the Router fallback method
},
);
const receipt = await tx.wait();
return { receipt };
@@ -377,10 +435,10 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
return await this.accountApi.isAcountDeployed();
}
async deployIfNeeded(): Promise<void> {
async deployIfNeeded(options?: TransactionOptions): Promise<void> {
const isDeployed = await this.isDeployed();
if (!isDeployed) {
await this.deploy();
await this.deploy(options);
}
}
@@ -523,9 +581,9 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
private async estimateTx(
tx: TransactionDetailsForUserOp,
batchData?: BatchData,
options?: UserOpOptions,
) {
if (!this.accountApi) {
if (!this.accountApi || !this.aaProvider) {
throw new Error("Personal wallet not connected");
}
let deployGasLimit = BigNumber.from(0);
@@ -536,12 +594,16 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
if (!isDeployed) {
deployGasLimit = await this.estimateDeploymentGasLimit();
}
const [{ callGasLimit: transactionGasLimit }, gasPrice] = await Promise.all(
[
this.accountApi.encodeUserOpCallDataAndGasLimit(tx, batchData),
getGasPrice(provider),
],
);
const [userOp, gasPrice] = await Promise.all([
this.accountApi.createUnsignedUserOp(
this.aaProvider.httpRpcClient,
tx,
options,
),
getGasPrice(provider),
]);
const resolved = await utils.resolveProperties(userOp);
const transactionGasLimit = BigNumber.from(resolved.callGasLimit);
const transactionCost = transactionGasLimit.mul(gasPrice);
const deployCost = deployGasLimit.mul(gasPrice);
const totalCost = deployCost.add(transactionCost);
@@ -583,7 +645,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
ethers.utils.resolveProperties(transaction),
),
);
const targets = resolvedTxs.map((tx) => tx.to || AddressZero);
const targets = resolvedTxs.map((tx) => tx.to || constants.AddressZero);
const data = resolvedTxs.map((tx) => tx.data || "0x");
const values = resolvedTxs.map((tx) => tx.value || BigNumber.from(0));
return {
@@ -5,18 +5,18 @@ import {
Transaction,
} from "@thirdweb-dev/sdk";
import { BigNumberish, BigNumber, ethers, utils, BytesLike } from "ethers";
import { AccountApiParams } from "../types";
import { ProviderConfig } from "../types";
import { BaseAccountAPI } from "./base-api";
import { ACCOUNT_CORE_ABI } from "./constants";
export class AccountAPI extends BaseAccountAPI {
sdk: ThirdwebSDK;
params: AccountApiParams;
params: ProviderConfig;
accountContract?: SmartContract;
factoryContract?: SmartContract;
constructor(
params: AccountApiParams,
params: ProviderConfig,
originalProvider: ethers.providers.Provider,
) {
super({
@@ -30,6 +30,9 @@ export class AccountAPI extends BaseAccountAPI {
this.sdk = ThirdwebSDK.fromPrivateKey(LOCAL_NODE_PKEY, params.chain, {
clientId: params.clientId,
secretKey: params.secretKey,
// @ts-expect-error expected chain type error
supportedChains:
typeof params.chain === "object" ? [params.chain] : undefined,
});
}
@@ -1,51 +1,23 @@
import {
ethers,
BigNumber,
BigNumberish,
providers,
utils,
BytesLike,
} from "ethers";
import { ethers, BigNumber, BigNumberish, providers } from "ethers";
import {
EntryPoint,
EntryPoint__factory,
UserOperationStruct,
} from "@account-abstraction/contracts";
import { NotPromise, packUserOp } from "@account-abstraction/utils";
import {
GasOverheads,
PaymasterAPI,
calcPreVerificationGas,
} from "@account-abstraction/sdk";
import { TransactionDetailsForUserOp } from "./transaction-details";
import { getUserOpHashV06 } from "./utils";
import { DUMMY_PAYMASTER_AND_DATA, SIG_SIZE } from "./paymaster";
import {
CeloAlfajoresTestnet,
CeloBaklavaTestnet,
Celo,
} from "@thirdweb-dev/chains";
import { Transaction, getDynamicFeeData } from "@thirdweb-dev/sdk";
import { HttpRpcClient } from "./http-rpc-client";
import type { BaseApiParams, PaymasterAPI, UserOpOptions } from "../types";
export type BatchData = {
targets: (string | undefined)[];
data: BytesLike[];
values: BigNumberish[];
};
export interface BaseApiParams {
provider: providers.Provider;
entryPointAddress: string;
accountAddress?: string;
overheads?: Partial<GasOverheads>;
paymasterAPI?: PaymasterAPI;
}
export interface UserOpResult {
transactionHash: string;
success: boolean;
}
const DUMMY_SIGNATURE =
"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
/**
* Base class for all Smart Wallet ERC-4337 Clients to implement.
@@ -67,10 +39,10 @@ export abstract class BaseAccountAPI {
private readonly entryPointView: EntryPoint;
provider: providers.Provider;
overheads?: Partial<GasOverheads>;
entryPointAddress: string;
paymasterAPI: PaymasterAPI;
accountAddress?: string;
paymasterAPI?: PaymasterAPI;
gasless?: boolean;
/**
* base constructor.
@@ -78,10 +50,10 @@ export abstract class BaseAccountAPI {
*/
protected constructor(params: BaseApiParams) {
this.provider = params.provider;
this.overheads = params.overheads;
this.entryPointAddress = params.entryPointAddress;
this.accountAddress = params.accountAddress;
this.paymasterAPI = params.paymasterAPI;
this.gasless = params.gasless;
// factory "connect" define the contract address. the contract "connect" defines the "from" address.
this.entryPointView = EntryPoint__factory.connect(
@@ -160,85 +132,6 @@ export abstract class BaseAccountAPI {
return 100000;
}
/**
* should cover cost of putting calldata on-chain, and some overhead.
* actual overhead depends on the expected bundle size
*/
async getPreVerificationGas(
userOp: Partial<UserOperationStruct>,
): Promise<number> {
const p = await utils.resolveProperties(userOp);
return calcPreVerificationGas(p, this.overheads);
}
/**
* ABI-encode a user operation. used for calldata cost estimation
*/
packUserOp(userOp: NotPromise<UserOperationStruct>): string {
return packUserOp(userOp, false);
}
async encodeUserOpCallDataAndGasLimit(
detailsForUserOp: TransactionDetailsForUserOp,
batchData?: BatchData,
): Promise<{ callData: string; callGasLimit: BigNumber }> {
const value = parseNumber(detailsForUserOp.value) ?? BigNumber.from(0);
const callData = batchData
? detailsForUserOp.data
: await this.prepareExecute(
detailsForUserOp.target,
value,
detailsForUserOp.data,
).then((tx) => tx.encode());
let callGasLimit: BigNumber;
const isPhantom = await this.checkAccountPhantom();
if (isPhantom) {
// when the account is not deployed yet, we simulate the call to the target contract directly
if (batchData) {
const limits = await Promise.all(
batchData.targets.map((_, i) =>
this.provider.estimateGas({
from: this.getAccountAddress(),
to: batchData.targets[i],
data: batchData.data[i],
value: batchData.values[i],
}),
),
);
callGasLimit = limits.reduce((a, b) => a.add(b), BigNumber.from(0));
} else {
callGasLimit = await this.provider.estimateGas({
from: this.getAccountAddress(),
to: detailsForUserOp.target,
data: detailsForUserOp.data,
value: detailsForUserOp.value,
});
}
// add 20% overhead for entrypoint checks
callGasLimit = callGasLimit.mul(120).div(100);
// if the estimation is too low, we use a fixed value of 500k
if (callGasLimit.lt(30000)) {
callGasLimit = BigNumber.from(500000);
}
} else {
callGasLimit =
parseNumber(detailsForUserOp.gasLimit) ??
(await this.provider.estimateGas({
from: this.entryPointAddress,
to: this.getAccountAddress(),
data: callData,
value: detailsForUserOp.value,
}));
}
return {
callData,
callGasLimit,
};
}
/**
* return userOpHash for signing.
* This value matches entryPoint.getUserOpHash (calculated off-chain, to avoid a view call)
@@ -276,25 +169,19 @@ export abstract class BaseAccountAPI {
});
}
/**
* create a UserOperation, filling all details (except signature)
* - if account is not yet created, add initCode to deploy it.
* - if gas or nonce are missing, read them from the chain (note that we can't fill gaslimit before the account is created)
* @param info - transaction details for the userOp
*/
async createUnsignedUserOp(
httpRpcClient: HttpRpcClient,
info: TransactionDetailsForUserOp,
batchData?: BatchData,
options?: UserOpOptions,
): Promise<UserOperationStruct> {
const { callData, callGasLimit } =
await this.encodeUserOpCallDataAndGasLimit(info, batchData);
// construct the userOp without gasLimit or preVerifictaionGas
const initCode = await this.getInitCode();
const initGas = await this.estimateCreationGas(initCode);
const verificationGasLimit = BigNumber.from(
await this.getVerificationGasLimit(),
).add(initGas);
const value = parseNumber(info.value) ?? BigNumber.from(0);
const callData = options?.batchData
? info.data
: await this.prepareExecute(info.target, value, info.data).then((tx) =>
tx.encode(),
);
let { maxFeePerGas, maxPriorityFeePerGas } = info;
if (!maxFeePerGas || !maxPriorityFeePerGas) {
const feeData = await getDynamicFeeData(
@@ -305,7 +192,6 @@ export abstract class BaseAccountAPI {
}
if (!maxFeePerGas) {
maxFeePerGas = feeData.maxFeePerGas ?? undefined;
maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? undefined;
const network = await this.provider.getNetwork();
const chainId = network.chainId;
@@ -318,69 +204,101 @@ export abstract class BaseAccountAPI {
}
}
}
const partialUserOp: any = {
sender: this.getAccountAddress(),
nonce: info.nonce ?? this.getNonce(),
if (!maxFeePerGas || !maxPriorityFeePerGas) {
throw new Error(
"maxFeePerGas or maxPriorityFeePerGas could not be calculated, please pass them explicitely",
);
}
const [sender, nonce] = await Promise.all([
this.getAccountAddress(),
info.nonce ? Promise.resolve(info.nonce) : this.getNonce(),
]);
const partialOp: UserOperationStruct = {
sender,
nonce,
initCode,
callData,
callGasLimit,
verificationGasLimit,
maxFeePerGas,
maxPriorityFeePerGas,
callGasLimit: BigNumber.from(1000000),
verificationGasLimit: BigNumber.from(1000000),
preVerificationGas: BigNumber.from(1000000),
paymasterAndData: "0x",
signature: DUMMY_SIGNATURE,
};
let paymasterAndData: string | undefined;
let userOp = partialUserOp;
if (this.paymasterAPI) {
// fill (partial) preVerificationGas (all except the cost of the generated paymasterAndData)
try {
// userOp.preVerificationGas contains a promise that will resolve to an error.
await ethers.utils.resolveProperties(userOp);
// eslint-disable-next-line no-empty
} catch (_) {}
const pmOp: Partial<UserOperationStruct> = {
sender: userOp.sender,
nonce: userOp.nonce,
initCode: userOp.initCode,
callData: userOp.callData,
callGasLimit: userOp.callGasLimit,
verificationGasLimit: userOp.verificationGasLimit,
maxFeePerGas: userOp.maxFeePerGas,
maxPriorityFeePerGas: userOp.maxPriorityFeePerGas,
// A dummy value here is required in order to calculate a correct preVerificationGas value.
paymasterAndData: DUMMY_PAYMASTER_AND_DATA,
signature: ethers.utils.hexlify(Buffer.alloc(SIG_SIZE, 1)),
};
userOp = await ethers.utils.resolveProperties(pmOp);
const preVerificationGas = calcPreVerificationGas(userOp);
userOp.preVerificationGas = preVerificationGas;
paymasterAndData = await this.paymasterAPI.getPaymasterAndData(userOp);
if (paymasterAndData === "0x") {
paymasterAndData = undefined;
// paymaster data + maybe used for estimation as well
const gasless =
options?.gasless !== undefined ? options.gasless : this.gasless;
if (gasless) {
const paymasterResult = await this.paymasterAPI.getPaymasterAndData(
partialOp,
);
const paymasterAndData = paymasterResult.paymasterAndData;
if (paymasterAndData && paymasterAndData !== "0x") {
partialOp.paymasterAndData = paymasterAndData;
}
// paymaster can have the gas limits in the response
if (
paymasterResult.callGasLimit &&
paymasterResult.verificationGasLimit &&
paymasterResult.preVerificationGas
) {
partialOp.callGasLimit = BigNumber.from(paymasterResult.callGasLimit);
partialOp.verificationGasLimit = BigNumber.from(
paymasterResult.verificationGasLimit,
);
partialOp.preVerificationGas = BigNumber.from(
paymasterResult.preVerificationGas,
);
} else {
// otherwise fallback to bundler for gas limits
let estimates;
try {
estimates = await httpRpcClient.estimateUserOpGas(partialOp);
} catch (error: any) {
throw this.unwrapBundlerError(error);
}
partialOp.callGasLimit = BigNumber.from(estimates.callGasLimit);
partialOp.verificationGasLimit = BigNumber.from(
estimates.verificationGasLimit,
);
partialOp.preVerificationGas = BigNumber.from(
estimates.preVerificationGas,
);
// need paymaster to re-sign after estimates
const paymasterResult2 = await this.paymasterAPI.getPaymasterAndData(
partialOp,
);
if (
paymasterResult2.paymasterAndData &&
paymasterResult2.paymasterAndData !== "0x"
) {
partialOp.paymasterAndData = paymasterResult2.paymasterAndData;
}
}
} else {
// query bundler for gas limits
let estimates;
try {
estimates = await httpRpcClient.estimateUserOpGas(partialOp);
} catch (error: any) {
throw this.unwrapBundlerError(error);
}
partialOp.callGasLimit = BigNumber.from(estimates.callGasLimit);
partialOp.verificationGasLimit = BigNumber.from(
estimates.verificationGasLimit,
);
partialOp.preVerificationGas = BigNumber.from(
estimates.preVerificationGas,
);
}
if (paymasterAndData) {
userOp.paymasterAndData = paymasterAndData;
return {
...userOp,
signature: "",
};
} else {
const modifiedOp = {
...userOp,
paymasterAndData: "0x",
};
modifiedOp.preVerificationGas = await this.getPreVerificationGas(
modifiedOp,
);
return {
...modifiedOp,
signature: "",
};
}
return {
...partialOp,
signature: "",
};
}
/**
@@ -396,19 +314,6 @@ export abstract class BaseAccountAPI {
};
}
/**
* helper method: create and sign a user operation.
* @param info - transaction details for the userOp
*/
async createSignedUserOp(
info: TransactionDetailsForUserOp,
batchData?: BatchData,
): Promise<UserOperationStruct> {
return await this.signUserOp(
await this.createUnsignedUserOp(info, batchData),
);
}
/**
* get the transaction that has this userOpHash mined, or null if not found
* @param userOpHash - returned by sendUserOpToBundler (or by getUserOpHash..)
@@ -433,6 +338,12 @@ export abstract class BaseAccountAPI {
}
return null;
}
private unwrapBundlerError(error: any) {
const message =
error?.error?.message || error.error || error.message || error;
return new Error(message);
}
}
function parseNumber(a: any): BigNumber | null {
@@ -4,18 +4,18 @@ import {
EntryPoint,
UserOperationStruct,
} from "@account-abstraction/contracts";
import { ClientConfig } from "@account-abstraction/sdk";
import { UserOperationEventListener } from "./userop-event";
import { BaseAccountAPI } from "./base-api";
import { ERC4337EthersSigner } from "./erc4337-signer";
import { HttpRpcClient } from "./http-rpc-client";
import { ProviderConfig } from "../types";
export class ERC4337EthersProvider extends providers.BaseProvider {
readonly signer: ERC4337EthersSigner;
constructor(
readonly chainId: number,
readonly config: ClientConfig,
readonly config: ProviderConfig,
readonly originalSigner: Signer,
readonly originalProvider: providers.BaseProvider,
readonly httpRpcClient: HttpRpcClient,
@@ -46,15 +46,8 @@ export class ERC4337EthersProvider extends providers.BaseProvider {
throw new Error("Should not get here. Investigate.");
}
if (method === "estimateGas") {
// hijack this to estimate gas from the entrypoint instead
const { callGasLimit } =
await this.smartAccountAPI.encodeUserOpCallDataAndGasLimit({
target: params.transaction.to,
data: params.transaction.data,
value: params.transaction.value,
gasLimit: params.transaction.gasLimit,
});
return callGasLimit;
// gas estimation does nothing at this layer, sendTransaction will do the gas estimation for the userOp
return BigNumber.from(500000);
}
return await this.originalProvider.perform(method, params);
}
@@ -1,15 +1,14 @@
import { ethers, providers, utils } from "ethers";
import { Bytes, Signer } from "ethers";
import { ClientConfig } from "@account-abstraction/sdk";
import { BaseAccountAPI, BatchData } from "./base-api";
import { BaseAccountAPI } from "./base-api";
import type { ERC4337EthersProvider } from "./erc4337-provider";
import { HttpRpcClient } from "./http-rpc-client";
import { randomNonce } from "./utils";
import { deepHexlify } from "@account-abstraction/utils";
import { hexlifyUserOp, randomNonce } from "./utils";
import { ProviderConfig, UserOpOptions } from "../types";
export class ERC4337EthersSigner extends Signer {
config: ClientConfig;
config: ProviderConfig;
originalSigner: Signer;
erc4337provider: ERC4337EthersProvider;
httpRpcClient: HttpRpcClient;
@@ -17,7 +16,7 @@ export class ERC4337EthersSigner extends Signer {
// TODO: we have 'erc4337provider', remove shared dependencies or avoid two-way reference
constructor(
config: ClientConfig,
config: ProviderConfig,
originalSigner: Signer,
erc4337provider: ERC4337EthersProvider,
httpRpcClient: HttpRpcClient,
@@ -37,22 +36,26 @@ export class ERC4337EthersSigner extends Signer {
// This one is called by Contract. It signs the request and passes in to Provider to be sent.
async sendTransaction(
transaction: utils.Deferrable<providers.TransactionRequest>,
batchData?: BatchData,
options?: UserOpOptions,
): Promise<providers.TransactionResponse> {
const tx = await ethers.utils.resolveProperties(transaction);
await this.verifyAllNecessaryFields(tx);
const multidimensionalNonce = randomNonce();
const userOperation = await this.smartAccountAPI.createSignedUserOp(
const unsigned = await this.smartAccountAPI.createUnsignedUserOp(
this.httpRpcClient,
{
target: tx.to || "",
data: tx.data?.toString() || "0x",
value: tx.value,
gasLimit: tx.gasLimit,
nonce: multidimensionalNonce,
maxFeePerGas: tx.maxFeePerGas,
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
},
batchData,
options,
);
const userOperation = await this.smartAccountAPI.signUserOp(unsigned);
const transactionResponse =
await this.erc4337provider.constructUserOpTransactionResponse(
@@ -152,13 +155,14 @@ Code: ${errorCode}`;
async signTransaction(
transaction: utils.Deferrable<providers.TransactionRequest>,
batchData?: BatchData,
options?: UserOpOptions,
): Promise<string> {
const tx = await ethers.utils.resolveProperties(transaction);
await this.verifyAllNecessaryFields(tx);
const multidimensionalNonce = randomNonce();
const userOperation = await this.smartAccountAPI.createSignedUserOp(
const unsigned = await this.smartAccountAPI.createUnsignedUserOp(
this.httpRpcClient,
{
target: tx.to || "",
data: tx.data?.toString() || "0x",
@@ -166,12 +170,11 @@ Code: ${errorCode}`;
gasLimit: tx.gasLimit,
nonce: multidimensionalNonce,
},
batchData,
options,
);
const userOperation = await this.smartAccountAPI.signUserOp(unsigned);
const userOpString = JSON.stringify(
deepHexlify(await utils.resolveProperties(userOperation)),
);
const userOpString = JSON.stringify(await hexlifyUserOp(userOperation));
return userOpString;
}
}
@@ -1,10 +1,10 @@
import { providers, utils } from "ethers";
import { UserOperationStruct } from "@account-abstraction/contracts";
import { deepHexlify } from "@account-abstraction/utils";
import { isTwUrl } from "../../../utils/url";
import pkg from "../../../../../package.json";
import { hexlifyUserOp } from "./utils";
const DEBUG = false;
export const DEBUG = false; // TODO set as public flag
function isBrowser() {
return typeof window !== "undefined";
}
@@ -111,7 +111,7 @@ export class HttpRpcClient {
*/
async sendUserOpToBundler(userOp1: UserOperationStruct): Promise<string> {
await this.initializing;
const hexifiedUserOp = deepHexlify(await utils.resolveProperties(userOp1));
const hexifiedUserOp = await hexlifyUserOp(userOp1);
const jsonRequestData: [UserOperationStruct, string] = [
hexifiedUserOp,
this.entryPointAddress,
@@ -123,11 +123,14 @@ export class HttpRpcClient {
]);
}
async estimateUserOpGas(
userOp1: Partial<UserOperationStruct>,
): Promise<string> {
async estimateUserOpGas(userOp1: Partial<UserOperationStruct>): Promise<{
preVerificationGas: string;
verificationGas: string;
verificationGasLimit: string;
callGasLimit: string;
}> {
await this.initializing;
const hexifiedUserOp = deepHexlify(await utils.resolveProperties(userOp1));
const hexifiedUserOp = await hexlifyUserOp(userOp1);
const jsonRequestData: [UserOperationStruct, string] = [
hexifiedUserOp,
this.entryPointAddress,
@@ -1,8 +1,8 @@
import { PaymasterAPI } from "@account-abstraction/sdk";
import { UserOperationStruct } from "@account-abstraction/contracts";
import { toJSON } from "./utils";
import { hexlifyUserOp } from "./utils";
import { isTwUrl } from "../../../utils/url";
import { PaymasterAPI, PaymasterResult } from "../types";
import { DEBUG } from "./http-rpc-client";
export const SIG_SIZE = 65;
export const DUMMY_PAYMASTER_AND_DATA =
@@ -28,7 +28,7 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
async getPaymasterAndData(
userOp: Partial<UserOperationStruct>,
): Promise<string> {
): Promise<PaymasterResult> {
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
@@ -85,7 +85,7 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
jsonrpc: "2.0",
id: 1,
method: "pm_sponsorUserOperation",
params: [await toJSON(userOp), { entryPoint: this.entryPoint }],
params: [await hexlifyUserOp(userOp), this.entryPoint],
}),
});
const res = await response.json();
@@ -101,11 +101,26 @@ Code: ${code}`,
);
}
if (DEBUG) {
console.debug("Paymaster result:", res);
}
if (res.result) {
const result = (res.result as any).paymasterAndData || res.result;
return result.toString();
// some paymasters return a string, some return an object with more data
if (typeof res.result === "string") {
return {
paymasterAndData: res.result,
};
} else {
return res.result as PaymasterResult;
}
} else {
throw new Error(`Paymaster returned no result from ${this.paymasterUrl}`);
const error =
res.error?.message ||
res.error ||
response.statusText ||
"unknown error";
throw new Error(`Paymaster error from ${this.paymasterUrl}: ${error}`);
}
}
}

Some files were not shown because too many files have changed in this diff Show More