thirdweb 5.64.6-nightly-f40d2474e6cc1227a8d05151210ef4793beb6142-20241101000357 → 5.65.0-nightly-06604162a11d99ff119bbf427a24b9a7d82c1575-20241103000408

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 (258) hide show
  1. package/dist/cjs/analytics/track/index.js +2 -2
  2. package/dist/cjs/analytics/track/index.js.map +1 -1
  3. package/dist/cjs/auth/core/verify-jwt.js +2 -1
  4. package/dist/cjs/auth/core/verify-jwt.js.map +1 -1
  5. package/dist/cjs/extensions/erc721/drops/write/claimToBatch.js +8 -7
  6. package/dist/cjs/extensions/erc721/drops/write/claimToBatch.js.map +1 -1
  7. package/dist/cjs/pay/buyWithCrypto/getQuote.js +2 -1
  8. package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
  9. package/dist/cjs/pay/buyWithCrypto/getTransfer.js +2 -1
  10. package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
  11. package/dist/cjs/pay/buyWithFiat/getQuote.js +2 -1
  12. package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
  13. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +14 -0
  14. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +5 -4
  16. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js +29 -11
  18. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
  19. package/dist/cjs/rpc/rpc.js +2 -1
  20. package/dist/cjs/rpc/rpc.js.map +1 -1
  21. package/dist/cjs/utils/domains.js +3 -0
  22. package/dist/cjs/utils/domains.js.map +1 -1
  23. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc1155.js +3 -2
  24. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc1155.js.map +1 -1
  25. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc20.js +3 -2
  26. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc20.js.map +1 -1
  27. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc721.js +3 -2
  28. package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc721.js.map +1 -1
  29. package/dist/cjs/utils/extensions/drops/process-override-list.js +3 -2
  30. package/dist/cjs/utils/extensions/drops/process-override-list.js.map +1 -1
  31. package/dist/cjs/utils/jwt/encode-jwt.js +5 -2
  32. package/dist/cjs/utils/jwt/encode-jwt.js.map +1 -1
  33. package/dist/cjs/utils/storage/walletStorage.js +4 -3
  34. package/dist/cjs/utils/storage/walletStorage.js.map +1 -1
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/wallets/coinbase/coinbaseWebSDK.js +1 -0
  37. package/dist/cjs/wallets/coinbase/coinbaseWebSDK.js.map +1 -1
  38. package/dist/cjs/wallets/in-app/core/authentication/authEndpoint.js +2 -1
  39. package/dist/cjs/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
  40. package/dist/cjs/wallets/in-app/core/authentication/guest.js +2 -1
  41. package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
  42. package/dist/cjs/wallets/in-app/core/authentication/jwt.js +2 -1
  43. package/dist/cjs/wallets/in-app/core/authentication/jwt.js.map +1 -1
  44. package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js +2 -1
  45. package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
  46. package/dist/cjs/wallets/in-app/core/authentication/passkeys.js +3 -2
  47. package/dist/cjs/wallets/in-app/core/authentication/passkeys.js.map +1 -1
  48. package/dist/cjs/wallets/in-app/core/authentication/siwe.js +2 -1
  49. package/dist/cjs/wallets/in-app/core/authentication/siwe.js.map +1 -1
  50. package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +1 -0
  51. package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
  52. package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js +2 -1
  53. package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
  54. package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +5 -4
  55. package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
  56. package/dist/cjs/wallets/in-app/native/helpers/errors.js +2 -1
  57. package/dist/cjs/wallets/in-app/native/helpers/errors.js.map +1 -1
  58. package/dist/cjs/wallets/in-app/native/helpers/storage/local.js +2 -1
  59. package/dist/cjs/wallets/in-app/native/helpers/storage/local.js.map +1 -1
  60. package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js +4 -3
  61. package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js.map +1 -1
  62. package/dist/cjs/wallets/in-app/native/helpers/wallet/recoveryCode.js +5 -4
  63. package/dist/cjs/wallets/in-app/native/helpers/wallet/recoveryCode.js.map +1 -1
  64. package/dist/cjs/wallets/in-app/web/lib/auth/otp.js +3 -2
  65. package/dist/cjs/wallets/in-app/web/lib/auth/otp.js.map +1 -1
  66. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js +1 -0
  67. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  68. package/dist/cjs/wallets/injected/index.js +1 -0
  69. package/dist/cjs/wallets/injected/index.js.map +1 -1
  70. package/dist/cjs/wallets/manager/index.js +4 -3
  71. package/dist/cjs/wallets/manager/index.js.map +1 -1
  72. package/dist/cjs/wallets/smart/lib/bundler.js +1 -1
  73. package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
  74. package/dist/cjs/wallets/smart/lib/paymaster.js +2 -1
  75. package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
  76. package/dist/cjs/wallets/wallet-connect/controller.js +3 -1
  77. package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
  78. package/dist/cjs/wallets/wallet-connect/receiver/session-store.js +3 -2
  79. package/dist/cjs/wallets/wallet-connect/receiver/session-store.js.map +1 -1
  80. package/dist/esm/analytics/track/index.js +2 -2
  81. package/dist/esm/analytics/track/index.js.map +1 -1
  82. package/dist/esm/auth/core/verify-jwt.js +2 -1
  83. package/dist/esm/auth/core/verify-jwt.js.map +1 -1
  84. package/dist/esm/extensions/erc721/drops/write/claimToBatch.js +8 -7
  85. package/dist/esm/extensions/erc721/drops/write/claimToBatch.js.map +1 -1
  86. package/dist/esm/pay/buyWithCrypto/getQuote.js +2 -1
  87. package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
  88. package/dist/esm/pay/buyWithCrypto/getTransfer.js +2 -1
  89. package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
  90. package/dist/esm/pay/buyWithFiat/getQuote.js +2 -1
  91. package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
  92. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +14 -0
  93. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  94. package/dist/esm/react/web/ui/ConnectWallet/Details.js +5 -4
  95. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js +30 -12
  97. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
  98. package/dist/esm/rpc/rpc.js +2 -1
  99. package/dist/esm/rpc/rpc.js.map +1 -1
  100. package/dist/esm/utils/domains.js +3 -0
  101. package/dist/esm/utils/domains.js.map +1 -1
  102. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc1155.js +3 -2
  103. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc1155.js.map +1 -1
  104. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc20.js +3 -2
  105. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc20.js.map +1 -1
  106. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc721.js +3 -2
  107. package/dist/esm/utils/extensions/airdrop/process-snapshot-erc721.js.map +1 -1
  108. package/dist/esm/utils/extensions/drops/process-override-list.js +3 -2
  109. package/dist/esm/utils/extensions/drops/process-override-list.js.map +1 -1
  110. package/dist/esm/utils/jwt/encode-jwt.js +5 -2
  111. package/dist/esm/utils/jwt/encode-jwt.js.map +1 -1
  112. package/dist/esm/utils/storage/walletStorage.js +4 -3
  113. package/dist/esm/utils/storage/walletStorage.js.map +1 -1
  114. package/dist/esm/version.js +1 -1
  115. package/dist/esm/wallets/coinbase/coinbaseWebSDK.js +1 -0
  116. package/dist/esm/wallets/coinbase/coinbaseWebSDK.js.map +1 -1
  117. package/dist/esm/wallets/in-app/core/authentication/authEndpoint.js +2 -1
  118. package/dist/esm/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
  119. package/dist/esm/wallets/in-app/core/authentication/guest.js +2 -1
  120. package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
  121. package/dist/esm/wallets/in-app/core/authentication/jwt.js +2 -1
  122. package/dist/esm/wallets/in-app/core/authentication/jwt.js.map +1 -1
  123. package/dist/esm/wallets/in-app/core/authentication/linkAccount.js +2 -1
  124. package/dist/esm/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
  125. package/dist/esm/wallets/in-app/core/authentication/passkeys.js +3 -2
  126. package/dist/esm/wallets/in-app/core/authentication/passkeys.js.map +1 -1
  127. package/dist/esm/wallets/in-app/core/authentication/siwe.js +2 -1
  128. package/dist/esm/wallets/in-app/core/authentication/siwe.js.map +1 -1
  129. package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +1 -0
  130. package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
  131. package/dist/esm/wallets/in-app/core/wallet/in-app-core.js +2 -1
  132. package/dist/esm/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
  133. package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +5 -4
  134. package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
  135. package/dist/esm/wallets/in-app/native/helpers/errors.js +2 -1
  136. package/dist/esm/wallets/in-app/native/helpers/errors.js.map +1 -1
  137. package/dist/esm/wallets/in-app/native/helpers/storage/local.js +2 -1
  138. package/dist/esm/wallets/in-app/native/helpers/storage/local.js.map +1 -1
  139. package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js +4 -3
  140. package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js.map +1 -1
  141. package/dist/esm/wallets/in-app/native/helpers/wallet/recoveryCode.js +5 -4
  142. package/dist/esm/wallets/in-app/native/helpers/wallet/recoveryCode.js.map +1 -1
  143. package/dist/esm/wallets/in-app/web/lib/auth/otp.js +3 -2
  144. package/dist/esm/wallets/in-app/web/lib/auth/otp.js.map +1 -1
  145. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js +1 -0
  146. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  147. package/dist/esm/wallets/injected/index.js +1 -0
  148. package/dist/esm/wallets/injected/index.js.map +1 -1
  149. package/dist/esm/wallets/manager/index.js +4 -3
  150. package/dist/esm/wallets/manager/index.js.map +1 -1
  151. package/dist/esm/wallets/smart/lib/bundler.js +1 -1
  152. package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
  153. package/dist/esm/wallets/smart/lib/paymaster.js +2 -1
  154. package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
  155. package/dist/esm/wallets/wallet-connect/controller.js +3 -1
  156. package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
  157. package/dist/esm/wallets/wallet-connect/receiver/session-store.js +3 -2
  158. package/dist/esm/wallets/wallet-connect/receiver/session-store.js.map +1 -1
  159. package/dist/types/analytics/track/index.d.ts.map +1 -1
  160. package/dist/types/auth/core/verify-jwt.d.ts.map +1 -1
  161. package/dist/types/extensions/erc721/drops/write/claimToBatch.d.ts.map +1 -1
  162. package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
  163. package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
  164. package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
  165. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +7 -0
  166. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  167. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +14 -0
  168. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
  169. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +7 -0
  170. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  171. package/dist/types/react/web/ui/ConnectWallet/screens/ViewAssets.d.ts +5 -0
  172. package/dist/types/react/web/ui/ConnectWallet/screens/ViewAssets.d.ts.map +1 -1
  173. package/dist/types/rpc/rpc.d.ts.map +1 -1
  174. package/dist/types/utils/domains.d.ts +6 -0
  175. package/dist/types/utils/domains.d.ts.map +1 -1
  176. package/dist/types/utils/extensions/airdrop/process-snapshot-erc1155.d.ts.map +1 -1
  177. package/dist/types/utils/extensions/airdrop/process-snapshot-erc20.d.ts.map +1 -1
  178. package/dist/types/utils/extensions/airdrop/process-snapshot-erc721.d.ts.map +1 -1
  179. package/dist/types/utils/extensions/drops/process-override-list.d.ts.map +1 -1
  180. package/dist/types/utils/jwt/encode-jwt.d.ts.map +1 -1
  181. package/dist/types/utils/storage/walletStorage.d.ts.map +1 -1
  182. package/dist/types/version.d.ts +1 -1
  183. package/dist/types/wallets/coinbase/coinbaseWebSDK.d.ts.map +1 -1
  184. package/dist/types/wallets/in-app/core/authentication/authEndpoint.d.ts.map +1 -1
  185. package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -1
  186. package/dist/types/wallets/in-app/core/authentication/jwt.d.ts.map +1 -1
  187. package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts.map +1 -1
  188. package/dist/types/wallets/in-app/core/authentication/passkeys.d.ts.map +1 -1
  189. package/dist/types/wallets/in-app/core/authentication/siwe.d.ts.map +1 -1
  190. package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts.map +1 -1
  191. package/dist/types/wallets/in-app/core/wallet/in-app-core.d.ts.map +1 -1
  192. package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
  193. package/dist/types/wallets/in-app/native/helpers/errors.d.ts.map +1 -1
  194. package/dist/types/wallets/in-app/native/helpers/storage/local.d.ts.map +1 -1
  195. package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts.map +1 -1
  196. package/dist/types/wallets/in-app/native/helpers/wallet/recoveryCode.d.ts.map +1 -1
  197. package/dist/types/wallets/in-app/web/lib/auth/otp.d.ts.map +1 -1
  198. package/dist/types/wallets/in-app/web/lib/iframe-wallet.d.ts.map +1 -1
  199. package/dist/types/wallets/injected/index.d.ts.map +1 -1
  200. package/dist/types/wallets/manager/index.d.ts.map +1 -1
  201. package/dist/types/wallets/smart/lib/paymaster.d.ts.map +1 -1
  202. package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
  203. package/dist/types/wallets/wallet-connect/receiver/session-store.d.ts.map +1 -1
  204. package/package.json +1 -1
  205. package/src/analytics/track/index.ts +2 -3
  206. package/src/auth/core/verify-jwt.ts +2 -1
  207. package/src/extensions/erc1155/drop1155.test.ts +12 -1
  208. package/src/extensions/erc1155/token1155.test.ts +12 -1
  209. package/src/extensions/erc1155/write/mintAdditionalSupplyToBatch.test.ts +0 -1
  210. package/src/extensions/erc20/drop20.test.ts +11 -2
  211. package/src/extensions/erc721/drop721.test.ts +10 -7
  212. package/src/extensions/erc721/drops/write/claimToBatch.ts +10 -11
  213. package/src/extensions/erc721/read/getNFT.test.ts +0 -67
  214. package/src/extensions/erc721/read/getNFTs.test.ts +0 -32
  215. package/src/extensions/erc721/token721.test.ts +115 -0
  216. package/src/extensions/prebuilts/deploy-erc721.test.ts +0 -42
  217. package/src/pay/buyWithCrypto/getQuote.ts +2 -1
  218. package/src/pay/buyWithCrypto/getTransfer.ts +2 -1
  219. package/src/pay/buyWithFiat/getQuote.ts +2 -1
  220. package/src/react/core/hooks/connection/ConnectButtonProps.ts +8 -0
  221. package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +14 -0
  222. package/src/react/web/ui/ConnectWallet/Details.tsx +30 -16
  223. package/src/react/web/ui/ConnectWallet/screens/ViewAssets.tsx +46 -24
  224. package/src/rpc/rpc.ts +2 -1
  225. package/src/utils/domains.ts +8 -0
  226. package/src/utils/extensions/airdrop/process-snapshot-erc1155.ts +3 -2
  227. package/src/utils/extensions/airdrop/process-snapshot-erc20.ts +3 -2
  228. package/src/utils/extensions/airdrop/process-snapshot-erc721.ts +3 -2
  229. package/src/utils/extensions/drops/process-override-list.ts +3 -2
  230. package/src/utils/jwt/encode-jwt.ts +5 -5
  231. package/src/utils/nft/fetch-token-metadata.test.ts +2 -1
  232. package/src/utils/storage/walletStorage.ts +4 -3
  233. package/src/version.ts +1 -1
  234. package/src/wallets/coinbase/coinbaseWebSDK.ts +1 -0
  235. package/src/wallets/in-app/core/authentication/authEndpoint.ts +2 -1
  236. package/src/wallets/in-app/core/authentication/guest.ts +2 -1
  237. package/src/wallets/in-app/core/authentication/jwt.ts +2 -1
  238. package/src/wallets/in-app/core/authentication/linkAccount.ts +2 -1
  239. package/src/wallets/in-app/core/authentication/passkeys.ts +3 -2
  240. package/src/wallets/in-app/core/authentication/siwe.ts +2 -1
  241. package/src/wallets/in-app/core/wallet/enclave-wallet.ts +1 -0
  242. package/src/wallets/in-app/core/wallet/in-app-core.ts +2 -1
  243. package/src/wallets/in-app/native/helpers/api/fetchers.ts +5 -4
  244. package/src/wallets/in-app/native/helpers/errors.ts +3 -1
  245. package/src/wallets/in-app/native/helpers/storage/local.ts +2 -1
  246. package/src/wallets/in-app/native/helpers/wallet/migration.ts +4 -3
  247. package/src/wallets/in-app/native/helpers/wallet/recoveryCode.ts +5 -4
  248. package/src/wallets/in-app/web/lib/auth/otp.ts +3 -2
  249. package/src/wallets/in-app/web/lib/iframe-wallet.ts +1 -0
  250. package/src/wallets/injected/index.ts +1 -0
  251. package/src/wallets/manager/index.ts +4 -3
  252. package/src/wallets/smart/lib/bundler.ts +1 -1
  253. package/src/wallets/smart/lib/paymaster.ts +2 -1
  254. package/src/wallets/wallet-connect/controller.ts +3 -1
  255. package/src/wallets/wallet-connect/receiver/session-store.ts +3 -6
  256. package/src/extensions/erc721/write/mintTo.test.ts +0 -69
  257. package/src/extensions/prebuilts/deploy-erc1155.test.ts +0 -54
  258. package/src/extensions/prebuilts/deploy-erc20.test.ts +0 -56
@@ -109,7 +109,7 @@ import { ManageWalletScreen } from "./screens/ManageWalletScreen.js";
109
109
  import { PrivateKey } from "./screens/PrivateKey.js";
110
110
  import { ReceiveFunds } from "./screens/ReceiveFunds.js";
111
111
  import { SendFunds } from "./screens/SendFunds.js";
112
- import { ViewAssets } from "./screens/ViewAssets.js";
112
+ import { type AssetTabs, ViewAssets } from "./screens/ViewAssets.js";
113
113
  import { ViewNFTs } from "./screens/ViewNFTs.js";
114
114
  import { ViewTokens } from "./screens/ViewTokens.js";
115
115
  import { WalletConnectReceiverScreen } from "./screens/WalletConnectReceiverScreen.js";
@@ -170,6 +170,7 @@ export const ConnectedWalletDetails: React.FC<{
170
170
  chains={props.chains}
171
171
  displayBalanceToken={props.detailsButton?.displayBalanceToken}
172
172
  connectOptions={props.connectOptions}
173
+ assetTabs={props.detailsModal?.assetTabs}
173
174
  />,
174
175
  );
175
176
  }
@@ -284,6 +285,7 @@ function DetailsModal(props: {
284
285
  chains: Chain[];
285
286
  displayBalanceToken?: Record<number, string>;
286
287
  connectOptions: DetailsModalConnectOptions | undefined;
288
+ assetTabs?: AssetTabs[];
287
289
  }) {
288
290
  const [screen, setScreen] = useState<WalletDetailsModalScreen>("main");
289
291
  const { disconnect } = useDisconnect();
@@ -627,21 +629,24 @@ function DetailsModal(props: {
627
629
  </MenuButton>
628
630
 
629
631
  {/* View Funds */}
630
- <MenuButton
631
- onClick={() => {
632
- setScreen("view-assets");
633
- }}
634
- style={{
635
- fontSize: fontSize.sm,
636
- }}
637
- >
638
- <CoinsIcon size={iconSize.md} />
639
- <Text color="primaryText">
640
- {props.supportedNFTs
641
- ? locale.viewFunds.viewAssets
642
- : locale.viewFunds.title}
643
- </Text>
644
- </MenuButton>
632
+ {/* Hide the View Funds button if the assetTabs props is set to an empty array */}
633
+ {(props.assetTabs === undefined || props.assetTabs.length) && (
634
+ <MenuButton
635
+ onClick={() => {
636
+ setScreen("view-assets");
637
+ }}
638
+ style={{
639
+ fontSize: fontSize.sm,
640
+ }}
641
+ >
642
+ <CoinsIcon size={iconSize.md} />
643
+ <Text color="primaryText">
644
+ {props.supportedNFTs
645
+ ? locale.viewFunds.viewAssets
646
+ : locale.viewFunds.title}
647
+ </Text>
648
+ </MenuButton>
649
+ )}
645
650
 
646
651
  {/* Manage Wallet */}
647
652
  <MenuButton
@@ -799,6 +804,7 @@ function DetailsModal(props: {
799
804
  setScreen={setScreen}
800
805
  client={client}
801
806
  connectLocale={locale}
807
+ assetTabs={props.detailsModal?.assetTabs}
802
808
  />
803
809
  );
804
810
  } else {
@@ -1458,6 +1464,13 @@ export type UseWalletDetailsModalOptions = {
1458
1464
  * By default the "Buy Funds" button is shown.
1459
1465
  */
1460
1466
  hideBuyFunds?: boolean;
1467
+
1468
+ /**
1469
+ * When you click on "View Assets", by default the "Tokens" tab is shown first.
1470
+ * If you want to show the "NFTs" tab first, change the order of the asset tabs to: ["nft", "token"]
1471
+ * Note: If an empty array is passed, the [View Funds] button will be hidden
1472
+ */
1473
+ assetTabs?: AssetTabs[];
1461
1474
  };
1462
1475
 
1463
1476
  /**
@@ -1515,6 +1528,7 @@ export function useWalletDetailsModal() {
1515
1528
  hideBuyFunds: props.hideBuyFunds,
1516
1529
  hideReceiveFunds: props.hideReceiveFunds,
1517
1530
  hideSendFunds: props.hideSendFunds,
1531
+ assetTabs: props.assetTabs,
1518
1532
  }}
1519
1533
  displayBalanceToken={props.displayBalanceToken}
1520
1534
  theme={props.theme || "dark"}
@@ -1,4 +1,4 @@
1
- import { useState } from "react";
1
+ import { useMemo, useState } from "react";
2
2
  import type { ThirdwebClient } from "../../../../../client/client.js";
3
3
  import { type Theme, iconSize } from "../../../../core/design-system/index.js";
4
4
  import type {
@@ -15,6 +15,29 @@ import { ViewNFTsContent } from "./ViewNFTs.js";
15
15
  import { ViewTokensContent } from "./ViewTokens.js";
16
16
  import type { WalletDetailsModalScreen } from "./types.js";
17
17
 
18
+ /**
19
+ * @internal
20
+ */
21
+ export type AssetTabs = "token" | "nft";
22
+
23
+ const TokenTab = {
24
+ label: (
25
+ <span className="flex gap-2">
26
+ <CoinsIcon size={iconSize.sm} /> Tokens
27
+ </span>
28
+ ),
29
+ value: "Tokens",
30
+ };
31
+
32
+ const NftTab = {
33
+ label: (
34
+ <span className="flex gap-2">
35
+ <ImageIcon size={iconSize.sm} /> NFTs
36
+ </span>
37
+ ),
38
+ value: "NFTs",
39
+ };
40
+
18
41
  /**
19
42
  * @internal
20
43
  */
@@ -26,9 +49,29 @@ export function ViewAssets(props: {
26
49
  setScreen: (screen: WalletDetailsModalScreen) => void;
27
50
  client: ThirdwebClient;
28
51
  connectLocale: ConnectLocale;
52
+ assetTabs?: AssetTabs[];
29
53
  }) {
30
- const [activeTab, setActiveTab] = useState("Tokens");
31
54
  const { connectLocale } = props;
55
+ const options = useMemo(() => {
56
+ if (!props.assetTabs) {
57
+ return [TokenTab, NftTab];
58
+ }
59
+ if (!props.assetTabs.length) {
60
+ return [];
61
+ }
62
+ const tabs = [];
63
+ for (const item of props.assetTabs) {
64
+ if (item === "token") {
65
+ tabs.push(TokenTab);
66
+ } else if (item === "nft") {
67
+ tabs.push(NftTab);
68
+ }
69
+ }
70
+ return tabs;
71
+ }, [props.assetTabs]);
72
+
73
+ // Since `options` is now a dynamic value, the default active tab is set to the value of the first tab in `options`
74
+ const [activeTab, setActiveTab] = useState(options[0]?.value || "Tokens");
32
75
 
33
76
  return (
34
77
  <Container
@@ -52,28 +95,7 @@ export function ViewAssets(props: {
52
95
  }}
53
96
  >
54
97
  <Spacer y="md" />
55
- <Tabs
56
- options={[
57
- {
58
- label: (
59
- <span className="flex gap-2">
60
- <CoinsIcon size={iconSize.sm} /> Tokens
61
- </span>
62
- ),
63
- value: "Tokens",
64
- },
65
- {
66
- label: (
67
- <span className="flex gap-2">
68
- <ImageIcon size={iconSize.sm} /> NFTs
69
- </span>
70
- ),
71
- value: "NFTs",
72
- },
73
- ]}
74
- selected={activeTab}
75
- onSelect={setActiveTab}
76
- >
98
+ <Tabs options={options} selected={activeTab} onSelect={setActiveTab}>
77
99
  <Container
78
100
  scrollY
79
101
  style={{
package/src/rpc/rpc.ts CHANGED
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../client/client.js";
3
3
 
4
4
  import type { Chain } from "../chains/types.js";
5
5
  import { getRpcUrlForChain } from "../chains/utils.js";
6
+ import { stringify } from "../utils/json.js";
6
7
  import { type RpcRequest, fetchRpc, fetchSingleRpc } from "./fetch-rpc.js";
7
8
 
8
9
  const RPC_CLIENT_MAP = new WeakMap();
@@ -23,7 +24,7 @@ function getRpcClientMap(client: ThirdwebClient) {
23
24
  * @internal
24
25
  */
25
26
  function rpcRequestKey(request: RpcRequest): string {
26
- return `${request.method}:${JSON.stringify(request.params)}`;
27
+ return `${request.method}:${stringify(request.params)}`;
27
28
  }
28
29
 
29
30
  const DEFAULT_MAX_BATCH_SIZE = 100;
@@ -29,6 +29,11 @@ type DomainOverrides = {
29
29
  * @default "bundler.thirdweb.com"
30
30
  */
31
31
  bundler?: string;
32
+ /**
33
+ * The base URL for the analytics server.
34
+ * @default "c.thirdweb.com"
35
+ */
36
+ analytics?: string;
32
37
  };
33
38
 
34
39
  export const DEFAULT_RPC_URL = "rpc.thirdweb.com";
@@ -37,6 +42,7 @@ const DEFAULT_IN_APP_WALLET_URL = "embedded-wallet.thirdweb.com";
37
42
  const DEFAULT_PAY_URL = "pay.thirdweb.com";
38
43
  const DEFAULT_STORAGE_URL = "storage.thirdweb.com";
39
44
  const DEFAULT_BUNDLER_URL = "bundler.thirdweb.com";
45
+ const DEFAULT_ANALYTICS_URL = "c.thirdweb.com";
40
46
 
41
47
  let domains: { [k in keyof DomainOverrides]-?: string } = {
42
48
  rpc: DEFAULT_RPC_URL,
@@ -45,6 +51,7 @@ let domains: { [k in keyof DomainOverrides]-?: string } = {
45
51
  pay: DEFAULT_PAY_URL,
46
52
  storage: DEFAULT_STORAGE_URL,
47
53
  bundler: DEFAULT_BUNDLER_URL,
54
+ analytics: DEFAULT_ANALYTICS_URL,
48
55
  };
49
56
 
50
57
  /**
@@ -58,6 +65,7 @@ export const setThirdwebDomains = (DomainOverrides: DomainOverrides) => {
58
65
  pay: DomainOverrides.pay ?? DEFAULT_PAY_URL,
59
66
  storage: DomainOverrides.storage ?? DEFAULT_STORAGE_URL,
60
67
  bundler: DomainOverrides.bundler ?? DEFAULT_BUNDLER_URL,
68
+ analytics: DomainOverrides.analytics ?? DEFAULT_ANALYTICS_URL,
61
69
  };
62
70
  };
63
71
 
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
2
2
  import { MerkleTree } from "../../../merkletree/MerkleTree.js";
3
3
  import { upload } from "../../../storage/upload.js";
4
4
  import type { Hex } from "../../encoding/hex.js";
5
+ import { stringify } from "../../json.js";
5
6
  import { hashEntryERC1155 } from "./hash-entry-erc1155.js";
6
7
  import type {
7
8
  ShardDataERC1155,
@@ -54,7 +55,7 @@ export async function processSnapshotERC1155(options: {
54
55
  entries,
55
56
  };
56
57
  shardsToUpload.push({
57
- data: JSON.stringify(data),
58
+ data: stringify(data),
58
59
  name: `${shardId}.json`,
59
60
  });
60
61
  }
@@ -74,7 +75,7 @@ export async function processSnapshotERC1155(options: {
74
75
  // 6. Also upload the original entries for retrieving all entries
75
76
  const originalEntriesUri = await upload({
76
77
  client: options.client,
77
- files: [JSON.stringify(options.snapshot)],
78
+ files: [stringify(options.snapshot)],
78
79
  });
79
80
  // 7. assmeble the final sharded merkle tree info
80
81
  const shardedMerkleInfo: ShardedMerkleTreeInfo = {
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
2
2
  import { MerkleTree } from "../../../merkletree/MerkleTree.js";
3
3
  import { upload } from "../../../storage/upload.js";
4
4
  import type { Hex } from "../../encoding/hex.js";
5
+ import { stringify } from "../../json.js";
5
6
  import { hashEntryERC20 } from "./hash-entry-erc20.js";
6
7
  import type {
7
8
  ShardDataERC20,
@@ -56,7 +57,7 @@ export async function processSnapshotERC20(options: {
56
57
  entries,
57
58
  };
58
59
  shardsToUpload.push({
59
- data: JSON.stringify(data),
60
+ data: stringify(data),
60
61
  name: `${shardId}.json`,
61
62
  });
62
63
  }
@@ -76,7 +77,7 @@ export async function processSnapshotERC20(options: {
76
77
  // 6. Also upload the original entries for retrieving all entries
77
78
  const originalEntriesUri = await upload({
78
79
  client: options.client,
79
- files: [JSON.stringify(options.snapshot)],
80
+ files: [stringify(options.snapshot)],
80
81
  });
81
82
  // 7. assmeble the final sharded merkle tree info
82
83
  const shardedMerkleInfo: ShardedMerkleTreeInfo = {
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
2
2
  import { MerkleTree } from "../../../merkletree/MerkleTree.js";
3
3
  import { upload } from "../../../storage/upload.js";
4
4
  import type { Hex } from "../../encoding/hex.js";
5
+ import { stringify } from "../../json.js";
5
6
  import { hashEntryERC721 } from "./hash-entry-erc721.js";
6
7
  import type {
7
8
  ShardDataERC721,
@@ -54,7 +55,7 @@ export async function processSnapshotERC721(options: {
54
55
  entries,
55
56
  };
56
57
  shardsToUpload.push({
57
- data: JSON.stringify(data),
58
+ data: stringify(data),
58
59
  name: `${shardId}.json`,
59
60
  });
60
61
  }
@@ -74,7 +75,7 @@ export async function processSnapshotERC721(options: {
74
75
  // 6. Also upload the original entries for retrieving all entries
75
76
  const originalEntriesUri = await upload({
76
77
  client: options.client,
77
- files: [JSON.stringify(options.snapshot)],
78
+ files: [stringify(options.snapshot)],
78
79
  });
79
80
  // 7. assmeble the final sharded merkle tree info
80
81
  const shardedMerkleInfo: ShardedMerkleTreeInfo = {
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
3
3
  import { MerkleTree } from "../../../merkletree/MerkleTree.js";
4
4
  import { upload } from "../../../storage/upload.js";
5
5
  import type { Hex } from "../../encoding/hex.js";
6
+ import { stringify } from "../../json.js";
6
7
  import { hashEntry } from "./hash-entry.js";
7
8
  import type {
8
9
  OverrideEntry,
@@ -67,7 +68,7 @@ export async function processOverrideList(options: {
67
68
  entries,
68
69
  };
69
70
  shardsToUpload.push({
70
- data: JSON.stringify(data),
71
+ data: stringify(data),
71
72
  name: `${shardId}.json`,
72
73
  });
73
74
  }
@@ -87,7 +88,7 @@ export async function processOverrideList(options: {
87
88
  // 6. Also upload the original entries for retrieving all entries
88
89
  const originalEntriesUri = await upload({
89
90
  client: options.client,
90
- files: [JSON.stringify(options.overrides)],
91
+ files: [stringify(options.overrides)],
91
92
  });
92
93
  // 7. assmeble the final sharded merkle tree info
93
94
  const shardedMerkleInfo: ShardedMerkleTreeInfo = {
@@ -1,5 +1,6 @@
1
1
  import type { Account } from "../../wallets/interfaces/wallet.js";
2
2
  import { stringToBytes } from "../encoding/to-bytes.js";
3
+ import { stringify } from "../json.js";
3
4
  import { randomBytesHex } from "../random.js";
4
5
  import { uint8ArrayToBase64 } from "../uint8-array.js";
5
6
  import { PRECOMPILED_B64_ENCODED_JWT_HEADER } from "./jwt-header.js";
@@ -47,14 +48,13 @@ type EncodeJWTParams = { payload: JWTPayloadInput; account: Account };
47
48
  */
48
49
  export async function encodeJWT(options: EncodeJWTParams) {
49
50
  const payload = await ensureJWTPayload(options.payload);
50
- const message = JSON.stringify(payload);
51
+ const message = stringify(payload);
51
52
 
52
53
  const signature = await options.account.signMessage({ message });
53
54
 
54
- const encodedData = uint8ArrayToBase64(
55
- stringToBytes(JSON.stringify(payload)),
56
- { urlSafe: true },
57
- );
55
+ const encodedData = uint8ArrayToBase64(stringToBytes(message), {
56
+ urlSafe: true,
57
+ });
58
58
 
59
59
  const encodedSignature = uint8ArrayToBase64(stringToBytes(signature), {
60
60
  urlSafe: true,
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { TEST_CLIENT } from "~test/test-clients.js";
3
+ import { stringify } from "../json.js";
3
4
  import {
4
5
  type FetchTokenMetadataOptions,
5
6
  fetchTokenMetadata,
@@ -9,7 +10,7 @@ describe("fetchTokenMetadata", () => {
9
10
  it("should return a json object from a valid base64 encoded json", async () => {
10
11
  const validJson = { foo: "bar" };
11
12
  const validBase64Json = `data:application/json;base64,${btoa(
12
- JSON.stringify(validJson),
13
+ stringify(validJson),
13
14
  )}`;
14
15
 
15
16
  const options: FetchTokenMetadataOptions = {
@@ -1,3 +1,4 @@
1
+ import { stringify } from "../json.js";
1
2
  import type { AsyncStorage } from "./AsyncStorage.js";
2
3
 
3
4
  const CONNECT_PARAMS_MAP_KEY = "tw:connected-wallet-params";
@@ -39,7 +40,7 @@ export async function saveConnectParamsToStorage<T extends object>(
39
40
  };
40
41
  }
41
42
 
42
- storage.setItem(CONNECT_PARAMS_MAP_KEY, JSON.stringify(value));
43
+ storage.setItem(CONNECT_PARAMS_MAP_KEY, stringify(value));
43
44
  }
44
45
 
45
46
  /**
@@ -67,7 +68,7 @@ export async function deleteConnectParamsFromStorage(
67
68
  }
68
69
 
69
70
  delete value[walletId];
70
- storage.setItem(CONNECT_PARAMS_MAP_KEY, JSON.stringify(value));
71
+ storage.setItem(CONNECT_PARAMS_MAP_KEY, stringify(value));
71
72
  }
72
73
  }
73
74
 
@@ -100,7 +101,7 @@ export async function getSavedConnectParamsFromStorage<T extends object>(
100
101
 
101
102
  function isStringifiable(value: unknown): boolean {
102
103
  try {
103
- JSON.stringify(value);
104
+ stringify(value);
104
105
  return true;
105
106
  } catch {
106
107
  return false;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.64.6-nightly-f40d2474e6cc1227a8d05151210ef4793beb6142-20241101000357";
1
+ export const version = "5.65.0-nightly-06604162a11d99ff119bbf427a24b9a7d82c1575-20241103000408";
@@ -307,6 +307,7 @@ function createAccount({
307
307
 
308
308
  trackTransaction({
309
309
  client: client,
310
+ chainId: tx.chainId,
310
311
  walletAddress: getAddress(address),
311
312
  walletType: COINBASE,
312
313
  transactionHash,
@@ -1,5 +1,6 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { getClientFetch } from "../../../../utils/fetch.js";
3
+ import { stringify } from "../../../../utils/json.js";
3
4
  import { ROUTE_AUTH_ENDPOINT_CALLBACK } from "../../native/helpers/constants.js";
4
5
  import { createErrorMessage } from "../../native/helpers/errors.js";
5
6
  import type { Ecosystem } from "../wallet/types.js";
@@ -17,7 +18,7 @@ export async function authEndpoint(args: {
17
18
  headers: {
18
19
  "Content-Type": "application/json",
19
20
  },
20
- body: JSON.stringify({
21
+ body: stringify({
21
22
  payload: args.payload,
22
23
  developerClientId: args.client.clientId,
23
24
  }),
@@ -1,5 +1,6 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { getClientFetch } from "../../../../utils/fetch.js";
3
+ import { stringify } from "../../../../utils/json.js";
3
4
  import { randomBytesHex } from "../../../../utils/random.js";
4
5
  import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
5
6
  import type { Ecosystem } from "../wallet/types.js";
@@ -39,7 +40,7 @@ export async function guestAuthenticate(args: {
39
40
  headers: {
40
41
  "Content-Type": "application/json",
41
42
  },
42
- body: JSON.stringify({
43
+ body: stringify({
43
44
  sessionId,
44
45
  }),
45
46
  });
@@ -1,5 +1,6 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { getClientFetch } from "../../../../utils/fetch.js";
3
+ import { stringify } from "../../../../utils/json.js";
3
4
  import { ROUTE_AUTH_JWT_CALLBACK } from "../../native/helpers/constants.js";
4
5
  import { createErrorMessage } from "../../native/helpers/errors.js";
5
6
  import type { Ecosystem } from "../wallet/types.js";
@@ -17,7 +18,7 @@ export async function customJwt(args: {
17
18
  headers: {
18
19
  "Content-Type": "application/json",
19
20
  },
20
- body: JSON.stringify({
21
+ body: stringify({
21
22
  jwt: args.jwt,
22
23
  developerClientId: args.client.clientId,
23
24
  }),
@@ -1,6 +1,7 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
3
3
  import { getClientFetch } from "../../../../utils/fetch.js";
4
+ import { stringify } from "../../../../utils/json.js";
4
5
  import type { Ecosystem } from "../wallet/types.js";
5
6
  import type { ClientScopedStorage } from "./client-scoped-storage.js";
6
7
  import type { Profile } from "./types.js";
@@ -40,7 +41,7 @@ export async function linkAccount({
40
41
  {
41
42
  method: "POST",
42
43
  headers,
43
- body: JSON.stringify({
44
+ body: stringify({
44
45
  accountAuthTokenToConnect: tokenToLink,
45
46
  }),
46
47
  },
@@ -1,6 +1,7 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
3
3
  import { getClientFetch } from "../../../../utils/fetch.js";
4
+ import { stringify } from "../../../../utils/json.js";
4
5
  import type { Ecosystem } from "../wallet/types.js";
5
6
  import type { ClientScopedStorage } from "./client-scoped-storage.js";
6
7
  import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
@@ -96,7 +97,7 @@ export async function registerPasskey(options: {
96
97
  "Content-Type": "application/json",
97
98
  ...customHeaders,
98
99
  },
99
- body: JSON.stringify({
100
+ body: stringify({
100
101
  type: "sign-up",
101
102
  authenticatorData: registration.authenticatorData,
102
103
  credentialId: registration.credentialId,
@@ -166,7 +167,7 @@ export async function loginWithPasskey(options: {
166
167
  "Content-Type": "application/json",
167
168
  ...customHeaders,
168
169
  },
169
- body: JSON.stringify({
170
+ body: stringify({
170
171
  type: "sign-in",
171
172
  authenticatorData: authentication.authenticatorData,
172
173
  credentialId: authentication.credentialId,
@@ -3,6 +3,7 @@ import type { LoginPayload } from "../../../../auth/core/types.js";
3
3
  import type { Chain } from "../../../../chains/types.js";
4
4
  import type { ThirdwebClient } from "../../../../client/client.js";
5
5
  import { getClientFetch } from "../../../../utils/fetch.js";
6
+ import { stringify } from "../../../../utils/json.js";
6
7
  import type { Wallet } from "../../../interfaces/wallet.js";
7
8
  import type { Ecosystem } from "../wallet/types.js";
8
9
  import { getLoginCallbackUrl, getLoginUrl } from "./getLoginPath.js";
@@ -50,7 +51,7 @@ export async function siweAuthenticate(args: {
50
51
  headers: {
51
52
  "Content-Type": "application/json",
52
53
  },
53
- body: JSON.stringify({
54
+ body: stringify({
54
55
  signature,
55
56
  payload,
56
57
  }),
@@ -202,6 +202,7 @@ export class EnclaveWallet implements IWebWallet {
202
202
  trackTransaction({
203
203
  client,
204
204
  ecosystem,
205
+ chainId: tx.chainId,
205
206
  walletAddress: address,
206
207
  walletType: "inApp",
207
208
  transactionHash,
@@ -2,6 +2,7 @@ import { trackConnect } from "../../../../analytics/track/connect.js";
2
2
  import type { Chain } from "../../../../chains/types.js";
3
3
  import { getCachedChainIfExists } from "../../../../chains/utils.js";
4
4
  import type { ThirdwebClient } from "../../../../client/client.js";
5
+ import { stringify } from "../../../../utils/json.js";
5
6
  import { getEcosystemInfo } from "../../../ecosystem/get-ecosystem-wallet-auth-options.js";
6
7
  import type { Account, Wallet } from "../../../interfaces/wallet.js";
7
8
  import { createWalletEmitter } from "../../../wallet-emitter.js";
@@ -22,7 +23,7 @@ export async function getOrCreateInAppWalletConnector(
22
23
  connectorFactory: (client: ThirdwebClient) => Promise<InAppConnector>,
23
24
  ecosystem?: Ecosystem,
24
25
  ) {
25
- const key = JSON.stringify({ clientId: client.clientId, ecosystem });
26
+ const key = stringify({ clientId: client.clientId, ecosystem });
26
27
  if (connectorCache.has(key)) {
27
28
  return connectorCache.get(key) as InAppConnector;
28
29
  }
@@ -1,6 +1,7 @@
1
1
  import type { ThirdwebClient } from "../../../../../client/client.js";
2
2
  import type { Hex } from "../../../../../utils/encoding/hex.js";
3
3
  import { getClientFetch } from "../../../../../utils/fetch.js";
4
+ import { stringify } from "../../../../../utils/json.js";
4
5
  import { randomBytesHex } from "../../../../../utils/random.js";
5
6
  import type { ClientScopedStorage } from "../../../core/authentication/client-scoped-storage.js";
6
7
  import type { UserDetailsApiType } from "../../../core/authentication/types.js";
@@ -35,7 +36,7 @@ export const verifyClientId = async (client: ThirdwebClient) => {
35
36
  headers: {
36
37
  ...getSessionHeaders(),
37
38
  },
38
- body: JSON.stringify({ clientId: client.clientId, parentDomain: "" }),
39
+ body: stringify({ clientId: client.clientId, parentDomain: "" }),
39
40
  });
40
41
  if (!resp.ok) {
41
42
  const error = await resp.json();
@@ -155,7 +156,7 @@ export async function storeUserShares({
155
156
  props: {
156
157
  method: "POST",
157
158
  headers: { "Content-Type": "application/json" },
158
- body: JSON.stringify({
159
+ body: stringify({
159
160
  walletAddress,
160
161
  maybeEncryptedRecoveryShares,
161
162
  authShare,
@@ -168,7 +169,7 @@ export async function storeUserShares({
168
169
  const error = await resp.json();
169
170
 
170
171
  throw new Error(
171
- `Something went wrong storing user wallet shares: ${JSON.stringify(
172
+ `Something went wrong storing user wallet shares: ${stringify(
172
173
  error.message,
173
174
  null,
174
175
  2,
@@ -193,7 +194,7 @@ export async function getUserShares(args: {
193
194
  if (!resp.ok) {
194
195
  const error = await resp.json();
195
196
  throw new Error(
196
- `Something went wrong getting user's wallet: ${JSON.stringify(
197
+ `Something went wrong getting user's wallet: ${stringify(
197
198
  error.message,
198
199
  null,
199
200
  2,
@@ -1,3 +1,5 @@
1
+ import { stringify } from "../../../../utils/json.js";
2
+
1
3
  export const ErrorMessages = {
2
4
  invalidOtp:
3
5
  "Your OTP code is invalid or expired. Please request a new code or try again.",
@@ -8,5 +10,5 @@ export const createErrorMessage = (message: string, error: unknown): string => {
8
10
  if (error instanceof Error) {
9
11
  return `${message}: ${error.message}`;
10
12
  }
11
- return `${message}: ${JSON.stringify(error)}`;
13
+ return `${message}: ${stringify(error)}`;
12
14
  };
@@ -1,4 +1,5 @@
1
1
  import AsyncStorage from "@react-native-async-storage/async-storage";
2
+ import { stringify } from "../../../../../utils/json.js";
2
3
  import {
3
4
  DEVICE_SHARE_LOCAL_STORAGE_NAME,
4
5
  WALLET_USER_DETAILS_LOCAL_STORAGE_NAME,
@@ -65,7 +66,7 @@ export async function setWallerUserDetails({
65
66
  await setItemInAsyncStorage(
66
67
  // ! Keep this in sync with getWalletUserDetails function below
67
68
  name,
68
- JSON.stringify({ userId, email: newEmail }),
69
+ stringify({ userId, email: newEmail }),
69
70
  );
70
71
  }
71
72