thirdweb 5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351 → 5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useSiweAuth = useSiweAuth;
4
4
  const react_query_1 = require("@tanstack/react-query");
5
+ const utils_js_1 = require("../../../../chains/utils.js");
5
6
  /**
6
7
  * @internal
7
8
  */
@@ -44,6 +45,9 @@ function useSiweAuth(activeWallet, activeAccount, authOptions) {
44
45
  }),
45
46
  Promise.resolve().then(() => require("../../../../auth/core/sign-login-payload.js")),
46
47
  ]);
48
+ if (payload.chain_id) {
49
+ await activeWallet.switchChain((0, utils_js_1.getCachedChain)(Number(payload.chain_id)));
50
+ }
47
51
  const signedPayload = await signLoginPayload({
48
52
  payload,
49
53
  account: activeAccount,
@@ -1 +1 @@
1
- {"version":3,"file":"useSiweAuth.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/auth/useSiweAuth.ts"],"names":[],"mappings":";;AAgDA,kCA+FC;AA/ID,uDAA8E;AA6C9E;;GAEG;AACH,SAAgB,WAAW,CACzB,YAAqB,EACrB,aAAuB,EACvB,WAA6B;IAE7B,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC;IAEnC,MAAM,WAAW,GAAG,IAAA,4BAAc,GAAE,CAAC;IAErC,MAAM,eAAe,GAAG,IAAA,sBAAQ,EAAC;QAC/B,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC;QAC7D,OAAO,EAAE,YAAY,IAAI,CAAC,CAAC,aAAa,EAAE,OAAO;QACjD,OAAO,EAAE,GAAG,EAAE;YACZ,sDAAsD;YACtD,IAAI,CAAC,WAAW,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC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AAE,eAAe,CAAC,IAAI;QAChC,SAAS,EAAE,eAAe,CAAC,UAAU;KACtC,CAAC;AACJ,CAAC"}
@@ -5,7 +5,7 @@ const react_query_1 = require("@tanstack/react-query");
5
5
  const profiles_js_1 = require("../../../../wallets/in-app/core/wallet/profiles.js");
6
6
  const useActiveWallet_js_1 = require("../wallets/useActiveWallet.js");
7
7
  /**
8
- * @description Retrieves all linked profiles for the current wallet.
8
+ * Retrieves all linked profiles for the current wallet.
9
9
  *
10
10
  * @returns A React Query result containing the linked profiles for the connected in-app wallet.
11
11
  *
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351";
4
+ exports.version = "5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336";
5
5
  //# sourceMappingURL=version.js.map
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProfiles = getProfiles;
4
4
  exports.linkProfile = linkProfile;
5
5
  /**
6
- * @description
7
6
  * Gets the linked profiles for the provided wallet.
8
7
  * This method is only available for in-app wallets.
9
8
  *
@@ -21,6 +20,7 @@ exports.linkProfile = linkProfile;
21
20
  * console.log(profiles[0].type);
22
21
  * console.log(profiles[0].details.email);
23
22
  * ```
23
+ * @wallet
24
24
  */
25
25
  async function getProfiles(wallet) {
26
26
  if (wallet.id !== "inApp") {
@@ -29,10 +29,9 @@ async function getProfiles(wallet) {
29
29
  return wallet.getProfiles();
30
30
  }
31
31
  /**
32
- * @description
33
32
  * Connects a new profile (authentication method) to the current user.
34
33
  * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
35
- * The inputs mirror those used when authenticating normally, @see {@link Wallet.connect}
34
+ * The inputs mirror those used when authenticating normally.
36
35
  *
37
36
  * **When a profile is linked to the account, that profile can then be used to sign into the account.**
38
37
  *
@@ -50,6 +49,7 @@ async function getProfiles(wallet) {
50
49
  * await wallet.connect({ strategy: "google" });
51
50
  * const profiles = await linkProfile(wallet, { strategy: "discord" });
52
51
  * ```
52
+ * @wallet
53
53
  */
54
54
  async function linkProfile(wallet, auth) {
55
55
  if (wallet.id !== "inApp") {
@@ -1,4 +1,5 @@
1
1
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
2
+ import { getCachedChain } from "../../../../chains/utils.js";
2
3
  /**
3
4
  * @internal
4
5
  */
@@ -42,6 +43,9 @@ export function useSiweAuth(activeWallet, activeAccount, authOptions) {
42
43
  // we lazy-load this because it's only needed when logging in
43
44
  import("../../../../auth/core/sign-login-payload.js"),
44
45
  ]);
46
+ if (payload.chain_id) {
47
+ await activeWallet.switchChain(getCachedChain(Number(payload.chain_id)));
48
+ }
45
49
  const signedPayload = await signLoginPayload({
46
50
  payload,
47
51
  account: activeAccount,
@@ -1 +1 @@
1
- {"version":3,"file":"useSiweAuth.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/auth/useSiweAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA6C9E;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,YAAqB,EACrB,aAAuB,EACvB,WAA6B;IAE7B,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC;IAEnC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,eAAe,GAAG,QAAQ,CAAC;QAC/B,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC;QAC7D,OAAO,EAAE,YAAY,IAAI,CAAC,CAAC,aAAa,EAAE,OAAO;QACjD,OAAO,EAAE,GAAG,EAAE;YACZ,sDAAsD;YACtD,IAAI,CAAC,WAAW,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;gBAC5C,OAAO,KAAK,CAAC;YACf,CAAC;YACD,O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AY,EAAE,cAAc,CAAC,SAAS;QAEtC,wBAAwB;QACxB,UAAU,EAAE,eAAe,CAAC,IAAI;QAChC,SAAS,EAAE,eAAe,CAAC,UAAU;KACtC,CAAC;AACJ,CAAC"}
@@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
2
2
  import { getProfiles } from "../../../../wallets/in-app/core/wallet/profiles.js";
3
3
  import { useActiveWallet } from "../wallets/useActiveWallet.js";
4
4
  /**
5
- * @description Retrieves all linked profiles for the current wallet.
5
+ * Retrieves all linked profiles for the current wallet.
6
6
  *
7
7
  * @returns A React Query result containing the linked profiles for the connected in-app wallet.
8
8
  *
@@ -1,2 +1,2 @@
1
- export const version = "5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351";
1
+ export const version = "5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336";
2
2
  //# sourceMappingURL=version.js.map
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @description
3
2
  * Gets the linked profiles for the provided wallet.
4
3
  * This method is only available for in-app wallets.
5
4
  *
@@ -17,6 +16,7 @@
17
16
  * console.log(profiles[0].type);
18
17
  * console.log(profiles[0].details.email);
19
18
  * ```
19
+ * @wallet
20
20
  */
21
21
  export async function getProfiles(wallet) {
22
22
  if (wallet.id !== "inApp") {
@@ -25,10 +25,9 @@ export async function getProfiles(wallet) {
25
25
  return wallet.getProfiles();
26
26
  }
27
27
  /**
28
- * @description
29
28
  * Connects a new profile (authentication method) to the current user.
30
29
  * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
31
- * The inputs mirror those used when authenticating normally, @see {@link Wallet.connect}
30
+ * The inputs mirror those used when authenticating normally.
32
31
  *
33
32
  * **When a profile is linked to the account, that profile can then be used to sign into the account.**
34
33
  *
@@ -46,6 +45,7 @@ export async function getProfiles(wallet) {
46
45
  * await wallet.connect({ strategy: "google" });
47
46
  * const profiles = await linkProfile(wallet, { strategy: "discord" });
48
47
  * ```
48
+ * @wallet
49
49
  */
50
50
  export async function linkProfile(wallet, auth) {
51
51
  if (wallet.id !== "inApp") {
@@ -1 +1 @@
1
- {"version":3,"file":"useSiweAuth.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/auth/useSiweAuth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAG5B;;;OAGG;IACH,eAAe,EAAE,CAAC,MAAM,EAAE;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAI5B;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAI7D;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAI9B;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,CAAC,EAAE,eAAe;;;;;;;;EA4F9B"}
1
+ {"version":3,"file":"useSiweAuth.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/auth/useSiweAuth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAE9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAG5B;;;OAGG;IACH,eAAe,EAAE,CAAC,MAAM,EAAE;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAI5B;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAI7D;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAI9B;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,CAAC,EAAE,eAAe;;;;;;;;EAkG9B"}
@@ -1,7 +1,7 @@
1
1
  import { type UseQueryResult } from "@tanstack/react-query";
2
2
  import type { Profile } from "../../../../wallets/in-app/core/authentication/types.js";
3
3
  /**
4
- * @description Retrieves all linked profiles for the current wallet.
4
+ * Retrieves all linked profiles for the current wallet.
5
5
  *
6
6
  * @returns A React Query result containing the linked profiles for the connected in-app wallet.
7
7
  *
@@ -1,2 +1,2 @@
1
- export declare const version = "5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351";
1
+ export declare const version = "5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import type { Wallet } from "../../../interfaces/wallet.js";
2
2
  import type { MultiStepAuthArgsType, Profile, SingleStepAuthArgsType } from "../authentication/types.js";
3
3
  /**
4
- * @description
5
4
  * Gets the linked profiles for the provided wallet.
6
5
  * This method is only available for in-app wallets.
7
6
  *
@@ -19,13 +18,13 @@ import type { MultiStepAuthArgsType, Profile, SingleStepAuthArgsType } from "../
19
18
  * console.log(profiles[0].type);
20
19
  * console.log(profiles[0].details.email);
21
20
  * ```
21
+ * @wallet
22
22
  */
23
23
  export declare function getProfiles(wallet: Wallet<"inApp">): Promise<Profile[]>;
24
24
  /**
25
- * @description
26
25
  * Connects a new profile (authentication method) to the current user.
27
26
  * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
28
- * The inputs mirror those used when authenticating normally, @see {@link Wallet.connect}
27
+ * The inputs mirror those used when authenticating normally.
29
28
  *
30
29
  * **When a profile is linked to the account, that profile can then be used to sign into the account.**
31
30
  *
@@ -43,6 +42,7 @@ export declare function getProfiles(wallet: Wallet<"inApp">): Promise<Profile[]>
43
42
  * await wallet.connect({ strategy: "google" });
44
43
  * const profiles = await linkProfile(wallet, { strategy: "discord" });
45
44
  * ```
45
+ * @wallet
46
46
  */
47
47
  export declare function linkProfile(wallet: Wallet<"inApp">, auth: MultiStepAuthArgsType | SingleStepAuthArgsType): Promise<Profile[]>;
48
48
  //# sourceMappingURL=profiles.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thirdweb",
3
- "version": "5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351",
3
+ "version": "5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -9,7 +9,7 @@ import { getAllRecipientsAddresses } from "./getAllRecipientsAddresses.js";
9
9
  const chain = ANVIL_CHAIN;
10
10
  const client = TEST_CLIENT;
11
11
 
12
- describe("getAllRecipientsAddresses", () => {
12
+ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsAddresses", () => {
13
13
  it("should work", async () => {
14
14
  const payees = [
15
15
  "0x12345674b599ce99958242b3D3741e7b01841DF3",
@@ -9,7 +9,7 @@ import { getAllRecipientsPercentages } from "./getAllRecipientsPercentages.js";
9
9
  const chain = ANVIL_CHAIN;
10
10
  const client = TEST_CLIENT;
11
11
 
12
- describe("getAllRecipientsPercentages", () => {
12
+ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsPercentages", () => {
13
13
  it("should work", async () => {
14
14
  const payees = [
15
15
  "0x12345674b599ce99958242b3D3741e7b01841DF3",
@@ -8,7 +8,7 @@ import { getRecipientSplitPercentage } from "./getRecipientSplitPercentage.js";
8
8
  const chain = ANVIL_CHAIN;
9
9
  const client = TEST_CLIENT;
10
10
 
11
- describe("getRecipientSplitPercentage", () => {
11
+ describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
12
12
  it("should work", async () => {
13
13
  const payees = [
14
14
  "0x12345674b599ce99958242b3D3741e7b01841DF3",
@@ -1,6 +1,7 @@
1
1
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
2
2
  import type { LoginPayload } from "../../../../auth/core/types.js";
3
3
  import type { VerifyLoginPayloadParams } from "../../../../auth/core/verify-login-payload.js";
4
+ import { getCachedChain } from "../../../../chains/utils.js";
4
5
  import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
5
6
 
6
7
  /**
@@ -95,6 +96,12 @@ export function useSiweAuth(
95
96
  import("../../../../auth/core/sign-login-payload.js"),
96
97
  ]);
97
98
 
99
+ if (payload.chain_id) {
100
+ await activeWallet.switchChain(
101
+ getCachedChain(Number(payload.chain_id)),
102
+ );
103
+ }
104
+
98
105
  const signedPayload = await signLoginPayload({
99
106
  payload,
100
107
  account: activeAccount,
@@ -5,7 +5,7 @@ import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
5
5
  import { useActiveWallet } from "../wallets/useActiveWallet.js";
6
6
 
7
7
  /**
8
- * @description Retrieves all linked profiles for the current wallet.
8
+ * Retrieves all linked profiles for the current wallet.
9
9
  *
10
10
  * @returns A React Query result containing the linked profiles for the connected in-app wallet.
11
11
  *
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.45.2-nightly-141fd53759f1b5515e38688fe96364edc4c76644-20240812000351";
1
+ export const version = "5.45.2-nightly-b15aa4cdff3f3b233025da285780668a18fe29ab-20240813000336";
@@ -6,7 +6,6 @@ import type {
6
6
  } from "../authentication/types.js";
7
7
 
8
8
  /**
9
- * @description
10
9
  * Gets the linked profiles for the provided wallet.
11
10
  * This method is only available for in-app wallets.
12
11
  *
@@ -24,6 +23,7 @@ import type {
24
23
  * console.log(profiles[0].type);
25
24
  * console.log(profiles[0].details.email);
26
25
  * ```
26
+ * @wallet
27
27
  */
28
28
  export async function getProfiles(wallet: Wallet<"inApp">) {
29
29
  if (wallet.id !== "inApp") {
@@ -36,10 +36,9 @@ export async function getProfiles(wallet: Wallet<"inApp">) {
36
36
  }
37
37
 
38
38
  /**
39
- * @description
40
39
  * Connects a new profile (authentication method) to the current user.
41
40
  * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
42
- * The inputs mirror those used when authenticating normally, @see {@link Wallet.connect}
41
+ * The inputs mirror those used when authenticating normally.
43
42
  *
44
43
  * **When a profile is linked to the account, that profile can then be used to sign into the account.**
45
44
  *
@@ -57,6 +56,7 @@ export async function getProfiles(wallet: Wallet<"inApp">) {
57
56
  * await wallet.connect({ strategy: "google" });
58
57
  * const profiles = await linkProfile(wallet, { strategy: "discord" });
59
58
  * ```
59
+ * @wallet
60
60
  */
61
61
  export async function linkProfile(
62
62
  wallet: Wallet<"inApp">,