thirdweb 5.29.3-nightly-ffaff744f72d2cb22896e7501677b48f76ea857a-20240614184424 → 5.29.3-nightly-f8e0c5f84bb3a07a2911b5fce51da3983bb2e9e9-20240614190203
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/{react-native.js → react.native.js} +1 -1
- package/dist/cjs/exports/{react-native.js.map → react.native.js.map} +1 -1
- package/dist/cjs/exports/wallets/embedded.js +4 -4
- package/dist/cjs/exports/wallets/embedded.js.map +1 -1
- package/dist/cjs/exports/wallets/in-app.js +4 -3
- package/dist/cjs/exports/wallets/in-app.js.map +1 -1
- package/dist/cjs/exports/wallets/in-app.native.js +17 -0
- package/dist/cjs/exports/wallets/in-app.native.js.map +1 -0
- package/dist/cjs/exports/wallets.js +10 -7
- package/dist/cjs/exports/wallets.js.map +1 -1
- package/dist/cjs/exports/{react-native/wallets.js → wallets.native.js} +13 -11
- package/dist/cjs/exports/wallets.native.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletOTPLoginUI.js +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletOTPLoginUI.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/create-wallet.js +3 -128
- package/dist/cjs/wallets/create-wallet.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/type.js +6 -1
- package/dist/cjs/wallets/in-app/core/authentication/type.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js +100 -0
- package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js.map +1 -0
- package/dist/cjs/wallets/in-app/core/wallet/index.js +14 -6
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/{core/authentication → native/auth}/index.js +15 -42
- package/dist/cjs/wallets/in-app/native/auth/index.js.map +1 -0
- package/dist/cjs/wallets/in-app/native/{auth.js → auth/native-auth.js} +9 -9
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -0
- package/dist/cjs/wallets/in-app/native/in-app.js +69 -0
- package/dist/cjs/wallets/in-app/native/in-app.js.map +1 -0
- package/dist/cjs/wallets/in-app/native/native-connector.js +9 -10
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +69 -0
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -0
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js +219 -0
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -0
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +121 -208
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +3 -4
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/exports/{react-native.js → react.native.js} +1 -1
- package/dist/esm/exports/{react-native.js.map → react.native.js.map} +1 -1
- package/dist/esm/exports/wallets/embedded.js +3 -2
- package/dist/esm/exports/wallets/embedded.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.js +4 -2
- package/dist/esm/exports/wallets/in-app.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.native.js +9 -0
- package/dist/esm/exports/wallets/in-app.native.js.map +1 -0
- package/dist/esm/exports/wallets.js +7 -4
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/exports/wallets.native.js +23 -0
- package/dist/esm/exports/wallets.native.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletOTPLoginUI.js +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletOTPLoginUI.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/create-wallet.js +1 -125
- package/dist/esm/wallets/create-wallet.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/type.js +5 -0
- package/dist/esm/wallets/in-app/core/authentication/type.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/in-app-core.js +95 -0
- package/dist/esm/wallets/in-app/core/wallet/in-app-core.js.map +1 -0
- package/dist/esm/wallets/in-app/core/wallet/index.js +14 -6
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/{core/authentication → native/auth}/index.js +14 -40
- package/dist/esm/wallets/in-app/native/auth/index.js.map +1 -0
- package/dist/esm/wallets/in-app/native/{auth.js → auth/native-auth.js} +9 -9
- package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -0
- package/dist/esm/wallets/in-app/native/in-app.js +65 -0
- package/dist/esm/wallets/in-app/native/in-app.js.map +1 -0
- package/dist/esm/wallets/in-app/native/native-connector.js +2 -3
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +65 -0
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -0
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js +215 -0
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -0
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +115 -206
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +2 -3
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/types/exports/{react-native.d.ts → react.native.d.ts} +1 -1
- package/dist/types/exports/{react-native.d.ts.map → react.native.d.ts.map} +1 -1
- package/dist/types/exports/wallets/embedded.d.ts +3 -2
- package/dist/types/exports/wallets/embedded.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.d.ts +3 -2
- package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.native.d.ts +5 -0
- package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -0
- package/dist/types/exports/wallets.d.ts +4 -3
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/exports/{react-native/wallets.d.ts → wallets.native.d.ts} +20 -19
- package/dist/types/exports/wallets.native.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/create-wallet.d.ts +0 -53
- package/dist/types/wallets/create-wallet.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/type.d.ts +4 -0
- package/dist/types/wallets/in-app/core/authentication/type.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/in-app-core.d.ts +16 -0
- package/dist/types/wallets/in-app/core/wallet/in-app-core.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/wallet/index.d.ts +3 -2
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/{core/authentication → native/auth}/index.d.ts +3 -12
- package/dist/types/wallets/in-app/native/auth/index.d.ts.map +1 -0
- package/dist/types/wallets/in-app/native/{auth.d.ts → auth/native-auth.d.ts} +3 -3
- package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -0
- package/dist/types/wallets/in-app/native/in-app.d.ts +56 -0
- package/dist/types/wallets/in-app/native/in-app.d.ts.map +1 -0
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +56 -0
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -0
- package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts +141 -0
- package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts.map +1 -0
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +78 -137
- package/dist/types/wallets/in-app/web/lib/auth/index.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 +9 -3
- package/src/exports/wallets/embedded.ts +4 -3
- package/src/exports/wallets/in-app.native.ts +18 -0
- package/src/exports/wallets/in-app.ts +6 -3
- package/src/exports/{react-native/wallets.ts → wallets.native.ts} +21 -19
- package/src/exports/wallets.ts +11 -5
- package/src/react/web/ui/ConnectWallet/Details.tsx +1 -1
- package/src/react/web/wallets/in-app/InAppWalletOTPLoginUI.tsx +1 -1
- package/src/version.ts +1 -1
- package/src/wallets/create-wallet.ts +1 -146
- package/src/wallets/in-app/core/authentication/type.ts +13 -0
- package/src/wallets/in-app/core/wallet/in-app-core.ts +134 -0
- package/src/wallets/in-app/core/wallet/index.ts +16 -5
- package/src/wallets/in-app/{core/authentication → native/auth}/index.ts +15 -57
- package/src/wallets/in-app/native/{auth.ts → auth/native-auth.ts} +10 -10
- package/src/wallets/in-app/native/in-app.ts +70 -0
- package/src/wallets/in-app/native/native-connector.ts +2 -2
- package/src/wallets/in-app/web/in-app.ts +70 -0
- package/src/wallets/in-app/web/lib/auth/iframe-auth.ts +266 -0
- package/src/wallets/in-app/web/lib/auth/index.ts +124 -249
- package/src/wallets/in-app/web/lib/web-connector.ts +2 -2
- package/dist/cjs/exports/react-native/wallets.js.map +0 -1
- package/dist/cjs/wallets/in-app/core/authentication/index.js.map +0 -1
- package/dist/cjs/wallets/in-app/native/auth.js.map +0 -1
- package/dist/esm/exports/react-native/wallets.js +0 -23
- package/dist/esm/exports/react-native/wallets.js.map +0 -1
- package/dist/esm/wallets/in-app/core/authentication/index.js.map +0 -1
- package/dist/esm/wallets/in-app/native/auth.js.map +0 -1
- package/dist/types/exports/react-native/wallets.d.ts.map +0 -1
- package/dist/types/wallets/in-app/core/authentication/index.d.ts.map +0 -1
- package/dist/types/wallets/in-app/native/auth.d.ts.map +0 -1
- /package/src/exports/{react-native.ts → react.native.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EAErB,MAAM,sCAAsC,CAAC;AAkB9C;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,0BAA0B,uFAWpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,0BAA0B,+BAMrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,+BAM3E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,kFAG1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,mBAAmB,CAAC,CAG9B"}
|
@@ -4,7 +4,7 @@ import { type AuthArgsType, type AuthLoginReturnType, type GetUser, type LogoutR
|
|
4
4
|
import type { InAppConnector } from "../../core/interfaces/connector.js";
|
5
5
|
import type { InAppWalletConstructorType } from "../types.js";
|
6
6
|
import { InAppWalletIframeCommunicator } from "../utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
|
7
|
-
import { Auth, type AuthQuerierTypes } from "./auth/
|
7
|
+
import { Auth, type AuthQuerierTypes } from "./auth/iframe-auth.js";
|
8
8
|
/**
|
9
9
|
* @internal
|
10
10
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;
|
1
|
+
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAG5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,CAAC;AAC9G,OAAO,EAAE,IAAI,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIpE;;GAEG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IACtD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IACjC,SAAS,CAAC,OAAO,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO,CAAC,MAAM,CAAe;IAC7B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX,OAAO,CAAC,qBAAqB;IAO7B;;;;OAIG;gBACS,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,0BAA0B;IAgDjE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxB,eAAe,CACnB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,sBAAsB,CAAC;IAiB5B,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiE9D,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAG1C"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.29.3-nightly-
|
3
|
+
"version": "5.29.3-nightly-f8e0c5f84bb3a07a2911b5fce51da3983bb2e9e9-20240614190203",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"./react": {
|
69
69
|
"types": "./dist/types/exports/react.d.ts",
|
70
70
|
"import": "./dist/esm/exports/react.js",
|
71
|
-
"react-native": "./dist/esm/exports/react
|
71
|
+
"react-native": "./dist/esm/exports/react.native.js",
|
72
72
|
"default": "./dist/cjs/exports/react.js"
|
73
73
|
},
|
74
74
|
"./react-native": {
|
@@ -99,9 +99,15 @@
|
|
99
99
|
"./wallets": {
|
100
100
|
"types": "./dist/types/exports/wallets.d.ts",
|
101
101
|
"import": "./dist/esm/exports/wallets.js",
|
102
|
-
"react-native": "./dist/esm/exports/
|
102
|
+
"react-native": "./dist/esm/exports/wallets.native.js",
|
103
103
|
"default": "./dist/cjs/exports/wallets.js"
|
104
104
|
},
|
105
|
+
"./wallets/in-app": {
|
106
|
+
"types": "./dist/types/exports/wallets/in-app.d.ts",
|
107
|
+
"import": "./dist/esm/exports/wallets/in-app.js",
|
108
|
+
"react-native": "./dist/esm/exports/wallets/in-app.native.js",
|
109
|
+
"default": "./dist/cjs/exports/wallets/in-app.js"
|
110
|
+
},
|
105
111
|
"./wallets/*": {
|
106
112
|
"types": "./dist/types/exports/wallets/*.d.ts",
|
107
113
|
"import": "./dist/esm/exports/wallets/*.js",
|
@@ -4,11 +4,12 @@ export {
|
|
4
4
|
* @deprecated use inAppWallet instead
|
5
5
|
*/
|
6
6
|
inAppWallet as embeddedWallet,
|
7
|
-
} from "../../wallets/
|
7
|
+
} from "../../wallets/in-app/web/in-app.js";
|
8
8
|
|
9
9
|
export {
|
10
10
|
preAuthenticate,
|
11
11
|
authenticate,
|
12
12
|
getUserEmail,
|
13
|
-
|
14
|
-
|
13
|
+
} from "../../wallets/in-app/web/lib/auth/index.js";
|
14
|
+
|
15
|
+
export { type GetAuthenticatedUserParams } from "../../wallets/in-app/core/authentication/type.js";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// --- KEEEP IN SYNC with exports/wallets/in-app.ts ---
|
2
|
+
|
3
|
+
export { inAppWallet } from "../../wallets/in-app/native/in-app.js";
|
4
|
+
|
5
|
+
export {
|
6
|
+
preAuthenticate,
|
7
|
+
authenticate,
|
8
|
+
getUserEmail,
|
9
|
+
getUserPhoneNumber,
|
10
|
+
} from "../../wallets/in-app/native/auth/index.js";
|
11
|
+
|
12
|
+
export { type GetAuthenticatedUserParams } from "../../wallets/in-app/core/authentication/type.js";
|
13
|
+
|
14
|
+
// NOT SUPPORTED (yet)
|
15
|
+
|
16
|
+
export const hasStoredPasskey = () => {
|
17
|
+
throw new Error("Not supported in native");
|
18
|
+
};
|
@@ -1,12 +1,15 @@
|
|
1
|
-
|
1
|
+
// --- KEEEP IN SYNC with exports/wallets/in-app.native.ts ---
|
2
|
+
|
3
|
+
export { inAppWallet } from "../../wallets/in-app/web/in-app.js";
|
2
4
|
|
3
5
|
export {
|
4
6
|
preAuthenticate,
|
5
7
|
authenticate,
|
6
8
|
getUserEmail,
|
7
9
|
getUserPhoneNumber,
|
8
|
-
|
9
|
-
|
10
|
+
} from "../../wallets/in-app/web/lib/auth/index.js";
|
11
|
+
|
12
|
+
export { type GetAuthenticatedUserParams } from "../../wallets/in-app/core/authentication/type.js";
|
10
13
|
|
11
14
|
export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js";
|
12
15
|
|
@@ -1,22 +1,24 @@
|
|
1
|
+
// --- KEEEP IN SYNC with exports/wallets.ts ---
|
2
|
+
|
1
3
|
export {
|
2
4
|
createWallet,
|
3
|
-
// TODO (rn) inAppWallet,
|
4
5
|
walletConnect,
|
5
|
-
} from "
|
6
|
-
export {
|
6
|
+
} from "../wallets/native/create-wallet.js";
|
7
|
+
export { inAppWallet } from "../wallets/in-app/native/in-app.js";
|
8
|
+
export { smartWallet } from "../wallets/smart/smart-wallet.js";
|
7
9
|
|
8
|
-
export type { Wallet, Account } from "
|
9
|
-
export type { ConnectionStatus } from "
|
10
|
+
export type { Wallet, Account } from "../wallets/interfaces/wallet.js";
|
11
|
+
export type { ConnectionStatus } from "../wallets/manager/index.js";
|
10
12
|
|
11
13
|
// utils
|
12
14
|
export {
|
13
15
|
getWalletBalance,
|
14
16
|
type GetWalletBalanceOptions,
|
15
|
-
} from "
|
17
|
+
} from "../wallets/utils/getWalletBalance.js";
|
16
18
|
export {
|
17
19
|
generateAccount,
|
18
20
|
type GenerateAccountOptions,
|
19
|
-
} from "
|
21
|
+
} from "../wallets/utils/generateAccount.js";
|
20
22
|
|
21
23
|
// private-key
|
22
24
|
export {
|
@@ -32,7 +34,7 @@ export {
|
|
32
34
|
* @deprecated - use {@link PrivateKeyToAccountOptions} instead
|
33
35
|
*/
|
34
36
|
type PrivateKeyToAccountOptions as PrivateKeyAccountOptions,
|
35
|
-
} from "
|
37
|
+
} from "../wallets/private-key.js";
|
36
38
|
|
37
39
|
export type {
|
38
40
|
WalletId,
|
@@ -40,22 +42,22 @@ export type {
|
|
40
42
|
WalletCreationOptions,
|
41
43
|
WalletConnectionOption,
|
42
44
|
CreateWalletArgs,
|
43
|
-
} from "
|
45
|
+
} from "../wallets/wallet-types.js";
|
44
46
|
|
45
47
|
export type {
|
46
48
|
WCSupportedWalletIds,
|
47
49
|
InjectedSupportedWalletIds,
|
48
|
-
} from "
|
50
|
+
} from "../wallets/__generated__/wallet-ids.js";
|
49
51
|
|
50
52
|
export type {
|
51
53
|
WCConnectOptions,
|
52
54
|
WCAutoConnectOptions,
|
53
|
-
} from "
|
55
|
+
} from "../wallets/wallet-connect/types.js";
|
54
56
|
|
55
57
|
export type {
|
56
58
|
SmartWalletConnectionOptions,
|
57
59
|
SmartWalletOptions,
|
58
|
-
} from "
|
60
|
+
} from "../wallets/smart/types.js";
|
59
61
|
|
60
62
|
export type {
|
61
63
|
InAppWalletAuth,
|
@@ -78,20 +80,20 @@ export type {
|
|
78
80
|
* @deprecated use InAppWalletSocialAuth instead
|
79
81
|
*/
|
80
82
|
InAppWalletSocialAuth as EmbeddedWalletSocialAuth,
|
81
|
-
} from "
|
83
|
+
} from "../wallets/in-app/core/wallet/types.js";
|
82
84
|
|
83
|
-
export type { CoinbaseSDKWalletConnectionOptions } from "
|
85
|
+
export type { CoinbaseSDKWalletConnectionOptions } from "../wallets/coinbase/coinbaseSDKWallet.js";
|
84
86
|
|
85
87
|
export type {
|
86
88
|
WalletEmitter,
|
87
89
|
WalletEmitterEvents,
|
88
|
-
} from "
|
90
|
+
} from "../wallets/wallet-emitter.js";
|
89
91
|
|
90
|
-
export { getAllWalletsList } from "
|
91
|
-
export { getWalletInfo } from "
|
92
|
-
export { type WalletInfo } from "
|
92
|
+
export { getAllWalletsList } from "../wallets/getAllWalletsList.js";
|
93
|
+
export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js";
|
94
|
+
export { type WalletInfo } from "../wallets/wallet-info.js";
|
93
95
|
|
94
|
-
export { createWalletAdapter } from "
|
96
|
+
export { createWalletAdapter } from "../adapters/wallet-adapter.js";
|
95
97
|
|
96
98
|
// NOT SUPPORTED
|
97
99
|
|
package/src/exports/wallets.ts
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
// --- KEEEP IN SYNC with exports/wallets.native.ts ---
|
2
|
+
|
1
3
|
export {
|
2
4
|
createWallet,
|
5
|
+
walletConnect,
|
6
|
+
} from "../wallets/create-wallet.js";
|
7
|
+
export {
|
3
8
|
inAppWallet,
|
4
9
|
/**
|
5
10
|
* @deprecated use inAppWallet instead
|
6
11
|
*/
|
7
12
|
inAppWallet as embeddedWallet,
|
8
|
-
|
9
|
-
} from "../wallets/create-wallet.js";
|
13
|
+
} from "../wallets/in-app/web/in-app.js";
|
10
14
|
export { smartWallet } from "../wallets/smart/smart-wallet.js";
|
11
15
|
|
12
16
|
export type { Wallet, Account } from "../wallets/interfaces/wallet.js";
|
@@ -38,9 +42,6 @@ export {
|
|
38
42
|
type PrivateKeyToAccountOptions as PrivateKeyAccountOptions,
|
39
43
|
} from "../wallets/private-key.js";
|
40
44
|
|
41
|
-
// injected
|
42
|
-
export { injectedProvider } from "../wallets/injected/mipdStore.js";
|
43
|
-
|
44
45
|
export type {
|
45
46
|
WalletId,
|
46
47
|
WalletAutoConnectionOption,
|
@@ -99,3 +100,8 @@ export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js";
|
|
99
100
|
export { type WalletInfo } from "../wallets/wallet-info.js";
|
100
101
|
|
101
102
|
export { createWalletAdapter } from "../adapters/wallet-adapter.js";
|
103
|
+
|
104
|
+
// WEB ONLY EXPORTS
|
105
|
+
|
106
|
+
// injected
|
107
|
+
export { injectedProvider } from "../wallets/injected/mipdStore.js";
|
@@ -916,7 +916,7 @@ function InAppWalletUserInfo(props: {
|
|
916
916
|
queryKey: ["in-app-wallet-user", client, account?.address],
|
917
917
|
queryFn: async () => {
|
918
918
|
const { getUserEmail, getUserPhoneNumber } = await import(
|
919
|
-
"../../../../wallets/in-app/
|
919
|
+
"../../../../wallets/in-app/web/lib/auth/index.js"
|
920
920
|
);
|
921
921
|
|
922
922
|
const [email, phone] = await Promise.all([
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
3
|
-
import { preAuthenticate } from "../../../../wallets/in-app/core/authentication/index.js";
|
4
3
|
import type { SendEmailOtpReturnType } from "../../../../wallets/in-app/core/authentication/type.js";
|
4
|
+
import { preAuthenticate } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
5
5
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
6
6
|
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
7
7
|
import { fontSize } from "../../../core/design-system/index.js";
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.29.3-nightly-
|
1
|
+
export const version = "5.29.3-nightly-f8e0c5f84bb3a07a2911b5fce51da3983bb2e9e9-20240614190203";
|
@@ -12,11 +12,10 @@ import type {
|
|
12
12
|
} from "./wallet-types.js";
|
13
13
|
|
14
14
|
import { trackConnect } from "../analytics/track.js";
|
15
|
-
import type { ThirdwebClient } from "../client/client.js";
|
16
15
|
import { coinbaseWalletSDK } from "./coinbase/coinbase-wallet.js";
|
17
16
|
import { getCoinbaseWebProvider } from "./coinbase/coinbaseSDKWallet.js";
|
18
17
|
import { COINBASE } from "./constants.js";
|
19
|
-
import {
|
18
|
+
import { inAppWallet } from "./in-app/web/in-app.js";
|
20
19
|
import { smartWallet } from "./smart/smart-wallet.js";
|
21
20
|
import type { WCConnectOptions } from "./wallet-connect/types.js";
|
22
21
|
import { createWalletEmitter } from "./wallet-emitter.js";
|
@@ -290,147 +289,3 @@ export function createWallet<const ID extends WalletId>(
|
|
290
289
|
export function walletConnect() {
|
291
290
|
return createWallet("walletConnect");
|
292
291
|
}
|
293
|
-
|
294
|
-
/**
|
295
|
-
* Creates an in-app wallet.
|
296
|
-
* @param createOptions - configuration options
|
297
|
-
* @returns The created in-app wallet.
|
298
|
-
* @example
|
299
|
-
* ```ts
|
300
|
-
* import { inAppWallet } from "thirdweb/wallets";
|
301
|
-
*
|
302
|
-
* const wallet = inAppWallet();
|
303
|
-
*
|
304
|
-
* const account = await wallet.connect({
|
305
|
-
* client,
|
306
|
-
* chain,
|
307
|
-
* strategy: "google",
|
308
|
-
* });
|
309
|
-
* ```
|
310
|
-
*
|
311
|
-
* Enable smart accounts and sponsor gas for your users:
|
312
|
-
* ```ts
|
313
|
-
* import { inAppWallet } from "thirdweb/wallets";
|
314
|
-
* const wallet = inAppWallet({
|
315
|
-
* smartAccount: {
|
316
|
-
* chain: sepolia,
|
317
|
-
* sponsorGas: true,
|
318
|
-
* },
|
319
|
-
* });
|
320
|
-
* ```
|
321
|
-
*
|
322
|
-
* Specify a logo for your login page
|
323
|
-
* ```ts
|
324
|
-
* import { inAppWallet } from "thirdweb/wallets";
|
325
|
-
* const wallet = inAppWallet({
|
326
|
-
* metadata: {
|
327
|
-
* image: {
|
328
|
-
* src: "https://example.com/logo.png",
|
329
|
-
* alt: "My logo",
|
330
|
-
* width: 100,
|
331
|
-
* height: 100,
|
332
|
-
* },
|
333
|
-
* },
|
334
|
-
* });
|
335
|
-
* ```
|
336
|
-
*
|
337
|
-
* Hide the ability to export the private key within the Connect Modal
|
338
|
-
* ```ts
|
339
|
-
* import { inAppWallet } from "thirdweb/wallets";
|
340
|
-
* const wallet = inAppWallet({
|
341
|
-
* hidePrivateKeyExport: true
|
342
|
-
* });
|
343
|
-
* ```
|
344
|
-
* @wallet
|
345
|
-
*/
|
346
|
-
export function inAppWallet(
|
347
|
-
createOptions?: CreateWalletArgs<"inApp">[1],
|
348
|
-
): Wallet<"inApp"> {
|
349
|
-
const emitter = createWalletEmitter<"inApp">();
|
350
|
-
let account: Account | undefined = undefined;
|
351
|
-
let chain: Chain | undefined = undefined;
|
352
|
-
let client: ThirdwebClient | undefined;
|
353
|
-
|
354
|
-
return {
|
355
|
-
id: "inApp",
|
356
|
-
subscribe: emitter.subscribe,
|
357
|
-
getChain: () => chain,
|
358
|
-
getConfig: () => createOptions,
|
359
|
-
getAccount: () => account,
|
360
|
-
autoConnect: async (options) => {
|
361
|
-
const { autoConnectInAppWallet } = await import(
|
362
|
-
"./in-app/core/wallet/index.js"
|
363
|
-
);
|
364
|
-
|
365
|
-
const [connectedAccount, connectedChain] = await autoConnectInAppWallet(
|
366
|
-
options,
|
367
|
-
createOptions,
|
368
|
-
);
|
369
|
-
// set the states
|
370
|
-
client = options.client;
|
371
|
-
account = connectedAccount;
|
372
|
-
chain = connectedChain;
|
373
|
-
trackConnect({
|
374
|
-
client: options.client,
|
375
|
-
walletType: "inApp",
|
376
|
-
walletAddress: account.address,
|
377
|
-
});
|
378
|
-
// return only the account
|
379
|
-
return account;
|
380
|
-
},
|
381
|
-
connect: async (options) => {
|
382
|
-
const { connectInAppWallet } = await import(
|
383
|
-
"./in-app/core/wallet/index.js"
|
384
|
-
);
|
385
|
-
|
386
|
-
const [connectedAccount, connectedChain] = await connectInAppWallet(
|
387
|
-
options,
|
388
|
-
createOptions,
|
389
|
-
);
|
390
|
-
// set the states
|
391
|
-
client = options.client;
|
392
|
-
account = connectedAccount;
|
393
|
-
chain = connectedChain;
|
394
|
-
trackConnect({
|
395
|
-
client: options.client,
|
396
|
-
walletType: "inApp",
|
397
|
-
walletAddress: account.address,
|
398
|
-
});
|
399
|
-
// return only the account
|
400
|
-
return account;
|
401
|
-
},
|
402
|
-
disconnect: async () => {
|
403
|
-
// If no client is assigned, we should be fine just unsetting the states
|
404
|
-
if (client) {
|
405
|
-
const result = await logoutAuthenticatedUser({ client });
|
406
|
-
if (!result.success) {
|
407
|
-
throw new Error("Failed to logout");
|
408
|
-
}
|
409
|
-
}
|
410
|
-
account = undefined;
|
411
|
-
chain = undefined;
|
412
|
-
emitter.emit("disconnect", undefined);
|
413
|
-
},
|
414
|
-
switchChain: async (newChain) => {
|
415
|
-
if (createOptions?.smartAccount && client && account) {
|
416
|
-
// if account abstraction is enabled, reconnect to smart account on the new chain
|
417
|
-
const { autoConnectInAppWallet } = await import(
|
418
|
-
"./in-app/core/wallet/index.js"
|
419
|
-
);
|
420
|
-
const [connectedAccount, connectedChain] = await autoConnectInAppWallet(
|
421
|
-
{
|
422
|
-
chain: newChain,
|
423
|
-
client,
|
424
|
-
},
|
425
|
-
createOptions,
|
426
|
-
);
|
427
|
-
account = connectedAccount;
|
428
|
-
chain = connectedChain;
|
429
|
-
} else {
|
430
|
-
// if not, simply set the new chain
|
431
|
-
chain = newChain;
|
432
|
-
}
|
433
|
-
emitter.emit("chainChanged", newChain);
|
434
|
-
},
|
435
|
-
};
|
436
|
-
}
|
@@ -210,3 +210,16 @@ export type GetUser =
|
|
210
210
|
walletAddress: string;
|
211
211
|
}
|
212
212
|
| InitializedUser;
|
213
|
+
|
214
|
+
export type GetAuthenticatedUserParams = {
|
215
|
+
client: ThirdwebClient;
|
216
|
+
};
|
217
|
+
|
218
|
+
export const oauthStrategyToAuthProvider: Record<
|
219
|
+
"google" | "facebook" | "apple",
|
220
|
+
AuthProvider
|
221
|
+
> = {
|
222
|
+
google: AuthProvider.GOOGLE,
|
223
|
+
facebook: AuthProvider.FACEBOOK,
|
224
|
+
apple: AuthProvider.APPLE,
|
225
|
+
};
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import { trackConnect } from "../../../../analytics/track.js";
|
2
|
+
import type { Chain } from "../../../../chains/types.js";
|
3
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
|
+
import type { Account, Wallet } from "../../../interfaces/wallet.js";
|
5
|
+
import { createWalletEmitter } from "../../../wallet-emitter.js";
|
6
|
+
import type { CreateWalletArgs } from "../../../wallet-types.js";
|
7
|
+
import type { InAppConnector } from "../interfaces/connector.js";
|
8
|
+
|
9
|
+
const connectorCache = new WeakMap<ThirdwebClient, InAppConnector>();
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @internal
|
13
|
+
*/
|
14
|
+
export async function getOrCreateInAppWalletConnector(
|
15
|
+
client: ThirdwebClient,
|
16
|
+
connectorFactory: (client: ThirdwebClient) => Promise<InAppConnector>,
|
17
|
+
) {
|
18
|
+
if (connectorCache.has(client)) {
|
19
|
+
return connectorCache.get(client) as InAppConnector;
|
20
|
+
}
|
21
|
+
const connector = await connectorFactory(client);
|
22
|
+
connectorCache.set(client, connector);
|
23
|
+
return connector;
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @internal
|
28
|
+
*/
|
29
|
+
export function createInAppWallet(args: {
|
30
|
+
createOptions?: CreateWalletArgs<"inApp">[1];
|
31
|
+
connectorFactory: (client: ThirdwebClient) => Promise<InAppConnector>;
|
32
|
+
}): Wallet<"inApp"> {
|
33
|
+
const { createOptions, connectorFactory } = args;
|
34
|
+
const emitter = createWalletEmitter<"inApp">();
|
35
|
+
let account: Account | undefined = undefined;
|
36
|
+
let chain: Chain | undefined = undefined;
|
37
|
+
let client: ThirdwebClient | undefined;
|
38
|
+
|
39
|
+
return {
|
40
|
+
id: "inApp",
|
41
|
+
subscribe: emitter.subscribe,
|
42
|
+
getChain: () => chain,
|
43
|
+
getConfig: () => createOptions,
|
44
|
+
getAccount: () => account,
|
45
|
+
autoConnect: async (options) => {
|
46
|
+
const { autoConnectInAppWallet } = await import("./index.js");
|
47
|
+
|
48
|
+
const connector = await getOrCreateInAppWalletConnector(
|
49
|
+
options.client,
|
50
|
+
connectorFactory,
|
51
|
+
);
|
52
|
+
const [connectedAccount, connectedChain] = await autoConnectInAppWallet(
|
53
|
+
options,
|
54
|
+
createOptions,
|
55
|
+
connector,
|
56
|
+
);
|
57
|
+
// set the states
|
58
|
+
client = options.client;
|
59
|
+
account = connectedAccount;
|
60
|
+
chain = connectedChain;
|
61
|
+
trackConnect({
|
62
|
+
client: options.client,
|
63
|
+
walletType: "inApp",
|
64
|
+
walletAddress: account.address,
|
65
|
+
});
|
66
|
+
// return only the account
|
67
|
+
return account;
|
68
|
+
},
|
69
|
+
connect: async (options) => {
|
70
|
+
const { connectInAppWallet } = await import("./index.js");
|
71
|
+
|
72
|
+
const connector = await getOrCreateInAppWalletConnector(
|
73
|
+
options.client,
|
74
|
+
connectorFactory,
|
75
|
+
);
|
76
|
+
const [connectedAccount, connectedChain] = await connectInAppWallet(
|
77
|
+
options,
|
78
|
+
createOptions,
|
79
|
+
connector,
|
80
|
+
);
|
81
|
+
// set the states
|
82
|
+
client = options.client;
|
83
|
+
account = connectedAccount;
|
84
|
+
chain = connectedChain;
|
85
|
+
trackConnect({
|
86
|
+
client: options.client,
|
87
|
+
walletType: "inApp",
|
88
|
+
walletAddress: account.address,
|
89
|
+
});
|
90
|
+
// return only the account
|
91
|
+
return account;
|
92
|
+
},
|
93
|
+
disconnect: async () => {
|
94
|
+
// If no client is assigned, we should be fine just unsetting the states
|
95
|
+
if (client) {
|
96
|
+
const connector = await getOrCreateInAppWalletConnector(
|
97
|
+
client,
|
98
|
+
connectorFactory,
|
99
|
+
);
|
100
|
+
const result = await connector.logout();
|
101
|
+
if (!result.success) {
|
102
|
+
throw new Error("Failed to logout");
|
103
|
+
}
|
104
|
+
}
|
105
|
+
account = undefined;
|
106
|
+
chain = undefined;
|
107
|
+
emitter.emit("disconnect", undefined);
|
108
|
+
},
|
109
|
+
switchChain: async (newChain) => {
|
110
|
+
if (createOptions?.smartAccount && client && account) {
|
111
|
+
// if account abstraction is enabled, reconnect to smart account on the new chain
|
112
|
+
const { autoConnectInAppWallet } = await import("./index.js");
|
113
|
+
const connector = await getOrCreateInAppWalletConnector(
|
114
|
+
client,
|
115
|
+
connectorFactory,
|
116
|
+
);
|
117
|
+
const [connectedAccount, connectedChain] = await autoConnectInAppWallet(
|
118
|
+
{
|
119
|
+
chain: newChain,
|
120
|
+
client,
|
121
|
+
},
|
122
|
+
createOptions,
|
123
|
+
connector,
|
124
|
+
);
|
125
|
+
account = connectedAccount;
|
126
|
+
chain = connectedChain;
|
127
|
+
} else {
|
128
|
+
// if not, simply set the new chain
|
129
|
+
chain = newChain;
|
130
|
+
}
|
131
|
+
emitter.emit("chainChanged", newChain);
|
132
|
+
},
|
133
|
+
};
|
134
|
+
}
|
@@ -8,6 +8,8 @@ import type {
|
|
8
8
|
WalletAutoConnectionOption,
|
9
9
|
WalletConnectionOption,
|
10
10
|
} from "../../../wallet-types.js";
|
11
|
+
import { UserWalletStatus } from "../authentication/type.js";
|
12
|
+
import type { InAppConnector } from "../interfaces/connector.js";
|
11
13
|
|
12
14
|
/**
|
13
15
|
* Checks if the provided wallet is an in-app wallet.
|
@@ -27,10 +29,9 @@ export function isInAppWallet(
|
|
27
29
|
export async function connectInAppWallet(
|
28
30
|
options: WalletConnectionOption<"inApp">,
|
29
31
|
createOptions: CreateWalletArgs<"inApp">[1],
|
32
|
+
connector: InAppConnector,
|
30
33
|
): Promise<[Account, Chain]> {
|
31
|
-
const
|
32
|
-
|
33
|
-
const authResult = await authenticate(options);
|
34
|
+
const authResult = await connector.authenticate(options);
|
34
35
|
const authAccount = authResult.user.account;
|
35
36
|
|
36
37
|
if (createOptions?.smartAccount) {
|
@@ -54,9 +55,9 @@ export async function connectInAppWallet(
|
|
54
55
|
export async function autoConnectInAppWallet(
|
55
56
|
options: WalletAutoConnectionOption<"inApp">,
|
56
57
|
createOptions: CreateWalletArgs<"inApp">[1],
|
58
|
+
connector: InAppConnector,
|
57
59
|
): Promise<[Account, Chain]> {
|
58
|
-
const
|
59
|
-
const user = await getAuthenticatedUser({ client: options.client });
|
60
|
+
const user = await getAuthenticatedUser(connector);
|
60
61
|
if (!user) {
|
61
62
|
throw new Error("not authenticated");
|
62
63
|
}
|
@@ -100,3 +101,13 @@ async function convertToSmartAccount(options: {
|
|
100
101
|
options.smartAccountOptions,
|
101
102
|
);
|
102
103
|
}
|
104
|
+
|
105
|
+
async function getAuthenticatedUser(connector: InAppConnector) {
|
106
|
+
const user = await connector.getUser();
|
107
|
+
switch (user.status) {
|
108
|
+
case UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED: {
|
109
|
+
return user;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
return undefined;
|
113
|
+
}
|