thirdweb 5.61.7-nightly-da9f1964e4ae74ed5d33666788e2d16e4d56614d-20241015000333 → 5.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/exports/extensions/erc1155.js +3 -1
- package/dist/cjs/exports/extensions/erc1155.js.map +1 -1
- package/dist/cjs/extensions/erc1155/write/mintToBatch.js +79 -0
- package/dist/cjs/extensions/erc1155/write/mintToBatch.js.map +1 -0
- package/dist/cjs/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js +15 -4
- package/dist/cjs/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/cjs/react/native/ui/components/WalletImage.js +3 -2
- package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +6 -6
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js +2 -2
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ReceiveScreen.js +2 -2
- package/dist/cjs/react/native/ui/connect/ReceiveScreen.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +8 -0
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -0
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +11 -16
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js +7 -0
- package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +9 -12
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.js +2 -2
- package/dist/cjs/wallets/in-app/core/actions/generate-wallet.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.js +2 -2
- package/dist/cjs/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-transaction.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-typed-data.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/core/authentication/client-scoped-storage.js +9 -2
- package/dist/cjs/wallets/in-app/core/authentication/client-scoped-storage.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +4 -8
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js +1 -1
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +14 -0
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js +3 -2
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/constants.js +2 -1
- package/dist/cjs/wallets/in-app/native/helpers/constants.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js +133 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js.map +1 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js +2 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +50 -28
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js +2 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +13 -13
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js.map +1 -1
- package/dist/esm/exports/extensions/erc1155.js +1 -0
- package/dist/esm/exports/extensions/erc1155.js.map +1 -1
- package/dist/esm/extensions/erc1155/write/mintToBatch.js +76 -0
- package/dist/esm/extensions/erc1155/write/mintToBatch.js.map +1 -0
- package/dist/esm/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js +15 -4
- package/dist/esm/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/esm/react/native/ui/components/WalletImage.js +3 -2
- package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +6 -6
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js +2 -2
- package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ReceiveScreen.js +2 -2
- package/dist/esm/react/native/ui/connect/ReceiveScreen.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js +8 -0
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -0
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +12 -17
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/PassKeyLogin.js +7 -0
- package/dist/esm/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +9 -12
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.js +2 -2
- package/dist/esm/wallets/in-app/core/actions/generate-wallet.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.js +2 -2
- package/dist/esm/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-transaction.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-typed-data.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/core/authentication/client-scoped-storage.js +9 -2
- package/dist/esm/wallets/in-app/core/authentication/client-scoped-storage.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +4 -8
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/passkeys.js +1 -1
- package/dist/esm/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +14 -0
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js +3 -2
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/constants.js +1 -0
- package/dist/esm/wallets/in-app/native/helpers/constants.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js +130 -0
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js.map +1 -0
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js +2 -2
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +50 -28
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js +2 -2
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +13 -13
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js.map +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts +1 -0
- package/dist/types/exports/extensions/erc1155.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/write/mintToBatch.d.ts +72 -0
- package/dist/types/extensions/erc1155/write/mintToBatch.d.ts.map +1 -0
- package/dist/types/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/WalletImage.d.ts +2 -0
- package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ReceiveScreen.d.ts +2 -0
- package/dist/types/react/native/ui/connect/ReceiveScreen.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/OTPLoginUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/actions/generate-wallet.enclave.d.ts +13 -0
- package/dist/types/wallets/in-app/core/actions/generate-wallet.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/get-enclave-user-status.d.ts +14 -0
- package/dist/types/wallets/in-app/core/actions/get-enclave-user-status.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/sign-message.enclave.d.ts +17 -0
- package/dist/types/wallets/in-app/core/actions/sign-message.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/sign-transaction.enclave.d.ts +9 -0
- package/dist/types/wallets/in-app/core/actions/sign-transaction.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.d.ts +3 -5
- package/dist/types/wallets/in-app/core/actions/sign-typed-data.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/authentication/client-scoped-storage.d.ts +4 -3
- package/dist/types/wallets/in-app/core/authentication/client-scoped-storage.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts +6 -7
- package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/constants.d.ts +1 -0
- package/dist/types/wallets/in-app/native/helpers/constants.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts +17 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts.map +1 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/retrieval.d.ts +27 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/retrieval.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/native-connector.d.ts +2 -2
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/exports/extensions/erc1155.ts +5 -0
- package/src/extensions/erc1155/write/mintToBatch.test.ts +74 -0
- package/src/extensions/erc1155/write/mintToBatch.ts +117 -0
- package/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.test.ts +75 -80
- package/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.ts +18 -4
- package/src/react/native/ui/components/WalletImage.tsx +5 -2
- package/src/react/native/ui/connect/ConnectModal.tsx +19 -2
- package/src/react/native/ui/connect/ConnectedButton.tsx +8 -2
- package/src/react/native/ui/connect/ConnectedModal.tsx +9 -2
- package/src/react/native/ui/connect/ReceiveScreen.tsx +5 -2
- package/src/react/web/wallets/in-app/WalletAuth.tsx +8 -0
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +1 -0
- package/src/react/web/wallets/shared/OTPLoginUI.tsx +12 -18
- package/src/react/web/wallets/shared/PassKeyLogin.tsx +7 -0
- package/src/react/web/wallets/shared/SocialLogin.tsx +9 -12
- package/src/version.ts +1 -1
- package/src/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.ts +6 -8
- package/src/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.ts +5 -5
- package/src/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.ts +7 -9
- package/src/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.ts +8 -10
- package/src/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.ts +7 -9
- package/src/wallets/in-app/core/authentication/client-scoped-storage.ts +6 -4
- package/src/wallets/in-app/core/authentication/guest.ts +1 -1
- package/src/wallets/in-app/core/wallet/enclave-wallet.ts +11 -17
- package/src/wallets/in-app/native/auth/passkeys.ts +1 -1
- package/src/wallets/in-app/native/helpers/api/fetchers.ts +14 -0
- package/src/wallets/in-app/native/helpers/auth/middleware.ts +3 -2
- package/src/wallets/in-app/native/helpers/constants.ts +2 -0
- package/src/wallets/in-app/native/helpers/wallet/migration.ts +185 -0
- package/src/wallets/in-app/native/helpers/wallet/retrieval.ts +2 -2
- package/src/wallets/in-app/native/native-connector.ts +62 -28
- package/src/wallets/in-app/web/lib/auth/iframe-auth.ts +2 -2
- package/src/wallets/in-app/web/lib/auth/passkeys.ts +1 -1
- package/src/wallets/in-app/web/lib/web-connector.ts +13 -13
- package/src/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.ts +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/generate-wallet.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/generate-wallet.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts +0 -15
- package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts +0 -14
- package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts +0 -19
- package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts +0 -11
- package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-typed-data.enclave.d.ts.map +0 -1
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
encryptDecrypt,
|
15
15
|
isEncryptDecryptSupported,
|
16
16
|
} from "../../__generated__/IDelayedReveal/read/encryptDecrypt.js";
|
17
|
+
import { nextTokenIdToMint } from "../../__generated__/IERC721Enumerable/read/nextTokenIdToMint.js";
|
17
18
|
import {
|
18
19
|
lazyMint as generatedLazyMint,
|
19
20
|
isLazyMintSupported,
|
@@ -80,16 +81,29 @@ export function createDelayedRevealBatch(
|
|
80
81
|
return generatedLazyMint({
|
81
82
|
contract: options.contract,
|
82
83
|
asyncParams: async () => {
|
83
|
-
const placeholderUris = await
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
const [placeholderUris, startFileNumber] = await Promise.all([
|
85
|
+
upload({
|
86
|
+
client: options.contract.client,
|
87
|
+
files: Array(options.metadata.length).fill(
|
88
|
+
options.placeholderMetadata,
|
89
|
+
),
|
90
|
+
}),
|
91
|
+
nextTokenIdToMint({
|
92
|
+
contract: options.contract,
|
93
|
+
}),
|
94
|
+
]);
|
87
95
|
const placeholderUri = getBaseUriFromBatch(placeholderUris);
|
88
96
|
|
89
97
|
const uris = await upload({
|
90
98
|
client: options.contract.client,
|
91
99
|
files: options.metadata,
|
100
|
+
// IMPORTANT: File number has to be calculated properly otherwise the whole batch will break
|
101
|
+
// e.g: If you are uploading a second batch, the file name should never start from `0`
|
102
|
+
rewriteFileNames: {
|
103
|
+
fileStartNumber: Number(startFileNumber),
|
104
|
+
},
|
92
105
|
});
|
106
|
+
|
93
107
|
const baseUri = getBaseUriFromBatch(uris);
|
94
108
|
const baseUriId = await getBaseURICount({
|
95
109
|
contract: options.contract,
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
2
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
3
|
+
import { resolveScheme } from "../../../../utils/ipfs.js";
|
2
4
|
import { nativeLocalStorage } from "../../../../utils/storage/nativeStorage.js";
|
3
5
|
import { getWalletInfo } from "../../../../wallets/__generated__/getWalletInfo.js";
|
4
6
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
@@ -25,10 +27,11 @@ import { RNImage } from "./RNImage.js";
|
|
25
27
|
export const WalletImage = (props: {
|
26
28
|
theme: Theme;
|
27
29
|
wallet: Wallet;
|
30
|
+
client: ThirdwebClient;
|
28
31
|
size: number;
|
29
32
|
avatar?: string | null;
|
30
33
|
}) => {
|
31
|
-
const { wallet, avatar, size } = props;
|
34
|
+
const { wallet, avatar, size, client } = props;
|
32
35
|
|
33
36
|
const { data: imageData } = useQuery({
|
34
37
|
queryKey: ["wallet-image", wallet.id, wallet.getAccount()?.address],
|
@@ -55,7 +58,7 @@ export const WalletImage = (props: {
|
|
55
58
|
try {
|
56
59
|
const externalWalletImage = await getWalletInfo(activeEOAId, true);
|
57
60
|
if (externalWalletImage) {
|
58
|
-
return externalWalletImage;
|
61
|
+
return resolveScheme({ client, uri: externalWalletImage });
|
59
62
|
}
|
60
63
|
} catch {}
|
61
64
|
|
@@ -2,6 +2,7 @@ import { useCallback, useState } from "react";
|
|
2
2
|
import { Platform, StyleSheet, View } from "react-native";
|
3
3
|
import { SvgXml } from "react-native-svg";
|
4
4
|
import type { Chain } from "../../../../chains/types.js";
|
5
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
5
6
|
import type { MultiStepAuthProviderType } from "../../../../wallets/in-app/core/authentication/types.js";
|
6
7
|
import type { InAppWalletAuth } from "../../../../wallets/in-app/core/wallet/types.js";
|
7
8
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
@@ -269,6 +270,7 @@ export function ConnectModal(
|
|
269
270
|
<WalletLoadingView
|
270
271
|
theme={theme}
|
271
272
|
wallet={modalState.wallet}
|
273
|
+
client={client}
|
272
274
|
authProvider={modalState.authMethod}
|
273
275
|
/>
|
274
276
|
{containerType === "modal" ? (
|
@@ -328,6 +330,7 @@ export function ConnectModal(
|
|
328
330
|
)}
|
329
331
|
<SignInView
|
330
332
|
theme={theme}
|
333
|
+
client={client}
|
331
334
|
siweAuth={siweAuth}
|
332
335
|
onSignIn={() => props.onClose?.()}
|
333
336
|
onError={(error) => setModalState({ screen: "error", error })}
|
@@ -462,10 +465,12 @@ export function ConnectModal(
|
|
462
465
|
function WalletLoadingView({
|
463
466
|
theme,
|
464
467
|
wallet,
|
468
|
+
client,
|
465
469
|
authProvider,
|
466
470
|
}: {
|
467
471
|
theme: Theme;
|
468
472
|
wallet: Wallet;
|
473
|
+
client: ThirdwebClient;
|
469
474
|
authProvider?: InAppWalletAuth;
|
470
475
|
}) {
|
471
476
|
const walletInfo = useWalletInfo(wallet.id);
|
@@ -500,7 +505,12 @@ function WalletLoadingView({
|
|
500
505
|
/>
|
501
506
|
</View>
|
502
507
|
) : (
|
503
|
-
<WalletImage
|
508
|
+
<WalletImage
|
509
|
+
theme={theme}
|
510
|
+
size={90}
|
511
|
+
wallet={wallet}
|
512
|
+
client={client}
|
513
|
+
/>
|
504
514
|
)}
|
505
515
|
</WalletLoadingThumbnail>
|
506
516
|
<Spacer size="xl" />
|
@@ -522,12 +532,14 @@ function WalletLoadingView({
|
|
522
532
|
function SignInView({
|
523
533
|
theme,
|
524
534
|
siweAuth,
|
535
|
+
client,
|
525
536
|
onSignIn,
|
526
537
|
onError,
|
527
538
|
onDisconnect,
|
528
539
|
}: {
|
529
540
|
theme: Theme;
|
530
541
|
siweAuth: ReturnType<typeof useSiweAuth>;
|
542
|
+
client: ThirdwebClient;
|
531
543
|
onSignIn: () => void;
|
532
544
|
onError: (error: string) => void;
|
533
545
|
onDisconnect: () => void;
|
@@ -552,7 +564,12 @@ function SignInView({
|
|
552
564
|
imageSize={100}
|
553
565
|
animate={isSigningIn}
|
554
566
|
>
|
555
|
-
<WalletImage
|
567
|
+
<WalletImage
|
568
|
+
theme={theme}
|
569
|
+
size={90}
|
570
|
+
wallet={wallet}
|
571
|
+
client={client}
|
572
|
+
/>
|
556
573
|
</WalletLoadingThumbnail>
|
557
574
|
<Spacer size="xl" />
|
558
575
|
<ThemedText theme={theme} type="subtitle">
|
@@ -20,7 +20,7 @@ export function ConnectedButton(
|
|
20
20
|
},
|
21
21
|
) {
|
22
22
|
const theme = parseTheme(props.theme);
|
23
|
-
const { account, wallet } = props;
|
23
|
+
const { account, wallet, client } = props;
|
24
24
|
const walletChain = useActiveWalletChain();
|
25
25
|
const { pfp, name, balanceQuery } = useConnectedWalletDetails(
|
26
26
|
props.client,
|
@@ -40,7 +40,13 @@ export function ConnectedButton(
|
|
40
40
|
}}
|
41
41
|
>
|
42
42
|
<View style={styles.row}>
|
43
|
-
<WalletImage
|
43
|
+
<WalletImage
|
44
|
+
theme={theme}
|
45
|
+
size={40}
|
46
|
+
wallet={wallet}
|
47
|
+
avatar={pfp}
|
48
|
+
client={client}
|
49
|
+
/>
|
44
50
|
<View style={styles.col}>
|
45
51
|
<ThemedText
|
46
52
|
theme={theme}
|
@@ -85,6 +85,7 @@ export function ConnectedModal(props: ConnectedModalProps) {
|
|
85
85
|
<ReceiveScreen
|
86
86
|
account={props.account}
|
87
87
|
wallet={props.wallet}
|
88
|
+
client={props.client}
|
88
89
|
theme={theme}
|
89
90
|
containerType={props.containerType}
|
90
91
|
onBack={() => setModalState({ screen: "account" })}
|
@@ -161,7 +162,7 @@ export function ConnectedModal(props: ConnectedModalProps) {
|
|
161
162
|
}
|
162
163
|
|
163
164
|
const AccountHeader = (props: ConnectedModalProps) => {
|
164
|
-
const { account, wallet, theme } = props;
|
165
|
+
const { account, wallet, theme, client } = props;
|
165
166
|
const walletChain = useActiveWalletChain();
|
166
167
|
const { pfp, name, balanceQuery } = useConnectedWalletDetails(
|
167
168
|
props.client,
|
@@ -171,7 +172,13 @@ const AccountHeader = (props: ConnectedModalProps) => {
|
|
171
172
|
);
|
172
173
|
return (
|
173
174
|
<View style={styles.accountHeaderContainer}>
|
174
|
-
<WalletImage
|
175
|
+
<WalletImage
|
176
|
+
theme={theme}
|
177
|
+
size={70}
|
178
|
+
wallet={wallet}
|
179
|
+
avatar={pfp}
|
180
|
+
client={client}
|
181
|
+
/>
|
175
182
|
<SmartAccountBadge client={props.client} theme={theme} />
|
176
183
|
<Spacer size="smd" />
|
177
184
|
<Address account={account} theme={theme} addressOrENS={name} />
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { StyleSheet, View } from "react-native";
|
2
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
3
|
import { shortenAddress } from "../../../../utils/address.js";
|
3
4
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
4
5
|
import type { Theme } from "../../../core/design-system/index.js";
|
@@ -16,10 +17,12 @@ type ReceiveScreenProps = {
|
|
16
17
|
onClose?: () => void;
|
17
18
|
onBack?: () => void;
|
18
19
|
containerType: ContainerType;
|
20
|
+
client: ThirdwebClient;
|
19
21
|
};
|
20
22
|
|
21
23
|
export const ReceiveScreen = (props: ReceiveScreenProps) => {
|
22
|
-
const { wallet, account, theme, onClose, onBack, containerType } =
|
24
|
+
const { wallet, account, theme, onClose, onBack, containerType, client } =
|
25
|
+
props;
|
23
26
|
|
24
27
|
return (
|
25
28
|
<>
|
@@ -32,7 +35,7 @@ export const ReceiveScreen = (props: ReceiveScreenProps) => {
|
|
32
35
|
/>
|
33
36
|
<View style={styles.container}>
|
34
37
|
{/* TODO (rn) QR code scanning */}
|
35
|
-
<WalletImage theme={theme} wallet={wallet} size={80} />
|
38
|
+
<WalletImage theme={theme} wallet={wallet} size={80} client={client} />
|
36
39
|
<Spacer size="lg" />
|
37
40
|
<View
|
38
41
|
style={[
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Suspense, useRef, useState } from "react";
|
2
2
|
import { defineChain } from "../../../../chains/utils.js";
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
|
+
import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
4
5
|
import { linkProfile } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
5
6
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
6
7
|
import type { EcosystemWalletId } from "../../../../wallets/wallet-types.js";
|
@@ -43,6 +44,12 @@ export function WalletAuth(props: {
|
|
43
44
|
);
|
44
45
|
const [error, setError] = useState<string | undefined>();
|
45
46
|
const [showAll, setShowAll] = useState<boolean>(false);
|
47
|
+
const ecosystem = isEcosystemWallet(wallet)
|
48
|
+
? {
|
49
|
+
id: wallet.id,
|
50
|
+
partnerId: wallet.getConfig()?.partnerId,
|
51
|
+
}
|
52
|
+
: undefined;
|
46
53
|
|
47
54
|
const back = () => {
|
48
55
|
setStatus("selecting");
|
@@ -59,6 +66,7 @@ export function WalletAuth(props: {
|
|
59
66
|
strategy: "wallet",
|
60
67
|
wallet: walletToLink,
|
61
68
|
chain: wallet.getChain() || defineChain(1),
|
69
|
+
ecosystem,
|
62
70
|
}).catch((e) => {
|
63
71
|
setError(e.message);
|
64
72
|
throw e;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import { useCallback, useEffect,
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
3
3
|
import type { Chain } from "../../../../chains/types.js";
|
4
4
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
5
5
|
import { webLocalStorage } from "../../../../utils/storage/webStorage.js";
|
@@ -9,7 +9,6 @@ import {
|
|
9
9
|
preAuthenticate,
|
10
10
|
} from "../../../../wallets/in-app/web/lib/auth/index.js";
|
11
11
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
12
|
-
import type { EcosystemWalletId } from "../../../../wallets/wallet-types.js";
|
13
12
|
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
14
13
|
import { fontSize } from "../../../core/design-system/index.js";
|
15
14
|
import { setLastAuthProvider } from "../../../core/utils/storage.js";
|
@@ -54,7 +53,12 @@ export function OTPLoginUI(props: {
|
|
54
53
|
const [verifyStatus, setVerifyStatus] = useState<VerificationStatus>("idle");
|
55
54
|
const [error, setError] = useState<string | undefined>();
|
56
55
|
const [accountStatus, setAccountStatus] = useState<AccountStatus>("sending");
|
57
|
-
const
|
56
|
+
const ecosystem = isEcosystemWallet(wallet)
|
57
|
+
? {
|
58
|
+
id: wallet.id,
|
59
|
+
partnerId: wallet.getConfig()?.partnerId,
|
60
|
+
}
|
61
|
+
: undefined;
|
58
62
|
|
59
63
|
const [screen] = useState<ScreenToShow>("base");
|
60
64
|
|
@@ -66,13 +70,7 @@ export function OTPLoginUI(props: {
|
|
66
70
|
try {
|
67
71
|
if ("email" in userInfo) {
|
68
72
|
await preAuthenticate({
|
69
|
-
ecosystem
|
70
|
-
? {
|
71
|
-
id: wallet.id as EcosystemWalletId,
|
72
|
-
partnerId: (wallet as Wallet<EcosystemWalletId>).getConfig()
|
73
|
-
?.partnerId,
|
74
|
-
}
|
75
|
-
: undefined,
|
73
|
+
ecosystem,
|
76
74
|
email: userInfo.email,
|
77
75
|
strategy: "email",
|
78
76
|
client: props.client,
|
@@ -80,13 +78,7 @@ export function OTPLoginUI(props: {
|
|
80
78
|
setAccountStatus("sent");
|
81
79
|
} else if ("phone" in userInfo) {
|
82
80
|
await preAuthenticate({
|
83
|
-
ecosystem
|
84
|
-
? {
|
85
|
-
id: wallet.id as EcosystemWalletId,
|
86
|
-
partnerId: (wallet as Wallet<EcosystemWalletId>).getConfig()
|
87
|
-
?.partnerId,
|
88
|
-
}
|
89
|
-
: undefined,
|
81
|
+
ecosystem,
|
90
82
|
phoneNumber: userInfo.phone,
|
91
83
|
strategy: "phone",
|
92
84
|
client: props.client,
|
@@ -100,7 +92,7 @@ export function OTPLoginUI(props: {
|
|
100
92
|
setVerifyStatus("idle");
|
101
93
|
setAccountStatus("error");
|
102
94
|
}
|
103
|
-
}, [props.client, userInfo,
|
95
|
+
}, [props.client, userInfo, ecosystem]);
|
104
96
|
|
105
97
|
async function connect(otp: string) {
|
106
98
|
if ("email" in userInfo) {
|
@@ -133,6 +125,7 @@ export function OTPLoginUI(props: {
|
|
133
125
|
strategy: "email",
|
134
126
|
email: userInfo.email,
|
135
127
|
verificationCode: otp,
|
128
|
+
ecosystem,
|
136
129
|
});
|
137
130
|
} else if ("phone" in userInfo) {
|
138
131
|
await linkProfile({
|
@@ -140,6 +133,7 @@ export function OTPLoginUI(props: {
|
|
140
133
|
strategy: "phone",
|
141
134
|
phoneNumber: userInfo.phone,
|
142
135
|
verificationCode: otp,
|
136
|
+
ecosystem,
|
143
137
|
});
|
144
138
|
}
|
145
139
|
}
|
@@ -211,6 +211,12 @@ function SignupScreen(props: {
|
|
211
211
|
const { wallet, done, client, chain } = props;
|
212
212
|
const [error, setError] = useState<string | undefined>();
|
213
213
|
const [status, setStatus] = useState<"loading" | "error">("loading");
|
214
|
+
const ecosystem = isEcosystemWallet(wallet)
|
215
|
+
? {
|
216
|
+
id: wallet.id,
|
217
|
+
partnerId: wallet.getConfig()?.partnerId,
|
218
|
+
}
|
219
|
+
: undefined;
|
214
220
|
|
215
221
|
async function signup() {
|
216
222
|
setStatus("loading");
|
@@ -220,6 +226,7 @@ function SignupScreen(props: {
|
|
220
226
|
client,
|
221
227
|
strategy: "passkey",
|
222
228
|
type: "sign-up",
|
229
|
+
ecosystem,
|
223
230
|
});
|
224
231
|
} else {
|
225
232
|
await wallet.connect({
|
@@ -39,6 +39,12 @@ export function SocialLogin(props: {
|
|
39
39
|
const ewLocale = props.locale;
|
40
40
|
const locale = ewLocale.socialLoginScreen;
|
41
41
|
const themeObj = useCustomTheme();
|
42
|
+
const ecosystem = isEcosystemWallet(props.wallet)
|
43
|
+
? {
|
44
|
+
id: props.wallet.id,
|
45
|
+
partnerId: props.wallet.getConfig()?.partnerId,
|
46
|
+
}
|
47
|
+
: undefined;
|
42
48
|
|
43
49
|
const [authError, setAuthError] = useState<string | undefined>(undefined);
|
44
50
|
const { done, wallet } = props;
|
@@ -62,12 +68,7 @@ export function SocialLogin(props: {
|
|
62
68
|
return loginWithOauthRedirect({
|
63
69
|
authOption: props.socialAuth,
|
64
70
|
client: props.client,
|
65
|
-
ecosystem
|
66
|
-
? {
|
67
|
-
id: wallet.id,
|
68
|
-
partnerId: wallet.getConfig()?.partnerId,
|
69
|
-
}
|
70
|
-
: undefined,
|
71
|
+
ecosystem,
|
71
72
|
redirectUrl: walletConfig?.auth?.redirectUrl,
|
72
73
|
mode: walletConfig?.auth?.mode,
|
73
74
|
});
|
@@ -78,12 +79,7 @@ export function SocialLogin(props: {
|
|
78
79
|
authOption: props.socialAuth,
|
79
80
|
themeObj,
|
80
81
|
client: props.client,
|
81
|
-
ecosystem
|
82
|
-
? {
|
83
|
-
id: wallet.id,
|
84
|
-
partnerId: wallet.getConfig()?.partnerId,
|
85
|
-
}
|
86
|
-
: undefined,
|
82
|
+
ecosystem,
|
87
83
|
});
|
88
84
|
|
89
85
|
if (!socialWindow) {
|
@@ -99,6 +95,7 @@ export function SocialLogin(props: {
|
|
99
95
|
closeOpenedWindow: (openedWindow) => {
|
100
96
|
openedWindow.close();
|
101
97
|
},
|
98
|
+
ecosystem,
|
102
99
|
}).catch((e) => {
|
103
100
|
setAuthError(e.message);
|
104
101
|
throw e;
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.62.0";
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import type { ThirdwebClient } from "
|
2
|
-
import { getThirdwebBaseUrl } from "
|
3
|
-
import { getClientFetch } from "
|
4
|
-
import type {
|
1
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
+
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
4
|
+
import type { UserWallet } from "../wallet/enclave-wallet.js";
|
5
|
+
import type { Ecosystem } from "../wallet/types.js";
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Generate a new enclave wallet using an auth token
|
@@ -34,10 +35,7 @@ export async function generateWallet({
|
|
34
35
|
}
|
35
36
|
|
36
37
|
const { wallet } = (await response.json()) as {
|
37
|
-
wallet:
|
38
|
-
address: string;
|
39
|
-
type: "enclave";
|
40
|
-
};
|
38
|
+
wallet: UserWallet;
|
41
39
|
};
|
42
40
|
|
43
41
|
return wallet;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { ThirdwebClient } from "
|
2
|
-
import { getThirdwebBaseUrl } from "
|
3
|
-
import { getClientFetch } from "
|
4
|
-
import type { UserStatus } from "
|
5
|
-
import type { Ecosystem } from "
|
1
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
+
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
4
|
+
import type { UserStatus } from "../wallet/enclave-wallet.js";
|
5
|
+
import type { Ecosystem } from "../wallet/types.js";
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Gets the user's status from the backend.
|
@@ -1,26 +1,24 @@
|
|
1
|
-
import type { ThirdwebClient } from "
|
2
|
-
import { getThirdwebBaseUrl } from "
|
3
|
-
import { getClientFetch } from "
|
4
|
-
import { stringify } from "
|
5
|
-
import type { ClientScopedStorage } from "
|
6
|
-
import type { Ecosystem } from "../../../core/wallet/types.js";
|
1
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
+
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
4
|
+
import { stringify } from "../../../../utils/json.js";
|
5
|
+
import type { ClientScopedStorage } from "../authentication/client-scoped-storage.js";
|
7
6
|
|
8
7
|
export async function signMessage({
|
9
8
|
client,
|
10
|
-
ecosystem,
|
11
9
|
payload: { message, isRaw },
|
12
10
|
storage,
|
13
11
|
}: {
|
14
12
|
client: ThirdwebClient;
|
15
|
-
ecosystem?: Ecosystem;
|
16
13
|
payload: {
|
17
14
|
message: string;
|
18
15
|
isRaw: boolean;
|
19
16
|
};
|
20
17
|
storage: ClientScopedStorage;
|
21
18
|
}) {
|
22
|
-
const clientFetch = getClientFetch(client, ecosystem);
|
23
19
|
const authToken = await storage.getAuthCookie();
|
20
|
+
const ecosystem = storage.ecosystem;
|
21
|
+
const clientFetch = getClientFetch(client, ecosystem);
|
24
22
|
|
25
23
|
if (!authToken) {
|
26
24
|
throw new Error("No auth token found when signing message");
|
@@ -1,24 +1,22 @@
|
|
1
|
-
import type { ThirdwebClient } from "
|
2
|
-
import { getThirdwebBaseUrl } from "
|
3
|
-
import type { Hex } from "
|
4
|
-
import { getClientFetch } from "
|
5
|
-
import { stringify } from "
|
6
|
-
import type { ClientScopedStorage } from "
|
7
|
-
import type { Ecosystem } from "../../../core/wallet/types.js";
|
1
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
+
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
|
+
import type { Hex } from "../../../../utils/encoding/hex.js";
|
4
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
5
|
+
import { stringify } from "../../../../utils/json.js";
|
6
|
+
import type { ClientScopedStorage } from "../authentication/client-scoped-storage.js";
|
8
7
|
|
9
8
|
export async function signTransaction({
|
10
9
|
client,
|
11
|
-
ecosystem,
|
12
10
|
payload,
|
13
11
|
storage,
|
14
12
|
}: {
|
15
13
|
client: ThirdwebClient;
|
16
|
-
ecosystem?: Ecosystem;
|
17
14
|
payload: Record<string, Hex | number | undefined>;
|
18
15
|
storage: ClientScopedStorage;
|
19
16
|
}) {
|
20
|
-
const clientFetch = getClientFetch(client, ecosystem);
|
21
17
|
const authToken = await storage.getAuthCookie();
|
18
|
+
const ecosystem = storage.ecosystem;
|
19
|
+
const clientFetch = getClientFetch(client, ecosystem);
|
22
20
|
|
23
21
|
if (!authToken) {
|
24
22
|
throw new Error("No auth token found when signing transaction");
|
@@ -1,28 +1,26 @@
|
|
1
1
|
import type { TypedData } from "abitype";
|
2
2
|
import type { TypedDataDefinition } from "viem";
|
3
|
-
import type { ThirdwebClient } from "
|
4
|
-
import { getThirdwebBaseUrl } from "
|
5
|
-
import { getClientFetch } from "
|
6
|
-
import { stringify } from "
|
7
|
-
import type { ClientScopedStorage } from "
|
8
|
-
import type { Ecosystem } from "../../../core/wallet/types.js";
|
3
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
5
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
6
|
+
import { stringify } from "../../../../utils/json.js";
|
7
|
+
import type { ClientScopedStorage } from "../authentication/client-scoped-storage.js";
|
9
8
|
|
10
9
|
export async function signTypedData<
|
11
10
|
const typedData extends TypedData | Record<string, unknown>,
|
12
11
|
primaryType extends keyof typedData | "EIP712Domain" = keyof typedData,
|
13
12
|
>({
|
14
13
|
client,
|
15
|
-
ecosystem,
|
16
14
|
payload,
|
17
15
|
storage,
|
18
16
|
}: {
|
19
17
|
client: ThirdwebClient;
|
20
|
-
ecosystem?: Ecosystem;
|
21
18
|
payload: TypedDataDefinition<typedData, primaryType>;
|
22
19
|
storage: ClientScopedStorage;
|
23
20
|
}) {
|
24
|
-
const clientFetch = getClientFetch(client, ecosystem);
|
25
21
|
const authToken = await storage.getAuthCookie();
|
22
|
+
const ecosystem = storage.ecosystem;
|
23
|
+
const clientFetch = getClientFetch(client, ecosystem);
|
26
24
|
|
27
25
|
if (!authToken) {
|
28
26
|
throw new Error("No auth token found when signing typed data");
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
2
|
-
import type { EcosystemWalletId } from "../../../wallet-types.js";
|
3
2
|
import {
|
4
3
|
AUTH_TOKEN_LOCAL_STORAGE_NAME,
|
5
4
|
DEVICE_SHARE_LOCAL_STORAGE_NAME,
|
@@ -8,6 +7,7 @@ import {
|
|
8
7
|
WALLET_CONNECT_SESSIONS_LOCAL_STORAGE_NAME,
|
9
8
|
WALLET_USER_ID_LOCAL_STORAGE_NAME,
|
10
9
|
} from "../constants/settings.js";
|
10
|
+
import type { Ecosystem } from "../wallet/types.js";
|
11
11
|
|
12
12
|
const data = new Map<string, string>();
|
13
13
|
|
@@ -17,20 +17,22 @@ const data = new Map<string, string>();
|
|
17
17
|
export class ClientScopedStorage {
|
18
18
|
protected key: string;
|
19
19
|
protected storage: AsyncStorage | null;
|
20
|
+
public ecosystem?: Ecosystem;
|
20
21
|
/**
|
21
22
|
* @internal
|
22
23
|
*/
|
23
24
|
constructor({
|
24
25
|
storage,
|
25
26
|
clientId,
|
26
|
-
|
27
|
+
ecosystem,
|
27
28
|
}: {
|
28
29
|
storage: AsyncStorage | null;
|
29
30
|
clientId: string;
|
30
|
-
|
31
|
+
ecosystem?: Ecosystem;
|
31
32
|
}) {
|
32
33
|
this.storage = storage;
|
33
|
-
this.key = getLocalStorageKey(clientId,
|
34
|
+
this.key = getLocalStorageKey(clientId, ecosystem?.id);
|
35
|
+
this.ecosystem = ecosystem;
|
34
36
|
}
|
35
37
|
|
36
38
|
protected async getItem(key: string): Promise<string | null> {
|
@@ -19,7 +19,7 @@ export async function guestAuthenticate(args: {
|
|
19
19
|
const storage = new ClientScopedStorage({
|
20
20
|
storage: args.storage,
|
21
21
|
clientId: args.client.clientId,
|
22
|
-
|
22
|
+
ecosystem: args.ecosystem,
|
23
23
|
});
|
24
24
|
|
25
25
|
let sessionId = await storage.getGuestSessionId();
|