thirdweb 5.112.1 → 5.112.3

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.
Files changed (30) hide show
  1. package/dist/cjs/adapters/eip1193/to-eip1193.js +9 -1
  2. package/dist/cjs/adapters/eip1193/to-eip1193.js.map +1 -1
  3. package/dist/cjs/version.js +1 -1
  4. package/dist/cjs/wallets/eip5792/get-capabilities.js +4 -2
  5. package/dist/cjs/wallets/eip5792/get-capabilities.js.map +1 -1
  6. package/dist/cjs/wallets/in-app/core/authentication/siwe.js +6 -2
  7. package/dist/cjs/wallets/in-app/core/authentication/siwe.js.map +1 -1
  8. package/dist/cjs/wallets/injected/index.js +2 -2
  9. package/dist/cjs/wallets/injected/index.js.map +1 -1
  10. package/dist/esm/adapters/eip1193/to-eip1193.js +9 -1
  11. package/dist/esm/adapters/eip1193/to-eip1193.js.map +1 -1
  12. package/dist/esm/version.js +1 -1
  13. package/dist/esm/wallets/eip5792/get-capabilities.js +4 -2
  14. package/dist/esm/wallets/eip5792/get-capabilities.js.map +1 -1
  15. package/dist/esm/wallets/in-app/core/authentication/siwe.js +6 -2
  16. package/dist/esm/wallets/in-app/core/authentication/siwe.js.map +1 -1
  17. package/dist/esm/wallets/injected/index.js +2 -2
  18. package/dist/esm/wallets/injected/index.js.map +1 -1
  19. package/dist/scripts/bridge-widget.js +113 -113
  20. package/dist/types/adapters/eip1193/to-eip1193.d.ts.map +1 -1
  21. package/dist/types/version.d.ts +1 -1
  22. package/dist/types/wallets/eip5792/get-capabilities.d.ts +1 -1
  23. package/dist/types/wallets/eip5792/get-capabilities.d.ts.map +1 -1
  24. package/dist/types/wallets/in-app/core/authentication/siwe.d.ts.map +1 -1
  25. package/package.json +4 -4
  26. package/src/adapters/eip1193/to-eip1193.ts +11 -1
  27. package/src/version.ts +1 -1
  28. package/src/wallets/eip5792/get-capabilities.ts +4 -2
  29. package/src/wallets/in-app/core/authentication/siwe.ts +7 -2
  30. package/src/wallets/injected/index.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"to-eip1193.d.ts","sourceRoot":"","sources":["../../../../src/adapters/eip1193/to-eip1193.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,eAAe,CA+I7E"}
1
+ {"version":3,"file":"to-eip1193.d.ts","sourceRoot":"","sources":["../../../../src/adapters/eip1193/to-eip1193.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,eAAe,CAyJ7E"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.112.1";
1
+ export declare const version = "5.112.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -28,5 +28,5 @@ export type GetCapabilitiesResult = Prettify<WalletCapabilitiesRecord<WalletCapa
28
28
  * @extension EIP5792
29
29
  */
30
30
  export declare function getCapabilities<const ID extends WalletId = WalletId>({ wallet, chainId, }: GetCapabilitiesOptions<ID>): Promise<GetCapabilitiesResult>;
31
- export declare function toGetCapabilitiesResult(result: Record<string, WalletCapabilities>, chainId?: number): GetCapabilitiesResult;
31
+ export declare function toGetCapabilitiesResult(result: Record<string, WalletCapabilities>, chainIdFilter?: number): GetCapabilitiesResult;
32
32
  //# sourceMappingURL=get-capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-capabilities.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/get-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE/E,MAAM,MAAM,sBAAsB,CAAC,EAAE,SAAS,QAAQ,GAAG,QAAQ,IAAI;IACnE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GA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AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC1C,aAAa,CAAC,EAAE,MAAM,GACrB,qBAAqB,CAkBvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"siwe.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/authentication/siwe.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAiD/C"}
1
+ {"version":3,"file":"siwe.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/authentication/siwe.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAKtE;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAmD/C"}
package/package.json CHANGED
@@ -36,11 +36,11 @@
36
36
  "qrcode": "1.5.3",
37
37
  "toml": "3.0.0",
38
38
  "uqr": "0.1.2",
39
- "viem": "2.37.9",
39
+ "viem": "2.39.0",
40
40
  "x402": "0.7.0",
41
41
  "zod": "3.25.75",
42
- "@thirdweb-dev/engine": "3.4.0",
43
- "@thirdweb-dev/insight": "1.1.1"
42
+ "@thirdweb-dev/insight": "1.1.1",
43
+ "@thirdweb-dev/engine": "3.4.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@aws-sdk/client-kms": "3.592.0",
@@ -399,7 +399,7 @@
399
399
  }
400
400
  },
401
401
  "typings": "./dist/types/exports/thirdweb.d.ts",
402
- "version": "5.112.1",
402
+ "version": "5.112.3",
403
403
  "scripts": {
404
404
  "bench": "vitest -c ./test/vitest.config.ts bench",
405
405
  "bench:compare": "bun run ./benchmarks/run.ts",
@@ -164,7 +164,17 @@ export function toProvider(options: ToEip1193ProviderOptions): EIP1193Provider {
164
164
  if (!account.getCapabilities) {
165
165
  throw new Error("Wallet does not support EIP-5792");
166
166
  }
167
- return account.getCapabilities({ chainId: chain.id });
167
+ const chains = request.params[1];
168
+ if (chains && Array.isArray(chains)) {
169
+ const firstChainStr = chains[0];
170
+ const firstChainId = isHex(firstChainStr)
171
+ ? hexToNumber(firstChainStr)
172
+ : Number(firstChainStr);
173
+ return account.getCapabilities(
174
+ firstChainId ? { chainId: firstChainId } : {},
175
+ );
176
+ }
177
+ return account.getCapabilities({});
168
178
  }
169
179
  case "wallet_sendCalls": {
170
180
  const account = wallet.getAccount();
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.112.1";
1
+ export const version = "5.112.3";
@@ -54,7 +54,7 @@ export async function getCapabilities<const ID extends WalletId = WalletId>({
54
54
 
55
55
  export function toGetCapabilitiesResult(
56
56
  result: Record<string, WalletCapabilities>,
57
- chainId?: number,
57
+ chainIdFilter?: number,
58
58
  ): GetCapabilitiesResult {
59
59
  const capabilities = {} as WalletCapabilitiesRecord<
60
60
  WalletCapabilities,
@@ -69,6 +69,8 @@ export function toGetCapabilitiesResult(
69
69
  capabilities[Number(chainId)] = capabilitiesCopy;
70
70
  }
71
71
  return (
72
- typeof chainId === "number" ? capabilities[chainId] : capabilities
72
+ typeof chainIdFilter === "number"
73
+ ? { [chainIdFilter]: capabilities[chainIdFilter] }
74
+ : capabilities
73
75
  ) as never;
74
76
  }
@@ -10,6 +10,9 @@ import type { Ecosystem } from "../wallet/types.js";
10
10
  import { getLoginCallbackUrl, getLoginUrl } from "./getLoginPath.js";
11
11
  import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
12
12
 
13
+ // wallets that cannot sign with ethereum mainnet, require a specific chain always
14
+ const NON_ETHEREUM_WALLETS = ["xyz.abs"];
15
+
13
16
  /**
14
17
  * @internal
15
18
  */
@@ -20,8 +23,10 @@ export async function siweAuthenticate(args: {
20
23
  ecosystem?: Ecosystem;
21
24
  }): Promise<AuthStoredTokenWithCookieReturnType> {
22
25
  const { wallet, client, ecosystem, chain } = args;
23
- const siweChain = chain || getCachedChain(1); // fallback to mainnet for SIWE for wide wallet compatibility
24
- // only connect if the wallet doesn't already have an account
26
+ const siweChain = NON_ETHEREUM_WALLETS.includes(wallet.id)
27
+ ? chain || getCachedChain(1)
28
+ : getCachedChain(1); // fallback to mainnet for SIWE for wide wallet compatibility
29
+ // only connect if the wallet doesn't alnready have an account
25
30
  const account =
26
31
  wallet.getAccount() || (await wallet.connect({ chain: siweChain, client }));
27
32
  const clientFetch = getClientFetch(client, ecosystem);
@@ -374,13 +374,13 @@ function createAccount({
374
374
  }
375
375
  },
376
376
  async getCapabilities(options) {
377
- const chainId = options.chainId;
377
+ const chainIdFilter = options.chainId;
378
378
  try {
379
379
  const result = await provider.request({
380
380
  method: "wallet_getCapabilities",
381
381
  params: [getAddress(account.address)],
382
382
  });
383
- return toGetCapabilitiesResult(result, chainId);
383
+ return toGetCapabilitiesResult(result, chainIdFilter);
384
384
  } catch (error: unknown) {
385
385
  if (
386
386
  /unsupport|not support|not available/i.test((error as Error).message)