thirdweb 5.90.3 → 5.91.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/contract/deployment/utils/create-2-factory.js +7 -0
- package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/utils/usePreloadWalletProviders.js +1 -34
- package/dist/cjs/react/web/utils/usePreloadWalletProviders.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js +4 -4
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/ecosystem.js +1 -0
- package/dist/cjs/wallets/in-app/native/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/in-app.js +1 -0
- package/dist/cjs/wallets/in-app/native/in-app.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +1 -0
- package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +26 -0
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js +4 -4
- 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 +2 -2
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/contract/deployment/utils/create-2-factory.js +7 -0
- package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/utils/usePreloadWalletProviders.js +1 -34
- package/dist/esm/react/web/utils/usePreloadWalletProviders.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/native/auth/passkeys.js +4 -4
- package/dist/esm/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/native/ecosystem.js +1 -0
- package/dist/esm/wallets/in-app/native/ecosystem.js.map +1 -1
- package/dist/esm/wallets/in-app/native/in-app.js +1 -0
- package/dist/esm/wallets/in-app/native/in-app.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +1 -0
- package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +26 -0
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js +4 -4
- 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 +2 -2
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/types/contract/deployment/utils/create-2-factory.d.ts.map +1 -1
- package/dist/types/exports/storage.d.ts +1 -0
- package/dist/types/exports/storage.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoQuote.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/utils/usePreloadWalletProviders.d.ts +1 -3
- package/dist/types/react/web/utils/usePreloadWalletProviders.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +5 -0
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +5 -0
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/auth/passkeys.d.ts +2 -1
- package/dist/types/wallets/in-app/native/auth/passkeys.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/in-app.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/native-connector.d.ts +2 -0
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +25 -0
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/passkeys.d.ts +2 -1
- package/dist/types/wallets/in-app/web/lib/auth/passkeys.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/dist/types/wallets/in-app/web/types.d.ts +5 -0
- package/dist/types/wallets/in-app/web/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contract/deployment/utils/create-2-factory.ts +8 -0
- package/src/exports/storage.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithCryptoQuote.ts +1 -0
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +0 -1
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +1 -1
- package/src/react/web/utils/usePreloadWalletProviders.ts +1 -49
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +5 -0
- package/src/wallets/in-app/core/wallet/types.ts +5 -0
- package/src/wallets/in-app/native/auth/passkeys.ts +5 -3
- package/src/wallets/in-app/native/ecosystem.ts +1 -0
- package/src/wallets/in-app/native/in-app.ts +1 -0
- package/src/wallets/in-app/native/native-connector.ts +3 -2
- package/src/wallets/in-app/web/ecosystem.ts +1 -0
- package/src/wallets/in-app/web/in-app.ts +26 -0
- package/src/wallets/in-app/web/lib/auth/passkeys.ts +5 -3
- package/src/wallets/in-app/web/lib/web-connector.ts +2 -1
- package/src/wallets/in-app/web/types.ts +6 -1
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +7 -5
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../client/client.js";
|
2
2
|
import { stringify } from "../../../utils/json.js";
|
3
|
+
import type { AsyncStorage } from "../../../utils/storage/AsyncStorage.js";
|
3
4
|
import { nativeLocalStorage } from "../../../utils/storage/nativeStorage.js";
|
4
5
|
import type { Account } from "../../interfaces/wallet.js";
|
5
6
|
import { getUserStatus } from "../core/actions/get-enclave-user-status.js";
|
@@ -37,11 +38,11 @@ import { sendOtp, verifyOtp } from "../web/lib/auth/otp.js";
|
|
37
38
|
import { deleteActiveAccount, socialAuth } from "./auth/native-auth.js";
|
38
39
|
import { logoutUser } from "./helpers/auth/logout.js";
|
39
40
|
import { ShardedWallet } from "./helpers/wallet/sharded-wallet.js";
|
40
|
-
|
41
41
|
type NativeConnectorOptions = {
|
42
42
|
client: ThirdwebClient;
|
43
43
|
ecosystem?: Ecosystem;
|
44
44
|
passkeyDomain?: string;
|
45
|
+
storage?: AsyncStorage;
|
45
46
|
};
|
46
47
|
|
47
48
|
export class InAppNativeConnector implements InAppConnector {
|
@@ -56,7 +57,7 @@ export class InAppNativeConnector implements InAppConnector {
|
|
56
57
|
this.passkeyDomain = options.passkeyDomain;
|
57
58
|
this.ecosystem = options.ecosystem;
|
58
59
|
this.storage = new ClientScopedStorage({
|
59
|
-
storage: nativeLocalStorage,
|
60
|
+
storage: options.storage ?? nativeLocalStorage,
|
60
61
|
clientId: this.client.clientId,
|
61
62
|
ecosystem: options.ecosystem,
|
62
63
|
});
|
@@ -222,6 +222,31 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
222
222
|
* });
|
223
223
|
* ```
|
224
224
|
*
|
225
|
+
* ### Override storage for the wallet state
|
226
|
+
*
|
227
|
+
* By default, wallet state is stored in the browser's local storage. You can override this behavior by providing a custom storage object, useful for server side integrations.
|
228
|
+
*
|
229
|
+
* ```ts
|
230
|
+
* import { inAppWallet } from "thirdweb/wallets";
|
231
|
+
* import { AsyncStorage } from "thirdweb/storage";
|
232
|
+
*
|
233
|
+
* const myStorage: AsyncStorage = {
|
234
|
+
* getItem: async (key) => {
|
235
|
+
* return customGet(`CUSTOM_STORAGE_KEY${key}`);
|
236
|
+
* },
|
237
|
+
* setItem: async (key, value) => {
|
238
|
+
* return customSet(`CUSTOM_STORAGE_KEY${key}`, value);
|
239
|
+
* },
|
240
|
+
* removeItem: async (key) => {
|
241
|
+
* return customRemove(`CUSTOM_STORAGE_KEY${key}`);
|
242
|
+
* },
|
243
|
+
* };
|
244
|
+
*
|
245
|
+
* const wallet = inAppWallet({
|
246
|
+
* storage: myStorage,
|
247
|
+
* });
|
248
|
+
* ```
|
249
|
+
*
|
225
250
|
* @returns The created in-app wallet.
|
226
251
|
* @wallet
|
227
252
|
*/
|
@@ -235,6 +260,7 @@ export function inAppWallet(
|
|
235
260
|
return new InAppWebConnector({
|
236
261
|
client,
|
237
262
|
passkeyDomain: createOptions?.auth?.passkeyDomain,
|
263
|
+
storage: createOptions?.storage,
|
238
264
|
});
|
239
265
|
},
|
240
266
|
}) as Wallet<"inApp">;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { client, parsers } from "@passwordless-id/webauthn";
|
2
2
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
3
|
+
import type { AsyncStorage } from "../../../../../utils/storage/AsyncStorage.js";
|
3
4
|
import { webLocalStorage } from "../../../../../utils/storage/webStorage.js";
|
4
5
|
import {
|
5
6
|
base64ToString,
|
@@ -83,12 +84,13 @@ export class PasskeyWebClient implements PasskeyClient {
|
|
83
84
|
export async function hasStoredPasskey(
|
84
85
|
client: ThirdwebClient,
|
85
86
|
ecosystemId?: EcosystemWalletId,
|
87
|
+
storage?: AsyncStorage,
|
86
88
|
) {
|
87
|
-
const
|
88
|
-
storage: webLocalStorage, // TODO (passkey) react native variant of this fn
|
89
|
+
const clientStorage = new ClientScopedStorage({
|
90
|
+
storage: storage ?? webLocalStorage, // TODO (passkey) react native variant of this fn
|
89
91
|
clientId: client.clientId,
|
90
92
|
ecosystem: ecosystemId ? { id: ecosystemId } : undefined,
|
91
93
|
});
|
92
|
-
const credId = await
|
94
|
+
const credId = await clientStorage.getPasskeyCredentialId();
|
93
95
|
return !!credId;
|
94
96
|
}
|
@@ -74,6 +74,7 @@ export class InAppWebConnector implements InAppConnector {
|
|
74
74
|
onAuthSuccess,
|
75
75
|
ecosystem,
|
76
76
|
passkeyDomain,
|
77
|
+
storage,
|
77
78
|
}: InAppWalletConstructorType) {
|
78
79
|
if (this.isClientIdLegacyPaper(client.clientId)) {
|
79
80
|
throw new Error(
|
@@ -85,7 +86,7 @@ export class InAppWebConnector implements InAppConnector {
|
|
85
86
|
this.ecosystem = ecosystem;
|
86
87
|
this.passkeyDomain = passkeyDomain;
|
87
88
|
this.storage = new ClientScopedStorage({
|
88
|
-
storage: webLocalStorage,
|
89
|
+
storage: storage ?? webLocalStorage,
|
89
90
|
clientId: client.clientId,
|
90
91
|
ecosystem: ecosystem,
|
91
92
|
});
|
@@ -2,11 +2,11 @@
|
|
2
2
|
// types for class constructors still a little messy right now.
|
3
3
|
|
4
4
|
import type { ThirdwebClient } from "../../../client/client.js";
|
5
|
+
import type { AsyncStorage } from "../../../utils/storage/AsyncStorage.js";
|
5
6
|
import type { AuthAndWalletRpcReturnType } from "../core/authentication/types.js";
|
6
7
|
import type { Ecosystem } from "../core/wallet/types.js";
|
7
8
|
import type { InAppWalletIframeCommunicator } from "./utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
|
8
9
|
|
9
|
-
// Open to PRs from whoever sees this and knows of a cleaner way to handle things
|
10
10
|
type ClientIdConstructorType = {
|
11
11
|
/**
|
12
12
|
* the clientId of your API Key. You can create an API key by creating a project on thirdweb dashboard.
|
@@ -29,6 +29,11 @@ export type InAppWalletConstructorType = ClientIdConstructorType & {
|
|
29
29
|
* The domain of the passkey to use for authentication
|
30
30
|
*/
|
31
31
|
passkeyDomain?: string;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The storage to use for storing wallet state
|
35
|
+
*/
|
36
|
+
storage?: AsyncStorage;
|
32
37
|
};
|
33
38
|
|
34
39
|
export type ClientIdWithQuerierType = ClientIdConstructorType & {
|
@@ -8,8 +8,8 @@ import { parseEventLogs } from "../../event/actions/parse-logs.js";
|
|
8
8
|
import { TEST_WALLET_A } from "~test/addresses.js";
|
9
9
|
import { verifyEip1271Signature } from "../../auth/verify-hash.js";
|
10
10
|
import { verifyTypedData } from "../../auth/verify-typed-data.js";
|
11
|
+
import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum-sepolia.js";
|
11
12
|
import { baseSepolia } from "../../chains/chain-definitions/base-sepolia.js";
|
12
|
-
import { sepolia } from "../../chains/chain-definitions/sepolia.js";
|
13
13
|
import {
|
14
14
|
addAdmin,
|
15
15
|
adminUpdatedEvent,
|
@@ -41,12 +41,12 @@ let smartWalletAddress: string;
|
|
41
41
|
let personalAccount: Account;
|
42
42
|
let accountContract: ThirdwebContract;
|
43
43
|
|
44
|
-
const chain =
|
44
|
+
const chain = arbitrumSepolia;
|
45
45
|
const client = TEST_CLIENT;
|
46
46
|
const contract = getContract({
|
47
47
|
client,
|
48
48
|
chain,
|
49
|
-
address: "
|
49
|
+
address: "0x6A7a26c9a595E6893C255C9dF0b593e77518e0c3",
|
50
50
|
});
|
51
51
|
|
52
52
|
describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
@@ -132,6 +132,8 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
132
132
|
});
|
133
133
|
await new Promise((resolve) => setTimeout(resolve, 3000)); // pause for a second to prevent race condition
|
134
134
|
|
135
|
+
expect(await isContractDeployed(accountContract)).toEqual(true);
|
136
|
+
|
135
137
|
const signature = await smartAccount.signMessage({
|
136
138
|
message: "hello world",
|
137
139
|
});
|
@@ -201,10 +203,10 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
201
203
|
});
|
202
204
|
|
203
205
|
await expect(tx).rejects.toMatchInlineSnapshot(`
|
204
|
-
[TransactionError:
|
206
|
+
[TransactionError: Error - Not authorized
|
205
207
|
|
206
208
|
contract: ${contract.address}
|
207
|
-
chainId:
|
209
|
+
chainId: 421614]
|
208
210
|
`);
|
209
211
|
});
|
210
212
|
|