Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b5e344f72 | ||
|
|
010955ff5c | ||
|
|
956b5645e4 | ||
|
|
068db44603 | ||
|
|
dd7d0fca2d | ||
|
|
526176c471 | ||
|
|
09120c923c | ||
|
|
d1f8e95162 | ||
|
|
6573556d0e | ||
|
|
fc62b91ee5 | ||
|
|
08e9cd206b | ||
|
|
fb0f12ae28 |
@@ -1,5 +1,19 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
|
||||||
## 4.0.2
|
## 4.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "4.0.2",
|
"version": "4.0.4",
|
||||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.13.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/auth@4.0.4
|
||||||
|
|
||||||
|
## 0.13.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
- @thirdweb-dev/auth@4.0.3
|
||||||
|
|
||||||
## 0.13.2
|
## 0.13.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "thirdweb",
|
"name": "thirdweb",
|
||||||
"main": "dist/cli/index.js",
|
"main": "dist/cli/index.js",
|
||||||
"version": "0.13.2",
|
"version": "0.13.4",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/contracts-js
|
# @thirdweb-dev/contracts-js
|
||||||
|
|
||||||
|
## 1.3.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1756](https://github.com/thirdweb-dev/js/pull/1756) [`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Enable adding smart wallet admins via bundler for new account contracts
|
||||||
|
|
||||||
## 1.3.14
|
## 1.3.14
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/contracts-js",
|
"name": "@thirdweb-dev/contracts-js",
|
||||||
"version": "1.3.14",
|
"version": "1.3.15",
|
||||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@thirdweb-dev/contracts": "3.10.2-3"
|
"@thirdweb-dev/contracts": "3.10.3-1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.22.9",
|
"@babel/preset-env": "^7.22.9",
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/auth@4.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1758](https://github.com/thirdweb-dev/js/pull/1758) [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add pagination to useOwnedNFTs
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
- @thirdweb-dev/auth@4.0.3
|
||||||
|
|
||||||
## 4.0.2
|
## 4.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "4.0.2",
|
"version": "4.0.4",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -225,11 +225,12 @@ export function useTotalCirculatingSupply(
|
|||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* const { data: ownedNFTs, isLoading, error } = useOwnedNFTs(contract, "{{wallet_address}}");
|
* const { data: ownedNFTs, isLoading, error } = useOwnedNFTs(contract, "{{wallet_address}}", { start: 0, count: 100 });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param contract - an instance of a {@link NFTContract}
|
* @param contract - an instance of a {@link NFTContract}
|
||||||
* @param ownerWalletAddress - the wallet address to get owned tokens for
|
* @param ownerWalletAddress - the wallet address to get owned tokens for
|
||||||
|
* @param queryParams - query params to pass to the query for pagination
|
||||||
* @returns a response object that includes the list of owned tokens
|
* @returns a response object that includes the list of owned tokens
|
||||||
* @beta
|
* @beta
|
||||||
* @twfeature ERC721Enumerable | ERC1155Enumerable | ERC721Supply
|
* @twfeature ERC721Enumerable | ERC1155Enumerable | ERC721Supply
|
||||||
@@ -238,6 +239,7 @@ export function useTotalCirculatingSupply(
|
|||||||
export function useOwnedNFTs<TContract extends NFTContract>(
|
export function useOwnedNFTs<TContract extends NFTContract>(
|
||||||
contract: RequiredParam<TContract>,
|
contract: RequiredParam<TContract>,
|
||||||
ownerWalletAddress: RequiredParam<WalletAddress>,
|
ownerWalletAddress: RequiredParam<WalletAddress>,
|
||||||
|
queryParams?: QueryAllParams,
|
||||||
) {
|
) {
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
const { erc721, erc1155 } = getErcs(contract);
|
const { erc721, erc1155 } = getErcs(contract);
|
||||||
@@ -248,10 +250,10 @@ export function useOwnedNFTs<TContract extends NFTContract>(
|
|||||||
requiredParamInvariant(contract, "No Contract instance provided");
|
requiredParamInvariant(contract, "No Contract instance provided");
|
||||||
invariant(ownerWalletAddress, "No wallet address provided");
|
invariant(ownerWalletAddress, "No wallet address provided");
|
||||||
if (erc721) {
|
if (erc721) {
|
||||||
return await erc721.getOwned(ownerWalletAddress);
|
return await erc721.getOwned(ownerWalletAddress, queryParams);
|
||||||
}
|
}
|
||||||
if (erc1155) {
|
if (erc1155) {
|
||||||
return await erc1155.getOwned(ownerWalletAddress);
|
return await erc1155.getOwned(ownerWalletAddress, queryParams);
|
||||||
}
|
}
|
||||||
invariant(false, "Unknown NFT type");
|
invariant(false, "Unknown NFT type");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.3.9
|
||||||
|
|
||||||
|
## 0.3.8
|
||||||
|
|
||||||
## 0.3.7
|
## 0.3.7
|
||||||
|
|
||||||
## 0.3.6
|
## 0.3.6
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native-compat",
|
"name": "@thirdweb-dev/react-native-compat",
|
||||||
"description": "Shims for Thirdweb in React Native Projects",
|
"description": "Shims for Thirdweb in React Native Projects",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,5 +1,47 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.3.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/react-core@4.0.4
|
||||||
|
|
||||||
|
## 0.3.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1724](https://github.com/thirdweb-dev/js/pull/1724) [`fc62b91e`](https://github.com/thirdweb-dev/js/commit/fc62b91ee55b0adba01298f33b21352004d1b71d) Thanks [@iketw](https://github.com/iketw)! - Adds Google sign in to embeddedWallet in React Native
|
||||||
|
|
||||||
|
You need to add the `react-native-inappbrowser-reborn` package to your app, then you can do:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
clientId={"your-client-id"}
|
||||||
|
supportedWallets={[
|
||||||
|
embeddedWallet({
|
||||||
|
// if this is true AND oauthOptions is not set we set it to false internally
|
||||||
|
email: true,
|
||||||
|
// if this is set we enable Sign in with Google
|
||||||
|
oauthOptions: {
|
||||||
|
redirectUrl: "test15app://",
|
||||||
|
providers: ["google"],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
|
||||||
## 0.3.7
|
## 0.3.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -89,7 +89,8 @@
|
|||||||
"amazon-cognito-identity-js": "^6.3.3",
|
"amazon-cognito-identity-js": "^6.3.3",
|
||||||
"react-native-quick-base64": "^2.0.7",
|
"react-native-quick-base64": "^2.0.7",
|
||||||
"react-native-quick-crypto": "^0.6.1",
|
"react-native-quick-crypto": "^0.6.1",
|
||||||
"react-native-aes-gcm-crypto": "^0.2.2"
|
"react-native-aes-gcm-crypto": "^0.2.2",
|
||||||
|
"react-native-inappbrowser-reborn": "^3.7.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"ethers": ">=5.5.1 <6",
|
"ethers": ">=5.5.1 <6",
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ export * from "./right-arrow";
|
|||||||
export * from "./wallet";
|
export * from "./wallet";
|
||||||
export * from "./money";
|
export * from "./money";
|
||||||
export * from "./switch";
|
export * from "./switch";
|
||||||
|
export * from "./svgs";
|
||||||
|
|||||||
@@ -1,3 +1,23 @@
|
|||||||
|
export const GOOGLE_ICON = `<svg height={height} viewBox="0 0 24 24" width={width}>
|
||||||
|
<path
|
||||||
|
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
||||||
|
fill="#4285F4"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
||||||
|
fill="#34A853"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
||||||
|
fill="#FBBC05"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
||||||
|
fill="#EA4335"
|
||||||
|
/>
|
||||||
|
<path d="M1 1h22v22H1z" fill="none" />
|
||||||
|
</svg>`;
|
||||||
|
|
||||||
export const EMAIL_WALLET_ICON = `<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
|
export const EMAIL_WALLET_ICON = `<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
|
||||||
<g clip-path="url(#clip0_3589_8649)">
|
<g clip-path="url(#clip0_3589_8649)">
|
||||||
<rect width="48" height="48" rx="8" fill="url(#paint0_linear_3589_8649)"/>
|
<rect width="48" height="48" rx="8" fill="url(#paint0_linear_3589_8649)"/>
|
||||||
|
|||||||
+7
-3
@@ -238,7 +238,8 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
) : null}
|
) : null}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
) : null}
|
) : null}
|
||||||
{activeWallet?.walletId === EmbeddedWallet.id ? (
|
{activeWallet?.walletId === EmbeddedWallet.id &&
|
||||||
|
(activeWallet as EmbeddedWallet).getEmail() ? (
|
||||||
<Box flexDirection="row" alignItems="center" mt="md">
|
<Box flexDirection="row" alignItems="center" mt="md">
|
||||||
<ActiveDot width={10} height={10} />
|
<ActiveDot width={10} height={10} />
|
||||||
<Text variant="bodySmallSecondary" ml="xxs">
|
<Text variant="bodySmallSecondary" ml="xxs">
|
||||||
@@ -246,7 +247,11 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) : null}
|
||||||
<Box flexDirection="row" justifyContent="space-evenly" mt="md">
|
<Box
|
||||||
|
flexDirection="row"
|
||||||
|
justifyContent="space-evenly"
|
||||||
|
marginVertical="md"
|
||||||
|
>
|
||||||
<SendButton supportedTokens={supportedTokens} />
|
<SendButton supportedTokens={supportedTokens} />
|
||||||
<ReceiveButton />
|
<ReceiveButton />
|
||||||
</Box>
|
</Box>
|
||||||
@@ -330,7 +335,6 @@ const styles = StyleSheet.create({
|
|||||||
alignContent: "flex-start",
|
alignContent: "flex-start",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
marginTop: 24,
|
|
||||||
marginBottom: 8,
|
marginBottom: 8,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+8
-2
@@ -1,7 +1,6 @@
|
|||||||
import { AddressDisplay } from "../base/AddressDisplay";
|
import { AddressDisplay } from "../base/AddressDisplay";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { WalletIcon } from "../base/WalletIcon";
|
|
||||||
import { useENS, useWallet } from "@thirdweb-dev/react-core";
|
import { useENS, useWallet } from "@thirdweb-dev/react-core";
|
||||||
import { StyleSheet } from "react-native";
|
import { StyleSheet } from "react-native";
|
||||||
import { LocalWallet, walletIds } from "@thirdweb-dev/wallets";
|
import { LocalWallet, walletIds } from "@thirdweb-dev/wallets";
|
||||||
@@ -11,6 +10,7 @@ import { useMemo, useState } from "react";
|
|||||||
import { TextBalance } from "../base/TextBalance";
|
import { TextBalance } from "../base/TextBalance";
|
||||||
import { SupportedTokens } from "../SendFunds/defaultTokens";
|
import { SupportedTokens } from "../SendFunds/defaultTokens";
|
||||||
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
||||||
|
import { ImageSvgUri } from "../base";
|
||||||
|
|
||||||
export type ConnectWalletDetailsProps = {
|
export type ConnectWalletDetailsProps = {
|
||||||
address?: string;
|
address?: string;
|
||||||
@@ -90,7 +90,13 @@ export const WalletDetailsButton = ({
|
|||||||
alignContent="center"
|
alignContent="center"
|
||||||
justifyContent="flex-start"
|
justifyContent="flex-start"
|
||||||
>
|
>
|
||||||
<WalletIcon size={32} iconUri={avatarUrl || walletIconUrl} />
|
<Box borderRadius="lg" overflow="hidden">
|
||||||
|
<ImageSvgUri
|
||||||
|
width={32}
|
||||||
|
height={32}
|
||||||
|
imageUrl={avatarUrl || walletIconUrl}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
<Box ml="md" justifyContent="center" alignItems="flex-start">
|
<Box ml="md" justifyContent="center" alignItems="flex-start">
|
||||||
{activeWallet?.walletId === LocalWallet.id ? (
|
{activeWallet?.walletId === LocalWallet.id ? (
|
||||||
<Text variant="bodySmall" color="red">
|
<Text variant="bodySmall" color="red">
|
||||||
|
|||||||
+1
-3
@@ -261,9 +261,7 @@ export function ChooseWallet({
|
|||||||
) : null}
|
) : null}
|
||||||
{showToSPrivacyPolicy ? (
|
{showToSPrivacyPolicy ? (
|
||||||
<Box
|
<Box
|
||||||
mt="md"
|
mt="sm"
|
||||||
pt="md"
|
|
||||||
height={50}
|
|
||||||
marginHorizontal={!isConnectAWalletEnabled ? "xl" : "none"}
|
marginHorizontal={!isConnectAWalletEnabled ? "xl" : "none"}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ export const ConnectWalletFlow = () => {
|
|||||||
|
|
||||||
const onChooseWallet = useCallback(
|
const onChooseWallet = useCallback(
|
||||||
(wallet: WalletConfig, data?: any) => {
|
(wallet: WalletConfig, data?: any) => {
|
||||||
setActiveWallet(wallet);
|
|
||||||
setSelectionData(data);
|
setSelectionData(data);
|
||||||
|
setActiveWallet(wallet);
|
||||||
|
|
||||||
// If the wallet has no custom connect UI, then connect it
|
// If the wallet has no custom connect UI, then connect it
|
||||||
if (!wallet.connectUI) {
|
if (!wallet.connectUI) {
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ export function ConnectingWallet({
|
|||||||
subHeaderText={subHeaderText}
|
subHeaderText={subHeaderText}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
<WalletLoadingThumbnail imageSize={100}>
|
<WalletLoadingThumbnail imageSize={85}>
|
||||||
<ImageSvgUri height={80} width={80} imageUrl={wallet.meta.iconURL} />
|
<ImageSvgUri height={80} width={80} imageUrl={wallet.meta.iconURL} />
|
||||||
</WalletLoadingThumbnail>
|
</WalletLoadingThumbnail>
|
||||||
<View style={styles.connectingContainer}>
|
<View style={styles.connectingContainer}>
|
||||||
|
|||||||
+1
-1
@@ -131,7 +131,7 @@ export const SmartWalletFlow = ({
|
|||||||
onBackPress={onConnectingBackPress}
|
onBackPress={onConnectingBackPress}
|
||||||
onClose={onConnectingClosePress}
|
onClose={onConnectingClosePress}
|
||||||
/>
|
/>
|
||||||
<WalletLoadingThumbnail imageSize={100}>
|
<WalletLoadingThumbnail imageSize={85}>
|
||||||
<ImageSvgUri
|
<ImageSvgUri
|
||||||
height={80}
|
height={80}
|
||||||
width={80}
|
width={80}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { TWModal } from "./base/modal/TWModal";
|
|||||||
import Box from "./base/Box";
|
import Box from "./base/Box";
|
||||||
// import { useAppTheme } from "../styles/hooks";
|
// import { useAppTheme } from "../styles/hooks";
|
||||||
|
|
||||||
const MODAL_HEIGHT = Dimensions.get("window").height * 0.6;
|
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||||
const DEVICE_WIDTH = Dimensions.get("window").width;
|
const DEVICE_WIDTH = Dimensions.get("window").width;
|
||||||
|
|
||||||
export const MainModal = () => {
|
export const MainModal = () => {
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ const SendFundsForm = ({
|
|||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const chainId = useChainId();
|
const chainId = useChainId();
|
||||||
const [receiverAddress, setReceiverAddress] = useState("");
|
const [receiverAddress, setReceiverAddress] = useState("");
|
||||||
const [amount, setAmount] = useState("");
|
const [amount, setAmount] = useState("0");
|
||||||
const [showIcon, setShowIcon] = useState(false);
|
const [showIcon, setShowIcon] = useState(false);
|
||||||
const tokenAddress = token?.address;
|
const tokenAddress = token?.address;
|
||||||
|
|
||||||
@@ -313,6 +313,7 @@ const SendFundsForm = ({
|
|||||||
editable={!sendTokenMutation.isLoading}
|
editable={!sendTokenMutation.isLoading}
|
||||||
returnKeyType={"done"}
|
returnKeyType={"done"}
|
||||||
keyboardType="numeric"
|
keyboardType="numeric"
|
||||||
|
value={amount}
|
||||||
clearTextOnFocus={false}
|
clearTextOnFocus={false}
|
||||||
style={{
|
style={{
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
@@ -322,8 +323,6 @@ const SendFundsForm = ({
|
|||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
}}
|
}}
|
||||||
onChangeText={setAmount}
|
onChangeText={setAmount}
|
||||||
placeholder="0"
|
|
||||||
placeholderTextColor={theme.colors.textPrimary}
|
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
@@ -348,9 +347,16 @@ const SendFundsForm = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{sendTokenMutation.isLoading ? (
|
{sendTokenMutation.isLoading ? (
|
||||||
<ActivityIndicator size="small" color={theme.colors.textPrimary} />
|
<ActivityIndicator
|
||||||
|
size="small"
|
||||||
|
color={theme.colors.accentButtonTextColor}
|
||||||
|
/>
|
||||||
) : showIcon ? (
|
) : showIcon ? (
|
||||||
<CheckIcon width={20} height={13} color={theme.colors.textPrimary} />
|
<CheckIcon
|
||||||
|
width={20}
|
||||||
|
height={13}
|
||||||
|
color={theme.colors.accentButtonTextColor}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodySmall" color="accentButtonTextColor" mr="sm">
|
<Text variant="bodySmall" color="accentButtonTextColor" mr="sm">
|
||||||
Send
|
Send
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const ImageSvgUri = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ width: width, height: height }}>
|
<Box width={width} height={height}>
|
||||||
{error ? (
|
{error ? (
|
||||||
<SvgUri width={width} height={height} uri={resolvedImageUrl} />
|
<SvgUri width={width} height={height} uri={resolvedImageUrl} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export const NetworkButton = ({
|
|||||||
<>
|
<>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
p={padding || "sm"}
|
p={padding || "sm"}
|
||||||
|
paddingVertical="xs"
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
borderWidth={0.5}
|
borderWidth={0.5}
|
||||||
flexDirection="row"
|
flexDirection="row"
|
||||||
@@ -82,13 +83,8 @@ export const NetworkButton = ({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<Box flexDirection="row" alignItems="center">
|
<Box flexDirection="row" alignItems="center">
|
||||||
<ChainIcon chainIconUrl={chain?.icon?.url} size={32} />
|
<ChainIcon chainIconUrl={chain?.icon?.url} size={28} />
|
||||||
<Box
|
<Box ml="md" alignItems="flex-start" justifyContent="center">
|
||||||
ml="md"
|
|
||||||
alignItems="flex-start"
|
|
||||||
justifyContent="center"
|
|
||||||
height={36}
|
|
||||||
>
|
|
||||||
<Text variant="bodyLarge">{chain?.name || "Unknown Network"}</Text>
|
<Text variant="bodyLarge">{chain?.name || "Unknown Network"}</Text>
|
||||||
{isSwitching ? (
|
{isSwitching ? (
|
||||||
<Box flexDirection="row" alignItems="center">
|
<Box flexDirection="row" alignItems="center">
|
||||||
|
|||||||
@@ -4,20 +4,27 @@ import ImageSvgUri from "./ImageSvgUri";
|
|||||||
import { Label } from "./Label";
|
import { Label } from "./Label";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
import Box from "./Box";
|
import Box from "./Box";
|
||||||
|
import { Palette } from "../../styles/colors";
|
||||||
|
|
||||||
type WalletButtonProps = {
|
type WalletButtonProps = {
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
walletIconUrl: string;
|
walletIconUrl: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
nameColor?: keyof Palette;
|
||||||
labelText?: string;
|
labelText?: string;
|
||||||
recommended?: boolean;
|
recommended?: boolean;
|
||||||
|
iconWidth?: number;
|
||||||
|
iconHeight?: number;
|
||||||
} & React.ComponentProps<typeof BaseButton>;
|
} & React.ComponentProps<typeof BaseButton>;
|
||||||
|
|
||||||
export const WalletButton = ({
|
export const WalletButton = ({
|
||||||
|
iconWidth = 48,
|
||||||
|
iconHeight = 48,
|
||||||
mb,
|
mb,
|
||||||
onPress,
|
onPress,
|
||||||
walletIconUrl,
|
walletIconUrl,
|
||||||
name,
|
name,
|
||||||
|
nameColor = "textPrimary",
|
||||||
labelText,
|
labelText,
|
||||||
recommended,
|
recommended,
|
||||||
...props
|
...props
|
||||||
@@ -36,9 +43,15 @@ export const WalletButton = ({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<Box flexDirection="row" justifyContent="flex-start" alignItems="center">
|
<Box flexDirection="row" justifyContent="flex-start" alignItems="center">
|
||||||
<ImageSvgUri imageUrl={walletIconUrl} width={48} height={48} />
|
<ImageSvgUri
|
||||||
|
imageUrl={walletIconUrl}
|
||||||
|
width={iconWidth}
|
||||||
|
height={iconHeight}
|
||||||
|
/>
|
||||||
<Box ml="sm" alignItems="flex-start">
|
<Box ml="sm" alignItems="flex-start">
|
||||||
<Text variant="bodyLarge">{name}</Text>
|
<Text variant="bodyLarge" color={nameColor}>
|
||||||
|
{name}
|
||||||
|
</Text>
|
||||||
{recommended ? <Text variant="link">Recommended</Text> : null}
|
{recommended ? <Text variant="link">Recommended</Text> : null}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
+32
-1
@@ -1,12 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
EmbeddedWalletConnectionArgs,
|
EmbeddedWalletConnectionArgs,
|
||||||
EmbeddedWalletConnectorOptions,
|
EmbeddedWalletConnectorOptions,
|
||||||
|
OauthOption,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import type { Chain } from "@thirdweb-dev/chains";
|
import type { Chain } from "@thirdweb-dev/chains";
|
||||||
import { Connector, normalizeChainId } from "@thirdweb-dev/wallets";
|
import { Connector, normalizeChainId } from "@thirdweb-dev/wallets";
|
||||||
import { providers, Signer } from "ethers";
|
import { providers, Signer } from "ethers";
|
||||||
import { utils } from "ethers";
|
import { utils } from "ethers";
|
||||||
import { sendEmailOTP, validateEmailOTP } from "./embedded/auth";
|
import { sendEmailOTP, socialLogin, validateEmailOTP } from "./embedded/auth";
|
||||||
import { getEthersSigner } from "./embedded/signer";
|
import { getEthersSigner } from "./embedded/signer";
|
||||||
import { logoutUser } from "./embedded/helpers/auth/logout";
|
import { logoutUser } from "./embedded/helpers/auth/logout";
|
||||||
import {
|
import {
|
||||||
@@ -83,6 +84,36 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
return sendEmailOTP(email, this.options.clientId);
|
return sendEmailOTP(email, this.options.clientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async socialLogin(oauthOption: OauthOption) {
|
||||||
|
try {
|
||||||
|
const { email } = await socialLogin(oauthOption, this.options.clientId);
|
||||||
|
this.email = email;
|
||||||
|
saveConnectedEmail(email);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error while signing in with: ${oauthOption.provider}. ${error}`,
|
||||||
|
);
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return { error: error.message };
|
||||||
|
} else {
|
||||||
|
return { error: "An unknown error occurred" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.getSigner();
|
||||||
|
this.emit("connected");
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return { error: error.message };
|
||||||
|
} else {
|
||||||
|
return { error: "Error getting the signer" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true };
|
||||||
|
}
|
||||||
|
|
||||||
async disconnect(): Promise<void> {
|
async disconnect(): Promise<void> {
|
||||||
clearConnectedEmail();
|
clearConnectedEmail();
|
||||||
await logoutUser(this.options.clientId);
|
await logoutUser(this.options.clientId);
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import { postPaperAuth, prePaperAuth } from "./helpers/auth/middleware";
|
|||||||
import { isDeviceSharePresentForUser } from "./helpers/storage/local";
|
import { isDeviceSharePresentForUser } from "./helpers/storage/local";
|
||||||
import { getCognitoUser, setCognitoUser } from "./helpers/storage/state";
|
import { getCognitoUser, setCognitoUser } from "./helpers/storage/state";
|
||||||
import { SendEmailOtpReturnType } from "@thirdweb-dev/wallets";
|
import { SendEmailOtpReturnType } from "@thirdweb-dev/wallets";
|
||||||
|
import { InAppBrowser } from "react-native-inappbrowser-reborn";
|
||||||
|
import { OauthOption } from "../types";
|
||||||
|
import { ROUTE_HEADLESS_GOOGLE_LOGIN } from "./helpers/constants";
|
||||||
|
|
||||||
export async function sendEmailOTP(
|
export async function sendEmailOTP(
|
||||||
email: string,
|
email: string,
|
||||||
@@ -122,3 +125,74 @@ export async function validateEmailOTP({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
||||||
|
const headlessLoginLinkWithParams = `${ROUTE_HEADLESS_GOOGLE_LOGIN}?authProvider=${encodeURIComponent(
|
||||||
|
"google",
|
||||||
|
)}&baseUrl=${encodeURIComponent(
|
||||||
|
"https://ews.thirdweb.com",
|
||||||
|
)}&platform=${encodeURIComponent("mobile")}`;
|
||||||
|
|
||||||
|
const resp = await fetch(headlessLoginLinkWithParams);
|
||||||
|
|
||||||
|
if (!resp.ok) {
|
||||||
|
throw new Error("Error getting headless login link");
|
||||||
|
}
|
||||||
|
|
||||||
|
const json = await resp.json();
|
||||||
|
|
||||||
|
const { platformLoginLink } = json;
|
||||||
|
|
||||||
|
const completeLoginUrl = `${platformLoginLink}?developerClientId=${encodeURIComponent(
|
||||||
|
clientId || "",
|
||||||
|
)}&platform=${encodeURIComponent("mobile")}&redirectUrl=${encodeURIComponent(
|
||||||
|
oauthOptions.redirectUrl,
|
||||||
|
)}`;
|
||||||
|
|
||||||
|
const result = await InAppBrowser.openAuth(
|
||||||
|
completeLoginUrl,
|
||||||
|
oauthOptions.redirectUrl,
|
||||||
|
{
|
||||||
|
// iOS Properties
|
||||||
|
ephemeralWebSession: false,
|
||||||
|
// Android Properties
|
||||||
|
showTitle: false,
|
||||||
|
enableUrlBarHiding: false,
|
||||||
|
enableDefaultShare: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.type !== "success") {
|
||||||
|
throw new Error("Error signing in. Please try again later.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const decodedUrl = decodeURIComponent(result.url);
|
||||||
|
|
||||||
|
const parts = decodedUrl.split("?authResult=");
|
||||||
|
if (parts.length < 2) {
|
||||||
|
throw new Error("Malformed response from the login redirect");
|
||||||
|
}
|
||||||
|
const authResult = parts[1];
|
||||||
|
const { storedToken } = JSON.parse(authResult);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const toStoreToken: AuthStoredTokenWithCookieReturnType["storedToken"] = {
|
||||||
|
jwtToken: storedToken.jwtToken,
|
||||||
|
authDetails: storedToken.authDetails,
|
||||||
|
authProvider: storedToken.authProvider,
|
||||||
|
developerClientId: storedToken.developerClientId,
|
||||||
|
cookieString: storedToken.cookieString,
|
||||||
|
// we should always store the jwt cookie since there's no concept of cookie in react native
|
||||||
|
shouldStoreCookieString: true,
|
||||||
|
isNewUser: storedToken.isNewUser,
|
||||||
|
};
|
||||||
|
|
||||||
|
await postPaperAuth(toStoreToken, clientId);
|
||||||
|
|
||||||
|
return { storedToken, email: storedToken.authDetails.email };
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(
|
||||||
|
`Malformed response from post authentication: ${JSON.stringify(e)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
@@ -30,4 +30,6 @@ export const ROUTE_STORE_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedd
|
|||||||
export const ROUTE_GET_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/get-shares`;
|
export const ROUTE_GET_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/get-shares`;
|
||||||
export const ROUTE_VERIFY_THIRDWEB_CLIENT_ID = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/verify-thirdweb-client-id`;
|
export const ROUTE_VERIFY_THIRDWEB_CLIENT_ID = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/verify-thirdweb-client-id`;
|
||||||
|
|
||||||
|
export const ROUTE_HEADLESS_GOOGLE_LOGIN = `${BASE_URL}/api/2022-08-12/embedded-wallet/headless-login-link`;
|
||||||
|
|
||||||
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
import { Chain } from "@thirdweb-dev/chains";
|
import { Chain } from "@thirdweb-dev/chains";
|
||||||
import { WalletOptions } from "@thirdweb-dev/wallets";
|
import { WalletOptions } from "@thirdweb-dev/wallets";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
RecoveryShareManagement,
|
RecoveryShareManagement,
|
||||||
PaperConstructorType,
|
PaperConstructorType,
|
||||||
|
AuthProvider,
|
||||||
} from "@paperxyz/embedded-wallet-service-sdk";
|
} from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
|
||||||
|
export type OauthOptions = {
|
||||||
|
providers: AuthProvider[];
|
||||||
|
redirectUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OauthOption = {
|
||||||
|
provider: AuthProvider;
|
||||||
|
redirectUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
export interface EmbeddedConnectorOptions {
|
export interface EmbeddedConnectorOptions {
|
||||||
chains?: Chain[];
|
chains?: Chain[];
|
||||||
chainId?: number;
|
chainId?: number;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import Box from "../../../components/base/Box";
|
|||||||
import Text from "../../../components/base/Text";
|
import Text from "../../../components/base/Text";
|
||||||
import BaseButton from "../../../components/base/BaseButton";
|
import BaseButton from "../../../components/base/BaseButton";
|
||||||
import * as Clipboard from "expo-clipboard";
|
import * as Clipboard from "expo-clipboard";
|
||||||
|
import { StyleSheet } from "react-native";
|
||||||
|
import { EmbeddedSocialConnection } from "./EmbeddedSocialConnection";
|
||||||
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
const OTP_LENGTH = 6;
|
const OTP_LENGTH = 6;
|
||||||
@@ -26,6 +28,7 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
goBack,
|
goBack,
|
||||||
selectionData,
|
selectionData,
|
||||||
onLocallyConnected,
|
onLocallyConnected,
|
||||||
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useGlobalTheme();
|
const theme = useGlobalTheme();
|
||||||
const inputRefs = useRef<(TextInput | null)[]>([]);
|
const inputRefs = useRef<(TextInput | null)[]>([]);
|
||||||
@@ -104,6 +107,7 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
inputRefs.current[i]?.setNativeProps({ text: newValues[i] });
|
inputRefs.current[i]?.setNativeProps({ text: newValues[i] });
|
||||||
}
|
}
|
||||||
setValues(newValues);
|
setValues(newValues);
|
||||||
|
Clipboard.setStringAsync("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,6 +161,18 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (selectionData?.oauthOptions) {
|
||||||
|
return (
|
||||||
|
<EmbeddedSocialConnection
|
||||||
|
connected={() => {}}
|
||||||
|
goBack={goBack}
|
||||||
|
onLocallyConnected={onLocallyConnected}
|
||||||
|
selectionData={selectionData}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box marginHorizontal="xl">
|
<Box marginHorizontal="xl">
|
||||||
<ConnectWalletHeader
|
<ConnectWalletHeader
|
||||||
@@ -198,10 +214,8 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
<TextInput
|
<TextInput
|
||||||
ref={(ref) => (inputRefs.current[index] = ref)}
|
ref={(ref) => (inputRefs.current[index] = ref)}
|
||||||
style={{
|
style={{
|
||||||
fontSize: 20,
|
...styles.textInput,
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
textAlign: "center",
|
|
||||||
height: 50,
|
|
||||||
}}
|
}}
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
editable={!checkingOtp}
|
editable={!checkingOtp}
|
||||||
@@ -246,3 +260,11 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
textInput: {
|
||||||
|
fontSize: 20,
|
||||||
|
textAlign: "center",
|
||||||
|
height: 50,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -9,22 +9,30 @@ import Box from "../../../components/base/Box";
|
|||||||
import Text from "../../../components/base/Text";
|
import Text from "../../../components/base/Text";
|
||||||
import BaseButton from "../../../components/base/BaseButton";
|
import BaseButton from "../../../components/base/BaseButton";
|
||||||
import { TextInput } from "../../../components/base/TextInput";
|
import { TextInput } from "../../../components/base/TextInput";
|
||||||
|
import { GOOGLE_ICON } from "../../../assets/svgs";
|
||||||
|
import { WalletButton } from "../../../components/base/WalletButton";
|
||||||
|
import { AuthProvider } from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
import { OauthOptions } from "../../connectors/embedded-wallet/types";
|
||||||
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for selecting wallet - this UI is rendered in the wallet selection screen
|
* UI for selecting wallet - this UI is rendered in the wallet selection screen
|
||||||
*/
|
*/
|
||||||
export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
export const EmailSelectionUI: React.FC<
|
||||||
onSelect,
|
SelectUIProps<EmbeddedWallet> & {
|
||||||
walletConfig,
|
oauthOptions?: OauthOptions;
|
||||||
}) => {
|
email?: boolean;
|
||||||
|
}
|
||||||
|
> = ({ onSelect, walletConfig, oauthOptions, email }) => {
|
||||||
const theme = useGlobalTheme();
|
const theme = useGlobalTheme();
|
||||||
const [email, setEmail] = useState<string>("");
|
const [emailInput, setEmailInput] = useState<string>("");
|
||||||
const [errorMessage, setErrorMessage] = useState<string>("");
|
const [errorMessage, setErrorMessage] = useState<string>("");
|
||||||
const [isFetching, setIsFetching] = useState<boolean>(false);
|
const [isFetching, setIsFetching] = useState<boolean>(false);
|
||||||
const createWalletInstance = useCreateWalletInstance();
|
const createWalletInstance = useCreateWalletInstance();
|
||||||
const [emailWallet, setEmailWallet] = useState<EmbeddedWallet | null>(null);
|
const [emailWallet, setEmailWallet] = useState<EmbeddedWallet | null>(null);
|
||||||
|
|
||||||
|
const isEmailEnabled = email === false ? false : true;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const emailWalletInstance = createWalletInstance(
|
const emailWalletInstance = createWalletInstance(
|
||||||
walletConfig,
|
walletConfig,
|
||||||
@@ -39,17 +47,18 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNetworkCall = () => {
|
const handleNetworkCall = () => {
|
||||||
if (validateEmail(email)) {
|
if (validateEmail(emailInput)) {
|
||||||
setErrorMessage("");
|
setErrorMessage("");
|
||||||
setIsFetching(true);
|
setIsFetching(true);
|
||||||
|
|
||||||
emailWallet
|
emailWallet
|
||||||
?.sendEmailOTP(email)
|
?.sendEmailOTP(emailInput)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
onSelect({
|
onSelect({
|
||||||
...response,
|
...response,
|
||||||
email,
|
email: emailInput,
|
||||||
emailWallet,
|
emailWallet,
|
||||||
|
oauthOptions: undefined,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -65,13 +74,62 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onGoogleSignInPress = () => {
|
||||||
|
onSelect({
|
||||||
|
email: emailInput,
|
||||||
|
emailWallet,
|
||||||
|
oauthOptions: {
|
||||||
|
provider: oauthOptions?.providers[0],
|
||||||
|
redirectUrl: oauthOptions?.redirectUrl,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box paddingHorizontal="xl" mt="lg">
|
<Box paddingHorizontal="xl" mt="lg">
|
||||||
|
{oauthOptions?.providers.includes(AuthProvider.GOOGLE) ? (
|
||||||
|
<Box justifyContent="center">
|
||||||
|
<WalletButton
|
||||||
|
iconHeight={28}
|
||||||
|
iconWidth={28}
|
||||||
|
borderRadius="lg"
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor="buttonBackgroundColor"
|
||||||
|
backgroundColor="buttonBackgroundColor"
|
||||||
|
nameColor="buttonTextColor"
|
||||||
|
justifyContent="center"
|
||||||
|
name="Sign in with Google"
|
||||||
|
walletIconUrl={GOOGLE_ICON}
|
||||||
|
onPress={onGoogleSignInPress}
|
||||||
|
/>
|
||||||
|
{isEmailEnabled ? (
|
||||||
|
<Box
|
||||||
|
mb="md"
|
||||||
|
mt="md"
|
||||||
|
flexDirection="row"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
<Box height={1} flex={1} backgroundColor="border" />
|
||||||
|
<Text
|
||||||
|
variant="subHeader"
|
||||||
|
textAlign="center"
|
||||||
|
marginHorizontal="xxs"
|
||||||
|
>
|
||||||
|
OR
|
||||||
|
</Text>
|
||||||
|
<Box height={1} flex={1} backgroundColor="border" />
|
||||||
|
</Box>
|
||||||
|
) : null}
|
||||||
|
</Box>
|
||||||
|
) : null}
|
||||||
|
{isEmailEnabled ? (
|
||||||
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
textInputProps={{
|
textInputProps={{
|
||||||
placeholder: "Enter your email address",
|
placeholder: "Enter your email address",
|
||||||
placeholderTextColor: theme.colors.textSecondary,
|
placeholderTextColor: theme.colors.textSecondary,
|
||||||
onChangeText: setEmail,
|
onChangeText: setEmailInput,
|
||||||
style: {
|
style: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
@@ -79,7 +137,7 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
padding: 0,
|
padding: 0,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
value: email,
|
value: emailInput,
|
||||||
keyboardType: "email-address",
|
keyboardType: "email-address",
|
||||||
returnKeyType: "done",
|
returnKeyType: "done",
|
||||||
autoCapitalize: "none",
|
autoCapitalize: "none",
|
||||||
@@ -117,6 +175,8 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
{errorMessage ? (
|
{errorMessage ? (
|
||||||
<Text variant="error" mt="xxs">
|
<Text variant="error" mt="xxs">
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
import React from "react";
|
||||||
|
import { ActivityIndicator } from "react-native";
|
||||||
|
import { EmbeddedWallet } from "./EmbeddedWallet";
|
||||||
|
import {
|
||||||
|
ConnectUIProps,
|
||||||
|
useSetConnectedWallet,
|
||||||
|
useSetConnectionStatus,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { GOOGLE_ICON } from "../../../assets";
|
||||||
|
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
||||||
|
import { Box, Text, WalletButton } from "../../../components/base";
|
||||||
|
|
||||||
|
export const EmbeddedSocialConnection: React.FC<
|
||||||
|
ConnectUIProps<EmbeddedWallet>
|
||||||
|
> = ({ goBack, selectionData, onLocallyConnected }) => {
|
||||||
|
const setConnectedWallet = useSetConnectedWallet();
|
||||||
|
const setConnectionStatus = useSetConnectionStatus();
|
||||||
|
const [errorMessage, setErrorMessage] = useState<string>();
|
||||||
|
|
||||||
|
const handleGoogleLogin = useCallback(() => {
|
||||||
|
setErrorMessage("");
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
(selectionData.emailWallet as EmbeddedWallet)
|
||||||
|
.socialLogin(selectionData?.oauthOptions)
|
||||||
|
.then(async (response) => {
|
||||||
|
if (response?.success) {
|
||||||
|
if (onLocallyConnected) {
|
||||||
|
onLocallyConnected(selectionData.emailWallet);
|
||||||
|
} else {
|
||||||
|
await setConnectedWallet(selectionData.emailWallet);
|
||||||
|
setConnectionStatus("connected");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setErrorMessage(
|
||||||
|
response?.error || "Error login in. Please try again later.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Error validating otp: ", error);
|
||||||
|
setErrorMessage("Error login in. Please try again later.");
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
}, [
|
||||||
|
onLocallyConnected,
|
||||||
|
selectionData.emailWallet,
|
||||||
|
selectionData.oauthOptions,
|
||||||
|
setConnectedWallet,
|
||||||
|
setConnectionStatus,
|
||||||
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleGoogleLogin();
|
||||||
|
}, [handleGoogleLogin]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box marginHorizontal="xl" height={200}>
|
||||||
|
<ConnectWalletHeader
|
||||||
|
middleContent={
|
||||||
|
<WalletButton
|
||||||
|
iconHeight={28}
|
||||||
|
iconWidth={28}
|
||||||
|
borderRadius="lg"
|
||||||
|
justifyContent="center"
|
||||||
|
name="Sign In"
|
||||||
|
walletIconUrl={GOOGLE_ICON}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
subHeaderText={""}
|
||||||
|
onBackPress={goBack}
|
||||||
|
onClose={goBack}
|
||||||
|
/>
|
||||||
|
<Box flex={1} justifyContent="center" alignItems="center">
|
||||||
|
{!errorMessage ? (
|
||||||
|
<ActivityIndicator size="large" />
|
||||||
|
) : (
|
||||||
|
<Text variant="error" numberOfLines={1}>
|
||||||
|
{errorMessage}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -5,7 +5,10 @@ import {
|
|||||||
walletIds,
|
walletIds,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
import type { EmbeddedWalletConnector as EmbeddedConnectorType } from "../../connectors/embedded-wallet/embedded-connector";
|
import type { EmbeddedWalletConnector as EmbeddedConnectorType } from "../../connectors/embedded-wallet/embedded-connector";
|
||||||
import { EmbeddedWalletConnectionArgs } from "../../connectors/embedded-wallet/types";
|
import {
|
||||||
|
EmbeddedWalletConnectionArgs,
|
||||||
|
OauthOption,
|
||||||
|
} from "../../connectors/embedded-wallet/types";
|
||||||
import { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
import { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
||||||
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
||||||
|
|
||||||
@@ -43,8 +46,6 @@ export class EmbeddedWallet extends AbstractClientWallet<
|
|||||||
return this.connector;
|
return this.connector;
|
||||||
}
|
}
|
||||||
|
|
||||||
// my methods
|
|
||||||
|
|
||||||
initializeConnector() {
|
initializeConnector() {
|
||||||
this.connector = new EmbeddedWalletConnector({
|
this.connector = new EmbeddedWalletConnector({
|
||||||
...this.options,
|
...this.options,
|
||||||
@@ -63,6 +64,10 @@ export class EmbeddedWallet extends AbstractClientWallet<
|
|||||||
return this.connector?.sendEmailOtp(email);
|
return this.connector?.sendEmailOtp(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async socialLogin(oauthOption: OauthOption) {
|
||||||
|
return this.connector?.socialLogin(oauthOption);
|
||||||
|
}
|
||||||
|
|
||||||
onConnected = () => {
|
onConnected = () => {
|
||||||
this.emit("message", { type: "connected" });
|
this.emit("message", { type: "connected" });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,16 +6,40 @@ import {
|
|||||||
} from "@thirdweb-dev/react-core";
|
} from "@thirdweb-dev/react-core";
|
||||||
import { EmbeddedConnectionUI } from "./EmbeddedConnectionUI";
|
import { EmbeddedConnectionUI } from "./EmbeddedConnectionUI";
|
||||||
import { EmailSelectionUI } from "./EmbeddedSelectionUI";
|
import { EmailSelectionUI } from "./EmbeddedSelectionUI";
|
||||||
|
import { AuthProvider } from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
|
||||||
|
type OAuthProvider = "google"; // currently we only have one
|
||||||
|
|
||||||
export type EmbeddedWalletConfig = {
|
export type EmbeddedWalletConfig = {
|
||||||
recommended?: boolean;
|
// @default true - set false to disable
|
||||||
|
email?: boolean;
|
||||||
|
|
||||||
|
// @default { providers: ['google'] } - set false to disable
|
||||||
|
oauthOptions?:
|
||||||
|
| {
|
||||||
|
providers: OAuthProvider[];
|
||||||
|
redirectUrl: string;
|
||||||
|
}
|
||||||
|
| false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const embeddedWallet = (
|
export const embeddedWallet = (
|
||||||
config?: EmbeddedWalletConfig,
|
config?: EmbeddedWalletConfig,
|
||||||
): WalletConfig<EmbeddedWallet> => {
|
): WalletConfig<EmbeddedWallet> => {
|
||||||
const selectUI = (props: SelectUIProps<EmbeddedWallet>) => (
|
const selectUI = (props: SelectUIProps<EmbeddedWallet>) => (
|
||||||
<EmailSelectionUI {...props} />
|
<EmailSelectionUI
|
||||||
|
{...props}
|
||||||
|
oauthOptions={
|
||||||
|
config?.oauthOptions
|
||||||
|
? {
|
||||||
|
providers: [AuthProvider.GOOGLE],
|
||||||
|
redirectUrl: config.oauthOptions.redirectUrl,
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
// you cannot disable both email and oauth
|
||||||
|
email={!config?.oauthOptions && !config?.email ? true : config?.email}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -29,6 +53,5 @@ export const embeddedWallet = (
|
|||||||
},
|
},
|
||||||
selectUI: selectUI,
|
selectUI: selectUI,
|
||||||
connectUI: EmbeddedConnectionUI,
|
connectUI: EmbeddedConnectionUI,
|
||||||
recommended: config?.recommended,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1769](https://github.com/thirdweb-dev/js/pull/1769) [`010955ff`](https://github.com/thirdweb-dev/js/commit/010955ff5cc35a975b54c25992b8e65b40e033a1) Thanks [@MananTank](https://github.com/MananTank)! - Fix OTP input not working well with Japanese keyboard
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/react-core@4.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1766](https://github.com/thirdweb-dev/js/pull/1766) [`dd7d0fca`](https://github.com/thirdweb-dev/js/commit/dd7d0fca2d14a529343396a31939d49b1a074d3e) Thanks [@MananTank](https://github.com/MananTank)! - Fix Continue as Guest button missing when Social + Guest login is setup in ConnectWallet Modal
|
||||||
|
|
||||||
|
- [#1692](https://github.com/thirdweb-dev/js/pull/1692) [`fb0f12ae`](https://github.com/thirdweb-dev/js/commit/fb0f12ae2835f4eba60ba4a74b453151cab0d393) Thanks [@etnlbck](https://github.com/etnlbck)! - Refactored OTPInput component to be simpler to read
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/react-core@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
|
||||||
## 4.0.2
|
## 4.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "4.0.2",
|
"version": "4.0.4",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -36,15 +36,17 @@ export function OTPInput(props: {
|
|||||||
data-error={props.isInvalid}
|
data-error={props.isInvalid}
|
||||||
ref={(e) => (boxEls.current[i] = e)}
|
ref={(e) => (boxEls.current[i] = e)}
|
||||||
key={i}
|
key={i}
|
||||||
value={otp[i] === undefined ? "" : otp[i]}
|
value={otp[i] ?? ""}
|
||||||
type="number"
|
type="number"
|
||||||
|
pattern="[0-9]*"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
inputMode="numeric"
|
||||||
onPaste={(e) => {
|
onPaste={(e) => {
|
||||||
const pastedData = e.clipboardData.getData("text/plain");
|
const pastedData = e.clipboardData.getData("text/plain");
|
||||||
const newOTP = pastedData
|
const newOTP = pastedData
|
||||||
.slice(0, props.digits)
|
.slice(0, props.digits)
|
||||||
.split("")
|
.split("")
|
||||||
.filter((n) => /[0-9]/.test(n))
|
.filter((n) => /\d/.test(n))
|
||||||
.map(Number);
|
.map(Number);
|
||||||
|
|
||||||
setOTP(newOTP);
|
setOTP(newOTP);
|
||||||
@@ -100,7 +102,7 @@ export function OTPInput(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!/[0-9]/.test(value) && value !== "") {
|
if (!/\d/.test(value) && value !== "") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ export const WalletSelector: React.FC<{
|
|||||||
|
|
||||||
// only social login - no eoa wallets
|
// only social login - no eoa wallets
|
||||||
if (eoaWallets.length === 0) {
|
if (eoaWallets.length === 0) {
|
||||||
bottomSection = tos ? (
|
bottomSection =
|
||||||
|
tos || continueAsGuest ? (
|
||||||
<>
|
<>
|
||||||
<Spacer y="md" />
|
<Spacer y="md" />
|
||||||
<Line />
|
<Line />
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1756](https://github.com/thirdweb-dev/js/pull/1756) [`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Enable adding smart wallet admins via bundler for new account contracts
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.15
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1764](https://github.com/thirdweb-dev/js/pull/1764) [`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for marketplace methods
|
||||||
|
|
||||||
|
- [#1763](https://github.com/thirdweb-dev/js/pull/1763) [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Improve fetchPublishedContractFromPolygon
|
||||||
|
|
||||||
|
- [#1765](https://github.com/thirdweb-dev/js/pull/1765) [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for getting deployment info
|
||||||
|
|
||||||
|
- [#1762](https://github.com/thirdweb-dev/js/pull/1762) [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for drop-claim-condition
|
||||||
|
|
||||||
## 4.0.1
|
## 4.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "4.0.1",
|
"version": "4.0.3",
|
||||||
"description": "The main thirdweb SDK.",
|
"description": "The main thirdweb SDK.",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -50,18 +50,18 @@ export async function fetchPublishedContractFromPolygon(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// get the metadata for each version
|
// get the metadata for each version
|
||||||
const versionMetadata = await Promise.all(
|
const versionMetadata = (
|
||||||
allVersions.map(async (c) => {
|
await Promise.all(
|
||||||
return {
|
allVersions.map((c) =>
|
||||||
name: c.id,
|
fetchAndCacheDeployMetadata(c.metadataUri, storage),
|
||||||
publishedTimestamp: c.timestamp,
|
|
||||||
publishedMetadata: await fetchAndCacheDeployMetadata(
|
|
||||||
c.metadataUri,
|
|
||||||
storage,
|
|
||||||
),
|
),
|
||||||
};
|
)
|
||||||
}),
|
).map((item, index) => ({
|
||||||
);
|
name: allVersions[index].id,
|
||||||
|
publishedTimestamp: allVersions[index].timestamp,
|
||||||
|
publishedMetadata: item,
|
||||||
|
}));
|
||||||
|
|
||||||
// find the version that matches the version string
|
// find the version that matches the version string
|
||||||
const versionMatch = versionMetadata.find(
|
const versionMatch = versionMetadata.find(
|
||||||
(metadata) =>
|
(metadata) =>
|
||||||
|
|||||||
@@ -37,15 +37,13 @@ export async function getDeploymentInfo(
|
|||||||
secretKey?: string,
|
secretKey?: string,
|
||||||
): Promise<DeploymentPreset[]> {
|
): Promise<DeploymentPreset[]> {
|
||||||
caches.deploymentPresets = {};
|
caches.deploymentPresets = {};
|
||||||
|
const [create2FactoryAddress, { compilerMetadata, extendedMetadata }] =
|
||||||
const create2FactoryAddress = create2Factory
|
await Promise.all([
|
||||||
? create2Factory
|
create2Factory ? create2Factory : getCreate2FactoryAddress(provider),
|
||||||
: await getCreate2FactoryAddress(provider);
|
fetchAndCacheDeployMetadata(metadataUri, storage),
|
||||||
|
]);
|
||||||
const customParams: ConstructorParamMap = {};
|
const customParams: ConstructorParamMap = {};
|
||||||
const finalDeploymentInfo: DeploymentPreset[] = [];
|
const finalDeploymentInfo: DeploymentPreset[] = [];
|
||||||
const { compilerMetadata, extendedMetadata } =
|
|
||||||
await fetchAndCacheDeployMetadata(metadataUri, storage);
|
|
||||||
const defaultExtensions = extendedMetadata?.defaultExtensions;
|
const defaultExtensions = extendedMetadata?.defaultExtensions;
|
||||||
|
|
||||||
if (extendedMetadata?.routerType === "plugin" && defaultExtensions) {
|
if (extendedMetadata?.routerType === "plugin" && defaultExtensions) {
|
||||||
@@ -65,16 +63,16 @@ export async function getDeploymentInfo(
|
|||||||
|
|
||||||
const pluginMetadata = (
|
const pluginMetadata = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
publishedExtensions.map(async (c) => {
|
publishedExtensions.map((c) =>
|
||||||
return fetchAndCacheDeployMetadata(c.metadataUri, storage);
|
fetchAndCacheDeployMetadata(c.metadataUri, storage),
|
||||||
}),
|
),
|
||||||
)
|
)
|
||||||
).map((fetchedMetadata) => fetchedMetadata.compilerMetadata);
|
).map((fetchedMetadata) => fetchedMetadata.compilerMetadata);
|
||||||
|
|
||||||
// get deployment info for all plugins
|
// get deployment info for all plugins
|
||||||
const pluginDeploymentInfo = await Promise.all(
|
const pluginDeploymentInfo = await Promise.all(
|
||||||
pluginMetadata.map(async (metadata) => {
|
pluginMetadata.map((metadata) =>
|
||||||
const info = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"plugin",
|
"plugin",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -82,9 +80,8 @@ export async function getDeploymentInfo(
|
|||||||
{ metadata: metadata },
|
{ metadata: metadata },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
return info;
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// create constructor param input for PluginMap
|
// create constructor param input for PluginMap
|
||||||
@@ -142,8 +139,8 @@ export async function getDeploymentInfo(
|
|||||||
|
|
||||||
// get deployment info for all extensions
|
// get deployment info for all extensions
|
||||||
const extensionDeploymentInfo = await Promise.all(
|
const extensionDeploymentInfo = await Promise.all(
|
||||||
extensionMetadata.map(async (metadata) => {
|
extensionMetadata.map((metadata) =>
|
||||||
const info = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"extension",
|
"extension",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -151,9 +148,8 @@ export async function getDeploymentInfo(
|
|||||||
{ metadata: metadata },
|
{ metadata: metadata },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
return info;
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// create constructor param input for BaseRouter
|
// create constructor param input for BaseRouter
|
||||||
@@ -179,7 +175,8 @@ export async function getDeploymentInfo(
|
|||||||
finalDeploymentInfo.push(...extensionDeploymentInfo);
|
finalDeploymentInfo.push(...extensionDeploymentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const implementationDeployInfo = await computeDeploymentInfo(
|
const [implementationDeployInfo, factoryInfo] = await Promise.all([
|
||||||
|
computeDeploymentInfo(
|
||||||
"implementation",
|
"implementation",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -190,10 +187,9 @@ export async function getDeploymentInfo(
|
|||||||
},
|
},
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
|
|
||||||
// get clone factory
|
// get clone factory
|
||||||
const factoryInfo = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"infra",
|
"infra",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -201,7 +197,8 @@ export async function getDeploymentInfo(
|
|||||||
{ contractName: "TWCloneFactory" },
|
{ contractName: "TWCloneFactory" },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
finalDeploymentInfo.push(factoryInfo);
|
finalDeploymentInfo.push(factoryInfo);
|
||||||
finalDeploymentInfo.push(...Object.values(caches.deploymentPresets));
|
finalDeploymentInfo.push(...Object.values(caches.deploymentPresets));
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ export async function isTokenApprovedForTransfer(
|
|||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const erc165 = new Contract(assetContract, ERC165Abi, provider) as IERC165;
|
const erc165 = new Contract(assetContract, ERC165Abi, provider) as IERC165;
|
||||||
const isERC721 = await erc165.supportsInterface(InterfaceId_IERC721);
|
const [isERC721, isERC1155] = await Promise.all([
|
||||||
const isERC1155 = await erc165.supportsInterface(InterfaceId_IERC1155);
|
erc165.supportsInterface(InterfaceId_IERC721),
|
||||||
|
erc165.supportsInterface(InterfaceId_IERC1155),
|
||||||
|
]);
|
||||||
if (isERC721) {
|
if (isERC721) {
|
||||||
const asset = new Contract(assetContract, ERC721Abi, provider) as IERC721;
|
const asset = new Contract(assetContract, ERC721Abi, provider) as IERC721;
|
||||||
|
|
||||||
@@ -108,11 +110,9 @@ export async function handleTokenApproval(
|
|||||||
contractWrapper.options,
|
contractWrapper.options,
|
||||||
contractWrapper.storage,
|
contractWrapper.storage,
|
||||||
);
|
);
|
||||||
const isERC721 = await erc165.read("supportsInterface", [
|
const [isERC721, isERC1155] = await Promise.all([
|
||||||
InterfaceId_IERC721,
|
erc165.read("supportsInterface", [InterfaceId_IERC721]),
|
||||||
]);
|
erc165.read("supportsInterface", [InterfaceId_IERC1155]),
|
||||||
const isERC1155 = await erc165.read("supportsInterface", [
|
|
||||||
InterfaceId_IERC1155,
|
|
||||||
]);
|
]);
|
||||||
// check for token approval
|
// check for token approval
|
||||||
if (isERC721) {
|
if (isERC721) {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ import {
|
|||||||
FEATURE_ACCOUNT,
|
FEATURE_ACCOUNT,
|
||||||
FEATURE_ACCOUNT_FACTORY,
|
FEATURE_ACCOUNT_FACTORY,
|
||||||
FEATURE_ACCOUNT_PERMISSIONS,
|
FEATURE_ACCOUNT_PERMISSIONS,
|
||||||
|
FEATURE_ACCOUNT_PERMISSIONS_V1,
|
||||||
} from "./thirdweb-features";
|
} from "./thirdweb-features";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,6 +147,7 @@ export type Feature =
|
|||||||
| typeof FEATURE_AIRDROP_ERC1155
|
| typeof FEATURE_AIRDROP_ERC1155
|
||||||
| typeof FEATURE_ACCOUNT
|
| typeof FEATURE_ACCOUNT
|
||||||
| typeof FEATURE_ACCOUNT_PERMISSIONS
|
| typeof FEATURE_ACCOUNT_PERMISSIONS
|
||||||
|
| typeof FEATURE_ACCOUNT_PERMISSIONS_V1
|
||||||
| typeof FEATURE_ACCOUNT_FACTORY;
|
| typeof FEATURE_ACCOUNT_FACTORY;
|
||||||
|
|
||||||
export type Extension = Feature;
|
export type Extension = Feature;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import IAirdropERC721 from "@thirdweb-dev/contracts-js/dist/abis/IAirdropERC721.
|
|||||||
import IAirdropERC1155 from "@thirdweb-dev/contracts-js/dist/abis/IAirdropERC1155.json";
|
import IAirdropERC1155 from "@thirdweb-dev/contracts-js/dist/abis/IAirdropERC1155.json";
|
||||||
import IAccountFactoryCore from "@thirdweb-dev/contracts-js/dist/abis/IAccountFactoryCore.json";
|
import IAccountFactoryCore from "@thirdweb-dev/contracts-js/dist/abis/IAccountFactoryCore.json";
|
||||||
import IAccountPermissions from "@thirdweb-dev/contracts-js/dist/abis/IAccountPermissions.json";
|
import IAccountPermissions from "@thirdweb-dev/contracts-js/dist/abis/IAccountPermissions.json";
|
||||||
|
import IAccountPermissionsV1 from "@thirdweb-dev/contracts-js/dist/abis/IAccountPermissions_V1.json";
|
||||||
import IAccount from "@thirdweb-dev/contracts-js/dist/abis/IAccount.json";
|
import IAccount from "@thirdweb-dev/contracts-js/dist/abis/IAccount.json";
|
||||||
|
|
||||||
export const getAllPluginsAbi = [
|
export const getAllPluginsAbi = [
|
||||||
@@ -295,6 +296,18 @@ export const FEATURE_ACCOUNT_FACTORY = {
|
|||||||
features: {},
|
features: {},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const FEATURE_ACCOUNT_PERMISSIONS_V1 = {
|
||||||
|
name: "AccountPermissionsV1",
|
||||||
|
namespace: "accountPermissions",
|
||||||
|
docLinks: {
|
||||||
|
// TODO
|
||||||
|
sdk: "sdk.account",
|
||||||
|
contracts: "IAccountPermissions",
|
||||||
|
},
|
||||||
|
abis: [IAccountPermissionsV1],
|
||||||
|
features: {},
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const FEATURE_ACCOUNT_PERMISSIONS = {
|
export const FEATURE_ACCOUNT_PERMISSIONS = {
|
||||||
name: "AccountPermissions",
|
name: "AccountPermissions",
|
||||||
namespace: "accountPermissions",
|
namespace: "accountPermissions",
|
||||||
@@ -316,7 +329,10 @@ export const FEATURE_ACCOUNT = {
|
|||||||
contracts: "IAccount",
|
contracts: "IAccount",
|
||||||
},
|
},
|
||||||
abis: [IAccount],
|
abis: [IAccount],
|
||||||
features: { [FEATURE_ACCOUNT_PERMISSIONS.name]: FEATURE_ACCOUNT_PERMISSIONS },
|
features: {
|
||||||
|
[FEATURE_ACCOUNT_PERMISSIONS.name]: FEATURE_ACCOUNT_PERMISSIONS,
|
||||||
|
[FEATURE_ACCOUNT_PERMISSIONS_V1.name]: FEATURE_ACCOUNT_PERMISSIONS_V1,
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const FEATURE_AIRDROP_ERC20 = {
|
export const FEATURE_AIRDROP_ERC20 = {
|
||||||
|
|||||||
@@ -7,24 +7,30 @@ import { Transaction } from "./transactions";
|
|||||||
import type {
|
import type {
|
||||||
IAccountCore,
|
IAccountCore,
|
||||||
IAccountPermissions,
|
IAccountPermissions,
|
||||||
|
IAccountPermissions_V1,
|
||||||
} from "@thirdweb-dev/contracts-js";
|
} from "@thirdweb-dev/contracts-js";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
import { resolveAddress } from "../../common";
|
import { detectContractFeature, resolveAddress } from "../../common";
|
||||||
import { resolveOrGenerateId } from "../../common/signature-minting";
|
import { resolveOrGenerateId } from "../../common/signature-minting";
|
||||||
import { buildTransactionFunction } from "../../common/transactions";
|
import { buildTransactionFunction } from "../../common/transactions";
|
||||||
import { AddressOrEns } from "../../schema";
|
import { AddressOrEns } from "../../schema";
|
||||||
import {
|
import {
|
||||||
|
AdminFlag,
|
||||||
|
DEFAULT_PERMISSIONS,
|
||||||
PermissionSnapshotInput,
|
PermissionSnapshotInput,
|
||||||
PermissionSnapshotOutput,
|
PermissionSnapshotOutput,
|
||||||
PermissionSnapshotSchema,
|
PermissionSnapshotSchema,
|
||||||
SignedSignerPermissionsPayload,
|
SignedSignerPermissionsPayload,
|
||||||
|
SignedSignerPermissionsPayloadV1,
|
||||||
SignerPermissionRequest,
|
SignerPermissionRequest,
|
||||||
|
SignerPermissionRequestV1,
|
||||||
SignerPermissions,
|
SignerPermissions,
|
||||||
SignerPermissionsInput,
|
SignerPermissionsInput,
|
||||||
SignerPermissionsOutput,
|
SignerPermissionsOutput,
|
||||||
SignerPermissionsSchema,
|
SignerPermissionsSchema,
|
||||||
SignerWithPermissions,
|
SignerWithPermissions,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
|
import { AddressZero } from "../../constants/addresses/AddressZero";
|
||||||
|
|
||||||
export class AccountPermissions implements DetectableFeature {
|
export class AccountPermissions implements DetectableFeature {
|
||||||
featureName = FEATURE_ACCOUNT_PERMISSIONS.name;
|
featureName = FEATURE_ACCOUNT_PERMISSIONS.name;
|
||||||
@@ -85,49 +91,49 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
private async sendSignerPermissionRequest(
|
private async sendSignerPermissionRequest(
|
||||||
signerAddress: string,
|
signerAddress: string,
|
||||||
permissions: SignerPermissionsOutput,
|
permissions: SignerPermissionsOutput,
|
||||||
|
adminFlag: AdminFlag,
|
||||||
): Promise<Transaction> {
|
): Promise<Transaction> {
|
||||||
const { payload, signature } = await this.generatePayload(
|
if (
|
||||||
|
detectContractFeature<IAccountPermissions_V1>(
|
||||||
|
this.contractWrapper,
|
||||||
|
"AccountPermissionsV1",
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// legacy account permissions contract
|
||||||
|
// admin is set only via EOA
|
||||||
|
// signer permissions are set via EOA or admin but no wildcard
|
||||||
|
if (
|
||||||
|
adminFlag === AdminFlag.AddAdmin ||
|
||||||
|
adminFlag === AdminFlag.RemoveAdmin
|
||||||
|
) {
|
||||||
|
return Transaction.fromContractWrapper({
|
||||||
|
contractWrapper: this.contractWrapper,
|
||||||
|
method: "setAdmin",
|
||||||
|
args: [signerAddress, adminFlag === AdminFlag.AddAdmin],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const { payload, signature } = await this.generateLegacyPayload(
|
||||||
signerAddress,
|
signerAddress,
|
||||||
permissions,
|
permissions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [success] = await this.contractWrapper.read(
|
|
||||||
"verifySignerPermissionRequest",
|
|
||||||
[payload, signature],
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(`Invalid signature.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Transaction.fromContractWrapper({
|
return Transaction.fromContractWrapper({
|
||||||
contractWrapper: this.contractWrapper,
|
contractWrapper: this.contractWrapper,
|
||||||
method: "setPermissionsForSigner",
|
method: "setPermissionsForSigner",
|
||||||
args: [payload, signature],
|
args: [payload, signature],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async buildSignerPermissionRequest(
|
|
||||||
signerAddress: string,
|
|
||||||
permissions: SignerPermissionsOutput,
|
|
||||||
): Promise<string> {
|
|
||||||
const { payload, signature } = await this.generatePayload(
|
const { payload, signature } = await this.generatePayload(
|
||||||
signerAddress,
|
signerAddress,
|
||||||
permissions,
|
permissions,
|
||||||
|
adminFlag,
|
||||||
);
|
);
|
||||||
|
return Transaction.fromContractWrapper({
|
||||||
const isValidSigner = await this.contractWrapper.read(
|
contractWrapper: this.contractWrapper,
|
||||||
"verifySignerPermissionRequest",
|
method: "setPermissionsForSigner",
|
||||||
[payload, signature],
|
args: [payload, signature],
|
||||||
);
|
});
|
||||||
if (!isValidSigner) {
|
|
||||||
throw new Error(`Invalid signature.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.contractWrapper.writeContract.interface.encodeFunctionData(
|
|
||||||
"setPermissionsForSigner",
|
|
||||||
[payload, signature],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,11 +147,16 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
private async generatePayload(
|
private async generatePayload(
|
||||||
signerAddress: string,
|
signerAddress: string,
|
||||||
permissions: SignerPermissionsOutput,
|
permissions: SignerPermissionsOutput,
|
||||||
|
isAdmin: AdminFlag,
|
||||||
): Promise<SignedSignerPermissionsPayload> {
|
): Promise<SignedSignerPermissionsPayload> {
|
||||||
// Get payload struct.
|
// Get payload struct.
|
||||||
const payload: IAccountPermissions.SignerPermissionRequestStruct = {
|
const payload: IAccountPermissions.SignerPermissionRequestStruct = {
|
||||||
signer: signerAddress,
|
signer: signerAddress,
|
||||||
approvedTargets: permissions.approvedCallTargets,
|
isAdmin: isAdmin.valueOf(),
|
||||||
|
approvedTargets:
|
||||||
|
permissions.approvedCallTargets === "*"
|
||||||
|
? [AddressZero]
|
||||||
|
: permissions.approvedCallTargets,
|
||||||
nativeTokenLimitPerTransaction: utils.parseEther(
|
nativeTokenLimitPerTransaction: utils.parseEther(
|
||||||
permissions.nativeTokenLimitPerTransaction,
|
permissions.nativeTokenLimitPerTransaction,
|
||||||
),
|
),
|
||||||
@@ -182,6 +193,53 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
return { payload, signature };
|
return { payload, signature };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async generateLegacyPayload(
|
||||||
|
signerAddress: string,
|
||||||
|
permissions: SignerPermissionsOutput,
|
||||||
|
): Promise<SignedSignerPermissionsPayloadV1> {
|
||||||
|
if (permissions.approvedCallTargets === "*") {
|
||||||
|
throw new Error(
|
||||||
|
"Wildcard call targets are not supported on legacy account permissions contract, please deploy an updated contract factory.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// legacy account permissions contract
|
||||||
|
// admin is set only via EOA
|
||||||
|
// signer permissions are set via EOA or admin but no wildcard
|
||||||
|
const payload: IAccountPermissions_V1.SignerPermissionRequestStruct = {
|
||||||
|
signer: signerAddress,
|
||||||
|
approvedTargets: permissions.approvedCallTargets,
|
||||||
|
nativeTokenLimitPerTransaction: utils.parseEther(
|
||||||
|
permissions.nativeTokenLimitPerTransaction,
|
||||||
|
),
|
||||||
|
permissionStartTimestamp: permissions.startDate,
|
||||||
|
permissionEndTimestamp: permissions.expirationDate,
|
||||||
|
reqValidityStartTimestamp: 0,
|
||||||
|
// Req validity ends 10 years from now.
|
||||||
|
reqValidityEndTimestamp: BigNumber.from(
|
||||||
|
Math.floor(
|
||||||
|
new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 10).getTime() /
|
||||||
|
1000,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
uid: resolveOrGenerateId(undefined),
|
||||||
|
};
|
||||||
|
const chainId = await this.contractWrapper.getChainID();
|
||||||
|
const connectedSigner = this.contractWrapper.getSigner();
|
||||||
|
invariant(connectedSigner, "No signer available");
|
||||||
|
const signature = await this.contractWrapper.signTypedData(
|
||||||
|
connectedSigner,
|
||||||
|
{
|
||||||
|
name: "Account",
|
||||||
|
version: "1",
|
||||||
|
chainId,
|
||||||
|
verifyingContract: this.getAddress(),
|
||||||
|
},
|
||||||
|
{ SignerPermissionRequest: SignerPermissionRequestV1 },
|
||||||
|
payload,
|
||||||
|
);
|
||||||
|
return { payload, signature };
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
* READ FUNCTIONS
|
* READ FUNCTIONS
|
||||||
********************************/
|
********************************/
|
||||||
@@ -320,11 +378,11 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
grantAdminPermissions = /* @__PURE__ */ buildTransactionFunction(
|
grantAdminPermissions = /* @__PURE__ */ buildTransactionFunction(
|
||||||
async (signerAddress: AddressOrEns): Promise<Transaction> => {
|
async (signerAddress: AddressOrEns): Promise<Transaction> => {
|
||||||
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
||||||
return Transaction.fromContractWrapper({
|
return await this.sendSignerPermissionRequest(
|
||||||
contractWrapper: this.contractWrapper,
|
resolvedSignerAddress,
|
||||||
method: "setAdmin",
|
DEFAULT_PERMISSIONS,
|
||||||
args: [resolvedSignerAddress, true],
|
AdminFlag.AddAdmin,
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -346,11 +404,11 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
revokeAdminPermissions = /* @__PURE__ */ buildTransactionFunction(
|
revokeAdminPermissions = /* @__PURE__ */ buildTransactionFunction(
|
||||||
async (signerAddress: AddressOrEns): Promise<Transaction> => {
|
async (signerAddress: AddressOrEns): Promise<Transaction> => {
|
||||||
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
||||||
return Transaction.fromContractWrapper({
|
return await this.sendSignerPermissionRequest(
|
||||||
contractWrapper: this.contractWrapper,
|
resolvedSignerAddress,
|
||||||
method: "setAdmin",
|
DEFAULT_PERMISSIONS,
|
||||||
args: [resolvedSignerAddress, false],
|
AdminFlag.RemoveAdmin,
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -395,6 +453,7 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
return await this.sendSignerPermissionRequest(
|
return await this.sendSignerPermissionRequest(
|
||||||
resolvedSignerAddress,
|
resolvedSignerAddress,
|
||||||
resolvedPermissions,
|
resolvedPermissions,
|
||||||
|
AdminFlag.None,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -440,6 +499,7 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
return await this.sendSignerPermissionRequest(
|
return await this.sendSignerPermissionRequest(
|
||||||
resolvedSignerAddress,
|
resolvedSignerAddress,
|
||||||
resolvedPermissions,
|
resolvedPermissions,
|
||||||
|
AdminFlag.None,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -475,12 +535,16 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.sendSignerPermissionRequest(resolvedSignerAddress, {
|
return await this.sendSignerPermissionRequest(
|
||||||
|
resolvedSignerAddress,
|
||||||
|
{
|
||||||
startDate: BigNumber.from(0),
|
startDate: BigNumber.from(0),
|
||||||
expirationDate: BigNumber.from(0),
|
expirationDate: BigNumber.from(0),
|
||||||
approvedCallTargets: [],
|
approvedCallTargets: [],
|
||||||
nativeTokenLimitPerTransaction: "0",
|
nativeTokenLimitPerTransaction: "0",
|
||||||
});
|
},
|
||||||
|
AdminFlag.None,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -531,13 +595,17 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
|
|
||||||
const newTargets = [...permissions.approvedTargets, resolvedTarget];
|
const newTargets = [...permissions.approvedTargets, resolvedTarget];
|
||||||
|
|
||||||
return await this.sendSignerPermissionRequest(resolvedSignerAddress, {
|
return await this.sendSignerPermissionRequest(
|
||||||
|
resolvedSignerAddress,
|
||||||
|
{
|
||||||
startDate: BigNumber.from(permissions.startTimestamp),
|
startDate: BigNumber.from(permissions.startTimestamp),
|
||||||
expirationDate: BigNumber.from(permissions.endTimestamp),
|
expirationDate: BigNumber.from(permissions.endTimestamp),
|
||||||
approvedCallTargets: newTargets,
|
approvedCallTargets: newTargets,
|
||||||
nativeTokenLimitPerTransaction:
|
nativeTokenLimitPerTransaction:
|
||||||
permissions.nativeTokenLimitPerTransaction.toString(),
|
permissions.nativeTokenLimitPerTransaction.toString(),
|
||||||
});
|
},
|
||||||
|
AdminFlag.None,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -591,13 +659,17 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
utils.getAddress(approvedTarget) !== utils.getAddress(resolvedTarget),
|
utils.getAddress(approvedTarget) !== utils.getAddress(resolvedTarget),
|
||||||
);
|
);
|
||||||
|
|
||||||
return await this.sendSignerPermissionRequest(resolvedSignerAddress, {
|
return await this.sendSignerPermissionRequest(
|
||||||
|
resolvedSignerAddress,
|
||||||
|
{
|
||||||
startDate: BigNumber.from(permissions.startTimestamp),
|
startDate: BigNumber.from(permissions.startTimestamp),
|
||||||
expirationDate: BigNumber.from(permissions.endTimestamp),
|
expirationDate: BigNumber.from(permissions.endTimestamp),
|
||||||
approvedCallTargets: newTargets,
|
approvedCallTargets: newTargets,
|
||||||
nativeTokenLimitPerTransaction:
|
nativeTokenLimitPerTransaction:
|
||||||
permissions.nativeTokenLimitPerTransaction.toString(),
|
permissions.nativeTokenLimitPerTransaction.toString(),
|
||||||
});
|
},
|
||||||
|
AdminFlag.None,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -651,14 +723,16 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
const allToMakeAdmin = resolvedSnapshot
|
const allToMakeAdmin = resolvedSnapshot
|
||||||
.filter((item) => item.makeAdmin)
|
.filter((item) => item.makeAdmin)
|
||||||
.map((item) => item.signer);
|
.map((item) => item.signer);
|
||||||
allAdmins.forEach((admin) => {
|
allAdmins.forEach(async (admin) => {
|
||||||
if (!allToMakeAdmin.includes(admin)) {
|
if (!allToMakeAdmin.includes(admin)) {
|
||||||
removeAdminData.push(
|
const data = (
|
||||||
this.contractWrapper.writeContract.interface.encodeFunctionData(
|
await this.sendSignerPermissionRequest(
|
||||||
"setAdmin",
|
admin,
|
||||||
[admin, false],
|
DEFAULT_PERMISSIONS,
|
||||||
),
|
AdminFlag.RemoveAdmin,
|
||||||
);
|
)
|
||||||
|
).encode();
|
||||||
|
removeAdminData.push(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -672,13 +746,13 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
allSigners.map(async (item) => {
|
allSigners.map(async (item) => {
|
||||||
if (!allToMakeSigners.includes(item.signer)) {
|
if (!allToMakeSigners.includes(item.signer)) {
|
||||||
const data = await this.buildSignerPermissionRequest(item.signer, {
|
const data = (
|
||||||
startDate: BigNumber.from(0),
|
await this.sendSignerPermissionRequest(
|
||||||
expirationDate: BigNumber.from(0),
|
item.signer,
|
||||||
approvedCallTargets: [],
|
DEFAULT_PERMISSIONS,
|
||||||
nativeTokenLimitPerTransaction: "0",
|
AdminFlag.None,
|
||||||
});
|
)
|
||||||
|
).encode();
|
||||||
removeSignerData.push(data);
|
removeSignerData.push(data);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -687,18 +761,23 @@ export class AccountPermissions implements DetectableFeature {
|
|||||||
for (const member of resolvedSnapshot) {
|
for (const member of resolvedSnapshot) {
|
||||||
// Add new admin
|
// Add new admin
|
||||||
if (member.makeAdmin) {
|
if (member.makeAdmin) {
|
||||||
addAdminData.push(
|
const data = (
|
||||||
this.contractWrapper.writeContract.interface.encodeFunctionData(
|
await this.sendSignerPermissionRequest(
|
||||||
"setAdmin",
|
member.signer,
|
||||||
[member.signer, true],
|
DEFAULT_PERMISSIONS,
|
||||||
),
|
AdminFlag.AddAdmin,
|
||||||
);
|
)
|
||||||
|
).encode();
|
||||||
|
addAdminData.push(data);
|
||||||
} else {
|
} else {
|
||||||
// Add new scoped
|
// Add new scoped
|
||||||
const data = await this.buildSignerPermissionRequest(
|
const data = (
|
||||||
|
await this.sendSignerPermissionRequest(
|
||||||
member.signer,
|
member.signer,
|
||||||
member.permissions,
|
member.permissions,
|
||||||
);
|
AdminFlag.None,
|
||||||
|
)
|
||||||
|
).encode();
|
||||||
addOrUpdateSignerData.push(data);
|
addOrUpdateSignerData.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
SignerPermissionsInput,
|
SignerPermissionsInput,
|
||||||
SignerWithPermissions,
|
SignerWithPermissions,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
import { AccountPermissions } from "./account-permissions";
|
|
||||||
import { buildTransactionFunction } from "../../common/transactions";
|
import { buildTransactionFunction } from "../../common/transactions";
|
||||||
|
import { AccountPermissions } from "./account-permissions";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TO BE REMOVED IN V4
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TO BE REMOVED IN V4
|
||||||
export class Account<TContract extends IAccountCore>
|
export class Account<TContract extends IAccountCore>
|
||||||
@@ -34,6 +34,10 @@ export class Account<TContract extends IAccountCore>
|
|||||||
detectContractFeature<IAccountCore>(
|
detectContractFeature<IAccountCore>(
|
||||||
this.contractWrapper,
|
this.contractWrapper,
|
||||||
"AccountPermissions",
|
"AccountPermissions",
|
||||||
|
) ||
|
||||||
|
detectContractFeature<IAccountCore>(
|
||||||
|
this.contractWrapper,
|
||||||
|
"AccountPermissionsV1",
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return new AccountPermissions(this.contractWrapper);
|
return new AccountPermissions(this.contractWrapper);
|
||||||
|
|||||||
@@ -100,11 +100,14 @@ export class DropClaimConditions<
|
|||||||
public async getActive(
|
public async getActive(
|
||||||
options?: ClaimConditionFetchOptions,
|
options?: ClaimConditionFetchOptions,
|
||||||
): Promise<ClaimCondition> {
|
): Promise<ClaimCondition> {
|
||||||
const cc = await this.get();
|
const [cc, metadata, tokenDecimals] = await Promise.all([
|
||||||
const metadata = await this.metadata.get();
|
this.get(),
|
||||||
|
this.metadata.get(),
|
||||||
|
this.getTokenDecimals(),
|
||||||
|
]);
|
||||||
return await transformResultToClaimCondition(
|
return await transformResultToClaimCondition(
|
||||||
cc,
|
cc,
|
||||||
await this.getTokenDecimals(),
|
tokenDecimals,
|
||||||
this.contractWrapper.getProvider(),
|
this.contractWrapper.getProvider(),
|
||||||
metadata.merkle || {},
|
metadata.merkle || {},
|
||||||
this.storage,
|
this.storage,
|
||||||
@@ -236,12 +239,6 @@ export class DropClaimConditions<
|
|||||||
let activeConditionIndex: BigNumber;
|
let activeConditionIndex: BigNumber;
|
||||||
let claimCondition: ClaimCondition;
|
let claimCondition: ClaimCondition;
|
||||||
|
|
||||||
const decimals = await this.getTokenDecimals();
|
|
||||||
const quantityWithDecimals = utils.parseUnits(
|
|
||||||
AmountSchema.parse(quantity),
|
|
||||||
decimals,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (addressToCheck === undefined) {
|
if (addressToCheck === undefined) {
|
||||||
try {
|
try {
|
||||||
addressToCheck = await this.contractWrapper.getSignerAddress();
|
addressToCheck = await this.contractWrapper.getSignerAddress();
|
||||||
@@ -255,7 +252,15 @@ export class DropClaimConditions<
|
|||||||
return [ClaimEligibility.NoWallet];
|
return [ClaimEligibility.NoWallet];
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedAddress = await resolveAddress(addressToCheck);
|
const [resolvedAddress, decimals] = await Promise.all([
|
||||||
|
resolveAddress(addressToCheck),
|
||||||
|
this.getTokenDecimals(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const quantityWithDecimals = utils.parseUnits(
|
||||||
|
AmountSchema.parse(quantity),
|
||||||
|
decimals,
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
claimCondition = await this.getActive();
|
claimCondition = await this.getActive();
|
||||||
@@ -487,7 +492,7 @@ export class DropClaimConditions<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not within a browser conetext, check for wallet balance.
|
// if not within a browser context, check for wallet balance.
|
||||||
// In browser context, let the wallet do that job
|
// In browser context, let the wallet do that job
|
||||||
if (claimCondition.price.gt(0) && isNode()) {
|
if (claimCondition.price.gt(0) && isNode()) {
|
||||||
const totalPrice = claimCondition.price.mul(BigNumber.from(quantity));
|
const totalPrice = claimCondition.price.mul(BigNumber.from(quantity));
|
||||||
@@ -528,8 +533,10 @@ export class DropClaimConditions<
|
|||||||
const merkleRoot = claimCondition.merkleRoot;
|
const merkleRoot = claimCondition.merkleRoot;
|
||||||
const merkleRootArray = utils.stripZeros(merkleRoot);
|
const merkleRootArray = utils.stripZeros(merkleRoot);
|
||||||
if (merkleRootArray.length > 0) {
|
if (merkleRootArray.length > 0) {
|
||||||
const metadata = await this.metadata.get();
|
const [metadata, resolvedAddress] = await Promise.all([
|
||||||
const resolvedAddress = await resolveAddress(claimerAddress);
|
this.metadata.get(),
|
||||||
|
resolveAddress(claimerAddress),
|
||||||
|
]);
|
||||||
return await fetchSnapshotEntryForAddress(
|
return await fetchSnapshotEntryForAddress(
|
||||||
resolvedAddress,
|
resolvedAddress,
|
||||||
merkleRoot.toString(),
|
merkleRoot.toString(),
|
||||||
@@ -820,13 +827,14 @@ export class DropClaimConditions<
|
|||||||
decimals = 0,
|
decimals = 0,
|
||||||
address?: string,
|
address?: string,
|
||||||
): Promise<ClaimVerification> {
|
): Promise<ClaimVerification> {
|
||||||
const addressToClaim = address
|
const [addressToClaim, activeClaimConditions] = await Promise.all([
|
||||||
? address
|
address ? address : this.contractWrapper.getSignerAddress(),
|
||||||
: await this.contractWrapper.getSignerAddress();
|
this.getActive(),
|
||||||
|
]);
|
||||||
return prepareClaim(
|
return prepareClaim(
|
||||||
addressToClaim,
|
addressToClaim,
|
||||||
quantity,
|
quantity,
|
||||||
await this.getActive(),
|
activeClaimConditions,
|
||||||
async () => (await this.metadata.get()).merkle,
|
async () => (await this.metadata.get()).merkle,
|
||||||
decimals,
|
decimals,
|
||||||
this.contractWrapper,
|
this.contractWrapper,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { generateExtensionFunctions } from "../../common/plugin/generatePluginFu
|
|||||||
import { Abi, AbiSchema, CommonContractSchema } from "../../schema";
|
import { Abi, AbiSchema, CommonContractSchema } from "../../schema";
|
||||||
import { utils } from "ethers";
|
import { utils } from "ethers";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
import { ExtensionAddedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/CoreRouter";
|
|
||||||
import {
|
import {
|
||||||
THIRDWEB_DEPLOYER,
|
THIRDWEB_DEPLOYER,
|
||||||
deployContractDeterministic,
|
deployContractDeterministic,
|
||||||
@@ -26,9 +25,12 @@ import {
|
|||||||
} from "../../common";
|
} from "../../common";
|
||||||
import { joinABIs } from "../../common/plugin/joinABIs";
|
import { joinABIs } from "../../common/plugin/joinABIs";
|
||||||
import { TransactionReceipt } from "@ethersproject/abstract-provider";
|
import { TransactionReceipt } from "@ethersproject/abstract-provider";
|
||||||
import { ExtensionRemovedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/CoreRouter";
|
|
||||||
import { ExtensionReplacedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/BaseRouter";
|
|
||||||
import { DynamicContractExtensionMetadataOrUri } from "../../types";
|
import { DynamicContractExtensionMetadataOrUri } from "../../types";
|
||||||
|
import {
|
||||||
|
ExtensionAddedEvent,
|
||||||
|
ExtensionRemovedEvent,
|
||||||
|
ExtensionReplacedEvent,
|
||||||
|
} from "@thirdweb-dev/contracts-js/dist/declarations/src/BaseRouter";
|
||||||
|
|
||||||
export class ExtensionManager implements DetectableFeature {
|
export class ExtensionManager implements DetectableFeature {
|
||||||
featureName = FEATURE_DYNAMIC_CONTRACT.name;
|
featureName = FEATURE_DYNAMIC_CONTRACT.name;
|
||||||
|
|||||||
@@ -285,12 +285,11 @@ export class MarketplaceAuction {
|
|||||||
async (
|
async (
|
||||||
listings: NewAuctionListing[],
|
listings: NewAuctionListing[],
|
||||||
): Promise<Transaction<TransactionResultWithId[]>> => {
|
): Promise<Transaction<TransactionResultWithId[]>> => {
|
||||||
const data = await Promise.all(
|
const data = (
|
||||||
listings.map(async (listing) => {
|
await Promise.all(
|
||||||
const tx = await this.createListing.prepare(listing);
|
listings.map((listing) => this.createListing.prepare(listing)),
|
||||||
return tx.encode();
|
)
|
||||||
}),
|
).map((tx) => tx.encode());
|
||||||
);
|
|
||||||
|
|
||||||
return Transaction.fromContractWrapper({
|
return Transaction.fromContractWrapper({
|
||||||
contractWrapper: this.contractWrapper,
|
contractWrapper: this.contractWrapper,
|
||||||
@@ -576,7 +575,7 @@ export class MarketplaceAuction {
|
|||||||
const [currentBidBufferBps, winningBid, listing] = await Promise.all([
|
const [currentBidBufferBps, winningBid, listing] = await Promise.all([
|
||||||
this.getBidBufferBps(),
|
this.getBidBufferBps(),
|
||||||
this.getWinningBid(listingId),
|
this.getWinningBid(listingId),
|
||||||
await this.validateListing(BigNumber.from(listingId)),
|
this.validateListing(BigNumber.from(listingId)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const currentBidOrReservePrice = winningBid
|
const currentBidOrReservePrice = winningBid
|
||||||
|
|||||||
@@ -239,12 +239,11 @@ export class MarketplaceDirect {
|
|||||||
async (
|
async (
|
||||||
listings: NewDirectListing[],
|
listings: NewDirectListing[],
|
||||||
): Promise<Transaction<TransactionResultWithId[]>> => {
|
): Promise<Transaction<TransactionResultWithId[]>> => {
|
||||||
const data = await Promise.all(
|
const data = (
|
||||||
listings.map(async (listing) => {
|
await Promise.all(
|
||||||
const tx = await this.createListing.prepare(listing);
|
listings.map((listing) => this.createListing.prepare(listing)),
|
||||||
return tx.encode();
|
)
|
||||||
}),
|
).map((tx) => tx.encode());
|
||||||
);
|
|
||||||
|
|
||||||
return Transaction.fromContractWrapper({
|
return Transaction.fromContractWrapper({
|
||||||
contractWrapper: this.contractWrapper,
|
contractWrapper: this.contractWrapper,
|
||||||
|
|||||||
@@ -414,12 +414,11 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
|||||||
async (
|
async (
|
||||||
listings: DirectListingInputParams[],
|
listings: DirectListingInputParams[],
|
||||||
): Promise<Transaction<TransactionResultWithId[]>> => {
|
): Promise<Transaction<TransactionResultWithId[]>> => {
|
||||||
const data = await Promise.all(
|
const data = (
|
||||||
listings.map(async (listing) => {
|
await Promise.all(
|
||||||
const tx = await this.createListing.prepare(listing);
|
listings.map((listing) => this.createListing.prepare(listing)),
|
||||||
return tx.encode();
|
)
|
||||||
}),
|
).map((tx) => tx.encode());
|
||||||
);
|
|
||||||
|
|
||||||
return Transaction.fromContractWrapper({
|
return Transaction.fromContractWrapper({
|
||||||
contractWrapper: this
|
contractWrapper: this
|
||||||
|
|||||||
@@ -404,12 +404,11 @@ export class MarketplaceV3EnglishAuctions<
|
|||||||
async (
|
async (
|
||||||
listings: EnglishAuctionInputParams[],
|
listings: EnglishAuctionInputParams[],
|
||||||
): Promise<Transaction<TransactionResultWithId[]>> => {
|
): Promise<Transaction<TransactionResultWithId[]>> => {
|
||||||
const data = await Promise.all(
|
const data = (
|
||||||
listings.map(async (listing) => {
|
await Promise.all(
|
||||||
const tx = await this.createAuction.prepare(listing);
|
listings.map((listing) => this.createAuction.prepare(listing)),
|
||||||
return tx.encode();
|
)
|
||||||
}),
|
).map((tx) => tx.encode());
|
||||||
);
|
|
||||||
|
|
||||||
return Transaction.fromContractWrapper({
|
return Transaction.fromContractWrapper({
|
||||||
contractWrapper: this
|
contractWrapper: this
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import type { IAccountPermissions } from "@thirdweb-dev/contracts-js";
|
import type {
|
||||||
|
IAccountPermissions,
|
||||||
|
IAccountPermissions_V1,
|
||||||
|
} from "@thirdweb-dev/contracts-js";
|
||||||
import { BigNumber, BytesLike } from "ethers";
|
import { BigNumber, BytesLike } from "ethers";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { AmountSchema } from "../../core/schema/shared";
|
import { AmountSchema } from "../../core/schema/shared";
|
||||||
@@ -12,12 +15,27 @@ export type SignerPermissions = {
|
|||||||
approvedCallTargets: string[];
|
approvedCallTargets: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum AdminFlag {
|
||||||
|
None = 0,
|
||||||
|
AddAdmin = 1,
|
||||||
|
RemoveAdmin = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_PERMISSIONS = {
|
||||||
|
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
|
||||||
|
startDate: BigNumber.from(0),
|
||||||
|
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
|
||||||
|
expirationDate: BigNumber.from(0),
|
||||||
|
approvedCallTargets: [],
|
||||||
|
nativeTokenLimitPerTransaction: "0",
|
||||||
|
};
|
||||||
|
|
||||||
export const SignerPermissionsSchema = /* @__PURE__ */ (() =>
|
export const SignerPermissionsSchema = /* @__PURE__ */ (() =>
|
||||||
z.object({
|
z.object({
|
||||||
startDate: StartDateSchema,
|
startDate: StartDateSchema,
|
||||||
expirationDate: EndDateSchema,
|
expirationDate: EndDateSchema,
|
||||||
nativeTokenLimitPerTransaction: AmountSchema.default(0),
|
nativeTokenLimitPerTransaction: AmountSchema.default(0),
|
||||||
approvedCallTargets: z.array(AddressOrEnsSchema),
|
approvedCallTargets: z.union([z.array(AddressOrEnsSchema), z.literal("*")]),
|
||||||
}))();
|
}))();
|
||||||
|
|
||||||
export type SignerPermissionsInput = z.input<typeof SignerPermissionsSchema>;
|
export type SignerPermissionsInput = z.input<typeof SignerPermissionsSchema>;
|
||||||
@@ -48,7 +66,12 @@ export type SignedSignerPermissionsPayload = {
|
|||||||
signature: BytesLike;
|
signature: BytesLike;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SignerPermissionRequest = [
|
export type SignedSignerPermissionsPayloadV1 = {
|
||||||
|
payload: IAccountPermissions_V1.SignerPermissionRequestStruct;
|
||||||
|
signature: BytesLike;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SignerPermissionRequestV1 = [
|
||||||
{ name: "signer", type: "address" },
|
{ name: "signer", type: "address" },
|
||||||
{ name: "approvedTargets", type: "address[]" },
|
{ name: "approvedTargets", type: "address[]" },
|
||||||
{ name: "nativeTokenLimitPerTransaction", type: "uint256" },
|
{ name: "nativeTokenLimitPerTransaction", type: "uint256" },
|
||||||
@@ -58,3 +81,15 @@ export const SignerPermissionRequest = [
|
|||||||
{ name: "reqValidityEndTimestamp", type: "uint128" },
|
{ name: "reqValidityEndTimestamp", type: "uint128" },
|
||||||
{ name: "uid", type: "bytes32" },
|
{ name: "uid", type: "bytes32" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const SignerPermissionRequest = [
|
||||||
|
{ name: "signer", type: "address" },
|
||||||
|
{ name: "isAdmin", type: "uint8" },
|
||||||
|
{ name: "approvedTargets", type: "address[]" },
|
||||||
|
{ name: "nativeTokenLimitPerTransaction", type: "uint256" },
|
||||||
|
{ name: "permissionStartTimestamp", type: "uint128" },
|
||||||
|
{ name: "permissionEndTimestamp", type: "uint128" },
|
||||||
|
{ name: "reqValidityStartTimestamp", type: "uint128" },
|
||||||
|
{ name: "reqValidityEndTimestamp", type: "uint128" },
|
||||||
|
{ name: "uid", type: "bytes32" },
|
||||||
|
];
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
} from "../../src/evm";
|
} from "../../src/evm";
|
||||||
import { ContractFactory, utils } from "ethers";
|
import { ContractFactory, utils } from "ethers";
|
||||||
import EntrypointArtifact from "./mock/EntryPoint.json";
|
import EntrypointArtifact from "./mock/EntryPoint.json";
|
||||||
import AccountFactoryArtifact from "./mock/AccountFactory.json";
|
|
||||||
|
|
||||||
// Target ABIs
|
// Target ABIs
|
||||||
import IAccountCoreAbi from "@thirdweb-dev/contracts-js/dist/abis/IAccountCore.json";
|
import IAccountCoreAbi from "@thirdweb-dev/contracts-js/dist/abis/IAccountCore.json";
|
||||||
@@ -17,7 +16,12 @@ import {
|
|||||||
deployContractAndUploadMetadata,
|
deployContractAndUploadMetadata,
|
||||||
mockUploadContractMetadata,
|
mockUploadContractMetadata,
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
import { IAccountCore, IAccountFactory } from "@thirdweb-dev/contracts-js";
|
import {
|
||||||
|
AccountFactory__factory,
|
||||||
|
IAccountCore,
|
||||||
|
IAccountFactory,
|
||||||
|
} from "@thirdweb-dev/contracts-js";
|
||||||
|
import { AddressZero } from "../../src/evm/constants/addresses/AddressZero";
|
||||||
|
|
||||||
describe("Accounts with account factory", function () {
|
describe("Accounts with account factory", function () {
|
||||||
let accountFactory: AccountFactory<IAccountFactory>;
|
let accountFactory: AccountFactory<IAccountFactory>;
|
||||||
@@ -57,8 +61,8 @@ describe("Accounts with account factory", function () {
|
|||||||
adminWallet,
|
adminWallet,
|
||||||
).deploy();
|
).deploy();
|
||||||
const factoryAddress = await deployContractAndUploadMetadata(
|
const factoryAddress = await deployContractAndUploadMetadata(
|
||||||
AccountFactoryArtifact.abi,
|
AccountFactory__factory.abi,
|
||||||
AccountFactoryArtifact.bytecode.object,
|
AccountFactory__factory.bytecode,
|
||||||
adminWallet,
|
adminWallet,
|
||||||
[entrypoint.address],
|
[entrypoint.address],
|
||||||
);
|
);
|
||||||
@@ -124,8 +128,8 @@ describe("Accounts with account factory", function () {
|
|||||||
accountAddress,
|
accountAddress,
|
||||||
IAccountCoreAbi,
|
IAccountCoreAbi,
|
||||||
);
|
);
|
||||||
const account = (await sdk.getContract(accountAddress)).account;
|
const acc = (await sdk.getContract(accountAddress)).account;
|
||||||
const allAdmins = await account.getAllAdmins();
|
const allAdmins = await acc.getAllAdmins();
|
||||||
assert.isTrue(
|
assert.isTrue(
|
||||||
allAdmins.length === 1,
|
allAdmins.length === 1,
|
||||||
"Account should only have one admin.",
|
"Account should only have one admin.",
|
||||||
@@ -139,8 +143,9 @@ describe("Accounts with account factory", function () {
|
|||||||
"Correct admin for account.",
|
"Correct admin for account.",
|
||||||
);
|
);
|
||||||
|
|
||||||
const associatedAccounts =
|
const associatedAccounts = await accountFactory.getAssociatedAccounts(
|
||||||
await accountFactory.getAssociatedAccounts(admin);
|
admin,
|
||||||
|
);
|
||||||
|
|
||||||
assert.isTrue(
|
assert.isTrue(
|
||||||
associatedAccounts.length === 1,
|
associatedAccounts.length === 1,
|
||||||
@@ -185,65 +190,65 @@ describe("Accounts with account factory", function () {
|
|||||||
account = (await sdk.getContract(accountAddress)).account;
|
account = (await sdk.getContract(accountAddress)).account;
|
||||||
});
|
});
|
||||||
|
|
||||||
// it("Should be able to add another admin to the account.", async () => {
|
it("Should be able to add another admin to the account.", async () => {
|
||||||
// assert.isFalse(
|
assert.isFalse(
|
||||||
// await account.isAdmin(signer1Wallet.address),
|
await account.isAdmin(signer1Wallet.address),
|
||||||
// "New signer1 should not be an admin on the account.",
|
"New signer1 should not be an admin on the account.",
|
||||||
// );
|
);
|
||||||
|
|
||||||
// await account.grantAdminPermissions(signer1Wallet.address);
|
await account.grantAdminPermissions(signer1Wallet.address);
|
||||||
|
|
||||||
// assert.isTrue(
|
assert.isTrue(
|
||||||
// await account.isAdmin(signer1Wallet.address),
|
await account.isAdmin(signer1Wallet.address),
|
||||||
// "New signer1 should be an admin on the account.",
|
"New signer1 should be an admin on the account.",
|
||||||
// );
|
);
|
||||||
|
|
||||||
// const isAdmin = (await account.getAllAdmins()).includes(
|
const isAdmin = (await account.getAllAdmins()).includes(
|
||||||
// utils.getAddress(signer1Wallet.address),
|
utils.getAddress(signer1Wallet.address),
|
||||||
// );
|
);
|
||||||
|
|
||||||
// assert.isTrue(isAdmin, "New signer1 should be an admin on the account.");
|
assert.isTrue(isAdmin, "New signer1 should be an admin on the account.");
|
||||||
|
|
||||||
// assert.isTrue(
|
assert.isTrue(
|
||||||
// (
|
(
|
||||||
// await accountFactory.getAssociatedAccounts(signer1Wallet.address)
|
await accountFactory.getAssociatedAccounts(signer1Wallet.address)
|
||||||
// ).includes(account.getAddress()),
|
).includes(account.getAddress()),
|
||||||
// "Wallet is an associated account of the signer.",
|
"Wallet is an associated account of the signer.",
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it("Should be able to remove an admin from the account.", async () => {
|
it("Should be able to remove an admin from the account.", async () => {
|
||||||
// await account.grantAdminPermissions(signer1Wallet.address);
|
await account.grantAdminPermissions(signer1Wallet.address);
|
||||||
// assert.isTrue(
|
assert.isTrue(
|
||||||
// await account.isAdmin(signer1Wallet.address),
|
await account.isAdmin(signer1Wallet.address),
|
||||||
// "New signer1 should be an admin on the account.",
|
"New signer1 should be an admin on the account.",
|
||||||
// );
|
);
|
||||||
|
|
||||||
// await account.revokeAdminPermissions(signer1Wallet.address);
|
await account.revokeAdminPermissions(signer1Wallet.address);
|
||||||
|
|
||||||
// assert.isFalse(
|
assert.isFalse(
|
||||||
// await account.isAdmin(signer1Wallet.address),
|
await account.isAdmin(signer1Wallet.address),
|
||||||
// "New signer1 should not be an admin on the account.",
|
"New signer1 should not be an admin on the account.",
|
||||||
// );
|
);
|
||||||
|
|
||||||
// assert.isFalse(
|
assert.isFalse(
|
||||||
// (await account.getAllSigners())
|
(await account.getAllSigners())
|
||||||
// .map((result) => utils.getAddress(result.signer))
|
.map((result) => utils.getAddress(result.signer))
|
||||||
// .includes(signer1Wallet.address),
|
.includes(signer1Wallet.address),
|
||||||
// "New signer1 should not be an admin on the account.",
|
"New signer1 should not be an admin on the account.",
|
||||||
// );
|
);
|
||||||
|
|
||||||
// assert.isFalse(
|
assert.isFalse(
|
||||||
// (await account.getAllAdmins()).includes(signer1Wallet.address),
|
(await account.getAllAdmins()).includes(signer1Wallet.address),
|
||||||
// "New signer1 is not an associated signer of the account.",
|
"New signer1 is not an associated signer of the account.",
|
||||||
// );
|
);
|
||||||
// assert.isFalse(
|
assert.isFalse(
|
||||||
// (
|
(
|
||||||
// await accountFactory.getAssociatedAccounts(signer1Wallet.address)
|
await accountFactory.getAssociatedAccounts(signer1Wallet.address)
|
||||||
// ).includes(account.getAddress()),
|
).includes(account.getAddress()),
|
||||||
// "Wallet is not an associated account of the signer.",
|
"Wallet is not an associated account of the signer.",
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
it("Should be able to grant restricted access to a new signer.", async () => {
|
it("Should be able to grant restricted access to a new signer.", async () => {
|
||||||
const signersWithRestrictions = await account.getAllSigners();
|
const signersWithRestrictions = await account.getAllSigners();
|
||||||
@@ -306,6 +311,56 @@ describe("Accounts with account factory", function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should be able to restrict approved targets.", async () => {
|
||||||
|
// Grant access
|
||||||
|
await account.grantPermissions(signer1Wallet.address, {
|
||||||
|
nativeTokenLimitPerTransaction: "1",
|
||||||
|
approvedCallTargets: [adminWallet.address],
|
||||||
|
});
|
||||||
|
|
||||||
|
const s = await account.getAllSigners();
|
||||||
|
const restrictions = s.find(
|
||||||
|
(result) =>
|
||||||
|
utils.getAddress(result.signer) ===
|
||||||
|
utils.getAddress(signer1Wallet.address),
|
||||||
|
)?.permissions as SignerPermissions;
|
||||||
|
assert.strictEqual(
|
||||||
|
restrictions.approvedCallTargets.length,
|
||||||
|
1,
|
||||||
|
"New signer1 should have one approved call targets.",
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
restrictions.approvedCallTargets[0],
|
||||||
|
adminWallet.address,
|
||||||
|
"New signer1 should have the expected approved call targets.",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should be able to approve any target.", async () => {
|
||||||
|
// Grant access
|
||||||
|
await account.grantPermissions(signer1Wallet.address, {
|
||||||
|
nativeTokenLimitPerTransaction: "1",
|
||||||
|
approvedCallTargets: "*",
|
||||||
|
});
|
||||||
|
|
||||||
|
const s = await account.getAllSigners();
|
||||||
|
const restrictions = s.find(
|
||||||
|
(result) =>
|
||||||
|
utils.getAddress(result.signer) ===
|
||||||
|
utils.getAddress(signer1Wallet.address),
|
||||||
|
)?.permissions as SignerPermissions;
|
||||||
|
assert.strictEqual(
|
||||||
|
restrictions.approvedCallTargets.length,
|
||||||
|
1,
|
||||||
|
"New signer1 should have one approved call targets.",
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
restrictions.approvedCallTargets[0],
|
||||||
|
AddressZero,
|
||||||
|
"New signer1 should have the expected approved call targets.",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("Should not be able to grant restricted access to a signer who already has access.", async () => {
|
it("Should not be able to grant restricted access to a signer who already has access.", async () => {
|
||||||
// Grant access to signer1
|
// Grant access to signer1
|
||||||
await account.grantPermissions(signer1Wallet.address, {
|
await account.grantPermissions(signer1Wallet.address, {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ export const mochaHooks = {
|
|||||||
if (contractType === "custom" || contractType === "marketplace-v3") {
|
if (contractType === "custom" || contractType === "marketplace-v3") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let factories: any[] = [];
|
const factories: any[] = [];
|
||||||
switch (contractType) {
|
switch (contractType) {
|
||||||
case TokenInitializer.contractType:
|
case TokenInitializer.contractType:
|
||||||
factories.push(TokenERC20__factory);
|
factories.push(TokenERC20__factory);
|
||||||
@@ -367,7 +367,7 @@ async function setupMultichainRegistry(
|
|||||||
|
|
||||||
// Setup marketplace-v3 for tests
|
// Setup marketplace-v3 for tests
|
||||||
async function setupMarketplaceV3(): Promise<string> {
|
async function setupMarketplaceV3(): Promise<string> {
|
||||||
let extensions: Extension[] = [];
|
const extensions: Extension[] = [];
|
||||||
|
|
||||||
// Direct Listings
|
// Direct Listings
|
||||||
const directListingsExtensionAddress = await deployContractAndUploadMetadata(
|
const directListingsExtensionAddress = await deployContractAndUploadMetadata(
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# @thirdweb-dev/unity-js-bridge
|
# @thirdweb-dev/unity-js-bridge
|
||||||
|
|
||||||
|
## 0.2.90
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/auth@4.0.4
|
||||||
|
|
||||||
|
## 0.2.89
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
- @thirdweb-dev/auth@4.0.3
|
||||||
|
|
||||||
## 0.2.88
|
## 0.2.88
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/unity-js-bridge",
|
"name": "@thirdweb-dev/unity-js-bridge",
|
||||||
"version": "0.2.88",
|
"version": "0.2.90",
|
||||||
"main": "dist/thirdweb-unity-bridge.js",
|
"main": "dist/thirdweb-unity-bridge.js",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
# @thirdweb-dev/wallets
|
# @thirdweb-dev/wallets
|
||||||
|
|
||||||
|
## 2.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.15
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
|
||||||
|
## 2.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/wallets",
|
"name": "@thirdweb-dev/wallets",
|
||||||
"version": "2.0.2",
|
"version": "2.0.4",
|
||||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||||
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
|
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
|
||||||
|
|||||||
Generated
+28
-5
@@ -380,8 +380,8 @@ importers:
|
|||||||
packages/contracts-js:
|
packages/contracts-js:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@thirdweb-dev/contracts':
|
'@thirdweb-dev/contracts':
|
||||||
specifier: 3.10.2-3
|
specifier: 3.10.3-1
|
||||||
version: 3.10.2-3([email protected])
|
version: 3.10.3-1([email protected])
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@babel/preset-env':
|
'@babel/preset-env':
|
||||||
specifier: ^7.22.9
|
specifier: ^7.22.9
|
||||||
@@ -827,6 +827,9 @@ importers:
|
|||||||
react-native-device-info:
|
react-native-device-info:
|
||||||
specifier: 10.6.0
|
specifier: 10.6.0
|
||||||
version: 10.6.0([email protected])
|
version: 10.6.0([email protected])
|
||||||
|
react-native-inappbrowser-reborn:
|
||||||
|
specifier: ^3.7.0
|
||||||
|
version: 3.7.0([email protected])
|
||||||
react-native-quick-base64:
|
react-native-quick-base64:
|
||||||
specifier: ^2.0.7
|
specifier: ^2.0.7
|
||||||
version: 2.0.7([email protected])([email protected])
|
version: 2.0.7([email protected])([email protected])
|
||||||
@@ -12030,8 +12033,9 @@ packages:
|
|||||||
use-sync-external-store: 1.2.0([email protected])
|
use-sync-external-store: 1.2.0([email protected])
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@thirdweb-dev/[email protected].2-3([email protected]):
|
/@thirdweb-dev/[email protected].3-1([email protected]):
|
||||||
resolution: {integrity: sha512-QWO9HT4k3s86oMyE/SbDWhgm/Na9FnxOkVjhyuOigmrwq5NlNp7NCcmecQgILxvUiLXO9if9OeFlYCFGsJinng==}
|
resolution: {integrity: sha512-eiGS1Q2+Ge48yEO+kBw0DqR6eTN6ip4vrY0eBoaUrpcFAudd+aW+qszxCFBUuKSHIxvRs3Ul2b64pdYFEXzMIA==}
|
||||||
|
engines: {node: '>=20.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@chainlink/contracts': 0.6.1([email protected])
|
'@chainlink/contracts': 0.6.1([email protected])
|
||||||
'@openzeppelin/contracts': 4.9.3
|
'@openzeppelin/contracts': 4.9.3
|
||||||
@@ -23999,6 +24003,13 @@ packages:
|
|||||||
is-docker: 2.2.1
|
is-docker: 2.2.1
|
||||||
is-wsl: 2.2.0
|
is-wsl: 2.2.0
|
||||||
|
|
||||||
|
/[email protected]:
|
||||||
|
resolution: {integrity: sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==}
|
||||||
|
hasBin: true
|
||||||
|
requiresBuild: true
|
||||||
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/[email protected]:
|
/[email protected]:
|
||||||
resolution: {integrity: sha512-hgJa2aQKcM2hn3eyVtN12tEA45ECjTJPXCgUh5YzTzy9qwapCvmDTVPWOcWVL0d34zeQoQ/hbG9lJhl3AYxJlQ==}
|
resolution: {integrity: sha512-hgJa2aQKcM2hn3eyVtN12tEA45ECjTJPXCgUh5YzTzy9qwapCvmDTVPWOcWVL0d34zeQoQ/hbG9lJhl3AYxJlQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -25539,7 +25550,7 @@ packages:
|
|||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
protobufjs: ^7.0.0
|
protobufjs: '>=7.2.4'
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
escodegen: 1.14.3
|
escodegen: 1.14.3
|
||||||
@@ -25910,6 +25921,18 @@ packages:
|
|||||||
/[email protected]:
|
/[email protected]:
|
||||||
resolution: {integrity: sha512-1dVk9NwhoyKHCSxcrM6vY6cxmojeATsBobDicX0ZKr7DgUF2cBQRTKsimQFvzH8XhOVXyH8p4HyDSZNIFI8OlQ==}
|
resolution: {integrity: sha512-1dVk9NwhoyKHCSxcrM6vY6cxmojeATsBobDicX0ZKr7DgUF2cBQRTKsimQFvzH8XhOVXyH8p4HyDSZNIFI8OlQ==}
|
||||||
|
|
||||||
|
/[email protected]([email protected]):
|
||||||
|
resolution: {integrity: sha512-Ia53jYNtFcbNaX5W3QfOmN25I7bcvuDiQmSY5zABXjy4+WI20bPc9ua09li55F8yDCjv3C99jX6vKms68mBV7g==}
|
||||||
|
requiresBuild: true
|
||||||
|
peerDependencies:
|
||||||
|
react-native: '>=0.56'
|
||||||
|
dependencies:
|
||||||
|
invariant: 2.2.4
|
||||||
|
opencollective-postinstall: 2.0.3
|
||||||
|
react-native: 0.71.11(@babel/[email protected])(@babel/[email protected])([email protected])
|
||||||
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/[email protected]([email protected])([email protected]):
|
/[email protected]([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-0hYNOTbsjJ5j5cpX+qjwReGIxuYE9MWRsyPQ72fTOvzmEjYXCF4Wr2VQoqx8R6W1/Uinekvln7dGvJ4RExmHhQ==}
|
resolution: {integrity: sha512-0hYNOTbsjJ5j5cpX+qjwReGIxuYE9MWRsyPQ72fTOvzmEjYXCF4Wr2VQoqx8R6W1/Uinekvln7dGvJ4RExmHhQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user