thirdweb 5.90.2 → 5.90.4
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/wallets/smart.js +2 -1
- package/dist/cjs/exports/wallets/smart.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/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/core/actions/sign-message.enclave.js +3 -1
- package/dist/cjs/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +4 -2
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +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/cjs/wallets/smart/lib/userop.js +47 -14
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +1 -1
- package/dist/esm/exports/wallets/smart.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/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/core/actions/sign-message.enclave.js +3 -1
- package/dist/esm/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +4 -2
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +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/esm/wallets/smart/lib/userop.js +45 -13
- package/dist/esm/wallets/smart/lib/userop.js.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/exports/wallets/smart.d.ts +1 -1
- package/dist/types/exports/wallets/smart.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/actions/sign-message.enclave.d.ts +3 -1
- package/dist/types/wallets/in-app/core/actions/sign-message.enclave.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/enclave-wallet.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/dist/types/wallets/interfaces/wallet.d.ts +3 -1
- package/dist/types/wallets/interfaces/wallet.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts +24 -1
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/storage.ts +1 -0
- package/src/exports/wallets/smart.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/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/actions/sign-message.enclave.ts +5 -1
- package/src/wallets/in-app/core/wallet/enclave-wallet.ts +4 -2
- 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/interfaces/wallet.ts +9 -1
- package/src/wallets/smart/lib/userop.ts +53 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAiB7D,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,mCAAmC,EACnC,OAAO,EACP,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,OAAO,EACP,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAyB,MAAM,uBAAuB,CAAC;AAKpE;;GAEG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IACtD,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAY;IAC9B,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,OAAO,CAAsB;IAErC,OAAO,CAAC,MAAM,CAAC,CAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B,OAAO,CAAC,qBAAqB;IAO7B;;;;OAIG;gBACS,EACV,MAAM,EACN,aAAa,EACb,SAAS,EACT,aAAa,
|
1
|
+
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAiB7D,OAAO,KAAK,EACV,YAAY,EACZ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EAAE,mCAAmC,EAC/C,YAAY,CAAC,EAAE,MAAM;IAKvB;;OAEG;IACG,YAAY,CAChB,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,GACnD,OAAO,CAAC,mCAAmC,CAAC;IAoF/C;;OAEG;IACG,OAAO,CACX,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,GACnD,OAAO,CAAC,mBAAmB,CAAC;IA8CzB,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAI3B,WAAW;IAgCnB,WAAW,CAAC,IAAI,EAAE,YAAY;IAU9B,aAAa,CAAC,OAAO,EAAE,OAAO;IAS9B,WAAW;CAOlB"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../client/client.js";
|
2
|
+
import type { AsyncStorage } from "../../../utils/storage/AsyncStorage.js";
|
2
3
|
import type { AuthAndWalletRpcReturnType } from "../core/authentication/types.js";
|
3
4
|
import type { Ecosystem } from "../core/wallet/types.js";
|
4
5
|
import type { InAppWalletIframeCommunicator } from "./utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
|
@@ -22,6 +23,10 @@ export type InAppWalletConstructorType = ClientIdConstructorType & {
|
|
22
23
|
* The domain of the passkey to use for authentication
|
23
24
|
*/
|
24
25
|
passkeyDomain?: string;
|
26
|
+
/**
|
27
|
+
* The storage to use for storing wallet state
|
28
|
+
*/
|
29
|
+
storage?: AsyncStorage;
|
25
30
|
};
|
26
31
|
export type ClientIdWithQuerierType = ClientIdConstructorType & {
|
27
32
|
querier: InAppWalletIframeCommunicator<any>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/in-app/web/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBA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zB,CAAC"}
|
@@ -154,8 +154,10 @@ export type Account = {
|
|
154
154
|
* const signature = await account.signMessage({ message: 'hello!' });
|
155
155
|
* ```
|
156
156
|
*/
|
157
|
-
signMessage: ({ message }: {
|
157
|
+
signMessage: ({ message, originalMessage, chainId, }: {
|
158
158
|
message: SignableMessage;
|
159
|
+
originalMessage?: string;
|
160
|
+
chainId?: number;
|
159
161
|
}) => Promise<Hex>;
|
160
162
|
/**
|
161
163
|
* Sign the given typed data and return the signature
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/wallets/interfaces/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,KAAK,aAAa,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GAAG;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,cAAc,EAA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,KAC1B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAEvB,WAAW,EAAE,mBAAmB,CAAC,GAAG,CAAC,KAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5D,CAAC"}
|
@@ -3,7 +3,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
3
3
|
import { type ThirdwebContract } from "../../../contract/contract.js";
|
4
4
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
5
5
|
import type { TransactionReceipt } from "../../../transaction/types.js";
|
6
|
-
import type
|
6
|
+
import { type Hex } from "../../../utils/encoding/hex.js";
|
7
7
|
import type { Account } from "../../interfaces/wallet.js";
|
8
8
|
import type { BundlerOptions, SmartWalletOptions, UserOperationV06, UserOperationV07 } from "../types.js";
|
9
9
|
export declare const clearAccountDeploying: (accountContract: ThirdwebContract) => void;
|
@@ -86,6 +86,29 @@ export declare function signUserOp(args: {
|
|
86
86
|
entrypointAddress?: string;
|
87
87
|
adminAccount: Account;
|
88
88
|
}): Promise<UserOperationV06 | UserOperationV07>;
|
89
|
+
/**
|
90
|
+
* Get the hash of a user operation.
|
91
|
+
* @param args - The options for getting the user operation hash
|
92
|
+
* @returns - The user operation hash
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* import { getUserOpHash } from "thirdweb/wallets/smart";
|
96
|
+
*
|
97
|
+
* const userOp = await createUnsignedUserOp(...);
|
98
|
+
* const userOpHash = await getUserOpHash({
|
99
|
+
* client,
|
100
|
+
* userOp,
|
101
|
+
* chain,
|
102
|
+
* });
|
103
|
+
* ```
|
104
|
+
* @walletUtils
|
105
|
+
*/
|
106
|
+
export declare function getUserOpHash(args: {
|
107
|
+
client: ThirdwebClient;
|
108
|
+
userOp: UserOperationV06 | UserOperationV07;
|
109
|
+
chain: Chain;
|
110
|
+
entrypointAddress?: string;
|
111
|
+
}): Promise<Hex>;
|
89
112
|
/**
|
90
113
|
* Create and sign a user operation.
|
91
114
|
* @param options - The options for creating and signing the user operation
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,EAAE,KAAK,GAAG,EAAS,MAAM,gCAAgC,CAAC;AAMjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAkCrB,eAAO,MAAM,qBAAqB,GAAI,iBAAiB,gBAAgB,SAEtE,CAAC;AAMF;;;;;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;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IACjD,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,gDAiBA;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,gDAqEA"}
|
package/package.json
CHANGED
package/src/exports/storage.ts
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
import { useQueries } from "@tanstack/react-query";
|
2
|
-
import type { ThirdwebClient } from "../../../client/client.js";
|
3
2
|
import { COINBASE } from "../../../wallets/constants.js";
|
4
3
|
import { isEcosystemWallet } from "../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
5
4
|
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
|
6
5
|
import type { CreateWalletArgs } from "../../../wallets/wallet-types.js";
|
7
|
-
import type { EcosystemWalletId } from "../../../wallets/wallet-types.js";
|
8
6
|
|
9
|
-
export function usePreloadWalletProviders({
|
10
|
-
client,
|
11
|
-
wallets,
|
12
|
-
}: { client: ThirdwebClient; wallets: Wallet[] }) {
|
7
|
+
export function usePreloadWalletProviders({ wallets }: { wallets: Wallet[] }) {
|
13
8
|
useQueries({
|
14
9
|
queries: wallets
|
15
10
|
.filter(
|
@@ -29,49 +24,6 @@ export function usePreloadWalletProviders({
|
|
29
24
|
// return _something_
|
30
25
|
return true;
|
31
26
|
}
|
32
|
-
case "inApp" === w.id: {
|
33
|
-
const [
|
34
|
-
{ InAppWebConnector },
|
35
|
-
{ getOrCreateInAppWalletConnector },
|
36
|
-
] = await Promise.all([
|
37
|
-
import("../../../wallets/in-app/web/lib/web-connector.js"),
|
38
|
-
import("../../../wallets/in-app/core/wallet/in-app-core.js"),
|
39
|
-
]);
|
40
|
-
await getOrCreateInAppWalletConnector(client, async (client) => {
|
41
|
-
return new InAppWebConnector({
|
42
|
-
client,
|
43
|
-
});
|
44
|
-
});
|
45
|
-
// return _something_
|
46
|
-
return true;
|
47
|
-
}
|
48
|
-
case isEcosystemWallet(w.id): {
|
49
|
-
const [
|
50
|
-
{ InAppWebConnector },
|
51
|
-
{ getOrCreateInAppWalletConnector },
|
52
|
-
] = await Promise.all([
|
53
|
-
import("../../../wallets/in-app/web/lib/web-connector.js"),
|
54
|
-
import("../../../wallets/in-app/core/wallet/in-app-core.js"),
|
55
|
-
]);
|
56
|
-
const ecosystemWallet = w as Wallet<EcosystemWalletId>; // we know this is an ecosystem wallet
|
57
|
-
await getOrCreateInAppWalletConnector(
|
58
|
-
client,
|
59
|
-
async (client) => {
|
60
|
-
return new InAppWebConnector({
|
61
|
-
client,
|
62
|
-
ecosystem: {
|
63
|
-
id: ecosystemWallet.id,
|
64
|
-
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
65
|
-
},
|
66
|
-
});
|
67
|
-
},
|
68
|
-
{
|
69
|
-
id: ecosystemWallet.id,
|
70
|
-
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
71
|
-
},
|
72
|
-
);
|
73
|
-
return true;
|
74
|
-
}
|
75
27
|
// potentially add more wallets here
|
76
28
|
default: {
|
77
29
|
return false;
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.90.
|
1
|
+
export const version = "5.90.4";
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { SupportedSmsCountry } from "../../react/web/wallets/in-app/supported-sms-countries.js";
|
2
|
+
import type { AsyncStorage } from "../../utils/storage/AsyncStorage.js";
|
2
3
|
import type {
|
3
4
|
InAppWalletAutoConnectOptions,
|
4
5
|
InAppWalletConnectionOptions,
|
@@ -23,6 +24,10 @@ export type EcosystemWalletCreationOptions = {
|
|
23
24
|
* The partnerId of the ecosystem wallet to connect to
|
24
25
|
*/
|
25
26
|
partnerId?: string;
|
27
|
+
/**
|
28
|
+
* The storage to use for storing wallet state
|
29
|
+
*/
|
30
|
+
storage?: AsyncStorage;
|
26
31
|
};
|
27
32
|
|
28
33
|
export type EcosystemWalletConnectionOptions = InAppWalletConnectionOptions;
|
@@ -6,13 +6,15 @@ import type { ClientScopedStorage } from "../authentication/client-scoped-storag
|
|
6
6
|
|
7
7
|
export async function signMessage({
|
8
8
|
client,
|
9
|
-
payload: { message, isRaw },
|
9
|
+
payload: { message, isRaw, originalMessage, chainId },
|
10
10
|
storage,
|
11
11
|
}: {
|
12
12
|
client: ThirdwebClient;
|
13
13
|
payload: {
|
14
14
|
message: string;
|
15
15
|
isRaw: boolean;
|
16
|
+
originalMessage?: string;
|
17
|
+
chainId?: number;
|
16
18
|
};
|
17
19
|
storage: ClientScopedStorage;
|
18
20
|
}) {
|
@@ -37,6 +39,8 @@ export async function signMessage({
|
|
37
39
|
messagePayload: {
|
38
40
|
message,
|
39
41
|
isRaw,
|
42
|
+
originalMessage,
|
43
|
+
chainId,
|
40
44
|
},
|
41
45
|
}),
|
42
46
|
},
|
@@ -217,10 +217,10 @@ export class EnclaveWallet implements IWebWallet {
|
|
217
217
|
|
218
218
|
return { transactionHash };
|
219
219
|
},
|
220
|
-
async signMessage({ message }) {
|
220
|
+
async signMessage({ message, originalMessage, chainId }) {
|
221
221
|
const messagePayload = (() => {
|
222
222
|
if (typeof message === "string") {
|
223
|
-
return { message, isRaw: false };
|
223
|
+
return { message, isRaw: false, originalMessage, chainId };
|
224
224
|
}
|
225
225
|
return {
|
226
226
|
message:
|
@@ -228,6 +228,8 @@ export class EnclaveWallet implements IWebWallet {
|
|
228
228
|
? message.raw
|
229
229
|
: bytesToHex(message.raw),
|
230
230
|
isRaw: true,
|
231
|
+
originalMessage,
|
232
|
+
chainId,
|
231
233
|
};
|
232
234
|
})();
|
233
235
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { Chain } from "../../../../chains/types.js";
|
2
2
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
3
3
|
import type { SupportedSmsCountry } from "../../../../react/web/wallets/in-app/supported-sms-countries.js";
|
4
|
+
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
4
5
|
import type { Prettify } from "../../../../utils/type-utils.js";
|
5
6
|
import type { SmartWalletOptions } from "../../../smart/types.js";
|
6
7
|
import type {
|
@@ -87,5 +88,9 @@ export type InAppWalletCreationOptions =
|
|
87
88
|
* Whether to hide the private key export button in the Connect Modal
|
88
89
|
*/
|
89
90
|
hidePrivateKeyExport?: boolean;
|
91
|
+
/**
|
92
|
+
* The storage to use for storing wallet state
|
93
|
+
*/
|
94
|
+
storage?: AsyncStorage;
|
90
95
|
}
|
91
96
|
| undefined;
|
@@ -3,6 +3,7 @@ import { concat } from "viem";
|
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
4
|
import { toBytes } from "../../../../utils/encoding/to-bytes.js";
|
5
5
|
import { keccak256 } from "../../../../utils/hashing/keccak256.js";
|
6
|
+
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
6
7
|
import { nativeLocalStorage } from "../../../../utils/storage/nativeStorage.js";
|
7
8
|
import {
|
8
9
|
base64ToString,
|
@@ -121,13 +122,14 @@ export class PasskeyNativeClient implements PasskeyClient {
|
|
121
122
|
export async function hasStoredPasskey(
|
122
123
|
client: ThirdwebClient,
|
123
124
|
ecosystemId?: EcosystemWalletId,
|
125
|
+
storage?: AsyncStorage,
|
124
126
|
) {
|
125
|
-
const
|
126
|
-
storage: nativeLocalStorage,
|
127
|
+
const clientStorage = new ClientScopedStorage({
|
128
|
+
storage: storage ?? nativeLocalStorage,
|
127
129
|
clientId: client.clientId,
|
128
130
|
ecosystem: ecosystemId ? { id: ecosystemId } : undefined,
|
129
131
|
});
|
130
|
-
const credId = await
|
132
|
+
const credId = await clientStorage.getPasskeyCredentialId();
|
131
133
|
return !!credId;
|
132
134
|
}
|
133
135
|
|
@@ -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 & {
|
@@ -182,7 +182,15 @@ export type Account = {
|
|
182
182
|
* const signature = await account.signMessage({ message: 'hello!' });
|
183
183
|
* ```
|
184
184
|
*/
|
185
|
-
signMessage: ({
|
185
|
+
signMessage: ({
|
186
|
+
message,
|
187
|
+
originalMessage,
|
188
|
+
chainId,
|
189
|
+
}: {
|
190
|
+
message: SignableMessage;
|
191
|
+
originalMessage?: string;
|
192
|
+
chainId?: number;
|
193
|
+
}) => Promise<Hex>;
|
186
194
|
/**
|
187
195
|
* Sign the given typed data and return the signature
|
188
196
|
* @example
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { maxUint96 } from "ox/Solidity";
|
2
|
-
import { concat
|
2
|
+
import { concat } from "viem";
|
3
3
|
import type { Chain } from "../../../chains/types.js";
|
4
4
|
import type { ThirdwebClient } from "../../../client/client.js";
|
5
5
|
import {
|
@@ -16,9 +16,11 @@ import type { PreparedTransaction } from "../../../transaction/prepare-transacti
|
|
16
16
|
import type { TransactionReceipt } from "../../../transaction/types.js";
|
17
17
|
import { encodeAbiParameters } from "../../../utils/abi/encodeAbiParameters.js";
|
18
18
|
import { isContractDeployed } from "../../../utils/bytecode/is-contract-deployed.js";
|
19
|
-
import type
|
19
|
+
import { type Hex, toHex } from "../../../utils/encoding/hex.js";
|
20
20
|
import { hexToBytes } from "../../../utils/encoding/to-bytes.js";
|
21
21
|
import { isThirdwebUrl } from "../../../utils/fetch.js";
|
22
|
+
import { keccak256 } from "../../../utils/hashing/keccak256.js";
|
23
|
+
import { stringify } from "../../../utils/json.js";
|
22
24
|
import { resolvePromisedValue } from "../../../utils/promise/resolve-promised-value.js";
|
23
25
|
import type { Account } from "../../interfaces/wallet.js";
|
24
26
|
import type {
|
@@ -597,6 +599,54 @@ export async function signUserOp(args: {
|
|
597
599
|
}): Promise<UserOperationV06 | UserOperationV07> {
|
598
600
|
const { userOp, chain, entrypointAddress, adminAccount } = args;
|
599
601
|
|
602
|
+
const userOpHash = await getUserOpHash({
|
603
|
+
client: args.client,
|
604
|
+
userOp,
|
605
|
+
chain,
|
606
|
+
entrypointAddress,
|
607
|
+
});
|
608
|
+
|
609
|
+
if (adminAccount.signMessage) {
|
610
|
+
const signature = await adminAccount.signMessage({
|
611
|
+
message: {
|
612
|
+
raw: hexToBytes(userOpHash),
|
613
|
+
},
|
614
|
+
originalMessage: stringify(userOp),
|
615
|
+
chainId: chain.id,
|
616
|
+
});
|
617
|
+
return {
|
618
|
+
...userOp,
|
619
|
+
signature,
|
620
|
+
};
|
621
|
+
}
|
622
|
+
throw new Error("signMessage not implemented in signingAccount");
|
623
|
+
}
|
624
|
+
|
625
|
+
/**
|
626
|
+
* Get the hash of a user operation.
|
627
|
+
* @param args - The options for getting the user operation hash
|
628
|
+
* @returns - The user operation hash
|
629
|
+
* @example
|
630
|
+
* ```ts
|
631
|
+
* import { getUserOpHash } from "thirdweb/wallets/smart";
|
632
|
+
*
|
633
|
+
* const userOp = await createUnsignedUserOp(...);
|
634
|
+
* const userOpHash = await getUserOpHash({
|
635
|
+
* client,
|
636
|
+
* userOp,
|
637
|
+
* chain,
|
638
|
+
* });
|
639
|
+
* ```
|
640
|
+
* @walletUtils
|
641
|
+
*/
|
642
|
+
export async function getUserOpHash(args: {
|
643
|
+
client: ThirdwebClient;
|
644
|
+
userOp: UserOperationV06 | UserOperationV07;
|
645
|
+
chain: Chain;
|
646
|
+
entrypointAddress?: string;
|
647
|
+
}): Promise<Hex> {
|
648
|
+
const { userOp, chain, entrypointAddress } = args;
|
649
|
+
|
600
650
|
const entrypointVersion = getEntryPointVersion(
|
601
651
|
entrypointAddress || ENTRYPOINT_ADDRESS_v0_6,
|
602
652
|
);
|
@@ -623,19 +673,7 @@ export async function signUserOp(args: {
|
|
623
673
|
userOp: userOp as UserOperationV06,
|
624
674
|
});
|
625
675
|
}
|
626
|
-
|
627
|
-
if (adminAccount.signMessage) {
|
628
|
-
const signature = await adminAccount.signMessage({
|
629
|
-
message: {
|
630
|
-
raw: hexToBytes(userOpHash),
|
631
|
-
},
|
632
|
-
});
|
633
|
-
return {
|
634
|
-
...userOp,
|
635
|
-
signature,
|
636
|
-
};
|
637
|
-
}
|
638
|
-
throw new Error("signMessage not implemented in signingAccount");
|
676
|
+
return userOpHash;
|
639
677
|
}
|
640
678
|
|
641
679
|
async function getAccountInitCode(options: {
|