thirdweb 5.105.45-nightly-dc1f7ab2ee820be512776a413f7de362ff6b98ef-20250912000326 → 5.105.46

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 (207) hide show
  1. package/dist/cjs/extensions/erc1155/drops/write/claimTo.js +1 -0
  2. package/dist/cjs/extensions/erc1155/drops/write/claimTo.js.map +1 -1
  3. package/dist/cjs/extensions/erc1155/drops/write/resetClaimEligibility.js +2 -0
  4. package/dist/cjs/extensions/erc1155/drops/write/resetClaimEligibility.js.map +1 -1
  5. package/dist/cjs/extensions/erc1155/drops/write/setClaimConditions.js +1 -0
  6. package/dist/cjs/extensions/erc1155/drops/write/setClaimConditions.js.map +1 -1
  7. package/dist/cjs/extensions/erc1155/drops/write/updateMetadata.js +1 -0
  8. package/dist/cjs/extensions/erc1155/drops/write/updateMetadata.js.map +1 -1
  9. package/dist/cjs/extensions/erc1155/write/lazyMint.js +1 -0
  10. package/dist/cjs/extensions/erc1155/write/lazyMint.js.map +1 -1
  11. package/dist/cjs/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -0
  12. package/dist/cjs/extensions/erc1155/write/mintAdditionalSupplyTo.js.map +1 -1
  13. package/dist/cjs/extensions/erc1155/write/updateTokenURI.js +1 -0
  14. package/dist/cjs/extensions/erc1155/write/updateTokenURI.js.map +1 -1
  15. package/dist/cjs/extensions/erc20/drops/write/claimTo.js +1 -0
  16. package/dist/cjs/extensions/erc20/drops/write/claimTo.js.map +1 -1
  17. package/dist/cjs/extensions/erc20/drops/write/resetClaimEligibility.js +1 -0
  18. package/dist/cjs/extensions/erc20/drops/write/resetClaimEligibility.js.map +1 -1
  19. package/dist/cjs/extensions/erc20/drops/write/setClaimConditions.js +1 -0
  20. package/dist/cjs/extensions/erc20/drops/write/setClaimConditions.js.map +1 -1
  21. package/dist/cjs/extensions/erc20/write/approve.js +1 -0
  22. package/dist/cjs/extensions/erc20/write/approve.js.map +1 -1
  23. package/dist/cjs/extensions/erc20/write/deposit.js +1 -0
  24. package/dist/cjs/extensions/erc20/write/deposit.js.map +1 -1
  25. package/dist/cjs/extensions/erc20/write/transferBatch.js +1 -0
  26. package/dist/cjs/extensions/erc20/write/transferBatch.js.map +1 -1
  27. package/dist/cjs/extensions/erc721/drops/write/claimTo.js +1 -0
  28. package/dist/cjs/extensions/erc721/drops/write/claimTo.js.map +1 -1
  29. package/dist/cjs/extensions/erc721/drops/write/resetClaimEligibility.js +1 -0
  30. package/dist/cjs/extensions/erc721/drops/write/resetClaimEligibility.js.map +1 -1
  31. package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.js +1 -0
  32. package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.js.map +1 -1
  33. package/dist/cjs/extensions/erc721/drops/write/updateMetadata.js +1 -0
  34. package/dist/cjs/extensions/erc721/drops/write/updateMetadata.js.map +1 -1
  35. package/dist/cjs/extensions/erc721/write/lazyMint.js +1 -0
  36. package/dist/cjs/extensions/erc721/write/lazyMint.js.map +1 -1
  37. package/dist/cjs/extensions/erc721/write/setSharedMetadata.js +1 -0
  38. package/dist/cjs/extensions/erc721/write/setSharedMetadata.js.map +1 -1
  39. package/dist/cjs/extensions/erc721/write/updateTokenURI.js +1 -0
  40. package/dist/cjs/extensions/erc721/write/updateTokenURI.js.map +1 -1
  41. package/dist/cjs/extensions/erc7702/account/createSessionKey.js +1 -0
  42. package/dist/cjs/extensions/erc7702/account/createSessionKey.js.map +1 -1
  43. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +4 -0
  44. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/version.js.map +1 -1
  47. package/dist/cjs/wallets/create-wallet.js +2 -0
  48. package/dist/cjs/wallets/create-wallet.js.map +1 -1
  49. package/dist/cjs/wallets/in-app/core/authentication/siwe.js +5 -3
  50. package/dist/cjs/wallets/in-app/core/authentication/siwe.js.map +1 -1
  51. package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js +28 -20
  52. package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
  53. package/dist/cjs/wallets/in-app/native/native-connector.js +0 -1
  54. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  55. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +0 -1
  56. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  57. package/dist/cjs/wallets/injected/index.js +25 -5
  58. package/dist/cjs/wallets/injected/index.js.map +1 -1
  59. package/dist/cjs/wallets/wallet-connect/controller.js +103 -11
  60. package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
  61. package/dist/esm/extensions/erc1155/drops/write/claimTo.js +1 -0
  62. package/dist/esm/extensions/erc1155/drops/write/claimTo.js.map +1 -1
  63. package/dist/esm/extensions/erc1155/drops/write/resetClaimEligibility.js +2 -0
  64. package/dist/esm/extensions/erc1155/drops/write/resetClaimEligibility.js.map +1 -1
  65. package/dist/esm/extensions/erc1155/drops/write/setClaimConditions.js +1 -0
  66. package/dist/esm/extensions/erc1155/drops/write/setClaimConditions.js.map +1 -1
  67. package/dist/esm/extensions/erc1155/drops/write/updateMetadata.js +1 -0
  68. package/dist/esm/extensions/erc1155/drops/write/updateMetadata.js.map +1 -1
  69. package/dist/esm/extensions/erc1155/write/lazyMint.js +1 -0
  70. package/dist/esm/extensions/erc1155/write/lazyMint.js.map +1 -1
  71. package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -0
  72. package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.js.map +1 -1
  73. package/dist/esm/extensions/erc1155/write/updateTokenURI.js +1 -0
  74. package/dist/esm/extensions/erc1155/write/updateTokenURI.js.map +1 -1
  75. package/dist/esm/extensions/erc20/drops/write/claimTo.js +1 -0
  76. package/dist/esm/extensions/erc20/drops/write/claimTo.js.map +1 -1
  77. package/dist/esm/extensions/erc20/drops/write/resetClaimEligibility.js +1 -0
  78. package/dist/esm/extensions/erc20/drops/write/resetClaimEligibility.js.map +1 -1
  79. package/dist/esm/extensions/erc20/drops/write/setClaimConditions.js +1 -0
  80. package/dist/esm/extensions/erc20/drops/write/setClaimConditions.js.map +1 -1
  81. package/dist/esm/extensions/erc20/write/approve.js +1 -0
  82. package/dist/esm/extensions/erc20/write/approve.js.map +1 -1
  83. package/dist/esm/extensions/erc20/write/deposit.js +1 -0
  84. package/dist/esm/extensions/erc20/write/deposit.js.map +1 -1
  85. package/dist/esm/extensions/erc20/write/transferBatch.js +1 -0
  86. package/dist/esm/extensions/erc20/write/transferBatch.js.map +1 -1
  87. package/dist/esm/extensions/erc721/drops/write/claimTo.js +1 -0
  88. package/dist/esm/extensions/erc721/drops/write/claimTo.js.map +1 -1
  89. package/dist/esm/extensions/erc721/drops/write/resetClaimEligibility.js +1 -0
  90. package/dist/esm/extensions/erc721/drops/write/resetClaimEligibility.js.map +1 -1
  91. package/dist/esm/extensions/erc721/drops/write/setClaimConditions.js +1 -0
  92. package/dist/esm/extensions/erc721/drops/write/setClaimConditions.js.map +1 -1
  93. package/dist/esm/extensions/erc721/drops/write/updateMetadata.js +1 -0
  94. package/dist/esm/extensions/erc721/drops/write/updateMetadata.js.map +1 -1
  95. package/dist/esm/extensions/erc721/write/lazyMint.js +1 -0
  96. package/dist/esm/extensions/erc721/write/lazyMint.js.map +1 -1
  97. package/dist/esm/extensions/erc721/write/setSharedMetadata.js +1 -0
  98. package/dist/esm/extensions/erc721/write/setSharedMetadata.js.map +1 -1
  99. package/dist/esm/extensions/erc721/write/updateTokenURI.js +1 -0
  100. package/dist/esm/extensions/erc721/write/updateTokenURI.js.map +1 -1
  101. package/dist/esm/extensions/erc7702/account/createSessionKey.js +1 -0
  102. package/dist/esm/extensions/erc7702/account/createSessionKey.js.map +1 -1
  103. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +4 -0
  104. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  105. package/dist/esm/version.js +1 -1
  106. package/dist/esm/version.js.map +1 -1
  107. package/dist/esm/wallets/create-wallet.js +2 -0
  108. package/dist/esm/wallets/create-wallet.js.map +1 -1
  109. package/dist/esm/wallets/in-app/core/authentication/siwe.js +5 -3
  110. package/dist/esm/wallets/in-app/core/authentication/siwe.js.map +1 -1
  111. package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js +28 -20
  112. package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
  113. package/dist/esm/wallets/in-app/native/native-connector.js +0 -1
  114. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  115. package/dist/esm/wallets/in-app/web/lib/web-connector.js +0 -1
  116. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  117. package/dist/esm/wallets/injected/index.js +25 -5
  118. package/dist/esm/wallets/injected/index.js.map +1 -1
  119. package/dist/esm/wallets/wallet-connect/controller.js +103 -11
  120. package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
  121. package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts +2 -2
  122. package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts.map +1 -1
  123. package/dist/types/extensions/erc1155/drops/write/resetClaimEligibility.d.ts +2 -2
  124. package/dist/types/extensions/erc1155/drops/write/resetClaimEligibility.d.ts.map +1 -1
  125. package/dist/types/extensions/erc1155/drops/write/setClaimConditions.d.ts +2 -2
  126. package/dist/types/extensions/erc1155/drops/write/setClaimConditions.d.ts.map +1 -1
  127. package/dist/types/extensions/erc1155/drops/write/updateMetadata.d.ts +2 -2
  128. package/dist/types/extensions/erc1155/drops/write/updateMetadata.d.ts.map +1 -1
  129. package/dist/types/extensions/erc1155/write/lazyMint.d.ts +3 -3
  130. package/dist/types/extensions/erc1155/write/lazyMint.d.ts.map +1 -1
  131. package/dist/types/extensions/erc1155/write/mintAdditionalSupplyTo.d.ts +3 -3
  132. package/dist/types/extensions/erc1155/write/mintAdditionalSupplyTo.d.ts.map +1 -1
  133. package/dist/types/extensions/erc1155/write/updateTokenURI.d.ts +3 -3
  134. package/dist/types/extensions/erc1155/write/updateTokenURI.d.ts.map +1 -1
  135. package/dist/types/extensions/erc20/drops/write/claimTo.d.ts +2 -2
  136. package/dist/types/extensions/erc20/drops/write/claimTo.d.ts.map +1 -1
  137. package/dist/types/extensions/erc20/drops/write/resetClaimEligibility.d.ts +2 -2
  138. package/dist/types/extensions/erc20/drops/write/resetClaimEligibility.d.ts.map +1 -1
  139. package/dist/types/extensions/erc20/drops/write/setClaimConditions.d.ts +2 -2
  140. package/dist/types/extensions/erc20/drops/write/setClaimConditions.d.ts.map +1 -1
  141. package/dist/types/extensions/erc20/write/approve.d.ts +3 -3
  142. package/dist/types/extensions/erc20/write/approve.d.ts.map +1 -1
  143. package/dist/types/extensions/erc20/write/deposit.d.ts +3 -3
  144. package/dist/types/extensions/erc20/write/deposit.d.ts.map +1 -1
  145. package/dist/types/extensions/erc20/write/transferBatch.d.ts +3 -3
  146. package/dist/types/extensions/erc20/write/transferBatch.d.ts.map +1 -1
  147. package/dist/types/extensions/erc721/drops/write/claimTo.d.ts +2 -2
  148. package/dist/types/extensions/erc721/drops/write/claimTo.d.ts.map +1 -1
  149. package/dist/types/extensions/erc721/drops/write/resetClaimEligibility.d.ts +2 -2
  150. package/dist/types/extensions/erc721/drops/write/resetClaimEligibility.d.ts.map +1 -1
  151. package/dist/types/extensions/erc721/drops/write/setClaimConditions.d.ts +2 -2
  152. package/dist/types/extensions/erc721/drops/write/setClaimConditions.d.ts.map +1 -1
  153. package/dist/types/extensions/erc721/drops/write/updateMetadata.d.ts +2 -2
  154. package/dist/types/extensions/erc721/drops/write/updateMetadata.d.ts.map +1 -1
  155. package/dist/types/extensions/erc721/write/lazyMint.d.ts +3 -3
  156. package/dist/types/extensions/erc721/write/lazyMint.d.ts.map +1 -1
  157. package/dist/types/extensions/erc721/write/setSharedMetadata.d.ts +3 -3
  158. package/dist/types/extensions/erc721/write/setSharedMetadata.d.ts.map +1 -1
  159. package/dist/types/extensions/erc721/write/updateTokenURI.d.ts +3 -3
  160. package/dist/types/extensions/erc721/write/updateTokenURI.d.ts.map +1 -1
  161. package/dist/types/extensions/erc7702/account/createSessionKey.d.ts +2 -2
  162. package/dist/types/extensions/erc7702/account/createSessionKey.d.ts.map +1 -1
  163. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  164. package/dist/types/version.d.ts +1 -1
  165. package/dist/types/version.d.ts.map +1 -1
  166. package/dist/types/wallets/create-wallet.d.ts.map +1 -1
  167. package/dist/types/wallets/in-app/core/authentication/siwe.d.ts +0 -2
  168. package/dist/types/wallets/in-app/core/authentication/siwe.d.ts.map +1 -1
  169. package/dist/types/wallets/in-app/core/eip7702/minimal-account.d.ts.map +1 -1
  170. package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
  171. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  172. package/dist/types/wallets/injected/index.d.ts +1 -1
  173. package/dist/types/wallets/injected/index.d.ts.map +1 -1
  174. package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
  175. package/package.json +3 -3
  176. package/src/extensions/erc1155/drops/write/claimTo.ts +8 -2
  177. package/src/extensions/erc1155/drops/write/resetClaimEligibility.ts +9 -2
  178. package/src/extensions/erc1155/drops/write/setClaimConditions.ts +6 -2
  179. package/src/extensions/erc1155/drops/write/updateMetadata.ts +6 -2
  180. package/src/extensions/erc1155/write/lazyMint.ts +7 -3
  181. package/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts +7 -3
  182. package/src/extensions/erc1155/write/updateTokenURI.ts +7 -3
  183. package/src/extensions/erc20/drops/write/claimTo.ts +8 -2
  184. package/src/extensions/erc20/drops/write/resetClaimEligibility.ts +8 -2
  185. package/src/extensions/erc20/drops/write/setClaimConditions.ts +6 -2
  186. package/src/extensions/erc20/write/approve.ts +15 -9
  187. package/src/extensions/erc20/write/deposit.ts +8 -3
  188. package/src/extensions/erc20/write/transferBatch.ts +19 -13
  189. package/src/extensions/erc721/drops/write/claimTo.ts +8 -2
  190. package/src/extensions/erc721/drops/write/resetClaimEligibility.ts +8 -2
  191. package/src/extensions/erc721/drops/write/setClaimConditions.ts +6 -2
  192. package/src/extensions/erc721/drops/write/updateMetadata.ts +6 -2
  193. package/src/extensions/erc721/read/getNFT.test.ts +1 -1
  194. package/src/extensions/erc721/write/lazyMint.ts +7 -3
  195. package/src/extensions/erc721/write/setSharedMetadata.ts +7 -3
  196. package/src/extensions/erc721/write/updateTokenURI.ts +7 -3
  197. package/src/extensions/erc7702/account/createSessionKey.ts +6 -2
  198. package/src/react/core/hooks/transaction/useSendTransaction.ts +5 -0
  199. package/src/version.ts +1 -1
  200. package/src/wallets/create-wallet.ts +2 -0
  201. package/src/wallets/in-app/core/authentication/siwe.ts +5 -5
  202. package/src/wallets/in-app/core/eip7702/minimal-account.ts +38 -25
  203. package/src/wallets/in-app/native/native-connector.ts +0 -1
  204. package/src/wallets/in-app/web/lib/web-connector.test.ts +0 -1
  205. package/src/wallets/in-app/web/lib/web-connector.ts +0 -1
  206. package/src/wallets/injected/index.ts +25 -6
  207. package/src/wallets/wallet-connect/controller.ts +117 -14
@@ -1,4 +1,7 @@
1
- import type { BaseTransactionOptions } from "../../../../transaction/types.js";
1
+ import type {
2
+ BaseTransactionOptions,
3
+ WithOverrides,
4
+ } from "../../../../transaction/types.js";
2
5
  import type { NFT, NFTInput } from "../../../../utils/nft/parseNft.js";
3
6
  import * as BatchBaseURI from "../../__generated__/DropERC721/write/updateBatchBaseURI.js";
4
7
  import * as BaseURICount from "../../__generated__/IBatchMintMetadata/read/getBaseURICount.js";
@@ -128,12 +131,13 @@ async function getUpdateMetadataParams(
128
131
  * ```
129
132
  */
130
133
  export function updateMetadata(
131
- options: BaseTransactionOptions<UpdateMetadataParams>,
134
+ options: BaseTransactionOptions<WithOverrides<UpdateMetadataParams>>,
132
135
  ) {
133
136
  const { contract } = options;
134
137
  return BatchBaseURI.updateBatchBaseURI({
135
138
  asyncParams: async () => getUpdateMetadataParams(options),
136
139
  contract,
140
+ overrides: options.overrides,
137
141
  });
138
142
  }
139
143
 
@@ -93,7 +93,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFT", () => {
93
93
  "name": "Doodle #1",
94
94
  "uri": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
95
95
  },
96
- "owner": "0x620b70123fB810F6C653DA7644b5dD0b6312e4D8",
96
+ "owner": null,
97
97
  "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
98
98
  "tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
99
99
  "type": "ERC721",
@@ -1,4 +1,7 @@
1
- import type { BaseTransactionOptions } from "../../../transaction/types.js";
1
+ import type {
2
+ BaseTransactionOptions,
3
+ WithOverrides,
4
+ } from "../../../transaction/types.js";
2
5
  import {
3
6
  getBaseUriFromBatch,
4
7
  uploadOrExtractURIs,
@@ -13,9 +16,9 @@ import * as LazyMint from "../__generated__/ILazyMint/write/lazyMint.js";
13
16
  /**
14
17
  * @extension ERC721
15
18
  */
16
- export type LazyMintParams = {
19
+ export type LazyMintParams = WithOverrides<{
17
20
  nfts: (NFTInput | string)[];
18
- };
21
+ }>;
19
22
 
20
23
  /**
21
24
  * Lazily mints ERC721 tokens.
@@ -66,6 +69,7 @@ export function lazyMint(options: BaseTransactionOptions<LazyMintParams>) {
66
69
  } as const;
67
70
  },
68
71
  contract: options.contract,
72
+ overrides: options.overrides,
69
73
  });
70
74
  }
71
75
 
@@ -1,4 +1,7 @@
1
- import type { BaseTransactionOptions } from "../../../transaction/types.js";
1
+ import type {
2
+ BaseTransactionOptions,
3
+ WithOverrides,
4
+ } from "../../../transaction/types.js";
2
5
  import type { NFTInput } from "../../../utils/nft/parseNft.js";
3
6
  import { setSharedMetadata as generatedSharedMetadata } from "../__generated__/ISharedMetadata/write/setSharedMetadata.js";
4
7
 
@@ -7,9 +10,9 @@ export { isSetSharedMetadataSupported } from "../__generated__/ISharedMetadata/w
7
10
  /**
8
11
  * @extension ERC721
9
12
  */
10
- export type SetSharedMetadataParams = {
13
+ export type SetSharedMetadataParams = WithOverrides<{
11
14
  nft: NFTInput;
12
- };
15
+ }>;
13
16
 
14
17
  /**
15
18
  * Sets the shared metadata for a OpenEdition contract.
@@ -69,6 +72,7 @@ export function setSharedMetadata(
69
72
  };
70
73
  },
71
74
  contract: options.contract,
75
+ overrides: options.overrides,
72
76
  });
73
77
  }
74
78
 
@@ -1,5 +1,8 @@
1
1
  import { upload } from "../../../storage/upload.js";
2
- import type { BaseTransactionOptions } from "../../../transaction/types.js";
2
+ import type {
3
+ BaseTransactionOptions,
4
+ WithOverrides,
5
+ } from "../../../transaction/types.js";
3
6
  import type { NFTInput } from "../../../utils/nft/parseNft.js";
4
7
  import {
5
8
  type SetTokenURIParams,
@@ -11,10 +14,10 @@ export { isSetTokenURISupported as isUpdateTokenURISupported } from "../../erc72
11
14
  /**
12
15
  * @extension ERC721
13
16
  */
14
- export type UpdateTokenURIParams = {
17
+ export type UpdateTokenURIParams = WithOverrides<{
15
18
  tokenId: bigint;
16
19
  newMetadata: NFTInput;
17
- };
20
+ }>;
18
21
 
19
22
  /**
20
23
  * This function is an abstracted layer of the [`setTokenURI` extension](https://portal.thirdweb.com/references/typescript/v5/erc721/setTokenURI),
@@ -48,6 +51,7 @@ export function updateTokenURI(
48
51
  return setTokenURI({
49
52
  asyncParams: async () => getUpdateTokenParams(options),
50
53
  contract,
54
+ overrides: options.overrides,
51
55
  });
52
56
  }
53
57
 
@@ -1,4 +1,7 @@
1
- import type { BaseTransactionOptions } from "../../../transaction/types.js";
1
+ import type {
2
+ BaseTransactionOptions,
3
+ WithOverrides,
4
+ } from "../../../transaction/types.js";
2
5
  import { randomBytesHex } from "../../../utils/random.js";
3
6
  import type { Account } from "../../../wallets/interfaces/wallet.js";
4
7
  import {
@@ -68,7 +71,7 @@ export type CreateSessionKeyOptions = {
68
71
  * @extension ERC7702
69
72
  */
70
73
  export function createSessionKey(
71
- options: BaseTransactionOptions<CreateSessionKeyOptions>,
74
+ options: BaseTransactionOptions<WithOverrides<CreateSessionKeyOptions>>,
72
75
  ) {
73
76
  const {
74
77
  contract,
@@ -161,6 +164,7 @@ export function createSessionKey(
161
164
  return { sessionSpec: req, signature };
162
165
  },
163
166
  contract,
167
+ overrides: options.overrides,
164
168
  });
165
169
  }
166
170
 
@@ -154,6 +154,11 @@ export function useSendTransactionCore(args: {
154
154
  await switchChain(tx.chain);
155
155
  // in smart wallet case, account may change after chain switch
156
156
  _account = wallet.getAccount();
157
+
158
+ // ensure that the account has switched to the correct chain
159
+ if (wallet.getChain()?.id !== tx.chain.id) {
160
+ throw new Error(`Could not switch to chain ${tx.chain.id}`);
161
+ }
157
162
  }
158
163
 
159
164
  const account = _account;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.105.45-nightly-dc1f7ab2ee820be512776a413f7de362ff6b98ef-20250912000326";
1
+ export const version = "5.105.46";
@@ -483,6 +483,8 @@ export function createWallet<const ID extends WalletId>(
483
483
  id,
484
484
  subscribe: emitter.subscribe,
485
485
  switchChain: async (c) => {
486
+ // TODO: this should actually throw an error if the chain switch fails
487
+ // but our useSwitchActiveWalletChain hook currently doesn't handle this
486
488
  try {
487
489
  await handleSwitchChain(c);
488
490
  chain = c;
@@ -1,6 +1,6 @@
1
1
  import { signLoginPayload } from "../../../../auth/core/sign-login-payload.js";
2
2
  import type { LoginPayload } from "../../../../auth/core/types.js";
3
- import type { Chain } from "../../../../chains/types.js";
3
+ import { getCachedChain } from "../../../../chains/utils.js";
4
4
  import type { ThirdwebClient } from "../../../../client/client.js";
5
5
  import { getClientFetch } from "../../../../utils/fetch.js";
6
6
  import { stringify } from "../../../../utils/json.js";
@@ -14,14 +14,14 @@ import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
14
14
  */
15
15
  export async function siweAuthenticate(args: {
16
16
  wallet: Wallet;
17
- chain: Chain;
18
17
  client: ThirdwebClient;
19
18
  ecosystem?: Ecosystem;
20
19
  }): Promise<AuthStoredTokenWithCookieReturnType> {
21
- const { wallet, chain, client, ecosystem } = args;
20
+ const { wallet, client, ecosystem } = args;
21
+ const siweChain = getCachedChain(1); // always use mainnet for SIWE for wide wallet compatibility
22
22
  // only connect if the wallet doesn't already have an account
23
23
  const account =
24
- wallet.getAccount() || (await wallet.connect({ chain, client }));
24
+ wallet.getAccount() || (await wallet.connect({ chain: siweChain, client }));
25
25
  const clientFetch = getClientFetch(client, ecosystem);
26
26
 
27
27
  const payload = await (async () => {
@@ -31,7 +31,7 @@ export async function siweAuthenticate(args: {
31
31
  ecosystem: args.ecosystem,
32
32
  });
33
33
  const res = await clientFetch(
34
- `${path}&address=${account.address}&chainId=${chain.id}`,
34
+ `${path}&address=${account.address}&chainId=${siweChain.id}`,
35
35
  );
36
36
 
37
37
  if (!res.ok) throw new Error("Failed to generate SIWE login payload");
@@ -180,36 +180,49 @@ export const create7702MinimalAccount = (args: {
180
180
  abi: MinimalAccountAbi,
181
181
  });
182
182
  // check if account has been delegated already
183
- let authorization: SignedAuthorization | undefined;
183
+ let authorization: SignedAuthorization | undefined =
184
+ firstTx.authorizationList?.[0];
184
185
  const delegationContractAddress = await getDelegationContractAddress({
185
186
  client,
186
187
  chain,
187
188
  });
188
- const isMinimalAccount = await is7702MinimalAccount(
189
- eoaContract,
190
- delegationContractAddress,
191
- );
192
- if (!isMinimalAccount) {
193
- // if not, sign authorization
194
- let nonce = firstTx.nonce
195
- ? BigInt(firstTx.nonce)
196
- : BigInt(
197
- await getNonce({
198
- client,
199
- address: adminAccount.address,
200
- chain,
201
- }),
202
- );
203
- nonce += sponsorGas ? 0n : 1n;
204
- const auth = await adminAccount.signAuthorization?.({
205
- address: getAddress(delegationContractAddress),
206
- chainId: firstTx.chainId,
207
- nonce,
208
- });
209
- if (!auth) {
210
- throw new Error("Failed to sign authorization");
189
+ if (
190
+ authorization &&
191
+ authorization.address?.toLowerCase() !==
192
+ delegationContractAddress.toLowerCase()
193
+ ) {
194
+ throw new Error(
195
+ `Authorization address does not match expected delegation contract address. Expected ${delegationContractAddress} but got ${authorization.address}`,
196
+ );
197
+ }
198
+ // if the tx already has an authorization, use it, otherwise sign one
199
+ if (!authorization) {
200
+ const isMinimalAccount = await is7702MinimalAccount(
201
+ eoaContract,
202
+ delegationContractAddress,
203
+ );
204
+ if (!isMinimalAccount) {
205
+ // if not, sign authorization
206
+ let nonce = firstTx.nonce
207
+ ? BigInt(firstTx.nonce)
208
+ : BigInt(
209
+ await getNonce({
210
+ client,
211
+ address: adminAccount.address,
212
+ chain,
213
+ }),
214
+ );
215
+ nonce += sponsorGas ? 0n : 1n;
216
+ const auth = await adminAccount.signAuthorization?.({
217
+ address: getAddress(delegationContractAddress),
218
+ chainId: firstTx.chainId,
219
+ nonce,
220
+ });
221
+ if (!auth) {
222
+ throw new Error("Failed to sign authorization");
223
+ }
224
+ authorization = auth;
211
225
  }
212
- authorization = auth;
213
226
  }
214
227
  if (sponsorGas) {
215
228
  // send transaction from executor, needs signature
@@ -183,7 +183,6 @@ export class InAppNativeConnector implements InAppConnector {
183
183
  "../core/authentication/siwe.js"
184
184
  );
185
185
  return siweAuthenticate({
186
- chain: params.chain,
187
186
  client: this.client,
188
187
  ecosystem: params.ecosystem,
189
188
  wallet: params.wallet,
@@ -104,7 +104,6 @@ describe("InAppWebConnector.connect", () => {
104
104
  });
105
105
 
106
106
  expect(siweAuthenticate).toHaveBeenCalledWith({
107
- chain: ethereum,
108
107
  client: TEST_CLIENT,
109
108
  ecosystem: undefined,
110
109
  wallet: mockWallet,
@@ -365,7 +365,6 @@ export class InAppWebConnector implements InAppConnector {
365
365
  }
366
366
  case "wallet": {
367
367
  return siweAuthenticate({
368
- chain: args.chain,
369
368
  client: this.client,
370
369
  ecosystem: this.ecosystem,
371
370
  wallet: args.wallet,
@@ -1,6 +1,7 @@
1
1
  import * as ox__Authorization from "ox/Authorization";
2
- import type { EIP1193Provider } from "viem";
2
+ import * as ox__Signature from "ox/Signature";
3
3
  import {
4
+ type EIP1193Provider,
4
5
  getTypesForEIP712Domain,
5
6
  type SignTypedDataParameters,
6
7
  serializeTypedData,
@@ -188,7 +189,7 @@ function createAccount({
188
189
  async sendTransaction(tx: SendTransactionOption) {
189
190
  const gasFees = tx.gasPrice
190
191
  ? {
191
- gasPrice: tx.gasPrice ? numberToHex(tx.gasPrice) : undefined,
192
+ gasPrice: numberToHex(tx.gasPrice),
192
193
  }
193
194
  : {
194
195
  maxFeePerGas: tx.maxFeePerGas
@@ -201,6 +202,9 @@ function createAccount({
201
202
  const params = [
202
203
  {
203
204
  ...tx,
205
+ authorizationList: tx.authorizationList
206
+ ? ox__Authorization.toRpcList(tx.authorizationList)
207
+ : undefined,
204
208
  ...gasFees,
205
209
  from: this.address,
206
210
  gas: tx.gas ? numberToHex(tx.gas) : undefined,
@@ -269,10 +273,25 @@ function createAccount({
269
273
  },
270
274
  async signAuthorization(authorization: AuthorizationRequest) {
271
275
  const payload = ox__Authorization.getSignPayload(authorization);
272
- return await provider.request({
273
- method: "eth_sign",
274
- params: [getAddress(account.address), payload],
275
- });
276
+ let signature: Hex | undefined;
277
+ try {
278
+ signature = await provider.request({
279
+ method: "eth_sign",
280
+ params: [getAddress(account.address), payload],
281
+ });
282
+ } catch {
283
+ // fallback to secp256k1_sign, some providers don't support eth_sign
284
+ signature = await provider.request({
285
+ // @ts-expect-error - overriding types here
286
+ method: "secp256k1_sign",
287
+ params: [payload],
288
+ });
289
+ }
290
+ if (!signature) {
291
+ throw new Error("Failed to sign authorization");
292
+ }
293
+ const parsedSignature = ox__Signature.fromHex(signature as Hex);
294
+ return { ...authorization, ...parsedSignature };
276
295
  },
277
296
  async signTypedData(typedData) {
278
297
  if (!provider || !account.address) {
@@ -132,7 +132,7 @@ export async function connectWC(
132
132
  ...(wcOptions?.pairingTopic
133
133
  ? { pairingTopic: wcOptions?.pairingTopic }
134
134
  : {}),
135
- namespaces: {
135
+ optionalNamespaces: {
136
136
  [NAMESPACE]: {
137
137
  chains: chainsToRequest,
138
138
  events: ["chainChanged", "accountsChanged"],
@@ -157,14 +157,8 @@ export async function connectWC(
157
157
  );
158
158
  const currentChainId = chainsToRequest[0]?.split(":")[1] || 1;
159
159
  const providerChainId = normalizeChainId(currentChainId);
160
- const accounts: string[] = await provider.request(
161
- {
162
- method: "eth_requestAccounts",
163
- params: [],
164
- },
165
- `eip155:${providerChainId}`,
166
- );
167
- const address = accounts[0];
160
+ const account = firstAccountOn(provider.session, `eip155:1`); // grab the address from mainnet
161
+ const address = account;
168
162
  if (!address) {
169
163
  throw new Error("No accounts found on provider.");
170
164
  }
@@ -202,6 +196,109 @@ export async function connectWC(
202
196
  );
203
197
  }
204
198
 
199
+ async function ensureTargetChain(
200
+ provider: Awaited<ReturnType<typeof initProvider>>,
201
+ chain: Chain,
202
+ walletInfo: WalletInfo,
203
+ ) {
204
+ if (!provider.session) {
205
+ throw new Error("No session found on provider.");
206
+ }
207
+ const TARGET_CAIP = `eip155:${chain.id}`;
208
+ const TARGET_HEX = numberToHex(chain.id);
209
+
210
+ // Fast path: already enabled
211
+ if (hasChainEnabled(provider.session, TARGET_CAIP)) {
212
+ provider.setDefaultChain(TARGET_CAIP);
213
+ return;
214
+ }
215
+
216
+ // 1) Try switch
217
+ try {
218
+ await requestAndOpenWallet({
219
+ provider,
220
+ payload: {
221
+ method: "wallet_switchEthereumChain",
222
+ params: [{ chainId: TARGET_HEX }],
223
+ },
224
+ chain: TARGET_CAIP, // route to target
225
+ walletInfo,
226
+ });
227
+ provider.setDefaultChain(TARGET_CAIP);
228
+ return;
229
+ } catch (err: any) {
230
+ const code = err?.code ?? err?.data?.originalError?.code;
231
+ // 4001 user rejected; stop
232
+ if (code === 4001) throw new Error("User rejected chain switch");
233
+ // fall through on 4902 or unknown -> try add
234
+ }
235
+
236
+ // 2) Add the chain via any chain we already have
237
+ const routeChain = anyRoutableChain(provider.session);
238
+ if (!routeChain)
239
+ throw new Error("No routable chain to send wallet_addEthereumChain");
240
+
241
+ try {
242
+ await requestAndOpenWallet({
243
+ provider,
244
+ payload: {
245
+ method: "wallet_addEthereumChain",
246
+ params: [
247
+ {
248
+ chainId: TARGET_HEX,
249
+ chainName: chain.name,
250
+ nativeCurrency: chain.nativeCurrency,
251
+ rpcUrls: [chain.rpc],
252
+ blockExplorerUrls: [chain.blockExplorers?.[0]?.url ?? ""],
253
+ },
254
+ ],
255
+ },
256
+ chain: routeChain, // route via known-good chain, not the target
257
+ walletInfo,
258
+ });
259
+ } catch (err: any) {
260
+ const code = err?.code ?? err?.data?.originalError?.code;
261
+ if (code === 4001) throw new Error("User rejected add chain");
262
+ throw new Error(`Add chain failed: ${err?.message || String(err)}`);
263
+ }
264
+
265
+ // 3) Re-try switch after add
266
+ await requestAndOpenWallet({
267
+ provider,
268
+ payload: {
269
+ method: "wallet_switchEthereumChain",
270
+ params: [{ chainId: TARGET_HEX }],
271
+ },
272
+ chain: TARGET_CAIP,
273
+ walletInfo,
274
+ });
275
+ provider.setDefaultChain(TARGET_CAIP);
276
+
277
+ // 4) Verify enablement
278
+ if (!hasChainEnabled(provider.session, TARGET_CAIP)) {
279
+ throw new Error("Target chain still not enabled by wallet");
280
+ }
281
+ }
282
+
283
+ type WCSession = Awaited<ReturnType<typeof UniversalProvider.init>>["session"];
284
+
285
+ function getNS(session: WCSession) {
286
+ return session?.namespaces?.eip155;
287
+ }
288
+ function hasChainEnabled(session: WCSession, caip: string) {
289
+ const ns = getNS(session);
290
+ return !!ns?.accounts?.some((a) => a.startsWith(`${caip}:`));
291
+ }
292
+ function firstAccountOn(session: WCSession, caip: string): string | null {
293
+ const ns = getNS(session);
294
+ const hit = ns?.accounts?.find((a) => a.startsWith(`${caip}:`));
295
+ return hit ? (hit.split(":")[2] ?? null) : null;
296
+ }
297
+ function anyRoutableChain(session: WCSession): string | null {
298
+ const ns = getNS(session);
299
+ return ns?.accounts?.[0]?.split(":")?.slice(0, 2)?.join(":") ?? null; // e.g. "eip155:1"
300
+ }
301
+
205
302
  /**
206
303
  * Auto connect to already connected wallet connect session.
207
304
  * @internal
@@ -545,14 +642,17 @@ function onConnect(
545
642
  account,
546
643
  chain,
547
644
  disconnect,
548
- (newChain) => switchChainWC(provider, newChain),
645
+ (newChain) => switchChainWC(provider, newChain, walletInfo),
549
646
  ];
550
647
  }
551
648
 
552
- async function switchChainWC(provider: WCProvider, chain: Chain) {
553
- const chainId = chain.id;
649
+ async function switchChainWC(
650
+ provider: WCProvider,
651
+ chain: Chain,
652
+ walletInfo: WalletInfo,
653
+ ) {
554
654
  try {
555
- provider.setDefaultChain(`eip155:${chainId}`);
655
+ await ensureTargetChain(provider, chain, walletInfo);
556
656
  } catch (error) {
557
657
  const message =
558
658
  typeof error === "string" ? error : (error as ProviderRpcError)?.message;
@@ -605,7 +705,10 @@ function getChainsToRequest(options: {
605
705
  chainIds.push(chain.id);
606
706
  }
607
707
 
608
- if (!options.chain && optionalChains.length === 0) {
708
+ // always include mainnet
709
+ // many wallets only support a handful of chains, but mainnet is always supported
710
+ // we will add additional chains in switchChain if needed
711
+ if (!chainIds.includes(1)) {
609
712
  rpcMap[1] = getCachedChain(1).rpc;
610
713
  chainIds.push(1);
611
714
  }